/** * Load the item data */ protected function loadData() { $this->id = $this->getParameter('id', 'int', null); if ($this->id == null || !BackendMailengineModel::existsTemplate($this->id)) { $this->redirect(BackendModel::createURLForAction('templates') . '&error=non-existing'); } $this->record = BackendMailengineModel::getTemplate($this->id); }
/** * Execute the action */ public function execute() { $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendMailengineModel::existsTemplate($this->id)) { parent::execute(); $this->record = (array) BackendMailengineModel::getTemplate($this->id); BackendMailengineModel::deleteTemplate($this->id); BackendModel::triggerEvent($this->getModule(), 'after_delete_template', array('id' => $this->id)); $this->redirect(BackendModel::createURLForAction('templates') . '&report=deleted&var=' . urlencode($this->record['title'])); } else { $this->redirect(BackendModel::createURLForAction('templates') . '&error=non-existing'); } }