/**
  * Generate the module
  */
 protected function compile()
 {
     global $objPage;
     $this->import('Sermoner');
     $objSermon = \SermonerItemsModel::findByPk($this->sermon);
     $objConfig = new \stdClass();
     $objConfig->template = 'sermon_startpage';
     if ($objSermon->published) {
         $this->Template->sermon = $this->Sermoner->parseSermon($objSermon, false, '', 0, $objConfig);
         $GLOBALS['TL_HEAD'][] = '<meta property="og:title" content="' . $objSermon->title . '"/>';
     }
 }
 /**
  * Generate the module
  */
 protected function compile()
 {
     global $objPage;
     $this->import('Sermoner');
     $this->Template->sermons = '';
     // Get the sermon item
     $objSermon = \SermonerItemsModel::findPublishedByParentAndIdOrAlias(\Input::get('items'), $this->serm_sermonarchive);
     if ($objSermon === null) {
         // Do not index or cache the page
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         // Send a 404 header
         header('HTTP/1.1 404 Not Found');
         $this->Template->sermons = '<p class="error">' . sprintf($GLOBALS['TL_LANG']['MSC']['invalidPage'], \Input::get('items')) . '</p>';
         return;
     }
     //Add OG-Tags for Facebook to Head
     $GLOBALS['TL_HEAD'][] = '<meta property="og:title" content="' . $objSermon->title . '"/>';
     $GLOBALS['TL_HEAD'][] = '<meta property="og:description" content="Eine Predigt der Kirche Lindenwiese mit ' . $objSermon->speaker . '"/>';
     // Add an image
     if ($objSermon->addImage && $objSermon->singleSRC != '') {
         $objModel = \FilesModel::findByUuid($objSermon->singleSRC);
         if (is_file(TL_ROOT . '/' . $objModel->path)) {
             $GLOBALS['TL_HEAD'][] = '<meta property="og:image" content="' . \Environment::get('base') . $objModel->path . '"/>';
         }
     }
     //Configuration
     $objConfig = new \stdClass();
     $objConfig->template = $this->serm_template;
     $strSermon = $this->Sermoner->parseSermon($objSermon, false, '', 0, $objConfig);
     $this->Template->sermons = $strSermon;
     // Overwrite the page title (see #2853 and #4955)
     if ($objSermon->title != '') {
         $objPage->pageTitle = strip_tags(strip_insert_tags($objSermon->title));
     }
     //Weiterleitung auf Predigtarchiv, wenn in Moduleeinstellungen gesetzt (Ausnahme: Facebook-Crawler)
     if ($this->skipReader) {
         if (\Environment::get('httpUserAgent') != "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)") {
             if (($objNextPage = \PageModel::findPublishedById($this->jumpToList)) !== null) {
                 $this->redirect($this->generateFrontendUrl($objNextPage->row()) . "#" . standardize(\String::restoreBasicEntities($objSermon->title)));
             }
         }
     }
     return;
 }
예제 #3
0
 /**
  * Generate the module
  */
 protected function compile()
 {
     $this->import('Sermoner');
     $offset = intval($this->skipFirst);
     $limit = null;
     $this->Template->sermons = array();
     // Maximum number of items
     if ($this->numberOfItems > 0) {
         $limit = $this->numberOfItems;
     }
     // Get the total number of items
     $intTotal = \SermonerItemsModel::countPublishedByPids($this->serm_sermonarchive);
     if ($intTotal < 1) {
         $this->Template = new \FrontendTemplate('mod_sermonlist_empty');
         $this->Template->empty = $GLOBALS['TL_LANG']['MSC']['emptyList'];
         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, $GLOBALS['TL_CONFIG']['maxPaginationLinks'], $id);
         $this->Template->pagination = $objPagination->generate("\n  ");
     }
     //Configuration
     $objConfig = new \stdClass();
     $objConfig->feedHref = sprintf("%s/share/%s.xml", \Environment::get('path'), \SermonFeedModel::findByPk($this->linkedRssFeed)->alias);
     $objConfig->feedIcon = $this->iconSRC;
     $objConfig->template = $this->serm_template;
     // Get the items
     if (isset($limit)) {
         $objSermons = \SermonerItemsModel::findPublishedByPids($this->serm_sermonarchive, $limit, $offset);
     } else {
         $objSermons = \SermonerItemsModel::findPublishedByPids($this->serm_sermonarchive, 0, $offset);
     }
     // No items found
     if ($objSermons === null) {
         $this->Template = new \FrontendTemplate('mod_sermonlist_empty');
         $this->Template->empty = $GLOBALS['TL_LANG']['MSC']['emptyList'];
     } else {
         $this->Template->sermons = $this->Sermoner->parseSermons($objSermons, $objConfig);
     }
 }
예제 #4
0
 /**
  * Add news 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 news archives
     $objArchive = \SermonArchiveModel::findByProtected('');
     // Walk through each archive
     if ($objArchive !== null) {
         while ($objArchive->next()) {
             // Skip news archives without target page
             if (!$objArchive->jumpTo) {
                 continue;
             }
             // Skip news archives outside the root nodes
             if (!empty($arrRoot) && !in_array($objArchive->jumpTo, $arrRoot)) {
                 continue;
             }
             // Get the URL of the jumpTo page
             if (!isset($arrProcessed[$objArchive->jumpTo])) {
                 $objParent = \PageModel::findWithDetails($objArchive->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[$objArchive->jumpTo] = $domain . $this->generateFrontendUrl($objParent->row(), $GLOBALS['TL_CONFIG']['useAutoItem'] && !$GLOBALS['TL_CONFIG']['disableAlias'] ? '/%s' : '/items/%s', $objParent->language);
             }
             $strUrl = $arrProcessed[$objArchive->jumpTo];
             // Get the items
             $objSermons = \SermonerItemsModel::findPublishedDefaultByPid($objArchive->id);
             if ($objSermons !== null) {
                 while ($objSermons->next()) {
                     $arrPages[] = $this->getLink($objSermons, $strUrl);
                 }
             }
         }
     }
     return $arrPages;
 }