[ 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/ -> mylink.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/mylinkscategory.class.php" );
   5  
   6      /**
   7       * \ingroup DAO
   8       *
   9       * Represents one of the links that can be created for each blog. The basic information this
  10       * object holds is the description, the name, the url and the link category to which they belong.
  11       */
  12      class MyLink extends DbObject 
  13      {
  14  
  15          var $_id;
  16          var $_blogId;
  17          var $_description;
  18          var $_name;
  19          var $_url;
  20          var $_categoryId;
  21          var $_category;
  22          var $_date;
  23          var $_rssFeed;
  24  
  25          /**
  26           * Constructor.
  27           *
  28           * @param description Description of the link
  29           * @param url URL assigned to the link
  30           * @param blogId Identifier of the blog
  31           * @param categoryId Category of the link
  32           * @param id Internal idenfitier of the link
  33           */
  34  		function MyLink( $name, $description, $url, $blogId, $categoryId, $date = '', $rssFeed, $properties = Array(), $id = -1)
  35          {
  36              $this->DbObject();
  37  
  38              $this->_name = $name;
  39              $this->_description = $description;
  40              $this->_url  = $url;
  41              $this->_blogId = $blogId;
  42              $this->_categoryId = $categoryId;
  43              $this->_id = $id;
  44              $this->_rssFeed = $rssFeed;
  45              if( $date == "" ) {
  46                  lt_include( PLOG_CLASS_PATH."class/data/Date.class.php" );                
  47                  $dateObject = new Date();
  48                  $date = $dateObject->getDate();
  49              }
  50              $this->setDate( $date );
  51              $this->setProperties( $properties );
  52              
  53              $this->_pk = "id";
  54              $this->_fields = Array(
  55                 "category_id" => "getCategoryId",
  56                 "url" => "getUrl",
  57                 "name" => "getName",
  58                 "description" => "getDescription",
  59                 "blog_id" => "getBlogId",
  60                 "rss_feed" => "getRssFeed",
  61                 "date" => "getDate",
  62                 "properties" => "getProperties"
  63              );
  64          }
  65  
  66          /**
  67           * @private
  68           */
  69          function setName( $name )
  70          {
  71              $this->_name = $name;
  72          }
  73  
  74          /**
  75           * @private
  76           */
  77  		function setId( $newId )
  78          {
  79              $this->_id = $newId;
  80          }
  81  
  82          /**
  83           * @private
  84           */
  85  		function setBlogId( $newBlogId )
  86          {
  87              $this->_blogId = $newBlogId;
  88          }
  89  
  90          /**
  91           * @private
  92           */
  93  		function setDescription( $newText )
  94          {
  95              $this->_description = $newText;
  96          }
  97  
  98          /**
  99           * @private
 100           */
 101  		function setUrl( $newURL )
 102          {
 103              $this->_url = $newURL;
 104          }
 105  
 106          /**
 107           * @private
 108           */
 109          function setCategoryId( $categoryId )
 110          {
 111              $this->_categoryId = $categoryId;
 112          }
 113  
 114          /**
 115           * Returns the name that was given to this link.
 116           *
 117           * @return A string value with the name.
 118           */
 119          function getName()
 120          {
 121              return $this->_name;
 122          }
 123  
 124          /**
 125           * Returns the identifier that this link has in the database.
 126           *
 127           * @return An integer value.
 128           */
 129  		function getId()
 130          {
 131              return $this->_id;
 132          }
 133  
 134          /**
 135           * Returns the identifier of the blog to which this link belongs.
 136           *
 137           * @return An integer value.
 138           */
 139  		function getBlogId()
 140          {
 141              return $this->_blogId;
 142          }
 143  
 144          /**
 145           * Returns the description assigned to this link.
 146           *
 147           * @return An string with the description.
 148           */
 149          function getDescription()
 150          {
 151              return $this->_description;
 152          }
 153  
 154          /**
 155           * Returns the url to which this link is pointing. Wouldn't be a link
 156           * without a url, huh? :)
 157           *
 158           * @return A string representing the url.
 159           */
 160  		function getUrl()
 161          {
 162              return $this->_url;
 163          }
 164  
 165          /**
 166           * The link category identifier this link has been filed under.
 167           *
 168           * @return An integer value.
 169           */
 170          function getCategoryId()
 171          {
 172              return $this->_categoryId;
 173          }
 174          
 175          function setDate( $newDate )
 176          {
 177              lt_include( PLOG_CLASS_PATH."class/data/timestamp.class.php" );
 178  
 179              $this->_date = $newDate;
 180              $this->_timestamp = new Timestamp( $newDate );
 181          }
 182          
 183          function getMyLinkCategory()
 184          {        
 185              if( !$this->_category ) {
 186                  lt_include( PLOG_CLASS_PATH."class/dao/mylinkscategories.class.php" );
 187                  $categories = new MyLinksCategories();
 188                  $this->_category = $categories->getMyLinksCategory( $this->getCategoryId());
 189              }            
 190              
 191              return( $this->_category );
 192          }
 193          
 194          function getDate()
 195          {
 196              return $this->_date;
 197          }
 198          
 199          function getDateObject()
 200          {
 201              return $this->_timestamp;
 202          }
 203          
 204  		function getRssFeed()
 205          {
 206              return $this->_rssFeed;
 207          }
 208          
 209  		function setRssFeed( $rssFeed ) 
 210          {
 211              $this->_rssFeed = $rssFeed;
 212          }
 213  }
 214  ?>


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