00001 <?php
00002
00003 lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
00004 lt_include( PLOG_CLASS_PATH."class/dao/mylinkscategories.class.php" );
00005 lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
00006 lt_include( PLOG_CLASS_PATH."class/view/admin/adminlinkcategorieslistview.class.php" );
00007 lt_include( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
00008
00015 class AdminAddLinkCategoryAction extends AdminAction
00016 {
00017
00018 var $_linkCategoryName;
00019 var $_properties;
00020
00025 function AdminAddLinkCategoryAction( $actionInfo, $request )
00026 {
00027 $this->AdminAction( $actionInfo, $request );
00028
00029
00030 $this->registerFieldValidator( "linkCategoryName", new StringValidator());
00031 $this->setValidationErrorView( new AdminTemplatedView( $this->_blogInfo, "newlinkcategory" ));
00032
00033 $this->requirePermission( "add_link_category" );
00034 }
00035
00039 function perform()
00040 {
00041
00042 $this->_linkCategoryName = Textfilter::filterAllHTML($this->_request->getValue( "linkCategoryName" ));
00043 $mylinksCategories = new MyLinksCategories();
00044 $mylinksCategory = new MyLinksCategory( $this->_linkCategoryName,
00045 $this->_blogInfo->getId(),
00046 0,
00047 $this->_properties );
00048
00049 if( $this->userHasPermission( "view_link_categories" ))
00050 $this->_view = new AdminLinkCategoriesListView( $this->_blogInfo );
00051 else
00052 $this->_view = new AdminTemplatedView( $this->_blogInfo, "newlinkcategory" );
00053
00054 if( !$mylinksCategories->addMyLinksCategory( $mylinksCategory, $this->_blogInfo->getId())) {
00055
00056 $this->_view->setErrorMessage( $this->_locale->tr("error_adding_link_category"));
00057 }
00058 else {
00059
00060 CacheControl::resetBlogCache( $this->_blogInfo->getId(), false );
00061 $this->_view->setSuccessMessage( $this->_locale->pr("link_category_added_ok", $mylinksCategory->getName()));
00062 }
00063
00064 $this->setCommonData();
00065
00066 return true;
00067 }
00068 }
00069 ?>