/** * Creates path for original files on server. * If path does not exist, it will be created if given parameter is true. * * @param Tx_Yag_Domain_Model_Album $album * @param bool $createIfNotExists If set to true, directory will be created if it does not exist * @return string Path for original images (absolute) * @throws Exception */ public function getOrigFileDirectoryPathForAlbum(Tx_Yag_Domain_Model_Album $album, $createIfNotExists = true) { $path = Tx_Yag_Domain_Configuration_ConfigurationBuilderFactory::getInstance()->buildExtensionConfiguration()->getOrigFilesRootAbsolute() . '/' . $album->getUid() . '/'; if ($createIfNotExists) { $success = Tx_Yag_Domain_FileSystem_Div::checkDirAndCreateIfMissing($path); if (!$success) { throw new Exception(sprintf('The original file path %s for album %s could not be created!', $path, $album->getUid()), 1404452464); } } return $path; }
/** * Renders link for an album * * @param Tx_Yag_Domain_Model_Album $album Album object to render link for * @param Tx_Yag_Domain_Model_Gallery $gallery Gallery object to render link for * @param integer $pageUid * @param integer $pageType type of the target page. See typolink.parameter * @param integer $pageType type of the target page. See typolink.parameter * @param boolean $noCache set this to disable caching for the target page. You should not need this. * @param boolean $noCacheHash set this to supress the cHash query parameter created by TypoLink. You should not need this. * @param string $section the anchor to be added to the URI * @param string $format The requested format, e.g. ".html" * @return string Rendered link for album * @throws Exception */ public function render(Tx_Yag_Domain_Model_Album $album = null, Tx_Yag_Domain_Model_Gallery $gallery = null, $pageUid = null, $pageType = 0, $noCache = false, $noCacheHash = false, $section = '', $format = '') { // TODO implement gallery download if ($album instanceof Tx_Yag_Domain_Model_Album) { $namespace = Tx_Yag_Domain_Context_YagContextFactory::getInstance()->getObjectNamespace() . '.albumUid'; $arguments = Tx_PtExtbase_Utility_NameSpace::saveDataInNamespaceTree($namespace, array(), $album->getUid()); } Tx_PtExtbase_State_Session_SessionPersistenceManagerFactory::getInstance()->addSessionRelatedArguments($arguments); return parent::render('downloadAsZip', $arguments, 'ItemList', null, null, $pageUid, $pageType, $noCache, $noCacheHash, $section, $format); }
/** * @return Tx_Yag_Domain_Model_Album */ public function getAlbum() { if (!$this->selectedAlbumUid) { return NULL; } if ($this->selectedAlbum instanceof Tx_Yag_Domain_Model_Album && $this->selectedAlbum->getUid() == $this->selectedAlbumUid) { return $this->selectedAlbum; } else { return $this->objectManager->get('Tx_Yag_Domain_Repository_AlbumRepository')->findByUid($this->selectedAlbumUid); } }
/** * Renders link for an album * * @param integer $albumUid UID of album to render link for * @param Tx_Yag_Domain_Model_Album $album Album object to render link for * @param Tx_Yag_Domain_Model_Gallery $gallery Gallery object to render link for * @param integer pageUid (Optional) ID of page to render link for. If null, current page is used * @param integer $pageType type of the target page. See typolink.parameter * @param integer $pageType type of the target page. See typolink.parameter * @param boolean $noCache set this to disable caching for the target page. You should not need this. * @param boolean $noCacheHash set this to supress the cHash query parameter created by TypoLink. You should not need this. * @param string $section the anchor to be added to the URI * @param string $format The requested format, e.g. ".html" * @return string Rendered link for album * @throws Exception */ public function render($albumUid = 0, Tx_Yag_Domain_Model_Album $album = NULL, Tx_Yag_Domain_Model_Gallery $gallery = NULL, $pageUid = NULL, $pageType = 0, $noCache = FALSE, $noCacheHash = FALSE, $section = '', $format = '') { if ($albumUid == 0 && $album === NULL) { throw new Exception('You have to set "albumUid" or "album" as parameter. Both parameters can not be empty when using albumLinkViewHelper', 1295575454); } if ($albumUid == 0) { $albumUid = $album->getUid(); } $baseNamespace = Tx_Yag_Domain_Context_YagContextFactory::getInstance()->getObjectNamespace(); $arguments = Tx_PtExtbase_Utility_NameSpace::saveDataInNamespaceTree($baseNamespace . '.albumUid', array(), $albumUid); if ($gallery !== NULL) { $arguments = Tx_PtExtbase_Utility_NameSpace::saveDataInNamespaceTree($baseNamespace . '.galleryUid', $arguments, $gallery->getUid()); } return parent::render('submitFilter', $arguments, 'ItemList', NULL, NULL, $pageUid, $pageType, $noCache, $noCacheHash, $section, $format); }
/** * @param PathInfo $pathInfo * @param \Tx_Yag_Domain_Model_Album $album * @return array */ protected function buildAlbumObjectInfo(PathInfo $pathInfo, \Tx_Yag_Domain_Model_Album $album) { return array('name' => $album->getName() . ' |' . $album->getUid(), 'identifier' => \Tx_Yag_Domain_FileSystem_Div::concatenatePaths(array($pathInfo->getGalleryPath(), $album->getName() . ' |' . $album->getUid())) . '/', 'storage' => $this->storage->getUid()); }