function get_trigger_overview_cells(&$table_row, &$trhosts, &$hostname) { $css_class = NULL; unset($tr_ov_menu); $ack = null; if (isset($trhosts[$hostname])) { unset($ack_menu); switch ($trhosts[$hostname]['value']) { case TRIGGER_VALUE_TRUE: $css_class = get_severity_style($trhosts[$hostname]['priority']); if ($ack = get_last_event_by_triggerid($trhosts[$hostname]['triggerid'])) { $ack_menu = array(S_ACKNOWLEDGE, 'acknow.php?eventid=' . $ack['eventid'], array('tw' => '_blank')); } if (1 == $ack['acknowledged']) { $ack = new CImg('images/general/tick.png', 'ack'); } else { $ack = null; } break; case TRIGGER_VALUE_FALSE: $css_class = 'normal'; break; default: $css_class = 'unknown_trigger'; } $style = 'cursor: pointer; '; if (time(NULL) - $trhosts[$hostname]['lastchange'] < 300) { $style .= 'background-image: url(images/gradients/blink1.gif); ' . 'background-position: top left; ' . 'background-repeat: repeat;'; } else { if (time(NULL) - $trhosts[$hostname]['lastchange'] < 900) { $style .= 'background-image: url(images/gradients/blink2.gif); ' . 'background-position: top left; ' . 'background-repeat: repeat;'; } } unset($item_menu); $tr_ov_menu = array(array(S_TRIGGER, null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))), array(S_EVENTS, 'events.php?triggerid=' . $trhosts[$hostname]['triggerid'], array('tw' => '_blank'))); if (isset($ack_menu)) { $tr_ov_menu[] = $ack_menu; } $db_items = DBselect('select distinct i.itemid, i.description, i.key_, i.value_type ' . ' from items i, functions f ' . ' where f.itemid=i.itemid and f.triggerid=' . $trhosts[$hostname]['triggerid']); while ($item_data = DBfetch($db_items)) { $description = item_description($item_data); switch ($item_data['value_type']) { case ITEM_VALUE_TYPE_UINT64: case ITEM_VALUE_TYPE_FLOAT: $action = 'showgraph'; $status_bar = S_SHOW_GRAPH_OF_ITEM . ' \'' . $description . '\''; break; case ITEM_VALUE_TYPE_LOG: case ITEM_VALUE_TYPE_STR: case ITEM_VALUE_TYPE_TEXT: default: $action = 'showlatest'; $status_bar = S_SHOW_VALUES_OF_ITEM . ' \'' . $description . '\''; break; } if (strlen($description) > 25) { $description = substr($description, 0, 22) . '...'; } $item_menu[$action][] = array($description, 'history.php?action=' . $action . '&itemid=' . $item_data['itemid'] . '&period=3600', array('tw' => '', 'sb' => $status_bar)); } if (isset($item_menu['showgraph'])) { $tr_ov_menu[] = array(S_GRAPHS, null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))); $tr_ov_menu = array_merge($tr_ov_menu, $item_menu['showgraph']); } if (isset($item_menu['showlatest'])) { $tr_ov_menu[] = array(S_VALUES, null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))); $tr_ov_menu = array_merge($tr_ov_menu, $item_menu['showlatest']); } unset($item_menu); } // dependency // TRIGGERS ON WHICH DEPENDS THIS $desc = array(); if (isset($trhosts[$hostname])) { $triggerid = $trhosts[$hostname]['triggerid']; $dependency = false; $dep_table = new CTableInfo(); $dep_table->AddOption('style', 'width: 200px;'); $dep_table->addRow(bold(S_DEPENDS_ON . ':')); $sql_dep = 'SELECT * FROM trigger_depends WHERE triggerid_down=' . $triggerid; $dep_res = DBselect($sql_dep); while ($dep_row = DBfetch($dep_res)) { $dep_table->addRow(SPACE . '-' . SPACE . expand_trigger_description($dep_row['triggerid_up'])); $dependency = true; } if ($dependency) { $img = new Cimg('images/general/down_icon.png', 'DEP_DOWN'); $img->AddOption('style', 'vertical-align: middle; border: 0px;'); $img->SetHint($dep_table); array_push($desc, $img); } unset($img, $dep_table, $dependency); // TRIGGERS THAT DEPEND ON THIS $dependency = false; $dep_table = new CTableInfo(); $dep_table->AddOption('style', 'width: 200px;'); $dep_table->addRow(bold(S_DEPENDENT . ':')); $sql_dep = 'SELECT * FROM trigger_depends WHERE triggerid_up=' . $triggerid; $dep_res = DBselect($sql_dep); while ($dep_row = DBfetch($dep_res)) { $dep_table->addRow(SPACE . '-' . SPACE . expand_trigger_description($dep_row['triggerid_down'])); $dependency = true; } if ($dependency) { $img = new Cimg('images/general/up_icon.png', 'DEP_UP'); $img->AddOption('style', 'vertical-align: middle; border: 0px;'); $img->SetHint($dep_table); array_push($desc, $img); } unset($img, $dep_table, $dependency); } //------------------------ $status_col = new CCol(array($desc, $ack), $css_class); if (isset($style)) { $status_col->AddOption('style', $style); } if (isset($tr_ov_menu)) { $tr_ov_menu = new CPUMenu($tr_ov_menu, 170); $status_col->OnClick($tr_ov_menu->GetOnActionJS()); $status_col->AddAction('onmouseover', 'this.old_border=this.style.border; this.style.border=\'1px dotted #0C0CF0\''); $status_col->AddAction('onmouseout', 'this.style.border=this.old_border;'); } array_push($table_row, $status_col); return $table_row; }
function get_item_data_overview_cells(&$table_row, &$ithosts, $hostname) { $css_class = NULL; unset($it_ov_menu); $value = '-'; $ack = null; if (isset($ithosts[$hostname])) { if ($ithosts[$hostname]['tr_value'] == TRIGGER_VALUE_TRUE) { $css_class = get_severity_style($ithosts[$hostname]['severity']); $ack = get_last_event_by_triggerid($ithosts[$hostname]['triggerid']); if (1 == $ack['acknowledged']) { $ack = array(SPACE, new CImg('images/general/tick.png', 'ack')); } else { $ack = null; } } $value = format_lastvalue($ithosts[$hostname]); $it_ov_menu = array(array(S_VALUES, null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))), array(S_500_LATEST_VALUES, 'history.php?action=showlatest&itemid=' . $ithosts[$hostname]['itemid'], array('tw' => '_blank'))); switch ($ithosts[$hostname]['value_type']) { case ITEM_VALUE_TYPE_UINT64: case ITEM_VALUE_TYPE_FLOAT: $it_ov_menu = array_merge(array(array(S_GRAPHS, null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))), array(S_LAST_HOUR_GRAPH, 'history.php?period=3600&action=showgraph&itemid=' . $ithosts[$hostname]['itemid'], array('tw' => '_blank')), array(S_LAST_WEEK_GRAPH, 'history.php?period=604800&action=showgraph&itemid=' . $ithosts[$hostname]['itemid'], array('tw' => '_blank')), array(S_LAST_MONTH_GRAPH, 'history.php?period=2678400&action=showgraph&itemid=' . $ithosts[$hostname]['itemid'], array('tw' => '_blank'))), $it_ov_menu); break; default: break; } } // if($value == '-') $css_class = 'center'; $value_col = new CCol(array($value, $ack), $css_class); if (isset($it_ov_menu)) { $it_ov_menu = new CPUMenu($it_ov_menu, 170); $value_col->OnClick($it_ov_menu->GetOnActionJS()); $value_col->AddOption('style', 'cursor: pointer;'); $value_col->AddAction('onmouseover', 'this.old_border=this.style.border; this.style.border=\'1px dotted #0C0CF0\''); $value_col->AddAction('onmouseout', 'this.style.border=this.old_border;'); unset($it_ov_menu); } array_push($table_row, $value_col); return $table_row; }
while ($db_service_data = DBfetch($db_services)) { $prefix = null; $trigger = "-"; $description = $db_service_data["name"]; if (isset($db_service_data["triggerid"])) { $trigger = expand_trigger_description($db_service_data["triggerid"]); } $description = new CLink($description, '#', 'action'); $description->SetAction('window.opener.add_child_service(' . zbx_jsvalue($db_service_data["name"]) . ',' . zbx_jsvalue($db_service_data["serviceid"]) . ',' . zbx_jsvalue($trigger) . ',' . zbx_jsvalue($db_service_data["triggerid"]) . '); self.close(); return false;'); $table->AddRow(array(array($prefix, $description), algorithm2str($db_service_data["algorithm"]), $trigger)); } $cb = new CButton('cancel', S_CANCEL); $cb->SetType('button'); $cb->SetAction('javascript: self.close();'); $td = new CCol($cb); $td->AddOption('style', 'text-align:right;'); $table->SetFooter($td); $form->AddItem($table); $form->Show(); } //-------------------------------------------- </CHILD SERVICES LIST> -------------------------------------------- //-------------------------------------------- <FORM> -------------------------------------------- if (isset($_REQUEST['sform'])) { $frmService = new CFormTable(S_SERVICE, 'services_form.php', 'POST', null, 'sform'); $frmService->SetHelp("web.services.service.php"); $frmService->SetTableClass('formlongtable'); //service times if (isset($_REQUEST["add_service_time"]) && isset($_REQUEST["new_service_time"])) { $_REQUEST['service_times'] = get_request('service_times', array()); $new_service_time['type'] = $_REQUEST["new_service_time"]['type']; if ($_REQUEST["new_service_time"]['type'] == SERVICE_TIME_TYPE_ONETIME_DOWNTIME) {
$left_tab->setCellPadding(3); $left_tab->setCellSpacing(3); $left_tab->addOption('border', 0); $left_tab->addRow(create_hat(S_REGULAR_EXPRESSION, get_regexp_form(), null, 'hat_regexp', get_profile('web.config.hats.hat_regexp.state', 1))); $right_tab = new CTable(); $right_tab->setCellPadding(3); $right_tab->setCellSpacing(3); $right_tab->addOption('border', 0); $right_tab->addRow(create_hat(S_EXPRESSIONS, get_expressions_tab(), null, 'hat_expressions', get_profile('web.config.hats.hat_expressions.state', 1))); if (isset($_REQUEST['new_expression'])) { $right_tab->addRow(create_hat(S_NEW_EXPRESSION, get_expression_form(), null, 'hat_new_expression', get_profile('web.config.hats.hat_new_expression.state', 1))); } $td_l = new CCol($left_tab); $td_l->AddOption('valign', 'top'); $td_r = new CCol($right_tab); $td_r->AddOption('valign', 'top'); $outer_table = new CTable(); $outer_table->AddOption('border', 0); $outer_table->SetCellPadding(1); $outer_table->SetCellSpacing(1); $outer_table->AddRow(array($td_l, $td_r)); $frmRegExp->Additem($outer_table); show_messages(); $frmRegExp->Show(); } else { echo SBR; show_table_header(S_REGULAR_EXPRESSIONS); // ---- $regexps = array(); $regexpids = array(); $sql = 'SELECT re.* ' . ' FROM regexps re ' . ' WHERE ' . DBin_node('re.regexpid') . ' ORDER BY re.name';
unset($lst_nodes); if (!defined('ZBX_DISABLE_SUBNODES')) { global $ZBX_WITH_SUBNODES; $cmd_show_subnodes = new CComboBox('show_subnodes', !empty($ZBX_WITH_SUBNODES) ? 1 : 0, 'submit()'); $cmd_show_subnodes->addItem(0, S_CURRENT_NODE_ONLY); $cmd_show_subnodes->addItem(1, S_WITH_SUBNODES); $node_form->addItem(array(SPACE, new CSpan(S_SHOW, 'textcolorstyles'), $cmd_show_subnodes)); } } } $table = new CTable(); $table->setCellSpacing(0); $table->setCellPadding(0); $table->addOption('style', 'width: 100%;'); $r_col = new CCol($node_form); $r_col->AddOption('align', 'right'); // $r_col->AddOption('style','text-align: right;'); $table->addRow(array($menu_table, $r_col)); $page_menu = new CDiv(); $page_menu->addoption('id', 'mmenu'); $page_menu->addItem($table); $menu_selected = false; foreach ($sub_menus as $label => $sub_menu) { $sub_menu_table = new CTable(NULL, 'sub_menu'); $sub_menu_table->setCellSpacing(0); $sub_menu_table->setCellPadding(5); $sub_menu_row = array(); foreach ($sub_menu as $id => $sub_page) { if (empty($sub_page['menu_text'])) { $sub_page['menu_text'] = SPACE; }