public function addItem($value, $caption = '', $selected = null, $enabled = 'yes', $class = null) { if (is_null($selected)) { if (is_array($this->value)) { if (str_in_array($value, $this->value)) { $this->value_exist = 1; } } elseif (strcmp($value, $this->value) == 0) { $this->value_exist = 1; } } parent::addItem($value, $caption, $selected, $enabled, $class); }
$userGroupForm->setName('userGroupsForm'); $userGroupForm->addVar('form', $this->data['form']); $userGroupForm->addVar('group_rights', $this->data['group_rights']); if (isset($this->data['usrgrpid'])) { $userGroupForm->addVar('usrgrpid', $this->data['usrgrpid']); } /* * User group tab */ $userGroupFormList = new CFormList('userGroupFormList'); $nameTextBox = new CTextBox('gname', $this->data['name'], ZBX_TEXTBOX_STANDARD_SIZE); $nameTextBox->attr('autofocus', 'autofocus'); $userGroupFormList->addRow(_('Group name'), $nameTextBox); // append groups to form list $groupsComboBox = new CComboBox('selusrgrp', $this->data['selected_usrgrp'], 'submit()'); $groupsComboBox->addItem(0, _('All')); foreach ($this->data['usergroups'] as $group) { $groupsComboBox->addItem($group['usrgrpid'], $group['name']); } // append user tweenbox to form list $usersTweenBox = new CTweenBox($userGroupForm, 'group_users', $this->data['group_users'], 10); foreach ($this->data['users'] as $user) { $usersTweenBox->addItem($user['userid'], getUserFullname($user)); } $userGroupFormList->addRow(_('Users'), $usersTweenBox->get(_('In group'), array(_('Other groups'), SPACE, $groupsComboBox))); // append frontend and user status to from list $isGranted = isset($data['usrgrpid']) ? granted2update_group($data['usrgrpid']) : true; if ($isGranted) { $frontendComboBox = new CComboBox('gui_access', $this->data['gui_access']); $frontendComboBox->addItem(GROUP_GUI_ACCESS_SYSTEM, user_auth_type2str(GROUP_GUI_ACCESS_SYSTEM)); $frontendComboBox->addItem(GROUP_GUI_ACCESS_INTERNAL, user_auth_type2str(GROUP_GUI_ACCESS_INTERNAL));
} $cmbFnc->addItem(CALC_FNC_MIN, S_MIN_SMALL); $cmbFnc->addItem(CALC_FNC_AVG, S_AVG_SMALL); $cmbFnc->addItem(CALC_FNC_MAX, S_MAX_SMALL); $frmGItem->addRow(S_FUNCTION, $cmbFnc); if ($graphtype == GRAPH_TYPE_NORMAL) { $cmbType = new CComboBox('drawtype', $drawtype); foreach (graph_item_drawtypes() as $i) { $cmbType->addItem($i, graph_item_drawtype2str($i)); } $frmGItem->addRow(S_DRAW_STYLE, $cmbType); } else { $frmGItem->addVar('drawtype', 1); } } $frmGItem->addRow(S_COLOR, new CColor('color', $color)); } if ($graphtype == GRAPH_TYPE_NORMAL || $graphtype == GRAPH_TYPE_STACKED) { $cmbYax = new CComboBox('yaxisside', $yaxisside); $cmbYax->addItem(GRAPH_YAXIS_SIDE_RIGHT, S_RIGHT); $cmbYax->addItem(GRAPH_YAXIS_SIDE_LEFT, S_LEFT); $frmGItem->addRow(S_YAXIS_SIDE, $cmbYax); } if ($type != GRAPH_ITEM_SUM) { $frmGItem->addRow(S_SORT_ORDER_0_100, new CTextBox('sortorder', $sortorder, 3)); } $frmGItem->addItemToBottomRow(new CButton('save', isset($gid) ? S_SAVE : S_ADD)); $frmGItem->addItemToBottomRow(new CButtonCancel(null, 'close_window();')); $frmGItem->show(); } include_once 'include/page_footer.php';
$problemTrigger['description'] = $triggers[$problemTrigger['triggerid']]['description']; } unset($problemTrigger); } unset($serviceSla); $treeData = array(); createServiceMonitoringTree($services, $slaData, $period, $treeData); $tree = new CServiceTree('service_status_tree', $treeData, array('caption' => _('Service'), 'status' => _('Status'), 'reason' => _('Reason'), 'sla' => _('Problem time'), 'sla2' => nbsp(_('SLA') . ' / ' . _('Acceptable SLA')))); if ($tree) { // creates form for choosing a preset interval $r_form = new CForm(); $r_form->setAttribute('class', 'nowrap'); $r_form->setMethod('get'); $r_form->setAttribute('name', 'period_choice'); $r_form->addVar('fullscreen', $_REQUEST['fullscreen']); $period_combo = new CComboBox('period', $period, 'javascript: submit();'); foreach ($periods as $key => $val) { $period_combo->addItem($key, $val); } $r_form->addItem(array(_('Period') . SPACE, $period_combo)); $srv_wdgt = new CWidget('hat_services', 'service-list service-mon'); $srv_wdgt->addPageHeader(_('IT SERVICES'), get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen']))); $srv_wdgt->addHeader(_('IT services'), $r_form); $srv_wdgt->addItem(BR()); $srv_wdgt->addItem($tree->getHTML()); $srv_wdgt->show(); } else { error(_('Cannot format Tree. Check logic structure in service links.')); } } require_once dirname(__FILE__) . '/include/page_footer.php';
$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) { $lstGroups->addItem($group['groupid'], get_node_name_by_elid($group['groupid'], true, ':') . $group['name']); } if (!$filterEnable) {
**/ require_once dirname(__FILE__) . '/include/config.inc.php'; require_once dirname(__FILE__) . '/include/triggers.inc.php'; $page['title'] = _('Most busy triggers top 100'); $page['file'] = 'report5.php'; $page['hist_arg'] = array('period'); require_once dirname(__FILE__) . '/include/page_header.php'; // VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION $fields = array('period' => array(T_ZBX_STR, O_OPT, P_SYS | P_NZERO, IN('"day","week","month","year"'), NULL)); check_fields($fields); $rprt_wdgt = new CWidget(); $_REQUEST['period'] = getRequest('period', 'day'); $admin_links = CWebUser::$data['type'] == USER_TYPE_ZABBIX_ADMIN || CWebUser::$data['type'] == USER_TYPE_SUPER_ADMIN; $form = new CForm('get'); $cmbPeriod = new CComboBox('period', $_REQUEST['period'], 'submit()'); $cmbPeriod->addItem('day', _('Day')); $cmbPeriod->addItem('week', _('Week')); $cmbPeriod->addItem('month', _('Month')); $cmbPeriod->addItem('year', _('Year')); $form->addItem($cmbPeriod); $rprt_wdgt->addPageHeader(_('MOST BUSY TRIGGERS TOP 100')); $rprt_wdgt->addHeader(_('Report'), $form); $rprt_wdgt->addItem(BR()); $table = new CTableInfo(_('No triggers found.')); $table->setHeader(array(_('Host'), _('Trigger'), _('Severity'), _('Number of status changes'))); switch ($_REQUEST['period']) { case 'week': $time_dif = SEC_PER_WEEK; break; case 'month': $time_dif = SEC_PER_MONTH;
} $fname = 'test_data_' . md5($exprPart['expression']); $macrosData[$exprPart['expression']] = get_request($fname, ''); $info = get_item_function_info($exprPart['expression']); if (!is_array($info) && isset($definedErrorPhrases[$info])) { $allowedTesting = false; $control = new CTextBox($fname, $macrosData[$exprPart['expression']], 30); $control->setAttribute('disabled', 'disabled'); } else { $octet = $info['value_type'] == 'HHMMSS'; $validation = $info['validation']; if (substr($validation, 0, COMBO_PATTERN_LENGTH) == COMBO_PATTERN) { $vals = explode(',', substr($validation, COMBO_PATTERN_LENGTH, zbx_strlen($validation) - COMBO_PATTERN_LENGTH - 4)); $control = new CComboBox($fname, $macrosData[$exprPart['expression']]); foreach ($vals as $v) { $control->addItem($v, $v); } } else { $control = new CTextBox($fname, $macrosData[$exprPart['expression']], 30); } $fields[$fname] = array($info['type'], O_OPT, null, $validation, 'isset({test_expression})', $exprPart['expression']); } $data_table->addRow(new CRow(array($exprPart['expression'], is_array($info) || !isset($definedErrorPhrases[$info]) ? $info['value_type'] : new CCol($definedErrorPhrases[$info], 'disaster'), $control))); } } //---------------------------------- CHECKS ------------------------------------ $fields['test_expression'] = array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null); if (!check_fields($fields)) { $test = false; } //------------------------ <ACTIONS> ---------------------------
// create form $proxyForm = new CForm(); $proxyForm->setName('proxyForm'); $proxyForm->addVar('form', $this->data['form']); $proxyForm->addVar('form_refresh', $this->data['form_refresh']); if (!empty($this->data['proxyid'])) { $proxyForm->addVar('proxyid', $this->data['proxyid']); } // create form list $proxyFormList = new CFormList('proxyFormList'); $nameTextBox = new CTextBox('host', $this->data['name'], ZBX_TEXTBOX_STANDARD_SIZE, 'no', 64); $nameTextBox->attr('autofocus', 'autofocus'); $proxyFormList->addRow(_('Proxy name'), $nameTextBox); // append status to form list $statusBox = new CComboBox('status', $this->data['status'], 'submit()'); $statusBox->addItem(HOST_STATUS_PROXY_ACTIVE, _('Active')); $statusBox->addItem(HOST_STATUS_PROXY_PASSIVE, _('Passive')); $proxyFormList->addRow(_('Proxy mode'), $statusBox); if ($this->data['status'] == HOST_STATUS_PROXY_PASSIVE) { if (isset($this->data['interface']['interfaceid'])) { $proxyForm->addVar('interface[interfaceid]', $this->data['interface']['interfaceid']); $proxyForm->addVar('interface[hostid]', $this->data['interface']['hostid']); } $interfaceTable = new CTable(null, 'formElementTable'); $interfaceTable->addRow(array(_('IP address'), _('DNS name'), _('Connect to'), _('Port'))); $connectByComboBox = new CRadioButtonList('interface[useip]', $this->data['interface']['useip']); $connectByComboBox->addValue(_('IP'), 1); $connectByComboBox->addValue(_('DNS'), 0); $connectByComboBox->useJQueryStyle(); $interfaceTable->addRow(array(new CTextBox('interface[ip]', $this->data['interface']['ip'], ZBX_TEXTBOX_SMALL_SIZE, 'no', 64), new CTextBox('interface[dns]', $this->data['interface']['dns'], ZBX_TEXTBOX_SMALL_SIZE, 'no', 64), $connectByComboBox, new CTextBox('interface[port]', $this->data['interface']['port'], 18, 'no', 64))); $proxyFormList->addRow(_('Interface'), new CDiv($interfaceTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
$r_form->addVar('stime', get_request('stime')); $r_form->addVar('period', get_request('period')); if (EVENT_SOURCE_TRIGGERS == $source) { $options = array('groups' => array('monitored_hosts' => 1, 'with_items' => 1), 'hosts' => array('monitored_hosts' => 1, 'with_items' => 1), 'triggers' => array(), 'hostid' => get_request('hostid', null), 'groupid' => get_request('groupid', null), 'triggerid' => get_request('triggerid', null)); $pageFilter = new CPageFilter($options); $_REQUEST['groupid'] = $pageFilter->groupid; $_REQUEST['hostid'] = $pageFilter->hostid; if ($pageFilter->triggerid > 0) { $_REQUEST['triggerid'] = $pageFilter->triggerid; } $r_form->addItem(array(S_GROUP . SPACE, $pageFilter->getGroupsCB(true))); $r_form->addItem(array(SPACE . S_HOST . SPACE, $pageFilter->getHostsCB(true))); } if ($allow_discovery) { $cmbSource = new CComboBox('source', $source, 'submit()'); $cmbSource->addItem(EVENT_SOURCE_TRIGGERS, S_TRIGGER); $cmbSource->addItem(EVENT_SOURCE_DISCOVERY, S_DISCOVERY); $r_form->addItem(array(SPACE . S_SOURCE . SPACE, $cmbSource)); } $events_wdgt->addHeader(S_EVENTS_BIG, $r_form); $numrows = new CDiv(); $numrows->setAttribute('name', 'numrows'); $events_wdgt->addHeader($numrows); // }}} HEADER // FILTER {{{ $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');
function get_timeperiod_form() { $tblPeriod = new CTable(null, 'formElementTable'); // init new_timeperiod variable $new_timeperiod = getRequest('new_timeperiod', array()); $new = is_array($new_timeperiod); if (is_array($new_timeperiod)) { if (isset($new_timeperiod['id'])) { $tblPeriod->addItem(new CVar('new_timeperiod[id]', $new_timeperiod['id'])); } if (isset($new_timeperiod['timeperiodid'])) { $tblPeriod->addItem(new CVar('new_timeperiod[timeperiodid]', $new_timeperiod['timeperiodid'])); } } if (!is_array($new_timeperiod)) { $new_timeperiod = array(); $new_timeperiod['timeperiod_type'] = TIMEPERIOD_TYPE_ONETIME; } if (!isset($new_timeperiod['every'])) { $new_timeperiod['every'] = 1; } if (!isset($new_timeperiod['day'])) { $new_timeperiod['day'] = 1; } if (!isset($new_timeperiod['hour'])) { $new_timeperiod['hour'] = 12; } if (!isset($new_timeperiod['minute'])) { $new_timeperiod['minute'] = 0; } if (!isset($new_timeperiod['start_date'])) { $new_timeperiod['start_date'] = 0; } if (!isset($new_timeperiod['period_days'])) { $new_timeperiod['period_days'] = 0; } if (!isset($new_timeperiod['period_hours'])) { $new_timeperiod['period_hours'] = 1; } if (!isset($new_timeperiod['period_minutes'])) { $new_timeperiod['period_minutes'] = 0; } if (!isset($new_timeperiod['month_date_type'])) { $new_timeperiod['month_date_type'] = !(bool) $new_timeperiod['day']; } // start time if (isset($new_timeperiod['start_time'])) { $new_timeperiod['hour'] = floor($new_timeperiod['start_time'] / SEC_PER_HOUR); $new_timeperiod['minute'] = floor(($new_timeperiod['start_time'] - $new_timeperiod['hour'] * SEC_PER_HOUR) / SEC_PER_MIN); } // period if (isset($new_timeperiod['period'])) { $new_timeperiod['period_days'] = floor($new_timeperiod['period'] / SEC_PER_DAY); $new_timeperiod['period_hours'] = floor(($new_timeperiod['period'] - $new_timeperiod['period_days'] * SEC_PER_DAY) / SEC_PER_HOUR); $new_timeperiod['period_minutes'] = floor(($new_timeperiod['period'] - $new_timeperiod['period_days'] * SEC_PER_DAY - $new_timeperiod['period_hours'] * SEC_PER_HOUR) / SEC_PER_MIN); } // daysofweek $dayofweek = ''; $dayofweek .= !isset($new_timeperiod['dayofweek_mo']) ? '0' : '1'; $dayofweek .= !isset($new_timeperiod['dayofweek_tu']) ? '0' : '1'; $dayofweek .= !isset($new_timeperiod['dayofweek_we']) ? '0' : '1'; $dayofweek .= !isset($new_timeperiod['dayofweek_th']) ? '0' : '1'; $dayofweek .= !isset($new_timeperiod['dayofweek_fr']) ? '0' : '1'; $dayofweek .= !isset($new_timeperiod['dayofweek_sa']) ? '0' : '1'; $dayofweek .= !isset($new_timeperiod['dayofweek_su']) ? '0' : '1'; if (isset($new_timeperiod['dayofweek'])) { $dayofweek = zbx_num2bitstr($new_timeperiod['dayofweek'], true); } $new_timeperiod['dayofweek_mo'] = $dayofweek[0]; $new_timeperiod['dayofweek_tu'] = $dayofweek[1]; $new_timeperiod['dayofweek_we'] = $dayofweek[2]; $new_timeperiod['dayofweek_th'] = $dayofweek[3]; $new_timeperiod['dayofweek_fr'] = $dayofweek[4]; $new_timeperiod['dayofweek_sa'] = $dayofweek[5]; $new_timeperiod['dayofweek_su'] = $dayofweek[6]; // months $month = ''; $month .= !isset($new_timeperiod['month_jan']) ? '0' : '1'; $month .= !isset($new_timeperiod['month_feb']) ? '0' : '1'; $month .= !isset($new_timeperiod['month_mar']) ? '0' : '1'; $month .= !isset($new_timeperiod['month_apr']) ? '0' : '1'; $month .= !isset($new_timeperiod['month_may']) ? '0' : '1'; $month .= !isset($new_timeperiod['month_jun']) ? '0' : '1'; $month .= !isset($new_timeperiod['month_jul']) ? '0' : '1'; $month .= !isset($new_timeperiod['month_aug']) ? '0' : '1'; $month .= !isset($new_timeperiod['month_sep']) ? '0' : '1'; $month .= !isset($new_timeperiod['month_oct']) ? '0' : '1'; $month .= !isset($new_timeperiod['month_nov']) ? '0' : '1'; $month .= !isset($new_timeperiod['month_dec']) ? '0' : '1'; if (isset($new_timeperiod['month'])) { $month = zbx_num2bitstr($new_timeperiod['month'], true); } $new_timeperiod['month_jan'] = $month[0]; $new_timeperiod['month_feb'] = $month[1]; $new_timeperiod['month_mar'] = $month[2]; $new_timeperiod['month_apr'] = $month[3]; $new_timeperiod['month_may'] = $month[4]; $new_timeperiod['month_jun'] = $month[5]; $new_timeperiod['month_jul'] = $month[6]; $new_timeperiod['month_aug'] = $month[7]; $new_timeperiod['month_sep'] = $month[8]; $new_timeperiod['month_oct'] = $month[9]; $new_timeperiod['month_nov'] = $month[10]; $new_timeperiod['month_dec'] = $month[11]; $bit_dayofweek = strrev($dayofweek); $bit_month = strrev($month); $cmbType = new CComboBox('new_timeperiod[timeperiod_type]', $new_timeperiod['timeperiod_type'], 'submit()'); $cmbType->addItem(TIMEPERIOD_TYPE_ONETIME, _('One time only')); $cmbType->addItem(TIMEPERIOD_TYPE_DAILY, _('Daily')); $cmbType->addItem(TIMEPERIOD_TYPE_WEEKLY, _('Weekly')); $cmbType->addItem(TIMEPERIOD_TYPE_MONTHLY, _('Monthly')); $tblPeriod->addRow(array(_('Period type'), $cmbType)); if ($new_timeperiod['timeperiod_type'] == TIMEPERIOD_TYPE_DAILY) { $tblPeriod->addItem(new CVar('new_timeperiod[dayofweek]', bindec($bit_dayofweek))); $tblPeriod->addItem(new CVar('new_timeperiod[month]', bindec($bit_month))); $tblPeriod->addItem(new CVar('new_timeperiod[day]', $new_timeperiod['day'])); $tblPeriod->addItem(new CVar('new_timeperiod[start_date]', $new_timeperiod['start_date'])); $tblPeriod->addItem(new CVar('new_timeperiod[month_date_type]', $new_timeperiod['month_date_type'])); $tblPeriod->addRow(array(_('Every day(s)'), new CNumericBox('new_timeperiod[every]', $new_timeperiod['every'], 3))); } elseif ($new_timeperiod['timeperiod_type'] == TIMEPERIOD_TYPE_WEEKLY) { $tblPeriod->addItem(new CVar('new_timeperiod[month]', bindec($bit_month))); $tblPeriod->addItem(new CVar('new_timeperiod[day]', $new_timeperiod['day'])); $tblPeriod->addItem(new CVar('new_timeperiod[start_date]', $new_timeperiod['start_date'])); $tblPeriod->addItem(new CVar('new_timeperiod[month_date_type]', $new_timeperiod['month_date_type'])); $tblPeriod->addRow(array(_('Every week(s)'), new CNumericBox('new_timeperiod[every]', $new_timeperiod['every'], 2))); $tabDays = new CTable(); $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_mo]', $dayofweek[0], null, 1), _('Monday'))); $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_tu]', $dayofweek[1], null, 1), _('Tuesday'))); $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_we]', $dayofweek[2], null, 1), _('Wednesday'))); $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_th]', $dayofweek[3], null, 1), _('Thursday'))); $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_fr]', $dayofweek[4], null, 1), _('Friday'))); $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_sa]', $dayofweek[5], null, 1), _('Saturday'))); $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_su]', $dayofweek[6], null, 1), _('Sunday'))); $tblPeriod->addRow(array(_('Day of week'), $tabDays)); } elseif ($new_timeperiod['timeperiod_type'] == TIMEPERIOD_TYPE_MONTHLY) { $tblPeriod->addItem(new CVar('new_timeperiod[start_date]', $new_timeperiod['start_date'])); $tabMonths = new CTable(); $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_jan]', $month[0], null, 1), _('January'), SPACE, SPACE, new CCheckBox('new_timeperiod[month_jul]', $month[6], null, 1), _('July'))); $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_feb]', $month[1], null, 1), _('February'), SPACE, SPACE, new CCheckBox('new_timeperiod[month_aug]', $month[7], null, 1), _('August'))); $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_mar]', $month[2], null, 1), _('March'), SPACE, SPACE, new CCheckBox('new_timeperiod[month_sep]', $month[8], null, 1), _('September'))); $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_apr]', $month[3], null, 1), _('April'), SPACE, SPACE, new CCheckBox('new_timeperiod[month_oct]', $month[9], null, 1), _('October'))); $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_may]', $month[4], null, 1), _('May'), SPACE, SPACE, new CCheckBox('new_timeperiod[month_nov]', $month[10], null, 1), _('November'))); $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_jun]', $month[5], null, 1), _('June'), SPACE, SPACE, new CCheckBox('new_timeperiod[month_dec]', $month[11], null, 1), _('December'))); $tblPeriod->addRow(array(_('Month'), $tabMonths)); $tblPeriod->addRow(array(_('Date'), array(new CRadioButton('new_timeperiod[month_date_type]', '0', null, null, !$new_timeperiod['month_date_type'], 'submit()'), _('Day'), SPACE, new CRadioButton('new_timeperiod[month_date_type]', '1', null, null, $new_timeperiod['month_date_type'], 'submit()'), _('Day of week')))); if ($new_timeperiod['month_date_type'] > 0) { $tblPeriod->addItem(new CVar('new_timeperiod[day]', $new_timeperiod['day'])); $cmbCount = new CComboBox('new_timeperiod[every]', $new_timeperiod['every']); $cmbCount->addItem(1, _('First')); $cmbCount->addItem(2, _('Second')); $cmbCount->addItem(3, _('Third')); $cmbCount->addItem(4, _('Fourth')); $cmbCount->addItem(5, _('Last')); $td = new CCol($cmbCount); $td->setColSpan(2); $tabDays = new CTable(); $tabDays->addRow($td); $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_mo]', $dayofweek[0], null, 1), _('Monday'))); $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_tu]', $dayofweek[1], null, 1), _('Tuesday'))); $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_we]', $dayofweek[2], null, 1), _('Wednesday'))); $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_th]', $dayofweek[3], null, 1), _('Thursday'))); $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_fr]', $dayofweek[4], null, 1), _('Friday'))); $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_sa]', $dayofweek[5], null, 1), _('Saturday'))); $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_su]', $dayofweek[6], null, 1), _('Sunday'))); $tblPeriod->addRow(array(_('Day of week'), $tabDays)); } else { $tblPeriod->addItem(new CVar('new_timeperiod[dayofweek]', bindec($bit_dayofweek))); $tblPeriod->addRow(array(_('Day of month'), new CNumericBox('new_timeperiod[day]', $new_timeperiod['day'], 2))); } } else { $tblPeriod->addItem(new CVar('new_timeperiod[every]', $new_timeperiod['every'], 'new_timeperiod_every_tmp')); $tblPeriod->addItem(new CVar('new_timeperiod[month]', bindec($bit_month), 'new_timeperiod_month_tmp')); $tblPeriod->addItem(new CVar('new_timeperiod[day]', $new_timeperiod['day'], 'new_timeperiod_day_tmp')); $tblPeriod->addItem(new CVar('new_timeperiod[hour]', $new_timeperiod['hour'], 'new_timeperiod_hour_tmp')); $tblPeriod->addItem(new CVar('new_timeperiod[minute]', $new_timeperiod['minute'], 'new_timeperiod_minute_tmp')); $tblPeriod->addItem(new CVar('new_timeperiod[start_date]', $new_timeperiod['start_date'])); $tblPeriod->addItem(new CVar('new_timeperiod[month_date_type]', $new_timeperiod['month_date_type'])); $tblPeriod->addItem(new CVar('new_timeperiod[dayofweek]', bindec($bit_dayofweek))); if (isset($_REQUEST['add_timeperiod'])) { $date = array('y' => getRequest('new_timeperiod_start_date_year'), 'm' => getRequest('new_timeperiod_start_date_month'), 'd' => getRequest('new_timeperiod_start_date_day'), 'h' => getRequest('new_timeperiod_start_date_hour'), 'i' => getRequest('new_timeperiod_start_date_minute')); } else { $date = zbxDateToTime($new_timeperiod['start_date'] ? $new_timeperiod['start_date'] : date(TIMESTAMP_FORMAT_ZERO_TIME, time())); } $tblPeriod->addRow(array(_('Date'), createDateSelector('new_timeperiod_start_date', $date))); } if ($new_timeperiod['timeperiod_type'] != TIMEPERIOD_TYPE_ONETIME) { $tblPeriod->addRow(array(_('At (hour:minute)'), array(new CNumericBox('new_timeperiod[hour]', $new_timeperiod['hour'], 2), ':', new CNumericBox('new_timeperiod[minute]', $new_timeperiod['minute'], 2)))); } $perHours = new CComboBox('new_timeperiod[period_hours]', $new_timeperiod['period_hours'], null, range(0, 23)); $perMinutes = new CComboBox('new_timeperiod[period_minutes]', $new_timeperiod['period_minutes'], null, range(0, 59)); $tblPeriod->addRow(array(_('Maintenance period length'), array(new CNumericBox('new_timeperiod[period_days]', $new_timeperiod['period_days'], 3), _('Days') . SPACE . SPACE, $perHours, _('Hours') . SPACE . SPACE, $perMinutes, _('Minutes')))); return $tblPeriod; }
$functionComboBox->addItem($id, $f['description']); } } $expressionFormList->addRow(_('Function'), $functionComboBox); if (isset($this->data['functions'][$this->data['function'] . '[' . $this->data['operator'] . ']']['params'])) { foreach ($this->data['functions'][$this->data['function'] . '[' . $this->data['operator'] . ']']['params'] as $pid => $pf) { $paramIsReadonly = 'no'; $paramTypeElement = null; $paramValue = isset($this->data['param'][$pid]) ? $this->data['param'][$pid] : null; if ($pf['T'] == T_ZBX_INT) { if ($pid == 0 || $pid == 1 && (substr($this->data['expr_type'], 0, 6) == 'regexp' || substr($this->data['expr_type'], 0, 7) == 'iregexp' || substr($this->data['expr_type'], 0, 3) == 'str' && substr($this->data['expr_type'], 0, 6) != 'strlen')) { if (isset($pf['M'])) { if (is_array($pf['M'])) { $paramTypeElement = new CComboBox('paramtype', $this->data['paramtype']); foreach ($pf['M'] as $mid => $caption) { $paramTypeElement->addItem($mid, $caption); } if (substr($this->data['expr_type'], 0, 4) == 'last' || substr($this->data['expr_type'], 0, 6) == 'strlen') { $paramIsReadonly = 'yes'; } } elseif ($pf['M'] == PARAM_TYPE_SECONDS) { $expressionForm->addVar('paramtype', PARAM_TYPE_SECONDS); $paramTypeElement = SPACE . _('Seconds'); } elseif ($pf['M'] == PARAM_TYPE_COUNTS) { $expressionForm->addVar('paramtype', PARAM_TYPE_COUNTS); $paramTypeElement = SPACE . _('Count'); } } else { $expressionForm->addVar('paramtype', PARAM_TYPE_SECONDS); $paramTypeElement = SPACE . _('Seconds'); }
private function _getCB($cbname, $selectedid, $items, $withNode) { $cmb = new CComboBox($cbname, $selectedid, 'javascript: submit();'); if ($withNode) { foreach ($items as $id => $item) { $items[$id] = get_node_name_by_elid($id, null, ': ') . $item; } } natcasesort($items); $items = array(0 => $this->config['DDFirst'] == ZBX_DROPDOWN_FIRST_NONE ? S_NOT_SELECTED_SMALL : S_ALL_SMALL) + $items; foreach ($items as $id => $name) { $cmb->addItem($id, $name); } return $cmb; }
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ $widget = (new CWidget())->setTitle(_('Authentication')); // create form $authenticationForm = (new CForm())->setName('authenticationForm'); // create form list $authenticationFormList = new CFormList('authenticationList'); // append config radio buttons to form list $authenticationFormList->addRow(_('Default authentication'), (new CRadioButtonList('config', (int) $this->data['config']['authentication_type']))->addValue(_x('Internal', 'authentication'), ZBX_AUTH_INTERNAL, null, 'submit()')->addValue(_('LDAP'), ZBX_AUTH_LDAP, null, 'submit()')->addValue(_('HTTP'), ZBX_AUTH_HTTP, null, 'submit()')->setModern(true)); // append LDAP fields to form list if ($this->data['config']['authentication_type'] == ZBX_AUTH_LDAP) { if ($this->data['user_list']) { $userComboBox = new CComboBox('user', $this->data['user']); foreach ($this->data['user_list'] as $user) { if (check_perm2login($user['userid']) && check_perm2system($user['userid'])) { $userComboBox->addItem($user['alias'], $user['alias']); } } } else { $userComboBox = (new CTextBox('user', $this->data['user'], true))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH); } $authenticationFormList->addRow(_('LDAP host'), (new CTextBox('ldap_host', $this->data['config']['ldap_host']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)); $authenticationFormList->addRow(_('Port'), (new CNumericBox('ldap_port', $this->data['config']['ldap_port'], 5))->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH)); $authenticationFormList->addRow(_('Base DN'), (new CTextBox('ldap_base_dn', $this->data['config']['ldap_base_dn']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)); $authenticationFormList->addRow(_('Search attribute'), (new CTextBox('ldap_search_attribute', zbx_empty($this->data['config']['ldap_search_attribute']) && $this->data['form_refresh'] == 0 ? 'uid' : $this->data['config']['ldap_search_attribute'], false, 128))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)); $authenticationFormList->addRow(_('Bind DN'), (new CTextBox('ldap_bind_dn', $this->data['config']['ldap_bind_dn']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)); // bind password if (isset($this->data['change_bind_password']) || zbx_empty($this->data['config']['ldap_bind_password'])) { $authenticationForm->addVar('change_bind_password', 1); $authenticationFormList->addRow(_('Bind password'), (new CPassBox('ldap_bind_password'))->setWidth(ZBX_TEXTAREA_SMALL_WIDTH)); } else {
$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(); include_once 'include/page_footer.php';
$available_nodes = get_accessible_nodes_by_user(CWebUser::$data, PERM_READ, PERM_RES_DATA_ARRAY); $available_nodes = get_tree_by_parentid($ZBX_LOCALNODEID, $available_nodes, 'masterid'); // remove parent nodes if (empty($available_nodes[0])) { unset($available_nodes[0]); } if (!empty($available_nodes)) { $node_form = new CForm('get'); $node_form->cleanItems(); $node_form->setAttribute('id', 'node_form'); // create ComboBox with selected nodes $nodesComboBox = null; if (count($ZBX_VIEWED_NODES['nodes']) > 0) { $nodesComboBox = new CComboBox('switch_node', $ZBX_VIEWED_NODES['selected'], 'submit()'); foreach ($ZBX_VIEWED_NODES['nodes'] as $nodeid => $nodedata) { $nodesComboBox->addItem($nodeid, $nodedata['name']); } } $jscript = 'javascript: ' . " var pos = getPosition('button_show_tree');" . " showHide('div_node_tree', 'table');" . ' pos.top += 20;' . " \$('div_node_tree').setStyle({top: pos.top + 'px'});"; $button_show_tree = new CButton('show_node_tree', _('Select Nodes'), $jscript); $button_show_tree->setAttribute('id', 'button_show_tree'); // create node tree $node_tree = array(); $node_tree[0] = array('id' => 0, 'caption' => _('All'), 'combo_select_node' => new CCheckbox('check_all_nodes', null, "javascript : check_all('node_form', this.checked);"), 'parentid' => 0); foreach ($available_nodes as $node) { $checked = isset($ZBX_VIEWED_NODES['nodeids'][$node['nodeid']]); $combo_select_node = new CCheckbox('selected_nodes[' . $node['nodeid'] . ']', $checked, null, $node['nodeid']); $combo_select_node->setAttribute('style', 'margin: 1px 4px 2px 4px;'); // if no parent for node, link it to root (0) if (!isset($available_nodes[$node['masterid']])) { $node['masterid'] = 0;
if (isset($_REQUEST["form"])) { insert_map_form(); } else { $form = new CForm(); $form->setName('frm_maps'); $numrows = new CSpan(null, 'info'); $numrows->setAttribute('name', 'numrows'); $header = get_table_header(array(S_MAPS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows)); show_table_header($header); $table = new CTableInfo(S_NO_MAPS_DEFINED); $table->SetHeader(array(new CCheckBox('all_maps', NULL, "checkAll('" . $form->getName() . "','all_maps','maps');"), make_sorting_link(S_NAME, 'sm.name'), make_sorting_link(S_WIDTH, 'sm.width'), make_sorting_link(S_HEIGHT, 'sm.height'), S_MAP)); $result = DBselect('SELECT sm.sysmapid,sm.name,sm.width,sm.height ' . ' FROM sysmaps sm' . ' WHERE ' . DBin_node('sm.sysmapid') . order_by('sm.name,sm.width,sm.height', 'sm.sysmapid')); while ($row = DBfetch($result)) { if (!sysmap_accessible($row["sysmapid"], PERM_READ_WRITE)) { continue; } $table->AddRow(array(new CCheckBox('maps[' . $row['sysmapid'] . ']', NULL, NULL, $row['sysmapid']), new CLink($row["name"], "sysmaps.php?form=update" . "&sysmapid=" . $row["sysmapid"] . "#form", 'action'), $row["width"], $row["height"], new CLink(S_EDIT, "sysmap.php?sysmapid=" . $row["sysmapid"]))); } //----- GO ------ $goBox = new CComboBox('go'); $goBox->addItem('delete', S_DELETE_SELECTED); // goButton name is necessary!!! $goButton = new CButton('goButton', S_GO . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "maps";'); $table->setFooter(new CCol(array($goBox, $goButton))); $form->addItem($table); $form->show(); zbx_add_post_js('insert_in_element("numrows","' . $table->getNumRows() . '");'); } include_once "include/page_footer.php";
if (PAGE_TYPE_JS == $page['type'] || PAGE_TYPE_HTML_BLOCK == $page['type']) { require_once dirname(__FILE__) . '/include/page_footer.php'; exit; } $options = array('groups' => array('real_hosts' => 1), 'groupid' => get_request('groupid', null)); $pageFilter = new CPageFilter($options); $_REQUEST['groupid'] = $pageFilter->groupid; $_REQUEST['groupby'] = get_request('groupby', ''); $groupFieldTitle = ''; $hostinvent_wdgt = new CWidget(); $hostinvent_wdgt->addPageHeader(_('HOST INVENTORY OVERVIEW')); // getting inventory fields to make a drop down $inventoryFields = getHostInventories(true); // 'true' means list should be ordered by title $inventoryFieldsComboBox = new CComboBox('groupby', $_REQUEST['groupby'], 'submit()'); $inventoryFieldsComboBox->addItem('', _('not selected')); foreach ($inventoryFields as $inventoryField) { $inventoryFieldsComboBox->addItem($inventoryField['db_field'], $inventoryField['title'], $_REQUEST['groupby'] === $inventoryField['db_field'] ? 'yes' : null); if ($_REQUEST['groupby'] === $inventoryField['db_field']) { $groupFieldTitle = $inventoryField['title']; } } $r_form = new CForm('get'); $r_form->addItem(array(_('Group'), SPACE, $pageFilter->getGroupsCB(true), SPACE)); $r_form->addItem(array(_('Grouping by'), SPACE, $inventoryFieldsComboBox)); $hostinvent_wdgt->addHeader(_('Hosts'), $r_form); $hostinvent_wdgt->addItem(BR()); $table = new CTableInfo(_('No hosts defined.')); $table->setHeader(array(make_sorting_header($groupFieldTitle === '' ? _('Field') : $groupFieldTitle, 'inventory_field'), make_sorting_header(_('Host count'), 'host_count'))); // to show a report, we will need a host group and a field to aggregate if ($pageFilter->groupsSelected && $groupFieldTitle !== '') {
//-------- $p_elements = array(); // Header $r_form = new CForm(); $r_form->SetMethod('get'); // $cmbGroup = new CComboBox('groupid',$_REQUEST['groupid'],"javascript: return updater.onetime_update('".ZBX_PAGE_MAIN_HAT."',this.form);"); // $cmbHosts = new CComboBox('hostid',$_REQUEST['hostid'],"javascript: return updater.onetime_update('".ZBX_PAGE_MAIN_HAT."',this.form);"); $available_groups = $PAGE_GROUPS['groupids']; $available_hosts = $PAGE_HOSTS['hostids']; $cmbGroup = new CComboBox('groupid', $PAGE_GROUPS['selected'], 'javascript: submit();'); $cmbHosts = new CComboBox('hostid', $PAGE_HOSTS['selected'], 'javascript: submit();'); foreach ($PAGE_GROUPS['groups'] as $groupid => $name) { $cmbGroup->addItem($groupid, get_node_name_by_elid($groupid) . $name); } foreach ($PAGE_HOSTS['hosts'] as $hostid => $name) { $cmbHosts->addItem($hostid, get_node_name_by_elid($hostid) . $name); } $r_form->addItem(array(S_GROUP . SPACE, $cmbGroup)); $r_form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts)); $sql_from = ''; $sql_where = ''; if ($_REQUEST['groupid'] > 0) { $sql_from .= ',hosts_groups hg '; $sql_where .= ' AND hg.hostid=h.hostid AND hg.groupid=' . $_REQUEST['groupid']; } //--- $l_form = new CForm(); $l_form->SetMethod('get'); $l_form->addVar('groupid', $_REQUEST['groupid']); $l_form->addVar('hostid', $_REQUEST['hostid']); $l_form->AddItem(array(S_SHOW_ITEMS_WITH_DESCRIPTION_LIKE, new CTextBox('select', $_REQUEST['select'], 20)));
$ack_cb_col->setColSpan(2); $row = new CRow(array(SPACE, $config['event_ack_enable'] ? $ack_cb_col : null, $status, $clock, zbx_date2age($row_event['clock']), zbx_date2age($next_clock, $row_event['clock']), $config['event_ack_enable'] ? $ack : NULL, is_show_all_nodes() ? SPACE : null, $empty_col), 'odd_row'); $row->setAttribute('data-parentid', $trigger['triggerid']); $row->addStyle('display: none;'); $table->addRow($row); if ($i > $config['event_show_max']) { break; } } } } //----- GO ------ $footer = null; if ($config['event_ack_enable']) { $goBox = new CComboBox('go'); $goBox->addItem('bulkacknowledge', S_BULK_ACKNOWLEDGE); // goButton name is necessary!!! $goButton = new CButton('goButton', S_GO . ' (0)'); $goButton->setAttribute('id', 'goButton'); $show_event_col ? zbx_add_post_js('chkbxRange.pageGoName = "events";') : zbx_add_post_js('chkbxRange.pageGoName = "triggers";'); $footer = get_table_header(array($goBox, $goButton)); } //---- $table = array($paging, $table, $paging, $footer); $m_form->addItem($table); $trigg_wdgt->addItem($m_form); $trigg_wdgt->show(); zbx_add_post_js('blink.init();'); zbx_add_post_js("var switcher = new CSwitcher('{$switcherName}');"); $jsmenu = new CPUMenu(null, 170); $jsmenu->InsertJavaScript();
default: $style = null; $url = 'hosts.php?form=update&hostid=' . $hostid . '&groupid=' . $groupid; break; } $hosts_output[] = new CLink($host['host'], $url, $style); $hosts_output[] = ', '; } array_pop($hosts_output); foreach ($group['hosts'] as $hostid => $host) { $host['status'] == HOST_STATUS_TEMPLATE ? $tpl_count++ : $host_count++; } $table->addRow(array(new CCheckBox('groups[' . $groupid . ']', NULL, NULL, $groupid), new CLink($group['name'], 'hostgroups.php?form=update&groupid=' . $groupid), array(array(new CLink(S_HOSTS, 'hosts.php?groupid=' . $groupid), ' (' . $host_count . ')'), BR(), array(new CLink(S_TEMPLATES, 'templates.php?groupid=' . $groupid, 'unknown'), ' (' . $tpl_count . ')')), new CCol(empty($hosts_output) ? '-' : $hosts_output, 'wraptext'))); } $row_count = $table->getNumRows(); //----- GO ------ $goBox = new CComboBox('go'); $goBox->addItem('activate', S_ACTIVATE_SELECTED); $goBox->addItem('disable', S_DISABLE_SELECTED); $goBox->addItem('delete', S_DELETE_SELECTED); // goButton name is necessary!!! $goButton = new CButton('goButton', S_GO . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "groups";'); $table->setFooter(new CCol(array($goBox, $goButton))); //---- $form->addItem($table); $form->show(); zbx_add_post_js('insert_in_element("numrows","' . $row_count . '");'); } include_once 'include/page_footer.php';
**/ $hostInventoryWidget = new CWidget(); $rForm = new CForm('get'); $rForm->addItem(array(_('Group'), SPACE, $this->data['pageFilter']->getGroupsCB())); $hostInventoryWidget->addPageHeader(_('HOST INVENTORY'), SPACE); $hostInventoryWidget->addHeader(_('Hosts'), $rForm); $filterTable = new CTable('', 'filter filter-center'); // getting inventory fields to make a drop down $inventoryFields = getHostInventories(true); // 'true' means list should be ordered by title $inventoryFieldsComboBox = new CComboBox('filter_field', $this->data['filterField']); foreach ($inventoryFields as $inventoryField) { $inventoryFieldsComboBox->addItem($inventoryField['db_field'], $inventoryField['title']); } $exactComboBox = new CComboBox('filter_exact', $this->data['filterExact']); $exactComboBox->addItem('0', _('like')); $exactComboBox->addItem('1', _('exactly')); $filterTable->addRow(array(array(array(bold(_('Field')), SPACE, $inventoryFieldsComboBox), array($exactComboBox, new CTextBox('filter_field_value', $this->data['filterFieldValue'], 20)))), 'host-inventories'); $filter = new CSubmit('filter_set', _('Filter')); $filter->useJQueryStyle('main'); $reset = new CSubmit('filter_rst', _('Reset')); $reset->useJQueryStyle(); $divButtons = new CDiv(array($filter, SPACE, $reset)); $divButtons->setAttribute('style', 'padding: 4px 0px;'); $footerCol = new CCol($divButtons, 'controls'); $filterTable->addRow($footerCol); $filterForm = new CForm('get'); $filterForm->setAttribute('name', 'zbx_filter'); $filterForm->setAttribute('id', 'zbx_filter'); $filterForm->addItem($filterTable); $hostInventoryWidget->addFlicker($filterForm, CProfile::get('web.hostinventories.filter.state', 0));
** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ // header $imageComboBox = new CComboBox('imagetype', $this->data['imagetype'], 'submit();'); $imageComboBox->addItem(IMAGE_TYPE_ICON, _('Icon')); $imageComboBox->addItem(IMAGE_TYPE_BACKGROUND, _('Background')); $imageComboBoxForm = new CForm(); $imageComboBoxForm->addItem(_('Type') . SPACE); $imageComboBoxForm->addItem($imageComboBox); $this->data['widget']->addHeader(_('Images'), $imageComboBoxForm); // form $imageForm = new CForm(); $imageForm->setName('imageForm'); $imageForm->addItem(BR()); $imageTable = new CTable(_('No images found.'), 'header_wide padding_standard'); $count = 0; $imageRow = new CRow(); foreach ($this->data['images'] as $image) { $img = $image['imagetype'] == IMAGE_TYPE_BACKGROUND ? new CLink(new CImg('imgstore.php?width=200&height=200&iconid=' . $image['imageid'], 'no image'), 'image.php?imageid=' . $image['imageid']) : new CImg('imgstore.php?iconid=' . $image['imageid'], 'no image'); $nodeName = $this->data['displayNodes'] ? new CSpan($image['nodename'], 'unknown') : null;
if (!$service) { access_deny(); } $form = new CForm(); $form->setMethod('get'); $form->addVar('serviceid', $_REQUEST['serviceid']); $cmbPeriod = new CComboBox('period', $period, 'submit();'); $cmbPeriod->addItem('daily', _('Daily')); $cmbPeriod->addItem('weekly', _('Weekly')); $cmbPeriod->addItem('monthly', _('Monthly')); $cmbPeriod->addItem('yearly', _('Yearly')); $form->addItem(array(SPACE . _('Period') . SPACE, $cmbPeriod)); if ($period != 'yearly') { $cmbYear = new CComboBox('year', $year, 'submit();'); for ($y = date('Y') - YEAR_LEFT_SHIFT; $y <= date('Y'); $y++) { $cmbYear->addItem($y, $y); } $form->addItem(array(SPACE . _('Year') . SPACE, $cmbYear)); } show_table_header(array(_('IT SERVICES AVAILABILITY REPORT'), SPACE . '"', new CLink($service['name'], 'srv_status.php?showgraph=1&serviceid=' . $service['serviceid']), '"'), $form); $table = new CTableInfo(); $header = array(_('Ok'), _('Problems'), _('Downtime'), _('SLA'), _('Acceptable SLA')); switch ($period) { case 'yearly': $from = date('Y') - YEAR_LEFT_SHIFT; $to = date('Y'); array_unshift($header, new CCol(_('Year'), 'center')); function get_time($y) { return mktime(0, 0, 0, 1, 1, $y); }
$new_opcondition['conditiontype'] = $allowedOpConditions[0]; } $rowCondition = array(); $conditionTypeComboBox = new CComboBox('new_opcondition[conditiontype]', $new_opcondition['conditiontype'], 'submit()'); foreach ($allowedOpConditions as $opcondition) { $conditionTypeComboBox->addItem($opcondition, condition_type2str($opcondition)); } array_push($rowCondition, $conditionTypeComboBox); $operationConditionComboBox = new CComboBox('new_opcondition[operator]'); foreach (get_operators_by_conditiontype($new_opcondition['conditiontype']) as $operationCondition) { $operationConditionComboBox->addItem($operationCondition, condition_operator2str($operationCondition)); } array_push($rowCondition, $operationConditionComboBox); if ($new_opcondition['conditiontype'] == CONDITION_TYPE_EVENT_ACKNOWLEDGED) { $operationConditionValueComboBox = new CComboBox('new_opcondition[value]', $new_opcondition['value']); $operationConditionValueComboBox->addItem(0, _('Not Ack')); $operationConditionValueComboBox->addItem(1, _('Ack')); $rowCondition[] = $operationConditionValueComboBox; } $newOperationConditionTable->addRow($rowCondition); $newOperationConditionFooter = array(new CSubmit('add_opcondition', _('Add'), null, 'link_menu'), SPACE . SPACE, new CSubmit('cancel_new_opcondition', _('Cancel'), null, 'link_menu')); $newOperationsTable->addRow(array(_('Operation condition'), new CDiv(array($newOperationConditionTable, $newOperationConditionFooter), 'objectgroup inlineblock border_dotted ui-corner-all'))); } $footer = array(new CSubmit('add_operation', $this->data['new_operation']['action'] == 'update' ? _('Update') : _('Add'), null, 'link_menu'), SPACE . SPACE, new CSubmit('cancel_new_operation', _('Cancel'), null, 'link_menu')); $operationFormList->addRow(_('Operation details'), new CDiv(array($newOperationsTable, $footer), 'objectgroup inlineblock border_dotted ui-corner-all')); } // append tabs to form $actionTabs = new CTabView(); if (!isset($_REQUEST['form_refresh'])) { $actionTabs->setSelected(0); }
$col->addRow($row); // double div necassary for FireFox $col = new CCol(new CDiv(new CDiv($col), 'overview-mon-severities-container')); $hintTable->addRow(array($col, _s('Age less than %s', convertUnitsS($config['blink_period'])))); } $hintTable->addRow(array(new CCol(SPACE), _('No trigger'))); } else { $hintTable->addRow(array(new CCol(SPACE), _('OK or no trigger'))); } $help = new CHelp('web.view.php', 'right'); $help->setHint($hintTable, '', '', true, false); // header right $overviewWidget->addPageHeader(_('OVERVIEW'), array(get_icon('fullscreen', array('fullscreen' => $this->data['fullscreen'])), SPACE, $help)); // header left $styleComboBox = new CComboBox('view_style', $this->data['view_style'], 'submit()'); $styleComboBox->addItem(STYLE_TOP, _('Top')); $styleComboBox->addItem(STYLE_LEFT, _('Left')); $hostLocationForm = new CForm('get'); $hostLocationForm->addVar('groupid', $this->data['groupid']); $hostLocationForm->additem(array(_('Hosts location'), SPACE, $styleComboBox)); $overviewWidget->addHeader($hostLocationForm); if ($config['dropdown_first_entry'] || $this->data['pageFilter']->applicationsSelected || $this->data['pageFilter']->groupsSelected) { if ($this->data['type'] == SHOW_DATA) { $dataTable = getItemsDataOverview(array_keys($this->data['pageFilter']->hosts), $this->data['pageFilter']->application, $this->data['view_style']); } elseif ($this->data['type'] == SHOW_TRIGGERS) { global $page; $dataTable = getTriggersOverview(array_keys($this->data['pageFilter']->hosts), $this->data['pageFilter']->application, $page['file'], $this->data['view_style']); } } else { $dataTable = new CTableInfo(_('No items found.')); }
function stage3() { $table = new CTable(null, 'requirements'); $table->setAlign('center'); $DB['TYPE'] = $this->getConfig('DB_TYPE'); $cmbType = new CComboBox('type', $DB['TYPE'], 'this.form.submit();'); $frontendSetup = new FrontendSetup(); $databases = $frontendSetup->getSupportedDatabases(); foreach ($databases as $id => $name) { $cmbType->addItem($id, $name); } $table->addRow(array(new CCol(_('Database type'), 'header'), $cmbType)); switch ($DB['TYPE']) { case ZBX_DB_SQLITE3: $database = new CTextBox('database', $this->getConfig('DB_DATABASE', 'zabbix')); $database->attr('onchange', "disableSetupStepButton('#next_2')"); $table->addRow(array(new CCol(_('Database file'), 'header'), $database)); break; default: $server = new CTextBox('server', $this->getConfig('DB_SERVER', 'localhost')); $server->attr('onchange', "disableSetupStepButton('#next_2')"); $table->addRow(array(new CCol(_('Database host'), 'header'), $server)); $port = new CNumericBox('port', $this->getConfig('DB_PORT', '0'), 5, 'no', false, false); $port->attr('style', ''); $port->attr('onchange', "disableSetupStepButton('#next_2'); validateNumericBox(this, 'false', 'false');"); $table->addRow(array(new CCol(_('Database port'), 'header'), array($port, ' 0 - use default port'))); $database = new CTextBox('database', $this->getConfig('DB_DATABASE', 'zabbix')); $database->attr('onchange', "disableSetupStepButton('#next_2')"); $table->addRow(array(new CCol(_('Database name'), 'header'), $database)); if ($DB['TYPE'] == ZBX_DB_DB2) { $schema = new CTextBox('schema', $this->getConfig('DB_SCHEMA', '')); $schema->attr('onchange', "disableSetupStepButton('#next_2')"); $table->addRow(array(new CCol(_('Database schema'), 'header'), $schema)); } $user = new CTextBox('user', $this->getConfig('DB_USER', 'root')); $user->attr('onchange', "disableSetupStepButton('#next_2')"); $table->addRow(array(new CCol(_('User'), 'header'), $user)); $password = new CPassBox('password', $this->getConfig('DB_PASSWORD', '')); $password->attr('onchange', "disableSetupStepButton('#next_2')"); $table->addRow(array(new CCol(_('Password'), 'header'), $password)); break; } global $ZBX_MESSAGES; if (!empty($ZBX_MESSAGES)) { $lst_error = new CList(null, 'messages'); foreach ($ZBX_MESSAGES as $msg) { $lst_error->addItem($msg['message'], $msg['type']); } $table = array($table, $lst_error); } return array(new CDiv(new CDiv(array('Please create database manually, and set the configuration parameters for connection to this database.', BR(), BR(), 'Press "Test connection" button when done.', BR(), $table), 'vertical_center'), 'table_wraper'), new CDiv(array(isset($_REQUEST['retry']) ? !$this->DISABLE_NEXT_BUTTON ? new CSpan(array(_('OK'), BR()), 'ok') : new CSpan(array(_('Fail'), BR()), 'fail') : null, new CSubmit('retry', 'Test connection')), 'info_bar')); }
$hostTemplates[] = $caption; $hostTemplates[] = ', '; } if ($hostTemplates) { array_pop($hostTemplates); } } // status $status = new CLink(item_status2str($hostPrototype['status']), '?group_hostid=' . $hostPrototype['hostid'] . '&parent_discoveryid=' . $discoveryRule['itemid'] . '&go=' . ($hostPrototype['status'] ? 'activate' : 'disable'), itemIndicatorStyle($hostPrototype['status'])); $hostTable->addRow(array(new CCheckBox('group_hostid[' . $hostPrototype['hostid'] . ']', null, null, $hostPrototype['hostid']), $name, new CCol($hostTemplates, 'wraptext'), $status)); } // create go buttons $goComboBox = new CComboBox('go'); $goOption = new CComboItem('activate', _('Activate selected')); $goOption->setAttribute('confirm', _('Enable selected host prototypes?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('disable', _('Disable selected')); $goOption->setAttribute('confirm', _('Disable selected host prototypes?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('delete', _('Delete selected')); $goOption->setAttribute('confirm', _('Delete selected host prototypes?')); $goComboBox->addItem($goOption); $goButton = new CSubmit('goButton', _('Go') . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "group_hostid";'); zbx_add_post_js('chkbxRange.prefix = "' . $discoveryRule['itemid'] . '";'); zbx_add_post_js('cookie.prefix = "' . $discoveryRule['itemid'] . '";'); // append table to form $itemForm->addItem(array($this->data['paging'], $hostTable, $this->data['paging'], get_table_header(array($goComboBox, $goButton)))); // append form to widget $itemsWidget->addItem($itemForm);
$hostsgroups[$hostgroup['hostid']] = $hostgroup['groupid']; } $params = array('nodeids' => get_current_nodeid(), 'pattern' => $search, 'extend_pattern' => true, 'count' => 1); $hosts_count = CHost::get($params); $overalCount = $hosts_count['rowscount']; $viewCount = count($hosts); $header = array(is_show_all_nodes() ? new CCol(S_NODE) : null, new CCol(S_HOSTS), new CCol(S_IP), new CCol(S_DNS), new CCol(S_LATEST_DATA), new CCol(S_TRIGGERS), new CCol(S_EVENTS), $admin ? new CCol(S_EDIT, 'center') : null); $table = new CTableInfo(); $table->setHeader($header); foreach ($hosts as $num => $host) { $hostid = $host['hostid']; $groupid = isset($hostsgroups[$hostid]) ? $hostsgroups[$hostid] : 0; $link = 'groupid=' . $groupid . '&hostid=' . $hostid; if ($admin) { $pageBox = new CComboBox('hostpages_' . $hostid); $pageBox->addItem('hosts.php?form=update&config=0&' . $link, S_HOST); $pageBox->addItem('items.php?' . $link, S_ITEMS); $pageBox->addItem('triggers.php?' . $link, S_TRIGGERS); $pageBox->addItem('graphs.php?' . $link, S_GRAPHS); $pageGo = new CButton('pagego', S_GO, "javascript: " . " redirect(\$('hostpages_{$hostid}').options[\$('hostpages_{$hostid}').selectedIndex].value);"); $pageSelect = array($pageBox, SPACE, $pageGo); } else { $pageSelect = null; } $caption = make_decoration($host['host'], $search); $hostip = make_decoration($host['ip'], $search); $hostdns = make_decoration($host['dns'], $search); $table->addRow(array(get_node_name_by_elid($hostid), $caption, $hostip, $hostdns, new CLink(S_GO, 'latest.php?' . $link), new CLink(S_GO, 'tr_status.php?' . $link), new CLink(S_GO, 'events.php?' . $link), $pageSelect)); } $table->setFooter(new CCol(S_DISPLAYING . SPACE . $viewCount . SPACE . S_OF_SMALL . SPACE . $overalCount . SPACE . S_FOUND_SMALL)); $wdgt_hosts = new CWidget('search_hosts', $table);
$node_form = null; if (ZBX_DISTRIBUTED && !defined('ZBX_HIDE_NODE_SELECTION')) { insert_js_function('check_all'); $available_nodes = get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_LIST, PERM_RES_DATA_ARRAY); $available_nodes = get_tree_by_parentid($ZBX_LOCALNODEID, $available_nodes, 'masterid'); //remove parent nodes if (!empty($available_nodes)) { $node_form = new CForm(); $node_form->setMethod('get'); $node_form->setAttribute('id', 'node_form'); // +++ create Combo Box with selected nodes +++ $combo_node_list = null; if (count($ZBX_VIEWED_NODES['nodes']) > 0) { $combo_node_list = new CComboBox('switch_node', $ZBX_VIEWED_NODES['selected'], 'submit()'); foreach ($ZBX_VIEWED_NODES['nodes'] as $nodeid => $nodedata) { $combo_node_list->addItem($nodeid, $nodedata['name']); } } // --- --- $jscript = 'javascript : ' . " var pos = getPosition('button_show_tree');" . " ShowHide('div_node_tree',IE6?'block':'table');" . ' pos.top += 20;' . " \$('div_node_tree').setStyle({top: pos.top+'px'});" . " showPopupDiv('div_node_tree','select_iframe');"; // IE6 $button_show_tree = new CButton('show_node_tree', S_SELECT_NODES, $jscript); //sdelatj konstatntu! $button_show_tree->setType('button'); $button_show_tree->setAttribute('id', 'button_show_tree'); // +++ Create node tree +++ $combo_check_all = new CCheckbox('check_all_nodes', null, "javascript : check_all('node_form', this.checked);"); $node_tree = array(); $node_tree[0] = array('id' => 0, 'caption' => S_ALL_S, 'combo_select_node' => $combo_check_all, 'parentid' => 0); //root foreach ($available_nodes as $num => $node) {
$itemForm->addVar('group_itemid', $this->data['group_itemid']); $itemForm->addVar('hostid', $this->data['hostid']); $itemForm->addVar('go', 'copy_to'); // create form list $itemFormList = new CFormList('itemFormList'); // append type to form list $copyTypeComboBox = new CComboBox('copy_type', $this->data['copy_type'], 'submit()'); $copyTypeComboBox->addItem(0, _('Hosts')); $copyTypeComboBox->addItem(1, _('Host groups')); $itemFormList->addRow(_('Target type'), $copyTypeComboBox); // append targets to form list $targetList = array(); if ($this->data['copy_type'] == 0) { $groupComboBox = new CComboBox('copy_groupid', $this->data['copy_groupid'], 'submit()'); foreach ($this->data['groups'] as $group) { $groupComboBox->addItem($group['groupid'], $group['name']); } $itemFormList->addRow(_('Group'), $groupComboBox); foreach ($this->data['hosts'] as $host) { array_push($targetList, array(new CCheckBox('copy_targetid[' . $host['hostid'] . ']', uint_in_array($host['hostid'], $this->data['copy_targetid']), null, $host['hostid']), SPACE, $host['name'], BR())); } } else { foreach ($this->data['groups'] as $group) { array_push($targetList, array(new CCheckBox('copy_targetid[' . $group['groupid'] . ']', uint_in_array($group['groupid'], $this->data['copy_targetid']), null, $group['groupid']), SPACE, $group['name'], BR())); } } $itemFormList->addRow(_('Target'), !empty($targetList) ? $targetList : SPACE); // append tabs to form $itemTab = new CTabView(); $itemTab->addTab('itemTab', count($this->data['group_itemid']) . ' ' . _('elements copy to ...'), $itemFormList); $itemForm->addItem($itemTab);