コード例 #1
0
 /**
  * Execute the action
  *
  * @return	void
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendBlogModel::existsCategory($this->id)) {
         // get data
         $this->record = (array) BackendBlogModel::getCategory($this->id);
         // allowed to delete the category?
         if (BackendBlogModel::deleteCategoryAllowed($this->id)) {
             // call parent, this will probably add some general CSS/JS or other required files
             parent::execute();
             // delete item
             BackendBlogModel::deleteCategory($this->id);
             // trigger event
             BackendModel::triggerEvent($this->getModule(), 'after_delete_category', array('id' => $this->id));
             // 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');
     }
 }
コード例 #2
0
ファイル: edit_category.php プロジェクト: richsage/forkcms
 /**
  * Parse the form
  */
 protected function parse()
 {
     parent::parse();
     $this->tpl->assign('item', $this->record);
     // delete allowed?
     $this->tpl->assign('showDeleteCategory', BackendBlogModel::deleteCategoryAllowed($this->id) && BackendModel::createURLForAction('delete_category'));
 }
コード例 #3
0
 /**
  * Parse the form
  *
  * @return	void
  */
 protected function parse()
 {
     // call parent
     parent::parse();
     // assign
     $this->tpl->assign('item', $this->record);
     // delete allowed?
     $this->tpl->assign('deleteAllowed', BackendBlogModel::deleteCategoryAllowed($this->id));
 }