/** * Execute the action */ public function execute() { // get parameters $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendGalleriaModel::existsAlbum($this->id)) { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // get album $this->album = BackendGalleriaModel::getAlbumFromId($this->id); // is this album allowed to be deleted? if (!BackendGalleriaModel::deleteAlbumAllowed($this->id)) { $this->redirect(BackendModel::createURLForAction('albums') . '&error=album-not-deletable'); } else { // delete the item BackendGalleriaModel::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'); } }
public function execute() { // get parameters $this->id = $this->getParameter('id', 'int'); // does the item exists? if ($this->id !== null && BackendGalleriaModel::existsAlbum($this->id)) { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // get all data for the item we want to edit $this->getData(); // load the form $this->loadForm(); $this->loadFormAddImage(); $this->loadFormDeleteImage(); // validate the form $this->validateForm(); $this->validateFormAddImage(); $this->validateFormDeleteImage(); // parse the form $this->parse(); // display the page $this->display(); } else { $this->redirect(BackendModel::createURLForAction('albums') . '&error=non-existing'); } }
/** * Execute the action */ public function execute() { parent::execute(); // get parameters $newIdSequence = trim(\SpoonFilter::getPostValue('new_id_sequence', null, '', 'string')); // list id $ids = (array) explode(',', rtrim($newIdSequence, ',')); // loop id's and set new sequence foreach ($ids as $i => $id) { // build item $item['id'] = (int) $id; // change sequence $item['sequence'] = $i + 1; // update sequence if (BackendGalleriaModel::existsAlbum($item['id'])) { BackendGalleriaModel::updateAlbum($item); } } // success output $this->output(self::OK, null, 'sequence updated'); }