/** * @test */ public function buildFilterCriteriaForAllFieldsWithZeroAlbumUid() { Tx_Yag_Domain_Context_YagContextFactory::getInstance()->setAlbumUid(0); $this->albumFilter->init(); $filterQuery = $this->albumFilter->getFilterQuery(); $criteriaArray = $filterQuery->getCriterias(); $this->assertCount(0, $criteriaArray); }
/** * Init the hook for a every contentElement */ protected function init() { if (!class_exists('Tx_Yag_Domain_Context_YagContextFactory')) { throw new Exception('We are not in yag context', 1302280230); } if ($this->currentContextIdentifier != Tx_Yag_Domain_Context_YagContextFactory::getInstance()->getIdentifier()) { $this->currentContextIdentifier = Tx_Yag_Domain_Context_YagContextFactory::getInstance()->getIdentifier(); $this->initVarSetConfig($this->currentContextIdentifier); } }
/** * 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); }
/** * 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 the link to an image * * @param array $arguments Arguments * @param integer $pageUid target page. See TypoLink destination * @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" * @param boolean $linkAccessRestrictedPages If set, links pointing to access restricted pages will still link to the page even though the page cannot be accessed. * @param array $additionalParams additional query parameters that won't be prefixed like $arguments (overrule $arguments) * @param boolean $absolute If set, the URI of the rendered link is absolute * @param boolean $addQueryString If set, the current query parameters will be kept in the URI * @param array $argumentsToBeExcludedFromQueryString arguments to be removed from the URI. Only active if $addQueryString = TRUE * @return string Rendered link */ public function render($pageUid = null, $pageType = 0, array $arguments = array(), $noCache = false, $noCacheHash = false, $section = '', $format = '', $linkAccessRestrictedPages = false, array $additionalParams = array(), $absolute = false, $addQueryString = false, array $argumentsToBeExcludedFromQueryString = array()) { $objectNameSpace = $namespace = Tx_Yag_Domain_Context_YagContextFactory::getInstance()->getObjectNamespace(); $arguments = array(); if (isset($this->arguments['album'])) { $albumUid = $this->arguments['album']->getUid(); $arguments = Tx_PtExtbase_Utility_NameSpace::saveDataInNamespaceTree($objectNameSpace . '.albumUid', $arguments, $albumUid); } if (isset($this->arguments['gallery'])) { $galleryUid = $this->arguments['gallery']->getUid(); $arguments = Tx_PtExtbase_Utility_NameSpace::saveDataInNamespaceTree($objectNameSpace . '.galleryUid', $arguments, $galleryUid); } Tx_PtExtbase_State_Session_SessionPersistenceManagerFactory::getInstance()->addSessionRelatedArguments($arguments); return parent::render('show', $arguments, 'Item', null, null, $pageUid, $pageType, $noCache, $noCacheHash, $section, $format, $linkAccessRestrictedPages, $additionalParams, $absolute, $addQueryString, $argumentsToBeExcludedFromQueryString); }
/** * 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); }
/** * @throws Exception * @return Tx_PtExtlist_Domain_Model_List_ListData */ protected function buildListData() { $type = strtolower($this->arguments['type']); if ($type != 'pre' && $type != 'post') { throw new Exception('The Type should either be pre or post', 1320933448); } $yagContext = Tx_Yag_Domain_Context_YagContextFactory::getInstance(); $itemList = $yagContext->getItemlistContext(); $dataBackend = $itemList->getDataBackend(); /** @var Tx_Yag_Extlist_DataBackend_YagDataBackend $dataBackend */ if ($type == 'pre') { return $dataBackend->getPrePageListData(); } else { return $dataBackend->getPostPageListData(); } }
/** * Build an array of tags while respecting current filterSettings * * @return array */ public function getTagsByCurrentItemListFilterSettings() { $dataBackend = Tx_Yag_Domain_Context_YagContextFactory::getInstance()->getItemlistContext()->getDataBackend(); $statement[] = ' SELECT COUNT(*) as tagCount, tag.name FROM tx_yag_domain_model_tag tag INNER JOIN tx_yag_item_tag_mm mm ON mm.uid_foreign = tag.uid INNER JOIN tx_yag_domain_model_item item ON mm.uid_local = item.uid INNER JOIN tx_yag_domain_model_album album ON item.album = album.uid'; $whereClauses[] = $this->getWhereClauseFromFilterboxes($dataBackend->getFilterboxCollection()); $whereClauses[] = ' item.hidden = 0 AND item.deleted = 0 AND album.deleted = 0 AND album.hidden = 0'; $statement[] = 'WHERE ' . implode(' AND ', $whereClauses); $statement[] = 'GROUP BY tag.name'; $statement[] = 'ORDER BY tagCount DESC'; $statement = implode(" \n", $statement); $statement = str_replace('__self__', 'item', $statement); $query = $this->createQuery(); $result = $query->statement($statement)->execute(true); return $result; }
public function __construct() { parent::__construct(); $this->yagContext = Tx_Yag_Domain_Context_YagContextFactory::getInstance(); $this->yagConfigurationBuilder = Tx_Yag_Domain_Configuration_ConfigurationBuilderFactory::getInstance(); }
/** * @return void */ public function initRenderer() { $this->yagConfigurationBuilder = Tx_Yag_Domain_Context_YagContextFactory::getInstance(); }
/** * (non-PHPdoc) * @see Classes/Domain/Model/Filter/Tx_PtExtlist_Domain_Model_Filter_AbstractFilter::setActiveState() */ public function setActiveState() { if ($this->albumUid > 0 || Tx_Yag_Domain_Context_YagContextFactory::getInstance()->isInStrictFilterMode()) { $this->isActive = true; } }
/** * @return void */ public function initializeAction() { $this->yagContext = Tx_Yag_Domain_Context_YagContextFactory::getInstance(); $this->configurationBuilder = $this->yagContext->getConfigurationBuilder(); }