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

NagVisMap::parseIcon ( &$  obj,
link = 1,
hoverMenu = 1 
)

Parses the HTML-Code of an icon

Parameters:
Array $obj Array with object informations
String $base Array with object informations
Boolean $link Add a link to the icon
Boolean $hoverMenu Add a hover menu to the icon
Returns:
String String with Html Code
Author:
Lars Michelsen <lars@vertical-visions.de>

Definition at line 200 of file NagVisMap.php.

                                                     {
            if (DEBUG&&DEBUGLEVEL&1) debug('Start method NagVisMap::parseIcon(&$obj,'.$link.','.$hoverMenu.')');
            
            if($obj['type'] == 'shape') {
                  if(preg_match('/^\[(.*)\]$/',$obj['icon'],$match) > 0) {
                        $imgPath = $match[1];
                  } else {
                        $imgPath = $this->MAINCFG->getValue('paths', 'htmlshape').$obj['icon'];
                  }
                  $alt = $obj['icon'];
            } else {
                  $imgPath = $this->MAINCFG->getValue('paths', 'htmlicon').$obj['icon'];
                  
                  if($obj['type'] == 'service') {
                        $name = 'host_name';
                        $alt = $obj['host_name'].'-'.$obj['service_description'];
                  } else {
                        $alt = $obj[$obj['type'].'_name'];
                  }
                  
            }
            
            
            $ret = '<div class="icon" style="left:'.$obj['x'].'px;top:'.$obj['y'].'px;z-index:'.$obj['z'].';">';
            
            if($link) {
                  $ret .= $this->createLink($obj);
            }
            
            if($hoverMenu) {
                  $menu = $this->getHoverMenu($obj);
            } else {
                  $menu = '';
            }
            
            $ret .= '<img src="'.$imgPath.'" '.$menu.' alt="'.$obj['type'].'-'.$alt.'">';
            
            if($link) {
                  $ret .= '</a>';
            }
            
            $ret .= '</div>';
            
            if (DEBUG&&DEBUGLEVEL&1) debug('End method NagVisMap::parseIcon(): Array(...)');
            return $ret;
      }


Generated by  Doxygen 1.6.0   Back to index