本文整理汇总了PHP中CForm::addItem方法的典型用法代码示例。如果您正苦于以下问题:PHP CForm::addItem方法的具体用法?PHP CForm::addItem怎么用?PHP CForm::addItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForm
的用法示例。
在下文中一共展示了CForm::addItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_report2_header
function show_report2_header($config, &$PAGE_GROUPS, &$PAGE_HOSTS)
{
global $USER_DETAILS;
$available_groups = $PAGE_GROUPS['groupids'];
$available_hosts = $PAGE_HOSTS['hostids'];
// $available_groups = $PAGE_GROUPS['groupids'];
// $available_hosts = $PAGE_HOSTS['hostids'];
$r_form = new CForm();
$r_form->setMethod('get');
$cmbConf = new CComboBox('config', $config, 'submit()');
$cmbConf->addItem(0, S_BY_HOST);
$cmbConf->addItem(1, S_BY_TRIGGER_TEMPLATE);
$r_form->addItem(array(S_MODE . SPACE, $cmbConf, SPACE));
$cmbGroups = new CComboBox('groupid', $PAGE_GROUPS['selected'], 'javascript: submit();');
$cmbHosts = new CComboBox('hostid', $PAGE_HOSTS['selected'], 'javascript: submit();');
foreach ($PAGE_GROUPS['groups'] as $groupid => $name) {
$cmbGroups->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, $cmbGroups));
$r_form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts));
if (1 == $config) {
$cmbTrigs = new CComboBox('tpl_triggerid', get_request('tpl_triggerid', 0), 'submit()');
$cmbHGrps = new CComboBox('hostgroupid', get_request('hostgroupid', 0), 'submit()');
$cmbTrigs->addItem(0, S_ALL_SMALL);
$cmbHGrps->addItem(0, S_ALL_SMALL);
}
if (0 == $config) {
show_table_header(S_AVAILABILITY_REPORT_BIG, $r_form);
} else {
$sql_cond = ' AND h.hostid=ht.hostid ';
if ($_REQUEST['hostid'] > 0) {
$sql_cond .= ' AND ht.templateid=' . $_REQUEST['hostid'];
}
if (isset($_REQUEST['tpl_triggerid']) && $_REQUEST['tpl_triggerid'] > 0) {
$sql_cond .= ' AND t.templateid=' . $_REQUEST['tpl_triggerid'];
}
$result = DBselect('SELECT DISTINCT g.groupid,g.name ' . ' FROM triggers t,hosts h,items i,functions f, hosts_templates ht, groups g, hosts_groups hg ' . ' WHERE f.itemid=i.itemid ' . ' AND h.hostid=i.hostid ' . ' AND hg.hostid=h.hostid' . ' AND g.groupid=hg.groupid ' . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND t.triggerid=f.triggerid ' . ' AND ' . DBin_node('t.triggerid') . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND h.status=' . HOST_STATUS_MONITORED . $sql_cond . ' ORDER BY g.name');
while ($row = DBfetch($result)) {
$cmbHGrps->addItem($row['groupid'], get_node_name_by_elid($row['groupid']) . $row['name']);
}
$sql_cond = $_REQUEST['hostid'] > 0 ? ' AND h.hostid=' . $_REQUEST['hostid'] : ' AND ' . DBcondition('h.hostid', $available_hosts);
$sql = 'SELECT DISTINCT t.triggerid,t.description ' . ' FROM triggers t,hosts h,items i,functions f ' . ' WHERE f.itemid=i.itemid ' . ' AND h.hostid=i.hostid ' . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND t.triggerid=f.triggerid ' . ' AND h.status=' . HOST_STATUS_TEMPLATE . ' AND ' . DBin_node('t.triggerid') . ' AND i.status=' . ITEM_STATUS_ACTIVE . $sql_cond . ' ORDER BY t.description';
$result = DBselect($sql);
while ($row = DBfetch($result)) {
$cmbTrigs->addItem($row['triggerid'], get_node_name_by_elid($row['triggerid']) . expand_trigger_description($row['triggerid']));
}
$rr_form = new CForm();
$rr_form->setMethod('get');
$rr_form->addVar('config', $config);
$rr_form->addVar('groupid', $_REQUEST['groupid']);
$rr_form->addVar('hostid', $_REQUEST['hostid']);
$rr_form->addItem(array(S_TRIGGER . SPACE, $cmbTrigs, BR(), S_FILTER, SPACE, S_HOST_GROUP . SPACE, $cmbHGrps));
show_table_header(S_AVAILABILITY_REPORT_BIG, array($r_form, $rr_form));
}
}
示例2: dirname
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
require_once dirname(__FILE__) . '/js/monitoring.triggerComment.js.php';
$commentWidget = new CWidget('triggerComment');
$commentWidget->addPageHeader(_('TRIGGER DESCRIPTION'));
// create form
$commentForm = new CForm();
$commentForm->setName('commentForm');
$commentForm->addVar('triggerid', $this->data['triggerid']);
// create form list
$commentFormList = new CFormList('commentFormList');
$commentTextArea = new CTextArea('comments', CMacrosResolverHelper::resolveTriggerDescription($this->data['trigger']), array('rows' => 25, 'width' => ZBX_TEXTAREA_BIG_WIDTH, 'readonly' => $this->data['isCommentExist']));
$commentTextArea->attr('autofocus', 'autofocus');
$commentFormList->addRow(_('Description'), $commentTextArea);
// append tabs to form
$commentTab = new CTabView();
$commentTab->addTab('commentTab', _s('Description for "%s".', $this->data['trigger']['description']), $commentFormList);
$commentForm->addItem($commentTab);
// append buttons to form
$updateButton = new CSubmit('update', _('Update'));
$updateButton->setEnabled(!$this->data['isCommentExist']);
if ($this->data['isCommentExist']) {
$editButton = new CButton('edit', _('Edit'));
$editButton->setEnabled($this->data['isTriggerEditable']);
} else {
$editButton = null;
}
$commentForm->addItem(makeFormFooter($updateButton, array($editButton, new CButtonCancel('&triggerid=' . $this->data['triggerid']))));
$commentWidget->addItem($commentForm);
return $commentWidget;
示例3: array
*/
if (get_request('groupid') && !API::HostGroup()->isReadable(array($_REQUEST['groupid']))) {
access_deny();
}
if (get_request('hostid') && !API::Host()->isReadable(array($_REQUEST['hostid']))) {
access_deny();
}
validate_sort_and_sortorder('name', ZBX_SORT_DOWN);
$options = array('groups' => array('real_hosts' => true, 'with_httptests' => true), 'hosts' => array('with_monitored_items' => true, 'with_httptests' => true), 'hostid' => get_request('hostid', null), 'groupid' => get_request('groupid', null));
$pageFilter = new CPageFilter($options);
$_REQUEST['groupid'] = $pageFilter->groupid;
$_REQUEST['hostid'] = $pageFilter->hostid;
$displayNodes = is_array(get_current_nodeid()) && $pageFilter->groupid == 0 && $pageFilter->hostid == 0;
$r_form = new CForm('get');
$r_form->addVar('fullscreen', $_REQUEST['fullscreen']);
$r_form->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB(true)));
$r_form->addItem(array(SPACE . _('Host') . SPACE, $pageFilter->getHostsCB(true)));
$httpmon_wdgt = new CWidget();
$httpmon_wdgt->addPageHeader(_('STATUS OF WEB MONITORING'), get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen'])));
$httpmon_wdgt->addHeader(_('Web scenarios'), $r_form);
$httpmon_wdgt->addHeaderRowNumber();
// TABLE
$table = new CTableInfo(_('No web scenarios found.'));
$table->SetHeader(array($displayNodes ? _('Node') : null, $_REQUEST['hostid'] == 0 ? make_sorting_header(_('Host'), 'hostname') : null, make_sorting_header(_('Name'), 'name'), _('Number of steps'), _('Last check'), _('Status')));
$paging = null;
if ($pageFilter->hostsSelected) {
$options = array('output' => array('httptestid'), 'templated' => false, 'filter' => array('status' => HTTPTEST_STATUS_ACTIVE), 'limit' => $config['search_limit'] + 1);
if ($pageFilter->hostid > 0) {
$options['hostids'] = $pageFilter->hostid;
} elseif ($pageFilter->groupid > 0) {
$options['groupids'] = $pageFilter->groupid;
示例4: unset
$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';
示例5: CCol
}
array_pop($actionLinks);
} else {
$actionLinks = '-';
}
$actionColumn = new CCol($actionLinks);
$actionColumn->setAttribute('style', 'white-space: normal;');
$statusLink = 'media_types.php?go=' . ($mediaType['status'] == MEDIA_TYPE_STATUS_DISABLED ? 'activate' : 'disable') . '&mediatypeids' . SQUAREBRACKETS . '=' . $mediaType['mediatypeid'];
$status = MEDIA_TYPE_STATUS_ACTIVE == $mediaType['status'] ? new CLink(_('Enabled'), $statusLink, 'enabled') : new CLink(_('Disabled'), $statusLink, 'disabled');
// append row
$mediaTypeTable->addRow(array(new CCheckBox('mediatypeids[' . $mediaType['mediatypeid'] . ']', null, null, $mediaType['mediatypeid']), $this->data['displayNodes'] ? $mediaType['nodename'] : null, new CLink($mediaType['description'], '?form=edit&mediatypeid=' . $mediaType['mediatypeid']), media_type2str($mediaType['typeid']), $status, $actionColumn, $details));
}
// create go button
$goComboBox = new CComboBox('go');
$goOption = new CComboItem('activate', _('Enable selected'));
$goOption->setAttribute('confirm', _('Enable selected media types?'));
$goComboBox->addItem($goOption);
$goOption = new CComboItem('disable', _('Disable selected'));
$goOption->setAttribute('confirm', _('Disable selected media types?'));
$goComboBox->addItem($goOption);
$goOption = new CComboItem('delete', _('Delete selected'));
$goOption->setAttribute('confirm', _('Delete selected media types?'));
$goComboBox->addItem($goOption);
$goButton = new CSubmit('goButton', _('Go') . ' (0)');
$goButton->setAttribute('id', 'goButton');
zbx_add_post_js('chkbxRange.pageGoName = "mediatypeids";');
// append table to form
$mediaTypeForm->addItem(array($this->data['paging'], $mediaTypeTable, $this->data['paging'], get_table_header(array($goComboBox, $goButton))));
// append form to widget
$mediaTypeWidget->addItem($mediaTypeForm);
return $mediaTypeWidget;
示例6: getRequest
$year = getRequest('year', date('Y'));
define('YEAR_LEFT_SHIFT', 5);
$service = API::Service()->get(array('output' => array('serviceid', 'name', 'showsla', 'goodsla'), 'serviceids' => $_REQUEST['serviceid']));
$service = reset($service);
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'));
示例7: CComboBox
$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));
$hostInventoryWidget->addHeaderRowNumber();
$table = new CTableInfo(_('No hosts found.'));
$table->setHeader(array(make_sorting_header(_('Host'), 'name', $this->data['sort'], $this->data['sortorder']), _('Group'), make_sorting_header(_('Name'), 'pr_name', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Type'), 'pr_type', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('OS'), 'pr_os', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Serial number A'), 'pr_serialno_a', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Tag'), 'pr_tag', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('MAC address A'), 'pr_macaddress_a', $this->data['sort'], $this->data['sortorder'])));
foreach ($this->data['hosts'] as $host) {
$hostGroups = array();
foreach ($host['groups'] as $group) {
$hostGroups[] = $group['name'];
}
natsort($hostGroups);
$hostGroups = implode(', ', $hostGroups);
$row = array(new CLink($host['name'], '?hostid=' . $host['hostid'] . url_param('groupid'), $host['status'] == HOST_STATUS_NOT_MONITORED ? 'not-monitored' : ''), $hostGroups, zbx_str2links($host['inventory']['name']), zbx_str2links($host['inventory']['type']), zbx_str2links($host['inventory']['os']), zbx_str2links($host['inventory']['serialno_a']), zbx_str2links($host['inventory']['tag']), zbx_str2links($host['inventory']['macaddress_a']));
$table->addRow($row);
}
$table = array($this->data['paging'], $table, $this->data['paging']);
示例8: array
$page['title'] = _('Configuration of trigger displaying options');
$page['file'] = 'adm.triggerdisplayoptions.php';
$page['hist_arg'] = array();
require_once dirname(__FILE__) . '/include/page_header.php';
$fields = array('problem_unack_color' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'problem_ack_color' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'ok_unack_color' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'ok_ack_color' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'problem_unack_style' => array(T_ZBX_INT, O_OPT, null, IN('1'), null), 'problem_ack_style' => array(T_ZBX_INT, O_OPT, null, IN('1'), null), 'ok_unack_style' => array(T_ZBX_INT, O_OPT, null, IN('1'), null), 'ok_ack_style' => array(T_ZBX_INT, O_OPT, null, IN('1'), null), 'ok_period' => array(T_ZBX_INT, O_OPT, null, null, 'isset({save})'), 'blink_period' => array(T_ZBX_INT, O_OPT, null, null, 'isset({save})'), 'save' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form_refresh' => array(T_ZBX_INT, O_OPT, null, null, null));
check_fields($fields);
if (isset($_REQUEST['save'])) {
$configs = array('ok_period' => get_request('ok_period'), 'blink_period' => get_request('blink_period'), 'problem_unack_color' => get_request('problem_unack_color'), 'problem_ack_color' => get_request('problem_ack_color'), 'ok_unack_color' => get_request('ok_unack_color'), 'ok_ack_color' => get_request('ok_ack_color'), 'problem_unack_style' => get_request('problem_unack_style', 0), 'problem_ack_style' => get_request('problem_ack_style', 0), 'ok_unack_style' => get_request('ok_unack_style', 0), 'ok_ack_style' => get_request('ok_ack_style', 0));
$result = update_config($configs);
show_messages($result, _('Configuration updated'), _('Cannot update configuration'));
}
$form = new CForm();
$form->cleanItems();
$cmbConf = new CComboBox('configDropDown', 'adm.triggerdisplayoptions.php', 'redirect(this.options[this.selectedIndex].value);');
$cmbConf->addItems(array('adm.gui.php' => _('GUI'), 'adm.housekeeper.php' => _('Housekeeping'), 'adm.images.php' => _('Images'), 'adm.iconmapping.php' => _('Icon mapping'), 'adm.regexps.php' => _('Regular expressions'), 'adm.macros.php' => _('Macros'), 'adm.valuemapping.php' => _('Value mapping'), 'adm.workingtime.php' => _('Working time'), 'adm.triggerseverities.php' => _('Trigger severities'), 'adm.triggerdisplayoptions.php' => _('Trigger displaying options'), 'adm.other.php' => _('Other')));
$form->addItem($cmbConf);
$cnf_wdgt = new CWidget();
$cnf_wdgt->addPageHeader(_('CONFIGURATION OF ZABBIX'), $form);
$data = array();
$data['form_refresh'] = get_request('form_refresh', 0);
// form has been submitted
if ($data['form_refresh']) {
$data['ok_period'] = get_request('ok_period');
$data['blink_period'] = get_request('blink_period');
$data['problem_unack_color'] = get_request('problem_unack_color');
$data['problem_ack_color'] = get_request('problem_ack_color');
$data['ok_unack_color'] = get_request('ok_unack_color');
$data['ok_ack_color'] = get_request('ok_ack_color');
$data['problem_unack_style'] = get_request('problem_unack_style');
$data['problem_ack_style'] = get_request('problem_ack_style');
$data['ok_unack_style'] = get_request('ok_unack_style');
示例9: CNumericBox
foreach ($this->data['slides'] as $step => $slides) {
$name = '';
if (!empty($slides['screenid'])) {
$screen = get_screen_by_screenid($slides['screenid']);
if (!empty($screen['name'])) {
$name = $screen['name'];
}
}
$delay = new CNumericBox('slides[' . $step . '][delay]', !empty($slides['delay']) ? $slides['delay'] : '', 5, 'no', true, false);
$delay->setAttribute('placeholder', _('default'));
$removeButton = new CButton('remove_' . $step, _('Remove'), 'javascript: removeSlide(this);', 'link_menu');
$removeButton->setAttribute('remove_slide', $step);
$row = new CRow(array(new CSpan(null, 'ui-icon ui-icon-arrowthick-2-n-s move'), new CSpan($i++ . ':', 'rowNum', 'current_slide_' . $step), $name, $delay, $removeButton), 'sortable', 'slides_' . $step);
$slideTable->addRow($row);
}
$addButtonColumn = new CCol(empty($this->data['work_slide']) ? new CButton('add', _('Add'), 'return PopUp("popup.php?srctbl=screens&srcfld1=screenid&dstfrm=' . $slideForm->getName() . '&multiselect=1", 450, 450)', 'link_menu') : null, null, 5);
$addButtonColumn->setAttribute('style', 'vertical-align: middle;');
$slideTable->addRow(new CRow($addButtonColumn, null, 'screenListFooter'));
$slideFormList->addRow(_('Slides'), new CDiv($slideTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
// append tabs to form
$slideTab = new CTabView();
$slideTab->addTab('slideTab', _('Slide'), $slideFormList);
$slideForm->addItem($slideTab);
// append buttons to form
if (empty($this->data['slideshowid'])) {
$slideForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), new CButtonCancel()));
} else {
$slideForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), array(new CSubmit('clone', _('Clone')), new CButtonDelete(_('Delete slide show?'), url_param('form') . url_param('slideshowid') . url_param('config')), new CButtonCancel())));
}
$slideWidget->addItem($slideForm);
return $slideWidget;
示例10: array
$passwordField = array($passwordButton, $passwordBox);
} else {
$passwordField = new CPassBox('password', '', ZBX_TEXTBOX_SMALL_SIZE);
}
// append password field to form list
if ($this->data['type'] == MEDIA_TYPE_JABBER) {
$mediaTypeFormList->addRow(_('Jabber identifier'), new CTextBox('username', $this->data['username'], ZBX_TEXTBOX_STANDARD_SIZE));
$mediaTypeFormList->addRow(_('Password'), $passwordField);
} else {
$mediaTypeFormList->addRow(_('Username'), new CTextBox('username', $this->data['username'], ZBX_TEXTBOX_STANDARD_SIZE));
$mediaTypeFormList->addRow(_('Password'), $passwordField);
$limitCb = new CComboBox('exec_path', $this->data['exec_path']);
$limitCb->addItems(array(EZ_TEXTING_LIMIT_USA => _('USA (160 characters)'), EZ_TEXTING_LIMIT_CANADA => _('Canada (136 characters)')));
$mediaTypeFormList->addRow(_('Message text limit'), $limitCb);
}
}
$mediaTypeFormList->addRow(_('Enabled'), new CCheckBox('status', MEDIA_TYPE_STATUS_ACTIVE == $this->data['status'], null, MEDIA_TYPE_STATUS_ACTIVE));
// append form list to tab
$mediaTypeTab = new CTabView();
$mediaTypeTab->addTab('mediaTypeTab', _('Media type'), $mediaTypeFormList);
// append tab to form
$mediaTypeForm->addItem($mediaTypeTab);
// append buttons to form
if (!empty($this->data['mediatypeid'])) {
$mediaTypeForm->addItem(makeFormFooter(new CSubmit('update', _('Update')), array(new CButtonDelete(_('Delete selected media type?'), url_param('form') . url_param('mediatypeid') . url_param('config')), new CButtonCancel(url_param('config')))));
} else {
$mediaTypeForm->addItem(makeFormFooter(new CSubmit('add', _('Add')), new CButtonCancel(url_param('config'))));
}
// append form to widget
$mediaTypeWidget->addItem($mediaTypeForm);
return $mediaTypeWidget;
示例11: CForm
// 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)));
$l_form->AddItem(array(SPACE, new CButton('show', S_SHOW, 'javascript: submit();')));
// $l_form->AddItem(array(SPACE, new CButton('show',S_SHOW,"javascript: return updater.onetime_update('".ZBX_PAGE_MAIN_HAT."',this.form);")));
示例12: CForm
if (!isset($_REQUEST['stepid'])) {
insert_js('add_httpstep(' . zbx_jsvalue($_REQUEST['dstfrm']) . ',' . zbx_jsvalue($_REQUEST['name']) . ',' . zbx_jsvalue($_REQUEST['timeout']) . ',' . zbx_jsvalue($_REQUEST['url']) . ',' . zbx_jsvalue($_REQUEST['posts']) . ',' . zbx_jsvalue($_REQUEST['variables']) . ',' . zbx_jsvalue($_REQUEST['required']) . ',' . zbx_jsvalue($_REQUEST['status_codes']) . ");\n");
} else {
insert_js('update_httpstep(' . zbx_jsvalue($_REQUEST['dstfrm']) . ',' . zbx_jsvalue($_REQUEST['list_name']) . ',' . zbx_jsvalue($_REQUEST['stepid']) . ',' . zbx_jsvalue($_REQUEST['name']) . ',' . zbx_jsvalue($_REQUEST['timeout']) . ',' . zbx_jsvalue($_REQUEST['url']) . ',' . zbx_jsvalue($_REQUEST['posts']) . ',' . zbx_jsvalue($_REQUEST['variables']) . ',' . zbx_jsvalue($_REQUEST['required']) . ',' . zbx_jsvalue($_REQUEST['status_codes']) . ");\n");
}
} else {
$httpPopupForm = new CForm();
$httpPopupForm->addVar('dstfrm', get_request('dstfrm', null));
$httpPopupForm->addVar('stepid', get_request('stepid', null));
$httpPopupForm->addVar('list_name', get_request('list_name', null));
$httpPopupForm->addVar('templated', get_request('templated', null));
$httpPopupForm->addVar('old_name', get_request('old_name', null));
$httpPopupForm->addVar('steps_names', get_request('steps_names', null));
$httpPopupFormList = new CFormList('httpPopupFormList');
$httpPopupFormList->addRow(_('Name'), new CTextBox('name', get_request('name', ''), ZBX_TEXTBOX_STANDARD_SIZE, get_request('templated', null), 64));
$httpPopupFormList->addRow(_('URL'), new CTextBox('url', get_request('url', ''), ZBX_TEXTBOX_STANDARD_SIZE));
$httpPopupFormList->addRow(_('Post'), new CTextArea('posts', get_request('posts', '')));
$httpPopupFormList->addRow(_('Variables'), new CTextArea('variables', get_request('variables', '')));
$httpPopupFormList->addRow(_('Timeout'), new CNumericBox('timeout', get_request('timeout', 15), 5));
$httpPopupFormList->addRow(_('Required string'), new CTextBox('required', get_request('required', ''), ZBX_TEXTBOX_STANDARD_SIZE));
$httpPopupFormList->addRow(_('Required status codes'), new CTextBox('status_codes', get_request('status_codes', ''), ZBX_TEXTBOX_STANDARD_SIZE));
// append tabs to form
$httpPopupTab = new CTabView();
$httpPopupTab->addTab('scenarioStepTab', _('Step of scenario'), $httpPopupFormList);
$httpPopupForm->addItem($httpPopupTab);
// append buttons to form
$stepid = get_request('stepid', null);
$httpPopupForm->addItem(makeFormFooter(new CSubmit('save', isset($stepid) ? _('Update') : _('Add')), new CButtonCancel(null, 'close_window();')));
$httpPopupWidget->addItem($httpPopupForm);
}
return $httpPopupWidget;
示例13: CForm
// }}}PAGE HEADER
// HEADER {{{
$r_form = new CForm(null, 'get');
$r_form->addVar('fullscreen', $_REQUEST['fullscreen']);
$r_form->addVar('triggerid', get_request('triggerid'));
$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;
示例14: CComboBox
$exactComboBox = new CComboBox('filter_exact', $_REQUEST['filter_exact']);
$exactComboBox->addItem('0', _('like'));
$exactComboBox->addItem('1', _('exactly'));
$filter_table->addRow(array(array(array(bold(_('Field:')), $inventoryFieldsComboBox), array($exactComboBox, new CTextBox('filter_field_value', $_REQUEST['filter_field_value'], 20)))));
$filter = new CButton('filter', _('Filter'), "javascript: create_var('zbx_filter', 'filter_set', '1', true);");
$filter->useJQueryStyle('main');
$reset = new CButton('reset', _('Reset'), "javascript: clearAllForm('zbx_filter');");
$reset->useJQueryStyle();
$div_buttons = new CDiv(array($filter, SPACE, $reset));
$div_buttons->setAttribute('style', 'padding: 4px 0px;');
$footer_col = new CCol($div_buttons, 'controls');
$filter_table->addRow($footer_col);
$filter_form = new CForm('get');
$filter_form->setAttribute('name', 'zbx_filter');
$filter_form->setAttribute('id', 'zbx_filter');
$filter_form->addItem($filter_table);
$hostinvent_wdgt->addFlicker($filter_form, CProfile::get('web.hostinventories.filter.state', 0));
$hostinvent_wdgt->addHeaderRowNumber();
$table = new CTableInfo(_('No hosts defined.'));
$table->setHeader(array(is_show_all_nodes() ? make_sorting_header(_('Node'), 'hostid') : null, make_sorting_header(_('Host'), 'name'), _('Group'), make_sorting_header(_('Name'), 'pr_name'), make_sorting_header(_('Type'), 'pr_type'), make_sorting_header(_('OS'), 'pr_os'), make_sorting_header(_('Serial number A'), 'pr_serialno_a'), make_sorting_header(_('Tag'), 'pr_tag'), make_sorting_header(_('MAC address A'), 'pr_macaddress_a')));
$hosts = array();
$paging = getPagingLine($hosts);
if ($pageFilter->groupsSelected) {
// which inventory fields we will need for displaying
$requiredInventoryFields = array('name', 'type', 'os', 'serialno_a', 'tag', 'macaddress_a');
// checking if correct inventory field is specified for filter
$possibleInventoryFields = getHostInventories();
$possibleInventoryFields = zbx_toHash($possibleInventoryFields, 'db_field');
if (!empty($_REQUEST['filter_field']) && !empty($_REQUEST['filter_field_value']) && !isset($possibleInventoryFields[$_REQUEST['filter_field']])) {
error(_s('Impossible to filter by inventory field "%s", which does not exist.', $_REQUEST['filter_field']));
} else {
示例15: getItemFilterForm
function getItemFilterForm(&$items)
{
$filter_groupId = $_REQUEST['filter_groupid'];
$filter_hostId = $_REQUEST['filter_hostid'];
$filter_application = $_REQUEST['filter_application'];
$filter_name = $_REQUEST['filter_name'];
$filter_type = $_REQUEST['filter_type'];
$filter_key = $_REQUEST['filter_key'];
$filter_snmp_community = $_REQUEST['filter_snmp_community'];
$filter_snmpv3_securityname = $_REQUEST['filter_snmpv3_securityname'];
$filter_snmp_oid = $_REQUEST['filter_snmp_oid'];
$filter_port = $_REQUEST['filter_port'];
$filter_value_type = $_REQUEST['filter_value_type'];
$filter_data_type = $_REQUEST['filter_data_type'];
$filter_delay = $_REQUEST['filter_delay'];
$filter_history = $_REQUEST['filter_history'];
$filter_trends = $_REQUEST['filter_trends'];
$filter_status = $_REQUEST['filter_status'];
$filter_state = $_REQUEST['filter_state'];
$filter_templated_items = $_REQUEST['filter_templated_items'];
$filter_with_triggers = $_REQUEST['filter_with_triggers'];
$subfilter_hosts = $_REQUEST['subfilter_hosts'];
$subfilter_apps = $_REQUEST['subfilter_apps'];
$subfilter_types = $_REQUEST['subfilter_types'];
$subfilter_value_types = $_REQUEST['subfilter_value_types'];
$subfilter_status = $_REQUEST['subfilter_status'];
$subfilter_state = $_REQUEST['subfilter_state'];
$subfilter_templated_items = $_REQUEST['subfilter_templated_items'];
$subfilter_with_triggers = $_REQUEST['subfilter_with_triggers'];
$subfilter_history = $_REQUEST['subfilter_history'];
$subfilter_trends = $_REQUEST['subfilter_trends'];
$subfilter_interval = $_REQUEST['subfilter_interval'];
$form = new CForm('get');
$form->setAttribute('name', 'zbx_filter');
$form->setAttribute('id', 'zbx_filter');
$form->addVar('subfilter_hosts', $subfilter_hosts);
$form->addVar('subfilter_apps', $subfilter_apps);
$form->addVar('subfilter_types', $subfilter_types);
$form->addVar('subfilter_value_types', $subfilter_value_types);
$form->addVar('subfilter_status', $subfilter_status);
$form->addVar('subfilter_state', $subfilter_state);
$form->addVar('subfilter_templated_items', $subfilter_templated_items);
$form->addVar('subfilter_with_triggers', $subfilter_with_triggers);
$form->addVar('subfilter_history', $subfilter_history);
$form->addVar('subfilter_trends', $subfilter_trends);
$form->addVar('subfilter_interval', $subfilter_interval);
// type select
$fTypeVisibility = array();
$cmbType = new CComboBox('filter_type', $filter_type);
$cmbType->setAttribute('id', 'filter_type');
$cmbType->addItem(-1, _('all'));
foreach (array('filter_delay_label', 'filter_delay') as $vItem) {
zbx_subarray_push($fTypeVisibility, -1, $vItem);
}
$itemTypes = item_type2str();
unset($itemTypes[ITEM_TYPE_HTTPTEST]);
// httptest items are only for internal zabbix logic
$cmbType->addItems($itemTypes);
foreach ($itemTypes as $typeNum => $typeLabel) {
if ($typeNum != ITEM_TYPE_TRAPPER) {
zbx_subarray_push($fTypeVisibility, $typeNum, 'filter_delay_label');
zbx_subarray_push($fTypeVisibility, $typeNum, 'filter_delay');
}
switch ($typeNum) {
case ITEM_TYPE_SNMPV1:
case ITEM_TYPE_SNMPV2C:
$snmp_types = array('filter_snmp_community_label', 'filter_snmp_community', 'filter_snmp_oid_label', 'filter_snmp_oid', 'filter_port_label', 'filter_port');
foreach ($snmp_types as $vItem) {
zbx_subarray_push($fTypeVisibility, $typeNum, $vItem);
}
break;
case ITEM_TYPE_SNMPV3:
foreach (array('filter_snmpv3_securityname_label', 'filter_snmpv3_securityname', 'filter_snmp_oid_label', 'filter_snmp_oid', 'filter_port_label', 'filter_port') as $vItem) {
zbx_subarray_push($fTypeVisibility, $typeNum, $vItem);
}
break;
}
}
zbx_add_post_js("var filterTypeSwitcher = new CViewSwitcher('filter_type', 'change', " . zbx_jsvalue($fTypeVisibility, true) . ');');
// type of information select
$fVTypeVisibility = array();
$cmbValType = new CComboBox('filter_value_type', $filter_value_type);
$cmbValType->addItem(-1, _('all'));
$cmbValType->addItem(ITEM_VALUE_TYPE_UINT64, _('Numeric (unsigned)'));
$cmbValType->addItem(ITEM_VALUE_TYPE_FLOAT, _('Numeric (float)'));
$cmbValType->addItem(ITEM_VALUE_TYPE_STR, _('Character'));
$cmbValType->addItem(ITEM_VALUE_TYPE_LOG, _('Log'));
$cmbValType->addItem(ITEM_VALUE_TYPE_TEXT, _('Text'));
foreach (array('filter_data_type_label', 'filter_data_type') as $vItem) {
zbx_subarray_push($fVTypeVisibility, ITEM_VALUE_TYPE_UINT64, $vItem);
}
zbx_add_post_js("var filterValueTypeSwitcher = new CViewSwitcher('filter_value_type', 'change', " . zbx_jsvalue($fVTypeVisibility, true) . ');');
// status select
$cmbStatus = new CComboBox('filter_status', $filter_status);
$cmbStatus->addItem(-1, _('all'));
foreach (array(ITEM_STATUS_ACTIVE, ITEM_STATUS_DISABLED) as $status) {
$cmbStatus->addItem($status, item_status2str($status));
}
// state select
$cmbState = new CComboBox('filter_state', $filter_state);
//.........这里部分代码省略.........