本文整理汇总了PHP中CTable::addItem方法的典型用法代码示例。如果您正苦于以下问题:PHP CTable::addItem方法的具体用法?PHP CTable::addItem怎么用?PHP CTable::addItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTable
的用法示例。
在下文中一共展示了CTable::addItem方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
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)) {
示例2: isset
}
$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');
示例3: get_timeperiod_form
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];
//.........这里部分代码省略.........
示例4: get_expression_form
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;
}
示例5: zbxDateToTime
$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();
示例6: get_expression_form
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;
}
示例7: array
// 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', '');
}
示例8: array
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']));