Exemple #1
0
//	$cmbHosts = new CComboBox('hostid',$_REQUEST['hostid'],"javascript: return updater.onetime_update('".ZBX_PAGE_MAIN_HAT."',this.form);");
$options = array('groups' => array('monitored_hosts' => 1, 'with_historical_items' => 1), 'hosts' => array('monitored_hosts' => 1, 'with_historical_items' => 1), 'hostid' => get_request('hostid', null), 'groupid' => get_request('groupid', null));
$pageFilter = new CPageFilter($options);
$_REQUEST['groupid'] = $pageFilter->groupid;
$_REQUEST['hostid'] = $pageFilter->hostid;
$available_hosts = $pageFilter->hostsSelected ? array_keys($pageFilter->hosts) : array();
$r_form->addItem(array(S_GROUP . SPACE, $pageFilter->getGroupsCB(true)));
$r_form->addItem(array(SPACE . S_HOST . SPACE, $pageFilter->getHostsCB(true)));
$latest_wdgt->addHeader(S_ITEMS_BIG, $r_form);
//-------------
/************************* FILTER **************************/
/***********************************************************/
$filterForm = new CFormTable();
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
$filterForm->addRow(S_SHOW_ITEMS_WITH_DESCRIPTION_LIKE, new CTextBox('select', $_REQUEST['select'], 20));
$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);
$latest_wdgt->addFlicker($filterForm, CProfile::get('web.latest.filter.state', 1));
//-------
validate_sort_and_sortorder('i.description', ZBX_SORT_UP);
$_REQUEST['groupbyapp'] = get_request('groupbyapp', CProfile::get('web.latest.groupbyapp', 1));
CProfile::update('web.latest.groupbyapp', $_REQUEST['groupbyapp'], PROFILE_TYPE_INT);
$_REQUEST['apps'] = get_request('apps', array());
$apps = zbx_toHash($_REQUEST['apps']);
if (isset($_REQUEST['open'])) {
    $showAll = 1;
    if (isset($_REQUEST['applicationid'])) {
$numrows->setAttribute('name', 'numrows');
$trigg_wdgt->addHeader(S_TRIGGERS_BIG, $r_form);
$trigg_wdgt->addHeader($numrows);
/************************* FILTER **************************/
/***********************************************************/
$filterForm = new CFormTable(null, null, 'get');
//,'tr_status.php?filter_set=1','POST',null,'sform');
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
$filterForm->addVar('fullscreen', $_REQUEST['fullscreen']);
$filterForm->addVar('groupid', $_REQUEST['groupid']);
$filterForm->addVar('hostid', $_REQUEST['hostid']);
$tr_select = new CComboBox('show_triggers', $show_triggers);
$tr_select->addItem(TRIGGERS_OPTION_ALL, S_ANY);
$tr_select->additem(TRIGGERS_OPTION_ONLYTRUE, S_PROBLEM);
$filterForm->addRow(S_TRIGGERS_STATUS, $tr_select);
if ($config['event_ack_enable']) {
    $cb_ack_status = new CComboBox('ack_status', $ack_status);
    $cb_ack_status->addItem(ZBX_ACK_STS_ANY, S_ANY);
    $cb_ack_status->additem(ZBX_ACK_STS_WITH_UNACK, S_WITH_UNACKNOWLEDGED_EVENTS);
    $cb_ack_status->additem(ZBX_ACK_STS_WITH_LAST_UNACK, S_WITH_LAST_EVENT_UNACKNOWLEDGED);
    $filterForm->addRow(S_ACKNOWLEDGE_STATUS, $cb_ack_status);
}
$ev_select = new CComboBox('show_events', $_REQUEST['show_events']);
$ev_select->addItem(EVENTS_OPTION_NOEVENT, S_HIDE_ALL);
$ev_select->addItem(EVENTS_OPTION_ALL, S_SHOW_ALL . SPACE . '(' . $config['event_expire'] . SPACE . ($config['event_expire'] > 1 ? S_DAYS : S_DAY) . ')');
if ($config['event_ack_enable']) {
    $ev_select->addItem(EVENTS_OPTION_NOT_ACK, S_SHOW_UNACKNOWLEDGED . SPACE . '(' . $config['event_expire'] . SPACE . ($config['event_expire'] > 1 ? S_DAYS : S_DAY) . ')');
}
$filterForm->addRow(S_EVENTS, $ev_select);
$severity_select = new CComboBox('show_severity', $show_severity);
    $groupids = zbx_toHash($groupids);
    $grpswitch = CProfile::get('web.dashconf.groups.grpswitch', 0);
    $maintenance = CProfile::get('web.dashconf.hosts.maintenance', 1);
    $extAck = CProfile::get('web.dashconf.events.extAck', 0);
    $severity = CProfile::get('web.dashconf.triggers.severity', '0;1;2;3;4;5');
    $severity = zbx_empty($severity) ? array() : explode(';', $severity);
}
$dashForm->addVar('filterEnable', $filterEnable);
if ($filterEnable) {
    $cbFilter = new CSpan(S_ENABLED, 'green underline pointer');
    $cbFilter->setAttribute('onclick', "create_var('" . $dashForm->getName() . "', 'filterEnable', 0, true);");
} else {
    $cbFilter = new CSpan(S_DISABLED, 'red underline pointer');
    $cbFilter->setAttribute('onclick', "\$('dashform').enable(); create_var('" . $dashForm->getName() . "', 'filterEnable', 1, true);");
}
$dashForm->addRow(S_DASHBOARD_FILTER, $cbFilter);
$dashForm->addVar('groupids', $groupids);
$cmbGroups = new CComboBox('grpswitch', $grpswitch, 'submit();');
$cmbGroups->addItem(0, S_ALL_S);
$cmbGroups->addItem(1, S_SELECTED);
if (!$filterEnable) {
    $cmbGroups->setAttribute('disabled', 'disabled');
}
$dashForm->addRow(S_HOST_GROUPS, $cmbGroups);
if ($grpswitch == 1) {
    $options = array('nodeids' => get_current_nodeid(true), 'groupids' => $groupids, 'output' => API_OUTPUT_EXTEND);
    $groups = CHostGroup::get($options);
    order_result($groups, 'name');
    $lstGroups = new CListBox('del_groups[]', null, 15);
    $lstGroups->setAttribute('style', 'width: 200px;');
    foreach ($groups as $gnum => $group) {
$r_form = new CForm('get');
$options = array('groups' => array('monitored_hosts' => 1), 'hosts' => array('monitored_hosts' => 1), 'hostid' => get_request('hostid', null), 'groupid' => get_request('groupid', null));
$pageFilter = new CPageFilter($options);
$_REQUEST['groupid'] = $pageFilter->groupid;
$_REQUEST['hostid'] = $pageFilter->hostid;
$available_hosts = $pageFilter->hostsSelected ? array_keys($pageFilter->hosts) : array();
$r_form->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB(true)));
$r_form->addItem(array(SPACE . _('Host') . SPACE, $pageFilter->getHostsCB(true)));
$latest_wdgt->addHeader(_('Items'), $r_form);
//-------------
/************************* FILTER **************************/
/***********************************************************/
$filterForm = new CFormTable(null, null, 'get');
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
$filterForm->addRow(_('Show items with name like'), new CTextBox('select', $_REQUEST['select'], 20));
$filterForm->addRow(_('Show items without data'), new CCheckBox('show_without_data', $_REQUEST['show_without_data'], null, 1));
$reset = new CButton("filter_rst", _('Reset'), 'javascript: var uri = new Curl(location.href); uri.setArgument("filter_rst",1); location.href = uri.getUrl();');
$filterForm->addItemToBottomRow(new CSubmit("filter_set", _('Filter')));
$filterForm->addItemToBottomRow($reset);
$latest_wdgt->addFlicker($filterForm, CProfile::get('web.latest.filter.state', 1));
//-------
validate_sort_and_sortorder('i.name', ZBX_SORT_UP);
$_REQUEST['apps'] = get_request('apps', array());
$apps = zbx_toHash($_REQUEST['apps']);
if (isset($_REQUEST['open'])) {
    $showAll = 1;
    if (isset($_REQUEST['applicationid'])) {
        $apps[$_REQUEST['applicationid']] = $_REQUEST['applicationid'];
    }
} else {
Exemple #5
0
$filterForm = null;
if (EVENT_SOURCE_TRIGGERS == $source) {
    $filterForm = new CFormTable(null, null, 'get');
    //,'events.php?filter_set=1','POST',null,'sform');
    $filterForm->setAttribute('name', 'zbx_filter');
    $filterForm->setAttribute('id', 'zbx_filter');
    $filterForm->addVar('triggerid', get_request('triggerid'));
    $filterForm->addVar('stime', get_request('stime'));
    $filterForm->addVar('period', get_request('period'));
    if (isset($_REQUEST['triggerid']) && $_REQUEST['triggerid'] > 0) {
        $trigger = expand_trigger_description($_REQUEST['triggerid']);
    } else {
        $trigger = '';
    }
    $row = new CRow(array(new CCol(S_TRIGGER, 'form_row_l'), new CCol(array(new CTextBox('trigger', $trigger, 96, 'yes'), new CButton("btn1", S_SELECT, "return PopUp('popup.php?" . "dstfrm=" . $filterForm->getName() . "&dstfld1=triggerid&dstfld2=trigger" . "&srctbl=triggers&srcfld1=triggerid&srcfld2=description&real_hosts=1');", 'T')), 'form_row_r')));
    $filterForm->addRow($row);
    $filterForm->addVar('hide_unknown', $_REQUEST['hide_unknown']);
    $unkcbx = new CCheckBox('hide_unk', $_REQUEST['hide_unknown'], null, '1');
    $unkcbx->setAction('javascript: create_var("' . $filterForm->GetName() . '", "hide_unknown", (this.checked?1:0), 0); ');
    $filterForm->addRow(S_HIDE_UNKNOWN, $unkcbx);
    $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);
}
$events_wdgt->addFlicker($filterForm, CProfile::get('web.events.filter.state', 0));
$scroll_div = new CDiv();
$scroll_div->setAttribute('id', 'scrollbar_cntr');
$events_wdgt->addFlicker($scroll_div, CProfile::get('web.events.filter.state', 0));
// }}} FILTER
Exemple #6
0
     $command = get_request('command', '');
     $usrgrpid = get_request('usrgrpid', 0);
     $groupid = get_request('groupid', 0);
     $access = get_request('access', PERM_READ_ONLY);
 }
 if (isset($_REQUEST['scriptid']) && !isset($_REQUEST['form_refresh'])) {
     $frmScr->addVar('form_refresh', get_request('form_refresh', 1));
     if ($script = get_script_by_scriptid($_REQUEST['scriptid'])) {
         $name = $script['name'];
         $command = $script['command'];
         $usrgrpid = $script['usrgrpid'];
         $groupid = $script['groupid'];
         $access = $script['host_access'];
     }
 }
 $frmScr->addRow(S_NAME, new CTextBox('name', $name, 80));
 $frmScr->addRow(S_COMMAND, new CTextBox('command', $command, 80));
 $usr_groups = new CCombobox('usrgrpid', $usrgrpid);
 $usr_groups->addItem(0, S_ALL_S);
 $sql = 'SELECT DISTINCT ug.name, ug.usrgrpid ' . ' FROM usrgrp ug ' . ' WHERE ' . DBin_node('ug.usrgrpid') . ' ORDER BY ug.name';
 $usrgrp_result = DBselect($sql);
 while ($usr_group = DBfetch($usrgrp_result)) {
     $usr_groups->addItem($usr_group['usrgrpid'], $usr_group['name']);
 }
 $frmScr->addRow(S_USER_GROUPS, $usr_groups);
 $host_groups = new CCombobox('groupid', $groupid);
 $host_groups->addItem(0, S_ALL_S);
 $sql = 'SELECT DISTINCT g.name, g.groupid ' . ' FROM groups g ' . ' WHERE ' . DBcondition('g.groupid', $available_groups) . ' ORDER BY g.name';
 $grp_result = DBselect($sql);
 while ($group = DBfetch($grp_result)) {
     $host_groups->addItem($group['groupid'], $group['name']);
Exemple #7
0
 echo SBR;
 $frmPd = new CFormTable(S_PERIOD);
 $frmPd->setName('period');
 $frmPd->addVar('dstfrm', $_REQUEST['dstfrm']);
 $config = get_request('config', 1);
 $caption = get_request('caption', '');
 $color = get_request('color', '009900');
 $report_timesince = get_request('report_timesince', time() - 86400);
 $report_timetill = get_request('report_timetill', time());
 $frmPd->addVar('config', $config);
 $frmPd->addVar('report_timesince', $report_timesince);
 $frmPd->addVar('report_timetill', $report_timetill);
 if (isset($_REQUEST['period_id'])) {
     $frmPd->addVar('period_id', $_REQUEST['period_id']);
 }
 $frmPd->addRow(array(new CVisibilityBox('caption_visible', !zbx_empty($caption), 'caption', S_DEFAULT), S_CAPTION), new CTextBox('caption', $caption, 10));
 //		$frmPd->addRow(S_CAPTION, new CTextBox('caption',$caption,10));
 //*
 $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->setAttribute('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");');
 $frmPd->addRow(S_PERIOD, $reporttimetab);
 //*/
Exemple #8
0
/***********************************************************/
$filterForm = new CFormTable();
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
$script = new CScript("javascript: if(CLNDR['audit_since'].clndr.setSDateFromOuterObj()){" . "\$('nav_time').value = parseInt(CLNDR['audit_since'].clndr.sdt.getTime()/1000);}");
$filterForm->addAction('onsubmit', $script);
$filterForm->addVar('nav_time', $_REQUEST['nav_time'] > 0 ? $_REQUEST['nav_time'] : '');
$filterForm->addVar('config', $_REQUEST['config']);
$filterForm->addVar('userid', $_REQUEST['userid']);
if (isset($_REQUEST['userid']) && $_REQUEST['userid'] > 0) {
    $user = get_user_by_userid($_REQUEST['userid']);
} else {
    $user['alias'] = '';
}
$row = new CRow(array(new CCol($config == 1 ? S_RECIPIENT : S_USER, 'form_row_l'), new CCol(array(new CTextBox("user", $user['alias'], 32, 'yes'), new CButton("btn1", S_SELECT, "return PopUp('popup.php?" . "dstfrm=" . $filterForm->GetName() . "&dstfld1=userid&dstfld2=user" . "&srctbl=users&srcfld1=userid&srcfld2=alias&real_hosts=1');", 'T')), 'form_row_r')));
$filterForm->addRow($row);
if ($config == 0) {
    $cmbAction = new CComboBox('action', $_REQUEST['action']);
    $cmbAction->addItem(-1, S_ALL_S);
    $cmbAction->addItem(AUDIT_ACTION_LOGIN, S_LOGIN);
    $cmbAction->addItem(AUDIT_ACTION_LOGOUT, S_LOGOUT);
    $cmbAction->addItem(AUDIT_ACTION_ADD, S_ADD);
    $cmbAction->addItem(AUDIT_ACTION_UPDATE, S_UPDATE);
    $cmbAction->addItem(AUDIT_ACTION_DELETE, S_DELETE);
    $cmbAction->addItem(AUDIT_ACTION_ENABLE, S_ENABLE);
    $cmbAction->addItem(AUDIT_ACTION_DISABLE, S_DISABLE);
    $filterForm->addRow(S_ACTION, $cmbAction);
    $cmbResource = new CComboBox('resourcetype', $_REQUEST['resourcetype']);
    $cmbResource->addItem(-1, S_ALL_S);
    $cmbResource->addItem(AUDIT_RESOURCE_USER, S_USER);
    //		$cmbResource->addItem(AUDIT_RESOURCE_ZABBIX,		S_ZABBIX);
         continue;
     }
     $host = reset($item['hosts']);
     $itemsData[$itemid]['id'] = $itemid;
     $itemsData[$itemid]['name'] = $host['name'] . NAME_DELIMITER . $item['name_expanded'];
 }
 order_result($itemsData, 'name');
 foreach ($itemsData as $item) {
     $itemListbox->addItem($item['id'], $item['name']);
 }
 $addItemButton = new CButton('add_log', _('Add'), "return PopUp('popup.php?multiselect=1&real_hosts=1" . '&reference=itemid&srctbl=items&value_types[]=' . $this->data['item']['value_type'] . "&srcfld1=itemid');");
 $deleteItemButton = null;
 if (count($this->data['items']) > 1) {
     $deleteItemButton = new CSubmit('remove_log', _('Remove selected'), "javascript: removeSelectedItems('cmbitemlist_', 'itemid')");
 }
 $filterForm->addRow(_('Items list'), array($itemListbox, BR(), $addItemButton, $deleteItemButton));
 $filterForm->addRow(_('Select rows with value like'), new CTextBox('filter', get_request('filter', ''), ZBX_TEXTBOX_FILTER_SIZE));
 $filterTask = get_request('filter_task', 0);
 $taskComboBox = new CComboBox('filter_task', $filterTask, 'submit()');
 $taskComboBox->addItem(FILTER_TASK_SHOW, _('Show selected'));
 $taskComboBox->addItem(FILTER_TASK_HIDE, _('Hide selected'));
 $taskComboBox->addItem(FILTER_TASK_MARK, _('Mark selected'));
 $taskComboBox->addItem(FILTER_TASK_INVERT_MARK, _('Mark others'));
 $tasks = array($taskComboBox);
 if (str_in_array($filterTask, array(FILTER_TASK_MARK, FILTER_TASK_INVERT_MARK))) {
     $colorComboBox = new CComboBox('mark_color', get_request('mark_color', 0));
     $colorComboBox->addItem(MARK_COLOR_RED, _('as Red'));
     $colorComboBox->addItem(MARK_COLOR_GREEN, _('as Green'));
     $colorComboBox->addItem(MARK_COLOR_BLUE, _('as Blue'));
     $tasks[] = SPACE;
     $tasks[] = $colorComboBox;
}
$media = get_request('media', -1);
$sendto = get_request('sendto', '');
$mediatypeid = get_request('mediatypeid', 0);
$active = get_request('active', 0);
$period = get_request('period', ZBX_DEFAULT_INTERVAL);
$frmMedia = new CFormTable(_('New media'));
$frmMedia->addVar('media', $media);
$frmMedia->addVar('dstfrm', $_REQUEST['dstfrm']);
$cmbType = new CComboBox('mediatypeid', $mediatypeid);
$sql = 'SELECT mediatypeid,description ' . ' FROM media_type' . ' WHERE ' . DBin_node('mediatypeid') . ' ORDER BY type';
$types = DBselect($sql);
while ($type = DBfetch($types)) {
    $cmbType->addItem($type['mediatypeid'], get_node_name_by_elid($type['mediatypeid'], null, ': ') . $type['description']);
}
$frmMedia->addRow(_('Type'), $cmbType);
$frmMedia->addRow(_('Send to'), new CTextBox('sendto', $sendto, 20));
$frmMedia->addRow(_('When active'), new CTextBox('period', $period, 48));
$frm_row = array();
foreach (getSeverityCaption() as $i => $caption) {
    $frm_row[] = array(new CCheckBox('severity[' . $i . ']', str_in_array($i, $severity), null, $i), $caption);
    $frm_row[] = BR();
}
$frmMedia->addRow(_('Use if severity'), $frm_row);
$cmbStat = new CComboBox('active', $active);
$cmbStat->addItem(0, _('Enabled'));
$cmbStat->addItem(1, _('Disabled'));
$frmMedia->addRow(_('Status'), $cmbStat);
$frmMedia->addItemToBottomRow(array(new CSubmit('add', $media > -1 ? _('Save') : _('Add')), new CButtonCancel(null, 'close_window();')));
$frmMedia->Show();
require_once dirname(__FILE__) . '/include/page_footer.php';
Exemple #11
0
    }
}
$messageTable = new CFormTable($title . ' "' . getUserFullname(CWebUser::$data) . '"');
$messageTable->addVar('backurl', $_REQUEST['backurl']);
if (in_array($_REQUEST['backurl'], array('tr_events.php', 'events.php'))) {
    $messageTable->addVar('eventid', $_REQUEST['eventid']);
    $messageTable->addVar('triggerid', $_REQUEST['triggerid']);
} elseif (in_array($_REQUEST['backurl'], array('screenedit.php', 'screens.php'))) {
    $messageTable->addVar('screenid', $_REQUEST['screenid']);
}
if (isset($_REQUEST['eventid'])) {
    $messageTable->addVar('eventid', $_REQUEST['eventid']);
} elseif (isset($_REQUEST['triggers'])) {
    foreach ($_REQUEST['triggers'] as $triggerId) {
        $messageTable->addVar('triggers[' . $triggerId . ']', $triggerId);
    }
} elseif (isset($_REQUEST['events'])) {
    foreach ($_REQUEST['events'] as $eventId) {
        $messageTable->addVar('events[' . $eventId . ']', $eventId);
    }
}
$message = new CTextArea('message', '', array('rows' => ZBX_TEXTAREA_STANDARD_ROWS, 'width' => ZBX_TEXTAREA_BIG_WIDTH, 'maxlength' => 255));
$message->attr('autofocus', 'autofocus');
$messageTable->addRow(_('Message'), $message);
$messageTable->addItemToBottomRow(new CSubmit('saveandreturn', $saveAndReturnLabel));
if (!$bulk) {
    $messageTable->addItemToBottomRow(new CSubmit('save', $saveLabel));
}
$messageTable->addItemToBottomRow(new CButtonCancel(url_params(array('backurl', 'eventid', 'triggerid', 'screenid'))));
$messageTable->show(false);
require_once dirname(__FILE__) . '/include/page_footer.php';
Exemple #12
0
function insert_command_result_form($scriptid, $hostid)
{
    $result = execute_script($scriptid, $hostid);
    $script_info = DBfetch(DBselect("SELECT name FROM scripts WHERE scriptid={$scriptid}"));
    $frmResult = new CFormTable($script_info["name"] . ': ' . script_make_command($scriptid, $hostid));
    $message = $result["message"];
    if ($result["flag"] != 0) {
        error($message);
        $message = "";
    }
    $frmResult->addRow(S_RESULT, new CTextArea("message", $message, 100, 25, 'yes'));
    $frmResult->addItemToBottomRow(new CButton('close', S_CLOSE, 'window.close();'));
    $frmResult->Show();
}
$cmbConf->addItem('auditlogs.php', S_LOGS);
$cmbConf->addItem('auditacts.php', S_ACTIONS);
$frmForm->addItem($cmbConf);
$alerts_wdgt->addPageHeader(S_AUDIT_ACTIONS_BIG, $frmForm);
$numrows = new CDiv();
$numrows->setAttribute('name', 'numrows');
$alerts_wdgt->addHeader(S_ACTIONS_BIG);
$alerts_wdgt->addHeader($numrows);
//--------
/************************* FILTER **************************/
/***********************************************************/
$filterForm = new CFormTable();
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
$row = new CRow(array(new CCol(S_RECIPIENT, 'form_row_l'), new CCol(array(new CTextBox('alias', $_REQUEST['alias'], 32), new CButton('btn1', S_SELECT, "return PopUp('popup.php?" . "dstfrm=" . $filterForm->getName() . "&dstfld1=alias&srctbl=users&srcfld1=alias&real_hosts=1');", 'T')), 'form_row_r')));
$filterForm->addRow($row);
$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);
$alerts_wdgt->addFlicker($filterForm, CProfile::get('web.auditacts.filter.state', 1));
$scroll_div = new CDiv();
$scroll_div->setAttribute('id', 'scrollbar_cntr');
$alerts_wdgt->addFlicker($scroll_div, CProfile::get('web.auditacts.filter.state', 1));
//-------
$table = new CTableInfo(S_NO_ACTIONS_FOUND);
$table->setHeader(array(is_show_all_nodes() ? S_NODES : null, S_TIME, S_TYPE, S_STATUS, S_RETRIES_LEFT, S_RECIPIENTS, S_MESSAGE, S_ERROR));
$effectiveperiod = navigation_bar_calc('web.auditacts.timeline', 0, true);
$bstime = $_REQUEST['stime'];
$from = zbxDateToTime($_REQUEST['stime']);
Exemple #14
0
/**
 * Create report bar for for "Compare values for multiple periods"
 *
 * @return object $reportForm
 */
