$fs_icon = new CDiv(SPACE, 'fullscreen'); $fs_icon->addOption('title', $_REQUEST['fullscreen'] ? S_NORMAL . ' ' . S_VIEW : S_FULLSCREEN); $fs_icon->addAction('onclick', new CScript("javascript: document.location = '" . $url . "';")); //------- $left_tab = new CTable(); $left_tab->setCellPadding(3); $left_tab->setCellSpacing(3); $left_tab->addOption('border', 0); $left_tab->addRow(create_hat(S_EVENT . SPACE . S_SOURCE . SPACE . S_DETAILS, make_trigger_details($_REQUEST['triggerid'], $trigger_data), null, 'hat_triggerdetails')); $left_tab->addRow(create_hat(S_EVENT_DETAILS, make_event_details($_REQUEST['eventid']), null, 'hat_eventdetails')); $right_tab = new CTable(); $right_tab->setCellPadding(3); $right_tab->setCellSpacing(3); $right_tab->addOption('border', 0); $right_tab->addRow(create_hat(S_ACKNOWLEDGES, make_acktab_by_eventid($_REQUEST['eventid']), null, 'hat_eventack', get_profile('web.tr_events.hats.hat_eventack.state', 1))); $right_tab->addRow(create_hat(S_MESSAGE_ACTIONS, get_action_msgs_for_event($_REQUEST['eventid']), null, 'hat_eventactionmsgs', get_profile('web.tr_events.hats.hat_eventactionmsgs.state', 1))); $right_tab->addRow(create_hat(S_COMMAND_ACTIONS, get_action_cmds_for_event($_REQUEST['eventid']), null, 'hat_eventactioncmds', get_profile('web.tr_events.hats.hat_eventactioncmds.state', 1))); $right_tab->addRow(create_hat(S_EVENTS . SPACE . S_LIST . SPACE . '[' . S_LAST . ' 20]', make_small_eventlist($_REQUEST['triggerid'], $trigger_data), null, 'hat_eventlist', get_profile('web.tr_events.hats.hat_eventlist.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)); $p_elements[] = $outer_table; $latest_hat = create_hat($text, $p_elements, array($fs_icon), 'hat_tr_events', get_profile('web.tr_events.hats.hat_tr_events.state', 1)); $latest_hat->show(); include_once 'include/page_footer.php';
function make_favorite_maps() { $table = new CTableInfo(); $fav_sysmaps = get_favorites('web.favorite.sysmapids'); foreach ($fav_sysmaps as $key => $favorite) { $source = $favorite['source']; $sourceid = $favorite['value']; if (!($sysmap = get_sysmap_by_sysmapid($sourceid))) { continue; } if (!sysmap_accessible($sourceid, PERM_READ_ONLY)) { continue; } $link = new CLink(get_node_name_by_elid($sourceid) . $sysmap['name'], 'maps.php?sysmapid=' . $sourceid); $link->setTarget('blank'); $capt = new CSpan($link); $capt->addOption('style', 'line-height: 14px; vertical-align: middle;'); $icon = new CLink(new CImg('images/general/chart.png', 'map', 18, 18, 'borderless'), 'maps.php?sysmapid=' . $sourceid . '&fullscreen=1'); $icon->setTarget('blank'); $table->addRow(new CCol(array($icon, SPACE, $capt))); } $td = new CCol(array(new CLink(S_MAPS . ' »', 'maps.php', 'highlight'))); $td->addOption('style', 'text-align: right;'); $table->setFooter($td); return $table; }
function get_event_actions_stat_hints($eventid) { $actions = new CTable(' - '); $sql = 'SELECT COUNT(a.alertid) as cnt ' . ' FROM alerts a ' . ' WHERE a.eventid=' . $eventid . ' AND a.alerttype in (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')'; $alerts = DBfetch(DBselect($sql)); if (isset($alerts['cnt']) && $alerts['cnt'] > 0) { $sql = 'SELECT COUNT(a.alertid) as sent ' . ' FROM alerts a ' . ' WHERE a.eventid=' . $eventid . ' AND a.alerttype in (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')' . ' AND a.status=' . ALERT_STATUS_SENT; $alerts = DBfetch(DBselect($sql)); $alert_cnt = new CSpan($alerts['sent'], 'green'); if ($alerts['sent']) { $hint = get_actions_hint_by_eventid($eventid, ALERT_STATUS_SENT); $alert_cnt->SetHint($hint); } $tdl = new CCol($alerts['sent'] ? $alert_cnt : SPACE); $tdl->addOption('width', '10'); $sql = 'SELECT COUNT(a.alertid) as inprogress ' . ' FROM alerts a ' . ' WHERE a.eventid=' . $eventid . ' AND a.alerttype in (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')' . ' AND a.status=' . ALERT_STATUS_NOT_SENT; $alerts = DBfetch(DBselect($sql)); $alert_cnt = new CSpan($alerts['inprogress'], 'orange'); if ($alerts['inprogress']) { $hint = get_actions_hint_by_eventid($eventid, ALERT_STATUS_NOT_SENT); $alert_cnt->setHint($hint); } $tdc = new CCol($alerts['inprogress'] ? $alert_cnt : SPACE); $tdc->addOption('width', '10'); $sql = 'SELECT COUNT(a.alertid) as failed ' . ' FROM alerts a ' . ' WHERE a.eventid=' . $eventid . ' AND a.alerttype in (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')' . ' AND a.status=' . ALERT_STATUS_FAILED; $alerts = DBfetch(DBselect($sql)); $alert_cnt = new CSpan($alerts['failed'], 'red'); if ($alerts['failed']) { $hint = get_actions_hint_by_eventid($eventid, ALERT_STATUS_FAILED); $alert_cnt->setHint($hint); } $tdr = new CCol($alerts['failed'] ? $alert_cnt : SPACE); $tdr->addOption('width', '10'); $actions->addRow(array($tdl, $tdc, $tdr)); } return $actions; }
function get_expression_form() { $tblExp = new CTable(); /* init new_timeperiod variable */ $new_expression = get_request('new_expression', array()); if (is_array($new_expression) && isset($new_expression['id'])) { $tblExp->addItem(new Cvar('new_expression[id]', $new_expression['id'])); } if (!is_array($new_expression)) { $new_expression = array(); } if (!isset($new_expression['expression'])) { $new_expression['expression'] = ''; } if (!isset($new_expression['expression_type'])) { $new_expression['expression_type'] = EXPRESSION_TYPE_INCLUDED; } if (!isset($new_expression['case_sensitive'])) { $new_expression['case_sensitive'] = 0; } if (!isset($new_expression['exp_delimiter'])) { $new_expression['exp_delimiter'] = ','; } $tblExp->addRow(array(S_EXPRESSION, new CTextBox('new_expression[expression]', $new_expression['expression'], 60))); $cmbType = new CComboBox('new_expression[expression_type]', $new_expression['expression_type'], 'javascript: submit();'); $cmbType->addItem(EXPRESSION_TYPE_INCLUDED, expression_type2str(EXPRESSION_TYPE_INCLUDED)); $cmbType->addItem(EXPRESSION_TYPE_ANY_INCLUDED, expression_type2str(EXPRESSION_TYPE_ANY_INCLUDED)); $cmbType->addItem(EXPRESSION_TYPE_NOT_INCLUDED, expression_type2str(EXPRESSION_TYPE_NOT_INCLUDED)); $cmbType->addItem(EXPRESSION_TYPE_TRUE, expression_type2str(EXPRESSION_TYPE_TRUE)); $cmbType->addItem(EXPRESSION_TYPE_FALSE, expression_type2str(EXPRESSION_TYPE_FALSE)); $tblExp->addRow(array(S_EXPRESSION_TYPE, $cmbType)); if (EXPRESSION_TYPE_ANY_INCLUDED == $new_expression['expression_type']) { $cmbDelimiter = new CComboBox('new_expression[exp_delimiter]', $new_expression['exp_delimiter']); $cmbDelimiter->addItem(',', ','); $cmbDelimiter->addItem('.', '.'); $cmbDelimiter->addItem('/', '/'); $tblExp->addRow(array(S_DELIMITER, $cmbDelimiter)); } else { $tblExp->addItem(new Cvar('new_expression[exp_delimiter]', $new_expression['exp_delimiter'])); } $chkbCase = new CCheckBox('new_expression[case_sensitive]', $new_expression['case_sensitive'], null, 1); $tblExp->addRow(array(S_IGNORE_CASE, $chkbCase)); $tblExpFooter = new CTableInfo($tblExp); $oper_buttons = array(); $oper_buttons[] = new CButton('add_expression', isset($new_expression['id']) ? S_SAVE : S_ADD); $oper_buttons[] = new CButton('cancel_new_expression', S_CANCEL); $td = new CCol($oper_buttons); $td->addOption('colspan', 2); $td->addOption('style', 'text-align: right;'); $tblExpFooter->setFooter($td); // end of condition list preparation return $tblExpFooter; }
function get_table_header($col1, $col2 = SPACE) { if (isset($_REQUEST['print'])) { hide_form_items($col1); hide_form_items($col2); //if empty header than do not show it if ($col1 == SPACE && $col2 == SPACE) { return new CScript(''); } } $table = new CTable(NULL, 'header'); // $table->addOption('border',0); $table->setCellSpacing(0); $table->setCellPadding(1); $td_r = new CCol($col2, 'header_r'); $td_r->addOption('align', 'right'); $table->addRow(array(new CCol($col1, 'header_l'), $td_r)); return $table; }
function bar_report_form3() { global $USER_DETAILS; $available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY); $config = get_request('config', 1); $title = get_request('title', 'Report 2'); $xlabel = get_request('xlabel', ''); $ylabel = get_request('ylabel', ''); $sorttype = get_request('sorttype', 0); $scaletype = get_request('scaletype', TIMEPERIOD_TYPE_WEEKLY); $avgperiod = get_request('avgperiod', TIMEPERIOD_TYPE_DAILY); $report_timesince = get_request('report_timesince', time() - 86400); $report_timetill = get_request('report_timetill', time()); $captions = get_request('captions', array()); $items = get_request('items', array()); $hostids = get_request('hostids', array()); $showlegend = get_request('showlegend', 0); $palette = get_request('palette', 0); $palettetype = get_request('palettetype', 0); $reportForm = new CFormTable(S_REPORTS, null, 'get'); //,'events.php?report_set=1','POST',null,'sform'); $reportForm->addOption('name', 'zbx_report'); $reportForm->addOption('id', 'zbx_report'); // $reportForm->setMethod('post'); if (isset($_REQUEST['report_show']) && !empty($items)) { $reportForm->addVar('report_show', 'show'); } $reportForm->addVar('config', $config); $reportForm->addVar('report_timesince', $report_timesince > 0 ? $report_timesince : ''); $reportForm->addVar('report_timetill', $report_timetill > 0 ? $report_timetill : ''); // $reportForm->addVar('items',$items); //params are set later!! // $reportForm->addVar('periods',$periods); $reportForm->addRow(S_TITLE, new CTextBox('title', $title, 40)); $reportForm->addRow(S_X . SPACE . S_LABEL, new CTextBox('xlabel', $xlabel, 40)); $reportForm->addRow(S_Y . SPACE . S_LABEL, new CTextBox('ylabel', $ylabel, 40)); $reportForm->addRow(S_LEGEND, new CCheckBox('showlegend', $showlegend, null, 1)); $reportForm->addVar('sortorder', 0); // GROUPS $groupids = get_request('groupids', array()); $group_tb = new CTweenBox($reportForm, 'groupids', null, 10); $sql_from = ''; $sql_where = 'AND ' . DBcondition('g.groupid', $groupids); $sql = 'SELECT DISTINCT g.groupid, g.name ' . ' FROM hosts h, hosts_groups hg, groups g ' . $sql_from . ' WHERE hg.groupid=g.groupid' . ' AND h.hostid=hg.hostid ' . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ') ' . $sql_where . ' ORDER BY g.name'; //SDI($sql); $db_groups = DBselect($sql); while ($group = DBfetch($db_groups)) { $groupids[$group['groupid']] = $group['groupid']; $group_tb->addItem($group['groupid'], $group['name'], true); } $sql = 'SELECT DISTINCT g.* ' . ' FROM hosts h, hosts_groups hg, groups g ' . ' WHERE hg.groupid=g.groupid' . ' AND h.hostid=hg.hostid ' . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' AND ' . DBcondition('g.groupid', $groupids, true) . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ') ' . ' ORDER BY g.name'; $db_groups = DBselect($sql); while ($group = DBfetch($db_groups)) { $group_tb->addItem($group['groupid'], $group['name'], false); } $reportForm->addRow(S_GROUPS, $group_tb->Get(S_SELECTED_GROUPS, S_OTHER . SPACE . S_GROUPS)); // ---------- // HOSTS // validate_group(PERM_READ_ONLY,array('real_hosts'),'web.last.conf.groupid'); $cmbGroups = new CComboBox('groupid', get_request('groupid', 0), 'submit()'); $cmbGroups->addItem(0, S_ALL_S); $sql = 'SELECT DISTINCT g.groupid,g.name ' . ' FROM groups g,hosts_groups hg,hosts h ' . ' WHERE ' . DBcondition('h.hostid', $available_hosts) . ' AND g.groupid=hg.groupid ' . ' AND h.hostid=hg.hostid' . ' AND h.status IN (' . HOST_STATUS_MONITORED . ') ' . ' ORDER BY g.name'; $result = DBselect($sql); while ($row = DBfetch($result)) { $cmbGroups->addItem($row['groupid'], $row['name']); } $td_groups = new CCol(array(S_GROUP, SPACE, $cmbGroups)); $td_groups->addOption('style', 'text-align: right;'); $host_tb = new CTweenBox($reportForm, 'hostids', null, 10); $sql_from = ''; $sql_where = 'AND ' . DBcondition('h.hostid', $hostids); $sql = 'SELECT DISTINCT h.hostid, h.host ' . ' FROM hosts h ' . $sql_from . ' WHERE ' . DBcondition('h.hostid', $available_hosts) . $sql_where . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ') ' . ' ORDER BY h.host'; $db_hosts = DBselect($sql); while ($host = DBfetch($db_hosts)) { $hostids[$host['hostid']] = $host['hostid']; $host_tb->addItem($host['hostid'], $host['host'], true); } $sql_from = ''; $sql_where = ''; if (isset($_REQUEST['groupid']) && $_REQUEST['groupid'] > 0) { $sql_from .= ', hosts_groups hg '; $sql_where .= ' AND hg.groupid=' . $_REQUEST['groupid'] . ' AND h.hostid=hg.hostid '; } $sql = 'SELECT DISTINCT h.* ' . ' FROM hosts h ' . $sql_from . ' WHERE ' . DBcondition('h.hostid', $available_hosts) . ' AND ' . DBcondition('h.hostid', $hostids, true) . ' AND h.status IN (' . HOST_STATUS_MONITORED . ') ' . $sql_where . ' ORDER BY h.host'; $db_hosts = DBselect($sql); while ($host = DBfetch($db_hosts)) { $host_tb->addItem($host['hostid'], $host['host'], false); } $reportForm->addRow(S_HOSTS, $host_tb->Get(S_SELECTED_HOSTS, array(S_OTHER . SPACE . S_HOSTS . SPACE . '|' . SPACE . S_GROUP . SPACE, $cmbGroups))); // ---------- //*/ // PERIOD $clndr_icon = new CImg('images/general/bar/cal.gif', 'calendar', 16, 12, 'pointer'); $clndr_icon->addAction('onclick', 'javascript: ' . 'var pos = getPosition(this); ' . 'pos.top+=10; ' . 'pos.left+=16; ' . "CLNDR['avail_report_since'].clndr.clndrshow(pos.top,pos.left);"); $reporttimetab = new CTable(null, 'calendar'); $reporttimetab->addOption('width', '10%'); $reporttimetab->setCellPadding(0); $reporttimetab->setCellSpacing(0); $reporttimetab->addRow(array(S_FROM, new CNumericBox('report_since_day', $report_timesince > 0 ? date('d', $report_timesince) : '', 2), '/', new CNumericBox('report_since_month', $report_timesince > 0 ? date('m', $report_timesince) : '', 2), '/', new CNumericBox('report_since_year', $report_timesince > 0 ? date('Y', $report_timesince) : '', 4), SPACE, new CNumericBox('report_since_hour', $report_timesince > 0 ? date('H', $report_timesince) : '', 2), ':', new CNumericBox('report_since_minute', $report_timesince > 0 ? date('i', $report_timesince) : '', 2), $clndr_icon)); zbx_add_post_js('create_calendar(null,' . '["report_since_day","report_since_month","report_since_year","report_since_hour","report_since_minute"],' . '"avail_report_since",' . '"report_timesince");'); $clndr_icon->addAction('onclick', 'javascript: ' . 'var pos = getPosition(this); ' . 'pos.top+=10; ' . 'pos.left+=16; ' . "CLNDR['avail_report_till'].clndr.clndrshow(pos.top,pos.left);"); $reporttimetab->addRow(array(S_TILL, new CNumericBox('report_till_day', $report_timetill > 0 ? date('d', $report_timetill) : '', 2), '/', new CNumericBox('report_till_month', $report_timetill > 0 ? date('m', $report_timetill) : '', 2), '/', new CNumericBox('report_till_year', $report_timetill > 0 ? date('Y', $report_timetill) : '', 4), SPACE, new CNumericBox('report_till_hour', $report_timetill > 0 ? date('H', $report_timetill) : '', 2), ':', new CNumericBox('report_till_minute', $report_timetill > 0 ? date('i', $report_timetill) : '', 2), $clndr_icon)); zbx_add_post_js('create_calendar(null,' . '["report_till_day","report_till_month","report_till_year","report_till_hour","report_till_minute"],' . '"avail_report_till",' . '"report_timetill");'); zbx_add_post_js('addListener($("filter_icon"),' . '"click",' . 'CLNDR[\'avail_report_since\'].clndr.clndrhide.bindAsEventListener(CLNDR[\'avail_report_since\'].clndr));' . 'addListener($("filter_icon"),' . '"click",' . 'CLNDR[\'avail_report_till\'].clndr.clndrhide.bindAsEventListener(CLNDR[\'avail_report_till\'].clndr));'); $reportForm->addRow(S_PERIOD, $reporttimetab); //----------- $scale = new CComboBox('scaletype', $scaletype); $scale->addItem(TIMEPERIOD_TYPE_HOURLY, S_HOURLY); $scale->addItem(TIMEPERIOD_TYPE_DAILY, S_DAILY); $scale->addItem(TIMEPERIOD_TYPE_WEEKLY, S_WEEKLY); $scale->addItem(TIMEPERIOD_TYPE_MONTHLY, S_MONTHLY); $scale->addItem(TIMEPERIOD_TYPE_YEARLY, S_YEARLY); $reportForm->addRow(S_SCALE, $scale); $avgcmb = new CComboBox('avgperiod', $avgperiod); $avgcmb->addItem(TIMEPERIOD_TYPE_HOURLY, S_HOURLY); $avgcmb->addItem(TIMEPERIOD_TYPE_DAILY, S_DAILY); $avgcmb->addItem(TIMEPERIOD_TYPE_WEEKLY, S_WEEKLY); $avgcmb->addItem(TIMEPERIOD_TYPE_MONTHLY, S_MONTHLY); $avgcmb->addItem(TIMEPERIOD_TYPE_YEARLY, S_YEARLY); $reportForm->addRow(S_AVERAGE_BY, $avgcmb); // ITEMS $itemid = 0; $description = ''; if (count($items) && $items[0]['itemid'] > 0) { $itemid = $items[0]['itemid']; $description = get_item_by_itemid($itemid); $description = item_description($description); } $reportForm->addVar('items[0][itemid]', $itemid); $txtCondVal = new CTextBox('items[0][description]', $description, 50, 'yes'); $btnSelect = new CButton('btn1', S_SELECT, "return PopUp('popup.php?dstfrm=" . $reportForm->GetName() . "&dstfld1=items[0][itemid]&dstfld2=items[0][description]&" . "srctbl=items&srcfld1=itemid&srcfld2=description&monitored_hosts=1');", 'T'); $reportForm->addRow(S_ITEM, array($txtCondVal, $btnSelect)); $paletteCmb = new CComboBox('palette', $palette); $paletteCmb->addItem(0, S_PALETTE . ' #1'); $paletteCmb->addItem(1, S_PALETTE . ' #2'); $paletteCmb->addItem(2, S_PALETTE . ' #3'); $paletteCmb->addItem(3, S_PALETTE . ' #4'); $paletteTypeCmb = new CComboBox('palettetype', $palettetype); $paletteTypeCmb->addItem(0, S_MIDDLE); $paletteTypeCmb->addItem(1, S_DARKEN); $paletteTypeCmb->addItem(2, S_BRIGHTEN); $reportForm->addRow(S_PALETTE, array($paletteCmb, $paletteTypeCmb)); //-------------- $reportForm->addItemToBottomRow(new CButton('report_show', S_SHOW)); $reset = new CButton('reset', S_RESET); $reset->setType('reset'); $reportForm->addItemToBottomRow($reset); return $reportForm; }
function show_messages($bool = TRUE, $okmsg = NULL, $errmsg = NULL) { global $page, $ZBX_MESSAGES; if (!defined('PAGE_HEADER_LOADED')) { return; } if (!isset($page["type"])) { $page["type"] = PAGE_TYPE_HTML; } $message = array(); $width = 0; $height = 0; $img_space = null; if (!$bool && !is_null($errmsg)) { $msg = 'ERROR: ' . $errmsg; } else { if ($bool && !is_null($okmsg)) { $msg = $okmsg; } } if (isset($msg)) { switch ($page['type']) { case PAGE_TYPE_IMAGE: array_push($message, array('text' => $msg, 'color' => !$bool ? array('R' => 255, 'G' => 0, 'B' => 0) : array('R' => 34, 'G' => 51, 'B' => 68), 'font' => 2)); $width = max($width, ImageFontWidth(2) * strlen($msg) + 1); $height += imagefontheight(2) + 1; break; case PAGE_TYPE_XML: echo htmlspecialchars($msg) . "\n"; break; case PAGE_TYPE_HTML: default: $msg_tab = new CTable($msg, $bool ? 'msgok' : 'msgerr'); $msg_tab->setCellPadding(0); $msg_tab->setCellSpacing(0); $msg_col = new CCol(bold($msg), 'msg_main msg'); $msg_col->addOption('id', 'page_msg'); $msg_details = SPACE; if (isset($ZBX_MESSAGES) && !empty($ZBX_MESSAGES)) { $msg_details = new CDiv(array(S_DETAILS), 'pointer'); $msg_details->addAction('onclick', new CScript("javascript: ShowHide('msg_messages', IE?'block':'table');")); $msg_details->addOption('title', S_MAXIMIZE . '/' . S_MINIMIZE); } $msg_tab->addRow(array(new CCol($msg_details, 'clr'), $msg_col)); $msg_tab->Show(); $img_space = new CImg('images/general/tree/zero.gif', 'space', '100', '2'); break; } } if (isset($ZBX_MESSAGES)) { if ($page['type'] == PAGE_TYPE_IMAGE) { $msg_font = 2; foreach ($ZBX_MESSAGES as $msg) { if ($msg['type'] == 'error') { array_push($message, array('text' => $msg['message'], 'color' => array('R' => 255, 'G' => 55, 'B' => 55), 'font' => $msg_font)); } else { array_push($message, array('text' => $msg['message'], 'color' => array('R' => 155, 'G' => 155, 'B' => 55), 'font' => $msg_font)); } $width = max($width, imagefontwidth($msg_font) * strlen($msg['message']) + 1); $height += imagefontheight($msg_font) + 1; } } else { if ($page['type'] == PAGE_TYPE_XML) { foreach ($ZBX_MESSAGES as $msg) { echo '[' . $msg['type'] . '] ' . $msg['message'] . "\n"; } } else { $lst_error = new CList(null, 'messages'); foreach ($ZBX_MESSAGES as $msg) { $lst_error->addItem($msg['message'], $msg['type']); $bool = $bool && 'error' != strtolower($msg['type']); } //message scroll if needed $msg_show = 6; $msg_count = count($ZBX_MESSAGES); if ($msg_count > $msg_show) { $msg_count = $msg_show; $msg_count = $msg_count * 16; $lst_error->addOption('style', 'height: ' . $msg_count . 'px;'); } $tab = new CTable(null, $bool ? 'msgok' : 'msgerr'); $tab->setCellPadding(0); $tab->setCellSpacing(0); $tab->addOption('id', 'msg_messages'); $tab->addOption('style', 'width: 100%;'); if (isset($msg_tab) && $bool) { $tab->addOption('style', 'display: none;'); } $tab->addRow(new CCol($lst_error, 'msg')); $tab->Show(); //--- } } $ZBX_MESSAGES = null; } if (!is_null($img_space)) { print unpack_object($img_space); } if ($page['type'] == PAGE_TYPE_IMAGE && count($message) > 0) { $width += 2; $height += 2; $canvas = imagecreate($width, $height); imagefilledrectangle($canvas, 0, 0, $width, $height, imagecolorallocate($canvas, 255, 255, 255)); foreach ($message as $id => $msg) { $message[$id]['y'] = 1 + (isset($previd) ? $message[$previd]['y'] + $message[$previd]['h'] : 0); $message[$id]['h'] = imagefontheight($msg['font']); imagestring($canvas, $msg['font'], 1, $message[$id]['y'], $msg['text'], imagecolorallocate($canvas, $msg['color']['R'], $msg['color']['G'], $msg['color']['B'])); $previd = $id; } imageOut($canvas); imagedestroy($canvas); } }
private function makeSImgStr($id) { $tr = new CRow(); $td = new CCol(); $count = isset($this->tree[$id]['nodeimg']) ? strlen($this->tree[$id]['nodeimg']) : 0; for ($i = 0; $i < $count; $i++) { switch ($this->tree[$id]['nodeimg'][$i]) { case 'O': $td->addOption('style', 'width: 22px'); $img = new CImg('images/general/tree/zero.gif', 'o', '22', '14'); break; case 'I': $td->addOption('style', 'width:22px; background-image:url(images/general/tree/pointc.gif);'); $img = new CImg('images/general/tree/zero.gif', 'i', '22', '14'); break; case 'L': $td->addOption('valign', 'top'); // $td->addOption('style','width:22px; background-image:url(images/general/tree/pointc.gif);'); $div = new CTag('div', 'yes'); $div->addOption('style', 'height: 10px; width:22px; background-image:url(images/general/tree/pointc.gif);'); if ($this->tree[$id]['nodetype'] == 2) { $img = new CImg('images/general/tree/plus.gif', 'y', '22', '14'); $img->addOption('onclick', 'javascript: tree.closeSNodeX(' . $id . ',this);'); $img->addOption('id', 'idi_' . $id); $img->setClass('imgnode'); } else { $img = new CImg('images/general/tree/pointl.gif', 'y', '22', '14'); } $div->addItem($img); $img = $div; break; case 'T': $td->addOption('valign', 'top'); if ($this->tree[$id]['nodetype'] == 2) { $td->addOption('style', 'width:22px; background-image:url(images/general/tree/pointc.gif);'); $img = new CImg('images/general/tree/plus.gif', 't', '22', '14'); $img->addOption('onclick', 'javascript: tree.closeSNodeX(' . $id . ',this);'); $img->addOption('id', 'idi_' . $id); $img->setClass('imgnode'); } else { $td->addOption('style', 'width:22px; background-image:url(images/general/tree/pointc.gif);'); $img = new CImg('images/general/tree/pointl.gif', 't', '22', '14'); } break; } $td->addItem($img); $tr->addItem($td); $td = new CCol(); } // echo $txt.' '.$this->tree[$id]['Name'].'<br />'; return $tr; }
COpt::compare_files_with_menu($ZBX_MENU); $help = new CLink(S_HELP, 'http://www.zabbix.com/documentation.php', 'small_font', null, true); $help->setTarget('_blank'); $support = new CLink(S_GET_SUPPORT, 'http://www.zabbix.com/support.php', 'small_font', null, true); $support->setTarget('_blank'); $printview = new CLink(S_PRINT, $_SERVER['REQUEST_URI'] . (empty($_GET) ? '?' : '&') . 'print=1', 'small_font'); $page_header_r_col = array($help, '|', $support, '|', $printview); if ($USER_DETAILS['alias'] != ZBX_GUEST_USER) { $page_header_r_col[] = array('|', new CLink(S_PROFILE, 'profile.php', 'small_font'), '|', new CLink(S_LOGOUT, 'index.php?reconnect=1', 'small_font')); } else { $page_header_r_col[] = array('|', new CLink(S_LOGIN, 'index.php?reconnect=1', 'small_font')); } $logo = new CLink(new CDiv(SPACE, 'zabbix_logo'), 'http://www.zabbix.com/'); $logo->setTarget('_blank'); $td_r = new CCol($page_header_r_col, 'page_header_r'); $td_r->addOption('width', '100%'); $top_page_row = array(new CCol($logo, 'page_header_l'), $td_r); unset($logo, $page_header_r_col, $help, $support); $table = new CTable(NULL, 'page_header'); $table->setCellSpacing(0); $table->setCellPadding(5); $table->addRow($top_page_row); $table->show(); $menu_table = new CTable(NULL, 'menu'); $menu_table->setCellSpacing(0); $menu_table->setCellPadding(5); $menu_table->addRow($main_menu); $node_form = null; if (ZBX_DISTRIBUTED) { $lst_nodes = new CComboBox('switch_node', get_current_nodeid(false), 'submit()'); $available_nodes = get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_LIST);
$help = new CHelp('web.view.php', 'right'); $help_table = new CTableInfo(); $help_table->addOption('style', 'width: 200px'); if ($_REQUEST['type'] == SHOW_TRIGGERS) { $help_table->addRow(array(new CCol(SPACE, 'normal'), S_DISABLED)); } foreach (array(1, 2, 3, 4, 5) as $tr_severity) { $help_table->addRow(array(new CCol(get_severity_description($tr_severity), get_severity_style($tr_severity)), S_ENABLED)); } $help_table->addRow(array(new CCol(SPACE, 'unknown_trigger'), S_UNKNOWN)); if ($_REQUEST['type'] == SHOW_TRIGGERS) { $col = new CCol(SPACE, 'unknown_trigger'); $col->addOption('style', 'background-image: url(images/gradients/blink1.gif); ' . 'background-position: top left; background-repeat: repeate;'); $help_table->addRow(array($col, S_5_MIN)); $col = new CCol(SPACE, 'unknown_trigger'); $col->addOption('style', 'background-image: url(images/gradients/blink2.gif); ' . 'background-position: top left; background-repeat: repeate;'); $help_table->addRow(array($col, S_15_MIN)); $help_table->addRow(array(new CCol(SPACE), S_NO_TRIGGER)); } else { $help_table->addRow(array(new CCol(SPACE), S_DISABLED . ' ' . S_OR . ' ' . S_NO_TRIGGER)); } $help->SetHint($help_table); // Header $text = array(S_OVERVIEW_BIG); $url = 'overview.php?fullscreen=' . ($_REQUEST['fullscreen'] ? '0' : '1'); $fs_icon = new CDiv(SPACE, 'fullscreen'); $fs_icon->addOption('title', $_REQUEST['fullscreen'] ? S_NORMAL . ' ' . S_VIEW : S_FULLSCREEN); $fs_icon->addAction('onclick', new CScript("javascript: document.location = '" . $url . "';")); $form_l = new CForm(); $form_l->setMethod('get'); $form_l->addVar('groupid', $_REQUEST['groupid']);
function show_history($itemid, $from, $stime, $period) { //$till=date(S_DATE_FORMAT_YMDHMS,time(NULL)-$from*3600); //show_table_header(S_TILL.SPACE.$till.' ( '.zbx_date2age($stime,$stime+$period).' )'); $td = new CCol(get_js_sizeable_graph('graph', 'chart.php?itemid=' . $itemid . url_param($from, false, 'from') . url_param($stime, false, 'stime') . url_param($period, false, 'period'))); $td->addOption('align', 'center'); $tr = new CRow($td); $tr->addOption('bgcolor', '#dddddd'); $table = new CTable(); $table->addOption('width', '100%'); $table->addOption('bgcolor', '#cccccc'); $table->addOption('cellspacing', '1'); $table->addOption('cellpadding', '3'); $table->addRow($tr); $table->show(); }
$value = new CSpan(trigger_value2str($row_event['value']), get_trigger_value_style($row_event['value'])); if ($config['event_ack_enable']) { if ($row_event['acknowledged'] == 1) { $acks_cnt = DBfetch(DBselect('SELECT COUNT(*) as cnt FROM acknowledges WHERE eventid=' . $row_event['eventid'])); $ack = array(new CSpan(S_YES, 'off'), SPACE . '(' . $acks_cnt['cnt'] . SPACE, new CLink(S_SHOW, 'acknow.php?eventid=' . $row_event['eventid'], 'action'), ')'); } else { $ack = new CLink(S_NOT_ACKNOWLEDGED, 'acknow.php?eventid=' . $row_event['eventid'], 'on'); } } $description = expand_trigger_description_by_data(array_merge($row, array('clock' => $row_event['clock'])), ZBX_FLAG_EVENT); $font = new CTag('font', 'yes'); $font->addOption('color', '#808080'); $font->addItem(array(' - ', $description)); $description = $font; $description = new CCol($description); $description->addOption('style', 'white-space: normal; width: 90%;'); $table->addRow(array($config['event_ack_enable'] ? $row_event['acknowledged'] == 1 ? SPACE : new CCheckBox('events[' . $row_event['eventid'] . ']', 'no', NULL, $row_event['eventid']) : NULL, new CCol(get_severity_description($row['priority']), get_severity_style($row['priority'], $row_event['value'])), $value, new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS, $row_event['clock']), 'tr_events.php?triggerid=' . $row['triggerid'] . '&eventid=' . $row_event['eventid'], 'action'), get_node_name_by_elid($row['triggerid']), $host, $description, $actions, $config['event_ack_enable'] ? new CCol($ack, 'center') : NULL, new CLink($row['comments'] == '' ? S_ADD : S_SHOW, 'tr_comments.php?triggerid=' . $row['triggerid'], 'action'))); $event_limit++; if ($event_limit >= $config['event_show_max']) { break; } } unset($row, $description, $actions); } $table->setFooter(new CCol(array($config['event_ack_enable'] ? new CButton('bulkacknowledge', S_BULK_ACKNOWLEDGE, 'javascript: submit();') : SPACE))); $m_form->addItem($table); unset($table); $p_elements[] = $m_form; $triggers_hat = create_hat($text, $p_elements, array($mute_icon, $fs_icon), 'hat_triggers', get_profile('web.tr_status.hats.hat_triggers.state', 1)); $triggers_hat->Show(); zbx_add_post_js('insert_in_element("tr_numrows","' . $triggers_num . '");');