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

NagVisMap::replaceMacros ( &$  obj  ) 

Replaces macros of urls and hover_urls

Parameters:
Array $obj Array with object informations
Returns:
Array $obj Modified array
Author:
Lars Michelsen <lars@vertical-visions.de>

Definition at line 254 of file NagVisMap.php.

                                    {
            if (DEBUG&&DEBUGLEVEL&1) debug('Start method NagVisMap::replaceMacros(&$obj)');
            if($obj['type'] == 'service') {
                  $name = 'host_name';
            } else {
                  $name = $obj['type'] . '_name';
            }
            
            if(isset($obj['text']) && $obj['text'] != '') {
                  $obj['text'] = str_replace('[refresh_counter]','<font id="refreshCounter"></font>',$obj['text']);
            }
            
            if(isset($obj['url']) && $obj['url'] != '') {
                  $obj['url'] = str_replace('['.$name.']',$obj[$name],$obj['url']);
                  if($obj['type'] == 'service') {
                        $obj['url'] = str_replace('[service_description]',$obj['service_description'],$obj['url']);
                  }
            }
            
            if(isset($obj['hover_url']) && $obj['hover_url'] != '') {
                  $obj['hover_url'] = str_replace('[name]',$obj[$name],$obj['hover_url']);
                  if($obj['type'] == 'service') {
                        $obj['hover_url'] = str_replace('[service_description]',$obj['service_description'],$obj['hover_url']);
                  }
            }
            
            if(isset($obj['label_text']) && $obj['label_text'] != '') {
                  // For maps use the alias as display string
                  if($obj['type'] == 'map') {
                        $name = 'alias';   
                  }
                  
                  $obj['label_text'] = str_replace('[name]',$obj[$name],$obj['label_text']);
                  $obj['label_text'] = str_replace('[output]',$obj['stateOutput'],$obj['label_text']);
                  if($obj['type'] == 'service') {
                        $obj['label_text'] = str_replace('[service_description]',$obj['service_description'],$obj['label_text']);
                  }
            }
            
            if (DEBUG&&DEBUGLEVEL&1) debug('End method NagVisMap::replaceMacros(): Array(...)');
            return $obj;
      }


Generated by  Doxygen 1.6.0   Back to index