Exemplo n.º 1
0
 /**
  * Generate the comments and return them as HTML string
  * @param string
  * @param mixed
  * @return string
  */
 public static function generateComments($strShortname, $varIdentifier = null)
 {
     $objTemplate = new \FrontendTemplate('disqus');
     $objTemplate->shortname = $strShortname;
     $objTemplate->identifier = $varIdentifier;
     return $objTemplate->parse();
 }
 public function inject($strBuffer, $strTemplate)
 {
     // check for appId and version in config
     if (!$GLOBALS['TL_CONFIG']['fb_app_id'] || !$GLOBALS['TL_CONFIG']['fb_app_version']) {
         return $strBuffer;
     }
     // check for frontend or backend template
     if (stripos($strTemplate, 'fe_') === false && stripos($strTemplate, 'be_main') === false) {
         return $strBuffer;
     }
     // check for <body
     if (stripos($strBuffer, '<body') === false) {
         return $strBuffer;
     }
     // determine language string
     $lang = $GLOBALS['TL_LANGUAGE'];
     if (strlen($lang) == 2) {
         $lang = strtolower($lang) . '_' . strtoupper($lang);
     } else {
         $lang = str_replace('-', '_', $lang);
     }
     // create the template
     $objTemplate = new \FrontendTemplate('facebook-js-sdk');
     // set data
     $objTemplate->appId = $GLOBALS['TL_CONFIG']['fb_app_id'];
     $objTemplate->version = $GLOBALS['TL_CONFIG']['fb_app_version'];
     $objTemplate->lang = $lang;
     // search for body and inject template
     $strBuffer = preg_replace("/(<body.*>)/", "\$1" . $objTemplate->parse(), $strBuffer);
     // return the buffer
     return $strBuffer;
 }
 public function generateAddActions($arrData, $id, Watchlist $objWatchlist)
 {
     global $objPage;
     if ($objPage === null) {
         return;
     }
     if (\Validator::isUuid($id)) {
         $objFile = \FilesModel::findByUuid($id);
     } else {
         $objFile = \FilesModel::findBy('path', $id);
     }
     $objItem = new WatchlistItemModel();
     $objItem->pid = Watchlist::getInstance()->getId();
     $objItem->uuid = $objFile->uuid;
     $objItem->pageID = $objPage->id;
     $objItem->cid = $arrData['id'];
     $objItem->type = $arrData['type'];
     $objT = new \FrontendTemplate('watchlist_add_actions');
     $objT->addHref = ampersand(\Controller::generateFrontendUrl($objPage->row()) . '?act=' . WATCHLIST_ACT_ADD . '&cid=' . $objItem->cid . '&type=' . $objItem->type . '&id=' . $strUuid . '&title=' . urlencode($objItem->getTitle()));
     $objT->addTitle = $GLOBALS['TL_LANG']['WATCHLIST']['addTitle'];
     $objT->addLink = $GLOBALS['TL_LANG']['WATCHLIST']['addLink'];
     $objT->active = $objWatchlist->isInList($strUuid);
     $objT->id = $strUuid;
     return $objT->parse();
 }
 protected function generateFilterBox($filter)
 {
     $arrLinks = array();
     $baseurl = $this->generateFrontendUrl($this->arrJump);
     $objT = new \FrontendTemplate('mod_filterlink_set');
     $objT->title = $GLOBALS['TL_LANG']['articlefilter']['selectedFilter'];
     $objT->baseurl = $baseurl;
     $objT->removeAll = $GLOBALS['TL_LANG']['articlefilter']['removeAll'];
     if (!is_array($filter) || count($filter) == 0) {
         return '';
     }
     foreach ($filter as $grp => $f) {
         foreach ($f as $id) {
             $arrAdd[] = sprintf('articlefilter_filter[%s][]=%s', $grp, $id);
             $lbl[] = $this->getFilterTitle($id);
         }
     }
     for ($x = 0; $x < count($arrAdd); $x++) {
         $add = $arrAdd;
         unset($add[$x]);
         $arrLinks[] = ['href' => sprintf('%s?%s', $baseurl, implode('&', $add)), 'title' => $lbl[$x]];
     }
     $objT->links = $arrLinks;
     return $objT->parse();
 }
 protected function compile()
 {
     $GLOBALS['TL_JAVASCRIPT']['articlefilter'] = 'system/modules/articlefilter/assets/articlefilter.js';
     $arrGroups = deserialize($this->articlefilter_groups);
     $arrSelected = \Input::get('articlefilter_filter');
     $res = $this->Database->prepare('SELECT * from tl_articlefilter_groups where id IN (' . implode(',', $arrGroups) . ') AND published = 1 ORDER BY FIELD(id, ' . implode(',', $arrGroups) . ')')->execute();
     if ($res->numRows > 0) {
         $arrBoxes = [];
         $this->Template->hasGroups = true;
         $id = 0;
         while ($res->next()) {
             $arrCriteria = $this->loadCriteriaByGroup($res->id);
             if (is_array($arrCriteria)) {
                 $id++;
                 $objCB = new \FrontendTemplate($res->template);
                 $objCB->items = $arrCriteria;
                 $objCB->title = $res->title;
                 $objCB->name = $res->id;
                 $objCB->selected = $arrSelected[$res->id];
                 $objCB->id = $id;
                 $arrBoxes[] = $objCB->parse();
             }
         }
         /* jumpTo Page */
         $arrJump = $this->Database->prepare('SELECT id, alias from tl_page where id=?')->execute($this->jumpTo)->fetchAssoc();
         $this->Template->criterias = implode("\n", $arrBoxes);
         $this->Template->href = $this->generateFrontendUrl($arrJump);
         $this->Template->lblSubmit = $GLOBALS['TL_LANG']['articlefilter']['lblSubmit'];
         $this->Template->selectedMatchType = \Input::get('afstype') ? \Input::get('afstype') : $this->articlefilter_defaultfilter;
         $this->Template->lblMatches = $GLOBALS['TL_LANG']['articlefilter']['lblMatches'];
         $this->Template->lblAny = $GLOBALS['TL_LANG']['articlefilter']['lblAny'];
         $this->Template->lblAll = $GLOBALS['TL_LANG']['articlefilter']['lblAll'];
     }
 }
