本文整理汇总了PHP中CComboBox::setEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP CComboBox::setEnabled方法的具体用法?PHP CComboBox::setEnabled怎么用?PHP CComboBox::setEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComboBox
的用法示例。
在下文中一共展示了CComboBox::setEnabled方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CCheckBox
// SPACE added to extend CB width in Chrome
$cbMain = new CCheckBox('maintenance', $maintenance, null, '1');
if (!$filterEnable) {
$cbMain->setAttribute('disabled', 'disabled');
}
$dashForm->addRow(S_HOSTS, array($cbMain, S_SHOW_HOSTS_IN_MAINTENANCE));
// Trigger
$severity = zbx_toHash($severity);
$trgSeverities = array();
$severities = array(TRIGGER_SEVERITY_NOT_CLASSIFIED, TRIGGER_SEVERITY_INFORMATION, TRIGGER_SEVERITY_WARNING, TRIGGER_SEVERITY_AVERAGE, TRIGGER_SEVERITY_HIGH, TRIGGER_SEVERITY_DISASTER);
foreach ($severities as $snum => $sever) {
$cb = new CCheckBox('trgSeverity[' . $sever . ']', isset($severity[$sever]), '', 1);
$cb->setEnabled($filterEnable);
$trgSeverities[] = array($cb, getSeverityCaption($sever));
$trgSeverities[] = BR();
}
array_pop($trgSeverities);
$dashForm->addRow(S_TRIGGERS_WITH_SEVERITY, $trgSeverities);
$config = select_config();
$cb = new CComboBox('extAck', $extAck);
$cb->addItems(array(EXTACK_OPTION_ALL => S_O_ALL, EXTACK_OPTION_BOTH => S_O_SEPARATED, EXTACK_OPTION_UNACK => S_O_UNACKNOWLEDGED_ONLY));
$cb->setEnabled($filterEnable && $config['event_ack_enable']);
if (!$config['event_ack_enable']) {
$cb->setAttribute('title', S_EVENT_ACKNOWLEDGING_DISABLED);
}
$dashForm->addRow(S_PROBLEM_DISPLAY, $cb);
//-----
$dashForm->addItemToBottomRow(new CButton('save', S_SAVE));
$dashboard_wdgt->addItem($dashForm);
$dashboard_wdgt->show();
include_once 'include/page_footer.php';
示例2: CFormList
}
$userTab->addTab('userTab', _('User'), $userFormList);
if (isset($userMediaFormList)) {
$userTab->addTab('mediaTab', _('Media'), $userMediaFormList);
}
if (!$this->data['is_profile']) {
/*
* Permissions tab
*/
$permissionsFormList = new CFormList('permissionsFormList');
$userTypeComboBox = new CComboBox('user_type', $this->data['user_type'], 'submit();');
$userTypeComboBox->addItem(USER_TYPE_ZABBIX_USER, user_type2str(USER_TYPE_ZABBIX_USER));
$userTypeComboBox->addItem(USER_TYPE_ZABBIX_ADMIN, user_type2str(USER_TYPE_ZABBIX_ADMIN));
$userTypeComboBox->addItem(USER_TYPE_SUPER_ADMIN, user_type2str(USER_TYPE_SUPER_ADMIN));
if (isset($this->data['userid']) && bccomp(CWebUser::$data['userid'], $this->data['userid']) == 0) {
$userTypeComboBox->setEnabled('disabled');
$permissionsFormList->addRow(_('User type'), array($userTypeComboBox, SPACE, new CSpan(_('User can\'t change type for himself'))));
$userForm->addVar('user_type', $this->data['user_type']);
} else {
$permissionsFormList->addRow(_('User type'), $userTypeComboBox);
}
$permissionsFormList = getPermissionsFormList($this->data['user_rights'], $this->data['user_type'], $permissionsFormList);
$permissionsFormList->addInfo(_('Permissions can be assigned for user groups only.'));
$userTab->addTab('permissionsTab', _('Permissions'), $permissionsFormList);
}
if (isset($userMessagingFormList)) {
$userTab->addTab('messagingTab', _('Messaging'), $userMessagingFormList);
}
// append tab to form
$userForm->addItem($userTab);
// append buttons to form
示例3: getItemFilterForm
//.........这里部分代码省略.........
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);
$cmbState->addItem(-1, _('all'));
foreach (array(ITEM_STATE_NORMAL, ITEM_STATE_NOTSUPPORTED) as $state) {
$cmbState->addItem($state, itemState($state));
}
// update interval
$updateIntervalLabel = new CSpan(array(bold(_('Update interval')), SPACE . _('(in sec)') . NAME_DELIMITER));
$updateIntervalLabel->setAttribute('id', 'filter_delay_label');
$updateIntervalInput = new CNumericBox('filter_delay', $filter_delay, 5, false, true);
$updateIntervalInput->setEnabled('no');
// data type
$dataTypeLabel = new CSpan(bold(_('Data type') . NAME_DELIMITER));
$dataTypeLabel->setAttribute('id', 'filter_data_type_label');
$dataTypeInput = new CComboBox('filter_data_type', $filter_data_type);
$dataTypeInput->addItem(-1, _('all'));
$dataTypeInput->addItems(item_data_type2str());
$dataTypeInput->setEnabled('no');
// filter table
$table = new CTable('', 'filter');
$table->setCellPadding(0);
$table->setCellSpacing(0);
// SNMP community
$snmpCommunityLabel = new CSpan(array(bold(_('SNMP community')), SPACE . _('like') . NAME_DELIMITER));
$snmpCommunityLabel->setAttribute('id', 'filter_snmp_community_label');
$snmpCommunityField = new CTextBox('filter_snmp_community', $filter_snmp_community, ZBX_TEXTBOX_FILTER_SIZE);
$snmpCommunityField->setEnabled('no');
// SNMPv3 security name
$snmpSecurityLabel = new CSpan(array(bold(_('Security name')), SPACE . _('like') . NAME_DELIMITER));
$snmpSecurityLabel->setAttribute('id', 'filter_snmpv3_securityname_label');
$snmpSecurityField = new CTextBox('filter_snmpv3_securityname', $filter_snmpv3_securityname, ZBX_TEXTBOX_FILTER_SIZE);
$snmpSecurityField->setEnabled('no');
// SNMP OID
$snmpOidLabel = new CSpan(array(bold(_('SNMP OID')), SPACE . _('like') . NAME_DELIMITER));
$snmpOidLabel->setAttribute('id', 'filter_snmp_oid_label');
$snmpOidField = new CTextBox('filter_snmp_oid', $filter_snmp_oid, ZBX_TEXTBOX_FILTER_SIZE);
$snmpOidField->setEnabled('no');
// port
$portLabel = new CSpan(array(bold(_('Port')), SPACE . _('like') . NAME_DELIMITER));
$portLabel->setAttribute('id', 'filter_port_label');
$portField = new CNumericBox('filter_port', $filter_port, 5, false, true);
$portField->setEnabled('no');
// row 1
示例4: CMultiSelect
$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) {
$serverityCheckBox = (new CCheckBox('trgSeverity[' . $severity . ']'))->setChecked(isset($this->data['severity'][$severity]))->setEnabled($this->data['isFilterEnable']);
$severities[] = new CLabel([$serverityCheckBox, getSeverityName($severity, $this->data['config'])], 'trgSeverity[' . $severity . ']');
$severities[] = BR();
}
array_pop($severities);
$form_list->addRow(_('Triggers with severity'), $severities);
$form_list->addRow(_('Trigger name like'), (new CTextBox('trigger_name', $data['trigger_name']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)->setEnabled($data['isFilterEnable']));
if ($data['config']['event_ack_enable']) {
// append problem display to form list
$ext_ack_combobox = new CComboBox('extAck', $data['extAck'], null, [EXTACK_OPTION_ALL => _('All'), EXTACK_OPTION_BOTH => _('Separated'), EXTACK_OPTION_UNACK => _('Unacknowledged only')]);
$ext_ack_combobox->setEnabled($data['isFilterEnable']);
$form_list->addRow(_('Problem display'), $ext_ack_combobox);
}
// create tab
$tab = new CTabView();
$tab->addTab('dashconfTab', _('Filter'), $form_list);
$tab->setFooter(makeFormFooter(new CSubmit('update', _('Update')), [new CButtonCancel()]));
$form->addItem($tab);
$widget->addItem($form);
return $widget;
示例5: 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;
示例6: insert_copy_elements_to_forms
function insert_copy_elements_to_forms($elements_array_name)
{
$copy_type = get_request("copy_type", 0);
$copy_mode = get_request("copy_mode", 0);
$filter_groupid = get_request("filter_groupid", 0);
$group_itemid = get_request($elements_array_name, array());
$copy_targetid = get_request("copy_targetid", array());
if (!is_array($group_itemid) || is_array($group_itemid) && count($group_itemid) < 1) {
error("Incorrect list of items.");
return;
}
$frmCopy = new CFormTable(count($group_itemid) . ' ' . S_X_ELEMENTS_COPY_TO_DOT_DOT_DOT, null, 'post', null, 'form_copy_to');
$frmCopy->SetHelp('web.items.copyto.php');
$frmCopy->addVar($elements_array_name, $group_itemid);
$cmbCopyType = new CComboBox('copy_type', $copy_type, 'submit()');
$cmbCopyType->addItem(0, S_HOSTS);
$cmbCopyType->addItem(1, S_HOST_GROUPS);
$frmCopy->addRow(S_TARGET_TYPE, $cmbCopyType);
$target_sql = 'SELECT DISTINCT g.groupid as target_id, g.name as target_name ' . ' FROM groups g, hosts_groups hg ' . ' WHERE hg.groupid=g.groupid ' . ' ORDER BY g.name';
if (0 == $copy_type) {
$cmbGroup = new CComboBox('filter_groupid', $filter_groupid, 'submit()');
$cmbGroup->addItem(0, S_ALL_SMALL);
$groups = DBselect($target_sql);
while ($group = DBfetch($groups)) {
$cmbGroup->addItem($group["target_id"], $group["target_name"]);
}
$frmCopy->addRow('Group', $cmbGroup);
$target_sql = 'SELECT h.hostid as target_id, h.host as target_name FROM hosts h ';
if ($filter_groupid > 0) {
$target_sql .= ', hosts_groups hg WHERE hg.hostid=h.hostid AND hg.groupid=' . $filter_groupid;
}
$target_sql .= ' ORDER BY target_name';
}
$db_targets = DBselect($target_sql);
$target_list = array();
while ($target = DBfetch($db_targets)) {
array_push($target_list, array(new CCheckBox('copy_targetid[' . $target['target_id'] . ']', uint_in_array($target['target_id'], $copy_targetid), null, $target['target_id']), SPACE, $target['target_name'], BR()));
}
$frmCopy->addRow(S_TARGET, $target_list);
$cmbCopyMode = new CComboBox('copy_mode', $copy_mode);
$cmbCopyMode->addItem(0, S_UPDATE_EXISTING_NON_LINKED_ITEMS);
$cmbCopyMode->addItem(1, S_SKIP_EXISTING_ITEMS);
$cmbCopyMode->setEnabled(false);
$frmCopy->addRow(S_MODE, $cmbCopyMode);
$frmCopy->addItemToBottomRow(new CButton("copy", S_COPY));
$frmCopy->addItemToBottomRow(array(SPACE, new CButtonCancel(url_param('groupid') . url_param("hostid") . url_param("config"))));
$frmCopy->Show();
}
示例7: CTextArea
$customLabelImageTextArea = new CTextArea('label_string_image', $this->data['sysmap']['label_string_image']);
if ($this->data['sysmap']['label_type_image'] != MAP_LABEL_TYPE_CUSTOM) {
$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) {
示例8: CDiv
$hostList->addRow(_('JMX interfaces'), (new CDiv($ifTab))->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)->setAttribute('data-type', 'jmx')->setWidth(ZBX_HOST_INTERFACE_WIDTH));
// IPMI interfaces
$ifTab = (new CTable())->setId('IPMIInterfaces');
$row = (new CRow())->setId('IPMIInterfacesFooter');
if (!array_key_exists(INTERFACE_TYPE_IPMI, $existingInterfaceTypes)) {
$row->addItem(new CCol());
$row->addItem((new CCol(_('No IPMI interfaces found.')))->setColSpan(6));
}
$ifTab->addRow($row);
$hostList->addRow(_('IPMI interfaces'), (new CDiv($ifTab))->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)->setAttribute('data-type', 'ipmi')->setWidth(ZBX_HOST_INTERFACE_WIDTH));
}
$hostList->addRow(_('Description'), (new CTextArea('description', $data['description']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH));
// Proxy
if ($data['flags'] != ZBX_FLAG_DISCOVERY_CREATED) {
$proxy = new CComboBox('proxy_hostid', $data['proxy_hostid'], null, [0 => _('(no proxy)')] + $data['proxies']);
$proxy->setEnabled($data['flags'] != ZBX_FLAG_DISCOVERY_CREATED);
} else {
$proxy = (new CTextBox(null, $data['proxy_hostid'] != 0 ? $data['proxies'][$data['proxy_hostid']] : _('(no proxy)'), true))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH);
$hostList->addVar('proxy_hostid', $data['proxy_hostid']);
}
$hostList->addRow(_('Monitored by proxy'), $proxy);
$hostList->addRow(_('Enabled'), (new CCheckBox('status', HOST_STATUS_MONITORED))->setChecked($data['status'] == HOST_STATUS_MONITORED));
if ($data['clone_hostid'] != 0) {
// host applications
$hostApps = API::Application()->get(['output' => ['name'], 'hostids' => [$data['clone_hostid']], 'inherited' => false, 'preservekeys' => true, 'filter' => ['flags' => ZBX_FLAG_DISCOVERY_NORMAL]]);
if ($hostApps) {
$applicationsList = [];
foreach ($hostApps as $hostAppId => $hostApp) {
$applicationsList[$hostAppId] = $hostApp['name'];
}
order_result($applicationsList);
示例9: 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'))) {
示例10: insert_copy_elements_to_forms
function insert_copy_elements_to_forms($elements_array_name)
{
$copy_type = get_request("copy_type", 0);
$copy_mode = get_request("copy_mode", 0);
$filter_groupid = get_request("filter_groupid", 0);
$group_itemid = get_request($elements_array_name, array());
$copy_targetid = get_request("copy_targetid", array());
if (!is_array($group_itemid) || is_array($group_itemid) && count($group_itemid) < 1) {
error("Incorrect list of items.");
return;
}
$frmCopy = new CFormTable(count($group_itemid) . ' ' . S_X_ELEMENTS_COPY_TO_DOT_DOT_DOT, null, 'post', null, 'go');
$frmCopy->SetHelp('web.items.copyto.php');
$frmCopy->addVar($elements_array_name, $group_itemid);
$cmbCopyType = new CComboBox('copy_type', $copy_type, 'submit()');
$cmbCopyType->addItem(0, S_HOSTS);
$cmbCopyType->addItem(1, S_HOST_GROUPS);
$frmCopy->addRow(S_TARGET_TYPE, $cmbCopyType);
$target_list = array();
$groups = CHostGroup::get(array('extendoutput' => 1, 'order' => 'name'));
if (0 == $copy_type) {
$cmbGroup = new CComboBox('filter_groupid', $filter_groupid, 'submit()');
foreach ($groups as $groupid => $group) {
if (empty($filter_groupid)) {
$filter_groupid = $groupid;
}
$cmbGroup->addItem($groupid, $group['name']);
}
$frmCopy->addRow('Group', $cmbGroup);
$options = array('extendoutput' => 1, 'order' => 'host', 'groupids' => $filter_groupid);
$hosts = CHost::get($options);
foreach ($hosts as $hostid => $host) {
array_push($target_list, array(new CCheckBox('copy_targetid[' . $hostid . ']', uint_in_array($hostid, $copy_targetid), null, $hostid), SPACE, $host['host'], BR()));
}
} else {
foreach ($groups as $groupid => $group) {
array_push($target_list, array(new CCheckBox('copy_targetid[' . $groupid . ']', uint_in_array($groupid, $copy_targetid), null, $groupid), SPACE, $group['name'], BR()));
}
}
$frmCopy->addRow(S_TARGET, $target_list);
$cmbCopyMode = new CComboBox('copy_mode', $copy_mode);
$cmbCopyMode->addItem(0, S_UPDATE_EXISTING_NON_LINKED_ITEMS);
$cmbCopyMode->addItem(1, S_SKIP_EXISTING_ITEMS);
$cmbCopyMode->setEnabled(false);
$frmCopy->addRow(S_MODE, $cmbCopyMode);
$frmCopy->addItemToBottomRow(new CButton("copy", S_COPY));
$frmCopy->addItemToBottomRow(array(SPACE, new CButtonCancel(url_param('groupid') . url_param("hostid") . url_param("config"))));
$frmCopy->show();
}
示例11: 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;
}
示例12: CTabView
$userTab = new CTabView();
if (!$this->data['form_refresh']) {
$userTab->setSelected(0);
}
$userTab->addTab('userTab', _('User'), $userFormList);
if (isset($userMediaFormList)) {
$userTab->addTab('mediaTab', _('Media'), $userMediaFormList);
}
if (!$this->data['is_profile']) {
/*
* Permissions tab
*/
$permissionsFormList = new CFormList('permissionsFormList');
$userTypeComboBox = new CComboBox('user_type', $this->data['user_type'], 'submit();', [USER_TYPE_ZABBIX_USER => user_type2str(USER_TYPE_ZABBIX_USER), USER_TYPE_ZABBIX_ADMIN => user_type2str(USER_TYPE_ZABBIX_ADMIN), USER_TYPE_SUPER_ADMIN => user_type2str(USER_TYPE_SUPER_ADMIN)]);
if ($data['userid'] != 0 && bccomp(CWebUser::$data['userid'], $data['userid']) == 0) {
$userTypeComboBox->setEnabled(false);
$permissionsFormList->addRow(_('User type'), [$userTypeComboBox, SPACE, new CSpan(_('User can\'t change type for himself'))]);
$userForm->addVar('user_type', $this->data['user_type']);
} else {
$permissionsFormList->addRow(_('User type'), $userTypeComboBox);
}
$permissionsFormList = getPermissionsFormList($this->data['user_rights'], $this->data['user_type'], $permissionsFormList);
$permissionsFormList->addInfo(_('Permissions can be assigned for user groups only.'));
$userTab->addTab('permissionsTab', _('Permissions'), $permissionsFormList);
}
if (isset($userMessagingFormList)) {
$userTab->addTab('messagingTab', _('Messaging'), $userMessagingFormList);
}
// append buttons to form
if ($data['userid'] != 0) {
$buttons = [new CButtonCancel()];
示例13: getRequest
for ($i = 1; $i <= $dstfldCount; $i++) {
$frmTitle->addVar('dstfld' . $i, getRequest('dstfld' . $i));
}
for ($i = 1; $i <= $srcfldCount; $i++) {
$frmTitle->addVar('srcfld' . $i, getRequest('srcfld' . $i));
}
/*
* Only host id
*/
$controls = [];
if (isset($onlyHostid)) {
$only_hosts = API::Host()->get(['hostids' => $hostid, 'templated_hosts' => true, 'output' => ['hostid', 'host', 'name'], 'limit' => 1]);
$host = reset($only_hosts);
$cmbHosts = new CComboBox('hostid', $hostid);
$cmbHosts->addItem($hostid, $host['name']);
$cmbHosts->setEnabled(false);
$cmbHosts->setAttribute('title', _('You can not switch hosts for current selection.'));
$controls[] = [SPACE, _('Host'), SPACE, $cmbHosts];
} else {
// show Group dropdown in header for these specified sources
$showGroupCmbBox = ['triggers', 'items', 'applications', 'graphs', 'graph_prototypes', 'item_prototypes', 'templates', 'hosts', 'host_templates'];
if (str_in_array($srctbl, $showGroupCmbBox) && ($srctbl !== 'item_prototypes' || !$parentDiscoveryId)) {
$controls[] = [_('Group'), SPACE, $pageFilter->getGroupsCB()];
}
// show Type dropdown in header for help items
if ($srctbl === 'help_items') {
$itemType = getRequest('itemtype', 0);
$cmbTypes = new CComboBox('itemtype', $itemType, 'javascript: submit();');
foreach ($allowedItemTypes as $type) {
$cmbTypes->addItem($type, item_type2str($type));
}
示例14: CTextarea
$customLabelImage = new CTextarea('label_string_image', $this->data['label_string_image']);
if ($this->data['label_type_image'] != MAP_LABEL_TYPE_CUSTOM) {
$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);