default: $group_op = _('or'); $glog_op = _('and'); break; } foreach ($grouped_opconditions as $id => $condition) { $grouped_opconditions[$id] = '(' . implode(' ' . $group_op . ' ', $condition) . ')'; } $grouped_opconditions = implode(' ' . $glog_op . ' ', $grouped_opconditions); $calcTypeComboBox = new CComboBox('new_operation[evaltype]', $this->data['new_operation']['evaltype'], 'submit()'); $calcTypeComboBox->addItem(ACTION_EVAL_TYPE_AND_OR, _('AND / OR')); $calcTypeComboBox->addItem(ACTION_EVAL_TYPE_AND, _('AND')); $calcTypeComboBox->addItem(ACTION_EVAL_TYPE_OR, _('OR')); $newOperationsTable->addRow(array(_('Type of calculation'), array($calcTypeComboBox, new CTextBox('preview', $grouped_opconditions, ZBX_TEXTBOX_STANDARD_SIZE, 'yes')))); } else { $operationConditionsTable->addItem(new CVar('new_operation[evaltype]', ACTION_EVAL_TYPE_AND_OR)); } if (!isset($_REQUEST['new_opcondition'])) { $operationConditionsTable->addRow(new CCol(new CSubmit('new_opcondition', _('New'), null, 'link_menu'))); } $newOperationsTable->addRow(array(_('Conditions'), new CDiv($operationConditionsTable, 'objectgroup inlineblock border_dotted ui-corner-all')), 'indent_top'); } // append new operation condition to form list if (isset($_REQUEST['new_opcondition'])) { $newOperationConditionTable = new CTable(null, 'formElementTable'); $allowedOpConditions = get_opconditions_by_eventsource($this->data['eventsource']); $new_opcondition = get_request('new_opcondition', array()); if (!is_array($new_opcondition)) { $new_opcondition = array(); } if (empty($new_opcondition)) {
} $operationsTable->addRow($operationRow, null, 'operations_' . $operationid); $operation['opmessage_grp'] = isset($operation['opmessage_grp']) ? zbx_toHash($operation['opmessage_grp'], 'usrgrpid') : null; $operation['opmessage_usr'] = isset($operation['opmessage_usr']) ? zbx_toHash($operation['opmessage_usr'], 'userid') : null; $operation['opcommand_grp'] = isset($operation['opcommand_grp']) ? zbx_toHash($operation['opcommand_grp'], 'groupid') : null; $operation['opcommand_hst'] = isset($operation['opcommand_hst']) ? zbx_toHash($operation['opcommand_hst'], 'hostid') : null; } $footer = array(); if (empty($this->data['new_operation'])) { $footer[] = new CSubmit('new_operation', _('New'), null, 'link_menu'); } $operationFormList->addRow(_('Action operations'), new CDiv(array($operationsTable, $footer), 'objectgroup inlineblock border_dotted ui-corner-all')); // create new operation table if (!empty($this->data['new_operation'])) { $newOperationsTable = new CTable(null, 'formElementTable'); $newOperationsTable->addItem(new CVar('new_operation[actionid]', $this->data['actionid'])); if (isset($this->data['new_operation']['id'])) { $newOperationsTable->addItem(new CVar('new_operation[id]', $this->data['new_operation']['id'])); } if (isset($this->data['new_operation']['operationid'])) { $newOperationsTable->addItem(new CVar('new_operation[operationid]', $this->data['new_operation']['operationid'])); } if ($this->data['eventsource'] == EVENT_SOURCE_TRIGGERS || $this->data['eventsource'] == EVENT_SOURCE_INTERNAL) { $stepFrom = new CNumericBox('new_operation[esc_step_from]', $this->data['new_operation']['esc_step_from'], 5); $stepFrom->attr('size', 6); $stepFrom->addAction('onchange', 'javascript:' . $stepFrom->getAttribute('onchange') . ' if (this.value == 0) this.value = 1;'); $stepTo = new CNumericBox('new_operation[esc_step_to]', $this->data['new_operation']['esc_step_to'], 5); $stepTo->attr('size', 6); $stepTable = new CTable(); $stepTable->addRow(array(_('From'), $stepFrom), 'indent_both'); $stepTable->addRow(array(_('To'), new CCol(array($stepTo, SPACE, _('(0 - infinitely)')))), 'indent_both');
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; }
function get_expression_form() { $tblExp = new CTable(); /* init new_timeperiod variable */ $new_expression = get_request('new_expression', array()); if (is_array($new_expression) && isset($new_expression['id'])) { $tblExp->addItem(new Cvar('new_expression[id]', $new_expression['id'])); } if (!is_array($new_expression)) { $new_expression = array(); } if (!isset($new_expression['expression'])) { $new_expression['expression'] = ''; } if (!isset($new_expression['expression_type'])) { $new_expression['expression_type'] = EXPRESSION_TYPE_INCLUDED; } if (!isset($new_expression['case_sensitive'])) { $new_expression['case_sensitive'] = 0; } if (!isset($new_expression['exp_delimiter'])) { $new_expression['exp_delimiter'] = ','; } $tblExp->addRow(array(S_EXPRESSION, new CTextBox('new_expression[expression]', $new_expression['expression'], 60))); $cmbType = new CComboBox('new_expression[expression_type]', $new_expression['expression_type'], 'javascript: submit();'); $cmbType->addItem(EXPRESSION_TYPE_INCLUDED, expression_type2str(EXPRESSION_TYPE_INCLUDED)); $cmbType->addItem(EXPRESSION_TYPE_ANY_INCLUDED, expression_type2str(EXPRESSION_TYPE_ANY_INCLUDED)); $cmbType->addItem(EXPRESSION_TYPE_NOT_INCLUDED, expression_type2str(EXPRESSION_TYPE_NOT_INCLUDED)); $cmbType->addItem(EXPRESSION_TYPE_TRUE, expression_type2str(EXPRESSION_TYPE_TRUE)); $cmbType->addItem(EXPRESSION_TYPE_FALSE, expression_type2str(EXPRESSION_TYPE_FALSE)); $tblExp->addRow(array(S_EXPRESSION_TYPE, $cmbType)); if (EXPRESSION_TYPE_ANY_INCLUDED == $new_expression['expression_type']) { $cmbDelimiter = new CComboBox('new_expression[exp_delimiter]', $new_expression['exp_delimiter']); $cmbDelimiter->addItem(',', ','); $cmbDelimiter->addItem('.', '.'); $cmbDelimiter->addItem('/', '/'); $tblExp->addRow(array(S_DELIMITER, $cmbDelimiter)); } else { $tblExp->addItem(new Cvar('new_expression[exp_delimiter]', $new_expression['exp_delimiter'])); } $chkbCase = new CCheckBox('new_expression[case_sensitive]', $new_expression['case_sensitive'], null, 1); $tblExp->addRow(array(S_IGNORE_CASE, $chkbCase)); $tblExpFooter = new CTableInfo($tblExp); $oper_buttons = array(); $oper_buttons[] = new CButton('add_expression', isset($new_expression['id']) ? S_SAVE : S_ADD); $oper_buttons[] = new CButton('cancel_new_expression', S_CANCEL); $td = new CCol($oper_buttons); $td->addOption('colspan', 2); $td->addOption('style', 'text-align: right;'); $tblExpFooter->setFooter($td); // end of condition list preparation return $tblExpFooter; }
$active_till = $maintenance['active_till']; $description = $maintenance['description']; } else { $mname = get_request('mname', ''); $maintenance_type = get_request('maintenance_type', 0); $active_since = zbxDateToTime(get_request('active_since', date('YmdHis'))); $active_till = zbxDateToTime(get_request('active_till', date('YmdHis', time() + 86400))); $description = get_request('description', ''); } $tblMntc = new CTable(null, 'formElementTable'); $tblMntc->addRow(array(S_NAME, new CTextBox('mname', $mname, 50))); $cmbType = new CComboBox('maintenance_type', $maintenance_type); $cmbType->addItem(MAINTENANCE_TYPE_NORMAL, S_WITH_DATA_COLLECTION); $cmbType->addItem(MAINTENANCE_TYPE_NODATA, S_NO_DATA_COLLECTION); $tblMntc->addRow(array(S_MAINTENANCE_TYPE, $cmbType)); $tblMntc->addItem(new Cvar('active_since', date('YmdHis', $active_since))); $tblMntc->addItem(new Cvar('active_till', date('YmdHis', $active_till))); $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["mntc_active_since"].clndr.clndrshow(pos.top,pos.left);'); zbx_add_post_js('create_calendar(null, ["mntc_since_day","mntc_since_month","mntc_since_year",' . '"mntc_since_hour","mntc_since_minute"],"mntc_active_since","active_since");'); $tblMntc->addRow(array(S_ACTIVE_SINCE, array(new CNumericBox('mntc_since_day', $active_since > 0 ? date('d', $active_since) : '', 2), '/', new CNumericBox('mntc_since_month', $active_since > 0 ? date('m', $active_since) : '', 2), '/', new CNumericBox('mntc_since_year', $active_since > 0 ? date('Y', $active_since) : '', 4), SPACE, new CNumericBox('mntc_since_hour', $active_since > 0 ? date('H', $active_since) : '', 2), ':', new CNumericBox('mntc_since_minute', $active_since > 0 ? date('i', $active_since) : '', 2), $clndr_icon))); $clndr_icon->addAction('onclick', 'javascript: var pos = getPosition(this); ' . 'pos.top+=10; pos.left+=16; CLNDR["mntc_active_till"].clndr.clndrshow(pos.top,pos.left);'); zbx_add_post_js('create_calendar(null,["mntc_till_day","mntc_till_month","mntc_till_year",' . '"mntc_till_hour","mntc_till_minute"],"mntc_active_till","active_till");'); $tblMntc->addRow(array(S_ACTIVE_TILL, array(new CNumericBox('mntc_till_day', $active_till > 0 ? date('d', $active_till) : '', 2), '/', new CNumericBox('mntc_till_month', $active_till > 0 ? date('m', $active_till) : '', 2), '/', new CNumericBox('mntc_till_year', $active_till > 0 ? date('Y', $active_till) : '', 4), SPACE, new CNumericBox('mntc_till_hour', $active_till > 0 ? date('H', $active_till) : '', 2), ':', new CNumericBox('mntc_till_minute', $active_till > 0 ? date('i', $active_till) : '', 2), $clndr_icon))); $tblMntc->addRow(array(S_DESCRIPTION, new CTextArea('description', $description, 66, 5))); $footer = array(new CButton('save', S_SAVE)); if (isset($_REQUEST['maintenanceid'])) { $footer[] = new CButton('clone', S_CLONE); $footer[] = new CButtonDelete(S_DELETE_MAINTENANCE_PERIOD_Q, url_param('form') . url_param('maintenanceid')); } $footer[] = new CButtonCancel();
function get_expression_form() { $tblExp = new CTable(); /* init new_timeperiod variable */ $new_expression = get_request('new_expression', array()); if (is_array($new_expression) && isset($new_expression['id'])) { $tblExp->addItem(new Cvar('new_expression[id]', $new_expression['id'])); } if (!is_array($new_expression)) { $new_expression = array(); } if (isset($new_expression['expressionid'])) { $tblExp->addItem(new CVar('new_expression[expressionid]', $new_expression['expressionid'])); } if (!isset($new_expression['expression'])) { $new_expression['expression'] = ''; } if (!isset($new_expression['expression_type'])) { $new_expression['expression_type'] = EXPRESSION_TYPE_INCLUDED; } if (!isset($new_expression['case_sensitive'])) { $new_expression['case_sensitive'] = 0; } if (!isset($new_expression['exp_delimiter'])) { $new_expression['exp_delimiter'] = ','; } $tblExp->addRow(array(_('Expression'), new CTextBox('new_expression[expression]', $new_expression['expression'], 60))); $cmbType = new CComboBox('new_expression[expression_type]', $new_expression['expression_type'], 'javascript: submit();'); $cmbType->addItem(EXPRESSION_TYPE_INCLUDED, expression_type2str(EXPRESSION_TYPE_INCLUDED)); $cmbType->addItem(EXPRESSION_TYPE_ANY_INCLUDED, expression_type2str(EXPRESSION_TYPE_ANY_INCLUDED)); $cmbType->addItem(EXPRESSION_TYPE_NOT_INCLUDED, expression_type2str(EXPRESSION_TYPE_NOT_INCLUDED)); $cmbType->addItem(EXPRESSION_TYPE_TRUE, expression_type2str(EXPRESSION_TYPE_TRUE)); $cmbType->addItem(EXPRESSION_TYPE_FALSE, expression_type2str(EXPRESSION_TYPE_FALSE)); $tblExp->addRow(array(_('Expression type'), $cmbType)); if (EXPRESSION_TYPE_ANY_INCLUDED == $new_expression['expression_type']) { $cmbDelimiter = new CComboBox('new_expression[exp_delimiter]', $new_expression['exp_delimiter']); $cmbDelimiter->addItem(',', ','); $cmbDelimiter->addItem('.', '.'); $cmbDelimiter->addItem('/', '/'); $tblExp->addRow(array(_('Delimiter'), $cmbDelimiter)); } else { $tblExp->addItem(new Cvar('new_expression[exp_delimiter]', $new_expression['exp_delimiter'])); } $chkbCase = new CCheckBox('new_expression[case_sensitive]', $new_expression['case_sensitive'], null, 1); $tblExp->addRow(array(_('Case sensitive'), $chkbCase)); $tblExpFooter = new CTableInfo($tblExp); $oper_buttons = array(); $oper_buttons[] = new CSubmit('add_expression', isset($new_expression['id']) ? _('Save') : _('Add')); $oper_buttons[] = new CSubmit('cancel_new_expression', _('Cancel')); $td = new CCol($oper_buttons); $td->setAttribute('colspan', 2); $td->setAttribute('style', 'text-align: right;'); $tblExpFooter->setFooter($td); return $tblExpFooter; }
// 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 $filter_table2->setAttribute('border', 0); $filter_table2->setAttribute('width', '100%'); $filter_table2->addItem(new CDiv(_('Search definition'), 'thin_header')); if ($itemid > 0 and $keyStandard == "") { $keyStandard = valorCampo('select key_ as id from items where itemid = ' . $itemid, 'id'); } $filter_table2->addRow(array(array(bold(_zeT('Search group')), ': ', $cmbGroupSearch), array(bold(_zeT('Item key')), ' (' . _('like') . '): ', new CTextBox('keyStandard', $keyStandard, 60)), array(bold(_zeT('Sort Order')), ': ', $cmbOrdem), array())); $filter_form = new CForm(); $filter_form->setMethod('get'); $filter_form->setAttribute('name', 'zbx_filter'); $filter_form->setAttribute('id', 'zbx_filter'); $reset = new CButton('reset', _('Reset')); $reset->onClick("javascript: clearAllForm('zbx_filter');"); $grafico = new CButton('grafico', _zeT('Chart')); // Habilita o botão de geração de gráfico quando tem host e item selecionado ============================================= if ($hostid < 1 and $itemid < 1) { $grafico->setAttribute('disabled', ''); }
if (!isset($new_operation['esc_period'])) { $new_operation['esc_period'] = 0; } if (!isset($new_operation['evaltype'])) { $new_operation['evaltype'] = 0; } if (!isset($new_operation['opconditions'])) { $new_operation['opconditions'] = array(); } if (!isset($new_operation['default_msg'])) { $new_operation['default_msg'] = 0; } $evaltype = $new_operation['evaltype']; $update_mode = false; if (isset($new_operation['id'])) { $tblOper->addItem(new CVar('new_operation[id]', $new_operation['id'])); $update_mode = true; } $tblNewOperation = new CTable(); if (isset($_REQUEST['escalation'])) { $tblStep = new CTable(); $step_from = new CNumericBox('new_operation[esc_step_from]', $new_operation['esc_step_from'], 4); $step_from->addAction('onchange', 'javascript:' . $step_from->getAttribute('onchange') . ' if(this.value == 0) this.value=1;'); $tblStep->addRow(array(S_FROM, $step_from)); $tblStep->addRow(array(S_TO, new CCol(array(new CNumericBox('new_operation[esc_step_to]', $new_operation['esc_step_to'], 4), ' [0-' . S_INFINITY . ']')))); $tblStep->addRow(array(S_PERIOD, new CCol(array(new CNumericBox('new_operation[esc_period]', $new_operation['esc_period'], 5), ' [' . S_MIN_SMALL . ' 60, 0-' . S_DEFAULT . ']')))); $tblNewOperation->addRow(array(S_STEP, $tblStep)); } else { $tblOper->addItem(new CVar('new_operation[esc_period]', $new_operation['esc_period'])); $tblOper->addItem(new CVar('new_operation[esc_step_from]', $new_operation['esc_step_from'])); $tblOper->addItem(new CVar('new_operation[esc_step_to]', $new_operation['esc_step_to']));