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

GlobalMap::getIcon ( &$  obj  )  [inherited]

Searches the icon for an object

Parameters:
Array $obj Array with object properties
Returns:
String Name of the icon
Author:
Michael Luebben <michael_luebben@web.de>

Lars Michelsen <lars@vertical-visions.de>

Definition at line 75 of file GlobalMap.php.

                              {
            if (DEBUG&&DEBUGLEVEL&1) debug('Start method GlobalMap::getIcon(&$obj)');
            $stateLow = strtolower($obj['state']);
            
            switch($obj['type']) {
                  case 'map':
                        switch($stateLow) {
                              case 'ok':
                              case 'warning':
                              case 'critical':
                              case 'unknown':
                              case 'ack':       
                                    $icon = $obj['iconset'].'_'.$stateLow.'.png';
                              break;
                              default:
                                    $icon = $obj['iconset'].'_error.png';
                              break;
                        }
                  break;
                  case 'host':
                  case 'hostgroup':
                        switch($stateLow) {
                              case 'down':
                              case 'unknown':
                              case 'critical':
                              case 'unreachable':
                              case 'warning':
                              case 'ack':
                              case 'up':
                                    $icon = $obj['iconset'].'_'.$stateLow.'.png';
                              break;
                              default:
                                    $icon = $obj['iconset'].'_error.png';
                              break;
                        }
                  break;
                  case 'service':
                  case 'servicegroup':
                        switch($stateLow) {
                              case 'critical':
                              case 'warning':
                              case 'unknown':
                              case 'ok':
                                    $icon = $obj['iconset'].'_'.$stateLow.'.png';
                              break;
                              case 'ack':
                                    $icon = $obj['iconset'].'_s'.$stateLow.'.png';
                              break;
                              default:    
                                    $icon = $obj['iconset'].'_error.png';
                              break;
                        }
                  break;
                  default:
                              $icon = $obj['iconset'].'_error.png';
                  break;
            }
            
            //replaced: if(file_exists($this->MAINCFG->getValue('paths', 'icon').$icon)) {
            if(@fclose(@fopen($this->MAINCFG->getValue('paths', 'icon').$icon,'r'))) {
                  if (DEBUG&&DEBUGLEVEL&1) debug('End method GlobalMap::getIcon(): '.$icon);
                  return $icon;
            } else {
                  if (DEBUG&&DEBUGLEVEL&1) debug('End method GlobalMap::getIcon(): '.$obj['iconset'].'_error.png');
                  return $obj['iconset'].'_error.png';
            }
      }


Generated by  Doxygen 1.6.0   Back to index