本文整理汇总了PHP中CLink::onClick方法的典型用法代码示例。如果您正苦于以下问题:PHP CLink::onClick方法的具体用法?PHP CLink::onClick怎么用?PHP CLink::onClick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLink
的用法示例。
在下文中一共展示了CLink::onClick方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CNumericBox
$userFormList->addRow(_('Rows per page'), new CNumericBox('rows_per_page', $this->data['rows_per_page'], 6));
$userFormList->addRow(_('URL (after login)'), new CTextBox('url', $this->data['url'], ZBX_TEXTBOX_STANDARD_SIZE));
/*
* Media tab
*/
if (uint_in_array(CWebUser::$data['type'], array(USER_TYPE_ZABBIX_ADMIN, USER_TYPE_SUPER_ADMIN))) {
$userMediaFormList = new CFormList('userMediaFormList');
$userForm->addVar('user_medias', $this->data['user_medias']);
$mediaTableInfo = new CTableInfo(_('No media found.'));
foreach ($this->data['user_medias'] as $id => $media) {
if (!isset($media['active']) || !$media['active']) {
$status = new CLink(_('Enabled'), '#', 'enabled');
$status->onClick('return create_var("' . $userForm->getName() . '","disable_media",' . $id . ', true);');
} else {
$status = new CLink(_('Disabled'), '#', 'disabled');
$status->onClick('return create_var("' . $userForm->getName() . '","enable_media",' . $id . ', true);');
}
$mediaUrl = '?dstfrm=' . $userForm->getName() . '&media=' . $id . '&mediatypeid=' . $media['mediatypeid'] . '&sendto=' . urlencode($media['sendto']) . '&period=' . $media['period'] . '&severity=' . $media['severity'] . '&active=' . $media['active'];
foreach (getSeverityCaption() as $key => $caption) {
$mediaActive = $media['severity'] & 1 << $key;
$mediaSeverity[$key] = new CSpan(mb_substr($caption, 0, 1), $mediaActive ? 'enabled' : null);
$mediaSeverity[$key]->setHint($caption . ($mediaActive ? ' (on)' : ' (off)'));
}
$mediaTableInfo->addRow(array(new CCheckBox('user_medias_to_del[' . $id . ']', null, null, $id), new CSpan($media['description'], 'nowrap'), new CSpan($media['sendto'], 'nowrap'), new CSpan($media['period'], 'nowrap'), $mediaSeverity, $status, new CButton('edit_media', _('Edit'), 'return PopUp("popup_media.php' . $mediaUrl . '", 550, 400);', 'link_menu')));
}
$userMediaFormList->addRow(_('Media'), array($mediaTableInfo, new CButton('add_media', _('Add'), 'return PopUp("popup_media.php?dstfrm=' . $userForm->getName() . '", 550, 400);', 'link_menu'), SPACE, SPACE, count($this->data['user_medias']) > 0 ? new CSubmit('del_user_media', _('Delete selected'), null, 'link_menu') : null));
}
/*
* Profile fields
*/
if ($this->data['is_profile']) {
示例2: foreach
$options['groupids'] = $groupid;
}
if (!is_null($writeonly)) {
$options['editable'] = true;
}
$scripts = API::Script()->get($options);
order_result($scripts, 'name');
foreach ($scripts as $script) {
$description = new CLink($script['name'], 'javascript:void(0);');
if ($multiselect) {
$js_action = 'javascript: addValue(' . zbx_jsvalue($reference) . ', ' . zbx_jsvalue($script['scriptid']) . ');';
} else {
$values = [$dstfld1 => $script[$srcfld1], $dstfld2 => $script[$srcfld2]];
$js_action = 'javascript: addValues(' . zbx_jsvalue($dstfrm) . ', ' . zbx_jsvalue($values) . '); close_window(); return false;';
}
$description->onClick($js_action . ' jQuery(this).removeAttr("onclick");');
if ($script['type'] == ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT) {
switch ($script['execute_on']) {
case ZBX_SCRIPT_EXECUTE_ON_AGENT:
$scriptExecuteOn = _('Agent');
break;
case ZBX_SCRIPT_EXECUTE_ON_SERVER:
$scriptExecuteOn = _('Server');
break;
}
} else {
$scriptExecuteOn = '';
}
$table->addRow([$multiselect ? new CCheckBox('scripts[' . zbx_jsValue($script[$srcfld1]) . ']', $script['scriptid']) : null, $description, $scriptExecuteOn, zbx_nl2br(htmlspecialchars($script['command'], ENT_COMPAT, 'UTF-8'))]);
}
if ($multiselect) {
示例3: getUserForm
//.........这里部分代码省略.........
}
$frmUser->addRow(S_LANGUAGE, $cmbLang);
$cmbTheme = new CComboBox('theme', $theme);
$cmbTheme->addItem(ZBX_DEFAULT_CSS, S_SYSTEM_DEFAULT);
$cmbTheme->addItem('css_ob.css', S_ORIGINAL_BLUE);
$cmbTheme->addItem('css_bb.css', S_BLACK_AND_BLUE);
$cmbTheme->addItem('css_od.css', S_DARK_ORANGE);
$frmUser->addRow(S_THEME, $cmbTheme);
$script = "javascript:\n\t\t\tvar autologout_visible = document.getElementById('autologout_visible');\n\t\t\tvar autologout = document.getElementById('autologout');\n\t\t\tif(this.checked){\n\t\t\t\tif(autologout_visible.checked){\n\t\t\t\t\tautologout_visible.checked = false;\n\t\t\t\t\tautologout_visible.onclick();\n\t\t\t\t}\n\t\t\t\tautologout_visible.disabled = true;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tautologout_visible.disabled = false;\n\t\t\t}";
$chkbx_autologin = new CCheckBox("autologin", $autologin, $script, 1);
$chkbx_autologin->setAttribute('autocomplete', 'off');
$frmUser->addRow(S_AUTO_LOGIN, $chkbx_autologin);
$script = "javascript: var autologout = document.getElementById('autologout');\n\t\t\t\t\tif(this.checked) autologout.disabled = false;\n\t\t\t\t\telse autologout.disabled = true;";
$autologoutCheckBox = new CCheckBox('autologout_visible', $autologout == 0 ? 'no' : 'yes', $script);
$autologoutTextBox = new CNumericBox("autologout", $autologout == 0 ? '90' : $autologout, 4);
// if autologout is disabled
if ($autologout == 0) {
$autologoutTextBox->setAttribute('disabled', 'disabled');
}
if ($autologin != 0) {
$autologoutCheckBox->setAttribute('disabled', 'disabled');
}
$frmUser->addRow(S_AUTO_LOGOUT, array($autologoutCheckBox, $autologoutTextBox));
$frmUser->addRow(S_SCREEN_REFRESH, new CNumericBox('refresh', $refresh, 4));
$frmUser->addRow(S_ROWS_PER_PAGE, new CNumericBox('rows_per_page', $rows_per_page, 6));
$frmUser->addRow(S_URL_AFTER_LOGIN, new CTextBox("url", $url, 50));
//view Media Settings for users above "User" +++
if (uint_in_array($USER_DETAILS['type'], array(USER_TYPE_ZABBIX_ADMIN, USER_TYPE_SUPER_ADMIN))) {
$frmUser->addVar('user_medias', $user_medias);
$media_table = new CTableInfo(S_NO_MEDIA_DEFINED);
foreach ($user_medias as $id => $one_media) {
if (!isset($one_media['active']) || $one_media['active'] == 0) {
$status = new CLink(S_ENABLED, '#', 'enabled');
$status->onClick('return create_var("' . $frmUser->getName() . '","disable_media",' . $id . ', true);');
} else {
$status = new CLink(S_DISABLED, '#', 'disabled');
$status->onClick('return create_var("' . $frmUser->getName() . '","enable_media",' . $id . ', true);');
}
$media_url = '?dstfrm=' . $frmUser->getName() . '&media=' . $id . '&mediatypeid=' . $one_media['mediatypeid'] . '&sendto=' . urlencode($one_media['sendto']) . '&period=' . $one_media['period'] . '&severity=' . $one_media['severity'] . '&active=' . $one_media['active'];
$media_table->addRow(array(new CCheckBox('user_medias_to_del[' . $id . ']', null, null, $id), new CSpan($media_types[$one_media['mediatypeid']], 'nowrap'), new CSpan($one_media['sendto'], 'nowrap'), new CSpan($one_media['period'], 'nowrap'), media_severity2str($one_media['severity']), $status, new CButton('edit_media', S_EDIT, 'javascript: return PopUp("popup_media.php' . $media_url . '",550,400);')));
}
$frmUser->addRow(S_MEDIA, array($media_table, new CButton('add_media', S_ADD, 'javascript: return PopUp("popup_media.php?dstfrm=' . $frmUser->getName() . '",550,400);'), SPACE, count($user_medias) > 0 ? new CButton('del_user_media', S_DELETE_SELECTED) : null));
}
if (0 == $profile) {
$frmUser->addVar('perm_details', $perm_details);
$link = new CSpan($perm_details ? S_HIDE : S_SHOW, 'link');
$link->onClick("return create_var('" . $frmUser->getName() . "','perm_details'," . ($perm_details ? 0 : 1) . ", true);");
$resources_list = array(S_RIGHTS_OF_RESOURCES, SPACE . '(', $link, ')');
$frmUser->addSpanRow($resources_list, 'right_header');
if ($perm_details) {
$group_ids = array_values($user_groups);
if (count($group_ids) == 0) {
$group_ids = array(-1);
}
$db_rights = DBselect('SELECT * FROM rights r WHERE ' . DBcondition('r.groupid', $group_ids));
$tmp_perm = array();
while ($db_right = DBfetch($db_rights)) {
if (isset($tmp_perm[$db_right['id']])) {
$tmp_perm[$db_right['id']] = min($tmp_perm[$db_right['id']], $db_right['permission']);
} else {
$tmp_perm[$db_right['id']] = $db_right['permission'];
}
}
$user_rights = array();
foreach ($tmp_perm as $id => $perm) {
array_push($user_rights, array('id' => $id, 'permission' => $perm));
示例4: CSpan
}
if (!isset($s['posts'])) {
$s['posts'] = '';
}
if (!isset($s['required'])) {
$s['required'] = '';
}
$up = null;
if ($stepid != $first) {
$up = new CSpan(S_UP, 'link');
$up->onClick("return create_var('" . $form->getName() . "','move_up'," . $stepid . ", true);");
}
$down = null;
if ($stepid != $last) {
$down = new CLink(S_DOWN, 'link');
$down->onClick("return create_var('" . $form->getName() . "','move_down'," . $stepid . ", true);");
}
$name = new CSpan($s['name'], 'link');
$name->onClick('return PopUp("popup_httpstep.php?dstfrm=' . $form->getName() . '&list_name=steps&stepid=' . $stepid . url_param($s['name'], false, 'name') . url_param($s['timeout'], false, 'timeout') . url_param($s['url'], false, 'url') . url_param($s['posts'], false, 'posts') . url_param($s['required'], false, 'required') . url_param($s['status_codes'], false, 'status_codes') . '");');
if (zbx_strlen($s['url']) > 70) {
$url = new CTag('span', 'yes', substr($s['url'], 0, 35) . SPACE . '...' . SPACE . substr($s['url'], zbx_strlen($s['url']) - 25, 25));
$url->setHint($s['url']);
} else {
$url = $s['url'];
}
$tblSteps->addRow(array(new CCheckBox('sel_step[]', null, null, $stepid), $name, $s['timeout'] . SPACE . S_SEC_SMALL, $url, $s['required'], $s['status_codes'], array($up, isset($up) && isset($down) ? SPACE : null, $down)));
}
$form->addVar('steps', $steps);
$form->addRow(S_STEPS, array(count($steps) > 0 ? array($tblSteps, BR()) : null, new CButton('add_step', S_ADD, 'return PopUp("popup_httpstep.php?dstfrm=' . $form->getName() . '");'), count($steps) > 0 ? new CButton('del_sel_step', S_DELETE_SELECTED) : null));
$form->addItemToBottomRow(new CButton("save", S_SAVE));
if (isset($_REQUEST["httptestid"])) {