| [ 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/dao/mylinkscategories.class.php" ); 7 lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" ); 8 9 /** 10 * \ingroup Action 11 * @private 12 * 13 * Action that shows a form to change the settings of the link category 14 */ 15 class AdminEditLinkCategoryAction extends AdminAction 16 { 17 18 var $_categoryId; 19 20 /** 21 * Constructor. If nothing else, it also has to call the constructor of the parent 22 * class, BlogAction with the same parameters 23 */ 24 function AdminEditLinkCategoryAction( $actionInfo, $request ) 25 { 26 $this->AdminAction( $actionInfo, $request ); 27 28 // data validation 29 $this->registerFieldValidator( "categoryId", new IntegerValidator()); 30 $this->_form->registerField( "categoryName" ); 31 $view = new AdminLinkCategoriesListView( $this->_blogInfo ); 32 $view->setErrorMessage( $this->_locale->tr("error_incorrect_link_category_id")); 33 $this->setValidationErrorView( $view ); 34 35 // permission checks 36 $this->requirePermission( "update_link_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 MyLinksCategories(); 47 $category = $categories->getMyLinksCategory( $this->_categoryId, $this->_blogInfo->getId()); 48 // show an error if we couldn't fetch the category 49 if( !$category ) { 50 $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_link_category")); 51 $this->setCommonData(); 52 53 return false; 54 } 55 $this->notifyEvent( EVENT_LINK_CATEGORY_LOADED, Array( "linkcategory" => &$category )); 56 // otherwise show the form to edit its fields 57 $this->_view = new AdminTemplatedView( $this->_blogInfo, "editlinkcategory" ); 58 $this->_view->setValue( "linkCategoryName", $category->getName()); 59 $this->_view->setValue( "linkCategoryId", $category->getId()); 60 $this->setCommonData(); 61 62 // better to return true if everything fine 63 return true; 64 } 65 } 66 ?>
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 |
|