Example #1
0
 /**
  * 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');
     }
 }
Example #2
0
 /**
  * Parse the form
  *
  * @return void
  */
 protected function parse()
 {
     $this->header->addCSS('jquery.ui.plupload/jquery-ui.css');
     $this->header->addCSS('jquery.ui.plupload/jquery.ui.plupload.css');
     $this->header->addJS('moxie.min.js', null, false);
     $this->header->addJS('plupload.full.min.js', null, false);
     $this->header->addJS('jquery.ui.plupload/jquery.ui.plupload.js', null, false);
     $this->header->addJS('i18n/nl.js', null, false);
     //--Add javascript file
     //$this->header->addJS('Jquery.uploadify.min.js', null,false);
     //$this->header->addCSS('Uploadify.css');
     $this->header->addJS('Edit.js', null, false);
     // call parent
     parent::parse();
     // assign the category
     $this->tpl->assign('album', $this->record);
     $this->tpl->assign('images', $this->images);
     if ($this->frmAddImage) {
         $this->frmAddImage->parse($this->tpl);
     }
     if ($this->frmDeleteImage) {
         $this->frmDeleteImage->parse($this->tpl);
     }
     //--Add data to Javascript
     $this->header->addJsData("Gallery", "id", $this->id);
     // can the category be deleted?
     if (BackendGalleryModel::deleteAlbumAllowed($this->id)) {
         $this->tpl->assign('showDelete', true);
     }
     // get url
     $url = BackendModel::getURLForBlock($this->URL->getModule(), 'group');
     $url404 = BackendModel::getURL(404);
     if ($url404 != $url) {
         $this->tpl->assign('detailURL', SITE_URL . $url);
     }
 }