[ 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/adminlinkcategorieslistview.class.php" ); 6 lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" ); 7 lt_include( PLOG_CLASS_PATH."class/dao/mylinkscategories.class.php" ); 8 lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" ); 9 10 /** 11 * \ingroup Action 12 * @private 13 * 14 * Updates an article category. 15 */ 16 class AdminUpdateLinkCategoryAction extends AdminAction 17 { 18 19 var $_categoryName; 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 AdminUpdateLinkCategoryAction( $actionInfo, $request ) 27 { 28 $this->AdminAction( $actionInfo, $request ); 29 30 // data validation 31 $this->registerFieldValidator( "linkCategoryName", new StringValidator()); 32 $this->registerFieldValidator( "linkCategoryId", new IntegerValidator()); 33 $errorView = new AdminTemplatedView( $this->_blogInfo, "editlinkcategory" ); 34 $errorView->setErrorMessage( $this->_locale->tr("error_updating_link_category")); 35 $this->setValidationErrorView( $errorView ); 36 37 // permission checks 38 $this->requirePermission( "update_link_category" ); 39 } 40 41 /** 42 * Carries out the specified action 43 */ 44 function perform() 45 { 46 // fetch the category we're trying to update 47 $this->_categoryId = $this->_request->getValue( "linkCategoryId" ); 48 $this->_categoryName = Textfilter::filterAllHTML($this->_request->getValue( "linkCategoryName" )); 49 $categories = new MyLinksCategories(); 50 $category = $categories->getMyLinksCategory( $this->_categoryId, $this->_blogInfo->getId()); 51 if( !$category ) { 52 $this->_view = new AdminLinkCategoriesListView( $this->_blogInfo ); 53 $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_link_category")); 54 $this->setCommonData(); 55 56 return false; 57 } 58 59 // update the fields 60 $category->setName( $this->_categoryName ); 61 $this->notifyEvent( EVENT_PRE_LINK_CATEGORY_UPDATE, Array( "linkcategory" => &$category )); 62 if( !$categories->updateMyLinksCategory( $category )) { 63 $this->_view = new AdminLinkCategoriesListView( $this->_blogInfo ); 64 $this->_view->setErrorMessage( $this->_locale->tr("error_updating_link_category")); 65 $this->setCommonData(); 66 67 return false; 68 } 69 $this->notifyEvent( EVENT_POST_LINK_CATEGORY_UPDATE, Array( "linkcategory" => &$category )); 70 71 // clear the cache 72 CacheControl::resetBlogCache( $this->_blogInfo->getId(), false ); 73 74 $this->_view = new AdminLinkCategoriesListView( $this->_blogInfo ); 75 $this->_view->setSuccessMessage( $this->_locale->pr("link_category_updated_ok", $category->getName())); 76 $this->setCommonData(); 77 78 // better to return true if everything fine 79 return true; 80 } 81 } 82 ?>
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 |
![]() |