[ 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/admintemplatedview.class.php" ); 5 lt_include( PLOG_CLASS_PATH."class/view/admin/adminblogcategorieslistview.class.php" ); 6 lt_include( PLOG_CLASS_PATH."class/dao/blogcategories.class.php" ); 7 lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" ); 8 lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" ); 9 lt_include( PLOG_CLASS_PATH."class/data/validator/emptyvalidator.class.php" ); 10 11 /** 12 * \ingroup Action 13 * @private 14 * 15 * Action that shows a form to change the settings of the article category 16 */ 17 class AdminEditBlogCategoryAction extends AdminAction 18 { 19 20 var $_categoryId; 21 22 /** 23 * Constructor. If nothing else, it also has to call the constructor of the parent 24 * class, BlogAction with the same parameters 25 */ 26 function AdminEditBlogCategoryAction( $actionInfo, $request ) 27 { 28 $this->AdminAction( $actionInfo, $request ); 29 30 // stuff for the data validation 31 $this->registerFieldValidator( "categoryId", new IntegerValidator()); 32 $errorView = new AdminBlogCategoriesListView( $this->_blogInfo ); 33 $errorView->setErrorMessage( $this->_locale->tr("error_incorrect_category_id")); 34 $this->setValidationErrorView( $errorView ); 35 36 $this->requireAdminPermission( "update_blog_category" ); 37 } 38 39 /** 40 * Carries out the specified action 41 */ 42 function perform() 43 { 44 // fetch the category 45 $this->_categoryId = $this->_request->getValue( "categoryId" ); 46 $categories = new BlogCategories(); 47 $category = $categories->getBlogCategory( $this->_categoryId); 48 // show an error if we couldn't fetch the category 49 if( !$category ) { 50 $this->_view = new AdminBlogCategoriesListView( $this->_blogInfo ); 51 $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_category") ); 52 $this->_view->setError( true ); 53 $this->setCommonData(); 54 return false; 55 } 56 57 $this->notifyEvent( EVENT_BLOG_CATEGORY_LOADED, Array( "category" => &$category )); 58 // otherwise show the form to edit its fields 59 $this->_view = new AdminTemplatedView( $this->_blogInfo, "editblogcategory" ); 60 $this->_view->setValue( "category", $category ); 61 $this->_view->setValue( "categoryName", $category->getName()); 62 $this->_view->setValue( "categoryDescription", $category->getDescription()); 63 $this->_view->setValue( "categoryId", $category->getId()); 64 $this->setCommonData(); 65 66 // better to return true if everything fine 67 return true; 68 } 69 } 70 ?>
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 |
![]() |