/** * Carries out the specified action */ function perform() { // fetch our data $this->_albumName = Textfilter::filterAllHTML($this->_request->getValue("albumName")); $this->_albumDescription = Textfilter::filterAllHTML($this->_request->getValue("albumDescription")); $this->_parentId = $this->_request->getValue("parentId"); $showAlbum = $this->_request->getValue("showAlbum") ? 1 : 0; // create the album $albums = new GalleryAlbums(); $t = new Timestamp(); $album = new GalleryAlbum($this->_blogInfo->getId(), $this->_albumName, $this->_albumDescription, GALLERY_RESOURCE_PREVIEW_AVAILABLE, $this->_parentId, $t->getTimestamp(), array(), $showAlbum); $this->notifyEvent(EVENT_PRE_ALBUM_ADD, array("album" => &$album)); // and add it to the database $result = $albums->addAlbum($album); $this->_view = new AdminResourcesListView($this->_blogInfo, array("albumId" => $this->_parentId)); if ($result) { $this->_view->setSuccessMessage($this->_locale->pr("album_added_ok", $album->getName())); $this->notifyEvent(EVENT_POST_ALBUM_ADD, array("album" => &$album)); // clear the cache if everything went fine CacheControl::resetBlogCache($this->_blogInfo->getId(), false); } else { $this->_view->setErrorMessage($this->_locale->tr("error_adding_album")); } $this->setCommonData(); // better to return true if everything fine return true; }