本文整理汇总了PHP中CComboBox::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP CComboBox::setAttribute方法的具体用法?PHP CComboBox::setAttribute怎么用?PHP CComboBox::setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComboBox
的用法示例。
在下文中一共展示了CComboBox::setAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CCheckBox
// append host in maintenance checkbox to form list
$maintenanceCheckBox = new CCheckBox('maintenance', $this->data['maintenance'], null, '1');
if (!$this->data['isFilterEnable']) {
$maintenanceCheckBox->setAttribute('disabled', 'disabled');
}
$dashconfFormList->addRow(_('Hosts'), array($maintenanceCheckBox, _('Show hosts in maintenance')));
// append trigger severities to form list
$severities = array();
foreach ($this->data['severities'] as $severity) {
$serverityCheckBox = new CCheckBox('trgSeverity[' . $severity . ']', isset($this->data['severity'][$severity]), '', 1);
$serverityCheckBox->setEnabled($this->data['isFilterEnable']);
$severities[] = array($serverityCheckBox, getSeverityCaption($severity));
$severities[] = BR();
}
array_pop($severities);
$dashconfFormList->addRow(_('Triggers with severity'), $severities);
// append problem display to form list
$extAckComboBox = new CComboBox('extAck', $this->data['extAck']);
$extAckComboBox->addItems(array(EXTACK_OPTION_ALL => _('All'), EXTACK_OPTION_BOTH => _('Separated'), EXTACK_OPTION_UNACK => _('Unacknowledged only')));
$extAckComboBox->setEnabled($this->data['isFilterEnable'] && $this->data['config']['event_ack_enable']);
if (!$this->data['config']['event_ack_enable']) {
$extAckComboBox->setAttribute('title', _('Event acknowledging disabled'));
}
$dashconfFormList->addRow(_('Problem display'), $extAckComboBox);
// create tab
$dashconfTab = new CTabView();
$dashconfTab->addTab('dashconfTab', _('Filter'), $dashconfFormList);
$dashconfForm->addItem($dashconfTab);
$dashconfForm->addItem(makeFormFooter(new CSubmit('update', _('Update')), new CButtonCancel()));
$dashconfWidget->addItem($dashconfForm);
return $dashconfWidget;
示例2: CDiv
$openState = CProfile::get('web.latest.toggle_other', null, $host['hostid']);
$toggle = new CDiv(null, 'app-list-toggle icon-plus-9x9');
if ($openState) {
$toggle->addClass('icon-minus-9x9');
}
$toggle->setAttribute('data-app-id', '0_' . $host['hostid']);
$toggle->setAttribute('data-open-state', $openState);
$hostName = null;
if (!$singleHostSelected) {
$hostName = new CSpan($host['name'], 'link_menu menu-host' . ($host['status'] == HOST_STATUS_NOT_MONITORED ? ' not-monitored' : ''));
$hostName->setMenuPopup(CMenuPopupHelper::getHost($host, $hostScripts[$host['hostid']]));
}
// add toggle row
$table->addRow(array($toggle, '', $hostName, new CCol(array(bold('- ' . 'other' . ' -'), ' (' . _n('%1$s Item', '%1$s Items', $dbHost['item_cnt']) . ')'), null, $filter['showDetails'] ? 10 : 5)), 'odd_row');
// add toggle sub rows
foreach ($appRows as $row) {
$row->setAttribute('parent_app_id', '0_' . $host['hostid']);
$row->addClass('odd_row');
if (!$openState) {
$row->addClass('hidden');
}
$table->addRow($row);
}
}
$goBox = new CComboBox('graphtype', GRAPH_TYPE_STACKED, null, array(GRAPH_TYPE_STACKED => _('Display stacked graph'), GRAPH_TYPE_NORMAL => _('Display graph')));
$goBox->setAttribute('id', 'action');
$goButton = new CSubmit('goButton', _('Go') . ' (0)');
$form->addItem(array($table, get_table_header(array($goBox, $goButton))));
$latestWidget->addItem($form);
$latestWidget->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
示例3: CWidget
}
$_REQUEST['alias'] = get_request('alias', CProfile::get('web.auditlogs.filter.alias', ''));
$_REQUEST['action'] = get_request('action', CProfile::get('web.auditlogs.filter.action', -1));
$_REQUEST['resourcetype'] = get_request('resourcetype', CProfile::get('web.auditlogs.filter.resourcetype', -1));
if (isset($_REQUEST['filter_set']) || isset($_REQUEST['filter_rst'])) {
CProfile::update('web.auditlogs.filter.alias', $_REQUEST['alias'], PROFILE_TYPE_STR);
CProfile::update('web.auditlogs.filter.action', $_REQUEST['action'], PROFILE_TYPE_INT);
CProfile::update('web.auditlogs.filter.resourcetype', $_REQUEST['resourcetype'], PROFILE_TYPE_INT);
}
// --------------
$audit_wdgt = new CWidget();
// HEADER
$frmForm = new CForm();
$frmForm->setMethod('get');
$cmbConf = new CComboBox('config', 'auditlogs.php');
$cmbConf->setAttribute('onchange', 'javascript: redirect(this.options[this.selectedIndex].value);');
$cmbConf->addItem('auditlogs.php', S_LOGS);
$cmbConf->addItem('auditacts.php', S_ACTIONS);
$frmForm->addItem($cmbConf);
$audit_wdgt->addPageHeader(S_AUDIT_LOGS_BIG, $frmForm);
$numrows = new CDiv();
$numrows->setAttribute('name', 'numrows');
$audit_wdgt->addHeader(S_LOGS_BIG);
$audit_wdgt->addHeader($numrows);
//--------
/************************* FILTER **************************/
/***********************************************************/
$filterForm = new CFormTable();
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
$row = new CRow(array(new CCol(S_USER, 'form_row_l'), new CCol(array(new CTextBox('alias', $_REQUEST['alias'], 32), new CButton('btn1', S_SELECT, "return PopUp('popup.php?" . "dstfrm=" . $filterForm->GetName() . "&dstfld1=alias&srctbl=users&srcfld1=alias&real_hosts=1');", 'T')), 'form_row_r')));
示例4: CComboBox
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']) {
$ev_select->addItem(EVENTS_OPTION_NOT_ACK, S_SHOW_UNACKNOWLEDGED . SPACE . '(' . $config['event_expire'] . SPACE . ($config['event_expire'] > 1 ? S_DAYS : S_DAY) . ')');
}
if (EVENTS_OPTION_ONLYTRUE_NOTACK && $config['event_ack_enable']) {
$ev_select->addItem(EVENTS_OPTION_ONLYTRUE_NOTACK, S_SHOW_PROBLEM_UNACKNOWLEDGED . SPACE . '(' . $config['event_expire'] . SPACE . ($config['event_expire'] > 1 ? S_DAYS : S_DAY) . ')');
}
//------- JP -------
if ($show_triggers == TRIGGERS_OPTION_NOFALSEFORB) {
$ev_select->addItem(EVENTS_OPTION_NOFALSEFORB, ' - ', 'yes');
$ev_select->setAttribute('disabled', 'disabled');
$ev_status = new CComboBox('show_events_status', $show_events_status, 'javascript: submit();');
$ev_status->addItem(EVENTS_NOFALSEFORB_STATUS_ALL, S_SHOW_ALL);
$ev_status->addItem(EVENTS_NOFALSEFORB_STATUS_FALSE, S_SHOW_ONLY_FALSE);
$ev_status->addItem(EVENTS_NOFALSEFORB_STATUS_TRUE, S_SHOW_ONLY_TRUE);
}
//---
$filterForm->addRow(S_TRIGGERS, $tr_select);
// JP
if ($show_triggers == TRIGGERS_OPTION_NOFALSEFORB) {
$filterForm->addRow(S_STATUS, $ev_status);
$filterForm->addVar('show_events', $show_events);
} else {
$filterForm->addRow(S_EVENTS, $ev_select);
$filterForm->addVar('show_events_status', $show_events_status);
}
示例5: CWidget
$widget = (new CWidget())->setTitle(_('Dashboard'));
// create form
$form = (new CForm())->setName('dashconf')->setId('dashform')->addVar('filterEnable', $this->data['isFilterEnable']);
// create form list
$form_list = new CFormList('dashconfFormList');
// append filter status to form list
if ($this->data['isFilterEnable']) {
$filterStatusSpan = (new CSpan(_('Enabled')))->addClass(ZBX_STYLE_LINK_ACTION)->addClass(ZBX_STYLE_GREEN)->onClick("create_var('" . $form->getName() . "', 'filterEnable', 0, true);")->setAttribute('tabindex', 0);
} else {
$filterStatusSpan = (new CSpan(_('Disabled')))->addClass(ZBX_STYLE_LINK_ACTION)->addClass(ZBX_STYLE_RED)->onClick("\$('dashform').enable(); create_var('" . $form->getName() . "', 'filterEnable', 1, true);")->setAttribute('tabindex', 0);
}
$form_list->addRow(_('Dashboard filter'), $filterStatusSpan);
// append host groups to form list
$hostGroupsComboBox = new CComboBox('grpswitch', $this->data['grpswitch'], 'submit()', [0 => _('All'), 1 => _('Selected')]);
if (!$this->data['isFilterEnable']) {
$hostGroupsComboBox->setAttribute('disabled', 'disabled');
}
$form_list->addRow(_('Host groups'), $hostGroupsComboBox);
if ($this->data['grpswitch']) {
$form_list->addRow(_('Show selected groups'), (new CMultiSelect(['name' => 'groupids[]', 'objectName' => 'hostGroup', 'data' => $this->data['groups'], 'disabled' => !$this->data['isFilterEnable'], 'popup' => ['parameters' => 'srctbl=host_groups&dstfrm=' . $form->getName() . '&dstfld1=groupids_' . '&srcfld1=groupid&multiselect=1']]))->setWidth(ZBX_TEXTAREA_FILTER_STANDARD_WIDTH));
$form_list->addRow(_('Hide selected groups'), (new CMultiSelect(['name' => 'hidegroupids[]', 'objectName' => 'hostGroup', 'data' => $this->data['hideGroups'], 'disabled' => !$this->data['isFilterEnable'], 'popup' => ['parameters' => 'srctbl=host_groups&dstfrm=' . $form->getName() . '&dstfld1=hidegroupids_' . '&srcfld1=groupid&multiselect=1']]))->setWidth(ZBX_TEXTAREA_FILTER_STANDARD_WIDTH));
}
// append host in maintenance checkbox to form list
$maintenanceCheckBox = (new CCheckBox('maintenance'))->setChecked($this->data['maintenance'] == 1);
if (!$this->data['isFilterEnable']) {
$maintenanceCheckBox->setAttribute('disabled', 'disabled');
}
$form_list->addRow(_('Hosts'), new CLabel([$maintenanceCheckBox, _('Show hosts in maintenance')], 'maintenance'));
// append trigger severities to form list
$severities = [];
foreach ($this->data['severities'] as $severity) {
示例6: 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);
//.........这里部分代码省略.........
示例7: array
$customLabelImage->addClass('hidden');
}
$sysmapList->addRow(_('Image label type'), array($labelTypeImage, BR(), $customLabelImage));
// append icon label to sysmap
unset($labelTypes[MAP_LABEL_TYPE_CUSTOM]);
$sysmapList->addRow(_('Icon label type'), new CComboBox('label_type', $this->data['label_type'], null, $labelTypes));
// append icon label location to sysmap
$cmbLocation = new CComboBox('label_location', $this->data['label_location']);
$cmbLocation->addItems(array(0 => _('Bottom'), 1 => _('Left'), 2 => _('Right'), 3 => _('Top')));
$sysmapList->addRow(_('Icon label location'), $cmbLocation);
// append show unack to sysmap
$selectShowUnack = new CComboBox('show_unack', $this->data['show_unack']);
$selectShowUnack->addItems(array(EXTACK_OPTION_ALL => _('All'), EXTACK_OPTION_BOTH => _('Separated'), EXTACK_OPTION_UNACK => _('Unacknowledged only')));
$selectShowUnack->setEnabled($config['event_ack_enable']);
if (!$config['event_ack_enable']) {
$selectShowUnack->setAttribute('title', _('Acknowledging disabled'));
}
$sysmapList->addRow(_('Problem display'), $selectShowUnack);
// create url table
$urlTable = new CTable(_('No URLs defined.'), 'formElementTable');
$urlTable->setAttribute('style', 'min-width: 500px;');
$urlTable->setHeader(array(_('Name'), _('URL'), _('Element'), SPACE));
if (empty($this->data['urls'])) {
$this->data['urls'][] = array('name' => '', 'url' => '', 'elementtype' => 0);
}
$i = 0;
foreach ($this->data['urls'] as $url) {
$urlLabel = new CTextBox('urls[' . $i . '][name]', $url['name'], 32);
$urlLink = new CTextBox('urls[' . $i . '][url]', $url['url'], 32);
$urlEtype = new CCombobox('urls[' . $i . '][elementtype]', $url['elementtype']);
$urlEtype->addItems(sysmap_element_types());
示例8: array
// disable node selection if we show objects from only one host or LLD rule
if (hasRequest('only_hostid') || hasRequest('parent_discoveryid')) {
$nodeComboBox->setEnabled('disabled');
}
$frmTitle->addItem(array(SPACE, _('Node'), SPACE, $nodeComboBox, SPACE));
}
/*
* Only host id
*/
if (isset($onlyHostid)) {
$only_hosts = API::Host()->get(array('hostids' => $hostid, 'templated_hosts' => true, 'output' => array('hostid', 'host'), 'limit' => 1));
$host = reset($only_hosts);
$cmbHosts = new CComboBox('hostid', $hostid);
$cmbHosts->addItem($hostid, $host['host']);
$cmbHosts->setEnabled('disabled');
$cmbHosts->setAttribute('title', _('You can not switch hosts for current selection.'));
$frmTitle->addItem(array(SPACE, _('Host'), SPACE, $cmbHosts));
} else {
if (str_in_array($srctbl, array('triggers', 'items', 'applications', 'graphs', 'templates', 'hosts', 'host_templates'))) {
$frmTitle->addItem(array(_('Group'), SPACE, $pageFilter->getGroupsCB()));
}
if (str_in_array($srctbl, array('help_items'))) {
$itemtype = get_request('itemtype', 0);
$cmbTypes = new CComboBox('itemtype', $itemtype, 'javascript: submit();');
foreach ($allowed_item_types as $type) {
$cmbTypes->addItem($type, item_type2str($type));
}
$frmTitle->addItem(array(_('Type'), SPACE, $cmbTypes));
}
if (str_in_array($srctbl, array('triggers', 'items', 'applications', 'graphs'))) {
$frmTitle->addItem(array(SPACE, _('Host'), SPACE, $pageFilter->getHostsCB()));
示例9: array
$customLabelImageTextArea->addClass('hidden');
}
$sysmapList->addRow(_('Image label type'), array($labelTypeImageComboBox, BR(), $customLabelImageTextArea));
// append icon label to form list
unset($this->data['labelTypes'][MAP_LABEL_TYPE_CUSTOM]);
$sysmapList->addRow(_('Icon label type'), new CComboBox('label_type', $this->data['sysmap']['label_type'], null, $this->data['labelTypes']));
// append icon label location to form list
$locationComboBox = new CComboBox('label_location', $this->data['sysmap']['label_location']);
$locationComboBox->addItems(array(0 => _('Bottom'), 1 => _('Left'), 2 => _('Right'), 3 => _('Top')));
$sysmapList->addRow(_('Icon label location'), $locationComboBox);
// append show unack to form list
$showUnackComboBox = new CComboBox('show_unack', $this->data['sysmap']['show_unack']);
$showUnackComboBox->addItems(array(EXTACK_OPTION_ALL => _('All'), EXTACK_OPTION_BOTH => _('Separated'), EXTACK_OPTION_UNACK => _('Unacknowledged only')));
$showUnackComboBox->setEnabled($this->data['config']['event_ack_enable']);
if (!$this->data['config']['event_ack_enable']) {
$showUnackComboBox->setAttribute('title', _('Acknowledging disabled'));
}
$sysmapList->addRow(_('Problem display'), $showUnackComboBox);
// append severity min to form list
$sysmapList->addRow(_('Minimum trigger severity'), new CSeverity(array('name' => 'severity_min', 'value' => $this->data['sysmap']['severity_min'])));
// create url table
$urlTable = new CTable(_('No URLs defined.'), 'formElementTable');
$urlTable->setAttribute('style', 'min-width: 500px;');
$urlTable->setHeader(array(_('Name'), _('URL'), _('Element'), SPACE));
if (empty($this->data['sysmap']['urls'])) {
$this->data['sysmap']['urls'][] = array('name' => '', 'url' => '', 'elementtype' => 0);
}
$i = 0;
foreach ($this->data['sysmap']['urls'] as $url) {
$urlLabel = new CTextBox('urls[' . $i . '][name]', $url['name'], 32);
$urlLink = new CTextBox('urls[' . $i . '][url]', $url['url'], 32);
示例10: CImg
$iconsComboBox->addItems($this->data['iconList']);
$iconPreviewImage = new CImg('imgstore.php?iconid=' . $mapping['iconid'] . '&width=' . ZBX_ICON_PREVIEW_WIDTH . '&height=' . ZBX_ICON_PREVIEW_HEIGHT, _('Preview'), null, null, 'pointer preview');
$iconPreviewImage->setAttribute('data-image-full', 'imgstore.php?iconid=' . $mapping['iconid']);
$row = new CRow(array(new CSpan(null, 'ui-icon ui-icon-arrowthick-2-n-s move'), $numSpan, $profileLinksComboBox, $expressionTextBox, $iconsComboBox, $iconPreviewImage, new CButton('remove', _('Remove'), '', 'link_menu removeMapping')), 'sortable');
$row->setAttribute('id', 'iconmapidRow_' . $i);
$iconMapTable->addRow($row);
$i++;
}
// hidden row for js
reset($this->data['iconList']);
$firstIconId = key($this->data['iconList']);
$numSpan = new CSpan('0:');
$numSpan->addClass('rowNum');
$profileLinksComboBox = new CComboBox('iconmap[mappings][#{iconmappingid}][inventory_link]');
$profileLinksComboBox->addItems($this->data['inventoryList']);
$profileLinksComboBox->setAttribute('disabled', 'disabled');
$expressionTextBox = new CTextBox('iconmap[mappings][#{iconmappingid}][expression]');
$expressionTextBox->setAttribute('maxlength', 64);
$expressionTextBox->setAttribute('disabled', 'disabled');
$iconsComboBox = new CComboBox('iconmap[mappings][#{iconmappingid}][iconid]', $firstIconId);
$iconsComboBox->addClass('mappingIcon');
$iconsComboBox->addItems($this->data['iconList']);
$iconsComboBox->setAttribute('disabled', 'disabled');
$iconPreviewImage = new CImg('imgstore.php?iconid=' . $firstIconId . '&width=' . ZBX_ICON_PREVIEW_WIDTH . '&height=' . ZBX_ICON_PREVIEW_HEIGHT, _('Preview'), null, null, 'pointer preview');
$iconPreviewImage->setAttribute('data-image-full', 'imgstore.php?iconid=' . $firstIconId);
// row template
$hiddenRowTemplate = new CRow(array(new CSpan(null, 'ui-icon ui-icon-arrowthick-2-n-s move'), $numSpan, $profileLinksComboBox, $expressionTextBox, $iconsComboBox, $iconPreviewImage, new CButton('remove', _('Remove'), '', 'link_menu removeMapping')), 'hidden');
$hiddenRowTemplate->setAttribute('id', 'rowTpl');
$iconMapTable->addRow($hiddenRowTemplate);
// add row button
$iconMapTable->addRow(new CCol(new CButton('addMapping', _('Add'), '', 'link_menu'), null, 7));
示例11: reset
$dbItem = reset($dbItems);
if ($dbItem['templateid']) {
$template = get_realhost_by_itemid($dbItem['templateid']);
$itemName = $template['host'] . NAME_DELIMITER . $dbItem['name_expanded'];
} else {
$itemName = $dbItem['name_expanded'];
}
$ctb = new CTextBox('item', $itemName, 80);
$ctb->setAttribute('id', 'item');
$ctb->setAttribute('disabled', 'disabled');
$script = "javascript: return PopUp('popup.php?dstfrm=" . $frmTRLog->getName() . "&dstfld1=itemid&dstfld2=item&srctbl=items&srcfld1=itemid&srcfld2=name',800,450);";
$cbtn = new CSubmit('select_item', _('Select'), $script);
$frmTRLog->addRow(_('Item'), array($ctb, $cbtn));
$frmTRLog->addVar('itemid', $itemid);
$exp_select = new CComboBox('expr_type');
$exp_select->setAttribute('id', 'expr_type');
$exp_select->addItem(REGEXP_INCLUDE, _('Include'));
$exp_select->addItem(REGEXP_EXCLUDE, _('Exclude'));
$ctb = new CTextBox('expression', '', 80);
$ctb->setAttribute('id', 'logexpr');
$cb = new CButton('add_exp', _('Add'), 'javascript: add_logexpr();');
$cbAdd = new CButton('add_key_and', _('AND'), 'javascript: add_keyword_and();');
$cbOr = new CButton('add_key_or', _('OR'), 'javascript: add_keyword_or();');
$cbIregexp = new CCheckBox('iregexp', 'no', null, 1);
$frmTRLog->addRow(_('Expression'), array($ctb, BR(), $cbIregexp, 'iregexp', SPACE, $cbAdd, SPACE, $cbOr, SPACE, $exp_select, SPACE, $cb));
$keyTable = new CTableInfo(null);
$keyTable->setAttribute('id', 'key_list');
$keyTable->setHeader(array(_('Keyword'), _('Type'), _('Action')));
$table = new CTableInfo(null);
$table->setAttribute('id', 'exp_list');
$table->setHeader(array(_('Expression'), _('Type'), _('Position'), _('Action')));
示例12: empty
$hostid = 0;
}
$available_nodes = get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_LIST);
$available_hosts = empty($pageFilter->hosts) ? array() : array_keys($pageFilter->hosts);
if (isset($only_hostid)) {
$hostid = $_REQUEST['hostid'] = $only_hostid;
$options = array('hostids' => $hostid, 'templated_hosts' => 1, 'output' => array('hostid', 'host'), 'limit' => 1);
$only_hosts = CHost::get($options);
$host = reset($only_hosts);
if (empty($host)) {
access_deny();
}
$cmbHosts = new CComboBox('hostid', $hostid);
$cmbHosts->addItem($hostid, get_node_name_by_elid($hostid, null, ': ') . $host['host']);
$cmbHosts->setEnabled('disabled');
$cmbHosts->setAttribute('title', S_CANNOT_SWITCH_HOSTS);
$frmTitle->addItem(array(SPACE, S_HOST, SPACE, $cmbHosts));
} else {
if (str_in_array($srctbl, array('hosts', 'host_group', 'triggers', 'items', 'simple_graph', 'applications', 'screens', 'slides', 'graphs', 'sysmaps', 'plain_text', 'screens2', 'overview', 'host_group_scr'))) {
if (ZBX_DISTRIBUTED) {
$cmbNode = new CComboBox('nodeid', $nodeid, 'submit()');
$db_nodes = DBselect('SELECT * FROM nodes WHERE ' . DBcondition('nodeid', $available_nodes));
while ($node_data = DBfetch($db_nodes)) {
$cmbNode->addItem($node_data['nodeid'], $node_data['name']);
if (bccomp($nodeid, $node_data['nodeid']) == 0) {
$ok = true;
}
}
$frmTitle->addItem(array(SPACE, S_NODE, SPACE, $cmbNode, SPACE));
}
}
示例13: insert_map_form
function insert_map_form()
{
$frm_title = 'New system map';
if (isset($_REQUEST['sysmapid'])) {
$options = array('sysmapids' => $_REQUEST['sysmapid'], 'output' => API_OUTPUT_EXTEND);
$sysmaps = CMap::get($options);
$row = reset($sysmaps);
$frm_title = 'System map: "' . $row['name'] . '"';
}
if (isset($_REQUEST['sysmapid']) && !isset($_REQUEST['form_refresh'])) {
$name = $row['name'];
$width = $row['width'];
$height = $row['height'];
$backgroundid = $row['backgroundid'];
$label_type = $row['label_type'];
$label_location = $row['label_location'];
$highlight = $row['highlight'];
$markelements = $row['markelements'];
$expandproblem = $row['expandproblem'];
$show_unack = $row['show_unack'];
} else {
$name = get_request('name', '');
$width = get_request('width', 800);
$height = get_request('height', 600);
$backgroundid = get_request('backgroundid', 0);
$label_type = get_request('label_type', 0);
$label_location = get_request('label_location', 0);
$highlight = get_request('highlight', 0);
$markelements = get_request('markelements', 0);
$expandproblem = get_request('expandproblem', 0);
$show_unack = get_request('show_unack', 0);
}
$frmMap = new CFormTable($frm_title, 'sysmaps.php');
$frmMap->setHelp('web.sysmaps.map.php');
if (isset($_REQUEST['sysmapid'])) {
$frmMap->addVar('sysmapid', $_REQUEST['sysmapid']);
}
$frmMap->addRow(S_NAME, new CTextBox('name', $name, 32));
$frmMap->addRow(S_WIDTH, new CNumericBox('width', $width, 5));
$frmMap->addRow(S_HEIGHT, new CNumericBox('height', $height, 5));
$cmbImg = new CComboBox('backgroundid', $backgroundid);
$cmbImg->addItem(0, S_NO_IMAGE . '...');
$result = DBselect('SELECT * FROM images WHERE imagetype=2 AND ' . DBin_node('imageid') . ' order by name');
while ($row = DBfetch($result)) {
$cmbImg->addItem($row['imageid'], get_node_name_by_elid($row['imageid'], null, ': ') . $row['name']);
}
$frmMap->addRow(S_BACKGROUND_IMAGE, $cmbImg);
$frmMap->addRow(S_ICON_HIGHLIGHTING, new CCheckBox('highlight', $highlight, null, 1));
$frmMap->addRow(S_MARK_ELEMENTS_ON_TRIGGER_STATUS_CHANGE, new CCheckBox('markelements', $markelements, null, 1));
$frmMap->addRow(S_EXPAND_SINGLE_PROBLEM, new CCheckBox('expandproblem', $expandproblem, null, 1));
$cmbLabel = new CComboBox('label_type', $label_type);
$cmbLabel->addItem(0, S_LABEL);
$cmbLabel->addItem(1, S_IP_ADDRESS);
$cmbLabel->addItem(2, S_ELEMENT_NAME);
$cmbLabel->addItem(3, S_STATUS_ONLY);
$cmbLabel->addItem(4, S_NOTHING);
$frmMap->addRow(S_ICON_LABEL_TYPE, $cmbLabel);
$cmbLocation = new CComboBox('label_location', $label_location);
$cmbLocation->addItem(0, S_BOTTOM);
$cmbLocation->addItem(1, S_LEFT);
$cmbLocation->addItem(2, S_RIGHT);
$cmbLocation->addItem(3, S_TOP);
$frmMap->addRow(S_ICON_LABEL_LOCATION, $cmbLocation);
$config = select_config();
$cb = new CComboBox('show_unack', $show_unack);
$cb->addItems(array(EXTACK_OPTION_ALL => S_O_ALL, EXTACK_OPTION_BOTH => S_O_SEPARATED, EXTACK_OPTION_UNACK => S_O_UNACKNOWLEDGED_ONLY));
$cb->setEnabled($config['event_ack_enable']);
if (!$config['event_ack_enable']) {
$cb->setAttribute('title', S_EVENT_ACKNOWLEDGING_DISABLED);
}
$frmMap->addRow(S_PROBLEM_DISPLAY, $cb);
$frmMap->addItemToBottomRow(new CButton('save', S_SAVE));
if (isset($_REQUEST['sysmapid'])) {
$frmMap->addItemToBottomRow(SPACE);
$frmMap->addItemToBottomRow(new CButtonDelete(S_DELETE_SYSTEM_MAP_Q, url_param('form') . url_param('sysmapid')));
}
$frmMap->addItemToBottomRow(SPACE);
$frmMap->addItemToBottomRow(new CButtonCancel());
return $frmMap;
}
示例14: setlocale
$allLocalesAvailable = true;
foreach (getLocales() as $localeId => $locale) {
if ($locale['display']) {
// checking if this locale exists in the system. The only way of doing it is to try and set one
// trying to set only the LC_MONETARY locale to avoid changing LC_NUMERIC
$localeExists = setlocale(LC_MONETARY, zbx_locale_variants($localeId)) || $localeId == 'en_GB';
$languageComboBox->addItem($localeId, $locale['name'], $localeId == $this->data['lang'] ? true : null, $localeExists);
$allLocalesAvailable &= $localeExists;
}
}
// restoring original locale
setlocale(LC_MONETARY, zbx_locale_variants(CWebUser::$data['lang']));
$languageError = '';
if (!function_exists('bindtextdomain')) {
$languageError = 'Translations are unavailable because the PHP gettext module is missing.';
$languageComboBox->setAttribute('disabled', 'disabled');
} elseif (!$allLocalesAvailable) {
$languageError = _('You are not able to choose some of the languages, because locales for them are not installed on the web server.');
}
$userFormList->addRow(_('Language'), $languageError ? [$languageComboBox, SPACE, (new CSpan($languageError))->addClass('red')->addClass('wrap')] : $languageComboBox);
// append themes to form list
$themes = array_merge([THEME_DEFAULT => _('System default')], Z::getThemes());
$userFormList->addRow(_('Theme'), new CComboBox('theme', $this->data['theme'], null, $themes));
// append auto-login & auto-logout to form list
$autologoutCheckBox = (new CCheckBox('autologout_visible'))->setChecked(isset($this->data['autologout']));
if (isset($this->data['autologout'])) {
$autologoutTextBox = (new CNumericBox('autologout', $this->data['autologout'], 4))->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH);
} else {
$autologoutTextBox = (new CNumericBox('autologout', 900, 4))->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH)->setAttribute('disabled', 'disabled');
}
if ($this->data['alias'] != ZBX_GUEST_USER) {
示例15: array
$labelSpan->setAttribute('data-formulaid', $label);
$conditionTable->addRow(array($labelSpan, get_condition_desc($condition['conditiontype'], $condition['operator'], $condition['value']), array(new CButton('remove', _('Remove'), 'javascript: removeCondition(' . $i . ');', 'link_menu'), new CVar('conditions[' . $i . ']', $condition)), new CVar('conditions[' . $i . '][formulaid]', $label)), null, 'conditions_' . $i);
$i++;
}
$formula = new CTextBox('formula', $this->data['action']['filter']['formula'], ZBX_TEXTBOX_STANDARD_SIZE);
$formula->attr('id', 'formula');
$formula->attr('placeholder', 'A or (B and C) …');
if ($this->data['action']['filter']['evaltype'] != CONDITION_EVAL_TYPE_EXPRESSION) {
$formula->addClass('hidden');
}
$calculationTypeComboBox = new CComboBox('evaltype', $this->data['action']['filter']['evaltype'], 'processTypeOfCalculation()');
$calculationTypeComboBox->addItem(CONDITION_EVAL_TYPE_AND_OR, _('And/Or'));
$calculationTypeComboBox->addItem(CONDITION_EVAL_TYPE_AND, _('And'));
$calculationTypeComboBox->addItem(CONDITION_EVAL_TYPE_OR, _('Or'));
$calculationTypeComboBox->addItem(CONDITION_EVAL_TYPE_EXPRESSION, _('Custom expression'));
$calculationTypeComboBox->setAttribute('id', 'evaltype');
$conditionFormList->addRow(_('Type of calculation'), array($calculationTypeComboBox, new CSpan('', $this->data['action']['filter']['evaltype'] == CONDITION_EVAL_TYPE_EXPRESSION ? 'hidden' : '', 'conditionLabel'), $formula), false, 'conditionRow');
$conditionFormList->addRow(_('Conditions'), new CDiv($conditionTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
// append new condition to form list
$conditionTypeComboBox = new CComboBox('new_condition[conditiontype]', $this->data['new_condition']['conditiontype'], 'submit()');
foreach ($this->data['allowedConditions'] as $key => $condition) {
$this->data['allowedConditions'][$key] = array('name' => condition_type2str($condition), 'type' => $condition);
}
order_result($this->data['allowedConditions'], 'name');
foreach ($this->data['allowedConditions'] as $condition) {
$conditionTypeComboBox->addItem($condition['type'], $condition['name']);
}
$conditionOperatorsComboBox = new CComboBox('new_condition[operator]', $this->data['new_condition']['operator']);
foreach (get_operators_by_conditiontype($this->data['new_condition']['conditiontype']) as $operator) {
$conditionOperatorsComboBox->addItem($operator, condition_operator2str($operator));
}