/** * Execute the action */ public function execute() { // get parameters $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendGalleryModel::existsAlbum($this->id)) { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // get album $this->album = BackendGalleryModel::getAlbumFromId($this->id); // is this album allowed to be deleted? if (!BackendGalleryModel::deleteAlbumAllowed($this->id)) { $this->redirect(BackendModel::createURLForAction('albums') . '&error=album-not-deletable'); } else { // delete the item BackendGalleryModel::deleteAlbumById($this->id); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_delete_album', array('id' => $this->id)); // item was deleted, so redirect $this->redirect(BackendModel::createURLForAction('albums') . '&report=album-deleted&var=' . urlencode($this->album['title'])); } } else { $this->redirect(BackendModel::createURLForAction('albums') . '&error=non-existing'); } }