deleteCategoryAllowed() public static method

Is the deletion of a category allowed?
public static deleteCategoryAllowed ( integer $id ) : boolean
$id integer
return boolean
コード例 #1
0
ファイル: EditCategory.php プロジェクト: bwgraves/forkcms
 /**
  * Parse the form
  */
 protected function parse()
 {
     parent::parse();
     // assign the data
     $this->tpl->assign('item', $this->record);
     $this->tpl->assign('showFaqDeleteCategory', BackendFaqModel::deleteCategoryAllowed($this->id) && BackendAuthentication::isAllowedAction('DeleteCategory'));
 }
コード例 #2
0
ファイル: EditCategory.php プロジェクト: forkcms/forkcms
 /**
  * Parse the form
  */
 protected function parse()
 {
     parent::parse();
     // assign the data
     $this->tpl->assign('item', $this->record);
     $this->tpl->assign('showFaqDeleteCategory', BackendFaqModel::deleteCategoryAllowed($this->id) && BackendAuthentication::isAllowedAction('DeleteCategory'));
     $url = BackendModel::getURLForBlock($this->URL->getModule(), 'Category');
     $url404 = BackendModel::getURL(404);
     if ($url404 != $url) {
         $this->tpl->assign('detailURL', SITE_URL . $url);
     }
 }
コード例 #3
0
ファイル: DeleteCategory.php プロジェクト: bwgraves/forkcms
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendFaqModel::existsCategory($this->id)) {
         $this->record = (array) BackendFaqModel::getCategory($this->id);
         if (BackendFaqModel::deleteCategoryAllowed($this->id)) {
             parent::execute();
             // delete item
             BackendFaqModel::deleteCategory($this->id);
             BackendModel::triggerEvent($this->getModule(), 'after_delete_category', array('item' => $this->record));
             // category was deleted, so redirect
             $this->redirect(BackendModel::createURLForAction('Categories') . '&report=deleted-category&var=' . urlencode($this->record['title']));
         } else {
             $this->redirect(BackendModel::createURLForAction('Categories') . '&error=delete-category-not-allowed&var=' . urlencode($this->record['title']));
         }
     } else {
         $this->redirect(BackendModel::createURLForAction('Categories') . '&error=non-existing');
     }
 }