Logo Search packages:      
Sourcecode: nagvis version File versions  Download package

NagVisFrontend::getHeaderMenu (  ) 

If enabled, the header menu is added to the page

Author:
Lars Michelsen <lars@vertical-visions.de>

Definition at line 144 of file NagVisFrontend.php.

                               {
            if (DEBUG&&DEBUGLEVEL&1) debug('Start method NagVisFrontend::getHeaderMenu()');
            if($this->MAINCFG->getValue('global', 'displayheader') == '1') {
                  if($this->checkHeaderTemplateReadable(1)) {
                        $ret = file_get_contents($this->MAINCFG->getValue('paths','headertemplate').'tmpl.'.$this->MAPCFG->getValue('global', 0, 'header_template').'.html');
                        
                        // Replace some macros
                        $ret = str_replace('[current_map]',$this->MAPCFG->getName(),$ret);
                        $ret = str_replace('[current_map_alias]',$this->MAPCFG->getValue('global', '0', 'alias'),$ret);
                        $ret = str_replace('[html_base]',$this->MAINCFG->getValue('paths','htmlbase'),$ret);
                        $ret = str_replace('[html_templates]',$this->MAINCFG->getValue('paths','htmlheadertemplates'),$ret);
                        $ret = str_replace('[html_template_images]',$this->MAINCFG->getValue('paths','htmlheadertemplateimages'),$ret);
                        // Replace language macros
                        $ret = str_replace('[lang_select_map]',$this->LANG->getLabel('selectMap'),$ret);
                        $ret = str_replace('[lang_edit_map]',$this->LANG->getLabel('editMap'),$ret);
                        $ret = str_replace('[lang_need_help]',$this->LANG->getLabel('needHelp'),$ret);
                        $ret = str_replace('[lang_online_doc]',$this->LANG->getLabel('onlineDoc'),$ret);
                        $ret = str_replace('[lang_forum]',$this->LANG->getLabel('forum'),$ret);
                        $ret = str_replace('[lang_support_info]',$this->LANG->getLabel('supportInfo'),$ret);
                        $ret = str_replace('[lang_overview]',$this->LANG->getLabel('overview'),$ret);
                        $ret = str_replace('[lang_instance]',$this->LANG->getLabel('instance'),$ret);
                        $ret = str_replace('[lang_rotation_start]',$this->LANG->getLabel('rotationStart'),$ret);
                        $ret = str_replace('[lang_rotation_stop]',$this->LANG->getLabel('rotationStop'),$ret);
                        // Replace lists
                        if(preg_match_all('/<!-- BEGIN (\w+) -->/',$ret,$matchReturn) > 0) {
                              foreach($matchReturn[1] AS $key) {
                                    if($key == 'maplist') {
                                          $sReplace = '';
                                          preg_match_all('/<!-- BEGIN '.$key.' -->((?s).*)<!-- END '.$key.' -->/',$ret,$matchReturn1);
                                          foreach($this->getMaps() AS $mapName) {
                                                $MAPCFG1 = new NagVisMapCfg($this->MAINCFG,$mapName);
                                                $MAPCFG1->readMapConfig(1);
                                                
                                                if($MAPCFG1->getValue('global',0, 'show_in_lists') == 1) {
                                                      $sReplaceObj = str_replace('[map_name]',$MAPCFG1->getName(),$matchReturn1[1][0]);
                                                      $sReplaceObj = str_replace('[map_alias]',$MAPCFG1->getValue('global', '0', 'alias'),$sReplaceObj);
                                                      // auto select current map
                                                      if($mapName == $this->MAPCFG->getName()) {
                                                            $sReplaceObj = str_replace('[selected]','selected="selected"',$sReplaceObj);
                                                      } else {
                                                            $sReplaceObj = str_replace('[selected]','',$sReplaceObj);
                                                      }
                                                      $sReplace .= $sReplaceObj;
                                                }
                                          }
                                          $ret = preg_replace('/<!-- BEGIN '.$key.' -->((?s).*)<!-- END '.$key.' -->/',$sReplace,$ret);
                                    }
                              }
                        }
                        
                        $this->addBodyLines('<div class="header">'.$ret.'</div>');
                  }
            }
            if (DEBUG&&DEBUGLEVEL&1) debug('End method NagVisFrontend::getHeaderMenu()');
      }


Generated by  Doxygen 1.6.0   Back to index