Exemplo n.º 6
0
 public function __construct()
 {
     // if the application wasn't defined before we will define it
     if (!defined('NAMED_APPLICATION')) {
         define('NAMED_APPLICATION', 'frontend');
     }
     // set the module
     $this->setModule(SpoonFilter::getGetValue('module', null, ''));
     // set the requested file
     $this->setFile(SpoonFilter::getGetValue('file', null, ''));
     // set the language
     $this->setLanguage(SpoonFilter::getGetValue('language', FrontendLanguage::getActiveLanguages(), SITE_DEFAULT_LANGUAGE));
     // create a new template instance (this will handle all stuff for us)
     $tpl = new FrontendTemplate();
     // enable addslashes on each locale
     $tpl->setAddSlashes(true);
     // set correct headers
     SpoonHTTP::setHeaders('content-type: application/javascript');
     // fetch the template path
     if ($this->module == 'core') {
         $file = FRONTEND_CORE_PATH . '/js/' . $this->getFile();
     } else {
         $file = FRONTEND_MODULES_PATH . '/' . $this->getModule() . '/js/' . $this->getFile();
     }
     // output the template
     $tpl->display(FrontendTheme::getPath($file), true);
 }
Exemplo n.º 7
0
 /**
  * Add the cookie HTML buffer
  * @param string
  * @return string
  */
 public function addCookiebarBuffer($strContent)
 {
     if ($this->isCookiebarEnabled()) {
         $objRoot = $this->getCurrentRootPage();
         $objTemplate = new \FrontendTemplate('cookiebar_default');
         $objTemplate->message = $objRoot->cookiebar_message;
         $objTemplate->position = $objRoot->cookiebar_position;
         $objTemplate->button = $objRoot->cookiebar_button;
         $objTemplate->cookie = $this->getCookiebarName($objRoot);
         $objTemplate->more = '';
         // Add the "more" link
         if ($objRoot->cookiebar_jumpTo > 0) {
             $objJump = \PageModel::findByPk($objRoot->cookiebar_jumpTo);
             if ($objJump !== null) {
                 $objJump->loadDetails();
                 $objTemplate->more = $GLOBALS['TL_LANG']['MSC']['more'];
                 $objTemplate->moreHref = ampersand($this->generateFrontendUrl($objJump->row(), null, $objJump->language));
                 $objTemplate->moreTitle = specialchars($GLOBALS['TL_LANG']['MSC']['more']);
             }
         }
         // Place the cookiebar in DOM structure
         if ($objRoot->cookiebar_placement === 'before_wrapper') {
             $strContent = str_replace('<div id="wrapper">', $objTemplate->parse() . '<div id="wrapper">', $strContent);
         } else {
             $strContent = str_replace('</body>', $objTemplate->parse() . '</body>', $strContent);
         }
     }
     return $strContent;
 }
