Esempio n. 1
0
 /**
  * Rule Engine Data Generator
  * @param $format none | json
  */
 public function toRuleEngineData($format = 'none')
 {
     $data = parent::toRuleEngineData();
     $data['inBillDnI'] = $this->inBillDnI->toRuleEngineData();
     if (strcasecmp($format, 'json') === 0) {
         return json_encode($data);
     } else {
         return $data;
     }
 }
Esempio n. 2
0
 /**
  * Rule Engine Data Generator
  * @param $format none | json
  */
 public function toRuleEngineData($format = 'none')
 {
     $data = parent::toRuleEngineData();
     $data['satisfyAll'] = is_null($this->satisfyAll) ? true : $this->satisfyAll;
     $data['qcList'] = array();
     foreach ($this->qcList as $idx => $qc) {
         $data['qcList'][] = $qc->toRuleEngineData();
     }
     if (strcasecmp($format, 'json') === 0) {
         return json_encode($data);
     } else {
         return $data;
     }
 }
Esempio n. 3
0
 /**
  * Parse the template file and return it as string
  *
  * @return string The template markup
  */
 public function parse()
 {
     if ($this->strTemplate == '') {
         return '';
     }
     // HOOK: add custom parse filters
     if (isset($GLOBALS['TL_HOOKS']['parseTemplate']) && is_array($GLOBALS['TL_HOOKS']['parseTemplate'])) {
         foreach ($GLOBALS['TL_HOOKS']['parseTemplate'] as $callback) {
             $this->import($callback[0]);
             $this->{$callback}[0]->{$callback}[1]($this);
         }
     }
     return parent::parse();
 }
Esempio n. 4
0
 public function getPeer()
 {
     if (self::$peer === null) {
         self::$peer = new TemplatePeer();
     }
     return self::$peer;
 }
Esempio n. 5
0
 /**
  * Parse the template file and return it as string
  *
  * @param array $arrAttributes An optional attributes array
  *
  * @return string The template markup
  */
 public function parse($arrAttributes = null)
 {
     if ($this->strTemplate == '') {
         return '';
     }
     $this->addAttributes($arrAttributes);
     $this->mandatoryField = $GLOBALS['TL_LANG']['MSC']['mandatory'];
     if ($this->customTpl != '' && TL_MODE == 'FE') {
         $this->strTemplate = $this->customTpl;
     }
     $strBuffer = parent::parse();
     // HOOK: add custom parse filters (see #5553)
     if (isset($GLOBALS['TL_HOOKS']['parseWidget']) && is_array($GLOBALS['TL_HOOKS']['parseWidget'])) {
         foreach ($GLOBALS['TL_HOOKS']['parseWidget'] as $callback) {
             $this->import($callback[0]);
             $strBuffer = $this->{$callback}[0]->{$callback}[1]($strBuffer, $this);
         }
     }
     return $strBuffer;
 }
 /**
  * Sets values for search form.
  * @param SkinTemplate $sktemplate
  * @param BaseTemplate $tpl
  * @return boolean Always true to keep hook running
  */
 public function onSkinTemplateOutputPageBeforeExec(&$sktemplate, &$tpl)
 {
     $tpl->set('searchtitle', SpecialPage::getTitleFor('SpecialExtendedSearch')->getFullText());
     if (!empty(SearchOptions::$searchStringRaw)) {
         $tpl->set('q', SearchOptions::$searchStringRaw);
     }
     $tpl->set('bs_search_input', array('id' => 'bs-extendedsearch-input', 'type' => 'text', 'name' => 'q'));
     $aHiddenFields = array();
     $aHiddenFields['sft'] = '1';
     if (BsConfig::get('MW::ExtendedSearch::SearchFiles')) {
         $aHiddenFields['search_files'] = '1';
     }
     $tpl->set('bs_search_hidden_fields', $aHiddenFields);
     return true;
 }
Esempio n. 7
0
 public function hasTemplates()
 {
     $templateInstance = new BaseTemplate($this);
     return $templateInstance->hasTemplates($this);
 }
Esempio n. 8
0
 /** @inheritdoc */
 public function beforeSave($insert)
 {
     $this->is_layout = true;
     return parent::beforeSave($insert);
 }
