Esempio n. 1
0
 /**
  * getAlbums function.
  *
  * @access public
  * @return object
  */
 public function getAlbums()
 {
     $objPa2Album = new \Pa2Album($this->getAlbumIds(), $this->getData());
     return $objPa2Album->getAlbums();
 }
 /**
  * addLinkToTemplate function.
  *
  * @access protected
  * @param  object $objTemplate
  * @param  object $objAlbum
  * @return object
  */
 protected function addLinkToTemplate($objTemplate, $objAlbum)
 {
     global $objPage;
     // Check
     if (!is_object($objTemplate)) {
         return $objTemplate;
     }
     if (is_numeric($objAlbum)) {
         $objPa2Album = new \Pa2Album($objAlbum, $objTemplate->getData());
         $objAlbum = $objPa2Album->getAlbums();
         $objAlbum = $objAlbum->current();
     }
     if (!is_object($objAlbum)) {
         return $objTemplate;
     }
     // Add array
     $arrLink = array('id' => $objPage->id, 'alias' => $objPage->alias);
     if (!empty($objTemplate->intDetailPage) && is_numeric($objTemplate->intDetailPage)) {
         $objDetailPage = $this->getPageDetails($objTemplate->intDetailPage);
         $arrLink['id'] = $objDetailPage->id;
         $arrLink['alias'] = $objDetailPage->alias;
         $arrLink['language'] = $objDetailPage->language;
     }
     $objTemplate->href = $this->generateFrontendUrl($arrLink, sprintf($GLOBALS['TL_CONFIG']['useAutoItem'] ? '/%s' : '/album/%s', $objAlbum->alias), $objDetailPage->language);
     return $objTemplate;
 }
 /**
  * compile function.
  *
  * @access protected
  * @return void
  */
 protected function compile()
 {
     global $objPage;
     // Generate new template object
     $objTemplate = new \FrontendTemplate($this->Template->strTemplate);
     $objTemplate->setData($this->Template->getData());
     $this->Template = $objTemplate;
     // Get album id
     $objPa2Album = new \Pa2Album($this->getAlbumIdOrAlias(), $this->Template->getData());
     $objAlbum = $objPa2Album->getAlbums();
     // If there is no album
     if (!is_object($objAlbum) || $objAlbum === null) {
         $this->setEmptyTemplate($GLOBALS['TL_LANG']['MSC']['albumNotFound']);
         return;
     }
     // If there are no images
     if (count($objAlbum->arrSortedImageUuids) < 1) {
         $this->setEmptyTemplate($GLOBALS['TL_LANG']['MSC']['imagesNotFound']);
         return;
     }
     // Get only the current object
     $objAlbum = $objAlbum->current();
     // Do this only in the Frontend
     if (TL_MODE == 'FE' && in_array($this->Template->pa2type, array('MOD', 'MOD_VIEW'))) {
         // Overwrite the page title
         if ($objAlbum->title != '') {
             $objPage->pageTitle = strip_tags(strip_insert_tags($objAlbum->title));
         }
         // Overwrite the page description
         if ($objAlbum->description != '') {
             $objPage->description = $this->prepareMetaDescription($objAlbum->description);
         }
         // Add comments module
         $this->addComments($objAlbum);
     }
     // Set arrItems and objAlbum
     $this->arrItems = $objAlbum->arrSortedImageUuids;
     $this->objAlbum = $objAlbum;
     // Pagination
     $objPa2Pagination = new \Pa2Pagination($this->arrItems, $this->Template->intMaxItems, $this->Template->intItemsPerPage);
     $this->arrAllItems = $this->arrItems;
     $this->arrItems = $objPa2Pagination->getItems();
     $this->Template->pagination = $objPa2Pagination->getPagination();
     $this->Template->totalItems = $objPa2Pagination->getTotalItems();
     // Call parseImages
     $this->parseImages();
 }
 /**
  * compile function.
  *
  * @access protected
  * @return void
  */
 protected function compile()
 {
     // Generate new template object
     $objTemplate = new \FrontendTemplate($this->Template->strTemplate);
     $objTemplate->setData($this->Template->getData());
     $this->Template = $objTemplate;
     // Get album ids from archives
     $objPa2Archive = new \Pa2Archive($this->Template->pa2Archives, $this->Template->getData());
     $arrAllAlbums = $objPa2Archive->getAlbumIds();
     // If there are no albums, show empty template with a message
     if (count($arrAllAlbums) < 1) {
         $this->setEmptyTemplate($GLOBALS['TL_LANG']['MSC']['albumsNotFound']);
         return;
     }
     // Set the pagination
     $objPa2Pagination = new \Pa2Pagination($arrAllAlbums, $this->Template->intMaxItems, $this->Template->intItemsPerPage);
     $arrAlbums = $objPa2Pagination->getItems();
     $this->Template->pagination = $objPa2Pagination->getPagination();
     $this->Template->totalItems = $objPa2Pagination->getTotalItems();
     // Get albums of this page as object
     $objPa2Album = new \Pa2Album($arrAlbums, $this->Template->getData());
     $this->objAlbums = $objPa2Album->getAlbums();
     // Call parseAlbums
     $this->parseAlbums();
 }