Exemplo n.º 8
0
 protected function parseCredit($objItem)
 {
     global $objPage;
     $objCredit = new FileCreditHybridModel();
     $objCredit = $objCredit->findRelatedByCredit($objItem, $this->arrPids);
     if (is_null($objCredit)) {
         return null;
     }
     $objTemplate = new \FrontendTemplate('filecredit_default');
     $objTemplate->setData($objCredit->file->row());
     // TODO
     $objTemplate->link = $this->generateCreditUrl($objCredit);
     $objTemplate->linkText = $GLOBALS['TL_LANG']['MSC']['creditLinkText'];
     // TODO
     if ($objCredit->page === null && $objCredit->result->usage) {
         $objTemplate->pageTitle = $objCredit->result->usage;
     } else {
         $objTemplate->pageTitle = $objCredit->page->pageTitle ? $objCredit->page->pageTitle : $objCredit->page->title;
     }
     // colorbox support
     if ($objPage->outputFormat == 'xhtml') {
         $strLightboxId = 'lightbox';
     } else {
         $strLightboxId = 'lightbox[' . substr(md5($objTemplate->getName() . '_' . $objCredit->file->id), 0, 6) . ']';
     }
     $objTemplate->attribute = $strLightboxId ? ($objPage->outputFormat == 'html5' ? ' data-gallery="#gallery-' . $this->id . '" data-lightbox="' : ' rel="') . $strLightboxId . '"' : '';
     return $objTemplate->parse();
 }
Exemplo n.º 9
0
 /**
  * Generate module
  */
 protected function compile()
 {
     // Get ID
     $strAlias = \Input::get('auto_item') ? \Input::get('auto_item') : \Input::get('store');
     // Find published store from ID
     if (($objStore = AnyStoresModel::findPublishedByIdOrAlias($strAlias)) !== null) {
         // load all details
         $objStore->loadDetails();
         // generate description
         $objDescription = \ContentModel::findPublishedByPidAndTable($objStore->id, $objStore->getTable());
         if ($objDescription !== null) {
             while ($objDescription->next()) {
                 $objStore->description .= \Controller::getContentElement($objDescription->current());
             }
         }
         // Get referer for back button
         $objStore->referer = $this->getReferer();
         // generate google map if template and geodata is set
         if ($this->anystores_mapTpl != '' && is_numeric($objStore->latitude) && is_numeric($objStore->longitude)) {
             $objMapTemplate = new \FrontendTemplate($this->anystores_mapTpl);
             $objMapTemplate->setData($objStore->row());
             $objStore->gMap = $objMapTemplate->parse();
         }
         // Template
         $objDetailTemplate = new \FrontendTemplate($this->anystores_detailTpl);
         $objDetailTemplate->setData($objStore->row());
         $this->Template->store = $objDetailTemplate->parse();
     } else {
         $this->_redirect404();
     }
 }
 /**
  * Generate the module
  */
 protected function compile()
 {
     $navTpl = new \FrontendTemplate($this->navigationTpl ?: 'nav_default');
     $navTpl->level = 0;
     $navTpl->items = $this->buildNavigationItems();
     $this->Template->navigation = $navTpl->parse();
 }
 public function parseMap()
 {
     $objT = new \FrontendTemplate($this->strTemplate);
     $objT->setData($GLOBALS['TL_LANG']['imagemapster']);
     $objT->active = $this->active;
     return $objT->parse();
 }
Exemplo n.º 12
0
 protected function compile()
 {
     $strHtml = '';
     $objTemplateTable = new \FrontendTemplate('hvv_tabelle');
     if ($this->hvv_liga) {
         $arrJson = json_decode(file_get_contents('http://service.mindbird.de/hvv-tabelle/www/' . $this->hvv_liga . '.json'), true);
         $strHtmlTable = '';
         foreach ($arrJson['table'] as $arrTeam) {
             $objTemplate = new \FrontendTemplate('hvv_tabelle_zeile');
             $objTemplate->position = $arrTeam['position'];
             $objTemplate->team = $arrTeam['team'];
             $objTemplate->games_count = $arrTeam['games']['count'];
             $objTemplate->games_3031 = $arrTeam['games']['3031'];
             $objTemplate->games_32 = $arrTeam['games']['32'];
             $objTemplate->games_23 = $arrTeam['games']['23'];
             $objTemplate->games_1303 = $arrTeam['games']['1303'];
             $objTemplate->balls_positiv = $arrTeam['balls']['positiv'];
             $objTemplate->balls_negativ = $arrTeam['balls']['negativ'];
             $objTemplate->sets_positiv = $arrTeam['sets']['positiv'];
             $objTemplate->sets_negativ = $arrTeam['sets']['negativ'];
             $objTemplate->points = $arrTeam['points'];
             if ($arrTeam['team'] == $this->hvv_mannschaft) {
                 $objTemplate->home_team = true;
             }
             $strHtmlTable .= $objTemplate->parse();
         }
         $objTemplateTable->strHtml = $strHtmlTable;
     }
     $this->Template->strHtml = $objTemplateTable->parse();
 }
