[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/template/templatesets/ -> templateset.class.php (source)

   1  <?php
   2  
   3      
   4      lt_include( PLOG_CLASS_PATH."class/file/file.class.php" );
   5      
   6      define( "TEMPLATE_SET_GLOBAL", 1 );
   7      define( "TEMPLATE_SET_BLOG_SPECIFIC", 2 );
   8  
   9      /**
  10       * \ingroup Template
  11       *
  12       * abstraction for a template set
  13       */
  14      class TemplateSet 
  15      {
  16          var $_name;
  17          var $_type;
  18          var $_blogId;
  19      
  20          /**
  21           * constructor
  22           *
  23           * @param name The name of the template set, does not need to be unique
  24           * @param type TEMPLATE_SET_GLOBAL for global templates and TEMPLATE_SET_BLOG_SPECIFIC
  25           * for blog-specific templates
  26           * @param blogId The blog to whom this template belongs, or 0 if it's global. 
  27           */
  28  		function TemplateSet( $name, $type, $blogId = 0)
  29          {
  30              
  31              
  32              $this->_name = $name;
  33              $this->_type = $type;
  34              $this->_blogId = $blogId;
  35          }
  36          
  37          /**
  38           * @return the name of the template set
  39           */
  40  		function getName()
  41          {
  42              return $this->_name;
  43          }
  44          
  45          /**
  46           * returns wether the template is global or blog-specific
  47           *
  48           * @return returns TEMPLATE_SET_GLOBAL if the template is global or
  49           * TEMPLATE_SET_BLOG_SPECIFIC is the template is blog-specific
  50           */
  51  		function getType()
  52          {
  53              return $this->_type;
  54          }
  55          
  56          /**
  57           * @return returns true if the template is global
  58           */
  59  		function isGlobal()
  60          {
  61              return( $this->getType() == TEMPLATE_SET_GLOBAL );
  62          }
  63          
  64          /**
  65           * @return Returns true if the template is blog-specific
  66           */
  67  		function isBlogSpecific()
  68          {
  69              return( $this->getType() == TEMPLATE_SET_BLOG_SPECIFIC );
  70          }
  71          
  72          /**
  73           * @return Returns the blog id of the blog to whom this blog belongs, or
  74           * 0 if the template is global
  75           */
  76  		function getBlogId()
  77          {
  78              return( $this->_blogId );
  79          }
  80          
  81          /**
  82           * returns true if the template set has an screenshot available
  83           *
  84           * @return true if screenshot available or false otherwise
  85           */
  86  		function hasScreenshot()
  87          {
  88              // check if the file screenshot.jpg is available in disk
  89              $ts = new TemplateSetStorage();
  90              return $ts->isScreenshotAvailable( $this->getName(), $this->getBlogId());
  91          }
  92          
  93          /**
  94           * calculates and returns the full path to the screenshot of the template set
  95           * regardless of whether it is global or blog specific
  96           *
  97           * @return The url to the screenshot
  98           */
  99  		function getScreenshotUrl()
 100          {
 101              $ts = new TemplateSetStorage();
 102              return $ts->getScreenshotUrl( $this->getName(), $this->getBlogId());
 103          }
 104      }
 105  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics