| [ 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/adminarticlecommentslistview.class.php" ); 5 lt_include( PLOG_CLASS_PATH."class/view/admin/adminpostslistview.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 list of all the comments or trackbacks for a given post 13 */ 14 class AdminEditCommentsAction extends AdminAction 15 { 16 17 /** 18 * Constructor. If nothing else, it also has to call the constructor of the parent 19 * class, BlogAction with the same parameters 20 */ 21 function AdminEditCommentsAction( $actionInfo, $request ) 22 { 23 $this->AdminAction( $actionInfo, $request ); 24 25 // data validation 26 $this->registerFieldValidator( "articleId", new IntegerValidator(), true); 27 $this->registerFieldValidator( "showStatus", new IntegerValidator( true ), true); 28 $view = new AdminPostsListView( $this->_blogInfo ); 29 $view->setErrorMessage( $this->_locale->tr("error_fetching_comments")); 30 $this->setValidationErrorView( $view ); 31 32 // we do this so that AdminEditTrackbacksAction can basically extend this class and provide 33 // a different view... it will allow us to save some extra code! 34 $this->_viewClass = "AdminArticleCommentsListView"; 35 36 $this->requirePermission( "view_comments" ); 37 } 38 39 /** 40 * Carries out the specified action 41 */ 42 function perform() 43 { 44 // get the validated parameters from the request 45 $articleId = $this->_request->getValue( "articleId" ); 46 $showStatus = $this->_request->getValue( "showStatus" ); 47 $searchTerms = $this->_request->getvalue( "searchTerms" ); 48 49 if( $articleId && $articleId > 0 ) { 50 $articles = new Articles(); 51 $article = $articles->getBlogArticle( $articleId, $this->_blogInfo->getId()); 52 if( !$article ) { 53 $this->_view = new AdminPostsListView( $this->_blogInfo ); 54 $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_article" )); 55 } 56 else 57 $this->_view = new $this->_viewClass( $this->_blogInfo, Array( "article" => $article, 58 "showStatus" => $showStatus, 59 "searchTerms" => $searchTerms )); 60 } 61 else { 62 // if there is no article id, then we will show all comments from all posts... 63 $this->_view = new $this->_viewClass( $this->_blogInfo, Array( "article" => null, 64 "showStatus" => $showStatus, 65 "searchTerms" => $searchTerms )); 66 } 67 68 $this->setCommonData(); 69 70 // better to return true if everything fine 71 return true; 72 } 73 } 74 ?>
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 |
|