Exemplo n.º 13
0
 protected function parseJs()
 {
     $objT = new \FrontendTemplate($this->strTemplate);
     $objT->setData($this->arrData);
     $objT->id = '#ctrl_' . $this->strName;
     return $objT->parse();
 }
 public function parsePromoter($objPromoter, $index = null, array $arrPromoters = array())
 {
     $strTemplate = $this->cal_promoterTemplate ? $this->cal_promoterTemplate : 'cal_promoter_default';
     $objT = new \FrontendTemplate($strTemplate);
     $objT->setData($objPromoter->row());
     if ($objPromoter->room && ($objRoom = $objPromoter->getRelated('room')) !== null) {
         $objT->room = $objRoom;
     }
     $contact = new \stdClass();
     $hasContact = false;
     if ($objPromoter->website) {
         $objT->websiteUrl = \HeimrichHannot\Haste\Util\Url::addScheme($objPromoter->website);
     }
     foreach (static::$arrContact as $strField) {
         if (!$objT->{$strField}) {
             continue;
         }
         $hasContact = true;
         $contact->{$strField} = $objT->{$strField};
     }
     $objT->hasContact = $hasContact;
     $objT->contact = $contact;
     $objT->contactTitle = $GLOBALS['TL_LANG']['cal_promoterlist']['contactTitle'];
     $objT->phoneTitle = $GLOBALS['TL_LANG']['cal_promoterlist']['phoneTitle'];
     $objT->faxTitle = $GLOBALS['TL_LANG']['cal_promoterlist']['faxTitle'];
     $objT->emailTitle = $GLOBALS['TL_LANG']['cal_promoterlist']['emailTitle'];
     $objT->websiteTitle = $GLOBALS['TL_LANG']['cal_promoterlist']['websiteTitle'];
     if (!empty($arrPromoters) && $index !== null) {
         $objT->cssClass = \HeimrichHannot\Haste\Util\Arrays::getListPositonCssClass($index, $arrPromoters);
     }
     return $objT->parse();
 }
 public function replaceInsertTags($strTag)
 {
     if (strstr($strTag, 'bootstrapResponsiveYoutubeEmbed')) {
         $arrPieces = explode('::', $strTag);
         $n = [];
         if (!strstr($arrPieces[1], '?')) {
             $id = $arrPieces[1];
         } else {
             $m = explode('?', $arrPieces[1]);
             $id = $m[0];
             $n = explode('&', $m[1]);
         }
         if ($id == '') {
             return false;
         }
         $objTemplate = new \FrontendTemplate('ce_bootstrap_youtube_responsive_embed');
         $objTemplate->movieId = $id;
         $objTemplate->playerType = intval($id) ? 'vimeo' : 'youtube';
         $objTemplate->playerAspectRatio = 'embed-responsive-4by3';
         foreach ($n as $prop) {
             $pieces = explode('=', $prop);
             $objTemplate->{$pieces[0]} = $pieces[1];
         }
         return $objTemplate->parse();
     }
     return false;
 }
 public static function createShareButtons($networks, $theme = self::DEFAULT_THEME, $template = self::DEFAULT_TEMPLATE, $url = null, $title = null, $description = null, $image = null)
 {
     // access to page
     global $objPage;
     // try to deserialize
     if (is_string($networks)) {
         $networks = deserialize($networks);
     }
     // if there are no networks, don't do anything
     if (!is_array($networks) || count($networks) == 0) {
         return '';
     }
     // process theme
     if ($theme == 'sharebuttons_none' || $theme == 'none' || !in_array($theme, array_keys($GLOBALS['sharebuttons']['themes']))) {
         $theme = '';
     }
     // force theme to fontawesome if fontawesome template is used
     if (stripos($template, 'fontawesome') !== false && $theme !== '' && $theme !== 'text') {
         $theme = 'fontawesome';
     } elseif ($theme == 'fontawesome') {
         $template = 'sharebuttons_fontawesome';
     }
     // check for empty template
     if (!$template) {
         $template = self::DEFAULT_TEMPLATE;
     }
     // create share buttons template
     $objButtonsTemplate = new \FrontendTemplate($template);
     // assign enabled networks to template
     foreach ($networks as $network) {
         $objButtonsTemplate->{$network} = true;
     }
     // determine the share image (e.g. for pinterest)
     if (!$image && isset($GLOBALS['SOCIAL_IMAGES']) && is_array($GLOBALS['SOCIAL_IMAGES']) && count($GLOBALS['SOCIAL_IMAGES']) > 0) {
         $image = \Environment::get('base') . $GLOBALS['SOCIAL_IMAGES'][0];
     }
     // assign url, title, theme, image, description to template
     $objButtonsTemplate->url = rawurlencode($url ?: \Environment::get('base') . \Environment::get('request'));
     $objButtonsTemplate->title = rawurlencode(strip_tags($title ?: ($objPage->pageTitle ?: $objPage->title)));
     $objButtonsTemplate->theme = $theme;
     $objButtonsTemplate->image = rawurlencode($image);
     $objButtonsTemplate->description = rawurlencode(strip_tags($description ?: $objPage->description));
     // add translations to template
     $translations = $GLOBALS['TL_LANG']['sharebuttons'];
     $translations['mail_subject'] = rawurlencode($translations['mail_subject']);
     $objButtonsTemplate->lang = $translations;
     // insert CSS if necessary
     if ($theme) {
         $GLOBALS['TL_CSS'][] = 'system/modules/sharebuttons/assets/base.css||static';
         $css_theme = $GLOBALS['sharebuttons']['themes'][$theme][1];
         if (is_file(TL_ROOT . '/' . $css_theme)) {
             $GLOBALS['TL_CSS'][] = $css_theme . '||static';
         }
     }
     // insert javascript
     $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/sharebuttons/assets/scripts.js|static';
     // return parsed template
     return $objButtonsTemplate->parse();
 }
