[ Index ] |
|
Code source de LifeType 1.2.4 |
1 <?php 2 3 lt_include( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" ); 4 lt_include( PLOG_CLASS_PATH."class/data/pager/pager.class.php" ); 5 lt_include( PLOG_CLASS_PATH."class/dao/blogs.class.php" ); 6 7 /** 8 * \ingroup View 9 * @private 10 * 11 * shows a list with all the blogs from the site 12 */ 13 class AdminSiteBlogsListView extends AdminTemplatedView 14 { 15 var $_page; 16 var $_status; 17 var $_searchTerms; 18 var $_pagerUrl; 19 20 function AdminSiteBlogsListView( $blogInfo ) 21 { 22 $this->_pagerUrl = "?op=editSiteBlogs"; 23 if( $this->_templateName == "" ) 24 $this->_templateName = "siteblogs"; 25 $this->AdminTemplatedView( $blogInfo, $this->_templateName ); 26 27 $this->_page = $this->getCurrentPageFromRequest(); 28 } 29 30 /** 31 * retrieves the current status from the request 32 * 33 * @private 34 * @return nothing 35 */ 36 function getStatusFromRequest() 37 { 38 $status = HttpVars::getRequestValue( "status" ); 39 40 // validate the value 41 $val = new IntegerValidator(); 42 if( !$val->validate( $status )) 43 $status = BlogStatus::getDefaultStatus(); 44 45 // if the value validated, check if it is a valid status 46 if( !BlogStatus::isValidStatus( $status )) 47 $status = BlogStatus::getDefaultStatus(); 48 49 return $status; 50 } 51 52 function render() 53 { 54 // we need to get all the blogs 55 // get the data itself 56 $this->_status = $this->getStatusFromRequest(); 57 $this->_searchTerms = HttpVars::getRequestValue( "searchTerms" ); 58 $blogs = new Blogs(); 59 $siteBlogs = $blogs->getAllBlogs( $this->_status, ALL_BLOG_CATEGORIES, $this->_searchTerms, $this->_page, DEFAULT_ITEMS_PER_PAGE ); 60 // print("search terms = ".$this->_searchTerms); 61 $numBlogs = $blogs->getNumBlogs( $this->_status, ALL_BLOG_CATEGORIES, $this->_searchTerms ); 62 if( !$siteBlogs ) { 63 $siteBlogs = Array(); 64 } 65 66 // throw the right event 67 $this->notifyEvent( EVENT_BLOGS_LOADED, Array( "blogs" => &$siteBlogs )); 68 69 // calculate the links to the different pages 70 $pager = new Pager( $this->_pagerUrl."&searchTerms=".$this->_searchTerms."&status=".$this->_status."&page=", 71 $this->_page, 72 $numBlogs, 73 DEFAULT_ITEMS_PER_PAGE ); 74 75 $this->setValue( "siteblogs", $siteBlogs ); 76 $this->setValue( "pager", $pager ); 77 $this->setValue( "currentstatus", $this->_status ); 78 $this->setValue( "blogstatus", BlogStatus::getStatusList( true )); 79 $this->setValue( "searchTerms", $this->_searchTerms ); 80 81 // let the parent view do its job 82 parent::render(); 83 } 84 } 85 ?>
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 |
![]() |