if ($triggers[$id]["status"] == TRIGGER_STATUS_ENABLED && $triggers[$id]["value"] == TRIGGER_VALUE_TRUE) { if ($triggers[$id]['severity'] >= $max_severity) { $drawtype = $triggers[$id]['drawtype']; $color = convertColor($im, $triggers[$id]['color']); $max_severity = $triggers[$id]['severity']; } } } } MyDrawLine($im, $x1, $y1, $x2, $y2, $color, $drawtype); } // Draw elements $icons = array(); $db_elements = DBselect('select * from sysmaps_elements where sysmapid=' . $_REQUEST['sysmapid']); while ($db_element = DBfetch($db_elements)) { if ($img = get_png_by_selementid($db_element['selementid'])) { imagecopy($im, $img, $db_element['x'], $db_element['y'], 0, 0, ImageSX($img), ImageSY($img)); } if ($label_type == MAP_LABEL_TYPE_NOTHING) { continue; } $color = $darkgreen; $label_color = $black; $info_line = ''; $label_location = $db_element['label_location']; if (is_null($label_location)) { $map['label_location']; } $label_line = expand_map_element_label_by_data($db_element); $el_info = get_info_by_selementid($db_element['selementid']); $info_line = $el_info['info'];
/* draw row */ $table->addRow(array(new CLink('link ' . $i++, 'sysmap.php?sysmapid=' . $_REQUEST['sysmapid'] . '&form=update&linkid=' . $row['linkid'], 'action'), $label1, $label2, $description)); } $table->Show(); } } show_messages(); echo SBR; $map = get_sysmap_by_sysmapid($_REQUEST['sysmapid']); show_table_header($map['name']); $table = new CTable(NULL, 'map'); if (isset($_REQUEST['sysmapid'])) { $linkMap = new CMap('links' . $_REQUEST['sysmapid'] . '_' . rand(0, 100000)); $db_elements = DBselect('select * from sysmaps_elements where sysmapid=' . $_REQUEST['sysmapid']); while ($db_element = DBfetch($db_elements)) { $tmp_img = get_png_by_selementid($db_element['selementid']); if (!$tmp_img) { continue; } $x1_ = $db_element['x']; $y1_ = $db_element['y']; $x2_ = $db_element['x'] + imagesx($tmp_img); $y2_ = $db_element['y'] + imagesy($tmp_img); $linkMap->addRectArea($x1_, $y1_, $x2_, $y2_, 'sysmap.php?form=update&sysmapid=' . $_REQUEST['sysmapid'] . '&selementid=' . $db_element['selementid'], $db_element['label']); } $imgMap = new CImg('map.php?sysmapid=' . $_REQUEST['sysmapid']); $imgMap->setMap($linkMap->GetName()); $table->addRow($linkMap); $table->addRow($imgMap); } $table->Show();
function get_icon_center_by_selementid($selementid) { $element = get_sysmaps_element_by_selementid($selementid); $x = $element["x"]; $y = $element["y"]; $image = get_png_by_selementid($selementid); if ($image) { $x += imagesx($image) / 2; $y += imagesy($image) / 2; } return array($x, $y); }