Exemplo n.º 17
0
 public function generate()
 {
     $GLOBALS['TL_JAVASCRIPT'][] = '/system/modules/uitotop/assets/js/jquery.ui.totop.js|static';
     $GLOBALS['TL_CSS'][] = '/system/modules/uitotop/assets/css/ui.totop.css|screen|static';
     $objTemplate = new \FrontendTemplate($this->strTemplate);
     $objTemplate->text = $this->uitotop_text;
     $GLOBALS['TL_BODY'][] = $objTemplate->parse();
 }
Exemplo n.º 18
0
 /**
  * @param $objWebfont
  */
 public function addFont($objWebfont)
 {
     if ($objWebfont->enableTypekit) {
         $objTemplate = new \FrontendTemplate($this->strTemplate);
         $objTemplate->typekitId = $objWebfont->typekitId;
         $GLOBALS['TL_HEAD'][] = $objTemplate->parse();
     }
 }
Exemplo n.º 19
0
 /**
  * Parse an item and return it as string
  * @param object
  * @param boolean
  * @param string
  * @param integer
  * @return string
  */
 protected function parseEmployee($objEmployee, $blnAddStaff = false, $strClass = '', $intCount = 0)
 {
     global $objPage;
     $objTemplate = new \FrontendTemplate($this->staff_employee_template);
     $objTemplate->setData($objEmployee->row());
     $objTemplate->class = ($this->staff_employee_class != '' ? ' ' . $this->staff_employee_class : '') . $strClass;
     if (!empty($objEmployee->education)) {
         $objTemplate->education = deserialize($objEmployee->education);
     }
     $objTemplate->link = $this->generateEmployeeUrl($objEmployee, $blnAddStaff);
     $objTemplate->staff = $objEmployee->getRelated('pid');
     $objTemplate->txt_educations = $GLOBALS['TL_LANG']['MSC']['educations'];
     $objTemplate->txt_contact = $GLOBALS['TL_LANG']['MSC']['contact'];
     $objTemplate->txt_room = $GLOBALS['TL_LANG']['MSC']['room'];
     $objTemplate->txt_phone = $GLOBALS['TL_LANG']['MSC']['phone'];
     $objTemplate->txt_mobile = $GLOBALS['TL_LANG']['MSC']['mobile'];
     $objTemplate->txt_fax = $GLOBALS['TL_LANG']['MSC']['fax'];
     $objTemplate->txt_email = $GLOBALS['TL_LANG']['MSC']['email'];
     $objTemplate->txt_website = $GLOBALS['TL_LANG']['MSC']['website'];
     $objTemplate->txt_facebook = $GLOBALS['TL_LANG']['MSC']['facebook'];
     $objTemplate->txt_googleplus = $GLOBALS['TL_LANG']['MSC']['googleplus'];
     $objTemplate->txt_twitter = $GLOBALS['TL_LANG']['MSC']['twitter'];
     $objTemplate->txt_linkedin = $GLOBALS['TL_LANG']['MSC']['linkedin'];
     $objTemplate->count = $intCount;
     // see #5708
     $objTemplate->addImage = false;
     // Add an image
     if ($objEmployee->singleSRC != '') {
         $objModel = \FilesModel::findByUuid($objEmployee->singleSRC);
         if ($objModel === null) {
             if (!\Validator::isUuid($objEmployee->singleSRC)) {
                 $objTemplate->text = '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
             }
         } elseif (is_file(TL_ROOT . '/' . $objModel->path)) {
             // Do not override the field now that we have a model registry (see #6303)
             $arrEmployee = $objEmployee->row();
             // Override the default image size
             if ($this->imgSize != '') {
                 $size = deserialize($this->imgSize);
                 if ($size[0] > 0 || $size[1] > 0 || is_numeric($size[2])) {
                     $arrEmployee['size'] = $this->imgSize;
                 }
             }
             $arrEmployee['singleSRC'] = $objModel->path;
             $strLightboxId = 'lightbox[lb' . $this->id . ']';
             $arrEmployee['fullsize'] = $this->fullsize;
             $this->addImageToTemplate($objTemplate, $arrEmployee, null, $strLightboxId);
         }
     }
     $objTemplate->enclosure = array();
     // Add enclosures
     if ($objEmployee->addEnclosure) {
         $this->addEnclosuresToTemplate($objTemplate, $objEmployee->row());
     }
     return $objTemplate->parse();
 }
 public function generate(array $arrOptions = array())
 {
     $this->arrOptions = array_merge($this->arrOptions, $arrOptions);
     $arrData = $this->getData($this->arrOptions);
     $strTemplate = sprintf('dlh_%s', $arrData['customTpl'] ?: strtolower($arrData['type']));
     $objTemplate = new \FrontendTemplate($strTemplate);
     $objTemplate->map = $arrData['map'];
     $objTemplate->element = $arrData;
     return $objTemplate->parse();
 }
