function get_report2_filter($config, &$PAGE_GROUPS, &$PAGE_HOSTS) { global $USER_DETAILS; $available_groups = $PAGE_GROUPS['groupids']; $available_hosts = $PAGE_HOSTS['hostids']; /************************* FILTER *************************/ /***********************************************************/ $filterForm = new CFormTable(); //,'events.php?filter_set=1','POST',null,'sform'); $filterForm->setAttribute('name', 'zbx_filter'); $filterForm->setAttribute('id', 'zbx_filter'); $filterForm->addVar('config', $config); $filterForm->addVar('filter_timesince', date('YmdHis', $_REQUEST['filter_timesince'])); $filterForm->addVar('filter_timetill', date('YmdHis', $_REQUEST['filter_timetill'])); $cmbGroups = new CComboBox('filter_groupid', $PAGE_GROUPS['selected'], 'javascript: submit();'); $cmbHosts = new CComboBox('filter_hostid', $PAGE_HOSTS['selected'], 'javascript: submit();'); foreach ($PAGE_GROUPS['groups'] as $groupid => $name) { $cmbGroups->addItem($groupid, get_node_name_by_elid($groupid, null, ': ') . $name); } foreach ($PAGE_HOSTS['hosts'] as $hostid => $name) { $cmbHosts->addItem($hostid, get_node_name_by_elid($hostid, null, ': ') . $name); } $filterForm->addRow(S_GROUP, $cmbGroups); $filterForm->addRow(S_HOST, $cmbHosts); if (1 == $config) { $cmbTrigs = new CComboBox('tpl_triggerid', get_request('tpl_triggerid', 0), 'submit()'); $cmbHGrps = new CComboBox('hostgroupid', get_request('hostgroupid', 0), 'submit()'); $cmbTrigs->addItem(0, S_ALL_SMALL); $cmbHGrps->addItem(0, S_ALL_SMALL); $sql_cond = ' AND h.hostid=ht.hostid '; if ($_REQUEST['hostid'] > 0) { $sql_cond .= ' AND ht.templateid=' . $_REQUEST['hostid']; } if (isset($_REQUEST['tpl_triggerid']) && $_REQUEST['tpl_triggerid'] > 0) { $sql_cond .= ' AND t.templateid=' . $_REQUEST['tpl_triggerid']; } $result = DBselect('SELECT DISTINCT g.groupid,g.name ' . ' FROM triggers t,hosts h,items i,functions f, hosts_templates ht, groups g, hosts_groups hg ' . ' WHERE f.itemid=i.itemid ' . ' AND h.hostid=i.hostid ' . ' AND hg.hostid=h.hostid' . ' AND g.groupid=hg.groupid ' . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND t.triggerid=f.triggerid ' . ' AND ' . DBin_node('t.triggerid') . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND h.status=' . HOST_STATUS_MONITORED . $sql_cond . ' ORDER BY g.name'); while ($row = DBfetch($result)) { $cmbHGrps->addItem($row['groupid'], get_node_name_by_elid($row['groupid'], null, ': ') . $row['name']); } $sql_cond = $_REQUEST['hostid'] > 0 ? ' AND h.hostid=' . $_REQUEST['hostid'] : ' AND ' . DBcondition('h.hostid', $available_hosts); $sql = 'SELECT DISTINCT t.triggerid,t.description ' . ' FROM triggers t,hosts h,items i,functions f ' . ' WHERE f.itemid=i.itemid ' . ' AND h.hostid=i.hostid ' . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND t.triggerid=f.triggerid ' . ' AND h.status=' . HOST_STATUS_TEMPLATE . ' AND ' . DBin_node('t.triggerid') . ' AND i.status=' . ITEM_STATUS_ACTIVE . $sql_cond . ' ORDER BY t.description'; $result = DBselect($sql); while ($row = DBfetch($result)) { $cmbTrigs->addItem($row['triggerid'], get_node_name_by_elid($row['triggerid'], null, ': ') . expand_trigger_description($row['triggerid'])); } $filterForm->addRow(S_TRIGGER, $cmbTrigs); $filterForm->addRow(S_FILTER . SPACE . S_HOST_GROUP, $cmbHGrps); } //* $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);"); $filtertimetab = new CTable(null, 'calendar'); $filtertimetab->setAttribute('width', '10%'); $filtertimetab->setCellPadding(0); $filtertimetab->setCellSpacing(0); $filtertimetab->addRow(array(S_FROM, new CNumericBox('filter_since_day', $_REQUEST['filter_timesince'] > 0 ? date('d', $_REQUEST['filter_timesince']) : '', 2), '/', new CNumericBox('filter_since_month', $_REQUEST['filter_timesince'] > 0 ? date('m', $_REQUEST['filter_timesince']) : '', 2), '/', new CNumericBox('filter_since_year', $_REQUEST['filter_timesince'] > 0 ? date('Y', $_REQUEST['filter_timesince']) : '', 4), SPACE, new CNumericBox('filter_since_hour', $_REQUEST['filter_timesince'] > 0 ? date('H', $_REQUEST['filter_timesince']) : '', 2), ':', new CNumericBox('filter_since_minute', $_REQUEST['filter_timesince'] > 0 ? date('i', $_REQUEST['filter_timesince']) : '', 2), $clndr_icon)); zbx_add_post_js('create_calendar(null,' . '["filter_since_day","filter_since_month","filter_since_year","filter_since_hour","filter_since_minute"],' . '"avail_report_since",' . '"filter_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);"); $filtertimetab->AddRow(array(S_TILL, new CNumericBox('filter_till_day', $_REQUEST['filter_timetill'] > 0 ? date('d', $_REQUEST['filter_timetill']) : '', 2), '/', new CNumericBox('filter_till_month', $_REQUEST['filter_timetill'] > 0 ? date('m', $_REQUEST['filter_timetill']) : '', 2), '/', new CNumericBox('filter_till_year', $_REQUEST['filter_timetill'] > 0 ? date('Y', $_REQUEST['filter_timetill']) : '', 4), SPACE, new CNumericBox('filter_till_hour', $_REQUEST['filter_timetill'] > 0 ? date('H', $_REQUEST['filter_timetill']) : '', 2), ':', new CNumericBox('filter_till_minute', $_REQUEST['filter_timetill'] > 0 ? date('i', $_REQUEST['filter_timetill']) : '', 2), $clndr_icon)); zbx_add_post_js('create_calendar(null,' . '["filter_till_day","filter_till_month","filter_till_year","filter_till_hour","filter_till_minute"],' . '"avail_report_till",' . '"filter_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));'); $filterForm->addRow(S_PERIOD, $filtertimetab); //*/ $filterForm->addItemToBottomRow(new CButton('filter_set', S_FILTER)); $reset = new CButton("filter_rst", S_RESET); $reset->setType('button'); $reset->setAction('javascript: var url = new Curl(location.href); url.setArgument("filter_rst",1); location.href = url.getUrl();'); $filterForm->addItemToBottomRow($reset); return $filterForm; }
if (isset($_REQUEST['serviceid']) && $_REQUEST['serviceid'] > 0 && !DBfetch(DBselect('select serviceid from services where serviceid=' . $_REQUEST['serviceid']))) { unset($_REQUEST['serviceid']); } $available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY); $available_triggers = get_accessible_triggers(PERM_READ_ONLY, array(), PERM_RES_IDS_ARRAY); if (isset($_REQUEST["serviceid"]) && $_REQUEST["serviceid"] > 0) { $sql = 'SELECT s.serviceid ' . ' FROM services s ' . ' WHERE (s.triggerid is NULL OR ' . DBcondition('s.triggerid', $available_triggers) . ') ' . ' AND s.serviceid=' . $_REQUEST['serviceid']; if (!($service = DBfetch(DBselect($sql, 1)))) { access_deny(); } } unset($_REQUEST['serviceid']); // show_table_header(S_IT_SERVICES_BIG); if (isset($service) && isset($_REQUEST['showgraph'])) { $table = new CTable(null, 'chart'); $table->AddRow(new CImg('chart5.php?serviceid=' . $service['serviceid'] . url_param('path'))); $table->Show(); } else { $query = 'SELECT DISTINCT s.serviceid, sl.servicedownid, sl_p.serviceupid as serviceupid, s.triggerid, ' . ' s.name as caption, s.algorithm, t.description, t.expression, s.sortorder, sl.linkid, s.showsla, s.goodsla, s.status ' . ' FROM services s ' . ' LEFT JOIN triggers t ON s.triggerid = t.triggerid ' . ' LEFT JOIN services_links sl ON s.serviceid = sl.serviceupid and NOT(sl.soft=0) ' . ' LEFT JOIN services_links sl_p ON s.serviceid = sl_p.servicedownid and sl_p.soft=0 ' . ' WHERE ' . DBin_node('s.serviceid') . ' AND (t.triggerid IS NULL OR ' . DBcondition('t.triggerid', $available_triggers) . ') ' . ' ORDER BY s.sortorder, sl_p.serviceupid, s.serviceid'; $result = DBSelect($query); $services = array(); $row = array('id' => 0, 'serviceid' => 0, 'serviceupid' => 0, 'caption' => S_ROOT_SMALL, 'status' => SPACE, 'reason' => SPACE, 'sla' => SPACE, 'sla2' => SPACE, 'graph' => SPACE, 'linkid' => ''); $services[0] = $row; $now = time(); while ($row = DBFetch($result)) { $row['id'] = $row['serviceid']; empty($row['serviceupid']) ? $row['serviceupid'] = '0' : ''; empty($row['description']) ? $row['description'] = 'None' : ''; $row['graph'] = new CLink(S_SHOW, "srv_status.php?serviceid=" . $row["serviceid"] . "&showgraph=1" . url_param('path'), "action"); if (isset($row["triggerid"]) && !empty($row["triggerid"])) { $url = new CLink(expand_trigger_description($row['triggerid']), 'events.php?triggerid=' . $row['triggerid']);
} redirect($last_page['url']); exit; } } } $msg = $bulk ? ' BULK ACKNOWLEDGE ' : array('"' . expand_trigger_description_by_data($db_data) . '"', BR(), explode_exp($db_data["expression"], 1)); show_table_header(array(S_ALARM_ACKNOWLEDGES_BIG, ' : ', $msg)); echo SBR; if (!$bulk) { $table = new CTable(NULL, "ack_msgs"); $table->SetAlign("center"); $db_acks = get_acknowledges_by_eventid($db_data["eventid"]); while ($db_ack = DBfetch($db_acks)) { $db_user = get_user_by_userid($db_ack["userid"]); $table->AddRow(array(new CCol($db_user["alias"], "user"), new CCol(date("d-m-Y h:i:s A", $db_ack["clock"]), "time")), "title"); $msgCol = new CCol(zbx_nl2br($db_ack['message'])); $msgCol->SetColspan(2); $table->AddRow($msgCol, "msg"); } /**/ if ($table->GetNumRows() > 0) { $table->Show(); echo SBR; } } insert_new_message_form($events, $bulk); ?> <?php include_once "include/page_footer.php";
$fields = array("from" => array(T_ZBX_INT, O_OPT, null, '{}>=0', null), "period" => array(T_ZBX_INT, O_OPT, null, null, null), "stime" => array(T_ZBX_STR, O_OPT, null, null, null), "reset" => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), "httptestid" => array(T_ZBX_INT, O_MAND, null, DB_ID, null), "groupid" => array(T_ZBX_INT, O_OPT, null, DB_ID, null), "hostid" => array(T_ZBX_INT, O_OPT, null, DB_ID, null), 'fullscreen' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), NULL), 'favobj' => array(T_ZBX_STR, O_OPT, P_ACT, NULL, 'isset({favid})'), 'favid' => array(T_ZBX_STR, O_OPT, P_ACT, NOT_EMPTY, NULL), 'state' => array(T_ZBX_INT, O_OPT, P_ACT, NOT_EMPTY, 'isset({favobj})')); check_fields($fields); $available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY); $sql = 'select ht.* ' . ' from httptest ht, applications a ' . ' where ' . DBcondition('a.hostid', $available_hosts) . ' and a.applicationid=ht.applicationid ' . ' and ht.httptestid=' . $_REQUEST['httptestid']; if (!($httptest_data = DBfetch(DBselect($sql)))) { access_deny(); } navigation_bar_calc(); // Header $text = array(S_DETAILS_OF_SCENARIO_BIG . ' / ', bold($httptest_data['name']), ' [' . date(S_DATE_FORMAT_YMDHMS, $httptest_data['lastcheck']) . ']'); $url = '?httptestid=' . $_REQUEST['httptestid'] . '&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 . "';")); $icon_tab = new CTable(); $icon_tab->AddRow(array($fs_icon, SPACE, $text)); $text = $icon_tab; show_table_header($text, new CLink(S_CANCEL, 'httpmon.php' . url_param('groupid') . url_param('hostid'))); //------------- // TABLE $table = new CTableInfo(); $table->SetHeader(array(S_STEP, S_SPEED, S_RESPONSE_TIME, S_RESPONSE_CODE, S_STATUS)); $items = array(); $total_data = array(HTTPSTEP_ITEM_TYPE_IN => null, HTTPSTEP_ITEM_TYPE_TIME => null); $color = array('current' => 0, 0 => array('next' => '1'), 1 => array('color' => 'Red', 'next' => '2'), 2 => array('color' => 'Dark Green', 'next' => '3'), 3 => array('color' => 'Blue', 'next' => '4'), 4 => array('color' => 'Dark Yellow', 'next' => '5'), 5 => array('color' => 'Cyan', 'next' => '6'), 6 => array('color' => 'Gray', 'next' => '7'), 7 => array('color' => 'Dark Red', 'next' => '8'), 8 => array('color' => 'Green', 'next' => '9'), 9 => array('color' => 'Dark Blue', 'next' => '10'), 10 => array('color' => 'Yellow', 'next' => '11'), 11 => array('color' => 'Black', 'next' => '1')); $db_httpsteps = DBselect('select * from httpstep where httptestid=' . $httptest_data['httptestid'] . ' order by no'); while ($httpstep_data = DBfetch($db_httpsteps)) { $status['msg'] = S_OK_BIG; $status['style'] = 'enabled'; if (HTTPTEST_STATE_BUSY == $httptest_data['curstate']) { if ($httptest_data['curstep'] == $httpstep_data['no']) {
if (isset($ZBX_PAGE_POST_JS)) { foreach ($ZBX_PAGE_POST_JS as $script) { echo $script . "\n"; } } ?> } try{ chkbx_range_ext.init(); } catch(e){ throw('Checkbox extension failed!'); } --> </script> <?php //SDI(SBR.'SELECTS: '.$DB['SELECT_COUNT'].SPACE.SPACE.'EXECUTE: '.$DB['EXECUTE_COUNT'].SPACE.SPACE.'TOTAL: '.($DB['EXECUTE_COUNT']+$DB['SELECT_COUNT'])); if (!defined('ZBX_PAGE_NO_MENU') && !defined('ZBX_PAGE_NO_FOOTER')) { $table = new CTable(NULL, "page_footer"); $table->SetCellSpacing(0); $table->SetCellPadding(1); $table->AddRow(array(new CCol(new CLink(S_ZABBIX_VER . SPACE . S_COPYRIGHT_BY . SPACE . S_SIA_ZABBIX, "http://www.zabbix.com", "highlight", null, true), "page_footer_l"), new CCol(array(new CSpan(SPACE . SPACE . "|" . SPACE . SPACE, "divider"), new CSpan($USER_DETAILS['userid'] == 0 ? S_NOT_CONNECTED : S_CONNECTED_AS . SPACE . "'" . $USER_DETAILS["alias"] . "'" . (ZBX_DISTRIBUTED ? SPACE . S_FROM_SMALL . SPACE . "'" . $USER_DETAILS["node"]['name'] . "'" : ''), 'footer_sign')), "page_footer_r"))); $table->Show(); } COpt::profiling_stop("page"); COpt::profiling_stop("script"); echo "</body>\n"; echo "</html>\n"; } exit;
//------------------------------------- <HISTORY> --------------------------------------- if (isset($page['hist_arg']) && $USER_DETAILS['alias'] != ZBX_GUEST_USER && $page['type'] == PAGE_TYPE_HTML && !defined('ZBX_PAGE_NO_MENU')) { add_user_history($page); } //------------------------------------- </HISTORY> -------------------------------------- show_messages(); $post_script = ''; if ($page['type'] == PAGE_TYPE_HTML) { $post_script .= 'function zbxCallPostScripts(){' . "\n"; if (isset($ZBX_PAGE_POST_JS)) { foreach ($ZBX_PAGE_POST_JS as $num => $script) { $post_script .= $script . "\n"; } } $post_script .= '}' . "\n"; // $post_script.= 'try{ chkbxRange.init(); } catch(e){ throw("Checkbox extension failed!");}'; $post_script .= 'chkbxRange.init();'; insert_js($post_script); if (!defined('ZBX_PAGE_NO_MENU') && !defined('ZBX_PAGE_NO_FOOTER')) { $table = new CTable(NULL, "page_footer"); $table->setCellSpacing(0); $table->setCellPadding(1); $table->AddRow(array(new CCol(new CLink(S_ZABBIX . SPACE . ZABBIX_VERSION . SPACE . S_COPYRIGHT_BY . SPACE . S_SIA_ZABBIX, 'http://www.zabbix.com', 'highlight', null, true), 'page_footer_l'), new CCol(array(new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), new CSpan($USER_DETAILS['userid'] == 0 ? S_NOT_CONNECTED : S_CONNECTED_AS . SPACE . "'" . $USER_DETAILS['alias'] . "'" . (ZBX_DISTRIBUTED ? SPACE . S_FROM_SMALL . SPACE . "'" . $USER_DETAILS['node']['name'] . "'" : ''), 'footer_sign')), "page_footer_r"))); $table->Show(); } COpt::profiling_stop("script"); print '<!--' . "\n" . 'SELECTS: ' . $DB['SELECT_COUNT'] . "\n" . 'EXECUTE: ' . $DB['EXECUTE_COUNT'] . "\n" . 'TOTAL: ' . ($DB['EXECUTE_COUNT'] + $DB['SELECT_COUNT']) . "\n" . '-->'; echo "</body>\n"; echo "</html>\n"; } exit;
$result = DBend($result); show_messages($result, S_IMPORTED . SPACE . S_SUCCESSEFULLY_SMALL, S_IMPORT . SPACE . S_FAILED_SMALL); } $form = new CFormTable($frm_title, null, "post", "multipart/form-data"); $form->AddVar('config', $config); $form->AddRow(S_IMPORT_FILE, new CFile('import_file')); $table = new CTable(); $table->SetHeader(array(S_ELEMENT, S_EXISTING, S_MISSING), 'bold'); foreach (array('host' => S_HOST, 'template' => S_TEMPLATE, 'item' => S_ITEM, 'trigger' => S_TRIGGER, 'graph' => S_GRAPH) as $key => $title) { $cmbExist = new CComboBox('rules[' . $key . '][exist]', $rules[$key]['exist']); $cmbExist->AddItem(0, S_UPDATE); $cmbExist->AddItem(1, S_SKIP); $cmbMissed = new CComboBox('rules[' . $key . '][missed]', $rules[$key]['missed']); $key == 'template' ? '' : $cmbMissed->AddItem(0, S_ADD); $cmbMissed->AddItem(1, S_SKIP); $table->AddRow(array($title, $cmbExist, $cmbMissed)); } $form->AddRow(S_RULES, $table); $form->AddItemToBottomRow(new CButton('import', S_IMPORT)); $form->Show(); } else { echo SBR; if ($preview) { $table = new CTableInfo(S_NO_DATA_FOR_EXPORT); $table->setHeader(array(S_HOST, S_ELEMENTS)); $table->showStart(); $hostids = array_keys($hosts); $sql = 'SELECT * ' . ' FROM hosts ' . ' WHERE ' . DBcondition('hostid', $hostids) . ' AND status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ',' . HOST_STATUS_TEMPLATE . ')'; $db_hosts = DBselect($sql); while ($host = DBfetch($db_hosts)) { $el_table = new CTableInfo(S_ONLY_HOST_INFO);
$cmbResource->addItem(AUDIT_RESOURCE_DISCOVERY_RULE, S_DISCOVERY_RULE); $cmbResource->addItem(AUDIT_RESOURCE_SLIDESHOW, S_SLIDESHOW); $cmbResource->addItem(AUDIT_RESOURCE_SCRIPT, S_SCRIPT); $cmbResource->addItem(AUDIT_RESOURCE_PROXY, S_PROXY); $cmbResource->addItem(AUDIT_RESOURCE_MAINTENANCE, S_MAINTENANCE); $cmbResource->addItem(AUDIT_RESOURCE_REGEXP, S_REGULAR_EXPRESSION); $filterForm->addRow(S_RESOURCE, $cmbResource); } //* $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['audit_since'].clndr.clndrshow(pos.top,pos.left);"); $filtertimetab = new CTable(); $filtertimetab->AddOption('width', '10%'); $filtertimetab->SetCellPadding(0); $filtertimetab->SetCellSpacing(0); $filtertimetab->AddRow(array(S_FROM, new CNumericBox('filter_since_day', $_REQUEST['filter_timesince'] > 0 ? date('d', $_REQUEST['filter_timesince']) : '', 2), '/', new CNumericBox('filter_since_month', $_REQUEST['filter_timesince'] > 0 ? date('m', $_REQUEST['filter_timesince']) : '', 2), '/', new CNumericBox('filter_since_year', $_REQUEST['filter_timesince'] > 0 ? date('Y', $_REQUEST['filter_timesince']) : '', 4), new CNumericBox('filter_since_hour', $_REQUEST['filter_timesince'] > 0 ? date('H', $_REQUEST['filter_timesince']) : '', 2), ':', new CNumericBox('filter_since_minute', $_REQUEST['filter_timesince'] > 0 ? date('i', $_REQUEST['filter_timesince']) : '', 2), $clndr_icon)); zbx_add_post_js('create_calendar(null,["filter_since_day","filter_since_month","filter_since_year","filter_since_hour","filter_since_minute"],"audit_since");'); $clndr_icon->AddAction('onclick', "javascript: var pos = getPosition(this); pos.top+=10; pos.left+=16; CLNDR['audit_till'].clndr.clndrshow(pos.top,pos.left);"); $filtertimetab->AddRow(array(S_TILL, new CNumericBox('filter_till_day', $_REQUEST['filter_timetill'] > 0 ? date('d', $_REQUEST['filter_timetill']) : '', 2), '/', new CNumericBox('filter_till_month', $_REQUEST['filter_timetill'] > 0 ? date('m', $_REQUEST['filter_timetill']) : '', 2), '/', new CNumericBox('filter_till_year', $_REQUEST['filter_timetill'] > 0 ? date('Y', $_REQUEST['filter_timetill']) : '', 4), new CNumericBox('filter_till_hour', $_REQUEST['filter_timetill'] > 0 ? date('H', $_REQUEST['filter_timetill']) : '', 2), ':', new CNumericBox('filter_till_minute', $_REQUEST['filter_timetill'] > 0 ? date('i', $_REQUEST['filter_timetill']) : '', 2), $clndr_icon)); zbx_add_post_js('create_calendar(null,["filter_till_day","filter_till_month","filter_till_year","filter_till_hour","filter_till_minute"],"audit_till");'); zbx_add_post_js('addListener($("filter_icon"),"click",CLNDR[\'audit_since\'].clndr.clndrhide.bindAsEventListener(CLNDR[\'audit_since\'].clndr));' . 'addListener($("filter_icon"),"click",CLNDR[\'audit_till\'].clndr.clndrhide.bindAsEventListener(CLNDR[\'audit_till\'].clndr));'); $row_count++; $filterForm->addRow(S_PERIOD, $filtertimetab); //*/ $reset = new CButton("filter_rst", S_RESET); $reset->SetType('button'); $reset->SetAction('javascript: var uri = new Curl(location.href); uri.setArgument("filter_rst",1); location.href = uri.getUrl();'); $filterForm->AddItemToBottomRow(new CButton("filter_set", S_FILTER)); $filterForm->AddItemToBottomRow($reset); $navigation = array(new CSpan(array('« ', $prev), 'textcolorstyles'), new CSpan(' | ', 'divider'), new CSpan(array($next, ' »'), 'textcolorstyles')); $filter = create_filter(S_FILTER, $navigation, $filterForm, 'tr_filter', get_profile('web.audit.filter.state', 0));
$frmService->AddVar('new_service_time[to]', ''); $clndr_icon = new CImg('images/general/bar/cal.gif', 'calendar', 16, 12, 'pointer'); $clndr_icon->AddAction('onclick', 'javascript: var pos = getPosition(this);' . ' pos.top-=203; pos.left+=16; ' . " CLNDR['downtime_since'].clndr.clndrshow(pos.top,pos.left);"); $filtertimetab = new CTable(null, 'calendar'); $filtertimetab->setAttribute('width', '10%'); $filtertimetab->SetCellPadding(0); $filtertimetab->SetCellSpacing(0); $td_tmp = new CCol(new CTextBox('new_service_time[note]', '<short description>', 40)); $td_tmp->SetColSpan(10); $filtertimetab->AddRow(array(S_NOTE, $td_tmp)); $filtertimetab->AddRow(array(S_FROM, new CNumericBox('downtime_since_day', '', 2), '/', new CNumericBox('downtime_since_month', '', 2), '/', new CNumericBox('downtime_since_year', '', 4), SPACE, new CNumericBox('downtime_since_hour', '', 2), ':', new CNumericBox('downtime_since_minute', '', 2), $clndr_icon)); zbx_add_post_js('create_calendar(' . 'null,' . '["downtime_since_day","downtime_since_month","downtime_since_year","downtime_since_hour","downtime_since_minute"],' . '"downtime_since");'); $clndr_icon->AddAction('onclick', 'javascript: var pos = getPosition(this);' . ' pos.top-=203; pos.left+=16; ' . " CLNDR['downtime_till'].clndr.clndrshow(pos.top,pos.left);"); $filtertimetab->AddRow(array(S_TILL, new CNumericBox('downtime_till_day', '', 2), '/', new CNumericBox('downtime_till_month', '', 2), '/', new CNumericBox('downtime_till_year', '', 4), SPACE, new CNumericBox('downtime_till_hour', '', 2), ':', new CNumericBox('downtime_till_minute', '', 2), $clndr_icon)); zbx_add_post_js('create_calendar(' . 'null,' . '["downtime_till_day","downtime_till_month","downtime_till_year","downtime_till_hour","downtime_till_minute"],' . '"downtime_till");'); $time_param->AddRow($filtertimetab); } else { $cmbWeekFrom = new CComboBox('new_service_time[from_week]', 'Sunday'); $cmbWeekTo = new CComboBox('new_service_time[to_week]', 'Sunday'); foreach (array('Sunday' => S_SUNDAY, 'Monday' => S_MONDAY, 'Tuesday' => S_TUESDAY, 'Wednesday' => S_WEDNESDAY, 'Thursday' => S_THURSDAY, 'Friday' => S_FRIDAY, 'Saturday' => S_SATURDAY) as $day_num => $day_str) { $cmbWeekFrom->AddItem($day_num, $day_str); $cmbWeekTo->AddItem($day_num, $day_str); } $time_param->AddRow(array(S_FROM, $cmbWeekFrom, new CTextBox('new_service_time[from]', 'H:i', 9))); $time_param->AddRow(array(S_TILL, $cmbWeekTo, new CTextBox('new_service_time[to]', 'H:i', 9))); $frmService->AddVar('new_service_time[note]', ''); } $frmService->AddRow(S_NEW_SERVICE_TIME, array($cmbTimeType, BR(), $time_param, new CButton('add_service_time', 'add', 'javascript: document.forms[0].action += \'?sform=1\'; submit();'))); //trigger $frmService->AddRow(S_LINK_TO_TRIGGER_Q, new CCheckBox("linktrigger", $linktrigger, "javascript: display_element('trigger_name');", 1)); if ($triggerid > 0) {
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; }
/** * Creates the availability report page filter and modifies trigger retrieval options. * * Possible $config values are AVAILABILITY_REPORT_BY_HOST or AVAILABILITY_REPORT_BY_TEMPLATE. * * @param int $config report mode * @param array $PAGE_GROUPS the data for the host/template group filter select * @param array $PAGE_HOSTS the data for the host/template filter select * @param array $options trigger retrieval options, to be modified * * @return array returns form table and modified options: array('form' => CFormTable, 'options' => array) */ function get_report2_filter($config, array $PAGE_GROUPS, array $PAGE_HOSTS, $options) { $filterForm = new CFormTable(); $filterForm->setAttribute('name', 'zbx_filter'); $filterForm->setAttribute('id', 'zbx_filter'); $filterForm->addVar('config', $config); $filterForm->addVar('filter_timesince', date('YmdHis', $_REQUEST['filter_timesince'])); $filterForm->addVar('filter_timetill', date('YmdHis', $_REQUEST['filter_timetill'])); $cmbGroups = new CComboBox('filter_groupid', $PAGE_GROUPS['selected'], 'javascript: submit();'); $cmbHosts = new CComboBox('filter_hostid', $PAGE_HOSTS['selected'], 'javascript: submit();'); foreach ($PAGE_GROUPS['groups'] as $groupid => $name) { $cmbGroups->addItem($groupid, get_node_name_by_elid($groupid, null, ': ') . $name); } foreach ($PAGE_HOSTS['hosts'] as $hostid => $name) { $cmbHosts->addItem($hostid, get_node_name_by_elid($hostid, null, ': ') . $name); } if ($config == AVAILABILITY_REPORT_BY_TEMPLATE) { $filterForm->addRow(_('Template group'), $cmbGroups); $filterForm->addRow(_('Template'), $cmbHosts); $cmbTrigs = new CComboBox('tpl_triggerid', get_request('tpl_triggerid', 0), 'submit()'); $cmbHGrps = new CComboBox('hostgroupid', get_request('hostgroupid', 0), 'submit()'); $cmbTrigs->addItem(0, _('all')); $cmbHGrps->addItem(0, _('all')); // fetch the groups, that the used hosts belong to $hostGroups = API::HostGroup()->get(array('output' => array('name', 'groupid'), 'hostids' => $options['hostids'], 'monitored_hosts' => true, 'preservekeys' => true)); foreach ($hostGroups as $hostGroup) { $cmbHGrps->addItem($hostGroup['groupid'], get_node_name_by_elid($hostGroup['groupid'], null, ': ') . $hostGroup['name']); } if (isset($_REQUEST['hostgroupid']) && !isset($hostGroups[$_REQUEST['hostgroupid']])) { unset($options['groupids']); } if ($PAGE_HOSTS['selected']) { $sql_cond = ' AND h.hostid=' . $PAGE_HOSTS['selected']; } else { $sql_cond = ' AND ' . dbConditionInt('h.hostid', $PAGE_HOSTS['hostids']); } $sql = 'SELECT DISTINCT t.triggerid,t.description ' . ' FROM triggers t,hosts h,items i,functions f ' . ' WHERE f.itemid=i.itemid ' . ' AND h.hostid=i.hostid ' . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND t.triggerid=f.triggerid ' . ' AND h.status=' . HOST_STATUS_TEMPLATE . ' AND ' . DBin_node('t.triggerid') . ' AND i.status=' . ITEM_STATUS_ACTIVE . $sql_cond . ' ORDER BY t.description'; $triggers = DBfetchArrayAssoc(DBselect($sql), 'triggerid'); foreach ($triggers as $trigger) { $cmbTrigs->addItem($trigger['triggerid'], get_node_name_by_elid($trigger['triggerid'], null, ': ') . $trigger['description']); } if (isset($_REQUEST['tpl_triggerid']) && !isset($triggers[$_REQUEST['tpl_triggerid']])) { unset($options['filter']['templateid']); } $filterForm->addRow(_('Template trigger'), $cmbTrigs); $filterForm->addRow(_('Filter by host group'), $cmbHGrps); } elseif ($config == AVAILABILITY_REPORT_BY_HOST) { $filterForm->addRow(_('Host group'), $cmbGroups); $filterForm->addRow(_('Host'), $cmbHosts); } //* $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);"); $filtertimetab = new CTable(null, 'calendar'); $filtertimetab->setAttribute('width', '10%'); $filtertimetab->setCellPadding(0); $filtertimetab->setCellSpacing(0); $filtertimetab->addRow(array(_('From'), new CNumericBox('filter_since_day', $_REQUEST['filter_timesince'] > 0 ? date('d', $_REQUEST['filter_timesince']) : '', 2), '/', new CNumericBox('filter_since_month', $_REQUEST['filter_timesince'] > 0 ? date('m', $_REQUEST['filter_timesince']) : '', 2), '/', new CNumericBox('filter_since_year', $_REQUEST['filter_timesince'] > 0 ? date('Y', $_REQUEST['filter_timesince']) : '', 4), SPACE, new CNumericBox('filter_since_hour', $_REQUEST['filter_timesince'] > 0 ? date('H', $_REQUEST['filter_timesince']) : '', 2), ':', new CNumericBox('filter_since_minute', $_REQUEST['filter_timesince'] > 0 ? date('i', $_REQUEST['filter_timesince']) : '', 2), $clndr_icon)); zbx_add_post_js('create_calendar(null,' . '["filter_since_day","filter_since_month","filter_since_year","filter_since_hour","filter_since_minute"],' . '"avail_report_since",' . '"filter_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);"); $filtertimetab->AddRow(array(_('Till'), new CNumericBox('filter_till_day', $_REQUEST['filter_timetill'] > 0 ? date('d', $_REQUEST['filter_timetill']) : '', 2), '/', new CNumericBox('filter_till_month', $_REQUEST['filter_timetill'] > 0 ? date('m', $_REQUEST['filter_timetill']) : '', 2), '/', new CNumericBox('filter_till_year', $_REQUEST['filter_timetill'] > 0 ? date('Y', $_REQUEST['filter_timetill']) : '', 4), SPACE, new CNumericBox('filter_till_hour', $_REQUEST['filter_timetill'] > 0 ? date('H', $_REQUEST['filter_timetill']) : '', 2), ':', new CNumericBox('filter_till_minute', $_REQUEST['filter_timetill'] > 0 ? date('i', $_REQUEST['filter_timetill']) : '', 2), $clndr_icon)); zbx_add_post_js('create_calendar(null,' . '["filter_till_day","filter_till_month","filter_till_year","filter_till_hour","filter_till_minute"],' . '"avail_report_till",' . '"filter_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));'); $filterForm->addRow(_('Period'), $filtertimetab); //*/ $filterForm->addItemToBottomRow(new CSubmit('filter_set', _('Filter'))); $reset = new CButton("filter_rst", _('Reset'), 'javascript: var url = new Curl(location.href); url.setArgument("filter_rst",1); location.href = url.getUrl();'); $filterForm->addItemToBottomRow($reset); return array('form' => $filterForm, 'options' => $options); }
$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'; $db_regexps = DBselect($sql); while ($regexp = DBfetch($db_regexps)) { $regexp['expressions'] = array(); $regexps[$regexp['regexpid']] = $regexp; $regexpids[$regexp['regexpid']] = $regexp['regexpid'];
update_profile('web.item.graph.period', $_REQUEST['period'], PROFILE_TYPE_INT, $_REQUEST['itemid']); } $l_header = array(new CLink($item_data['host'], 'latest.php?hostid=' . $item_data['hostid']), ': ', item_description($item_data)); if ('showgraph' == $_REQUEST['action']) { if (infavorites('web.favorite.graphids', $_REQUEST['itemid'], 'itemid')) { $icon = new CDiv(SPACE, 'iconminus'); $icon->AddOption('title', S_REMOVE_FROM . ' ' . S_FAVORITES); $icon->AddAction('onclick', new CScript("javascript: rm4favorites('itemid','" . $_REQUEST['itemid'] . "',0);")); } else { $icon = new CDiv(SPACE, 'iconplus'); $icon->AddOption('title', S_ADD_TO . ' ' . S_FAVORITES); $icon->AddAction('onclick', new CScript("javascript: add2favorites('itemid','" . $_REQUEST['itemid'] . "');")); } $icon->AddOption('id', 'addrm_fav'); $icon_tab = new CTable(); $icon_tab->AddRow(array($icon, SPACE, $l_header)); $l_header = $icon_tab; } } $effectiveperiod = navigation_bar_calc(); unset($item_data); $to_save_request = null; if (!isset($_REQUEST['plaintext']) && $_REQUEST['fullscreen'] == 0) { if ($item_type == ITEM_VALUE_TYPE_LOG) { $l_header = new CForm(); $l_header->SetName('loglist'); $l_header->AddVar('action', $_REQUEST['action']); $l_header->AddVar('from', $_REQUEST['from']); $l_header->AddVar('period', $_REQUEST['period']); $l_header->AddVar('itemid', $_REQUEST['itemid']); if (isset($_REQUEST['filter_task'])) {
} $form = new CForm(); $form->SetMethod('get'); $form->AddVar("fullscreen", $_REQUEST["fullscreen"]); $cmbMaps = new CComboBox("sysmapid", get_request("sysmapid", 0), "submit()"); foreach ($all_maps as $id => $name) { $cmbMaps->AddItem($id, $name); } if ($cmbMaps->ItemsCount() > 0) { $form->AddItem($cmbMaps); $p_elements[] = get_table_header($text, $form); } $table = new CTable(S_NO_MAPS_DEFINED, "map"); if (isset($_REQUEST["sysmapid"])) { $action_map = get_action_map_by_sysmapid($_REQUEST["sysmapid"]); $table->AddRow($action_map); $imgMap = new CImg("map.php?noedit=1&sysmapid=" . $_REQUEST["sysmapid"]); $imgMap->SetMap($action_map->GetName()); $table->AddRow($imgMap); } $p_elements[] = $table; $icon = null; $fs_icon = null; if (isset($_REQUEST["sysmapid"])) { $sysmap = get_sysmap_by_sysmapid($_REQUEST["sysmapid"]); $text = $all_maps[$_REQUEST["sysmapid"]]; if (infavorites('web.favorite.sysmapids', $_REQUEST['sysmapid'], 'sysmapid')) { $icon = new CDiv(SPACE, 'iconminus'); $icon->AddOption('title', S_REMOVE_FROM . ' ' . S_FAVORITES); $icon->AddAction('onclick', new CScript("javascript: rm4favorites('sysmapid','" . $_REQUEST["sysmapid"] . "',0);")); } else {
$refresh_rate = 30; //seconds $fields = array("warning_msg" => array(T_ZBX_STR, O_OPT, NULL, NULL, NULL), "message" => array(T_ZBX_STR, O_OPT, NULL, NULL, NULL), "retry" => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL), "cancel" => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL)); check_fields($fields, false); if (isset($_REQUEST['cancel'])) { zbx_unsetcookie('ZBX_CONFIG'); redirect('index.php'); exit; } // clear_messages(); $USER_DETAILS["refresh"] = $refresh_rate; include_once "include/page_header.php"; unset($USER_DETAILS); insert_showhint_javascript(); $table = new CTable(null, 'warning'); $table->SetAlign('center'); $table->AddOption('style', 'width: 480px; margin-top: 100px;'); $table->SetHeader(array(new CCol(S_ZABBIX_VER, 'left'), SPACE), 'header'); $table->AddRow(SPACE); $warning_msg = isset($_REQUEST['warning_msg']) ? $_REQUEST['warning_msg'] : S_ZABBIX_IS_UNAVAILABLE . '!'; $img = new CImg('./images/general/warning16r.gif', 'warning', 16, 16, 'img'); $img->addOption('style', 'border-width: 0px; vertical-align: bottom;'); $msg = new CSpan(bold(SPACE . $warning_msg)); $msg->AddOption('style', 'line-height: 20px; vertical-align: top;'); $table->AddRow(new CCol(array($img, $msg), 'center')); $table->AddRow(SPACE); $table->SetFooter(new CCol(new CButton('retry', S_RETRY, 'javascript: document.location.reload();'), 'left'), 'footer'); $table->Show(); zbx_add_post_js('setTimeout("document.location.reload();",' . $refresh_rate * 1000 . ');'); echo SBR; include_once "include/page_footer.php";