[ 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/dao/users.class.php" ); 5 lt_include( PLOG_CLASS_PATH."class/data/pager/pager.class.php" ); 6 lt_include( PLOG_CLASS_PATH."class/dao/userstatus.class.php" ); 7 8 /** 9 * \ingroup View 10 * @private 11 * 12 * shows a list with the users in the blog 13 */ 14 class AdminSiteUsersListView extends AdminTemplatedView 15 { 16 var $_status; 17 var $_page; 18 var $_templateName; 19 20 /** 21 * @param blogInfo 22 * @param chooserMode Whether this view should act in chooser mode or not. If in chooser mode, 23 * it will load a lighter template 24 */ 25 function AdminSiteUsersListView( $blogInfo ) 26 { 27 if( $this->_templateName == "" ) 28 $this->_templateName = "siteusers"; 29 30 $this->AdminTemplatedView( $blogInfo, $this->_templateName ); 31 32 $this->_pagerUrl = "?op=editSiteUsers"; 33 } 34 35 /** 36 * retrieves the current status from the request 37 * 38 * @private 39 * @return a string with the status code as it came from the request 40 */ 41 function getStatusFromRequest() 42 { 43 $status = HttpVars::getRequestValue( "status" ); 44 45 // validate the value 46 $val = new IntegerValidator(); 47 if( !$val->validate( $status )) 48 $status = UserStatus::getDefaultStatus(); 49 50 // if the value validated, check if it is a valid status 51 if( !UserStatus::isValidStatus( $status )) 52 $status = UserStatus::getDefaultStatus(); 53 54 return $status; 55 } 56 57 /** 58 * @private 59 */ 60 61 function render() 62 { 63 // get the current page 64 $this->_page = $this->getCurrentPageFromRequest(); 65 $this->_status = $this->getStatusFromRequest(); 66 $this->_searchTerms = HttpVars::getRequestValue( "searchTerms"); 67 68 // get the users of the blog 69 $users = new Users(); 70 $siteUsers = $users->getAllUsers( $this->_status, $this->_searchTerms, "", $this->_page, DEFAULT_ITEMS_PER_PAGE ); 71 $numUsers = $users->getNumUsers( $this->_status, $this->_searchTerms ); 72 73 // in case of problems, empty array... 74 if( !$siteUsers ) 75 $siteUsers = Array(); 76 77 // notify the event 78 $this->notifyEvent( EVENT_USERS_LOADED, Array( "users" => &$blogUsers )); 79 80 $this->_pagerUrl = $this->_pagerUrl."&searchTerms=".$this->_searchTerms."&status=".$this->_status."&page="; 81 $pager = new Pager( $this->_pagerUrl, 82 $this->_page, 83 $numUsers, 84 DEFAULT_ITEMS_PER_PAGE ); 85 86 // and generate the view 87 $this->setValue( "siteusers", $siteUsers ); 88 $this->setValue( "userstatus", UserStatus::getStatusList( true )); 89 $this->setValue( "pager", $pager ); 90 $this->setValue( "currentstatus", $this->_status ); 91 $this->setValue( "searchTerms", $this->_searchTerms ); 92 parent::render(); 93 } 94 } 95 96 ?>
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 |
![]() |