| [ Index ] |
|
Code source de LifeType 1.2.4 |
1 <?php 2 lt_include( PLOG_CLASS_PATH."class/database/dbobject.class.php" ); 3 4 /** 5 * \ingroup DAO 6 * 7 * Cache Object to cache all links of a blog, this information will not be stored in the db 8 * but only in the disk-cache. 9 */ 10 class BlogLinks { 11 12 var $_blogId; 13 var $_links = array(); 14 var $_linksById = array(); 15 var $_categories = array(); 16 17 /** 18 * Constructor 19 * 20 * @param blogId The blogId of the links to fetch 21 * @links array containing link objects 22 */ 23 function BlogLinks( $blogId, $blogLinks ) 24 { 25 $this->_blogId = $blogId; 26 27 foreach ($blogLinks as $link) { 28 $this->_links[] = $link; 29 $this->_linksById[$link->getId()] = $link; 30 $this->_categories[$link->getCategoryId()][] = $link; 31 } 32 } 33 34 /** 35 * Get the BlogId for the links stored in this object 36 */ 37 function getBlogId() 38 { 39 return $this->_blogId; 40 } 41 42 /** 43 * Get all Links for current blog 44 */ 45 function getLinks() 46 { 47 return $this->_links; 48 } 49 50 /** 51 * Get Links for a specific category, use categoryId = 0 to get all links. 52 * 53 * @param categoryId Category of the links to get 54 * @return array of link objects 55 */ 56 57 function getLinksForCategory( $categoryId ) 58 { 59 if ( $categoryId == 0 ) 60 return $this->getLinks(); 61 elseif ( is_array( $this->_categories[$categoryId] ) ) 62 return $this->_categories[$categoryId]; 63 else 64 return array(); 65 } 66 67 /** 68 * Get specific link of current blog 69 * 70 * :TODO: this method is not yet used, we might change a few admin panels to use this method 71 * instead of myLinks->getMyLink(). 72 * (2005-05-22 ork@devel.plogworld.net) 73 * 74 * @param linkId The id of the link to get 75 * @return link object of false 76 */ 77 78 function getLink( $linkId ) 79 { 80 if ( isset($this->_links[$linkId]) ) 81 return $this->_links[$linkId]; 82 else 83 return false; 84 } 85 } 86 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Mon Nov 26 21:04:15 2007 | par Balluche grâce à PHPXref 0.7 |
|