本文整理汇总了PHP中insert_js函数的典型用法代码示例。如果您正苦于以下问题:PHP insert_js函数的具体用法?PHP insert_js怎么用?PHP insert_js使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了insert_js函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* Process screen.
*
* @return CDiv (screen inside container)
*/
public function get()
{
$this->dataId = 'graph_full';
$containerId = 'graph_container';
// time control
$graphDims = getGraphDims($this->graphid);
if ($graphDims['graphtype'] == GRAPH_TYPE_PIE || $graphDims['graphtype'] == GRAPH_TYPE_EXPLODED) {
$loadSBox = 0;
$src = 'chart6.php';
} else {
$loadSBox = 1;
$src = 'chart2.php';
}
$src .= '?graphid=' . $this->graphid . '&period=' . $this->timeline['period'] . '&stime=' . $this->timeline['stimeNow'] . $this->getProfileUrlParams();
$this->timeline['starttime'] = date(TIMESTAMP_FORMAT, get_min_itemclock_by_graphid($this->graphid));
$timeControlData = array('id' => $this->getDataId(), 'containerid' => $containerId, 'src' => $src, 'objDims' => $graphDims, 'loadSBox' => $loadSBox, 'loadImage' => 1, 'dynamic' => 1, 'periodFixed' => CProfile::get($this->profileIdx . '.timelinefixed', 1), 'sliderMaximumTimePeriod' => ZBX_MAX_PERIOD);
// output
if ($this->mode == SCREEN_MODE_JS) {
$timeControlData['dynamic'] = 0;
$timeControlData['loadSBox'] = 0;
return 'timeControl.addObject("' . $this->getDataId() . '", ' . zbx_jsvalue($this->timeline) . ', ' . zbx_jsvalue($timeControlData) . ')';
} else {
if ($this->mode == SCREEN_MODE_SLIDESHOW) {
insert_js('timeControl.addObject("' . $this->getDataId() . '", ' . zbx_jsvalue($this->timeline) . ', ' . zbx_jsvalue($timeControlData) . ');');
} else {
zbx_add_post_js('timeControl.addObject("' . $this->getDataId() . '", ' . zbx_jsvalue($this->timeline) . ', ' . zbx_jsvalue($timeControlData) . ');');
}
return $this->getOutput(new CDiv(null, 'center', $containerId), true, array('graphid' => $this->graphid));
}
}
示例2: jsRedirect
function jsRedirect($url, $timeout = null)
{
zbx_flush_post_cookies();
$script = '';
if (is_numeric($timeout)) {
$script .= 'setTimeout(\'window.location="' . $url . '"\',' . $timeout * 1000 . ')';
} else {
$script .= 'window.location.replace("' . $url . '");';
}
insert_js($script);
}
示例3: __construct
/**
* @param string $options['id']
* @param string $options['name']
* @param int $options['value']
*/
public function __construct(array $options = array())
{
parent::__construct('div', 'yes');
$this->attr('id', isset($options['id']) ? $options['id'] : zbx_formatDomId($options['name']));
$this->addClass('jqueryinputset control-severity');
if (!isset($options['value'])) {
$options['value'] = TRIGGER_SEVERITY_NOT_CLASSIFIED;
}
$items = array();
$jsIds = '';
$jsLabels = '';
foreach (getSeverityCaption() as $severity => $caption) {
$items[] = new CRadioButton($options['name'], $severity, null, $options['name'] . '_' . $severity, $options['value'] == $severity);
$css = getSeverityStyle($severity);
$label = new CLabel($caption, $options['name'] . '_' . $severity, $options['name'] . '_label_' . $severity);
$label->attr('data-severity', $severity);
$label->attr('data-severity-style', $css);
if ($options['value'] == $severity) {
$label->attr('aria-pressed', 'true');
$label->addClass($css);
} else {
$label->attr('aria-pressed', 'false');
}
$items[] = $label;
$jsIds .= ', #' . $options['name'] . '_' . $severity;
$jsLabels .= ', #' . $options['name'] . '_label_' . $severity;
}
if ($jsIds) {
$jsIds = substr($jsIds, 2);
$jsLabels = substr($jsLabels, 2);
}
$this->addItem($items);
insert_js('
jQuery("' . $jsLabels . '").mouseenter(function() {
jQuery("' . $jsLabels . '").each(function() {
var obj = jQuery(this);
if (obj.attr("aria-pressed") == "false") {
obj.removeClass("ui-state-hover " + obj.data("severityStyle"));
}
});
var obj = jQuery(this);
obj.addClass(obj.data("severityStyle"));
})
.mouseleave(function() {
jQuery("#' . $this->getAttribute('id') . ' [aria-pressed=\\"true\\"]").trigger("mouseenter");
});
jQuery("' . $jsIds . '").change(function() {
jQuery("#' . $this->getAttribute('id') . ' [aria-pressed=\\"true\\"]").trigger("mouseenter");
});', true);
}
示例4: get
/**
* Process screen.
*
* @return CDiv (screen inside container)
*/
public function get()
{
$this->dataId = 'graph_' . $this->screenitem['screenitemid'] . '_' . $this->screenitem['screenid'];
$resourceid = !empty($this->screenitem['real_resourceid']) ? $this->screenitem['real_resourceid'] : $this->screenitem['resourceid'];
$containerid = 'graph_container_' . $this->screenitem['screenitemid'] . '_' . $this->screenitem['screenid'];
$graphDims = getGraphDims();
$graphDims['graphHeight'] = $this->screenitem['height'];
$graphDims['width'] = $this->screenitem['width'];
// get time control
$timeControlData = array('id' => $this->getDataId(), 'containerid' => $containerid, 'objDims' => $graphDims, 'loadImage' => 1, 'periodFixed' => CProfile::get('web.screens.timelinefixed', 1), 'sliderMaximumTimePeriod' => ZBX_MAX_PERIOD);
// host feature
if ($this->screenitem['dynamic'] == SCREEN_DYNAMIC_ITEM && !empty($this->hostid)) {
$newitemid = get_same_item_for_host($resourceid, $this->hostid);
$resourceid = !empty($newitemid) ? $newitemid : '';
}
if ($this->mode == SCREEN_MODE_PREVIEW && !empty($resourceid)) {
$this->action = 'history.php?action=' . HISTORY_GRAPH . '&itemids[]=' . $resourceid . '&period=' . $this->timeline['period'] . '&stime=' . $this->timeline['stimeNow'] . $this->getProfileUrlParams();
}
if ($resourceid && $this->mode != SCREEN_MODE_EDIT) {
if ($this->mode == SCREEN_MODE_PREVIEW) {
$timeControlData['loadSBox'] = 1;
}
}
$timeControlData['src'] = $resourceid ? 'chart.php?itemids[]=' . $resourceid . '&' . $this->screenitem['url'] . '&width=' . $this->screenitem['width'] . '&height=' . $this->screenitem['height'] : 'chart3.php?';
$timeControlData['src'] .= $this->mode == SCREEN_MODE_EDIT ? '&period=3600&stime=' . date(TIMESTAMP_FORMAT, time()) : '&period=' . $this->timeline['period'] . '&stime=' . $this->timeline['stimeNow'];
$timeControlData['src'] .= $this->getProfileUrlParams();
// output
if ($this->mode == SCREEN_MODE_JS) {
return 'timeControl.addObject("' . $this->getDataId() . '", ' . CJs::encodeJson($this->timeline) . ', ' . CJs::encodeJson($timeControlData) . ')';
} else {
if ($this->mode == SCREEN_MODE_SLIDESHOW) {
insert_js('timeControl.addObject("' . $this->getDataId() . '", ' . CJs::encodeJson($this->timeline) . ', ' . CJs::encodeJson($timeControlData) . ');');
} else {
zbx_add_post_js('timeControl.addObject("' . $this->getDataId() . '", ' . CJs::encodeJson($this->timeline) . ', ' . CJs::encodeJson($timeControlData) . ');');
}
if ($this->mode == SCREEN_MODE_EDIT || $this->mode == SCREEN_MODE_SLIDESHOW) {
$item = new CDiv();
} elseif ($this->mode == SCREEN_MODE_PREVIEW) {
$item = new CLink(null, 'history.php?action=' . HISTORY_GRAPH . '&itemids[]=' . $resourceid . '&period=' . $this->timeline['period'] . '&stime=' . $this->timeline['stimeNow']);
}
$item->setAttribute('id', $containerid);
return $this->getOutput($item);
}
}
示例5: show_head
/**
* show_head
*
*
*
*
*
*
*/
function show_head($head_content = '', $config = '')
{
// get default config from database if needed
if (empty($config)) {
$config = get_settings();
/*
$config['site']['meta'] = $config['meta'];
unset($config['meta']);
$config_site = $config['site'];
unset($config);
*/
}
// doctype
echo !empty($head_content['doctype']) ? $head_content['doctype'] : declare_doctype($config['site']['doctype']);
// html lang
echo !empty($head_content['html_lang']) ? $head_content['html_lang'] : declare_html_lang($config['site']['html_lang'], $config['site']['xml_namespaces']);
// start head section
$title = !empty($config['site']['meta_title']) ? $config['site']['meta_title'] : $config['site']['title'];
echo "\n" . '<head>
<title>' . $title . '</title>';
// base href
echo '
<base href="' . constant('WW_WEB_ROOT') . '" />' . "\n";
// meta tags
echo !empty($head_content['meta']) ? $head_content['meta'] : declare_meta($config['meta']);
// head links
$links_array = isset($config['site']['link']) ? $config['site']['link'] : array();
echo !empty($head_content['links']) ? $head_content['links'] : insert_links($links_array);
// favicon
echo !empty($head_content['favicon']) ? $head_content['favicon'] : insert_favicon($config['site']['theme']);
// css
echo !empty($head_content['css']) ? $head_content['css'] : insert_css($config['site']['theme']);
// js
echo !empty($head_content['js']) ? $head_content['js'] : insert_js($config['site']['theme']);
// analytics
if (!empty($config['connections']['google_analytics'])) {
echo insert_google_analytics($config['connections']['google_analytics']);
}
// close head section
echo "\n" . '</head>';
return;
}
示例6: insert_show_color_picker_javascript
function insert_show_color_picker_javascript()
{
global $SHOW_COLOR_PICKER_SCRIPT_ISERTTED;
if ($SHOW_COLOR_PICKER_SCRIPT_ISERTTED) {
return;
}
$SHOW_COLOR_PICKER_SCRIPT_ISERTTED = true;
$table = '';
$table .= '<table cellspacing="0" cellpadding="1">';
$table .= '<tr>';
/* gray colors */
foreach (array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'b', 'C', 'D', 'E', 'F') as $c) {
$color = $c . $c . $c . $c . $c . $c;
$table .= '<td>' . unpack_object(new CColorCell(null, $color, 'set_color(\\\'' . $color . '\\\')')) . '</td>';
}
$table .= '</tr>';
/* other colors */
$colors = array(array('r' => 0, 'g' => 0, 'b' => 1), array('r' => 0, 'g' => 1, 'b' => 0), array('r' => 1, 'g' => 0, 'b' => 0), array('r' => 0, 'g' => 1, 'b' => 1), array('r' => 1, 'g' => 0, 'b' => 1), array('r' => 1, 'g' => 1, 'b' => 0));
$brigs = array(array(0 => '0', 1 => '3'), array(0 => '0', 1 => '4'), array(0 => '0', 1 => '5'), array(0 => '0', 1 => '6'), array(0 => '0', 1 => '7'), array(0 => '0', 1 => '8'), array(0 => '0', 1 => '9'), array(0 => '0', 1 => 'A'), array(0 => '0', 1 => 'B'), array(0 => '0', 1 => 'C'), array(0 => '0', 1 => 'D'), array(0 => '0', 1 => 'E'), array(0 => '3', 1 => 'F'), array(0 => '6', 1 => 'F'), array(0 => '9', 1 => 'F'), array(0 => 'C', 1 => 'F'));
foreach ($colors as $c) {
$table .= '<tr>';
foreach ($brigs as $br) {
$r = $br[$c['r']];
$g = $br[$c['g']];
$b = $br[$c['b']];
$color = $r . $r . $g . $g . $b . $b;
$table .= '<td>' . unpack_object(new CColorCell(null, $color, 'set_color(\\\'' . $color . '\\\')')) . '</td>';
}
$table .= '</tr>';
}
$table .= '</table>';
$cancel = '<span onclick="javascript:hide_color_picker();" class="link">' . S_CANCEL . '</span>';
$script = 'var color_picker = null;
var curr_lbl = null;
var curr_txt = null;' . "\n";
$script .= "var color_table = '" . $table . $cancel . "'\n";
insert_js($script);
print '<script type="text/javascript" src="js/color_picker.js"></script>';
zbx_add_post_js('create_color_picker();');
}
示例7: define
define('ZBX_PAGE_NO_MENU', 1);
include_once 'include/page_header.php';
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = array('dstfrm' => array(T_ZBX_STR, O_MAND, P_SYS, NOT_EMPTY, null), 'config' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1,2,3'), NULL), 'period_id' => array(T_ZBX_INT, O_OPT, null, null, null), 'caption' => array(T_ZBX_STR, O_OPT, null, null, null), 'report_timesince' => array(T_ZBX_INT, O_OPT, null, null, 'isset({save})'), 'report_timetill' => array(T_ZBX_INT, O_OPT, null, null, 'isset({save})'), 'color' => array(T_ZBX_CLR, O_OPT, null, null, 'isset({save})'), 'save' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form_refresh' => array(T_ZBX_STR, O_OPT, null, null, null));
check_fields($fields);
insert_js_function('add_period');
insert_js_function('update_period');
$_REQUEST['caption'] = get_request('caption', '');
if (zbx_empty($_REQUEST['caption']) && isset($_REQUEST['report_timesince']) && isset($_REQUEST['report_timetill'])) {
$_REQUEST['caption'] = date(S_DATE_FORMAT_YMDHMS, $_REQUEST['report_timesince']) . ' - ' . date(S_DATE_FORMAT_YMDHMS, $_REQUEST['report_timetill']);
}
if (isset($_REQUEST['save'])) {
if (isset($_REQUEST['period_id'])) {
insert_js("update_period('" . $_REQUEST['period_id'] . "','" . $_REQUEST['dstfrm'] . "','" . $_REQUEST['caption'] . "','" . $_REQUEST['report_timesince'] . "','" . $_REQUEST['report_timetill'] . "','" . $_REQUEST['color'] . "');\n");
} else {
insert_js("add_period('" . $_REQUEST['dstfrm'] . "','" . $_REQUEST['caption'] . "','" . $_REQUEST['report_timesince'] . "','" . $_REQUEST['report_timetill'] . "','" . $_REQUEST['color'] . "');\n");
}
} else {
echo SBR;
$frmPd = new CFormTable(S_PERIOD);
$frmPd->setName('period');
$frmPd->addVar('dstfrm', $_REQUEST['dstfrm']);
$config = get_request('config', 1);
$caption = get_request('caption', '');
$color = get_request('color', '009900');
$report_timesince = get_request('report_timesince', time() - 86400);
$report_timetill = get_request('report_timetill', time());
$frmPd->addVar('config', $config);
$frmPd->addVar('report_timesince', $report_timesince);
$frmPd->addVar('report_timetill', $report_timetill);
if (isset($_REQUEST['period_id'])) {
示例8: CScreenBuilder
if (hasRequest('widgetRefresh')) {
$screenBuilder = new CScreenBuilder(['screen' => $dbScreen, 'mode' => SCREEN_MODE_PREVIEW, 'profileIdx' => 'web.slides', 'profileIdx2' => $elementId, 'hostid' => getRequest('hostid'), 'period' => getRequest('period'), 'stime' => getRequest('stime')]);
CScreenBuilder::insertScreenCleanJs();
echo (new CDiv($screenBuilder->show()))->addClass(ZBX_STYLE_TABLE_FORMS_CONTAINER)->toString();
CScreenBuilder::insertScreenStandardJs(['timeline' => $screenBuilder->timeline, 'profileIdx' => $screenBuilder->profileIdx]);
insertPagePostJs();
}
// refresh rate
if (hasRequest('widgetRefreshRate')) {
$widgetRefreshRate = substr(getRequest('widgetRefreshRate'), 1);
CProfile::update('web.slides.rf_rate.' . WIDGET_SLIDESHOW, $widgetRefreshRate, PROFILE_TYPE_STR, $elementId);
} else {
$widgetRefreshRate = CProfile::get('web.slides.rf_rate.' . WIDGET_SLIDESHOW, 1, getRequest('elementid', CProfile::get('web.slides.elementid')));
}
$delay = $screen['delay'] > 0 ? $screen['delay'] : $data['screen']['delay'];
insert_js('PMasters["slideshows"].dolls["' . WIDGET_SLIDESHOW . '"].frequency(' . CJs::encodeJson($delay * $widgetRefreshRate) . ');' . "\n" . 'PMasters["slideshows"].dolls["' . WIDGET_SLIDESHOW . '"].restartDoll();');
}
}
// filter state
if (hasRequest('favobj') && hasRequest('favid')) {
$favouriteObject = getRequest('favobj');
$favouriteId = getRequest('favid');
// saving fixed/dynamic setting to profile
if ($favouriteObject === 'timelinefixedperiod') {
CProfile::update('web.slides.timelinefixed', $favouriteId, PROFILE_TYPE_INT);
}
}
if ($page['type'] == PAGE_TYPE_JS || $page['type'] == PAGE_TYPE_HTML_BLOCK) {
require_once dirname(__FILE__) . '/include/page_footer.php';
exit;
}
示例9: CWidget
$dashboardWidget = new CWidget('dashboard_wdgt');
$dashboardWidget->setClass('header');
$dashboardWidget->addHeader(_('PERSONAL DASHBOARD'), array(new CIcon(_s('Configure (Filter %s)', $dashconf['filterEnable'] ? _('Enabled') : _('Disabled')), $dashconf['filterEnable'] ? 'iconconfig_hl' : 'iconconfig', "document.location = 'dashconf.php';"), SPACE, get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen']))));
// js menu arrays
$menu = array();
$submenu = array();
make_graph_menu($menu, $submenu);
make_sysmap_menu($menu, $submenu);
make_screen_menu($menu, $submenu);
make_refresh_menu('mainpage', 'hat_syssum', CProfile::get('web.dashboard.rf_rate.hat_syssum', 60), null, $menu, $submenu);
make_refresh_menu('mainpage', 'hat_hoststat', CProfile::get('web.dashboard.rf_rate.hat_hoststat', 60), null, $menu, $submenu);
make_refresh_menu('mainpage', 'hat_stszbx', CProfile::get('web.dashboard.rf_rate.hat_stszbx', 60), null, $menu, $submenu);
make_refresh_menu('mainpage', 'hat_lastiss', CProfile::get('web.dashboard.rf_rate.hat_lastiss', 60), null, $menu, $submenu);
make_refresh_menu('mainpage', 'hat_webovr', CProfile::get('web.dashboard.rf_rate.hat_webovr', 60), null, $menu, $submenu);
make_refresh_menu('mainpage', 'hat_dscvry', CProfile::get('web.dashboard.rf_rate.hat_dscvry', 60), null, $menu, $submenu);
insert_js('var page_menu=' . zbx_jsvalue($menu) . ";\n" . 'var page_submenu=' . zbx_jsvalue($submenu) . ";\n");
/*
* Left column
*/
$leftColumn = array();
// favorite graphs
$graph_menu = get_icon('menu', array('menu' => 'graphs'));
$fav_grph = new CUIWidget('hat_favgrph', make_favorite_graphs(), CProfile::get('web.dashboard.hats.hat_favgrph.state', 1));
$fav_grph->setHeader(_('Favourite graphs'), array($graph_menu));
$fav_grph->setFooter(new CLink(_('Graphs') . ' »', 'charts.php', 'highlight'), true);
$leftColumn[] = $fav_grph;
// favorite screens
$screen_menu = get_icon('menu', array('menu' => 'screens'));
$fav_scr = new CUIWidget('hat_favscr', make_favorite_screens(), CProfile::get('web.dashboard.hats.hat_favscr.state', 1));
$fav_scr->setHeader(_('Favourite screens'), array($screen_menu));
$fav_scr->setFooter(new CLink(_('Screens') . ' »', 'screens.php', 'highlight'), true);
示例10: show_messages
if (isset($rows['items']) && $rows['items'] > 0) {
show_messages(false, null, S_ANOTHER_ITEM_SUM);
if (isset($_REQUEST['save'])) {
unset($_REQUEST['save']);
}
$_REQUEST['type'] = GRAPH_ITEM_SIMPLE;
}
}
}
if (isset($_REQUEST['save']) && !isset($_REQUEST['gid'])) {
$script = "add_graph_item('" . $_REQUEST['dstfrm'] . "','" . $_REQUEST['itemid'] . "','" . $_REQUEST['color'] . "'," . $_REQUEST['drawtype'] . "," . $_REQUEST['sortorder'] . "," . $_REQUEST['yaxisside'] . "," . $_REQUEST['calc_fnc'] . "," . $_REQUEST['type'] . "," . $_REQUEST['periods_cnt'] . ");\n";
insert_js($script);
}
if (isset($_REQUEST['save']) && isset($_REQUEST['gid'])) {
$script = "update_graph_item('" . $_REQUEST['dstfrm'] . "','" . $_REQUEST['list_name'] . "','" . $_REQUEST['gid'] . "','" . $_REQUEST['itemid'] . "','" . $_REQUEST['color'] . "'," . $_REQUEST['drawtype'] . "," . $_REQUEST['sortorder'] . "," . $_REQUEST['yaxisside'] . "," . $_REQUEST['calc_fnc'] . "," . $_REQUEST['type'] . "," . $_REQUEST['periods_cnt'] . ");\n";
insert_js($script);
} else {
echo SBR;
$graphid = get_request("graphid", null);
$graphtype = get_request("graphtype", GRAPH_TYPE_NORMAL);
$gid = get_request("gid", null);
$list_name = get_request("list_name", null);
$itemid = get_request("itemid", 0);
$color = get_request("color", '009900');
$drawtype = get_request("drawtype", 0);
$sortorder = get_request("sortorder", 0);
$yaxisside = get_request("yaxisside", 1);
$calc_fnc = get_request("calc_fnc", 2);
$type = get_request("type", 0);
$periods_cnt = get_request("periods_cnt", 5);
$only_hostid = get_request("only_hostid", null);
示例11: basename
<?php
require_once 'include/config.inc.php';
require_once 'include/js.inc.php';
require_once 'include/hosts.inc.php';
require_once 'include/items.inc.php';
require_once 'yandexapi.conf.php';
$page["title"] = $ZabbixYaMap['city'];
$page['file'] = basename(__FILE__);
$page['scripts'] = array('yamaps_functions_shared.js');
$page['type'] = detect_page_type(PAGE_TYPE_HTML);
// Detect YandexMaps Language
$page['yaLang'] = YaMapLanguage(CWebUser::$data['lang']);
include_once 'include/page_header.php';
include 'include/views/js/configuration.yamaps.js.php';
insert_js("\n\tdocument.write('<select id=\"selectgroup\"></select>');\n\tvar h = jQuery(window).height() - 180;\n\tdocument.write('<div id=\"map\" style=\"width:100%; height:' + h + 'px\"></div>');\n");
?>
<!-- Load YandexMaps JS Classes -->
<script src="http://api-maps.yandex.ru/2.0/?load=package.full&lang=<?php
echo $page['yaLang'];
?>
" type="text/javascript"></script>
<?php
insert_js("\n ymaps.ready(function() {\n\t\t//console.log('YandexMaps is starting');\n\t\tYaMap = new ZabbixYaMapRW(" . $ZabbixYaMap['latitude'] . ",\n\t\t\t " . $ZabbixYaMap['longitude'] . ",\n\t\t\t " . $ZabbixYaMap['zoom'] . ",\n\t\t\t '" . $ZabbixYaMap['maptype'] . "',\n\t\t\t '" . $ZabbixYaMap['prioproblem'] . "');\n\t\t//console.log(YaMap);\n\t\tYaMap.init();\n });\n");
require_once 'include/page_footer.php';
?>
示例12: array
$values = array($dstfld1 => $script[$srcfld1], $dstfld2 => $script[$srcfld2]);
$js_action = 'javascript: addValues(' . zbx_jsvalue($dstfrm) . ', ' . zbx_jsvalue($values) . '); close_window(); return false;';
}
$description->setAttribute('onclick', $js_action . ' jQuery(this).removeAttr("onclick");');
if ($multiselect) {
$description = new CCol(array(new CCheckBox('scripts[' . zbx_jsValue($script[$srcfld1]) . ']', null, null, $script['scriptid']), $description));
}
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(array($description, $scriptExecuteOn, zbx_nl2br(htmlspecialchars($script['command'], ENT_COMPAT, 'UTF-8'))));
}
if ($multiselect) {
$button = new CButton('select', _('Select'), "javascript: addSelectedValues('scripts', " . zbx_jsvalue($reference) . ');');
$table->setFooter(new CCol($button, 'right'));
insert_js('var popupReference = ' . zbx_jsvalue($scripts, true) . ';');
}
zbx_add_post_js('chkbxRange.pageGoName = "scripts";');
$form->addItem($table);
$form->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
示例13: preload
public function preload()
{
$id = $this->getAttribute('id');
if (empty($id)) {
$id = 'img' . uniqid();
$this->setAttribute('id', $id);
}
insert_js('jQuery(' . CJs::encodeJson($this->toString()) . ').load(function() {
var parent = jQuery("#' . $id . 'preloader").parent();
jQuery("#' . $id . 'preloader").remove();
jQuery(parent).append(jQuery(this));
});', true);
$this->addClass('preloader');
$this->setAttribute('id', $id . 'preloader');
$this->setAttribute('src', 'styles/themes/' . getUserTheme(CWebUser::$data) . '/images/preloader.gif');
}
示例14: clearCookies
/**
* Clear page cookies on action.
*
* @param bool $clear
* @param string $id parent id, is used as cookie prefix
*/
function clearCookies($clear = false, $id = null)
{
if ($clear) {
insert_js('cookie.eraseArray("' . basename($_SERVER['SCRIPT_NAME'], '.php') . ($id ? '_' . $id : '') . '")');
}
}
示例15: set_users_jsmenu_array
function set_users_jsmenu_array()
{
$menu_all = array();
$menu_gui_access = array();
$menu_users_status = array();
$res = DBselect('SELECT DISTINCT g.usrgrpid, g.name, g.gui_access, g.users_status' . ' FROM usrgrp g' . ' WHERE ' . DBin_node('g.usrgrpid', get_current_nodeid(false)) . ' ORDER BY g.name');
while ($group = DBfetch($res)) {
$group['name'] = htmlspecialchars($group['name']);
$gui_access = $group['gui_access'];
$users_status = $group['users_status'];
unset($group['gui_access']);
unset($group['users_status']);
$menu_all[] = $group;
if ($gui_access != GROUP_GUI_ACCESS_SYSTEM) {
$menu_gui_access[] = $group;
}
if ($users_status == GROUP_STATUS_DISABLED) {
$menu_users_status[] = $group;
}
}
insert_js('var menu_usrgrp_all=' . zbx_jsvalue($menu_all) . ";\n" . 'var menu_usrgrp_gui=' . zbx_jsvalue($menu_gui_access) . ";\n" . 'var menu_usrgrp_status=' . zbx_jsvalue($menu_users_status) . ";\n");
}