function make_favorite_screens() { $table = new CTableInfo(); $fav_screens = get_favorites('web.favorite.screenids'); foreach ($fav_screens as $key => $favorite) { $source = $favorite['source']; $sourceid = $favorite['value']; if ('slideshowid' == $source) { if (!($slide = get_slideshow_by_slideshowid($sourceid))) { continue; } if (!slideshow_accessible($sourceid, PERM_READ_ONLY)) { continue; } $link = new CLink(get_node_name_by_elid($sourceid) . $slide['name'], 'screens.php?config=1&elementid=' . $sourceid); $link->setTarget('blank'); $capt = new CSpan($link); $capt->setAttribute('style', 'line-height: 14px; vertical-align: middle;'); $icon = new CLink(new CImg('images/general/chart.png', 'screen', 18, 18, 'borderless'), 'screens.php?config=1&elementid=' . $sourceid . '&fullscreen=1'); $icon->setTarget('blank'); } else { if (!($screen = get_screen_by_screenid($sourceid))) { continue; } if (!screen_accessible($sourceid, PERM_READ_ONLY)) { continue; } $link = new CLink(get_node_name_by_elid($sourceid) . $screen['name'], 'screens.php?config=0&elementid=' . $sourceid); $link->setTarget('blank'); $capt = new CSpan($link); $capt->setAttribute('style', 'line-height: 14px; vertical-align: middle;'); $icon = new CLink(new CImg('images/general/chart.png', 'screen', 18, 18, 'borderless'), 'screens.php?config=0&elementid=' . $sourceid . '&fullscreen=1'); $icon->setTarget('blank'); } $table->addRow(new CCol(array($icon, SPACE, $capt))); } $td = new CCol(array(new CLink(S_SCREENS . ' »', 'screens.php', 'highlight'))); $td->setAttribute('style', 'text-align: right;'); $table->setFooter($td); return $table; }
if (!screen_accessible($row['elementid'], PERM_READ_ONLY)) { continue; } $cmbElements->addItem($row['elementid'], get_node_name_by_elid($row['elementid']) . $row['name']); if (bccomp($elementid, $row['elementid']) == 0) { $element_correct = 1; } if (!isset($first_element)) { $first_element = $row['elementid']; } } if (!isset($element_correct) && isset($first_element)) { $elementid = $first_element; } if (isset($elementid)) { if (!screen_accessible($elementid, PERM_READ_ONLY)) { access_deny(); } $element = get_screen_by_screenid($elementid); if ($element) { $text = $element['name']; } } if ($cmbElements->ItemsCount() > 0) { $form->addItem(array(SPACE . S_SCREENS . SPACE, $cmbElements)); } if (2 != $_REQUEST['fullscreen'] && !empty($elementid) && check_dynamic_items($elementid, 0)) { if (!isset($_REQUEST['hostid'])) { $_REQUEST['groupid'] = $_REQUEST['hostid'] = 0; } $options = array('allow_all_hosts', 'monitored_hosts', 'with_items');
require_once 'include/screens.inc.php'; require_once 'include/forms.inc.php'; require_once 'include/nodes.inc.php'; require_once 'include/blocks.inc.php'; $page['title'] = "S_CONFIGURATION_OF_SCREENS"; $page['file'] = 'screenedit.php'; $page['hist_arg'] = array('screenid'); $page['scripts'] = array('scriptaculous.js?load=effects,dragdrop', 'cscreen.js'); include_once 'include/page_header.php'; // VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION $fields = array('screenid' => array(T_ZBX_INT, O_MAND, P_SYS, DB_ID, null), 'screenitemid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, '(isset({form})&&({form}=="update"))&&(!isset({x})||!isset({y}))'), 'resourcetype' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 14), 'isset({save})'), 'resourceid' => array(T_ZBX_INT, O_OPT, null, DB_ID, 'isset({save})'), 'width' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), null), 'height' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), null), 'colspan' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 100), null), 'rowspan' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 100), null), 'elements' => array(T_ZBX_INT, O_OPT, null, BETWEEN(1, 65535), null), 'valign' => array(T_ZBX_INT, O_OPT, null, BETWEEN(VALIGN_MIDDLE, VALIGN_BOTTOM), null), 'halign' => array(T_ZBX_INT, O_OPT, null, BETWEEN(HALIGN_CENTER, HALIGN_RIGHT), null), 'style' => array(T_ZBX_INT, O_OPT, null, BETWEEN(STYLE_HORISONTAL, STYLE_VERTICAL), 'isset({save})'), 'url' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'dynamic' => array(T_ZBX_INT, O_OPT, null, null, null), 'x' => array(T_ZBX_INT, O_OPT, null, BETWEEN(1, 100), 'isset({save})&&(isset({form})&&({form}!="update"))'), 'y' => array(T_ZBX_INT, O_OPT, null, BETWEEN(1, 100), 'isset({save})&&(isset({form})&&({form}!="update"))'), 'tr_groupid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'tr_hostid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'save' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'delete' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'cancel' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form_refresh' => array(T_ZBX_INT, O_OPT, null, null, null), 'add_row' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 100), null), 'add_col' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 100), null), 'rmv_row' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 100), null), 'rmv_col' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 100), null), 'sw_pos' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 100), null)); check_fields($fields); $_REQUEST['dynmic'] = get_request('dynamic', SCREEN_SIMPLE_ITEM); show_table_header(S_CONFIGURATION_OF_SCREEN_BIG); if (isset($_REQUEST['screenid'])) { if (!screen_accessible($_REQUEST['screenid'], PERM_READ_WRITE)) { access_deny(); } $screen = get_screen_by_screenid($_REQUEST['screenid']); echo SBR; if (isset($_REQUEST['save'])) { if (!isset($_REQUEST['elements'])) { $_REQUEST['elements'] = 0; } DBstart(); if (isset($_REQUEST['screenitemid'])) { $result = update_screen_item($_REQUEST['screenitemid'], $_REQUEST['resourcetype'], $_REQUEST['resourceid'], $_REQUEST['width'], $_REQUEST['height'], $_REQUEST['colspan'], $_REQUEST['rowspan'], $_REQUEST['elements'], $_REQUEST['valign'], $_REQUEST['halign'], $_REQUEST['style'], $_REQUEST['url'], $_REQUEST['dynmic']); show_messages($result, S_ITEM_UPDATED, S_CANNOT_UPDATE_ITEM); } else { $result = add_screen_item($_REQUEST['resourcetype'], $_REQUEST['screenid'], $_REQUEST['x'], $_REQUEST['y'], $_REQUEST['resourceid'], $_REQUEST['width'], $_REQUEST['height'], $_REQUEST['colspan'], $_REQUEST['rowspan'], $_REQUEST['elements'], $_REQUEST['valign'], $_REQUEST['halign'], $_REQUEST['style'], $_REQUEST['url'], $_REQUEST['dynmic']); show_messages($result, S_ITEM_ADDED, S_CANNOT_ADD_ITEM);
$action = get_window_opener($dstfrm, $dstfld1, $srcfld2) . get_window_opener($dstfrm, $dstfld2, $row[$srcfld2]) . "window.opener.setTimeout('add2favorites();', 1000);"; } else { $action = get_window_opener($dstfrm, $dstfld1, $row[$srcfld1]) . (isset($srcfld2) ? get_window_opener($dstfrm, $dstfld2, $row[$srcfld2]) : ''); } $name->SetAction($action . " close_window(); return false;"); $table->addRow($name); } $table->Show(); } else { if ($srctbl == 'screens2') { require_once 'include/screens.inc.php'; $table = new CTableInfo(S_NO_NODES_DEFINED); $table->SetHeader(S_NAME); $result = DBselect('SELECT DISTINCT n.name as node_name,s.screenid,s.name ' . ' FROM screens s ' . ' LEFT JOIN nodes n ON n.nodeid=' . DBid2nodeid('s.screenid') . ' WHERE ' . DBin_node('s.screenid', $nodeid) . ' ORDER BY s.name'); while ($row = DBfetch($result)) { if (!screen_accessible($row["screenid"], PERM_READ_ONLY)) { continue; } if (check_screen_recursion($_REQUEST['screenid'], $row['screenid'])) { continue; } $row['node_name'] = isset($row['node_name']) ? '(' . $row['node_name'] . ') ' : ''; $name = new CLink($row['name'], '#', 'action'); $row['name'] = $row['node_name'] . $row['name']; if (isset($_REQUEST['reference']) && $_REQUEST['reference'] == 'dashboard') { $action = get_window_opener($dstfrm, $dstfld1, $srcfld2) . get_window_opener($dstfrm, $dstfld2, $row[$srcfld2]) . "window.opener.setTimeout('add2favorites();', 1000);"; } else { $action = get_window_opener($dstfrm, $dstfld1, $row[$srcfld1]) . (isset($srcfld2) ? get_window_opener($dstfrm, $dstfld2, $row[$srcfld2]) : ''); } $name->SetAction($action . " close_window(); return false;"); $table->addRow($name);
show_table_header(0 == $config ? S_CONFIGURATION_OF_SCREENS_BIG : S_CONFIGURATION_OF_SLIDESHOWS_BIG, $form); echo SBR; $row_count = 0; if (0 == $config) { if (isset($_REQUEST["form"])) { insert_screen_form(); } else { $numrows = new CSpan(null, 'info'); $numrows->addOption('name', 'numrows'); $header = get_table_header(array(S_SCREENS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows)); show_table_header($header); $table = new CTableInfo(S_NO_SCREENS_DEFINED); $table->SetHeader(array(make_sorting_link(S_NAME, 's.name'), make_sorting_link(S_DIMENSION_COLS_ROWS, 'size'), S_SCREEN)); $result = DBselect('SELECT s.screenid,s.name,s.hsize,s.vsize,(s.hsize*s.vsize) as s_size ' . ' FROM screens s ' . ' WHERE ' . DBin_node('s.screenid') . order_by('s.name,s_size', 's.screenid')); while ($row = DBfetch($result)) { if (!screen_accessible($row["screenid"], PERM_READ_WRITE)) { continue; } $table->AddRow(array(new CLink($row["name"], "?config=0&form=update&screenid=" . $row["screenid"], 'action'), $row["hsize"] . " x " . $row["vsize"], new CLink(S_EDIT, "screenedit.php?screenid=" . $row["screenid"]))); $row_count++; } $table->Show(); } } else { if (isset($_REQUEST["form"])) { insert_slideshow_form(); } else { $row_count = 0; $numrows = new CSpan(null, 'info'); $numrows->addOption('name', 'numrows'); $header = get_table_header(array(S_SLIDESHOWS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
function get_screen($screenid, $editmode, $effectiveperiod = NULL) { global $USER_DETAILS; if ($screenid == 0) { return new CTableInfo(S_NO_SCREENS_DEFINED); } if (!screen_accessible($screenid, $editmode == 1 ? PERM_READ_WRITE : PERM_READ_ONLY)) { access_deny(); } if (is_null($effectiveperiod)) { $effectiveperiod = ZBX_MIN_PERIOD; } $result = DBselect('SELECT name,hsize,vsize FROM screens WHERE screenid=' . $screenid); $row = DBfetch($result); if (!$row) { return new CTableInfo(S_NO_SCREENS_DEFINED); } for ($r = 0; $r < $row['vsize']; $r++) { for ($c = 0; $c < $row['hsize']; $c++) { if (isset($skip_field[$r][$c])) { continue; } $sql = 'SELECT * FROM screens_items WHERE screenid=' . $screenid . ' AND x=' . $c . ' AND y=' . $r; $iresult = DBSelect($sql); $irow = DBfetch($iresult); if ($irow) { $colspan = $irow['colspan']; $rowspan = $irow['rowspan']; } else { $colspan = 0; $rowspan = 0; } for ($i = 0; $i < $rowspan || $i == 0; $i++) { for ($j = 0; $j < $colspan || $j == 0; $j++) { if ($i != 0 || $j != 0) { $skip_field[$r + $i][$c + $j] = 1; } } } } } $table = new CTable(new CLink('No rows in screen ' . $row['name'], 'screenconf.php?config=0&form=update&screenid=' . $screenid), $editmode == 0 || $editmode == 2 ? 'screen_view' : 'screen_edit'); $table->setAttribute('id', 'iframe'); if ($editmode == 1) { $add_col_link = 'screenedit.php?config=1&screenid=' . $screenid . '&add_col='; $new_cols = array(new Ccol(new Cimg('images/general/zero.gif', 'zero', 1, 1))); for ($c = 0; $c < $row['hsize'] + 1; $c++) { array_push($new_cols, new Ccol(new Clink(new Cimg('images/general/closed.gif'), $add_col_link . $c))); } $table->addRow($new_cols); } $empty_screen_col = array(); for ($r = 0; $r < $row['vsize']; $r++) { $new_cols = array(); $empty_screen_row = true; if ($editmode == 1) { $add_row_link = 'screenedit.php?config=1&screenid=' . $screenid . '&add_row='; array_push($new_cols, new Ccol(new Clink(new Cimg('images/general/closed.gif'), $add_row_link . $r))); } for ($c = 0; $c < $row['hsize']; $c++) { $item = array(); if (isset($skip_field[$r][$c])) { continue; } $item_form = false; $iresult = DBSelect('SELECT * FROM screens_items WHERE screenid=' . $screenid . ' AND x=' . $c . ' AND y=' . $r); $irow = DBfetch($iresult); if ($irow) { $screenitemid = $irow['screenitemid']; $resourcetype = $irow['resourcetype']; $resourceid = $irow['resourceid']; $width = $irow['width']; $height = $irow['height']; $colspan = $irow['colspan']; $rowspan = $irow['rowspan']; $elements = $irow['elements']; $valign = $irow['valign']; $halign = $irow['halign']; $style = $irow['style']; $url = $irow['url']; $dynamic = $irow['dynamic']; } else { $screenitemid = 0; $resourcetype = 0; $resourceid = 0; $width = 0; $height = 0; $colspan = 0; $rowspan = 0; $elements = 0; $valign = VALIGN_DEFAULT; $halign = HALIGN_DEFAULT; $style = 0; $url = ''; $dynamic = 0; } if ($screenitemid > 0) { $empty_screen_row = false; $empty_screen_col[$c] = 1; } if ($editmode == 1 && $screenitemid != 0) { $onclick_action = "ZBX_SCREENS['" . $_REQUEST['screenid'] . "'].screen.element_onclick('screenedit.php?form=update" . url_param('screenid') . '&screenitemid=' . $screenitemid . "#form');"; $action = 'screenedit.php?form=update' . url_param('screenid') . '&screenitemid=' . $screenitemid . '#form'; } else { if ($editmode == 1 && $screenitemid == 0) { $onclick_action = "ZBX_SCREENS['" . $_REQUEST['screenid'] . "'].screen.element_onclick('screenedit.php?form=update" . url_param('screenid') . '&x=' . $c . '&y=' . $r . "#form');"; $action = 'screenedit.php?form=update' . url_param('screenid') . '&x=' . $c . '&y=' . $r . '#form'; } else { $action = NULL; } } if ($editmode == 1 && isset($_REQUEST['form']) && isset($_REQUEST['x']) && $_REQUEST['x'] == $c && isset($_REQUEST['y']) && $_REQUEST['y'] == $r) { // click on empty field $item = get_screen_item_form(); $item_form = true; } else { if ($editmode == 1 && isset($_REQUEST['form']) && isset($_REQUEST['screenitemid']) && bccomp($_REQUEST['screenitemid'], $screenitemid) == 0) { // click on element $item = get_screen_item_form(); $item_form = true; } else { if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_GRAPH) { if ($editmode == 0) { $action = 'charts.php?graphid=' . $resourceid . url_param('period') . url_param('stime'); } $graphid = null; $graphtype = GRAPH_TYPE_NORMAL; $yaxis = 0; // GRAPH & ZOOM features $sql = 'SELECT MAX(g.graphid) as graphid, MAX(g.graphtype) as graphtype, MIN(gi.yaxisside) as yaxissidel, MAX(gi.yaxisside) as yaxissider,' . ' MAX(g.show_legend) as legend, MAX(g.show_3d) as show3d ' . ' FROM graphs g, graphs_items gi ' . ' WHERE g.graphid=' . $resourceid . ' AND gi.graphid=g.graphid '; $res = DBselect($sql); while ($graph = DBfetch($res)) { $graphid = $graph['graphid']; $graphtype = $graph['graphtype']; $yaxis = $graph['yaxissider']; $yaxis = $graph['yaxissidel'] == $yaxis ? $yaxis : 2; $legend = $graph['legend']; $graph3d = $graph['show3d']; } if ($yaxis == 2) { $shiftXleft = 60; $shiftXright = 60; } else { if ($yaxis == 0) { $shiftXleft = 60; $shiftXright = 20; } else { $shiftXleft = 10; $shiftXright = 60; } } //------------- // Host feature if ($dynamic == SCREEN_DYNAMIC_ITEM && isset($_REQUEST['hostid']) && $_REQUEST['hostid'] > 0) { $def_items = array(); $di_res = get_graphitems_by_graphid($resourceid); while ($gitem = DBfetch($di_res)) { $def_items[] = $gitem; } $url = ''; if ($new_items = get_same_graphitems_for_host($def_items, $_REQUEST['hostid'])) { $url .= make_url_from_gitems($new_items); } $url = make_url_from_graphid($resourceid, false) . $url; } //------------- $default = false; if ($graphtype == GRAPH_TYPE_PIE || $graphtype == GRAPH_TYPE_EXPLODED) { if ($dynamic == SCREEN_SIMPLE_ITEM || empty($url)) { $url = 'chart6.php?graphid=' . $resourceid; $default = true; } $g_img = new CImg($url . '&width=' . $width . '&height=' . $height . '&period=' . $effectiveperiod . url_param('stime') . '&legend=' . $legend . '&graph3d=' . $graph3d); } else { if ($dynamic == SCREEN_SIMPLE_ITEM || empty($url)) { $url = 'chart2.php?graphid=' . $resourceid; $default = true; } $dom_graph_id = 'graph_' . $screenitemid . '_' . $resourceid; $g_img = new CImg($url . '&width=' . $width . '&height=' . $height . '&period=' . $effectiveperiod . url_param('stime')); $g_img->setAttribute('id', $dom_graph_id); if (!is_null($graphid) && $editmode != 1) { insert_js(' A_SBOX["' . $dom_graph_id . '"] = new Object;' . 'A_SBOX["' . $dom_graph_id . '"].shiftT = 17;' . 'A_SBOX["' . $dom_graph_id . '"].shiftL = ' . $shiftXleft . ';'); if (isset($_REQUEST['stime'])) { $stime = $_REQUEST['stime']; $stime = mktime(substr($stime, 8, 2), substr($stime, 10, 2), 0, substr($stime, 4, 2), substr($stime, 6, 2), substr($stime, 0, 4)); } else { $stime = 'null'; } global $page; if ($page['type'] == PAGE_TYPE_HTML) { zbx_add_post_js('graph_zoom_init("' . $dom_graph_id . '",' . $stime . ',' . $effectiveperiod . ',' . $width . ',' . $height . ', false);'); } else { $g_img->setAttribute('onload', 'javascript: graph_zoom_init("' . $dom_graph_id . '",' . $stime . ',' . $effectiveperiod . ',' . $width . ',' . $height . ', false);'); // insert_js('graph_zoom_init("'.$dom_graph_id.'",'.$stime.','.$effectiveperiod.','.$width.','.$height.', false);'); } } } if ($default && $editmode == 0) { $item = new CLink($g_img, $action); } else { $item =& $g_img; } } else { if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_SIMPLE_GRAPH) { if ($editmode == 0) { $action = "history.php?action=showgraph&itemid={$resourceid}" . url_param("period") . url_param("inc") . url_param("dec"); } // Host feature if ($dynamic == SCREEN_DYNAMIC_ITEM && isset($_REQUEST['hostid']) && $_REQUEST['hostid'] > 0) { if ($newitemid = get_same_item_for_host($resourceid, $_REQUEST['hostid'])) { $resourceid = $newitemid; } else { $resourceid = ''; } } //------------- $url = empty($resourceid) ? 'chart3.php?' : "chart.php?itemid={$resourceid}&"; $item = new CLink(new CImg($url . "width={$width}&height={$height}" . "&period={$effectiveperiod}" . url_param("stime")), $action); } else { if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_MAP) { $image_map = new CImg("map.php?noedit=1&sysmapid={$resourceid}" . "&width={$width}&height={$height}"); if ($editmode == 0) { $action_map = get_action_map_by_sysmapid($resourceid); $image_map->SetMap($action_map->GetName()); $item = array($action_map, $image_map); } else { $item = $image_map; // $item = new CLink($image_map, $action); } } else { if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_PLAIN_TEXT) { // Host feature if ($dynamic == SCREEN_DYNAMIC_ITEM && isset($_REQUEST['hostid']) && $_REQUEST['hostid'] > 0) { if ($newitemid = get_same_item_for_host($resourceid, $_REQUEST['hostid'])) { $resourceid = $newitemid; } else { $resourceid = 0; } } //------------- $item = array(get_screen_plaintext($resourceid, $elements, $style)); if ($editmode == 1) { array_push($item, new CLink(S_CHANGE, $action)); } } else { if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_STATUS_OF_TRIGGERS) { $params = array(); $params['groupid'] = get_request('tr_groupid', get_profile('web.screens.tr_groupid', 0)); $params['hostid'] = get_request('tr_hostid', get_profile('web.screens.tr_hostid', 0)); $params['limit'] = $elements; update_profile('web.screens.tr_groupid', $params['groupid'], PROFILE_TYPE_ID); update_profile('web.screens.tr_hostid', $params['hostid'], PROFILE_TYPE_ID); $tr_form = new CForm(); $cmbGroup = new CComboBox('tr_groupid', $params['groupid'], 'submit()'); $cmbHosts = new CComboBox('tr_hostid', $params['hostid'], 'submit()'); $cmbGroup->addItem(0, S_ALL_SMALL); $cmbHosts->addItem(0, S_ALL_SMALL); $available_groups = get_accessible_groups_by_user($USER_DETAILS, PERM_READ_ONLY); $available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY); $available_triggers = get_accessible_triggers(PERM_READ_ONLY, PERM_RES_IDS_ARRAY); $sql = 'SELECT DISTINCT g.groupid,g.name ' . ' FROM groups g, hosts_groups hg, hosts h ' . ' WHERE ' . DBcondition('g.groupid', $available_groups) . ' AND hg.groupid=g.groupid ' . ' AND h.hostid=hg.hostid ' . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND EXISTS(SELECT i.itemid FROM items i WHERE i.status=' . ITEM_STATUS_ACTIVE . ' AND i.hostid=h.hostid ) ' . ' ORDER BY g.name'; $tresult = DBselect($sql); while ($tr_row = DBfetch($tresult)) { $cmbGroup->addItem($tr_row['groupid'], get_node_name_by_elid($tr_row['groupid']) . $tr_row['name']); } $tr_form->addItem(array(S_GROUP . SPACE, $cmbGroup)); $sql_from = ''; $sql_where = ''; if ($params['groupid'] > 0) { $sql_from .= ',hosts_groups hg '; $sql_where .= ' AND hg.hostid=h.hostid AND hg.groupid=' . $params['groupid']; } $sql = 'SELECT DISTINCT h.hostid,h.host ' . ' FROM hosts h, items i, functions f, triggers t ' . $sql_from . ' WHERE h.status=' . HOST_STATUS_MONITORED . $sql_where . ' AND h.hostid=i.hostid ' . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND i.itemid=f.itemid ' . ' AND f.triggerid=t.triggerid ' . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' ORDER BY h.host'; $tresult = DBselect($sql); while ($tr_row = DBfetch($tresult)) { $cmbHosts->addItem($tr_row['hostid'], get_node_name_by_elid($tr_row['hostid']) . $tr_row['host']); } $tr_form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts)); $item = array(get_table_header(array(S_STATUS_OF_TRIGGERS_BIG, SPACE, date('[H:i:s]', time())), $tr_form)); //*/ // $item = array(); $item[] = make_latest_issues($params); if ($editmode == 1) { array_push($item, new CLink(S_CHANGE, $action)); } } else { if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_SYSTEM_STATUS) { $item = array(get_table_header(array(S_SYSTEM_STATUSBIG, SPACE, date('[H:i:s]', time())))); $item[] = make_system_summary(); if ($editmode == 1) { array_push($item, new CLink(S_CHANGE, $action)); } } else { if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_HOSTS_INFO) { $item = array(new CHostsInfo($resourceid, $style)); if ($editmode == 1) { array_push($item, new CLink(S_CHANGE, $action)); } } else { if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_TRIGGERS_INFO) { $item = new CTriggersInfo($style); if ($resourceid > 0) { $item->set_host_group($resourceid); } $item = array($item); if ($editmode == 1) { array_push($item, new CLink(S_CHANGE, $action)); } } else { if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_SERVER_INFO) { // $item = array(get_table_header(S_STATUS_OF_ZABBIX_BIG),make_status_of_zbx()); $item = array(new CServerInfo()); if ($editmode == 1) { array_push($item, new CLink(S_CHANGE, $action)); } } else { if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_CLOCK) { $item = new CFlashClock($width, $height, $style, $action); } else { if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_SCREEN) { $item = array(get_screen($resourceid, 2, $effectiveperiod)); if ($editmode == 1) { array_push($item, new CLink(S_CHANGE, $action)); } } else { if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_TRIGGERS_OVERVIEW) { $hostids = array(); $res = DBselect('SELECT DISTINCT hg.hostid FROM hosts_groups hg WHERE hg.groupid=' . $resourceid); while ($tmp_host = DBfetch($res)) { $hostids[$tmp_host['hostid']] = $tmp_host['hostid']; } $item = array(get_triggers_overview($hostids, $style)); if ($editmode == 1) { array_push($item, new CLink(S_CHANGE, $action)); } } else { if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_DATA_OVERVIEW) { $hostids = array(); $res = DBselect('SELECT DISTINCT hg.hostid FROM hosts_groups hg WHERE hg.groupid=' . $resourceid); while ($tmp_host = DBfetch($res)) { $hostids[$tmp_host['hostid']] = $tmp_host['hostid']; } $item = array(get_items_data_overview($hostids, $style)); if ($editmode == 1) { array_push($item, new CLink(S_CHANGE, $action)); } } else { if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_URL) { $item = array(new CIFrame($url, $width, $height, "auto")); if ($editmode == 1) { array_push($item, BR(), new CLink(S_CHANGE, $action)); } } else { if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_ACTIONS) { $item = array(get_history_of_actions($elements)); if ($editmode == 1) { array_push($item, new CLink(S_CHANGE, $action)); } } else { if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_EVENTS) { $item = array(get_history_of_triggers_events(0, $elements)); if ($editmode == 1) { array_push($item, new CLink(S_CHANGE, $action)); } } else { $item = array(SPACE); if ($editmode == 1) { array_push($item, BR(), new CLink(S_CHANGE, $action)); } } } } } } } } } } } } } } } } } } } $str_halign = 'def'; if ($halign == HALIGN_CENTER) { $str_halign = 'cntr'; } if ($halign == HALIGN_LEFT) { $str_halign = 'left'; } if ($halign == HALIGN_RIGHT) { $str_halign = 'right'; } $str_valign = 'def'; if ($valign == VALIGN_MIDDLE) { $str_valign = 'mdl'; } if ($valign == VALIGN_TOP) { $str_valign = 'top'; } if ($valign == VALIGN_BOTTOM) { $str_valign = 'bttm'; } if ($editmode == 1 && !$item_form) { $item = new CDiv($item, 'draggable'); $item->setAttribute('id', 'position_' . $r . '_' . $c); if ($editmode == 1) { $item->setAttribute('onclick', 'javascript: ' . $onclick_action); } } $new_col = new CCol($item, $str_halign . '_' . $str_valign); if ($colspan) { $new_col->SetColSpan($colspan); } if ($rowspan) { $new_col->SetRowSpan($rowspan); } array_push($new_cols, $new_col); } if ($editmode == 1) { $rmv_icon = new Cimg('images/general/opened.gif'); if ($empty_screen_row) { $rmv_row_link = 'javascript: location.href = ' . "'screenedit.php?config=1&screenid=" . $screenid . '&rmv_row=' . $r . "';"; } else { $rmv_row_link = "javascript: if(Confirm('This screen-row is not empty. Delete it?')){" . " location.href = 'screenedit.php?config=1&screenid=" . $screenid . "&rmv_row=" . $r . "';}"; } $rmv_icon->addAction('onclick', $rmv_row_link); array_push($new_cols, new Ccol($rmv_icon)); } $table->AddRow(new CRow($new_cols)); } if ($editmode == 1) { $add_row_link = 'screenedit.php?config=1&screenid=' . $screenid . '&add_row='; $new_cols = array(new Ccol(new Clink(new Cimg('images/general/closed.gif'), $add_row_link . $row['vsize']))); for ($c = 0; $c < $row['hsize']; $c++) { $rmv_icon = new Cimg('images/general/opened.gif'); if (isset($empty_screen_col[$c])) { $rmv_col_link = "javascript: if(Confirm('This screen-column is not empty. Delete it?')){" . " location.href = 'screenedit.php?config=1&screenid=" . $screenid . "&rmv_col=" . $c . "';}"; } else { $rmv_col_link = "javascript: location.href = 'screenedit.php?config=1&screenid=" . $screenid . "&rmv_col=" . $c . "';"; } $rmv_icon->addAction('onclick', $rmv_col_link); array_push($new_cols, new Ccol($rmv_icon)); } array_push($new_cols, new Ccol(new Cimg('images/general/zero.gif', 'zero', 1, 1))); $table->addRow($new_cols); } return $table; }