function valueComparisonFormForMultiplePeriods()
{
    $config = get_request('config', 1);
    $title = get_request('title', _('Report 3'));
    $xlabel = get_request('xlabel', '');
    $ylabel = get_request('ylabel', '');
    $scaletype = get_request('scaletype', TIMEPERIOD_TYPE_WEEKLY);
    $avgperiod = get_request('avgperiod', TIMEPERIOD_TYPE_DAILY);
    $report_timesince = get_request('report_timesince', date(TIMESTAMP_FORMAT_ZERO_TIME, time() - SEC_PER_DAY));
    $report_timetill = get_request('report_timetill', date(TIMESTAMP_FORMAT_ZERO_TIME));
    $itemId = get_request('itemid', 0);
    $hostids = get_request('hostids', array());
    $hostids = zbx_toHash($hostids);
    $showlegend = get_request('showlegend', 0);
    $palette = get_request('palette', 0);
    $palettetype = get_request('palettetype', 0);
    $reportForm = new CFormTable(null, null, 'get');
    $reportForm->setAttribute('name', 'zbx_report');
    $reportForm->setAttribute('id', 'zbx_report');
    if (isset($_REQUEST['report_show']) && $itemId) {
        $reportForm->addVar('report_show', 'show');
    }
    $reportForm->addVar('config', $config);
    $reportForm->addVar('report_timesince', date(TIMESTAMP_FORMAT, $report_timesince));
    $reportForm->addVar('report_timetill', date(TIMESTAMP_FORMAT, $report_timetill));
    $reportForm->addRow(_('Title'), new CTextBox('title', $title, 40));
    $reportForm->addRow(_('X label'), new CTextBox('xlabel', $xlabel, 40));
    $reportForm->addRow(_('Y label'), new CTextBox('ylabel', $ylabel, 40));
    $reportForm->addRow(_('Legend'), new CCheckBox('showlegend', $showlegend, null, 1));
    $reportForm->addVar('sortorder', 0);
    $groupids = get_request('groupids', array());
    $group_tb = new CTweenBox($reportForm, 'groupids', $groupids, 10);
    $options = array('real_hosts' => true, 'output' => 'extend');
    $db_groups = API::HostGroup()->get($options);
    order_result($db_groups, 'name');
    foreach ($db_groups as $gnum => $group) {
        $groupids[$group['groupid']] = $group['groupid'];
        $group_tb->addItem($group['groupid'], $group['name']);
    }
    $reportForm->addRow(_('Groups'), $group_tb->Get(_('Selected groups'), _('Other groups')));
    $groupid = get_request('groupid', 0);
    $cmbGroups = new CComboBox('groupid', $groupid, 'submit()');
    $cmbGroups->addItem(0, _('All'));
    foreach ($db_groups as $gnum => $group) {
        $cmbGroups->addItem($group['groupid'], $group['name']);
    }
    $td_groups = new CCol(array(_('Group'), SPACE, $cmbGroups));
    $td_groups->setAttribute('style', 'text-align: right;');
    $host_tb = new CTweenBox($reportForm, 'hostids', $hostids, 10);
    $options = array('real_hosts' => true, 'output' => array('hostid', 'name'));
    if ($groupid > 0) {
        $options['groupids'] = $groupid;
    }
    $db_hosts = API::Host()->get($options);
    $db_hosts = zbx_toHash($db_hosts, 'hostid');
    order_result($db_hosts, 'name');
    foreach ($db_hosts as $hnum => $host) {
        $host_tb->addItem($host['hostid'], $host['name']);
    }
    $options = array('real_hosts' => true, 'output' => array('hostid', 'name'), 'hostids' => $hostids);
    $db_hosts2 = API::Host()->get($options);
    order_result($db_hosts2, 'name');
    foreach ($db_hosts2 as $hnum => $host) {
        if (!isset($db_hosts[$host['hostid']])) {
            $host_tb->addItem($host['hostid'], $host['name']);
        }
    }
    $reportForm->addRow(_('Hosts'), $host_tb->Get(_('Selected hosts'), array(_('Other hosts | Group') . SPACE, $cmbGroups)));
    $reporttimetab = new CTable(null, 'calendar');
    $timeSinceRow = createDateSelector('report_timesince', $report_timesince, 'report_timetill');
    array_unshift($timeSinceRow, _('From'));
    $reporttimetab->addRow($timeSinceRow);
    $timeTillRow = createDateSelector('report_timetill', $report_timetill, 'report_timesince');
    array_unshift($timeTillRow, _('Till'));
    $reporttimetab->addRow($timeTillRow);
    $reportForm->addRow(_('Period'), $reporttimetab);
    $scale = new CComboBox('scaletype', $scaletype);
    $scale->addItem(TIMEPERIOD_TYPE_HOURLY, _('Hourly'));
    $scale->addItem(TIMEPERIOD_TYPE_DAILY, _('Daily'));
    $scale->addItem(TIMEPERIOD_TYPE_WEEKLY, _('Weekly'));
    $scale->addItem(TIMEPERIOD_TYPE_MONTHLY, _('Monthly'));
    $scale->addItem(TIMEPERIOD_TYPE_YEARLY, _('Yearly'));
    $reportForm->addRow(_('Scale'), $scale);
    $avgcmb = new CComboBox('avgperiod', $avgperiod);
    $avgcmb->addItem(TIMEPERIOD_TYPE_HOURLY, _('Hourly'));
    $avgcmb->addItem(TIMEPERIOD_TYPE_DAILY, _('Daily'));
    $avgcmb->addItem(TIMEPERIOD_TYPE_WEEKLY, _('Weekly'));
    $avgcmb->addItem(TIMEPERIOD_TYPE_MONTHLY, _('Monthly'));
    $avgcmb->addItem(TIMEPERIOD_TYPE_YEARLY, _('Yearly'));
    $reportForm->addRow(_('Average by'), $avgcmb);
    $itemName = '';
    if ($itemId) {
        $itemName = get_item_by_itemid($itemId);
        $itemName = itemName($itemName);
    }
    $itemidVar = new CVar('itemid', $itemId, 'itemid');
    $reportForm->addItem($itemidVar);
    $txtCondVal = new CTextBox('item_name', $itemName, 50, 'yes');
    $txtCondVal->setAttribute('id', 'item_name');
    $btnSelect = new CButton('btn1', _('Select'), 'return PopUp("popup.php?dstfrm=' . $reportForm->GetName() . '&dstfld1=itemid' . '&dstfld2=item_name' . '&srctbl=items' . '&srcfld1=itemid' . '&srcfld2=name' . '&monitored_hosts=1");', 'T');
    $reportForm->addRow(_('Item'), array($txtCondVal, $btnSelect));
    $paletteCmb = new CComboBox('palette', $palette);
    $paletteCmb->addItem(0, _s('Palette #%1$s', 1));
    $paletteCmb->addItem(1, _s('Palette #%1$s', 2));
    $paletteCmb->addItem(2, _s('Palette #%1$s', 3));
    $paletteCmb->addItem(3, _s('Palette #%1$s', 4));
    $paletteTypeCmb = new CComboBox('palettetype', $palettetype);
    $paletteTypeCmb->addItem(0, _('Middle'));
    $paletteTypeCmb->addItem(1, _('Darken'));
    $paletteTypeCmb->addItem(2, _('Brighten'));
    $reportForm->addRow(_('Palette'), array($paletteCmb, $paletteTypeCmb));
    $reportForm->addItemToBottomRow(new CSubmit('report_show', _('Show')));
    $reset = new CButton('reset', _('Reset'));
    $reset->setType('reset');
    $reportForm->addItemToBottomRow($reset);
    return $reportForm;
}
     $name = get_request('name', '');
     $iprange = get_request('iprange', '192.168.0.1-255');
     $delay = get_request('delay', 3600);
     $status = get_request('status', DRULE_STATUS_ACTIVE);
     $dchecks = get_request('dchecks', array());
     $dchecks_deleted = get_request('dchecks_deleted', array());
 }
 $new_check_type = get_request('new_check_type', SVC_HTTP);
 $new_check_ports = get_request('new_check_ports', '80');
 $new_check_key = get_request('new_check_key', '');
 $new_check_snmp_community = get_request('new_check_snmp_community', '');
 $new_check_snmpv3_securitylevel = get_request('new_check_snmpv3_securitylevel', ITEM_SNMPV3_SECURITYLEVEL_NOAUTHNOPRIV);
 $new_check_snmpv3_securityname = get_request('new_check_snmpv3_securityname', '');
 $new_check_snmpv3_authpassphrase = get_request('new_check_snmpv3_authpassphrase', '');
 $new_check_snmpv3_privpassphrase = get_request('new_check_snmpv3_privpassphrase', '');
 $form->addRow(S_NAME, new CTextBox('name', $name, 40));
 $cmbProxy = new CComboBox('proxy_hostid', $proxy_hostid);
 $cmbProxy->addItem(0, S_NO_PROXY);
 $sql = 'SELECT hostid, host ' . ' FROM hosts' . ' WHERE status IN (' . HOST_STATUS_PROXY_ACTIVE . ',' . HOST_STATUS_PROXY_PASSIVE . ') ' . ' AND ' . DBin_node('hostid') . ' ORDER BY host';
 $db_proxies = DBselect($sql);
 while ($db_proxy = DBfetch($db_proxies)) {
     $cmbProxy->addItem($db_proxy['hostid'], $db_proxy['host']);
 }
 $form->addRow(S_DISCOVERY_BY_PROXY, $cmbProxy);
 $form->addRow(S_IP_RANGE, new CTextBox('iprange', $iprange, 27));
 $form->addRow(S_DELAY . SPACE . S_SECOND_IN_PARENTHESES, new CNumericBox('delay', $delay, 8));
 $form->addVar('dchecks', $dchecks);
 $form->addVar('dchecks_deleted', $dchecks_deleted);
 $cmbUniquenessCriteria = new CComboBox('uniqueness_criteria', $uniqueness_criteria);
 $cmbUniquenessCriteria->addItem(-1, S_IP_ADDRESS);
 foreach ($dchecks as $id => $data) {
Exemple #16
0
        $value = '';
    }
    $frmLcls->addItemToBottomRow(new CButton('prev', '<< ' . S_PREVIOUS));
    $frmLcls->addItemToBottomRow(SPACE);
    $frmLcls->addItemToBottomRow(new CButton('download', S_DOWNLOAD));
    $frmLcls->show();
} else {
    show_table_header(S_LOCALES);
    echo SBR;
    $frmLcls = new CFormTable(S_CREATE . SPACE . S_LOCALE_SMALL, 'locales.php', 'post', null, 'form');
    $frmLcls->setAttribute('id', 'locales');
    $cmbLang = new CComboBox('srclang', get_request('srclang', 'en_gb'));
    foreach ($ZBX_LOCALES as $id => $name) {
        $cmbLang->addItem($id, $name);
    }
    $frmLcls->addRow(S_TAKE_DEF_LOCALE, $cmbLang);
    $cmbExtLang = new CComboBox('extlang', get_request('extlang', 'new'));
    $cmbExtLang->addItem('new', S_CREATE . SPACE . S_NEW_SMALL);
    foreach ($ZBX_LOCALES as $id => $name) {
        $cmbExtLang->addItem($id, $name);
    }
    $frmLcls->addRow(S_LOCALE_TO_EXTEND, $cmbExtLang);
    $cmbFill = new CComboBox('fill', get_request('fill', 1));
    $cmbFill->addItem('0', S_DO_NOT_ADD);
    $cmbFill->addItem('1', S_LEAVE_EMPTY);
    $cmbFill->addItem('2', S_FILL_WITH_DEFAULT_VALUE);
    $frmLcls->addRow(S_NEW_ENTRIES, $cmbFill);
    $frmLcls->addItemToBottomRow(new CButton('next', S_NEXT . ' >>'));
    $frmLcls->show();
}
include_once "include/page_footer.php";
                    $usr_test->addItem($db_user['alias'], $db_user['alias']);
                }
            }
        } else {
            $usr_test = new CTextBox('user', $USER_DETAILS['alias'], null, 'yes');
        }
        $frmAuth->addRow(S_LOGIN, $usr_test);
        $frmAuth->addRow(S_USER . SPACE . S_PASSWORD, new CPassBox('user_password'));
        $frmAuth->addItemToBottomRow(new CButton('save', S_SAVE));
        $frmAuth->addItemToBottomRow(new CButton('test', S_TEST));
        $frmAuth->Show();
    } else {
        if (ZBX_AUTH_HTTP == $_REQUEST['config']) {
            $form_refresh_http = get_request('form_refresh_http', 0);
            $form_refresh_http++;
            $frmAuth = new CFormTable(S_HTTP_AUTH, 'authentication.php');
            $frmAuth->SetHelp('web.authentication.php');
            $frmAuth->addVar('form_refresh_http', $form_refresh_http);
            $cmbConfig = new CCombobox('config', ZBX_AUTH_HTTP, 'submit()');
            $cmbConfig->addItem(ZBX_AUTH_INTERNAL, S_INTERNAL_S);
            $cmbConfig->addItem(ZBX_AUTH_LDAP, S_LDAP);
            $cmbConfig->addItem(ZBX_AUTH_HTTP, S_HTTP);
            $frmAuth->addRow(S_DEFAULT_AUTHENTICATION, $cmbConfig);
            $action = "javascript: if(confirm('" . S_SWITCHING_HTTP . "')) return true; else return false;";
            $frmAuth->addRow(S_HTTP_AUTH . SPACE . S_ENABLED, new CCheckBox('authentication_type', ZBX_AUTH_HTTP == $config['authentication_type'], $action, ZBX_AUTH_HTTP));
            $frmAuth->addItemToBottomRow(new CButton('save', S_SAVE));
            $frmAuth->Show();
        }
    }
}
include_once 'include/page_footer.php';
Exemple #18
0
    $ev_select->addItem(EVENTS_OPTION_NOT_ACK, S_SHOW_UNACKNOWLEDGED . SPACE . '(' . $config['event_expire'] . SPACE . ($config['event_expire'] > 1 ? S_DAYS : S_DAY) . ')');
}
if (EVENTS_OPTION_ONLYTRUE_NOTACK && $config['event_ack_enable']) {
    $ev_select->addItem(EVENTS_OPTION_ONLYTRUE_NOTACK, S_SHOW_PROBLEM_UNACKNOWLEDGED . SPACE . '(' . $config['event_expire'] . SPACE . ($config['event_expire'] > 1 ? S_DAYS : S_DAY) . ')');
}
//------- JP -------
if ($show_triggers == TRIGGERS_OPTION_NOFALSEFORB) {
    $ev_select->addItem(EVENTS_OPTION_NOFALSEFORB, ' - ', 'yes');
    $ev_select->setAttribute('disabled', 'disabled');
    $ev_status = new CComboBox('show_events_status', $show_events_status, 'javascript: submit();');
    $ev_status->addItem(EVENTS_NOFALSEFORB_STATUS_ALL, S_SHOW_ALL);
    $ev_status->addItem(EVENTS_NOFALSEFORB_STATUS_FALSE, S_SHOW_ONLY_FALSE);
    $ev_status->addItem(EVENTS_NOFALSEFORB_STATUS_TRUE, S_SHOW_ONLY_TRUE);
}
//---
$filterForm->addRow(S_TRIGGERS, $tr_select);
// JP
if ($show_triggers == TRIGGERS_OPTION_NOFALSEFORB) {
    $filterForm->addRow(S_STATUS, $ev_status);
    $filterForm->addVar('show_events', $show_events);
} else {
    $filterForm->addRow(S_EVENTS, $ev_select);
    $filterForm->addVar('show_events_status', $show_events_status);
}
$severity_select = new CComboBox('show_severity', $show_severity, 'javasctipt: submit();');
$severity_select->addItem(-1, S_ALL_S);
$severity_select->addItem(TRIGGER_SEVERITY_NOT_CLASSIFIED, S_NOT_CLASSIFIED);
$severity_select->addItem(TRIGGER_SEVERITY_INFORMATION, S_INFORMATION);
$severity_select->addItem(TRIGGER_SEVERITY_WARNING, S_WARNING);
$severity_select->addItem(TRIGGER_SEVERITY_AVERAGE, S_AVERAGE);
$severity_select->addItem(TRIGGER_SEVERITY_HIGH, S_HIGH);
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
require_once dirname(__FILE__) . '/js/common.filter.trigger.js.php';
$overview = $this->data['overview'];
$filter = $this->data['filter'];
$config = select_config();
$filterForm = new CFormTable(null, null, 'get');
$filterForm->setTableClass('formtable old-filter');
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
$filterForm->addVar('fullscreen', $filter['fullScreen']);
$filterForm->addVar('groupid', $filter['groupId']);
$filterForm->addVar('hostid', $filter['hostId']);
// trigger status
$filterForm->addRow(_('Triggers status'), new CComboBox('show_triggers', $filter['showTriggers'], null, array(TRIGGERS_OPTION_ALL => _('Any'), TRIGGERS_OPTION_RECENT_PROBLEM => _('Recent problem'), TRIGGERS_OPTION_IN_PROBLEM => _('Problem'))));
// ack status
if ($config['event_ack_enable']) {
    $filterForm->addRow(_('Acknowledge status'), new CComboBox('ack_status', $filter['ackStatus'], null, array(ZBX_ACK_STS_ANY => _('Any'), ZBX_ACK_STS_WITH_UNACK => _('With unacknowledged events'), ZBX_ACK_STS_WITH_LAST_UNACK => _('With last event unacknowledged'))));
}
// events
if (!$overview) {
    $eventsComboBox = new CComboBox('show_events', $filter['showEvents'], null, array(EVENTS_OPTION_NOEVENT => _('Hide all'), EVENTS_OPTION_ALL => _n('Show all (%1$s day)', 'Show all (%1$s days)', $config['event_expire'])));
    if ($config['event_ack_enable']) {
        $eventsComboBox->addItem(EVENTS_OPTION_NOT_ACK, _n('Show unacknowledged (%1$s day)', 'Show unacknowledged (%1$s days)', $config['event_expire']));
    }
    $filterForm->addRow(_('Events'), $eventsComboBox);
}
// min severity
$filterForm->addRow(_('Minimum trigger severity'), new CComboBox('show_severity', $filter['showSeverity'], null, array(TRIGGER_SEVERITY_NOT_CLASSIFIED => getSeverityCaption(TRIGGER_SEVERITY_NOT_CLASSIFIED), TRIGGER_SEVERITY_INFORMATION => getSeverityCaption(TRIGGER_SEVERITY_INFORMATION), TRIGGER_SEVERITY_WARNING => getSeverityCaption(TRIGGER_SEVERITY_WARNING), TRIGGER_SEVERITY_AVERAGE => getSeverityCaption(TRIGGER_SEVERITY_AVERAGE), TRIGGER_SEVERITY_HIGH => getSeverityCaption(TRIGGER_SEVERITY_HIGH), TRIGGER_SEVERITY_DISASTER => getSeverityCaption(TRIGGER_SEVERITY_DISASTER))));
// age less than
Exemple #20
0
 }
 if (isset($_REQUEST['tpl_triggerid']) && !empty($_REQUEST['tpl_triggerid'])) {
     $triggerOptions['filter']['templateid'] = $_REQUEST['tpl_triggerid'];
 }
 if (isset($_REQUEST['hostgroupid']) && !empty($_REQUEST['hostgroupid'])) {
     $triggerOptions['groupids'] = $_REQUEST['hostgroupid'];
 }
 // filter template group
 $groupsComboBox = new CComboBox('filter_groupid', $_REQUEST['filter_groupid'], 'javascript: submit();');
 $groupsComboBox->addItem(0, _('all'));
 $groups = API::HostGroup()->get(array('output' => array('groupid', 'name'), 'templated_hosts' => true, 'with_triggers' => true));
 order_result($groups, 'name');
 foreach ($groups as $group) {
     $groupsComboBox->addItem($group['groupid'], $group['name']);
 }
 $filterForm->addRow(_('Template group'), $groupsComboBox);
 // filter template
 $templateComboBox = new CComboBox('filter_hostid', $_REQUEST['filter_hostid'], 'javascript: submit();');
 $templateComboBox->addItem(0, _('all'));
 $templates = API::Template()->get(array('output' => array('templateid', 'name'), 'groupids' => empty($_REQUEST['filter_groupid']) ? null : $_REQUEST['filter_groupid'], 'with_triggers' => true));
 order_result($templates, 'name');
 $templateIds = array();
 foreach ($templates as $template) {
     $templateIds[$template['templateid']] = $template['templateid'];
     $templateComboBox->addItem($template['templateid'], $template['name']);
 }
 $filterForm->addRow(_('Template'), $templateComboBox);
 // filter trigger
 $triggerComboBox = new CComboBox('tpl_triggerid', getRequest('tpl_triggerid', 0), 'javascript: submit()');
 $triggerComboBox->addItem(0, _('all'));
 $sqlCondition = empty($_REQUEST['filter_hostid']) ? ' AND ' . dbConditionInt('h.hostid', $templateIds) : ' AND h.hostid=' . zbx_dbstr($_REQUEST['filter_hostid']);
