[ Index ] |
|
Code source de LifeType 1.2.4 |
1 <?php 2 3 lt_include( PLOG_CLASS_PATH."class/summary/action/summaryaction.class.php" ); 4 lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" ); 5 lt_include( PLOG_CLASS_PATH."class/summary/view/summarycachedview.class.php" ); 6 7 /** 8 * shows a user profile 9 */ 10 class UserProfileAction extends SummaryAction 11 { 12 13 var $_userId; 14 15 function UserProfileAction( $actionInfo, $request ) 16 { 17 $this->SummaryAction( $actionInfo, $request ); 18 19 // data validaiton 20 $this->registerFieldValidator( "userId", new IntegerValidator()); 21 $this->setValidationErrorView( new SummaryCachedView( "userlist", Array( "summary" => "UserList", "page" => 1, "locale" => $this->_locale->getLocaleCode()))); 22 } 23 24 /** 25 * Loads the user info and show it 26 */ 27 function perform() 28 { 29 $this->_userId = $this->_request->getValue( "userId" ); 30 31 $this->_view = new SummaryCachedView( "userprofile", Array( "summary" => "userProfile", "userId" => $this->_userId, "locale" => $this->_locale->getLocaleCode())); 32 if( $this->_view->isCached()) { 33 // nothing to do, the view is cached 34 $this->setCommonData(); 35 return true; 36 } 37 38 // load the classes that we are going to need 39 lt_include( PLOG_CLASS_PATH."class/dao/users.class.php" ); 40 lt_include( PLOG_CLASS_PATH."class/summary/dao/summarystats.class.php" ); 41 42 // load some information about the user 43 $users = new Users(); 44 $userInfo = $users->getUserInfoFromId( $this->_userId, true ); 45 46 if( !$userInfo ) { 47 $this->_view = new SummaryCachedView( "userlist", Array( "summary" => "UserList", "page" => 1, "locale" => $this->_locale->getLocaleCode())); 48 $this->setCommonData(); 49 return false; 50 } 51 52 // load the user's recent posting activity 53 $stats = new SummaryStats(); 54 $this->_view->setValue( "recentArticles", $stats->getUserRecentArticles( $userInfo->getId())); 55 56 $this->_view->setValue( "user", $userInfo ); 57 58 $this->setCommonData(); 59 60 return true; 61 } 62 } 63 ?>
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 |
![]() |