/**
  * 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');
     }
 }
 /**
  * Parse the form
  *
  * @return void
  */
 protected function parse()
 {
     //--Add javascript file
     $this->header->addJS('Jquery.uploadify.min.js', null, false);
     $this->header->addJS('Edit.js', null, false);
     $this->header->addCSS('Uploadify.css');
     // 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("Galleria", "id", $this->id);
     // can the category be deleted?
     if (BackendGalleriaModel::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);
     }
 }