function drawMapLinkLabels(&$im, $map, $mapInfo, $resolveMacros = true) { global $colors; $links = $map['links']; $selements = $map['selements']; foreach ($links as $link) { if (empty($link['label'])) { continue; } $selement1 = $selements[$link['selementid1']]; list($x1, $y1) = get_icon_center_by_selement($selement1, $mapInfo[$link['selementid1']], $map); $selement2 = $selements[$link['selementid2']]; list($x2, $y2) = get_icon_center_by_selement($selement2, $mapInfo[$link['selementid2']], $map); if (isset($selement1['elementsubtype']) && $selement1['elementsubtype'] == SYSMAP_ELEMENT_AREA_TYPE_CUSTOM) { if ($selement1['areatype'] == SYSMAP_ELEMENT_AREA_TYPE_CUSTOM) { $w = $selement1['width']; $h = $selement1['height']; } else { $w = $map['width']; $h = $map['height']; } list($x1, $y1) = calculateMapAreaLinkCoord($x1, $y1, $w, $h, $x2, $y2); } if (isset($selement2['elementsubtype']) && $selement2['elementsubtype'] == SYSMAP_ELEMENT_AREA_TYPE_CUSTOM) { if ($selement2['areatype'] == SYSMAP_ELEMENT_AREA_TYPE_CUSTOM) { $w = $selement2['width']; $h = $selement2['height']; } else { $w = $map['width']; $h = $map['height']; } list($x2, $y2) = calculateMapAreaLinkCoord($x2, $y2, $w, $h, $x1, $y1); } $drawtype = $link['drawtype']; $color = convertColor($im, $link['color']); $linktriggers = $link['linktriggers']; order_result($linktriggers, 'triggerid'); if (!empty($linktriggers)) { $max_severity = 0; $triggers = array(); foreach ($linktriggers as $link_trigger) { if ($link_trigger['triggerid'] == 0) { continue; } $id = $link_trigger['linktriggerid']; $triggers[$id] = zbx_array_merge($link_trigger, get_trigger_by_triggerid($link_trigger['triggerid'])); if ($triggers[$id]['status'] == TRIGGER_STATUS_ENABLED && $triggers[$id]['value'] == TRIGGER_VALUE_TRUE) { if ($triggers[$id]['priority'] >= $max_severity) { $drawtype = $triggers[$id]['drawtype']; $color = convertColor($im, $triggers[$id]['color']); $max_severity = $triggers[$id]['priority']; } } } } $label = $link['label']; $label = str_replace("\r", '', $label); $strings = explode("\n", $label); $box_width = 0; $box_height = 0; foreach ($strings as $snum => $str) { $strings[$snum] = $resolveMacros ? CMacrosResolverHelper::resolveMapLabelMacros($str) : $str; } foreach ($strings as $str) { $dims = imageTextSize(8, 0, $str); $box_width = $box_width > $dims['width'] ? $box_width : $dims['width']; $box_height += $dims['height'] + 2; } $boxX_left = round(($x1 + $x2) / 2 - $box_width / 2 - 6); $boxX_right = round(($x1 + $x2) / 2 + $box_width / 2 + 6); $boxY_top = round(($y1 + $y2) / 2 - $box_height / 2 - 4); $boxY_bottom = round(($y1 + $y2) / 2 + $box_height / 2 + 2); switch ($drawtype) { case MAP_LINK_DRAWTYPE_DASHED_LINE: case MAP_LINK_DRAWTYPE_DOT: dashedRectangle($im, $boxX_left, $boxY_top, $boxX_right, $boxY_bottom, $color); break; case MAP_LINK_DRAWTYPE_BOLD_LINE: imagerectangle($im, $boxX_left - 1, $boxY_top - 1, $boxX_right + 1, $boxY_bottom + 1, $color); // break; is not ne // break; is not ne case MAP_LINK_DRAWTYPE_LINE: default: imagerectangle($im, $boxX_left, $boxY_top, $boxX_right, $boxY_bottom, $color); } imagefilledrectangle($im, $boxX_left + 1, $boxY_top + 1, $boxX_right - 1, $boxY_bottom - 1, $colors['White']); $increasey = 4; foreach ($strings as $str) { $dims = imageTextSize(8, 0, $str); $labelx = ($x1 + $x2) / 2 - $dims['width'] / 2; $labely = $boxY_top + $increasey; imagetext($im, 8, 0, $labelx, $labely + $dims['height'], $colors['Black'], $str); $increasey += $dims['height'] + 2; } } }
// Draw connectors $links = DBselect('select * from sysmaps_links where sysmapid=' . $_REQUEST['sysmapid']); while ($link = DBfetch($links)) { list($x1, $y1) = get_icon_center_by_selementid($link["selementid1"]); list($x2, $y2) = get_icon_center_by_selementid($link["selementid2"]); $drawtype = $link["drawtype"]; $color = convertColor($im, $link["color"]); $triggers = get_link_triggers($link['linkid']); if (!empty($triggers)) { $max_severity = 0; foreach ($triggers as $id => $link_trigger) { $triggers[$id] = array_merge($link_trigger, get_trigger_by_triggerid($link_trigger["triggerid"])); 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) {
function drawMapLinkLabels(&$im, &$map, &$map_info) { global $colors; $links = $map['links']; $selements = $map['selements']; foreach ($links as $lnum => $link) { if (empty($link)) { continue; } if (empty($link['label'])) { continue; } $selement = $selements[$link['selementid1']]; list($x1, $y1) = get_icon_center_by_selement($selement, $map_info[$link['selementid1']]); $selement = $selements[$link['selementid2']]; list($x2, $y2) = get_icon_center_by_selement($selement, $map_info[$link['selementid2']]); $drawtype = $link['drawtype']; $color = convertColor($im, $link['color']); $linktriggers = $link['linktriggers']; order_result($linktriggers, 'triggerid'); if (!empty($linktriggers)) { $max_severity = 0; $options = array(); $options['nopermissions'] = 1; $options['extendoutput'] = 1; $options['triggerids'] = array(); $triggers = array(); foreach ($linktriggers as $lt_num => $link_trigger) { if ($link_trigger['triggerid'] == 0) { continue; } $id = $link_trigger['linktriggerid']; $triggers[$id] = zbx_array_merge($link_trigger, get_trigger_by_triggerid($link_trigger['triggerid'])); if ($triggers[$id]['status'] == TRIGGER_STATUS_ENABLED && $triggers[$id]['value'] == TRIGGER_VALUE_TRUE) { if ($triggers[$id]['priority'] >= $max_severity) { $drawtype = $triggers[$id]['drawtype']; $color = convertColor($im, $triggers[$id]['color']); $max_severity = $triggers[$id]['priority']; } } } } $label = $link['label']; $label = str_replace("\r", '', $label); $strings = explode("\n", $label); $box_width = 0; $box_height = 0; foreach ($strings as $snum => $str) { $strings[$snum] = resolveMapLabelMacros($str); } foreach ($strings as $snum => $str) { $dims = imageTextSize(8, 0, $str); $box_width = $box_width > $dims['width'] ? $box_width : $dims['width']; $box_height += $dims['height'] + 2; } $boxX_left = round(($x1 + $x2) / 2 - $box_width / 2 - 6); $boxX_right = round(($x1 + $x2) / 2 + $box_width / 2 + 6); $boxY_top = round(($y1 + $y2) / 2 - $box_height / 2 - 4); $boxY_bottom = round(($y1 + $y2) / 2 + $box_height / 2 + 2); switch ($drawtype) { case MAP_LINK_DRAWTYPE_DASHED_LINE: case MAP_LINK_DRAWTYPE_DOT: dashedrectangle($im, $boxX_left, $boxY_top, $boxX_right, $boxY_bottom, $color); break; case MAP_LINK_DRAWTYPE_BOLD_LINE: imagerectangle($im, $boxX_left - 1, $boxY_top - 1, $boxX_right + 1, $boxY_bottom + 1, $color); case MAP_LINK_DRAWTYPE_LINE: default: imagerectangle($im, $boxX_left, $boxY_top, $boxX_right, $boxY_bottom, $color); } imagefilledrectangle($im, $boxX_left + 1, $boxY_top + 1, $boxX_right - 1, $boxY_bottom - 1, $colors['White']); $increasey = 4; foreach ($strings as $snum => $str) { $dims = imageTextSize(8, 0, $str); $labelx = ($x1 + $x2) / 2 - $dims['width'] / 2; $labely = $boxY_top + $increasey; imagetext($im, 8, 0, $labelx, $labely + $dims['height'], $colors['Black'], $str); $increasey += $dims['height'] + 2; } } }
$hex_RGB = ''; $hex_RGB .= $hex_value; } return "#" . $hex_RGB; } } $RGB = '$RGB'; $RGBa = $RGB[0]; $RGBb = $RGB[1]; $RGBc = $RGB[2]; $item_color = ''; if (isset($item->cat_color)) { $item_color = $item->cat_color; } $js_list = "media/com_icagenda/js/jsevt.js"; $RGB = explode(",", convertColor($item_color)); $a = array($RGBa, $RGBa, $RGBa); $somme = array_sum($a); // // End old function $iCModeliChelper = new iCModeliChelper(); $icsetvar = 'components/com_icagenda/add/elements/icsetvar.php'; $navposition = $this->navposition; $datesDisplay_menu = $this->datesDisplay; $datesDisplay_global = $this->datesDisplay_global; if ($datesDisplay_menu) { $datesDisplay = $datesDisplay_menu; } else { $datesDisplay = $datesDisplay_global; } $orderby = $this->orderby;