/** * Execute the action * * @return void */ public function execute() { // get parameters $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendSlideshowModel::existsGallery($this->id)) { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // delete widget BackendSlideshowModel::deleteWidget($this->id); // delete item BackendSlideshowModel::deleteGallery($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'); } else { // something went wrong $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing'); } }