$media = get_request('media', -1);
$sendto = get_request('sendto', '');
$mediatypeid = get_request('mediatypeid', 0);
$active = get_request('active', 0);
$period = get_request('period', '1-7,00:00-23:59');
$frmMedia = new CFormTable(S_NEW_MEDIA);
$frmMedia->SetHelp('web.media.php');
$frmMedia->addVar('media', $media);
$frmMedia->addVar('dstfrm', $_REQUEST['dstfrm']);
$cmbType = new CComboBox('mediatypeid', $mediatypeid);
$sql = 'SELECT mediatypeid,description ' . ' FROM media_type' . ' WHERE ' . DBin_node('mediatypeid') . ' ORDER BY type';
$types = DBselect($sql);
while ($type = DBfetch($types)) {
    $cmbType->addItem($type['mediatypeid'], get_node_name_by_elid($type['mediatypeid'], null, ': ') . $type['description']);
}
$frmMedia->addRow(S_TYPE, $cmbType);
$frmMedia->addRow(S_SEND_TO, new CTextBox('sendto', $sendto, 20));
$frmMedia->addRow(S_WHEN_ACTIVE, new CTextBox('period', $period, 48));
$frm_row = array();
for ($i = 0; $i <= 5; $i++) {
    array_push($frm_row, array(new CCheckBox('severity[' . $i . ']', str_in_array($i, $severity) ? 'yes' : 'no', null, $i), get_severity_description($i)), BR());
}
$frmMedia->addRow(S_USE_IF_SEVERITY, $frm_row);
$cmbStat = new CComboBox('active', $active);
$cmbStat->addItem(0, S_ENABLED);
$cmbStat->addItem(1, S_DISABLED);
$frmMedia->addRow(S_STATUS, $cmbStat);
$frmMedia->addItemToBottomRow(new CButton('add', $media > -1 ? S_SAVE : S_ADD));
$frmMedia->addItemToBottomRow(SPACE);
$frmMedia->addItemToBottomRow(new CButtonCancel(null, 'close_window();'));
$frmMedia->Show();
 echo SBR;
 $frmPd = new CFormTable(_('Period'));
 $frmPd->setName('period');
 $frmPd->addVar('dstfrm', $_REQUEST['dstfrm']);
 $config = get_request('config', 1);
 $caption = get_request('caption', '');
 $color = get_request('color', '009900');
 $report_timesince = get_request('report_timesince', time() - SEC_PER_DAY);
 $report_timetill = get_request('report_timetill', time());
 $frmPd->addVar('config', $config);
 $frmPd->addVar('report_timesince', date('YmdHis', $report_timesince));
 $frmPd->addVar('report_timetill', date('YmdHis', $report_timetill));
 if (isset($_REQUEST['period_id'])) {
     $frmPd->addVar('period_id', $_REQUEST['period_id']);
 }
 $frmPd->addRow(array(new CVisibilityBox('caption_visible', !zbx_empty($caption), 'caption', _('Default')), _('Caption')), new CTextBox('caption', $caption, 42));
 $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->setAttribute('width', '10%');
 $reporttimetab->setCellPadding(0);
 $reporttimetab->setCellSpacing(0);
 $reporttimetab->addRow(array(_('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(_('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");');
 $frmPd->addRow(_('Period'), $reporttimetab);
 //*/
 if ($config != 1) {
     $frmPd->addRow(_('Colour'), new CColor('color', $color));
Exemple #23
0
 $list_name = get_request('list_name', null);
 $caption = get_request('caption', '');
 $itemid = get_request('itemid', 0);
 $color = get_request('color', '009900');
 $calc_fnc = get_request('calc_fnc', 2);
 $axisside = get_request('axisside', GRAPH_YAXIS_SIDE_LEFT);
 $description = '';
 if ($itemid > 0) {
     $description = get_item_by_itemid($itemid);
     $description = item_description($description);
 }
 $frmGItem->addVar('gid', $gid);
 $frmGItem->addVar('config', $config);
 $frmGItem->addVar('list_name', $list_name);
 $frmGItem->addVar('itemid', $itemid);
 $frmGItem->addRow(array(new CVisibilityBox('caption_visible', !zbx_empty($caption), 'caption', S_DEFAULT), S_CAPTION), new CTextBox('caption', $caption, 32));
 //		$frmGItem->addRow(S_CAPTION, new CTextBox('caption',$caption,10));
 $txtCondVal = new CTextBox('description', $description, 50, 'yes');
 $btnSelect = new CButton('btn1', S_SELECT, "return PopUp('popup.php?dstfrm=" . $frmGItem->GetName() . '&dstfld1=itemid&dstfld2=description&srctbl=items' . "&srcfld1=itemid&srcfld2=description&monitored_hosts=1');", 'T');
 $frmGItem->addRow(S_PARAMETER, array($txtCondVal, $btnSelect));
 $cmbFnc = new CComboBox('calc_fnc', $calc_fnc);
 $cmbFnc->addItem(CALC_FNC_MIN, S_MIN_SMALL);
 $cmbFnc->addItem(CALC_FNC_AVG, S_AVG_SMALL);
 $cmbFnc->addItem(CALC_FNC_MAX, S_MAX_SMALL);
 $cmbFnc->addItem(0, S_COUNT);
 $frmGItem->addRow(S_FUNCTION, $cmbFnc);
 if ($config == 1) {
     $cmbAxis = new CComboBox('axisside', $axisside);
     $cmbAxis->addItem(GRAPH_YAXIS_SIDE_LEFT, S_LEFT);
     $cmbAxis->addItem(GRAPH_YAXIS_SIDE_RIGHT, S_RIGHT);
     $frmGItem->addRow(S_AXIS_SIDE, $cmbAxis);
$cmbConf->addItem('auditlogs.php', S_LOGS);
$cmbConf->addItem('auditacts.php', S_ACTIONS);
$frmForm->addItem($cmbConf);
$audit_wdgt->addPageHeader(S_AUDIT_LOGS_BIG, $frmForm);
$numrows = new CDiv();
$numrows->setAttribute('name', 'numrows');
$audit_wdgt->addHeader(S_LOGS_BIG);
$audit_wdgt->addHeader($numrows);
//--------
/************************* FILTER **************************/
/***********************************************************/
$filterForm = new CFormTable();
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
$row = new CRow(array(new CCol(S_USER, 'form_row_l'), new CCol(array(new CTextBox('alias', $_REQUEST['alias'], 32), new CButton('btn1', S_SELECT, "return PopUp('popup.php?" . "dstfrm=" . $filterForm->GetName() . "&dstfld1=alias&srctbl=users&srcfld1=alias&real_hosts=1');", 'T')), 'form_row_r')));
$filterForm->addRow($row);
$cmbAction = new CComboBox('action', $_REQUEST['action']);
$cmbAction->addItem(-1, S_ALL_S);
$cmbAction->addItem(AUDIT_ACTION_LOGIN, S_LOGIN);
$cmbAction->addItem(AUDIT_ACTION_LOGOUT, S_LOGOUT);
$cmbAction->addItem(AUDIT_ACTION_ADD, S_ADD);
$cmbAction->addItem(AUDIT_ACTION_UPDATE, S_UPDATE);
$cmbAction->addItem(AUDIT_ACTION_DELETE, S_DELETE);
$cmbAction->addItem(AUDIT_ACTION_ENABLE, S_ENABLE);
$cmbAction->addItem(AUDIT_ACTION_DISABLE, S_DISABLE);
$filterForm->addRow(S_ACTION, $cmbAction);
$cmbResource = new CComboBox('resourcetype', $_REQUEST['resourcetype']);
$resources = array(-1 => S_ALL_S) + audit_resource2str();
$cmbResource->addItems($resources);
$filterForm->addRow(S_RESOURCE, $cmbResource);
$reset = new CButton('filter_rst', S_RESET);
Exemple #25
0
 echo SBR;
 global $USER_DETAILS;
 $groupid = get_request('groupid', 0);
 $hosts = get_request('hosts', array());
 SDII($hosts);
 $frm_title = S_HOST_GROUP;
 if ($groupid > 0) {
     $group = get_hostgroup_by_groupid($_REQUEST['groupid']);
     $name = $group['name'];
     $frm_title .= ' [' . $group['name'] . ']';
 } else {
     $name = '';
 }
 $frmHostG = new CFormTable($frm_title, 'hostgroups.php');
 $frmHostG->setName('hg_form');
 $frmHostG->addRow(S_GROUP_NAME, new CTextBox('gname', $name, 48));
 if ($groupid > 0) {
     $frmHostG->addVar('groupid', $_REQUEST['groupid']);
     // if first time select all hosts for group from db
     if (!isset($_REQUEST['form_refresh'])) {
         $params = array('groupids' => $groupid, 'editable' => 1, 'order' => 'host', 'templated_hosts' => 1);
         $db_hosts = CHost::get($params);
         foreach ($db_hosts as $hostid => $db_host) {
             $hosts[$hostid] = $hostid;
         }
     }
 }
 // select all possible groups
 $params = array('not_proxy_host' => 1, 'order' => 'name', 'editable' => 1, 'extendoutput' => 1);
 $db_groups = CHostGroup::get($params);
 $twb_groupid = get_request('twb_groupid', 0);
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', S_REPORT . ' 3');
    $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', date('YmdHis', time() - 86400));
    $report_timetill = get_request('report_timetill', date('YmdHis'));
    $captions = get_request('captions', array());
    $items = get_request('items', array());
    $hostids = get_request('hostids', array());
    $hostids = zbx_toHash($hostids);
    $showlegend = get_request('showlegend', 0);
    $palette = get_request('palette', 0);
    $palettetype = get_request('palettetype', 0);
    $reportForm = new CFormTable(null, null, 'get');
    //,'events.php?report_set=1','POST',null,'sform');
    $reportForm->setAttribute('name', 'zbx_report');
    $reportForm->setAttribute('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', date('YmdHis', $report_timesince));
    $reportForm->addVar('report_timetill', date('YmdHis', $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', $groupids, 10);
    $options = array('real_hosts' => 1, 'output' => 'extend');
    $db_groups = CHostGroup::get($options);
    order_result($db_groups, 'name');
    foreach ($db_groups as $gnum => $group) {
        $groupids[$group['groupid']] = $group['groupid'];
        $group_tb->addItem($group['groupid'], $group['name']);
    }
    $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');
    $groupid = get_request('groupid', 0);
    $cmbGroups = new CComboBox('groupid', $groupid, 'submit()');
    $cmbGroups->addItem(0, S_ALL_S);
    foreach ($db_groups as $gnum => $group) {
        $cmbGroups->addItem($group['groupid'], $group['name']);
    }
    $td_groups = new CCol(array(S_GROUP, SPACE, $cmbGroups));
    $td_groups->setAttribute('style', 'text-align: right;');
    $host_tb = new CTweenBox($reportForm, 'hostids', $hostids, 10);
    $options = array('real_hosts' => 1, 'output' => array('hostid', 'host'));
    if ($groupid > 0) {
        $options['groupids'] = $groupid;
    }
    $db_hosts = CHost::get($options);
    $db_hosts = zbx_toHash($db_hosts, 'hostid');
    order_result($db_hosts, 'host');
    foreach ($db_hosts as $hnum => $host) {
        $host_tb->addItem($host['hostid'], $host['host']);
    }
    $options = array('real_hosts' => 1, 'output' => array('hostid', 'host'), 'hostids' => $hostids);
    $db_hosts2 = CHost::get($options);
    order_result($db_hosts2, 'host');
    foreach ($db_hosts2 as $hnum => $host) {
        if (!isset($db_hosts[$host['hostid']])) {
            $host_tb->addItem($host['hostid'], $host['host']);
        }
    }
    $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->setAttribute('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;
}
//------------------------ <ACTIONS> ---------------------------
if (isset($_REQUEST['test_expression'])) {
    show_messages();
    $test = true;
} else {
    $test = false;
}
//------------------------ </ACTIONS> --------------------------
//------------------------ <FORM> ---------------------------
$frm_test = new CFormTable(_('Test'), 'tr_testexpr.php');
$frm_test->setHelp('web.testexpr.service.php');
$frm_test->setTableClass('formlongtable formtable');
$frm_test->addVar('form_refresh', get_request('form_refresh', 1));
$frm_test->addVar('expression', $expression);
/* test data */
$frm_test->addRow(_('Test data'), $data_table);
/* result */
$res_table = new CTable(null, 'tableinfo');
$res_table->setAttribute('id', 'result_list');
$res_table->setOddRowClass('even_row');
$res_table->setEvenRowClass('even_row');
$res_table->setHeader(array(_('Expression'), _('Result')));
ksort($rplcts, SORT_NUMERIC);
foreach ($eHTMLTree as $e) {
    $result = '-';
    if ($allowedTesting && $test && isset($e['expression'])) {
        $result = evalExpressionData($e['expression']['value'], $macrosData, $octet);
    }
    $style = 'text-align: center;';
    if ($result != '-') {
        $style = $result == 'TRUE' ? 'background-color: #ccf; color: #00f;' : 'background-color: #fcc; color: #f00;';
Exemple #28
0
        $url = is_null($request) ? $USER_DETAILS['url'] : $request;
        redirect($url);
        exit;
    }
}
include_once 'include/page_header.php';
if (isset($_REQUEST['message'])) {
    show_error_message($_REQUEST['message']);
}
if (!isset($sessionid) || $USER_DETAILS['alias'] == ZBX_GUEST_USER) {
    switch ($authentication_type) {
        case ZBX_AUTH_HTTP:
            break;
        case ZBX_AUTH_LDAP:
        case ZBX_AUTH_INTERNAL:
        default:
            //	konqueror bug #138024; adding useless param(login=1) to the form's action path to avoid bug!!
            $frmLogin = new CFormTable('Login', 'index.php?login=1', 'post', 'multipart/form-data');
            $frmLogin->setHelp('web.index.login');
            $frmLogin->addVar('request', $request);
            $frmLogin->addRow('Login name', new CTextBox('name'));
            $frmLogin->addRow('Password', new CPassBox('password'));
            $frmLogin->addItemToBottomRow(new CButton('enter', 'Enter'));
            $frmLogin->show(false);
            setFocus($frmLogin->getName(), 'name');
            $frmLogin->destroy();
    }
} else {
    echo '<div align="center" class="textcolorstyles">Welcome to ZABBIX! You are connected as <b>' . $USER_DETAILS['alias'] . '</b>.</div>';
}
include_once 'include/page_footer.php';
Exemple #29
0
 $frmGItem->addVar('list_name', $list_name);
 $frmGItem->addVar('itemid', $itemid);
 $frmGItem->addVar('graphtype', $graphtype);
 $frmGItem->addVar('only_hostid', $only_hostid);
 $txtCondVal = new CTextBox('description', $description, 50, 'yes');
 $host_condition = '';
 if (isset($only_hostid)) {
     // graph for template must use only one host
     $host_condition = "&only_hostid=" . $only_hostid;
 } else {
     if (isset($monitored_hosts)) {
         $host_condition = "&monitored_hosts=1";
     }
 }
 $btnSelect = new CButton('btn1', S_SELECT, "return PopUp('popup.php?dstfrm=" . $frmGItem->GetName() . "&dstfld1=itemid&dstfld2=description&" . "srctbl=items&srcfld1=itemid&srcfld2=description" . $host_condition . "');", 'T');
 $frmGItem->addRow(S_PARAMETER, array($txtCondVal, $btnSelect));
 if ($graphtype == GRAPH_TYPE_NORMAL) {
     $cmbType = new CComboBox('type', $type, 'submit()');
     $cmbType->addItem(GRAPH_ITEM_SIMPLE, S_SIMPLE);
     $cmbType->addItem(GRAPH_ITEM_AGGREGATED, S_AGGREGATED);
     $frmGItem->addRow(S_TYPE, $cmbType);
 } else {
     if ($graphtype == GRAPH_TYPE_PIE || $graphtype == GRAPH_TYPE_EXPLODED) {
         $cmbType = new CComboBox('type', $type, 'submit()');
         $cmbType->addItem(GRAPH_ITEM_SIMPLE, S_SIMPLE);
         $cmbType->addItem(GRAPH_ITEM_SUM, S_GRAPH_SUM);
         $frmGItem->addRow(S_TYPE, $cmbType);
     } else {
         $frmGItem->addVar('type', GRAPH_ITEM_SIMPLE);
     }
 }
Exemple #30
0
/************************* FILTER **************************/
/***********************************************************/
$filterForm = new CFormTable();
//,'events.php?filter_set=1','POST',null,'sform');
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
//	$filterForm->setMethod('get');
$filterForm->addVar('nav_time', $_REQUEST['nav_time']);
$script = new CScript("javascript: if(CLNDR['nav_time'].clndr.setSDateFromOuterObj()){" . "\$('nav_time').value = parseInt(CLNDR['nav_time'].clndr.sdt.getTime()/1000); }");
$filterForm->addAction('onsubmit', $script);
$clndr_icon = new CImg('images/general/bar/cal.gif', 'calendar', 16, 12, 'pointer');
$clndr_icon->addAction('onclick', "javascript: var pos = getPosition(this); pos.top+=14; pos.left-=174; CLNDR['nav_time'].clndr.clndrshow(pos.top,pos.left);");
$clndr_icon->setAttribute('style', 'vertical-align: middle;');
$nav_clndr = array(new CNumericBox('nav_day', $_REQUEST['nav_time'] > 0 ? date('d', $_REQUEST['nav_time']) : '', 2), new CNumericBox('nav_month', $_REQUEST['nav_time'] > 0 ? date('m', $_REQUEST['nav_time']) : '', 2), new CNumericBox('nav_year', $_REQUEST['nav_time'] > 0 ? date('Y', $_REQUEST['nav_time']) : '', 4), SPACE, new CNumericBox('nav_hour', $_REQUEST['nav_time'] > 0 ? date('H', $_REQUEST['nav_time']) : '', 2), ':', new CNumericBox('nav_minute', $_REQUEST['nav_time'] > 0 ? date('i', $_REQUEST['nav_time']) : '', 2), $clndr_icon);
zbx_add_post_js('create_calendar(null,["nav_day","nav_month","nav_year","nav_hour","nav_minute"],"nav_time");');
$filterForm->addRow(S_EVENTS_BEFORE, $nav_clndr);
if (EVENT_SOURCE_TRIGGERS == $source) {
    $filterForm->addVar('triggerid', $_REQUEST['triggerid']);
    if (isset($_REQUEST['triggerid']) && $_REQUEST['triggerid'] > 0) {
        $trigger = expand_trigger_description($_REQUEST['triggerid']);
    } else {
        $trigger = "";
    }
    $row = new CRow(array(new CCol(S_TRIGGER, 'form_row_l'), new CCol(array(new CTextBox("trigger", $trigger, 96, 'yes'), new CButton("btn1", S_SELECT, "return PopUp('popup.php?" . "dstfrm=" . $filterForm->GetName() . "&dstfld1=triggerid&dstfld2=trigger" . "&srctbl=triggers&srcfld1=triggerid&srcfld2=description&real_hosts=1');", 'T')), 'form_row_r')));
    $filterForm->addRow($row);
    $filterForm->addVar('show_unknown', $show_unknown);
    $unkcbx = new CCheckBox('show_unk', $show_unknown, null, '1');
    $unkcbx->setAction('javascript: create_var("' . $filterForm->GetName() . '", "show_unknown", (this.checked?1:0), 0); ');
    $filterForm->addRow(S_SHOW_UNKNOWN, $unkcbx);
}
$reset = new CButton("filter_rst", S_RESET);