[ 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/ -> blogcategory.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/blogstatus.class.php" );
   5  
   6      /**
   7       * \ingroup DAO
   8       *
   9       * Represents a global blog category
  10       */
  11      class BlogCategory extends DbObject 
  12      {
  13      
  14          var $_id;
  15          var $_name;
  16          var $_description;
  17          var $_properties;
  18          var $_mangledName;
  19          var $_numBlogs;
  20          var $_numActiveBlogs;
  21  
  22  		function BlogCategory( $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->_numBlogs = 0;
  31              $this->_numActiveBlogs = 0;
  32              
  33              $this->_pk = "id";
  34              $this->_fields = Array( "id" => "getId",
  35                                      "name" => "getName",
  36                                      "description" => "getDescription",
  37                                      "properties" => "getProperties",
  38                                      "num_blogs" => "getNumBlogs",
  39                                      "num_active_blogs" => "getNumActiveBlogs",
  40                                      "mangled_name" => "getMangledName" );
  41          }
  42  
  43          /**
  44           * @private
  45           */
  46  		function setId( $newId )
  47          {
  48              $this->_id = $newId;
  49          }
  50  
  51          /**
  52           * @private
  53           */
  54  		function setName( $newName )
  55          {
  56              $this->_name = $newName;
  57          }
  58                  
  59          /**
  60           * sets the description
  61           *
  62           * @param description
  63           */
  64  		function setDescription( $desc )
  65          {
  66              $this->_description = $desc;
  67          }
  68  
  69          /**
  70           * Returns the identifier assigned to this category.
  71           *
  72           * @return An integer value with the category number.
  73           */
  74  		function getId()
  75          {
  76              return $this->_id;
  77          }
  78  
  79          /**
  80           * Returns the name assigned to the category.
  81           *
  82           * @return A string value with the name assigned to the category.
  83           */
  84  		function getName()
  85          {
  86              return $this->_name;
  87          }
  88  
  89          /**
  90           * Returns how many articles have been categorized under this category.
  91           *
  92           * @param status A valid post status
  93           * @return An integer value
  94           */
  95          function getNumBlogs( $status = BLOG_STATUS_ACTIVE )        
  96          {
  97              if( $status == BLOG_STATUS_ALL )
  98                  return( $this->_numBlogs );
  99              elseif( $status == BLOG_STATUS_ACTIVE )
 100                  return( $this->_numActiveBlogs );
 101              else {
 102                  lt_include( PLOG_CLASS_PATH."class/dao/blogcategories.class.php" );            
 103                  $categories = new BlogCategories();
 104                  return( $categories->getNumBlogsCategory( $this->getId(), $status ));
 105              }
 106          }
 107          
 108          function setNumBlogs( $numBlogs )
 109          {
 110              $this->_numBlogs = $numBlogs;
 111              if( $this->_numBlogs < 0 ) 
 112                  $this->_numBlogs = 0;
 113          }
 114          
 115          function getNumActiveBlogs()
 116          {
 117              return( $this->getNumBlogs( BLOG_STATUS_ACTIVE ));
 118          }
 119          
 120          function setNumActiveBlogs( $numActiveBlogs )
 121          {
 122              $this->_numActiveBlogs = $numActiveBlogs;
 123              if( $this->_numActiveBlogs < 0 )
 124                  $this->_numActiveBlogs = 0;
 125          }
 126          
 127          /**
 128           * returns a list with all the blogs that have been categorized under this category
 129           *
 130           * @return An Array of BlogInfo objects
 131           */
 132  		function getBlogs( $status = BLOG_STATUS_ACTIVE )
 133          {        
 134          }
 135          
 136          /**
 137           * returns the description
 138           *
 139           * @return The description
 140           */
 141  		function getDescription()
 142          {
 143              return $this->_description;
 144          }
 145          
 146          /**
 147           * @private
 148           * For future use
 149           */
 150  		function getProperties()
 151          {
 152              return( $this->_properties );
 153          }
 154  
 155  		function setMangledName( $mangledName )
 156          {
 157              $this->_mangledName = $mangledName;
 158          }
 159          
 160  		function getMangledName()
 161          {
 162              if( $this->_mangledName == "" ) {
 163                  lt_include( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
 164                  $this->_mangledName = Textfilter::urlize( $this->getName() );
 165              }
 166              
 167              return( $this->_mangledName );
 168          }        
 169      }
 170  ?>


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