/** * Execute the action */ public function execute() { // get parameters $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendFormBuilderModel::exists($this->id)) { parent::execute(); // get all data for the item we want to edit $this->record = (array) BackendFormBuilderModel::get($this->id); // delete item BackendFormBuilderModel::delete($this->id); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id)); // user 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'); } }