/** * Load the item data */ protected function loadData() { $this->id = $this->getParameter('id', 'int', null); if ($this->id == null || !BackendBlocksModel::exists($this->id)) { $this->redirect(Model::createURLForAction('Index') . '&error=non-existing'); } $this->record = BackendBlocksModel::get($this->id); }
/** * Execute the action */ public function execute() { $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendBlocksModel::exists($this->id)) { parent::execute(); $this->record = (array) BackendBlocksModel::get($this->id); BackendBlocksModel::delete($this->id); Model::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id)); $this->redirect(Model::createURLForAction('Index') . '&report=deleted&var=' . urlencode($this->record['title'])); } else { $this->redirect(Model::createURLForAction('Index') . '&error=non-existing'); } }