/**
  * Add product items to the indexer
  * @param array
  * @param integer
  * @param boolean
  * @return array
  */
 public function getSearchablePages($arrPages, $intRoot = 0, $blnIsSitemap = false)
 {
     $arrRoot = array();
     if ($intRoot > 0) {
         $arrRoot = $this->Database->getChildRecords($intRoot, 'tl_page');
     }
     $time = time();
     $arrProcessed = array();
     // Get all catalog categories
     $objPhotogallery = \PhotogalleryModel::findByProtected('');
     // Walk through each archive
     if ($objPhotogallery !== null) {
         while ($objPhotogallery->next()) {
             // Skip catalog categories without target page
             if (!$objPhotogallery->jumpTo) {
                 continue;
             }
             // Skip catalog categories outside the root nodes
             if (!empty($arrRoot) && !in_array($objPhotogallery->jumpTo, $arrRoot)) {
                 continue;
             }
             // Get the URL of the jumpTo page
             if (!isset($arrProcessed[$objPhotogallery->jumpTo])) {
                 $objParent = \PageModel::findWithDetails($objPhotogallery->jumpTo);
                 // The target page does not exist
                 if ($objParent === null) {
                     continue;
                 }
                 // The target page has not been published (see #5520)
                 if (!$objParent->published || $objParent->start != '' && $objParent->start > $time || $objParent->stop != '' && $objParent->stop < $time) {
                     continue;
                 }
                 // The target page is exempt from the sitemap (see #6418)
                 if ($blnIsSitemap && $objParent->sitemap == 'map_never') {
                     continue;
                 }
                 // Set the domain (see #6421)
                 $domain = ($objParent->rootUseSSL ? 'https://' : 'http://') . ($objParent->domain ?: \Environment::get('host')) . TL_PATH . '/';
                 // Generate the URL
                 $arrProcessed[$objPhotogallery->jumpTo] = $domain . $this->generateFrontendUrl($objParent->row(), \Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/%s' : '/items/%s', $objParent->language);
             }
             $strUrl = $arrProcessed[$objPhotogallery->jumpTo];
             // Get the items
             $objAlbum = \PhotogalleryAlbumModel::findPublishedByPid($objPhotogallery->id);
             if ($objAlbum !== null) {
                 while ($objAlbum->next()) {
                     $arrPages[] = $this->getLink($objAlbum, $strUrl);
                 }
             }
         }
     }
     return $arrPages;
 }
 /**
  * Generate the module
  */
 protected function compile()
 {
     global $objPage;
     $this->Template->albums = '';
     $this->Template->referer = 'javascript:history.go(-1)';
     $this->Template->back = $GLOBALS['TL_LANG']['MSC']['goBack'];
     $objAlbum = \PhotogalleryAlbumModel::findPublishedByParentAndIdOrAlias(\Input::get('items'), $this->photogalleries);
     // Overwrite the page title
     if ($objAlbum->title != '') {
         $objPage->pageTitle = strip_tags(strip_insert_tags($objAlbum->title));
     }
     // Overwrite the page description
     if ($objProduct->description != '') {
         $objPage->description = $this->prepareMetaDescription($objAlbum->description);
     }
     $arrAlbum = $this->parseAlbumFull($objAlbum);
     $this->Template->albums = $arrAlbum;
 }
 /**
  * Generate the module
  */
 protected function compile()
 {
     $offset = intval($this->skipFirst);
     $limit = null;
     // Maximum number of items
     if ($this->numberOfItems > 0) {
         $limit = $this->numberOfItems;
     }
     // Handle featured news
     if ($this->photogallery_featured == 'featured') {
         $blnFeatured = true;
     } elseif ($this->photogallery_featured == 'unfeatured') {
         $blnFeatured = false;
     } else {
         $blnFeatured = null;
     }
     $this->Template->albums = array();
     $this->Template->empty = $GLOBALS['TL_LANG']['MSC']['emptyPhotogallery'];
     $intTotal = \PhotogalleryAlbumModel::countPublishedByPids($this->photogalleries);
     if ($intTotal < 1) {
         return;
     }
     $total = $intTotal - $offset;
     // Split the results
     if ($this->perPage > 0 && (!isset($limit) || $this->numberOfItems > $this->perPage)) {
         // Adjust the overall limit
         if (isset($limit)) {
             $total = min($limit, $total);
         }
         // Get the current page
         $id = 'page_n' . $this->id;
         $page = \Input::get($id) ?: 1;
         // Do not index or cache the page if the page number is outside the range
         if ($page < 1 || $page > max(ceil($total / $this->perPage), 1)) {
             global $objPage;
             $objPage->noSearch = 1;
             $objPage->cache = 0;
             // Send a 404 header
             header('HTTP/1.1 404 Not Found');
             return;
         }
         // Set limit and offset
         $limit = $this->perPage;
         $offset += (max($page, 1) - 1) * $this->perPage;
         $skip = intval($this->skipFirst);
         // Overall limit
         if ($offset + $limit > $total + $skip) {
             $limit = $total + $skip - $offset;
         }
         // Add the pagination menu
         $objPagination = new \Pagination($total, $this->perPage, \Config::get('maxPaginationLinks'), $id);
         $this->Template->pagination = $objPagination->generate("\n  ");
     }
     // Get the items
     if (isset($limit)) {
         $objAlbums = \PhotogalleryAlbumModel::findPublishedByPids($this->photogalleries, $blnFeatured, $limit, $offset);
     } else {
         $objAlbums = \PhotogalleryAlbumModel::findPublishedByPids($this->photogalleries, $blnFeatured, 0, $offset);
     }
     // Add the albums
     if ($objAlbums !== null) {
         $this->Template->albums = $this->parseAlbums($objAlbums);
     }
     $this->Template->gategories = $this->photogalleries;
 }