/** * Get the data for a question * * @return void */ private function getData() { // get the record $this->record = BackendFaqModel::getQuestion($this->id); // get categories $this->categories = BackendFaqModel::getCategoriesForDropdown(); }
/** * Execute the action * * @return void */ public function execute() { // get parameters $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendFaqModel::existsQuestion($this->id)) { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // get item $this->record = BackendFaqModel::getQuestion($this->id); // delete item BackendFaqModel::deleteQuestion($this->id); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id)); // item was deleted, so redirect $this->redirect(BackendModel::createURLForAction('index') . '&report=deleted&var=' . urlencode($this->record['question'])); } else { $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } }