/** * Display a wildcard in the back end * @return string */ public function generate() { if (TL_MODE == 'BE') { $objTemplate = new \BackendTemplate('be_wildcard'); $objTemplate->wildcard = '### EVENT READER ###'; $objTemplate->title = $this->headline; $objTemplate->id = $this->id; $objTemplate->link = $this->name; $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&table=tl_module&act=edit&id=' . $this->id; return $objTemplate->parse(); } // Set the item from the auto_item parameter if ($GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) { \Input::setGet('events', \Input::get('auto_item')); } // Do not index or cache the page if no event has been specified if (!\Input::get('events')) { global $objPage; $objPage->noSearch = 1; $objPage->cache = 0; return ''; } $this->cal_calendar = $this->sortOutProtected(deserialize($this->cal_calendar)); // Do not index or cache the page if there are no calendars if (!is_array($this->cal_calendar) || empty($this->cal_calendar)) { global $objPage; $objPage->noSearch = 1; $objPage->cache = 0; return ''; } return parent::generate(); }
/** * Do not show the module if no calendar has been selected * @return string */ public function generate() { if (TL_MODE == 'BE') { $objTemplate = new \BackendTemplate('be_wildcard'); $objTemplate->wildcard = '### TIMETABLE ###'; $objTemplate->title = $this->headline; $objTemplate->id = $this->id; $objTemplate->link = $this->name; $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id; return $objTemplate->parse(); } $this->cal_calendar = $this->sortOutProtected(deserialize($this->cal_calendar_ext, true)); $this->cal_holiday = $this->sortOutProtected(deserialize($this->cal_holiday, true)); // Return if there are no calendars if (!is_array($this->cal_calendar) || count($this->cal_calendar) < 1) { return ''; } //Get the bg color of the calendar foreach ($this->cal_calendar as $cal) { $objBG = $this->Database->prepare("select bg_color, fg_color from tl_calendar where id = ?")->limit(1)->executeUncached($cal); $this->calConf[$cal]['calendar'] = $objBG->title; if ($objBG->bg_color) { $cssBgValues = deserialize($objBG->bg_color); $this->calConf[$cal]['background'] = 'background-color:#' . $cssBgValues[0] . ';'; if ($cssBgValues[1] > 0) { $this->calConf[$cal]['background'] .= ' opacity:' . (int) $cssBgValues[1] / 100 . ';'; } } if ($objBG->fg_color) { $cssFgValues = deserialize($objBG->fg_color); $this->calConf[$cal]['foreground'] = 'color:#' . $cssFgValues[0] . ';'; if ($cssFgValues[1] > 0) { $this->calConf[$cal]['foreground'] .= ' opacity:' . (int) $cssFgValues[1] / 100 . ';'; } } } //Get the bg color of the holiday calendar foreach ($this->cal_holiday as $cal) { $objBG = $this->Database->prepare("select bg_color, fg_color from tl_calendar where id = ?")->limit(1)->executeUncached($cal); $this->calConf[$cal]['calendar'] = $objBG->title; if ($objBG->bg_color) { $cssBgValues = deserialize($objBG->bg_color); $this->calConf[$cal]['background'] = 'background-color:#' . $cssBgValues[0] . ';'; if ($cssBgValues[1] > 0) { $this->calConf[$cal]['background'] .= ' opacity:' . (int) $cssBgValues[1] / 100 . ';'; } } if ($objBG->fg_color) { $cssFgValues = deserialize($objBG->fg_color); $this->calConf[$cal]['foreground'] = 'color:#' . $cssFgValues[0] . ';'; if ($cssFgValues[1] > 0) { $this->calConf[$cal]['foreground'] .= ' opacity:' . (int) $cssFgValues[1] / 100 . ';'; } } } $this->strUrl = preg_replace('/\\?.*$/', '', \Environment::get('request')); $this->strLink = $this->strUrl; if ($this->jumpTo && ($objTarget = $this->objModel->getRelated('jumpTo')) !== null) { $this->strLink = $this->generateFrontendUrl($objTarget->row()); } return parent::generate(); }
/** * Display a wildcard in the back end * @return string */ public function generate() { if (TL_MODE == 'BE') { $objTemplate = new \BackendTemplate('be_wildcard'); $objTemplate->wildcard = '### EVENT LIST ###'; $objTemplate->title = $this->headline; $objTemplate->id = $this->id; $objTemplate->link = $this->name; $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id; return $objTemplate->parse(); } $this->cal_calendar = $this->sortOutProtected(deserialize($this->cal_calendar_ext, true)); $this->cal_holiday = $this->sortOutProtected(deserialize($this->cal_holiday, true)); // Return if there are no calendars if (!is_array($this->cal_calendar) || empty($this->cal_calendar)) { return ''; } //Get the bg color of the calendar foreach ($this->cal_calendar as $cal) { $objBG = $this->Database->prepare("select bg_color, fg_color from tl_calendar where id = ?")->limit(1)->executeUncached($cal); $this->calConf[$cal]['calendar'] = $objBG->title; if ($objBG->bg_color) { $cssBgValues = deserialize($objBG->bg_color); $this->calConf[$cal]['background'] = 'background-color:#' . $cssBgValues[0] . ';'; if ($cssBgValues[1] > 0) { $this->calConf[$cal]['background'] .= ' opacity:' . (int) $cssBgValues[1] / 100 . ';'; } } if ($objBG->fg_color) { $cssFgValues = deserialize($objBG->fg_color); $this->calConf[$cal]['foreground'] = 'color:#' . $cssFgValues[0] . ';'; if ($cssFgValues[1] > 0) { $this->calConf[$cal]['foreground'] .= ' opacity:' . (int) $cssFgValues[1] / 100 . ';'; } } } //Get the bg color of the holiday calendar foreach ($this->cal_holiday as $cal) { $objBG = $this->Database->prepare("select bg_color, fg_color from tl_calendar where id = ?")->limit(1)->executeUncached($cal); $this->calConf[$cal]['calendar'] = $objBG->title; if ($objBG->bg_color) { $cssBgValues = deserialize($objBG->bg_color); $this->calConf[$cal]['background'] = 'background-color:#' . $cssBgValues[0] . ';'; if ($cssBgValues[1] > 0) { $this->calConf[$cal]['background'] .= ' opacity:' . (int) $cssBgValues[1] / 100 . ';'; } } if ($objBG->fg_color) { $cssFgValues = deserialize($objBG->fg_color); $this->calConf[$cal]['foreground'] = 'color:#' . $cssFgValues[0] . ';'; if ($cssFgValues[1] > 0) { $this->calConf[$cal]['foreground'] .= ' opacity:' . (int) $cssFgValues[1] / 100 . ';'; } } } // Show the event reader if an item has been selected if ($this->cal_readerModule > 0 && (isset($_GET['events']) || $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item']))) { return $this->getFrontendModule($this->cal_readerModule, $this->strColumn); } return parent::generate(); }