本文整理汇总了PHP中CComboBox::additem方法的典型用法代码示例。如果您正苦于以下问题:PHP CComboBox::additem方法的具体用法?PHP CComboBox::additem怎么用?PHP CComboBox::additem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComboBox
的用法示例。
在下文中一共展示了CComboBox::additem方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: newComboFilterArray
function newComboFilterArray($array, $name, $value)
{
$cmbRange = new CComboBox($name, $value, 'javascript: submit();');
$cmbRange->additem('', 'Selecione...');
foreach ($array as $k => $v) {
$cmbRange->additem($k, $v);
}
return $cmbRange;
}
示例2: newComboAPI
function newComboAPI($Data, $keyField, $showField, $selected_value, $name, $reloadScript = 'javascript: submit();', $fristBlank = true)
{
$cmbRange = new CComboBox($name, $selected_value, $reloadScript);
if ($fristBlank == true) {
$cmbRange->additem("0", "");
}
for ($i = 0; $i < count($Data); $i++) {
$cmbRange->additem($Data[$i][$keyField], $Data[$i][$showField]);
}
return $cmbRange;
}
示例3: CFormTable
/***********************************************************/
$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);
$cb_items = array(-1 => S_ALL_S, TRIGGER_SEVERITY_NOT_CLASSIFIED => S_NOT_CLASSIFIED, TRIGGER_SEVERITY_INFORMATION => S_INFORMATION, TRIGGER_SEVERITY_WARNING => S_WARNING, TRIGGER_SEVERITY_AVERAGE => S_AVERAGE, TRIGGER_SEVERITY_HIGH => S_HIGH, TRIGGER_SEVERITY_DISASTER => S_DISASTER);
$severity_select->addItems($cb_items);
$filterForm->addRow(S_MIN_SEVERITY, $severity_select);
$action = 'javascrip: this.checked ? $("status_change_days").enable() : $("status_change_days").disable()';
示例4: array
$options = array('groups' => array('real_hosts' => 1), 'groupid' => get_request('groupid', null));
$pageFilter = new CPageFilter($options);
$_REQUEST['groupid'] = $pageFilter->groupid;
$_REQUEST['hostid'] = get_request('hostid', 0);
// permission check, imo should be remuved in future.
if ($_REQUEST['hostid'] > 0) {
$res = CHost::get(array('real_hosts' => 1, 'hostids' => $_REQUEST['hostid']));
if (empty($res)) {
access_deny();
}
}
$_REQUEST['prof_type'] = get_request('prof_type', 0);
$hostprof_wdgt = new CWidget();
$profile_form = new CForm(null, 'get');
$cmbProf = new CComboBox('prof_type', $_REQUEST['prof_type'], 'javascript: submit();');
$cmbProf->additem(0, S_NORMAL);
$cmbProf->additem(1, S_EXTENDED);
$profile_form->addItem(array(SPACE . S_HOST_PROFILES . SPACE, $cmbProf));
$hostprof_wdgt->addPageHeader(S_HOST_PROFILES_BIG, $profile_form);
if ($_REQUEST['hostid'] > 0) {
if ($_REQUEST['prof_type']) {
$hostprof_wdgt->addItem(insert_host_profile_ext_form());
} else {
$hostprof_wdgt->addItem(insert_host_profile_form());
}
} else {
$sortfield = getPageSortField('host');
$sortorder = getPageSortOrder();
$options = array('extendoutput' => 1, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'select_profile' => 1, 'select_groups' => 1, 'limit' => $config['search_limit'] + 1);
if ($pageFilter->groupsSelected) {
if ($pageFilter->groupid > 0) {
示例5: array
$tr_info = array(S_TRIGGERS, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $tr_numrows, SPACE . SPACE . SPACE . S_UPDATED . ': ', new CSpan(date(S_DATE_FORMAT_YMDHMS), 'info'));
$trigg_wdgt->addHeader(S_STATUS_OF_TRIGGERS_BIG, array($mute_icon, $fs_icon));
$trigg_wdgt->addHeader($tr_info, $r_form);
/************************* FILTER **************************/
/***********************************************************/
$filterForm = new CFormTable();
//,'tr_status.php?filter_set=1','POST',null,'sform');
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
$filterForm->setMethod('post');
$filterForm->addVar('fullscreen', $_REQUEST['fullscreen']);
$filterForm->addVar('groupid', $_REQUEST['groupid']);
$filterForm->addVar('hostid', $_REQUEST['hostid']);
$tr_select = new CComboBox('show_triggers', $show_triggers, 'javasctipt: submit();');
if (TRIGGERS_OPTION_ONLYTRUE) {
$tr_select->additem(TRIGGERS_OPTION_ONLYTRUE, S_SHOW_ONLY_PROBLEMS);
}
if (TRIGGERS_OPTION_ALL) {
$tr_select->addItem(TRIGGERS_OPTION_ALL, S_SHOW_ALL);
}
if (TRIGGERS_OPTION_NOFALSEFORB && $config['event_ack_enable']) {
$tr_select->addItem(TRIGGERS_OPTION_NOFALSEFORB, S_SHOW_NOFALSEFORB);
}
$ev_select = new CComboBox('show_events', $show_events, 'javasctipt: submit();');
if (EVENTS_OPTION_NOEVENT) {
$ev_select->addItem(EVENTS_OPTION_NOEVENT, S_HIDE_ALL);
}
if (EVENTS_OPTION_ALL) {
$ev_select->addItem(EVENTS_OPTION_ALL, S_SHOW_ALL . SPACE . '(' . $config['event_expire'] . SPACE . ($config['event_expire'] > 1 ? S_DAYS : S_DAY) . ')');
}
if (EVENTS_OPTION_NOT_ACK && $config['event_ack_enable']) {
示例6: insert_trigger_form
function insert_trigger_form()
{
global $USER_DETAILS;
$frmTrig = new CFormTable(S_TRIGGER, "triggers.php");
$frmTrig->SetHelp("config_triggers.php");
if ($_REQUEST['hostid'] > 0) {
$frmTrig->addVar("hostid", $_REQUEST['hostid']);
}
$dep_el = array();
$dependencies = get_request("dependencies", array());
$limited = null;
if (isset($_REQUEST["triggerid"])) {
$frmTrig->addVar("triggerid", $_REQUEST["triggerid"]);
$trigger = get_trigger_by_triggerid($_REQUEST["triggerid"]);
$frmTrig->SetTitle(S_TRIGGER . ' "' . htmlspecialchars($trigger["description"]) . '"');
$limited = $trigger['templateid'] ? 'yes' : null;
}
$expression = get_request("expression", "");
$description = get_request("description", "");
$type = get_request('type', 0);
$priority = get_request("priority", 0);
$status = get_request("status", 0);
$comments = get_request("comments", "");
$url = get_request("url", "");
if (isset($_REQUEST["triggerid"]) && !isset($_REQUEST["form_refresh"]) || isset($limited)) {
$description = $trigger["description"];
$expression = explode_exp($trigger["expression"], 0);
if (!isset($limited) || !isset($_REQUEST["form_refresh"])) {
$type = $trigger['type'];
$priority = $trigger["priority"];
$status = $trigger["status"];
$comments = $trigger["comments"];
$url = $trigger["url"];
$trigs = DBselect('SELECT t.triggerid,t.description,t.expression ' . ' FROM triggers t,trigger_depends d ' . ' WHERE t.triggerid=d.triggerid_up ' . ' AND d.triggerid_down=' . $_REQUEST['triggerid']);
while ($trig = DBfetch($trigs)) {
if (uint_in_array($trig["triggerid"], $dependencies)) {
continue;
}
array_push($dependencies, $trig["triggerid"]);
}
}
}
$frmTrig->addRow(S_NAME, new CTextBox("description", $description, 90, $limited));
$frmTrig->addRow(S_EXPRESSION, array(new CTextBox("expression", $expression, 75, $limited), $limited ? null : new CButton('insert', S_INSERT, "return PopUp('popup_trexpr.php?dstfrm=" . $frmTrig->GetName() . "&dstfld1=expression&srctbl=expression" . "&srcfld1=expression&expression=' + escape(getSelectedText(this.form.elements['expression'])),700,200);")));
/* dependencies */
foreach ($dependencies as $val) {
array_push($dep_el, array(new CCheckBox("rem_dependence[]", 'no', null, strval($val)), expand_trigger_description($val)), BR());
$frmTrig->addVar("dependencies[]", strval($val));
}
if (count($dep_el) == 0) {
array_push($dep_el, S_NO_DEPENDENCES_DEFINED);
} else {
array_push($dep_el, new CButton('del_dependence', 'delete selected'));
}
$frmTrig->addRow(S_THE_TRIGGER_DEPENDS_ON, $dep_el);
/* end dependencies */
/* new dependence */
// $frmTrig->addVar('new_dependence','0');
// $txtCondVal = new CTextBox('trigger','',75,'yes');
$btnSelect = new CButton('btn1', S_ADD, "return PopUp('popup.php?dstfrm=" . $frmTrig->GetName() . "&dstfld1=new_dependence[]&srctbl=triggers&multiselect=1&dstact=add_dependence&objname=triggers&srcfld1=1" . "',750,450);", 'T');
$frmTrig->addRow(S_NEW_DEPENDENCY, $btnSelect, 'new');
/* end new dependence */
$type_select = new CComboBox('type');
$type_select->additem(TRIGGER_MULT_EVENT_DISABLED, S_NORMAL, $type == TRIGGER_MULT_EVENT_ENABLED ? 'no' : 'yes');
$type_select->additem(TRIGGER_MULT_EVENT_ENABLED, S_NORMAL . SPACE . '+' . SPACE . S_MULTIPLE_TRUE_EVENTS, $type == TRIGGER_MULT_EVENT_ENABLED ? 'yes' : 'no');
$frmTrig->addRow(S_EVENT_GENERATION, $type_select);
$cmbPrior = new CComboBox("priority", $priority);
for ($i = 0; $i <= 5; $i++) {
$cmbPrior->addItem($i, get_severity_description($i));
}
$frmTrig->addRow(S_SEVERITY, $cmbPrior);
$frmTrig->addRow(S_COMMENTS, new CTextArea("comments", $comments, 90, 7));
$frmTrig->addRow(S_URL, new CTextBox("url", $url, 90));
$frmTrig->addRow(S_DISABLED, new CCheckBox("status", $status));
$frmTrig->addItemToBottomRow(new CButton("save", S_SAVE));
if (isset($_REQUEST["triggerid"])) {
$frmTrig->addItemToBottomRow(SPACE);
$frmTrig->addItemToBottomRow(new CButton("clone", S_CLONE));
$frmTrig->addItemToBottomRow(SPACE);
if (!$limited) {
$frmTrig->addItemToBottomRow(new CButtonDelete("Delete trigger?", url_param("form") . url_param('groupid') . url_param("hostid") . url_param("triggerid")));
}
}
$frmTrig->addItemToBottomRow(SPACE);
$frmTrig->addItemToBottomRow(new CButtonCancel(url_param('groupid') . url_param("hostid")));
$frmTrig->Show();
}
示例7: CDiv
$filter_table->addRow($footer_col);
$filter_form->addItem($filter_table);
// $filter_form->addVar('report_timesince', date('YmdHis', $report_timesince));
// $filter_form->addVar('report_timetill', date('YmdHis', $report_timetill));
$hostprof_wdgt->addFlicker($filter_form, true);
// FIM Formulario de Filtro =========================================================
insert_js($script);
$numrows = new CDiv();
$numrows->setAttribute('name', 'numrows');
$report = array();
$hostprof_wdgt->addHeader($numrows);
$r_form = new CForm();
// Combo com os formatos de exibição ---------------------------------------
$cmbFormato = new CComboBox('formato', $formato, 'javascript: submit();');
$cmbFormato->additem('html', 'HTML');
$cmbFormato->additem('csv', 'CSV');
// Combo com as opções de relatorios possiveis -----------------------------
$cmbMenus = new CComboBox('submenu', $subMenu, 'javascript: submit();');
// var_dump (zbxeSubMenus ('submenu_05'));
foreach (zbxeSubMenus('sub_report') as $row) {
$cmbMenus->additem($row['url'], $row['label']);
}
$r_form->addItem(array(array(bold(_zeT('Formatting')), ': '), array($cmbFormato)));
$r_form->addItem(array(array(bold(_zeT('Report')), ': '), array($cmbMenus)));
$hostprof_wdgt->addPageHeader(_zeT('Zabbix-Extras Reports'));
$hostprof_wdgt->addHeader(_('Report'), $r_form);
// $hostprof_wdgt->addItem(BR());
$paging = getPagingLine($report);
//$hostprof_wdgt->addItem($table);
$hostprof_wdgt->show();
include_once 'include/page_footer.php';
示例8: CFormTable
* Filter
*/
$filterForm = new CFormTable(null, null, 'get');
$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']);
$statusComboBox = new CComboBox('show_triggers', $showTriggers);
$statusComboBox->addItem(TRIGGERS_OPTION_ALL, _('Any'));
$statusComboBox->additem(TRIGGERS_OPTION_ONLYTRUE, _('Problem'));
$filterForm->addRow(_('Triggers status'), $statusComboBox);
if ($config['event_ack_enable']) {
$ackStatusComboBox = new CComboBox('ack_status', $ackStatus);
$ackStatusComboBox->addItem(ZBX_ACK_STS_ANY, _('Any'));
$ackStatusComboBox->additem(ZBX_ACK_STS_WITH_UNACK, _('With unacknowledged events'));
$ackStatusComboBox->additem(ZBX_ACK_STS_WITH_LAST_UNACK, _('With last event unacknowledged'));
$filterForm->addRow(_('Acknowledge status'), $ackStatusComboBox);
}
$eventsComboBox = new CComboBox('show_events', $_REQUEST['show_events']);
$eventsComboBox->addItem(EVENTS_OPTION_NOEVENT, _('Hide all'));
$eventsComboBox->addItem(EVENTS_OPTION_ALL, _('Show all') . ' (' . $config['event_expire'] . ' ' . ($config['event_expire'] > 1 ? _('Days') : _('Day')) . ')');
if ($config['event_ack_enable']) {
$eventsComboBox->addItem(EVENTS_OPTION_NOT_ACK, _('Show unacknowledged') . ' (' . $config['event_expire'] . ' ' . ($config['event_expire'] > 1 ? _('Days') : _('Day')) . ')');
}
$filterForm->addRow(_('Events'), $eventsComboBox);
$severityComboBox = new CComboBox('show_severity', $showSeverity);
$severityComboBox->addItems(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)));
$filterForm->addRow(_('Minimum trigger severity'), $severityComboBox);
$statusChangeDays = new CNumericBox('status_change_days', $_REQUEST['status_change_days'], 3, false, false, false);
if (!$_REQUEST['status_change']) {
示例9: CComboBox
$cmbAgregation = new CComboBox('agregation', get_request('agregation', 0), 'javascript: submit();');
if ($completo) {
$intervalDesc = array('', _zeT('Day'), _zeT('Week'), _zeT('Month'), _zeT('Year'));
$intervalFactor = array(0, 1, 7, 30, 365);
$intervalFactor2 = array(0, '+1 days', '+1 week', '+1 months', '+1 years');
$sourceAgregator = array('hu.value_max', 'hu.value_min', 'hu.value_avg');
// $sourceAgregator = array ('AVG(hu.value_max)','AVG(hu.value_min)','AVG(hu.value_avg)');
$intervalMask = array('', '%d/%m/%Y', '%U', '%m/%Y', '%Y');
$intervalMask2 = array('', 'd/m/Y', 'W (d/m/Y)', 'm/Y', 'Y');
$intervalMaskSort = array('', '%Y%m%d', '%Y%U', '%Y%m', '%Y');
for ($i = 0; $i < count($intervalDesc); $i++) {
$cmbTimeSource->additem($i, $intervalDesc[$i]);
$cmbTimeProjection->additem($i, $intervalDesc[$i]);
}
$completo = $timeShiftSource > 0 && $timeShiftProjection > 0;
$cmbAgregation->additem(0, _zeT('Max'));
$cmbAgregation->additem(1, _zeT('Min'));
$cmbAgregation->additem(2, _zeT('Avg'));
}
/*----------- Filtro por período ---------------*/
$reporttimetab = new CTable(null, 'calendar');
$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->addRow(array(_('From'), array(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));
$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'), array(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_since_day","report_since_month","report_since_year","report_since_hour","report_since_minute"],' . '"avail_report_since",' . '"report_timesince");');
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");');
$reporttimetab2 = new CTable(null, 'calendar');
$reporttimetab2->addRow(array(array(bold(_zeT('Analysis')), ': '), array($cmbTimeSource, $cmbAgregation)));
$reporttimetab2->addRow(array(array(bold(_zeT('Projection')), ': '), array($cmbTimeProjection, array(bold(_zeT('Amount')), ': '), new CTextBox('num_projection', get_request('num_projection', 7), 2))));
示例10: CFormTable
/***********************************************************/
$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, _('Any'));
$tr_select->additem(TRIGGERS_OPTION_ONLYTRUE, _('Problem'));
$filterForm->addRow(_('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, _('Any'));
$cb_ack_status->additem(ZBX_ACK_STS_WITH_UNACK, _('With unacknowledged events'));
$cb_ack_status->additem(ZBX_ACK_STS_WITH_LAST_UNACK, _('With last event unacknowledged'));
$filterForm->addRow(_('Acknowledge status'), $cb_ack_status);
}
$ev_select = new CComboBox('show_events', $_REQUEST['show_events']);
$ev_select->addItem(EVENTS_OPTION_NOEVENT, _('Hide all'));
$ev_select->addItem(EVENTS_OPTION_ALL, _('Show all') . ' (' . $config['event_expire'] . ' ' . ($config['event_expire'] > 1 ? _('Days') : _('Day')) . ')');
if ($config['event_ack_enable']) {
$ev_select->addItem(EVENTS_OPTION_NOT_ACK, _('Show unacknowledged') . ' (' . $config['event_expire'] . ' ' . ($config['event_expire'] > 1 ? _('Days') : _('Day')) . ')');
}
$filterForm->addRow(_('Events'), $ev_select);
$severity_select = new CComboBox('show_severity', $show_severity);
$cb_items = array(-1 => _('All'), 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));
$severity_select->addItems($cb_items);
$filterForm->addRow(_('Min severity'), $severity_select);
$action = 'javascript: this.checked ? $("status_change_days").enable() : $("status_change_days").disable()';
示例11: insert_trigger_form
//.........这里部分代码省略.........
$del_url->setAttribute('onclick', 'javascript: if(confirm("' . S_DELETE_EXPRESSION_Q . '")) {' . ' delete_expression(\'' . $e['id'] . '\');' . ' document.forms["config_triggers.php"].submit(); ' . '}');
$tgt_chk = new CCheckbox('expr_target_single', $i == 0 ? 'yes' : 'no', 'check_target(this);', $e['id']);
} else {
$tgt_chk = null;
}
if (!isset($e['expression']['levelErrors'])) {
$errorImg = new CImg('images/general/ok_icon.png', 'expression_no_errors');
$errorImg->setHint(S_EXPRESSION_PART_NO_ERROR, '', '', false);
} else {
$allowedTesting = false;
$errorImg = new CImg('images/general/error_icon.png', 'expression_errors');
$errorTexts = array();
if (is_array($e['expression']['levelErrors'])) {
foreach ($e['expression']['levelErrors'] as $expVal => $errTxt) {
if (count($errorTexts) > 0) {
array_push($errorTexts, BR());
}
array_push($errorTexts, $expVal, ':', $errTxt);
}
}
$errorImg->setHint($errorTexts, '', 'left', false);
}
//if it is a templated trigger
if ($limited == 'yes') {
//make all links inside inactive
for ($i = 0; $i < count($e['list']); $i++) {
if (gettype($e['list'][$i]) == 'object' && get_class($e['list'][$i]) == 'CSpan' && $e['list'][$i]->getAttribute('class') == 'link') {
$e['list'][$i]->setClass('');
$e['list'][$i]->setAttribute('onclick', '');
}
}
}
$errorCell = new CCol($errorImg, 'center');
$row = new CRow(array($tgt_chk, $e['list'], $errorCell, isset($del_url) ? $del_url : null));
$exp_table->addRow($row);
}
} else {
$allowedTesting = false;
$outline = '';
}
$frmTrig->addVar('remove_expression', '');
$btn_test = new CButton('test_expression', S_TEST, "openWinCentered(" . "'tr_testexpr.php?expression=' + encodeURIComponent(this.form.elements['expression'].value)" . ",'ExpressionTest'" . ",850,400" . ",'titlebar=no, resizable=yes, scrollbars=yes');" . "return false;");
if (!isset($allowedTesting) || !$allowedTesting) {
$btn_test->setAttribute('disabled', 'disabled');
}
if (empty($outline)) {
$btn_test->setAttribute('disabled', 'yes');
}
//SDI($outline);
$wrapOutline = new CSpan(array($outline));
$wrapOutline->addStyle('white-space: pre;');
$frmTrig->addRow(SPACE, array($wrapOutline, BR(), BR(), $exp_table, $btn_test));
}
// dependencies
foreach ($dependencies as $val) {
array_push($dep_el, array(new CCheckBox('rem_dependence[' . $val . ']', 'no', null, strval($val)), expand_trigger_description($val)), BR());
$frmTrig->addVar('dependencies[]', strval($val));
}
if (count($dep_el) == 0) {
array_push($dep_el, S_NO_DEPENDENCES_DEFINED);
} else {
array_push($dep_el, new CButton('del_dependence', S_DELETE_SELECTED));
}
$frmTrig->addRow(S_THE_TRIGGER_DEPENDS_ON, $dep_el);
/* end dependencies */
/* new dependency */
// $frmTrig->addVar('new_dependence','0');
// $txtCondVal = new CTextBox('trigger','',75,'yes');
$btnSelect = new CButton('btn1', S_ADD, "return PopUp('popup.php?srctbl=triggers" . '&srcfld1=triggerid' . '&reference=deptrigger' . '&multiselect=1' . "',1000,700);", 'T');
$frmTrig->addRow(S_NEW_DEPENDENCY, $btnSelect, 'new');
// end new dependency
$type_select = new CComboBox('type');
$type_select->additem(TRIGGER_MULT_EVENT_DISABLED, S_NORMAL, $type == TRIGGER_MULT_EVENT_ENABLED ? 'no' : 'yes');
$type_select->additem(TRIGGER_MULT_EVENT_ENABLED, S_NORMAL . SPACE . '+' . SPACE . S_MULTIPLE_PROBLEM_EVENTS, $type == TRIGGER_MULT_EVENT_ENABLED ? 'yes' : 'no');
$frmTrig->addRow(S_EVENT_GENERATION, $type_select);
$cmbPrior = new CComboBox('priority', $priority);
for ($i = 0; $i <= 5; $i++) {
$cmbPrior->addItem($i, get_severity_description($i));
}
$frmTrig->addRow(S_SEVERITY, $cmbPrior);
$frmTrig->addRow(S_COMMENTS, new CTextArea("comments", $comments, 90, 7));
$frmTrig->addRow(S_URL, new CTextBox("url", $url, 90));
$frmTrig->addRow(S_DISABLED, new CCheckBox("status", $status));
$frmTrig->addItemToBottomRow(new CButton("save", S_SAVE));
if (isset($_REQUEST["triggerid"])) {
$frmTrig->addItemToBottomRow(SPACE);
$frmTrig->addItemToBottomRow(new CButton("clone", S_CLONE));
$frmTrig->addItemToBottomRow(SPACE);
if (!$limited) {
$frmTrig->addItemToBottomRow(new CButtonDelete(S_DELETE_TRIGGER_Q, url_param("form") . url_param('groupid') . url_param("hostid") . url_param("triggerid")));
}
}
$frmTrig->addItemToBottomRow(SPACE);
$frmTrig->addItemToBottomRow(new CButtonCancel(url_param('groupid') . url_param("hostid")));
$jsmenu = new CPUMenu(null, 170);
$jsmenu->InsertJavaScript();
$script = "function addPopupValues(list){\n\t\t\t\t\t\tif(!isset('object', list)) return false;\n\n\t\t\t\t\t\tif(list.object == 'deptrigger'){\n\t\t\t\t\t\t\tfor(var i=0; i < list.values.length; i++){\n\t\t\t\t\t\t\t\tcreate_var('" . $frmTrig->getName() . "', 'new_dependence['+i+']', list.values[i], false);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tcreate_var('" . $frmTrig->getName() . "','add_dependence', 1, true);\n\t\t\t\t\t\t}\n\t\t\t\t\t}";
insert_js($script);
return $frmTrig;
}
示例12: DBfetch
$descItem = "";
while ($row_extra = DBfetch($result)) {
$descricao = $row_extra['name'];
if (strpos($descricao, "\$") !== false) {
$tmp = explode("[", $row_extra['key_']);
$tmp = explode(",", str_replace("]", "", $tmp[1]));
for ($i = 0; $i < count($tmp); $i++) {
$descricao = str_replace("\$" . ($i + 1), $tmp[$i], $descricao);
}
}
$descItem = $row_extra['id'] == $itemid ? $descricao : $descItem;
$cmbItems->additem($row_extra['id'], $descricao);
}
// Combo com os formatos de exibição
$cmbReportType = new CComboBox('reportType', $reportType, 'javascript: submit();');
$cmbReportType->additem('html', 'HTML');
$cmbReportType->additem('csv', 'CSV');
$tituloGrafico = valorCampo('select name as id from hosts where hostid = ' . $hostid, 'id') . " - " . $descItem;
// FIM Combos de filtro =========================================================
$hostprof_wdgt->addHeader($titulo, array());
$filter_table = new CTable('', 'filter_config');
$filter_table->setAttribute('border', 0);
$filter_table->setAttribute('width', '100%');
// Idenfifica se o padrão foi informado para pesquisar ==========================================
$completo = $keyStandard !== '';
/*----------- Implementa o Filtro ---------------*/
$filter_table->addItem(new CDiv(_('Wizard'), 'thin_header'));
// Search standard
$filter_table->addRow(array(array(bold(_('Group')), ': ', $cmbGroups), array(bold(_('Host')), ': ', $cmbHosts), exibeConteudo($hostid > 0, array(bold(_('Application')), ': ', $cmbApplications)), exibeConteudo($applicationid > 0, array(bold(_('Item')), ': ', $cmbItems)), array()));
$filter_table2 = new CTable('', 'filter_config');
// Place to run the search