コード例 #1
0
 /**
  * Generate the module
  */
 protected function compile()
 {
     parent::compile();
     // HOOK: add custom logic
     if (isset($GLOBALS['TL_HOOKS']['compileSlickEventList']) && is_array($GLOBALS['TL_HOOKS']['compileSlickEventList'])) {
         foreach ($GLOBALS['TL_HOOKS']['compileSlickEventList'] as $callback) {
             $this->import($callback[0]);
             $this->{$callback}[0]->{$callback}[1]($this->Template, $this, $this->objModel);
         }
     }
 }
コード例 #2
0
ファイル: ModuleEventlistTags.php プロジェクト: AgentCT/tags
 /**
  * Generate module
  */
 protected function getAllEvents($arrCalendars, $intStart, $intEnd)
 {
     $arrAllEvents = parent::getAllEvents($arrCalendars, $intStart, $intEnd);
     if ($this->tag_ignore && !strlen($this->tag_filter)) {
         return $arrAllEvents;
     }
     if (strlen(\Input::get('tag')) || strlen($this->tag_filter)) {
         $limit = null;
         $offset = 0;
         $tagids = array();
         if (strlen($this->tag_filter)) {
             $tagids = $this->getFilterTags();
         }
         $relatedlist = strlen(\Input::get('related')) ? preg_split("/,/", \Input::get('related')) : array();
         $tagArray = strlen(\Input::get('tag')) ? array(\Input::get('tag')) : array();
         $alltags = array_merge($tagArray, $relatedlist);
         foreach ($alltags as $tag) {
             if (count($tagids)) {
                 $tagids = $this->Database->prepare("SELECT tid FROM tl_tag WHERE from_table = ? AND tag = ? AND tid IN (" . join($tagids, ",") . ")")->execute('tl_calendar_events', $tag)->fetchEach('tid');
             } else {
                 $tagids = $this->Database->prepare("SELECT tid FROM tl_tag WHERE from_table = ? AND tag = ?")->execute('tl_calendar_events', $tag)->fetchEach('tid');
             }
         }
         if (count($tagids)) {
             foreach ($arrAllEvents as $allEventsIdx => $days) {
                 foreach ($days as $daysIdx => $day) {
                     foreach ($day as $dayIdx => $event) {
                         if (!in_array($event['id'], $tagids)) {
                             unset($arrAllEvents[$allEventsIdx][$daysIdx][$dayIdx]);
                         }
                     }
                 }
             }
         } else {
             $arrAllEvents = array();
         }
     }
     return $arrAllEvents;
 }