private function errorPage($e) { global $_MAINCFG; ob_start(); $USERCFG = new CoreUserCfg(); js('oGeneralProperties = ' . $_MAINCFG->parseGeneralProperties() . ';' . N . 'oUserProperties = ' . $USERCFG->doGetAsJson() . ';' . N); echo '<div id="page">'; js('frontendMessage({' . N . ' "type" : "error",' . N . ' "closable": false,' . N . ' "title" : "' . l('Error') . '",' . N . ' "message" : "' . htmlentities($e->getMessage(), ENT_COMPAT, 'UTF-8') . '"' . N . '});'); echo '</div>'; return ob_get_clean(); }
/** * Parses the information for json * * @return String String with Html Code * @author Lars Michelsen <*****@*****.**> */ public function parse() { global $_MAINCFG, $CORE; // Initialize template system $TMPL = new FrontendTemplateSystem(); $TMPLSYS = $TMPL->getTmplSys(); $USERCFG = new CoreUserCfg(); $maps = cfg('index', 'showmaps') == 1 ? $CORE->getListMaps() : array(); $rotations = cfg('index', 'showrotations') == 1 ? array_keys($CORE->getPermittedRotationPools()) : array(); $aData = array('generalProperties' => $_MAINCFG->parseGeneralProperties(), 'workerProperties' => $_MAINCFG->parseWorkerProperties(), 'stateProperties' => json_encode($_MAINCFG->getStateWeightJS()), 'userProperties' => $USERCFG->doGetAsJson(), 'pageProperties' => json_encode($this->getProperties()), 'fileAges' => json_encode(array('maincfg' => $_MAINCFG->getConfigFileAge())), 'locales' => json_encode($CORE->getGeneralJSLocales()), 'rotation_names' => json_encode($rotations), 'map_names' => json_encode($maps)); // Build page based on the template file and the data array return $TMPLSYS->get($TMPL->getTmplFile(cfg('defaults', 'view_template'), 'overview'), $aData); }
/** * Parses the map and the objects for the nagvis-js frontend * * @return String String with JS Code * @author Lars Michelsen <*****@*****.**> */ public function parse() { global $_MAINCFG, $CORE; // Initialize template system $TMPL = new FrontendTemplateSystem(); $TMPLSYS = $TMPL->getTmplSys(); $USERCFG = new CoreUserCfg(); $this->MAPCFG = new GlobalMapCfg($this->name); $this->MAPCFG->readMapConfig(ONLY_GLOBAL, true, true, true); $aData = array('generalProperties' => $_MAINCFG->parseGeneralProperties(), 'workerProperties' => $_MAINCFG->parseWorkerProperties(), 'rotationProperties' => json_encode($this->aRotation), 'viewProperties' => $this->parseViewProperties(), 'stateProperties' => json_encode($_MAINCFG->getStateWeightJS()), 'pageProperties' => json_encode($this->MAPCFG->getMapProperties()), 'userProperties' => $USERCFG->doGetAsJson(), 'mapName' => $this->name, 'zoomFill' => $this->MAPCFG->getValue(0, 'zoom') == 'fill', 'fileAges' => json_encode(array('maincfg' => $_MAINCFG->getConfigFileAge(), $this->name => $this->MAPCFG->getFileModificationTime())), 'locales' => json_encode($CORE->getGeneralJSLocales())); // Build page based on the template file and the data array return $TMPLSYS->get($TMPL->getTmplFile(cfg('defaults', 'view_template'), 'map'), $aData); }