Esempio n. 9
0
 public static function setPartialPath($path)
 {
     self::$_partials = realpath($path);
 }
 /**
  * Prepare configured and available page actions
  * @param BaseTemplate $tpl
  */
 protected function preparePageActions(BaseTemplate $tpl)
 {
     $title = $this->getTitle();
     $noJsEdit = MobileContext::singleton()->getMFConfig()->get('MFAllowNonJavaScriptEditing');
     // Reuse template data variable from SkinTemplate to construct page menu
     $menu = array();
     $actions = $tpl->data['content_navigation']['actions'];
     if ($this->isUserPage) {
         if (!$this->getTitle()->exists()) {
             $tpl->set('page_actions', $menu);
             return;
         }
     }
     // empty placeholder for edit and photos which both require js
     if ($this->isAllowedPageAction('edit')) {
         $additionalClass = $noJsEdit ? ' nojs-edit' : '';
         $menu['edit'] = array('id' => 'ca-edit', 'text' => '', 'itemtitle' => $this->msg('mobile-frontend-pageaction-edit-tooltip'), 'class' => MobileUI::iconClass('edit-enabled', 'element' . $additionalClass), 'links' => array('edit' => array('href' => $this->getTitle()->getLocalUrl(array('action' => 'edit', 'section' => 0)))));
     }
     if ($this->isAllowedPageAction('watch')) {
         $watchTemplate = array('id' => 'ca-watch', 'class' => MobileUI::iconClass('watch', 'element', 'icon-32px watch-this-article hidden'));
         // standardise watch article into one menu item
         if (isset($actions['watch'])) {
             $menu['watch'] = array_merge($actions['watch'], $watchTemplate);
         } elseif (isset($actions['unwatch'])) {
             $menu['watch'] = array_merge($actions['unwatch'], $watchTemplate);
             $menu['watch']['class'] .= ' watched';
         } else {
             // placeholder for not logged in
             $menu['watch'] = $watchTemplate;
             // FIXME: makeLink (used by makeListItem) when no text is present defaults to use the key
             $menu['watch']['text'] = '';
             $menu['watch']['href'] = $this->getLoginUrl(array('returnto' => $title));
         }
     }
     $tpl->set('page_actions', $menu);
 }
Esempio n. 11
0
 function __construct()
 {
     global $wgHooks;
     parent::__construct();
     $wgHooks['BeforeTabsLine'][] = array('WikihowLogin::topContent', $this, 'create');
 }
Esempio n. 12
0
 /**
  * @param integer $iblockId Identifier of the iblock.
  */
 function __construct($iblockId)
 {
     $entity = new IblockValues($iblockId);
     parent::__construct($entity);
 }
 /**
  * Modifies the logo on runtime
  * @param SkinTemplate $sktemplate
  * @param BaseTemplate $tpl
  * @return boolean Always true to keep hook running
  */
 public static function onSkinTemplateOutputPageBeforeExec(&$sktemplate, &$tpl)
 {
     $sFlexiskin = $sktemplate->getRequest()->getVal('flexiskin');
     if ($sFlexiskin || BsConfig::get('MW::Flexiskin::Active') != '') {
         $sId = $sFlexiskin != '' ? $sFlexiskin : BsConfig::get('MW::Flexiskin::Active');
         if ($sId != "default") {
             $bPreview = $sktemplate->getRequest()->getVal('preview', false);
             $api = new ApiMain(new DerivativeRequest($sktemplate->getRequest(), array('action' => 'flexiskin', 'type' => 'get', 'mode' => 'config', 'id' => $sId, 'preview' => $bPreview), false), true);
             $api->execute();
             $aResult = $api->getResultData();
             $oResult = FormatJson::decode($aResult['flexiskin']);
             if ($oResult->success === false) {
                 return true;
             }
             $aConfig = FormatJson::decode($oResult->config);
             $sLogo = BsConfig::get("MW::Flexiskin::Logo");
             if ($sLogo == "") {
                 return true;
             }
             $sPath = BS_DATA_PATH . "/flexiskin/" . $sId . "/images/";
             $tpl->set('logopath', $sPath . $sLogo);
             return true;
         }
         return true;
     }
     return true;
 }
