/** * Execute the action * * @return void */ public function execute() { // get parameters $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendSlideshowModel::existsCategory($this->id)) { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // get item $this->record = BackendSlideshowModel::getCategory($this->id); // delete item BackendSlideshowModel::deleteCategory($this->id); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_delete_category', array('id' => $this->id)); // item was deleted, so redirect $this->redirect(BackendModel::createURLForAction('Categories') . '&report=deleted&var=' . urlencode($this->record['title'])); } else { // something went wrong $this->redirect(BackendModel::createURLForAction('Categories') . '&error=non-existing'); } }
/** * Execute the action * * @return void */ public function execute() { // get parameters $this->id = $this->getParameter('id', 'int'); // does the item exists? if ($this->id !== null && BackendSlideshowModel::existsCategory($this->id)) { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // get all data for the item we want to edit $this->getData(); // load the form $this->loadForm(); // validate the form $this->validateForm(); // parse the form $this->parse(); // display the page $this->display(); } else { // no item found, throw an exceptions, because somebody is f*****g with our URL $this->redirect(BackendModel::createURLForAction('Categories') . '&error=non-existing'); } }