本文整理汇总了PHP中CComboBox::addItem方法的典型用法代码示例。如果您正苦于以下问题:PHP CComboBox::addItem方法的具体用法?PHP CComboBox::addItem怎么用?PHP CComboBox::addItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComboBox
的用法示例。
在下文中一共展示了CComboBox::addItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addItem
public function addItem($value, $caption = '', $selected = null, $enabled = 'yes', $class = null)
{
if (is_null($selected)) {
if (is_array($this->value)) {
if (str_in_array($value, $this->value)) {
$this->value_exist = 1;
}
} elseif (strcmp($value, $this->value) == 0) {
$this->value_exist = 1;
}
}
parent::addItem($value, $caption, $selected, $enabled, $class);
}
示例2: CFormList
$userGroupForm->setName('userGroupsForm');
$userGroupForm->addVar('form', $this->data['form']);
$userGroupForm->addVar('group_rights', $this->data['group_rights']);
if (isset($this->data['usrgrpid'])) {
$userGroupForm->addVar('usrgrpid', $this->data['usrgrpid']);
}
/*
* User group tab
*/
$userGroupFormList = new CFormList('userGroupFormList');
$nameTextBox = new CTextBox('gname', $this->data['name'], ZBX_TEXTBOX_STANDARD_SIZE);
$nameTextBox->attr('autofocus', 'autofocus');
$userGroupFormList->addRow(_('Group name'), $nameTextBox);
// append groups to form list
$groupsComboBox = new CComboBox('selusrgrp', $this->data['selected_usrgrp'], 'submit()');
$groupsComboBox->addItem(0, _('All'));
foreach ($this->data['usergroups'] as $group) {
$groupsComboBox->addItem($group['usrgrpid'], $group['name']);
}
// append user tweenbox to form list
$usersTweenBox = new CTweenBox($userGroupForm, 'group_users', $this->data['group_users'], 10);
foreach ($this->data['users'] as $user) {
$usersTweenBox->addItem($user['userid'], getUserFullname($user));
}
$userGroupFormList->addRow(_('Users'), $usersTweenBox->get(_('In group'), array(_('Other groups'), SPACE, $groupsComboBox)));
// append frontend and user status to from list
$isGranted = isset($data['usrgrpid']) ? granted2update_group($data['usrgrpid']) : true;
if ($isGranted) {
$frontendComboBox = new CComboBox('gui_access', $this->data['gui_access']);
$frontendComboBox->addItem(GROUP_GUI_ACCESS_SYSTEM, user_auth_type2str(GROUP_GUI_ACCESS_SYSTEM));
$frontendComboBox->addItem(GROUP_GUI_ACCESS_INTERNAL, user_auth_type2str(GROUP_GUI_ACCESS_INTERNAL));
示例3: CComboBox
}
$cmbFnc->addItem(CALC_FNC_MIN, S_MIN_SMALL);
$cmbFnc->addItem(CALC_FNC_AVG, S_AVG_SMALL);
$cmbFnc->addItem(CALC_FNC_MAX, S_MAX_SMALL);
$frmGItem->addRow(S_FUNCTION, $cmbFnc);
if ($graphtype == GRAPH_TYPE_NORMAL) {
$cmbType = new CComboBox('drawtype', $drawtype);
foreach (graph_item_drawtypes() as $i) {
$cmbType->addItem($i, graph_item_drawtype2str($i));
}
$frmGItem->addRow(S_DRAW_STYLE, $cmbType);
} else {
$frmGItem->addVar('drawtype', 1);
}
}
$frmGItem->addRow(S_COLOR, new CColor('color', $color));
}
if ($graphtype == GRAPH_TYPE_NORMAL || $graphtype == GRAPH_TYPE_STACKED) {
$cmbYax = new CComboBox('yaxisside', $yaxisside);
$cmbYax->addItem(GRAPH_YAXIS_SIDE_RIGHT, S_RIGHT);
$cmbYax->addItem(GRAPH_YAXIS_SIDE_LEFT, S_LEFT);
$frmGItem->addRow(S_YAXIS_SIDE, $cmbYax);
}
if ($type != GRAPH_ITEM_SUM) {
$frmGItem->addRow(S_SORT_ORDER_0_100, new CTextBox('sortorder', $sortorder, 3));
}
$frmGItem->addItemToBottomRow(new CButton('save', isset($gid) ? S_SAVE : S_ADD));
$frmGItem->addItemToBottomRow(new CButtonCancel(null, 'close_window();'));
$frmGItem->show();
}
include_once 'include/page_footer.php';
示例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: array
$extAck = CProfile::get('web.dashconf.events.extAck', 0);
$severity = CProfile::get('web.dashconf.triggers.severity', '0;1;2;3;4;5');
$severity = zbx_empty($severity) ? array() : explode(';', $severity);
}
$dashForm->addVar('filterEnable', $filterEnable);
if ($filterEnable) {
$cbFilter = new CSpan(S_ENABLED, 'green underline pointer');
$cbFilter->setAttribute('onclick', "create_var('" . $dashForm->getName() . "', 'filterEnable', 0, true);");
} else {
$cbFilter = new CSpan(S_DISABLED, 'red underline pointer');
$cbFilter->setAttribute('onclick', "\$('dashform').enable(); create_var('" . $dashForm->getName() . "', 'filterEnable', 1, true);");
}
$dashForm->addRow(S_DASHBOARD_FILTER, $cbFilter);
$dashForm->addVar('groupids', $groupids);
$cmbGroups = new CComboBox('grpswitch', $grpswitch, 'submit();');
$cmbGroups->addItem(0, S_ALL_S);
$cmbGroups->addItem(1, S_SELECTED);
if (!$filterEnable) {
$cmbGroups->setAttribute('disabled', 'disabled');
}
$dashForm->addRow(S_HOST_GROUPS, $cmbGroups);
if ($grpswitch == 1) {
$options = array('nodeids' => get_current_nodeid(true), 'groupids' => $groupids, 'output' => API_OUTPUT_EXTEND);
$groups = CHostGroup::get($options);
order_result($groups, 'name');
$lstGroups = new CListBox('del_groups[]', null, 15);
$lstGroups->setAttribute('style', 'width: 200px;');
foreach ($groups as $gnum => $group) {
$lstGroups->addItem($group['groupid'], get_node_name_by_elid($group['groupid'], true, ':') . $group['name']);
}
if (!$filterEnable) {
示例6: dirname
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/triggers.inc.php';
$page['title'] = _('Most busy triggers top 100');
$page['file'] = 'report5.php';
$page['hist_arg'] = array('period');
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = array('period' => array(T_ZBX_STR, O_OPT, P_SYS | P_NZERO, IN('"day","week","month","year"'), NULL));
check_fields($fields);
$rprt_wdgt = new CWidget();
$_REQUEST['period'] = getRequest('period', 'day');
$admin_links = CWebUser::$data['type'] == USER_TYPE_ZABBIX_ADMIN || CWebUser::$data['type'] == USER_TYPE_SUPER_ADMIN;
$form = new CForm('get');
$cmbPeriod = new CComboBox('period', $_REQUEST['period'], 'submit()');
$cmbPeriod->addItem('day', _('Day'));
$cmbPeriod->addItem('week', _('Week'));
$cmbPeriod->addItem('month', _('Month'));
$cmbPeriod->addItem('year', _('Year'));
$form->addItem($cmbPeriod);
$rprt_wdgt->addPageHeader(_('MOST BUSY TRIGGERS TOP 100'));
$rprt_wdgt->addHeader(_('Report'), $form);
$rprt_wdgt->addItem(BR());
$table = new CTableInfo(_('No triggers found.'));
$table->setHeader(array(_('Host'), _('Trigger'), _('Severity'), _('Number of status changes')));
switch ($_REQUEST['period']) {
case 'week':
$time_dif = SEC_PER_WEEK;
break;
case 'month':
$time_dif = SEC_PER_MONTH;
示例7: CTextBox
}
$fname = 'test_data_' . md5($exprPart['expression']);
$macrosData[$exprPart['expression']] = get_request($fname, '');
$info = get_item_function_info($exprPart['expression']);
if (!is_array($info) && isset($definedErrorPhrases[$info])) {
$allowedTesting = false;
$control = new CTextBox($fname, $macrosData[$exprPart['expression']], 30);
$control->setAttribute('disabled', 'disabled');
} else {
$octet = $info['value_type'] == 'HHMMSS';
$validation = $info['validation'];
if (substr($validation, 0, COMBO_PATTERN_LENGTH) == COMBO_PATTERN) {
$vals = explode(',', substr($validation, COMBO_PATTERN_LENGTH, zbx_strlen($validation) - COMBO_PATTERN_LENGTH - 4));
$control = new CComboBox($fname, $macrosData[$exprPart['expression']]);
foreach ($vals as $v) {
$control->addItem($v, $v);
}
} else {
$control = new CTextBox($fname, $macrosData[$exprPart['expression']], 30);
}
$fields[$fname] = array($info['type'], O_OPT, null, $validation, 'isset({test_expression})', $exprPart['expression']);
}
$data_table->addRow(new CRow(array($exprPart['expression'], is_array($info) || !isset($definedErrorPhrases[$info]) ? $info['value_type'] : new CCol($definedErrorPhrases[$info], 'disaster'), $control)));
}
}
//---------------------------------- CHECKS ------------------------------------
$fields['test_expression'] = array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null);
if (!check_fields($fields)) {
$test = false;
}
//------------------------ <ACTIONS> ---------------------------
示例8: CForm
// create form
$proxyForm = new CForm();
$proxyForm->setName('proxyForm');
$proxyForm->addVar('form', $this->data['form']);
$proxyForm->addVar('form_refresh', $this->data['form_refresh']);
if (!empty($this->data['proxyid'])) {
$proxyForm->addVar('proxyid', $this->data['proxyid']);
}
// create form list
$proxyFormList = new CFormList('proxyFormList');
$nameTextBox = new CTextBox('host', $this->data['name'], ZBX_TEXTBOX_STANDARD_SIZE, 'no', 64);
$nameTextBox->attr('autofocus', 'autofocus');
$proxyFormList->addRow(_('Proxy name'), $nameTextBox);
// append status to form list
$statusBox = new CComboBox('status', $this->data['status'], 'submit()');
$statusBox->addItem(HOST_STATUS_PROXY_ACTIVE, _('Active'));
$statusBox->addItem(HOST_STATUS_PROXY_PASSIVE, _('Passive'));
$proxyFormList->addRow(_('Proxy mode'), $statusBox);
if ($this->data['status'] == HOST_STATUS_PROXY_PASSIVE) {
if (isset($this->data['interface']['interfaceid'])) {
$proxyForm->addVar('interface[interfaceid]', $this->data['interface']['interfaceid']);
$proxyForm->addVar('interface[hostid]', $this->data['interface']['hostid']);
}
$interfaceTable = new CTable(null, 'formElementTable');
$interfaceTable->addRow(array(_('IP address'), _('DNS name'), _('Connect to'), _('Port')));
$connectByComboBox = new CRadioButtonList('interface[useip]', $this->data['interface']['useip']);
$connectByComboBox->addValue(_('IP'), 1);
$connectByComboBox->addValue(_('DNS'), 0);
$connectByComboBox->useJQueryStyle();
$interfaceTable->addRow(array(new CTextBox('interface[ip]', $this->data['interface']['ip'], ZBX_TEXTBOX_SMALL_SIZE, 'no', 64), new CTextBox('interface[dns]', $this->data['interface']['dns'], ZBX_TEXTBOX_SMALL_SIZE, 'no', 64), $connectByComboBox, new CTextBox('interface[port]', $this->data['interface']['port'], 18, 'no', 64)));
$proxyFormList->addRow(_('Interface'), new CDiv($interfaceTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
示例9: array
$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;
if (EVENT_SOURCE_TRIGGERS == $source) {
$filterForm = new CFormTable(null, null, 'get');
//,'events.php?filter_set=1','POST',null,'sform');
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
示例10: get_timeperiod_form
function get_timeperiod_form()
{
$tblPeriod = new CTable(null, 'formElementTable');
// init new_timeperiod variable
$new_timeperiod = getRequest('new_timeperiod', array());
$new = is_array($new_timeperiod);
if (is_array($new_timeperiod)) {
if (isset($new_timeperiod['id'])) {
$tblPeriod->addItem(new CVar('new_timeperiod[id]', $new_timeperiod['id']));
}
if (isset($new_timeperiod['timeperiodid'])) {
$tblPeriod->addItem(new CVar('new_timeperiod[timeperiodid]', $new_timeperiod['timeperiodid']));
}
}
if (!is_array($new_timeperiod)) {
$new_timeperiod = array();
$new_timeperiod['timeperiod_type'] = TIMEPERIOD_TYPE_ONETIME;
}
if (!isset($new_timeperiod['every'])) {
$new_timeperiod['every'] = 1;
}
if (!isset($new_timeperiod['day'])) {
$new_timeperiod['day'] = 1;
}
if (!isset($new_timeperiod['hour'])) {
$new_timeperiod['hour'] = 12;
}
if (!isset($new_timeperiod['minute'])) {
$new_timeperiod['minute'] = 0;
}
if (!isset($new_timeperiod['start_date'])) {
$new_timeperiod['start_date'] = 0;
}
if (!isset($new_timeperiod['period_days'])) {
$new_timeperiod['period_days'] = 0;
}
if (!isset($new_timeperiod['period_hours'])) {
$new_timeperiod['period_hours'] = 1;
}
if (!isset($new_timeperiod['period_minutes'])) {
$new_timeperiod['period_minutes'] = 0;
}
if (!isset($new_timeperiod['month_date_type'])) {
$new_timeperiod['month_date_type'] = !(bool) $new_timeperiod['day'];
}
// start time
if (isset($new_timeperiod['start_time'])) {
$new_timeperiod['hour'] = floor($new_timeperiod['start_time'] / SEC_PER_HOUR);
$new_timeperiod['minute'] = floor(($new_timeperiod['start_time'] - $new_timeperiod['hour'] * SEC_PER_HOUR) / SEC_PER_MIN);
}
// period
if (isset($new_timeperiod['period'])) {
$new_timeperiod['period_days'] = floor($new_timeperiod['period'] / SEC_PER_DAY);
$new_timeperiod['period_hours'] = floor(($new_timeperiod['period'] - $new_timeperiod['period_days'] * SEC_PER_DAY) / SEC_PER_HOUR);
$new_timeperiod['period_minutes'] = floor(($new_timeperiod['period'] - $new_timeperiod['period_days'] * SEC_PER_DAY - $new_timeperiod['period_hours'] * SEC_PER_HOUR) / SEC_PER_MIN);
}
// daysofweek
$dayofweek = '';
$dayofweek .= !isset($new_timeperiod['dayofweek_mo']) ? '0' : '1';
$dayofweek .= !isset($new_timeperiod['dayofweek_tu']) ? '0' : '1';
$dayofweek .= !isset($new_timeperiod['dayofweek_we']) ? '0' : '1';
$dayofweek .= !isset($new_timeperiod['dayofweek_th']) ? '0' : '1';
$dayofweek .= !isset($new_timeperiod['dayofweek_fr']) ? '0' : '1';
$dayofweek .= !isset($new_timeperiod['dayofweek_sa']) ? '0' : '1';
$dayofweek .= !isset($new_timeperiod['dayofweek_su']) ? '0' : '1';
if (isset($new_timeperiod['dayofweek'])) {
$dayofweek = zbx_num2bitstr($new_timeperiod['dayofweek'], true);
}
$new_timeperiod['dayofweek_mo'] = $dayofweek[0];
$new_timeperiod['dayofweek_tu'] = $dayofweek[1];
$new_timeperiod['dayofweek_we'] = $dayofweek[2];
$new_timeperiod['dayofweek_th'] = $dayofweek[3];
$new_timeperiod['dayofweek_fr'] = $dayofweek[4];
$new_timeperiod['dayofweek_sa'] = $dayofweek[5];
$new_timeperiod['dayofweek_su'] = $dayofweek[6];
// months
$month = '';
$month .= !isset($new_timeperiod['month_jan']) ? '0' : '1';
$month .= !isset($new_timeperiod['month_feb']) ? '0' : '1';
$month .= !isset($new_timeperiod['month_mar']) ? '0' : '1';
$month .= !isset($new_timeperiod['month_apr']) ? '0' : '1';
$month .= !isset($new_timeperiod['month_may']) ? '0' : '1';
$month .= !isset($new_timeperiod['month_jun']) ? '0' : '1';
$month .= !isset($new_timeperiod['month_jul']) ? '0' : '1';
$month .= !isset($new_timeperiod['month_aug']) ? '0' : '1';
$month .= !isset($new_timeperiod['month_sep']) ? '0' : '1';
$month .= !isset($new_timeperiod['month_oct']) ? '0' : '1';
$month .= !isset($new_timeperiod['month_nov']) ? '0' : '1';
$month .= !isset($new_timeperiod['month_dec']) ? '0' : '1';
if (isset($new_timeperiod['month'])) {
$month = zbx_num2bitstr($new_timeperiod['month'], true);
}
$new_timeperiod['month_jan'] = $month[0];
$new_timeperiod['month_feb'] = $month[1];
$new_timeperiod['month_mar'] = $month[2];
$new_timeperiod['month_apr'] = $month[3];
$new_timeperiod['month_may'] = $month[4];
$new_timeperiod['month_jun'] = $month[5];
$new_timeperiod['month_jul'] = $month[6];
$new_timeperiod['month_aug'] = $month[7];
//.........这里部分代码省略.........
示例11: foreach
$functionComboBox->addItem($id, $f['description']);
}
}
$expressionFormList->addRow(_('Function'), $functionComboBox);
if (isset($this->data['functions'][$this->data['function'] . '[' . $this->data['operator'] . ']']['params'])) {
foreach ($this->data['functions'][$this->data['function'] . '[' . $this->data['operator'] . ']']['params'] as $pid => $pf) {
$paramIsReadonly = 'no';
$paramTypeElement = null;
$paramValue = isset($this->data['param'][$pid]) ? $this->data['param'][$pid] : null;
if ($pf['T'] == T_ZBX_INT) {
if ($pid == 0 || $pid == 1 && (substr($this->data['expr_type'], 0, 6) == 'regexp' || substr($this->data['expr_type'], 0, 7) == 'iregexp' || substr($this->data['expr_type'], 0, 3) == 'str' && substr($this->data['expr_type'], 0, 6) != 'strlen')) {
if (isset($pf['M'])) {
if (is_array($pf['M'])) {
$paramTypeElement = new CComboBox('paramtype', $this->data['paramtype']);
foreach ($pf['M'] as $mid => $caption) {
$paramTypeElement->addItem($mid, $caption);
}
if (substr($this->data['expr_type'], 0, 4) == 'last' || substr($this->data['expr_type'], 0, 6) == 'strlen') {
$paramIsReadonly = 'yes';
}
} elseif ($pf['M'] == PARAM_TYPE_SECONDS) {
$expressionForm->addVar('paramtype', PARAM_TYPE_SECONDS);
$paramTypeElement = SPACE . _('Seconds');
} elseif ($pf['M'] == PARAM_TYPE_COUNTS) {
$expressionForm->addVar('paramtype', PARAM_TYPE_COUNTS);
$paramTypeElement = SPACE . _('Count');
}
} else {
$expressionForm->addVar('paramtype', PARAM_TYPE_SECONDS);
$paramTypeElement = SPACE . _('Seconds');
}
示例12: _getCB
private function _getCB($cbname, $selectedid, $items, $withNode)
{
$cmb = new CComboBox($cbname, $selectedid, 'javascript: submit();');
if ($withNode) {
foreach ($items as $id => $item) {
$items[$id] = get_node_name_by_elid($id, null, ': ') . $item;
}
}
natcasesort($items);
$items = array(0 => $this->config['DDFirst'] == ZBX_DROPDOWN_FIRST_NONE ? S_NOT_SELECTED_SMALL : S_ALL_SMALL) + $items;
foreach ($items as $id => $name) {
$cmb->addItem($id, $name);
}
return $cmb;
}
示例13: CWidget
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
$widget = (new CWidget())->setTitle(_('Authentication'));
// create form
$authenticationForm = (new CForm())->setName('authenticationForm');
// create form list
$authenticationFormList = new CFormList('authenticationList');
// append config radio buttons to form list
$authenticationFormList->addRow(_('Default authentication'), (new CRadioButtonList('config', (int) $this->data['config']['authentication_type']))->addValue(_x('Internal', 'authentication'), ZBX_AUTH_INTERNAL, null, 'submit()')->addValue(_('LDAP'), ZBX_AUTH_LDAP, null, 'submit()')->addValue(_('HTTP'), ZBX_AUTH_HTTP, null, 'submit()')->setModern(true));
// append LDAP fields to form list
if ($this->data['config']['authentication_type'] == ZBX_AUTH_LDAP) {
if ($this->data['user_list']) {
$userComboBox = new CComboBox('user', $this->data['user']);
foreach ($this->data['user_list'] as $user) {
if (check_perm2login($user['userid']) && check_perm2system($user['userid'])) {
$userComboBox->addItem($user['alias'], $user['alias']);
}
}
} else {
$userComboBox = (new CTextBox('user', $this->data['user'], true))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH);
}
$authenticationFormList->addRow(_('LDAP host'), (new CTextBox('ldap_host', $this->data['config']['ldap_host']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH));
$authenticationFormList->addRow(_('Port'), (new CNumericBox('ldap_port', $this->data['config']['ldap_port'], 5))->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH));
$authenticationFormList->addRow(_('Base DN'), (new CTextBox('ldap_base_dn', $this->data['config']['ldap_base_dn']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH));
$authenticationFormList->addRow(_('Search attribute'), (new CTextBox('ldap_search_attribute', zbx_empty($this->data['config']['ldap_search_attribute']) && $this->data['form_refresh'] == 0 ? 'uid' : $this->data['config']['ldap_search_attribute'], false, 128))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH));
$authenticationFormList->addRow(_('Bind DN'), (new CTextBox('ldap_bind_dn', $this->data['config']['ldap_bind_dn']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH));
// bind password
if (isset($this->data['change_bind_password']) || zbx_empty($this->data['config']['ldap_bind_password'])) {
$authenticationForm->addVar('change_bind_password', 1);
$authenticationFormList->addRow(_('Bind password'), (new CPassBox('ldap_bind_password'))->setWidth(ZBX_TEXTAREA_SMALL_WIDTH));
} else {
示例14: CFormTable
$sendto = get_request('sendto', '');
$mediatypeid = get_request('mediatypeid', 0);
$active = get_request('active', 0);
$period = get_request('period', '1-7,00:00-23:59');
$frmMedia = new CFormTable(S_NEW_MEDIA);
$frmMedia->SetHelp('web.media.php');
$frmMedia->addVar('media', $media);
$frmMedia->addVar('dstfrm', $_REQUEST['dstfrm']);
$cmbType = new CComboBox('mediatypeid', $mediatypeid);
$sql = 'SELECT mediatypeid,description ' . ' FROM media_type' . ' WHERE ' . DBin_node('mediatypeid') . ' ORDER BY type';
$types = DBselect($sql);
while ($type = DBfetch($types)) {
$cmbType->addItem($type['mediatypeid'], get_node_name_by_elid($type['mediatypeid'], null, ': ') . $type['description']);
}
$frmMedia->addRow(S_TYPE, $cmbType);
$frmMedia->addRow(S_SEND_TO, new CTextBox('sendto', $sendto, 20));
$frmMedia->addRow(S_WHEN_ACTIVE, new CTextBox('period', $period, 48));
$frm_row = array();
for ($i = 0; $i <= 5; $i++) {
array_push($frm_row, array(new CCheckBox('severity[' . $i . ']', str_in_array($i, $severity) ? 'yes' : 'no', null, $i), get_severity_description($i)), BR());
}
$frmMedia->addRow(S_USE_IF_SEVERITY, $frm_row);
$cmbStat = new CComboBox('active', $active);
$cmbStat->addItem(0, S_ENABLED);
$cmbStat->addItem(1, S_DISABLED);
$frmMedia->addRow(S_STATUS, $cmbStat);
$frmMedia->addItemToBottomRow(new CButton('add', $media > -1 ? S_SAVE : S_ADD));
$frmMedia->addItemToBottomRow(SPACE);
$frmMedia->addItemToBottomRow(new CButtonCancel(null, 'close_window();'));
$frmMedia->Show();
include_once 'include/page_footer.php';
示例15: unset
$available_nodes = get_accessible_nodes_by_user(CWebUser::$data, PERM_READ, PERM_RES_DATA_ARRAY);
$available_nodes = get_tree_by_parentid($ZBX_LOCALNODEID, $available_nodes, 'masterid');
// remove parent nodes
if (empty($available_nodes[0])) {
unset($available_nodes[0]);
}
if (!empty($available_nodes)) {
$node_form = new CForm('get');
$node_form->cleanItems();
$node_form->setAttribute('id', 'node_form');
// create ComboBox with selected nodes
$nodesComboBox = null;
if (count($ZBX_VIEWED_NODES['nodes']) > 0) {
$nodesComboBox = new CComboBox('switch_node', $ZBX_VIEWED_NODES['selected'], 'submit()');
foreach ($ZBX_VIEWED_NODES['nodes'] as $nodeid => $nodedata) {
$nodesComboBox->addItem($nodeid, $nodedata['name']);
}
}
$jscript = 'javascript: ' . " var pos = getPosition('button_show_tree');" . " showHide('div_node_tree', 'table');" . ' pos.top += 20;' . " \$('div_node_tree').setStyle({top: pos.top + 'px'});";
$button_show_tree = new CButton('show_node_tree', _('Select Nodes'), $jscript);
$button_show_tree->setAttribute('id', 'button_show_tree');
// create node tree
$node_tree = array();
$node_tree[0] = array('id' => 0, 'caption' => _('All'), 'combo_select_node' => new CCheckbox('check_all_nodes', null, "javascript : check_all('node_form', this.checked);"), 'parentid' => 0);
foreach ($available_nodes as $node) {
$checked = isset($ZBX_VIEWED_NODES['nodeids'][$node['nodeid']]);
$combo_select_node = new CCheckbox('selected_nodes[' . $node['nodeid'] . ']', $checked, null, $node['nodeid']);
$combo_select_node->setAttribute('style', 'margin: 1px 4px 2px 4px;');
// if no parent for node, link it to root (0)
if (!isset($available_nodes[$node['masterid']])) {
$node['masterid'] = 0;