Exemplo n.º 21
0
 /**
  * Generate the element.
  *
  * @return string
  */
 public function generate()
 {
     $template = new \FrontendTemplate($this->template);
     $template->options = $this->options;
     $template->element = $this;
     $template->tag = $this->getTag();
     $template->label = $this->label;
     $template->attributes = (array) $this->childAttributes->getAttributes();
     return $template->parse();
 }
 /**
  * @param string $strBuffer
  * @return string
  */
 public static function addMarksaleScriptToDynamicScriptTags($strBuffer)
 {
     if (TL_MODE == 'FE') {
         /* @var $objPage \Contao\PageModel */
         global $objPage;
         $objParentPage = \PageModel::findOneBy(array('id=?', 'type=?'), array($objPage->rootId, 'root'));
         $objTemplate = new \FrontendTemplate('marksale_default');
         $objTemplate->mstcId = $objParentPage->mstcId;
         $GLOBALS['TL_BODY'][] = $objTemplate->parse();
     }
     return $strBuffer;
 }
 public function generate(array $arrOptions = array())
 {
     $this->arrOptions = array_merge($this->arrOptions, $arrOptions);
     $arrData = $this->getData($this->arrOptions);
     $objTemplate = new \FrontendTemplate($this->arrOptions['google_chart_template']);
     if (!isset($GLOBALS['TL_JAVASCRIPT']['vendor_vis_charts_loader'])) {
         $GLOBALS['TL_JAVASCRIPT']['vendor_vis_charts_loader'] = 'https://www.gstatic.com/charts/loader.js';
     }
     $objTemplate->chart = $arrData;
     $objTemplate->labels = $GLOBALS['TL_LANG']['google_charts']['labels'];
     return $objTemplate->parse();
 }
