本文整理汇总了PHP中CSubmit::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP CSubmit::setAttribute方法的具体用法?PHP CSubmit::setAttribute怎么用?PHP CSubmit::setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSubmit
的用法示例。
在下文中一共展示了CSubmit::setAttribute方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setAction
public function setAction($value = null)
{
if (!is_null($value)) {
return parent::setAttribute('onclick', $value);
}
global $page;
$confirmation = "Confirm('" . $this->msg . "')";
if (isset($this->vars)) {
$link = $page['file'] . '?' . $this->name . '=1' . $this->vars;
$url = new Curl($link);
$action = "redirect('" . $url->getUrl() . "')";
} else {
$action = 'true';
}
return parent::setAttribute('onclick', 'if (' . $confirmation . ') { return ' . $action . '; } else { return false; }');
}
示例2: CLink
$hostTemplates[] = ', ';
}
if ($hostTemplates) {
array_pop($hostTemplates);
}
}
// status
$status = new CLink(item_status2str($hostPrototype['status']), '?group_hostid=' . $hostPrototype['hostid'] . '&parent_discoveryid=' . $discoveryRule['itemid'] . '&go=' . ($hostPrototype['status'] ? 'activate' : 'disable'), itemIndicatorStyle($hostPrototype['status']));
$hostTable->addRow(array(new CCheckBox('group_hostid[' . $hostPrototype['hostid'] . ']', null, null, $hostPrototype['hostid']), $name, new CCol($hostTemplates, 'wraptext'), $status));
}
// create go buttons
$goComboBox = new CComboBox('go');
$goOption = new CComboItem('activate', _('Activate selected'));
$goOption->setAttribute('confirm', _('Enable selected host prototypes?'));
$goComboBox->addItem($goOption);
$goOption = new CComboItem('disable', _('Disable selected'));
$goOption->setAttribute('confirm', _('Disable selected host prototypes?'));
$goComboBox->addItem($goOption);
$goOption = new CComboItem('delete', _('Delete selected'));
$goOption->setAttribute('confirm', _('Delete selected host prototypes?'));
$goComboBox->addItem($goOption);
$goButton = new CSubmit('goButton', _('Go') . ' (0)');
$goButton->setAttribute('id', 'goButton');
zbx_add_post_js('chkbxRange.pageGoName = "group_hostid";');
zbx_add_post_js('chkbxRange.prefix = "' . $discoveryRule['itemid'] . '";');
zbx_add_post_js('cookie.prefix = "' . $discoveryRule['itemid'] . '";');
// append table to form
$itemForm->addItem(array($this->data['paging'], $hostTable, $this->data['paging'], get_table_header(array($goComboBox, $goButton))));
// append form to widget
$itemsWidget->addItem($itemForm);
return $itemsWidget;
示例3: CCol
if ($result != '-') {
$style = $result == 'TRUE' ? 'background-color: #ccf; color: #00f;' : 'background-color: #fcc; color: #f00;';
}
$col = new CCol($result);
$col->setAttribute('style', $style);
$res_table->addRow(new CRow(array($e['list'], $col)));
}
$result = '-';
if ($allowedTesting && $test) {
$result = evalExpressionData($expression, $macrosData, $octet);
}
$style = 'text-align: center;';
if ($result != '-') {
$style = $result == 'TRUE' ? 'background-color: #ccf; color: #00f;' : 'background-color: #fcc; color: #f00;';
}
$col = new CCol($result);
$col->setAttribute('style', $style);
$res_table->setFooter(array($outline, $col), $res_table->headerClass);
$frm_test->addRow(_('Result'), $res_table);
// action buttons
$btn_test = new CSubmit('test_expression', _('Test'));
if (!$allowedTesting) {
$btn_test->setAttribute('disabled', 'disabled');
}
$frm_test->addItemToBottomRow($btn_test);
$frm_test->addItemToBottomRow(SPACE);
$btn_close = new CButton('close', _('Close'), 'javascript: self.close();');
$frm_test->addItemToBottomRow($btn_close);
$frm_test->show();
//------------------------ </FORM> ---------------------------
require_once dirname(__FILE__) . '/include/page_footer.php';
示例4: CPassBox
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 {
$authenticationFormList->addRow(_('Bind password'), (new CSubmit('change_bind_password', _('Change password')))->addClass(ZBX_STYLE_BTN_GREY));
}
$authenticationFormList->addRow(_('Test authentication'), ' [' . _('must be a valid LDAP user') . ']');
$authenticationFormList->addRow(_('Login'), $userComboBox);
$authenticationFormList->addRow(_('User password'), (new CPassBox('user_password'))->setWidth(ZBX_TEXTAREA_SMALL_WIDTH));
}
// append form list to tab
$authenticationTab = new CTabView();
$authenticationTab->addTab('authenticationTab', $this->data['title'], $authenticationFormList);
// create save button
$saveButton = new CSubmit('update', _('Update'));
if ($this->data['is_authentication_type_changed']) {
$saveButton->onClick('javascript: if (confirm(' . CJs::encodeJson(_('Switching authentication method will reset all except this session! Continue?')) . ')) {' . 'jQuery("#authenticationForm").submit(); return true; } else { return false; }');
} elseif ($this->data['config']['authentication_type'] != ZBX_AUTH_LDAP) {
$saveButton->setAttribute('disabled', 'true');
}
// append buttons to form
if ($this->data['config']['authentication_type'] == ZBX_AUTH_LDAP) {
$authenticationTab->setFooter(makeFormFooter($saveButton, [new CSubmit('test', _('Test'))]));
} else {
$authenticationTab->setFooter(makeFormFooter($saveButton));
}
// append tab to form
$authenticationForm->addItem($authenticationTab);
// append form to widget
$widget->addItem($authenticationForm);
return $widget;
示例5: array
$lstGroups->addItem($group['usrgrpid'], $group['name']);
}
$userFormList->addRow(_('Groups'), array($lstGroups, new CButton('add_group', _('Add'), 'return PopUp("popup_usrgrp.php?dstfrm=' . $userForm->getName() . '&list_name=user_groups_to_del[]&var_name=user_groups", 450, 450);', 'formlist'), BR(), count($this->data['user_groups']) > 0 ? new CSubmit('del_user_group', _('Delete selected'), null, 'formlist') : null));
}
// append password to form list
if ($data['auth_type'] == ZBX_AUTH_INTERNAL) {
if (!$this->data['userid'] || isset($this->data['change_password'])) {
$userFormList->addRow(_('Password'), new CPassBox('password1', $this->data['password1'], ZBX_TEXTBOX_SMALL_SIZE));
$userFormList->addRow(_('Password (once again)'), new CPassBox('password2', $this->data['password2'], ZBX_TEXTBOX_SMALL_SIZE));
if (isset($this->data['change_password'])) {
$userForm->addVar('change_password', $this->data['change_password']);
}
} else {
$passwdButton = new CSubmit('change_password', _('Change password'), null, 'formlist');
if ($this->data['alias'] == ZBX_GUEST_USER) {
$passwdButton->setAttribute('disabled', 'disabled');
}
$userFormList->addRow(_('Password'), $passwdButton);
}
} else {
$userFormList->addRow(_('Password'), new CSpan(_s('Unavailable for users with %1$s.', authentication2str($data['auth_type']))));
}
// append languages to form list
$languageComboBox = new CComboBox('lang', $this->data['lang']);
$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);
示例6: CIcon
$removeLinkIcon = new CIcon(_('Remove link'), 'iconminus');
$removeLinkIcon->setAttribute('id', 'linkRemove');
$expandMacros = new CSpan($this->data['sysmap']['expand_macros'] == SYSMAP_EXPAND_MACROS_ON ? _('On') : _('Off'), 'whitelink');
$expandMacros->setAttribute('id', 'expand_macros');
$gridShow = new CSpan($this->data['sysmap']['grid_show'] == SYSMAP_GRID_SHOW_ON ? _('Shown') : _('Hidden'), 'whitelink');
$gridShow->setAttribute('id', 'gridshow');
$gridAutoAlign = new CSpan($this->data['sysmap']['grid_align'] == SYSMAP_GRID_ALIGN_ON ? _('On') : _('Off'), 'whitelink');
$gridAutoAlign->setAttribute('id', 'gridautoalign');
$gridSize = new CComboBox('gridsize', $this->data['sysmap']['grid_size']);
$gridSize->addItems(array(20 => '20x20', 40 => '40x40', 50 => '50x50', 75 => '75x75', 100 => '100x100'));
$gridAlignAll = new CSubmit('gridalignall', _('Align icons'));
$gridAlignAll->setAttribute('id', 'gridalignall');
$gridForm = new CDiv(array($gridSize, $gridAlignAll));
$gridForm->setAttribute('id', 'gridalignblock');
$saveButton = new CSubmit('update', _('Update'));
$saveButton->setAttribute('id', 'sysmap_update');
$menuTable = new CTable(null, 'textwhite');
$menuTable->addRow(array(_s('Map "%s"', $this->data['sysmap']['name']), SPACE . SPACE, _('Icon'), SPACE, $addIcon, SPACE, $removeIcon, SPACE . SPACE, _('Link'), SPACE, $addLinkIcon, SPACE, $removeLinkIcon, SPACE . SPACE, _('Expand macros') . ' [ ', $expandMacros, ' ]', SPACE . SPACE, _('Grid') . SPACE . '[', $gridShow, '|', $gridAutoAlign, ']', SPACE, $gridForm, SPACE . '|' . SPACE, $saveButton));
$sysmapWidget->addPageHeader($menuTable);
// create map
$backgroundImage = new CImg('images/general/tree/zero.gif', 'Sysmap');
$backgroundImage->setAttribute('id', 'sysmap_img', $this->data['sysmap']['width'], $this->data['sysmap']['height']);
$backgroundImageTable = new CTable();
$backgroundImageTable->addRow($backgroundImage);
$sysmapWidget->addItem($backgroundImageTable);
$container = new CDiv();
$container->setAttribute('id', 'sysmap_cnt');
$sysmapWidget->addItem($container);
// create elements
zbx_add_post_js('ZABBIX.apps.map.run("sysmap_cnt", ' . CJs::encodeJson(array('sysmap' => $this->data['sysmap'], 'iconList' => $this->data['iconList'], 'defaultAutoIconId' => $this->data['defaultAutoIconId'], 'defaultIconId' => $this->data['defaultIconId'], 'defaultIconName' => $this->data['defaultIconName']), true) . ');');
insert_show_color_picker_javascript();
示例7: CTabView
$hostsComboBox->addItem($host['hostid'], $host['name']);
}
}
foreach ($this->data['r_hosts'] as $host) {
if ($host['flags'] == ZBX_FLAG_DISCOVERY_NORMAL) {
$hostsComboBox->addItem($host['hostid'], $host['name']);
} else {
$hostsComboBox->addItem($host['hostid'], $host['name'], true, false);
}
}
$hostGroupFormList->addRow(_('Hosts'), $hostsComboBox->get(_('Hosts in'), [_('Other hosts | Group') . SPACE, $groupsComboBox]));
// append tabs to form
$hostGroupTab = new CTabView();
$hostGroupTab->addTab('hostgroupTab', _('Host group'), $hostGroupFormList);
// append buttons to form
if ($this->data['groupid'] == 0) {
$hostGroupTab->setFooter(makeFormFooter(new CSubmit('add', _('Add')), [new CButtonCancel()]));
} else {
$clone_button = new CSubmit('clone', _('Clone'));
if (CWebUser::getType() != USER_TYPE_SUPER_ADMIN) {
$clone_button->setAttribute('disabled', 'disabled');
}
$delete_button = new CButtonDelete(_('Delete selected group?'), url_param('form') . url_param('groupid'));
if (!isset($this->data['deletableHostGroups'][$this->data['groupid']])) {
$delete_button->setAttribute('disabled', 'disabled');
}
$hostGroupTab->setFooter(makeFormFooter(new CSubmit('update', _('Update')), [$clone_button, $delete_button, new CButtonCancel()]));
}
$hostGroupForm->addItem($hostGroupTab);
$widget->addItem($hostGroupForm);
return $widget;
示例8: CSpan
$cn_rmv->setAttribute('id', 'linkRemove');
$expandMacros = new CSpan($sysmap['expand_macros'] == SYSMAP_EXPAND_MACROS_ON ? _('On') : _('Off'), 'whitelink');
$expandMacros->setAttribute('id', 'expand_macros');
$gridShow = new CSpan($sysmap['grid_show'] == SYSMAP_GRID_SHOW_ON ? _('Shown') : _('Hidden'), 'whitelink');
$gridShow->setAttribute('id', 'gridshow');
$gridAutoAlign = new CSpan($sysmap['grid_align'] == SYSMAP_GRID_ALIGN_ON ? _('On') : _('Off'), 'whitelink');
$gridAutoAlign->setAttribute('id', 'gridautoalign');
$possibleGridSizes = array(20 => '20x20', 40 => '40x40', 50 => '50x50', 75 => '75x75', 100 => '100x100');
$gridSize = new CComboBox('gridsize', $sysmap['grid_size']);
$gridSize->addItems($possibleGridSizes);
$gridAlignAll = new CSubmit('gridalignall', _('Align icons'));
$gridAlignAll->setAttribute('id', 'gridalignall');
$gridForm = new CDiv(array($gridSize, $gridAlignAll));
$gridForm->setAttribute('id', 'gridalignblock');
$saveButton = new CSubmit('save', _('Save'));
$saveButton->setAttribute('id', 'sysmap_save');
$menuRow = array(_s('Map "%s"', $sysmap['name']), SPACE . SPACE, _('Icon'), SPACE, $el_add, SPACE, $el_rmv, SPACE . SPACE, _('Link'), SPACE, $cn_add, SPACE, $cn_rmv, SPACE . SPACE, _('Expand macros') . ' [ ', $expandMacros, ' ]', SPACE . SPACE, _('Grid') . SPACE . '[', $gridShow, '|', $gridAutoAlign, ']', SPACE, $gridForm, SPACE . '|' . SPACE, $saveButton);
$elcn_tab = new CTable(null, 'textwhite');
$elcn_tab->addRow($menuRow);
show_table_header($elcn_tab);
$sysmap_img = new CImg('images/general/tree/zero.gif', 'Sysmap');
$sysmap_img->setAttribute('id', 'sysmap_img', $sysmap['width'], $sysmap['height']);
$table = new CTable();
$table->addRow($sysmap_img);
$table->Show();
$container = new CDiv();
$container->setAttribute('id', 'sysmap_cnt');
$container->Show();
insert_show_color_picker_javascript();
add_elementNames($sysmap['selements']);
foreach ($sysmap['links'] as &$link) {
示例9: CCol
}
}
$col = new CCol($result);
$col->setAttribute('style', $style);
$resultTable->addRow(new CRow(array($e['list'], $col)));
}
$result = '-';
$style = 'text-align: center;';
if ($allowedTesting && $test) {
if (evalExpressionData($expression, $macrosData)) {
$result = 'TRUE';
$style = 'background-color: #ccf; color: #00f;';
} else {
$result = 'FALSE';
$style = 'background-color: #fcc; color: #f00;';
}
}
$col = new CCol($result);
$col->setAttribute('style', $style);
$resultTable->setFooter(array($outline, $col), $resultTable->headerClass);
$testForm->addRow(_('Result'), $resultTable);
// action buttons
$testButton = new CSubmit('test_expression', _('Test'));
if (!$allowedTesting) {
$testButton->setAttribute('disabled', 'disabled');
}
$testForm->addItemToBottomRow($testButton);
$testForm->addItemToBottomRow(SPACE);
$testForm->addItemToBottomRow(new CButton('close', _('Close'), 'javascript: self.close();'));
$testForm->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
示例10: CSubmit
// add button
$addExpressionButton = new CSubmit('and_expression', _('And'), null, 'formlist');
if ($this->data['limited']) {
$addExpressionButton->setAttribute('disabled', 'disabled');
}
array_push($expressionRow, $addExpressionButton);
// or button
$orExpressionButton = new CSubmit('or_expression', _('Or'), null, 'formlist');
if ($this->data['limited']) {
$orExpressionButton->setAttribute('disabled', 'disabled');
}
array_push($expressionRow, $orExpressionButton);
// replace button
$replaceExpressionButton = new CSubmit('replace_expression', _('Replace'), null, 'formlist');
if ($this->data['limited']) {
$replaceExpressionButton->setAttribute('disabled', 'disabled');
}
array_push($expressionRow, $replaceExpressionButton);
}
} elseif ($this->data['input_method'] != IM_FORCED) {
$inputMethodToggle = new CSpan(_('Expression constructor'), 'link');
$inputMethodToggle->setAttribute('onclick', 'javascript: ' . 'document.getElementById("toggle_input_method").value=1;' . 'document.getElementById("input_method").value=' . ($this->data['input_method'] == IM_TREE ? IM_ESTABLISHED : IM_TREE) . ';' . 'document.forms["' . $triggersForm->getName() . '"].submit();');
$expressionRow[] = array(BR(), $inputMethodToggle);
}
$triggersFormList->addRow(_('Expression'), $expressionRow);
// append expression table to form list
if ($this->data['input_method'] == IM_TREE) {
$expressionTable = new CTable(null, 'formElementTable');
$expressionTable->setAttribute('style', 'min-width: 500px;');
$expressionTable->setAttribute('id', 'exp_list');
$expressionTable->setOddRowClass('even_row');