示例#1
0
 /**
  * Class Constructor
  *
  * @param 	GlobalCore 	$CORE
  * @author 	Lars Michelsen <*****@*****.**>
  */
 public function __construct($CORE, $templateName, $OBJ = NULL)
 {
     $this->CORE = $CORE;
     $this->OBJPAGE = $OBJ;
     $this->templateName = $templateName;
     $this->pathHtmlBase = cfg('paths', 'htmlbase');
     $this->pathTemplateFile = path('sys', '', 'templates', $this->templateName . '.hover.html');
     // Simply skip processing with an invalid template file name
     if ($this->pathTemplateFile === '') {
         return;
     }
     $this->CACHE = new GlobalFileCache($this->pathTemplateFile, cfg('paths', 'var') . 'hover-' . $this->templateName . '-' . curLang() . '.cache');
     // Only use cache when there is
     // a) Some valid cache file
     // b) Some valid main configuration cache file
     // c) This cache file newer than main configuration cache file
     if ($this->CACHE->isCached() !== -1 && $this->CORE->getMainCfg()->isCached() !== -1 && $this->CACHE->isCached() >= $this->CORE->getMainCfg()->isCached()) {
         $this->code = $this->CACHE->getCache();
     } else {
         // Read the contents of the template file
         if ($this->readTemplate()) {
             // The static macros should be replaced before caching
             $this->replaceStaticMacros();
             // Build cache for the template
             $this->CACHE->writeCache($this->code, 1);
         }
     }
 }
示例#2
0
 /**
  * PRIVATE getStaticMacros()
  *
  * Get all static macros for the template code
  *
  * @author	Lars Michelsen <*****@*****.**>
  */
 private function getStaticMacros()
 {
     global $SHANDLER, $AUTH, $AUTHORISATION, $UHANDLER;
     // Replace paths and language macros
     $aReturn = array('pathBase' => $this->pathHtmlBase, 'currentUri' => preg_replace('/[&?]lang=[a-z]{2}_[A-Z]{2}/', '', $UHANDLER->getRequestUri()), 'pathImages' => cfg('paths', 'htmlimages'), 'showStates' => cfg('defaults', 'header_show_states'), 'pathHeaderJs' => path('html', 'global', 'templates', $this->templateName . '.header.js'), 'pathTemplates' => path('html', 'global', 'templates'), 'pathTemplateImages' => path('html', 'global', 'templateimages'), 'langSearch' => l('Search'), 'langUserMgmt' => l('Manage Users'), 'langManageRoles' => l('Manage Roles'), 'currentLanguage' => curLang(), 'docLanguage' => $this->getDocLanguage(), 'langChooseLanguage' => l('Choose Language'), 'langUser' => l('User menu'), 'langActions' => l('Actions'), 'langLoggedIn' => l('Logged in'), 'langChangePassword' => l('Change password'), 'langOpen' => l('Open'), 'langMap' => l('Map'), 'langRotations' => l('Rotations'), 'langMapOptions' => l('Map Options'), 'langMapManageTmpl' => l('Manage Templates'), 'langMapAddIcon' => l('Add Icon'), 'langMapAddLine' => l('Add Line'), 'langLine' => l('Line'), 'langMapAddSpecial' => l('Add Special'), 'langHost' => l('host'), 'langService' => l('service'), 'langHostgroup' => l('hostgroup'), 'langServicegroup' => l('servicegroup'), 'langDynGroup' => l('Dynamic Group'), 'langAggr' => l('Aggregation'), 'langMapEdit' => l('Edit Map'), 'langMaps' => l('Maps'), 'langTextbox' => l('textbox'), 'langContainer' => l('Container'), 'langShape' => l('shape'), 'langStateless' => l('Stateless'), 'langSpecial' => l('special'), 'langLockUnlockAll' => l('Lock/Unlock all'), 'langViewMap' => l('View current map'), 'langOptions' => l('Options'), 'langEditMainCfg' => l('General Configuration'), 'langMgmtBackends' => l('Manage Backends'), 'langMgmtBackgrounds' => l('Manage Backgrounds'), 'langMgmtMaps' => l('Manage Maps'), 'langMgmtShapes' => l('Manage Shapes'), 'langNeedHelp' => l('needHelp'), 'langOnlineDoc' => l('onlineDoc'), 'langForum' => l('forum'), 'langSupportInfo' => l('supportInfo'), 'langOverview' => l('overview'), 'langInstance' => l('instance'), 'langLogout' => l('Logout'), 'langRotationStart' => l('rotationStart'), 'langRotationStop' => l('rotationStop'), 'langToggleGrid' => l('Show/Hide Grid'), 'langToStaticMap' => l('Export to static map'), 'langModifyParams' => l('Modify view'), 'langMapViewport' => l('Viewport'), 'langSaveView' => l('Save View'), 'langSaveViewAsNewMap' => l('Save as new Map'), 'langScaleToAll' => l('Show all objects'), 'supportedChangePassword' => $AUTH->checkFeature('changePassword') && !$AUTH->authedTrusted(), 'permittedUserMgmt' => $AUTHORISATION->isPermitted('UserMgmt', 'manage'), 'permittedRoleMgmt' => $AUTHORISATION->isPermitted('RoleMgmt', 'manage'), 'rolesConfigurable' => $AUTHORISATION->rolesConfigurable());
     return $aReturn;
 }