/** * Get the data */ private function getData() { $this->id = $this->getParameter('id', 'int'); if ($this->id == null || !BackendCatalogModel::existsSpecification($this->id)) { $this->redirect(BackendModel::createURLForAction('specifications') . '&error=non-existing'); } $this->record = BackendCatalogModel::getSpecification($this->id); }
/** * Execute the action */ public function execute() { $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id == null || !BackendCatalogModel::existsSpecification($this->id)) { $this->redirect(BackendModel::createURLForAction('specifications') . '&error=non-existing'); } // fetch the specification $this->record = (array) BackendCatalogModel::getSpecification($this->id); // delete item BackendCatalogModel::deleteSpecification($this->id); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_delete_specification', array('item' => $this->record)); // specification was deleted, so redirect $this->redirect(BackendModel::createURLForAction('specifications') . '&report=deleted-specification&var=' . urlencode($this->record['title'])); }
public function execute() { 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) { $item['id'] = $id; $item['sequence'] = $i + 1; // update sequence if (BackendCatalogModel::existsSpecification($id)) { BackendCatalogModel::updateSpecification($id, $item); } } // success output $this->output(self::OK, null, 'sequence updated'); }