/** * 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'); } }
/** * Execute the action * * @return void */ public function execute() { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // set category id $this->categoryId = SpoonFilter::getGetValue('category', null, null, 'int'); if ($this->categoryId == 0) { $this->categoryId = null; } else { // get category $this->category = BackendBlogModel::getCategory($this->categoryId); // reset if (empty($this->category)) { // reset GET to trick Spoon $_GET['category'] = null; // reset $this->categoryId = null; } } // load datagrid $this->loadDataGrids(); // parse page $this->parse(); // display the page $this->display(); }
/** * Execute the action */ public function execute() { parent::execute(); // set category id $this->categoryId = SpoonFilter::getGetValue('category', null, null, 'int'); if ($this->categoryId == 0) { $this->categoryId = null; } else { // get category $this->category = BackendBlogModel::getCategory($this->categoryId); // reset if (empty($this->category)) { // reset GET to trick Spoon $_GET['category'] = null; // reset $this->categoryId = null; } } $this->loadDataGrids(); $this->parse(); $this->display(); }
/** * Get the data */ private function getData() { $this->record = BackendBlogModel::getCategory($this->id); }