/** * Execute the action */ public function execute() { $this->id = $this->getParameter('id', 'int'); // does the item exist? if ($this->id !== null && BackendFaqModel::existsCategory($this->id)) { parent::execute(); $this->getData(); $this->loadForm(); $this->validateForm(); $this->parse(); $this->display(); } else { $this->redirect(BackendModel::createURLForAction('categories') . '&error=non-existing'); } }
/** * 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'); } }
/** * 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::existsCategory($this->id)) { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // get item $this->record = BackendFaqModel::getCategory($this->id); // delete item BackendFaqModel::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['name'])); } 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(); // get parameters $newIdSequence = trim(SpoonFilter::getPostValue('new_id_sequence', null, '', 'string')); // list id $ids = (array) explode(',', rtrim($newIdSequence, ',')); // loop id's and set new sequence foreach ($ids as $i => $id) { // build item $item['id'] = (int) $id; // change sequence $item['sequence'] = $i + 1; // update sequence if (BackendFaqModel::existsCategory($item['id'])) { BackendFaqModel::updateCategory($item); } } // success output $this->output(self::OK, null, 'sequence updated'); }
/** * Execute the action * * @return void */ public function execute() { // get parameters $this->id = $this->getParameter('id', 'int'); // does the item exists? if ($this->id !== null && BackendFaqModel::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 { $this->redirect(BackendModel::createURLForAction('categories') . '&error=non-existing'); } }