Esempio n. 1
0
 private function getMaps($maps)
 {
     global $_BACKEND, $AUTHORISATION;
     $aObjs = array();
     foreach ($maps as $object_id => $mapName) {
         $MAPCFG = new GlobalMapCfg($mapName);
         $config_error = null;
         $error = null;
         try {
             $MAPCFG->readMapConfig();
         } catch (MapCfgInvalid $e) {
             $config_error = $e->getMessage();
         } catch (Exception $e) {
             $error = $e->getMessage();
         }
         if ($MAPCFG->getValue(0, 'show_in_lists') != 1 || $MAPCFG->getValue(0, 'show_in_multisite') != 1) {
             continue;
         }
         $MAP = new NagVisMap($MAPCFG, GET_STATE, !IS_VIEW);
         // Apply mulitsite snapin related configuration to object
         $objConf = array('type' => 'map', 'map_name' => $MAPCFG->getName(), 'object_id' => $object_id, 'hover_menu' => 0, 'hover_childs_show' => 0, 'hover_template' => 'default', 'parent_map' => $MAPCFG->getValue(0, 'parent_map'));
         $MAP->MAPOBJ->setConfiguration($objConf);
         if ($config_error !== null) {
             $MAP->MAPOBJ->clearMembers();
             $MAP->MAPOBJ->setState(array(ERROR, l('Map Configuration Error: ') . $config_error, null, null, null));
             $MAP->MAPOBJ->fetchIcon();
         } elseif ($error !== null) {
             $MAP->MAPOBJ->clearMembers();
             $MAP->MAPOBJ->setState(array(ERROR, l('Error: ') . $error, null, null, null));
             $MAP->MAPOBJ->fetchIcon();
         } elseif ($MAP->MAPOBJ->checkMaintenance(0)) {
             $MAP->MAPOBJ->fetchIcon();
         } else {
             $MAP->MAPOBJ->clearMembers();
             $MAP->MAPOBJ->setState(array(UNKNOWN, l('mapInMaintenance'), null, null, null));
             $MAP->MAPOBJ->fetchIcon();
         }
         $MAP->MAPOBJ->queueState(GET_STATE, GET_SINGLE_MEMBER_STATES);
         $aObjs[] = $MAP->MAPOBJ;
     }
     $_BACKEND->execute();
     $aMaps = array();
     foreach ($aObjs as $MAP) {
         $MAP->applyState();
         $MAP->fetchIcon();
         $aMaps[] = $MAP->getObjectInformation();
     }
     usort($aMaps, array('GlobalCore', 'cmpAlias'));
     return $aMaps;
 }