[ Index ] |
|
Code source de LifeType 1.2.4 |
1 <?php 2 3 lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" ); 4 lt_include( PLOG_CLASS_PATH."class/view/admin/adminpostslistview.class.php" ); 5 lt_include( PLOG_CLASS_PATH."class/view/admin/adminarticlereferrersview.class.php" ); 6 lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" ); 7 8 /** 9 * \ingroup Action 10 * @private 11 * 12 * Action that shows a page with the statistics about a form 13 */ 14 class AdminPostStatsAction extends AdminAction 15 { 16 var $_postId; 17 var $_page; 18 19 /** 20 * Constructor. If nothing else, it also has to call the constructor of the parent 21 * class, BlogAction with the same parameters 22 */ 23 function AdminPostStatsAction( $actionInfo, $request ) 24 { 25 $this->AdminAction( $actionInfo, $request ); 26 27 // data validatdion 28 $this->registerFieldValidator( "postId", new IntegerValidator()); 29 $view = new AdminPostsListView( $this->_blogInfo ); 30 $view->setErrorMessage( $this->_locale->tr("error_incorrect_article_id")); 31 $this->setValidationErrorView( $view ); 32 } 33 34 /** 35 * Check that the parameter is correct. 36 */ 37 function validate() 38 { 39 // let's make sure that the "page" parameter has a sane value 40 // and that it is not below 0 41 $val = new IntegerValidator(); 42 $this->_page = $this->_request->getValue( "page" ); 43 if( !$val->validate( $this->_page ) || $this->_page < 0 ) 44 $this->_page = 1; 45 46 // run the real validation stuff... 47 return parent::validate(); 48 } 49 50 /** 51 * Carries out the specified action 52 */ 53 function perform() 54 { 55 $this->_postId = $this->_request->getValue( "postId" ); 56 57 // fetch the post itself 58 $posts = new Articles(); 59 $post = $posts->getBlogArticle( $this->_postId, $this->_blogInfo->getId()); 60 if( !$post ) { 61 $this->_view = new AdminPostsListView( $this->_blogInfo ); 62 $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_article")); 63 $this->setCommonData(); 64 return false; 65 } 66 67 // generate the view 68 $this->_view = new AdminArticleReferrersView( $this->_blogInfo, Array( "page" => $this->_page, "article" => $post )); 69 $this->setCommonData(); 70 return true; 71 } 72 } 73 ?>
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 |
![]() |