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

   1  <?php
   2  
   3      lt_include( PLOG_CLASS_PATH."class/database/dbobject.class.php" );
   4  
   5      /**
   6       * \ingroup DAO
   7       * 
   8       * The links one can add to a blog can also be filed under different categories. This object
   9       * are the abstraction of those categories and offer methods to check the value of some of
  10       * its attributes.
  11       */
  12      class MyLinksCategory extends DbObject 
  13      {
  14  
  15          var $_id;
  16          var $_name;
  17          var $_blogId;
  18          var $_numLinks;
  19          var $_lastModification;
  20  
  21          /**
  22           * Constructor.
  23           *
  24           * @param name Name of the category
  25           * @param blogId Identifier of the blog to which it belongs
  26           * @param id Identifier of the link
  27           */
  28          function MyLinksCategory( $name, $blogId, $numLinks = 0, $properties = Array(), $id = -1 )
  29          {
  30              lt_include( PLOG_CLASS_PATH."class/data/timestamp.class.php" );
  31  
  32              $this->DbObject();
  33  
  34              $this->_name = $name;
  35              $this->_blogId = $blogId;
  36              $this->_numLinks = $numLinks;
  37              $this->_id = $id;
  38              $this->setProperties( $properties );
  39              $this->_lastModification = new Timestamp();
  40              $this->_links = null;
  41              $this->_numLinks = 0;
  42              
  43              $this->_pk = "id";
  44              $this->_fields = Array(
  45                 "name" => "getName",
  46                 "blog_id" => "getBlogId",
  47                 "last_modification" => "getLastModification",
  48                 "properties" => "getProperties",
  49                 "num_links" => "getNumLinks"
  50              );
  51          }
  52  
  53          /**
  54           * Returns the identifier assigned to this category in the database.
  55           *
  56           * @return The identifier assigned to this category in the database.
  57           */
  58          function getId()
  59          {
  60              return $this->_id;
  61          }
  62  
  63          /**
  64           * Returns the name given to this category.
  65           *
  66           * @return A string representing the name of this category.
  67           */
  68          function getName()
  69          {
  70              return $this->_name;
  71          }
  72  
  73          /**
  74           * Returns the identifier to which this this link category belongs.
  75           *
  76           * @return An integer value.
  77           */
  78          function getBlogId()
  79          {
  80              return $this->_blogId;
  81          }
  82  
  83          /**
  84           * @private
  85           */
  86          function setId( $id )
  87          {
  88              $this->_id = $id;
  89          }
  90  
  91          /**
  92           * @private
  93           */
  94          function setName( $name )
  95          {
  96              $this->_name = $name;
  97          }
  98  
  99          /**
 100           * @private
 101           */
 102          function setBlogId( $blogId )
 103          {
 104              $this->_blogId = $blogId;
 105          }
 106  
 107          /**
 108           * Returns how many links have been categorized under this category.
 109           *
 110           * @return Number of links.
 111           */
 112          function getNumLinks()
 113          {
 114              return $this->_numLinks;
 115          }
 116  
 117          /**
 118           * sets the links
 119           *
 120           * @param $links
 121           * @return True
 122           */
 123          function setLinks( $links )
 124          {
 125              $this->_links = $links;
 126          }
 127          
 128          /**
 129           * adds a link to the category
 130           *
 131           * @param link A MyLink object
 132           * @return nothing
 133           */
 134  		function addLink( $link )
 135          {
 136              $this->_links[] = $link;
 137          }
 138  
 139          /**
 140           * Returns an array of MyLink objects
 141           *
 142           * @return Array of MyLink object
 143           */
 144          function getLinks()
 145          {
 146              if( $this->_links === null ) {
 147                  $myLinks = new MyLinks();
 148                  $categoryLinks = $myLinks->getLinks( $this->getBlogId(), $this->getId());
 149                  $this->setLinks( $categoryLinks );            
 150              }
 151              
 152              return $this->_links;
 153          }
 154          
 155          /**
 156           * sets the last modification date
 157           *
 158           * @param date
 159           * @return nothing
 160           */
 161  		function setLastModification( $date )
 162          {
 163              $this->_lastModification = $date;
 164          }
 165          
 166          /**
 167           * returns the last modification date
 168           *
 169           * @return A Timestamp object
 170           */
 171  		function getLastModification()
 172          {
 173              return $this->_lastModification;
 174          }
 175          
 176  		function setNumLinks( $numLinks )
 177          {
 178              $this->_numLinks = $numLinks;
 179          }        
 180      }
 181  ?>


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