/** * Execute the action */ public function execute() { $this->id = $this->getParameter('id', 'int'); // group exists and id is not null? if ($this->id !== null && BackendGroupsModel::exists($this->id)) { parent::execute(); // get record $this->record = BackendGroupsModel::get($this->id); // delete group BackendGroupsModel::delete($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['name'])); } else { $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing'); } }
/** * Get the data to edit */ private function getData() { $this->id = $this->getParameter('id'); // get dashboard sequence $this->dashboardSequence = BackendGroupsModel::getSetting($this->id, 'dashboard_sequence'); // get the record $this->record = BackendGroupsModel::get($this->id); // no item found, throw an exceptions, because somebody is f*****g with our URL if (empty($this->record)) { $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing'); } $this->getWidgets(); $this->getActions(); $this->bundleActions(); }