[ 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/dao/ -> globalarticlecategory.class.php (source)

   1  <?php
   2  
   3      lt_include( PLOG_CLASS_PATH."class/database/dbobject.class.php" );
   4      lt_include( PLOG_CLASS_PATH."class/dao/articlestatus.class.php" );
   5  
   6      /**
   7       * \ingroup DAO
   8       *
   9       * Represents a global blog category.
  10       */
  11      class GlobalArticleCategory extends DbObject 
  12      {
  13      
  14          var $_id;
  15          var $_name;
  16          var $_description;
  17          var $_properties;
  18          var $_mangledName;
  19          var $_numArticles;
  20          var $_numActiveArticles;
  21  
  22  		function GlobalArticleCategory( $name, $description = "", $properties = Array(), $id = -1 )
  23          {
  24              $this->DbObject();
  25          
  26              $this->_id = $id;
  27              $this->_name = $name;
  28              $this->_description = $description;
  29              $this->_properties = $properties;
  30              $this->_numArticles = 0;
  31              $this->_numActiveArticles = 0;
  32              $this->_mangledName = "";
  33              
  34              $this->_pk = "id";
  35              $this->_fields = Array( "id" => "getId",
  36                                      "name" => "getName",
  37                                      "description" => "getDescription",
  38                                      "properties" => "getProperties",
  39                                      "num_articles" => "getNumArticles",
  40                                      "num_active_articles" => "getNumActiveArticles",
  41                                      "mangled_name" => "getMangledName" );
  42          }
  43  
  44          /**
  45           * @private
  46           */
  47  		function setId( $newId )
  48          {
  49              $this->_id = $newId;
  50          }
  51  
  52          /**
  53           * @private
  54           */
  55  		function setName( $newName )
  56          {
  57              $this->_name = $newName;
  58          }
  59                  
  60          /**
  61           * sets the description
  62           *
  63           * @param description
  64           */
  65  		function setDescription( $desc )
  66          {
  67              $this->_description = $desc;
  68          }
  69  
  70          /**
  71           * Returns the identifier assigned to this category.
  72           *
  73           * @return An integer value with the category number.
  74           */
  75  		function getId()
  76          {
  77              return $this->_id;
  78          }
  79  
  80          /**
  81           * Returns the name assigned to the category.
  82           *
  83           * @return A string value with the name assigned to the category.
  84           */
  85  		function getName()
  86          {
  87              return $this->_name;
  88          }
  89  
  90          /**
  91           * Returns how many articles have been categorized under this category.
  92           *
  93           * @param status A valid post status
  94           * @return An integer value
  95           */
  96          function getNumArticles( $status = POST_STATUS_ALL )        
  97          {
  98              if( $status == POST_STATUS_ALL )
  99                  return( $this->_numArticles );
 100              elseif( $status == POST_STATUS_PUBLISHED )
 101                  return( $this->_numActiveArticles );
 102              else {
 103                  lt_include( PLOG_CLASS_PATH."class/dao/globalarticlecategories.class.php" );            
 104                  $categories = new GlobalArticleCategories();
 105                  return( $categories->getNumArticlesCategory( $this->getId(), $status ));
 106              }
 107          }
 108          
 109          function setNumArticles( $numArticles )
 110          {
 111              $this->_numArticles = $numArticles;
 112          }
 113          
 114          function getNumActiveArticles()
 115          {
 116              return( $this->_numActiveArticles );
 117          }
 118          
 119          function setNumActiveArticles( $numActiveArticles )
 120          {
 121              $this->_numActiveArticles = $numActiveArticles;
 122          }
 123          
 124          /**
 125           * returns the description
 126           *
 127           * @return The description
 128           */
 129  		function getDescription()
 130          {
 131              return $this->_description;
 132          }
 133          
 134          /**
 135           * @private
 136           * For future use
 137           */
 138  		function getProperties()
 139          {
 140              return( $this->_properties );
 141          }    
 142          
 143  		function setMangledName( $mangledName )
 144          {
 145              $this->_mangledName = $mangledName;
 146          }
 147          
 148  		function getMangledName()
 149          {
 150              if( $this->_mangledName == "" ) {
 151                  lt_include( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
 152                  $this->_mangledName = Textfilter::urlize( $this->getName() );
 153              }
 154              
 155              return( $this->_mangledName );
 156          }
 157      }
 158  ?>


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