Exemplo n.º 24
0
 /**
  * Generate the widget and return it as string
  * @return string
  */
 public function generate()
 {
     $this->strSet = $GLOBALS['TL_CONFIG']['subcolumns'] ? $GLOBALS['TL_CONFIG']['subcolumns'] : 'yaml3';
     if (TL_MODE == 'BE') {
         $objTemplate = new BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### Subcolumns End <strong>' . $this->fsc_name . '</strong> ###';
         return $objTemplate->parse();
     }
     $objTemplate = new FrontendTemplate($this->strColTemplate);
     $objTemplate->useInside = $GLOBALS['TL_SUBCL'][$this->strSet]['inside'];
     return $objTemplate->parse();
 }
 protected function compile()
 {
     $arrContent = array();
     $objContent = $this->Database->prepare("SELECT * FROM tl_content WHERE tstamp > ? && outSide_log = ? && invisible = ? ORDER BY tstamp DESC")->execute($this->Member->lastLogin, '', '');
     while ($objContent->next()) {
         $arrItem = $objContent->row();
         if ($objContent->type == 'module') {
             $objModule = \ModuleModel::findById($objContent->module);
         }
         if ($objContent->type != 'module' or $objContent->type == 'module' && $objModule->type != 'content_log') {
             $arrItem['htmlElement'] = $this->getContentElement($objContent->id);
             foreach ($GLOBALS['TL_HOOKS']['contentLog'] as $callback) {
                 $this->import($callback[0]);
                 $arrItem = $this->{$callback}[0]->{$callback}[1]($objContent->ptable, $objContent->tstamp, $arrItem);
             }
             if ($mod++ % 2 == 0) {
                 $arrItem['css'] .= 'even';
             } else {
                 $arrItem['css'] .= 'odd';
             }
             $arrItem['headline'] = deserialize($arrItem['headline']);
             $arrItem['parseDate'] = '<time datetime="' . date('Y-m-d\\TH:i:sP', $arrItem['tstamp']) . '">' . \Date::parse($GLOBALS['objPage']->datimFormat, $arrItem['tstamp']) . '</time>';
             $arrContent[] = (object) $arrItem;
         }
     }
     $objFAQ = $this->Database->prepare("SELECT * FROM tl_faq WHERE tstamp > ? && published = ? ORDER BY tstamp DESC")->execute($this->Member->lastLogin, '1');
     while ($objFAQ->next()) {
         $arrItem = $objFAQ->row();
         foreach ($GLOBALS['TL_HOOKS']['contentLog'] as $callback) {
             $this->import($callback[0]);
             $arrItem = $this->{$callback}[0]->{$callback}[1]('tl_faq', $objFAQ->tstamp, $arrItem);
         }
         if ($mod++ % 2 == 0) {
             $arrItem['css'] .= 'even';
         } else {
             $arrItem['css'] .= 'odd';
         }
         $arrItem['parseDate'] = '<time datetime="' . date('Y-m-d\\TH:i:sP', $arrItem['tstamp']) . '">' . \Date::parse($GLOBALS['objPage']->datimFormat, $arrItem['tstamp']) . '</time>';
         $arrContent[] = (object) $arrItem;
     }
     $arrContent[0]->css .= ' first';
     $arrContent[count($arrContent) - 1]->css .= ' last';
     foreach ($arrContent as $v) {
         $objTemplate = new \FrontendTemplate($this->contentLogTpl);
         $objTemplate->setData((array) $v);
         $html .= $objTemplate->parse();
     }
     if ($this->contentLogTpl == 'cl_list') {
         $html = '<table>' . $html . '</table>';
     }
     $this->Template->html = $html;
 }
