Exemple #1
0
 /**
  * Add events to the indexer
  * @param array
  * @param integer
  * @return array
  */
 public function getSearchablePages($arrPages, $intRoot = 0)
 {
     $arrRoot = array();
     if ($intRoot > 0) {
         $arrRoot = $this->Database->getChildRecords($intRoot, 'tl_page');
     }
     $arrProcessed = array();
     // Get all calendars
     $objCalendar = \CalendarModel::findByProtected('');
     // Walk through each calendar
     if ($objCalendar !== null) {
         while ($objCalendar->next()) {
             // Skip calendars without target page
             if (!$objCalendar->jumpTo) {
                 continue;
             }
             // Skip calendars outside the root nodes
             if (!empty($arrRoot) && !in_array($objCalendar->jumpTo, $arrRoot)) {
                 continue;
             }
             // Get the URL of the jumpTo page
             if (!isset($arrProcessed[$objCalendar->jumpTo])) {
                 $domain = \Environment::get('base');
                 $objParent = $this->getPageDetails($objCalendar->jumpTo);
                 // The target page does not exist
                 if ($objParent === null) {
                     continue;
                 }
                 if ($objParent->domain != '') {
                     $domain = (\Environment::get('ssl') ? 'https://' : 'http://') . $objParent->domain . TL_PATH . '/';
                 }
                 $arrProcessed[$objCalendar->jumpTo] = $domain . $this->generateFrontendUrl($objParent->row(), $GLOBALS['TL_CONFIG']['useAutoItem'] ? '/%s' : '/events/%s', $objParent->language);
             }
             $strUrl = $arrProcessed[$objCalendar->jumpTo];
             // Get the items
             $objEvents = \CalendarEventsModel::findPublishedDefaultByPid($objCalendar->id);
             if ($objEvents !== null) {
                 while ($objEvents->next()) {
                     $arrPages[] = sprintf($strUrl, $objEvents->alias != '' && !$GLOBALS['TL_CONFIG']['disableAlias'] ? $objEvents->alias : $objEvents->id);
                 }
             }
         }
     }
     return $arrPages;
 }
Exemple #2
0
 /**
  * Add events to the indexer
  *
  * @param array   $arrPages
  * @param integer $intRoot
  * @param boolean $blnIsSitemap
  *
  * @return array
  */
 public function getSearchablePages($arrPages, $intRoot = 0, $blnIsSitemap = false)
 {
     $arrRoot = array();
     if ($intRoot > 0) {
         $arrRoot = $this->Database->getChildRecords($intRoot, 'tl_page');
     }
     $arrProcessed = array();
     $time = \Date::floorToMinute();
     // Get all calendars
     $objCalendar = \CalendarModel::findByProtected('');
     // Walk through each calendar
     if ($objCalendar !== null) {
         while ($objCalendar->next()) {
             // Skip calendars without target page
             if (!$objCalendar->jumpTo) {
                 continue;
             }
             // Skip calendars outside the root nodes
             if (!empty($arrRoot) && !in_array($objCalendar->jumpTo, $arrRoot)) {
                 continue;
             }
             // Get the URL of the jumpTo page
             if (!isset($arrProcessed[$objCalendar->jumpTo])) {
                 $objParent = \PageModel::findWithDetails($objCalendar->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 + 60) {
                     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[$objCalendar->jumpTo] = $domain . $this->generateFrontendUrl($objParent->row(), \Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/%s' : '/events/%s', $objParent->language);
             }
             $strUrl = $arrProcessed[$objCalendar->jumpTo];
             // Get the items
             $objEvents = \CalendarEventsModel::findPublishedDefaultByPid($objCalendar->id);
             if ($objEvents !== null) {
                 while ($objEvents->next()) {
                     $arrPages[] = sprintf($strUrl, $objEvents->alias != '' && !\Config::get('disableAlias') ? $objEvents->alias : $objEvents->id);
                 }
             }
         }
     }
     return $arrPages;
 }
Exemple #3
0
 /**
  * Add events to the indexer
  *
  * @param array   $arrPages
  * @param integer $intRoot
  * @param boolean $blnIsSitemap
  *
  * @return array
  */
 public function getSearchablePages($arrPages, $intRoot = 0, $blnIsSitemap = false)
 {
     $arrRoot = array();
     if ($intRoot > 0) {
         $arrRoot = $this->Database->getChildRecords($intRoot, 'tl_page');
     }
     $arrProcessed = array();
     $time = \Date::floorToMinute();
     // Get all calendars
     $objCalendar = \CalendarModel::findByProtected('');
     // Walk through each calendar
     if ($objCalendar !== null) {
         while ($objCalendar->next()) {
             // Skip calendars without target page
             if (!$objCalendar->jumpTo) {
                 continue;
             }
             // Skip calendars outside the root nodes
             if (!empty($arrRoot) && !in_array($objCalendar->jumpTo, $arrRoot)) {
                 continue;
             }
             // Get the URL of the jumpTo page
             if (!isset($arrProcessed[$objCalendar->jumpTo])) {
                 $objParent = \PageModel::findWithDetails($objCalendar->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 + 60) {
                     continue;
                 }
                 if ($blnIsSitemap) {
                     // The target page is protected (see #8416)
                     if ($objParent->protected) {
                         continue;
                     }
                     // The target page is exempt from the sitemap (see #6418)
                     if ($objParent->sitemap == 'map_never') {
                         continue;
                     }
                 }
                 // Generate the URL
                 $arrProcessed[$objCalendar->jumpTo] = $objParent->getAbsoluteUrl(\Config::get('useAutoItem') ? '/%s' : '/events/%s');
             }
             $strUrl = $arrProcessed[$objCalendar->jumpTo];
             // Get the items
             $objEvents = \CalendarEventsModel::findPublishedDefaultByPid($objCalendar->id);
             if ($objEvents !== null) {
                 while ($objEvents->next()) {
                     $arrPages[] = sprintf($strUrl, $objEvents->alias ?: $objEvents->id);
                 }
             }
         }
     }
     return $arrPages;
 }