Esempio n. 14
0
 /**
  * Setup ads handling
  */
 protected function setupAds(BaseTemplate &$tpl)
 {
     $tpl->set('ads-column', '');
     $tpl->set('ads_top', '');
     $tpl->set('ads_topleft', '');
     $tpl->set('ads_topright', '');
     $tpl->set('ads_bot', '');
 }
 /**
  * Prepare configured and available page actions
  * @param BaseTemplate $tpl
  */
 protected function preparePageActions(BaseTemplate $tpl)
 {
     $title = $this->getTitle();
     // Reuse template data variable from SkinTemplate to construct page menu
     $menu = array();
     $actions = $tpl->data['content_navigation']['actions'];
     // empty placeholder for edit and photos which both require js
     if ($this->isAllowedPageAction('edit')) {
         $menu['edit'] = array('id' => 'ca-edit', 'text' => '', 'itemtitle' => $this->msg('mobile-frontend-pageaction-edit-tooltip'), 'class' => MobileUI::iconClass('edit', 'element', 'hidden'));
     }
     if ($this->isAllowedPageAction('watch')) {
         $watchTemplate = array('id' => 'ca-watch', 'class' => MobileUI::iconClass('watch', 'element', 'icon-32px watch-this-article hidden'));
         // standardise watch article into one menu item
         if (isset($actions['watch'])) {
             $menu['watch'] = array_merge($actions['watch'], $watchTemplate);
         } elseif (isset($actions['unwatch'])) {
             $menu['watch'] = array_merge($actions['unwatch'], $watchTemplate);
             $menu['watch']['class'] .= ' watched';
         } else {
             // placeholder for not logged in
             $menu['watch'] = $watchTemplate;
             // FIXME: makeLink (used by makeListItem) when no text is present defaults to use the key
             $menu['watch']['text'] = '';
             $menu['watch']['href'] = $this->getLoginUrl(array('returnto' => $title));
         }
     }
     $tpl->set('page_actions', $menu);
 }
Esempio n. 16
0
 function __construct($iblock_id, $section_id)
 {
     $entity = new SectionValues($iblock_id, $section_id);
     parent::__construct($entity);
 }
Esempio n. 17
0
	/**
	 * Setup ads handling
	 */
	protected function setupAds(BaseTemplate &$tpl) {
		AdEngine::getInstance()->setLoadType('inline');

		// BugId:26735 We want spotlights regardless of whether ads have been enabled.
		$adsColumn = '<div id="column-google" class="noprint">'."\n".
			AdEngine::getInstance()->getSetupHtml() .
			'<div id="wikia_header" style="display:none"></div>'; // Hack because ads have code that referenc    es this. Awful.

		if($this->ads === false) {
			// FIXME: not used anymore?
			$tpl->set('ads_top', '');
			$tpl->set('ads_topleft', '');
			$tpl->set('ads_topright', '');
			$tpl->set('ads_bot','');

			$adsColumn .= '<!-- not USING ad server! -->'."\n".'</div>'."\n</div>\n";
		} else {
			// FIXME: not used anymore?
			$tpl->set('ads_top', AdServer::getInstance()->getAd('t'));
			$tpl->set('ads_topleft', AdServer::getInstance()->getAd('tl'));
			$tpl->set('ads_topright', AdServer::getInstance()->getAd('tr'));
			$tpl->set('ads_bot', AdServer::getInstance()->getAd('b'));

			$adsColumn .= '<!-- USING ad server! -->'."\n".
				'<div id="column-google-right">'.AdEngine::getInstance()->getAd('RIGHT_SKYSCRAPER_1').'</div></div>'."\n";
		}

		// BugId:26735 We want spotlights regardless of whether ads have been enabled.
		$adsColumn .= '<table id="spotlight_container"><tr>' .
			'<td><div>'.AdEngine::getInstance()->getPlaceHolderIframe('SPOTLIGHT_FOOTER_1').'</div></td>' .
			'<td><div>'.AdEngine::getInstance()->getPlaceHolderIframe('SPOTLIGHT_FOOTER_2').'</div></td>' .
			'<td><div>'.AdEngine::getInstance()->getPlaceHolderIframe('SPOTLIGHT_FOOTER_3').'</div></td>'.
			"</tr></table>\n".
			AdEngine::getInstance()->getDelayedIframeLoadingCode();

		// add ads column after content
		$tpl->set('ads-column', $adsColumn);
	}