Exemplo n.º 26
0
    /**
     * Replace news4ward insert tags
     * @param $strTag
     * @return bool|string
     */
    public function inserttagReplacer($strTag)
    {
        list($strTag, $strValue) = explode('::', $strTag);
        switch ($strTag) {
            case 'news4ward':
                switch ($strValue) {
                    case 'filter_hint':
                        if (!isset($GLOBALS['news4ward_filter_hint'])) {
                            return '';
                        }
                        $tpl = new FrontendTemplate('news4ward_filter_hint');
                        $tpl->items = $GLOBALS['news4ward_filter_hint'];
                        return $tpl->parse();
                        break;
                    default:
                        return false;
                        break;
                }
                break;
            case 'news4ward_link':
            case 'news4ward_open':
            case 'news4ward_url':
            case 'news4ward_title':
                $objArticle = $this->Database->prepare('
						SELECT a.id, a.alias, a.title, p.jumpTo as parentJumpTo
						FROM tl_news4ward_article AS a
						LEFT JOIN tl_news4ward AS p ON (a.pid = p.id)
						WHERE (a.id=? OR a.alias=?)' . (!BE_USER_LOGGED_IN ? "AND (a.start='' OR a.start<?) AND (a.stop='' OR a.stop>?) AND a.status='published'" : ""))->execute($strValue, $strValue, time(), time());
                if (!$objArticle->numRows) {
                    return '';
                }
                if ($strTag == 'news4ward_link') {
                    return sprintf('<a href="%s" title="%s">%s</a>', $this->generateUrl($objArticle), $objArticle->title, $objArticle->title);
                } else {
                    if ($strTag == 'news4ward_open') {
                        return sprintf('<a href="%s" title="%s">', $this->generateUrl($objArticle), $objArticle->title);
                    } else {
                        if ($strTag == 'news4ward_url') {
                            return $this->generateUrl($objArticle);
                        } else {
                            if ($strTag == 'news4ward_title') {
                                return $objArticle->title;
                            }
                        }
                    }
                }
                break;
            default:
                return false;
                break;
        }
    }
Exemplo n.º 27
0
 public function PopUpHtml($strContent)
 {
     if ($this->isPopupEnabled()) {
         $objRoot = $this->getCurrentRootPage();
         $objTemplate = new \FrontendTemplate('popup_default');
         $objTemplate->title = $objRoot->popup_title;
         $objTemplate->content = $objRoot->popup_content;
         $objTemplate->button = $objRoot->popup_button;
         $strContent = str_replace('</body>', $objTemplate->parse() . '</body>', $strContent);
         $_SESSION['popup_closed'] = true;
     }
     return $strContent;
 }
 public function generateEditActions(WatchlistItemModel $objItem, Watchlist $objWatchlist)
 {
     $objPage = \PageModel::findByPk($objItem->pageID);
     if ($objPage === null) {
         return;
     }
     $objT = new \FrontendTemplate('watchlist_edit_actions');
     $objT->delHref = ampersand(\Controller::generateFrontendUrl($objPage->row()) . '?act=' . WATCHLIST_ACT_DELETE . '&id=' . \String::binToUuid($objItem->uuid) . '&title=' . urlencode($objItem->title));
     $objT->delTitle = $GLOBALS['TL_LANG']['WATCHLIST']['delTitle'];
     $objT->delLink = $GLOBALS['TL_LANG']['WATCHLIST']['delLink'];
     $objT->id = \String::binToUuid($objItem->uuid);
     return $objT->parse();
 }
 protected function parseMember($objMember)
 {
     global $objPage;
     $objT = new \FrontendTemplate('memberlist_default');
     $objT->setData($objMember->row());
     $strUrl = $this->generateMemberUrl($objMember);
     $objT->addImage = false;
     // Add an image
     if ($objMember->addImage && $objMember->singleSRC != '') {
         $objModel = \FilesModel::findByUuid($objMember->singleSRC);
         if ($objModel === null) {
             if (!\Validator::isUuid($objMember->singleSRC)) {
                 $objMember->text = '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
             }
         } elseif (is_file(TL_ROOT . '/' . $objModel->path)) {
             // Do not override the field now that we have a model registry (see #6303)
             $arrMember = $objMember->row();
             // Override the default image size
             if ($this->size != '') {
                 $size = deserialize($this->size);
                 if ($size[0] > 0 || $size[1] > 0 || is_numeric($size[2])) {
                     $arrMember['size'] = $this->size;
                 }
             }
             $arrMember['singleSRC'] = $objModel->path;
             \Controller::addImageToTemplate($objT, $arrMember);
         }
     }
     $arrTitle = array($objMember->academicTitle, $objMember->firstname, $objMember->lastname);
     $objT->titleCombined = empty($arrTitle) ? '' : implode(' ', $arrTitle);
     $arrLocation = array($objMember->postal, $objMember->city);
     $objT->locationCombined = empty($arrLocation) ? '' : implode(' ', $arrLocation);
     $objT->websiteLink = $objMember->website;
     $objT->websiteTitle = $GLOBALS['TL_LANG']['MSC']['memberlist']['websiteTitle'];
     // Add http:// to the website
     if ($objMember->website != '' && !preg_match('@^(https?://|ftp://|mailto:|#)@i', $objMember->website)) {
         $objT->websiteLink = 'http://' . $objMember->website;
     }
     if ($this->mlSource == 'external') {
         // Encode e-mail addresses
         if (substr($this->mlUrl, 0, 7) == 'mailto:') {
             $strUrl = \String::encodeEmail($this->mlUrl);
         } else {
             $strUrl = ampersand($this->mlUrl);
         }
     }
     $objT->link = $strUrl;
     $objT->linkTarget = $this->mlTarget ? $objPage->outputFormat == 'xhtml' ? ' onclick="return !window.open(this.href)"' : ' target="_blank"' : '';
     $objT->linkTitle = specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['openMember'], $objT->titleCombined));
     return $objT->parse();
 }
Exemplo n.º 30
0
 public static function createConfigJs($objConfig, $debug = false)
 {
     $objT = new \FrontendTemplate('jquery.owlcarousel');
     $objT->config = rtrim(ltrim(json_encode(static::createConfig($objConfig)), '{'), '}');
     $objT->cssClass = static::getCssClassFromModel($objConfig);
     $strFile = 'assets/js/' . $objT->cssClass . '.js';
     $objFile = new \File($strFile, file_exists(TL_ROOT . '/' . $strFile));
     // simple file caching
     if ($objConfig->tstamp > $objFile->mtime || $objFile->size == 0 || $debug) {
         $objFile->write($objT->parse());
         $objFile->close();
     }
     $GLOBALS['TL_JAVASCRIPT']['owl.carousel_' . $objT->cssClass] = $strFile;
 }