/** * @return Tx_Yag_Domain_Model_Gallery */ public function getGallery() { if (!$this->selectedGalleryUid) { return NULL; } if ($this->selectedGallery instanceof Tx_Yag_Domain_Model_Gallery && $this->selectedGallery->getUid() == $this->selectedGalleryUid) { return $this->selectedGallery; } else { return $this->objectManager->get('Tx_Yag_Domain_Repository_GalleryRepository')->findByUid($this->selectedGalleryUid); } }
/** * Renders link for an album * * @param int $galleryUid UID of album to render link for * @param \Tx_Yag_Domain_Model_Gallery $gallery Album object to render link for * @param int $pageUid (Optional) ID of page to render link for. If null, current page is used * @param int $pageType * @param bool $noCache * @param bool $noCacheHash * @param string $section * @param string $format * @throws Exception * @return string Rendered link for gallery * */ public function render($galleryUid = null, \Tx_Yag_Domain_Model_Gallery $gallery = null, $pageUid = null, $pageType = 0, $noCache = false, $noCacheHash = false, $section = '', $format = '') { if ($galleryUid === null && $gallery === null) { throw new Exception('You have to set "galleryUid" or "gallery" as parameter. Both parameters can not be empty when using galleryLinkViewHelper', 1295575455); } if ($galleryUid === null) { $galleryUid = $gallery->getUid(); } $namespace = \Tx_Yag_Domain_Context_YagContextFactory::getInstance()->getObjectNamespace() . '.galleryUid'; $arguments = \Tx_PtExtbase_Utility_NameSpace::saveDataInNamespaceTree($namespace, array(), $galleryUid); return parent::render('index', $arguments, 'Gallery', null, null, $pageUid, $pageType, $noCache, $noCacheHash, $section, $format); }
/** * 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); }
protected function buildGalleryObjectInfo(PathInfo $pathInfo, \Tx_Yag_Domain_Model_Gallery $gallery) { return array('name' => $gallery->getName() . ' |' . $gallery->getUid(), 'identifier' => \Tx_Yag_Domain_FileSystem_Div::concatenatePaths(array($pathInfo->getPagePath(), $gallery->getName() . ' |' . $gallery->getUid())), 'storage' => $this->storage->getUid()); }
/** * Count all items that belong to a gallery * * @param Tx_Yag_Domain_Model_Gallery $gallery * @return int */ public function countItemsInGallery(Tx_Yag_Domain_Model_Gallery $gallery) { $query = $this->createQuery(); $statement = 'SELECT count(*) as sumItems FROM `tx_yag_domain_model_item` item INNER JOIN `tx_yag_domain_model_album` album ON item.album = album.uid WHERE album.gallery = %s AND album.deleted = 0 AND album.hidden = 0 AND item.deleted = 0 AND item.hidden = 0 AND item.l18n_parent = 0'; $result = $query->statement(sprintf($statement, $gallery->getUid()))->execute(true); return (int) $result[0]['sumItems']; }