本文整理汇总了PHP中zbx_add_post_js函数的典型用法代码示例。如果您正苦于以下问题:PHP zbx_add_post_js函数的具体用法?PHP zbx_add_post_js怎么用?PHP zbx_add_post_js使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zbx_add_post_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: __construct
/**
* @param array $options['objectOptions'] an array of parameters to be added to the request URL
*
* @see jQuery.multiSelect()
*/
public function __construct(array $options = [])
{
parent::__construct('div', true);
$this->addClass('multiselect');
$this->setId(zbx_formatDomId($options['name']));
// url
$url = new CUrl('jsrpc.php');
$url->setArgument('type', PAGE_TYPE_TEXT_RETURN_JSON);
$url->setArgument('method', 'multiselect.get');
$url->setArgument('objectName', $options['objectName']);
if (!empty($options['objectOptions'])) {
foreach ($options['objectOptions'] as $optionName => $optionvalue) {
$url->setArgument($optionName, $optionvalue);
}
}
$params = ['url' => $url->getUrl(), 'name' => $options['name'], 'labels' => ['No matches found' => _('No matches found'), 'More matches found...' => _('More matches found...'), 'type here to search' => _('type here to search'), 'new' => _('new'), 'Select' => _('Select')]];
if (array_key_exists('data', $options)) {
$params['data'] = zbx_cleanHashes($options['data']);
}
foreach (['ignored', 'defaultValue', 'disabled', 'selectedLimit', 'addNew'] as $option) {
if (array_key_exists($option, $options)) {
$params[$option] = $options[$option];
}
}
if (array_key_exists('popup', $options)) {
foreach (['parameters', 'width', 'height'] as $option) {
if (array_key_exists($option, $options['popup'])) {
$params['popup'][$option] = $options['popup'][$option];
}
}
}
zbx_add_post_js('jQuery("#' . $this->getAttribute('id') . '").multiSelect(' . CJs::encodeJson($params) . ');');
}
示例3: local_generateHeader
function local_generateHeader($data)
{
// only needed for zbx_construct_menu
global $page;
header('Content-Type: text/html; charset=UTF-8');
// construct menu
$main_menu = [];
$sub_menus = [];
zbx_construct_menu($main_menu, $sub_menus, $page, $data['controller']['action']);
$pageHeader = new CView('layout.htmlpage.header', ['javascript' => ['files' => $data['javascript']['files']], 'page' => ['title' => $data['page']['title']], 'user' => ['lang' => CWebUser::$data['lang'], 'theme' => CWebUser::$data['theme']]]);
echo $pageHeader->getOutput();
if ($data['fullscreen'] == 0) {
global $ZBX_SERVER_NAME;
$pageMenu = new CView('layout.htmlpage.menu', ['server_name' => isset($ZBX_SERVER_NAME) ? $ZBX_SERVER_NAME : '', 'menu' => ['main_menu' => $main_menu, 'sub_menus' => $sub_menus, 'selected' => $page['menu']], 'user' => ['is_guest' => CWebUser::isGuest(), 'alias' => CWebUser::$data['alias'], 'name' => CWebUser::$data['name'], 'surname' => CWebUser::$data['surname']]]);
echo $pageMenu->getOutput();
}
echo '<div class="' . ZBX_STYLE_ARTICLE . '">';
// should be replaced with addPostJS() at some point
zbx_add_post_js('initMessages({});');
// if a user logs in after several unsuccessful attempts, display a warning
if ($failedAttempts = CProfile::get('web.login.attempt.failed', 0)) {
$attempt_ip = CProfile::get('web.login.attempt.ip', '');
$attempt_date = CProfile::get('web.login.attempt.clock', 0);
$error_msg = _n('%4$s failed login attempt logged. Last failed attempt was from %1$s on %2$s at %3$s.', '%4$s failed login attempts logged. Last failed attempt was from %1$s on %2$s at %3$s.', $attempt_ip, zbx_date2str(DATE_FORMAT, $attempt_date), zbx_date2str(TIME_FORMAT, $attempt_date), $failedAttempts);
error($error_msg);
CProfile::update('web.login.attempt.failed', 0, PROFILE_TYPE_INT);
}
show_messages();
}
示例4: toString
public function toString($destroy = true)
{
if (count($this->tabs) == 1) {
$this->setAttribute('class', 'min-width ui-tabs ui-widget ui-widget-content ui-corner-all widget');
$header = reset($this->headers);
$header = new CDiv($header);
$header->addClass('ui-corner-all ui-widget-header header');
$header->setAttribute('id', 'tab_' . key($this->headers));
$this->addItem($header);
$tab = reset($this->tabs);
$tab->addClass('ui-tabs ui-tabs-panel ui-widget ui-widget-content ui-corner-all widget');
$this->addItem($tab);
} else {
$headersList = new CList();
foreach ($this->headers as $id => $header) {
$tabLink = new CLink($header, '#' . $id, null, null, false);
$tabLink->setAttribute('id', 'tab_' . $id);
$headersList->addItem($tabLink);
}
$this->addItem($headersList);
$this->addItem($this->tabs);
$options = array();
if (!is_null($this->selectedTab)) {
$options['selected'] = $this->selectedTab;
}
if ($this->rememberTab) {
$options['cookie'] = array();
}
zbx_add_post_js('jQuery("#' . $this->id . '").tabs(' . zbx_jsvalue($options, true) . ').show();');
}
return parent::toString($destroy);
}
示例5: add_doll_objects
function add_doll_objects($ref_tab, $pmid = 'mainpage')
{
$upd_script = array();
foreach ($ref_tab as $id => $doll) {
$upd_script[$doll['id']] = format_doll_init($doll);
}
zbx_add_post_js('initPMaster(' . zbx_jsvalue($pmid) . ',' . zbx_jsvalue($upd_script) . ');');
}
示例6: useJQueryStyle
public function useJQueryStyle()
{
$this->setAttribute('class', $this->getAttribute('class') . ' jqueryinputset');
if (!defined('ZBX_JQUERY_INPUTSET')) {
define('ZBX_JQUERY_INPUTSET', true);
zbx_add_post_js('setTimeout(function() { jQuery("div.jqueryinputset").buttonset(); }, 10);');
}
return $this;
}
示例7: useJQueryStyle
public function useJQueryStyle($class = '')
{
$this->jQuery = true;
$this->attr('class', 'jqueryinput ' . $this->getAttribute('class') . ' ' . $class);
if (!defined('ZBX_JQUERY_INPUT')) {
define('ZBX_JQUERY_INPUT', true);
zbx_add_post_js('jQuery("input.jqueryinput").button();');
}
return $this;
}
示例8: toString
public function toString($destroy = true)
{
if (!isset($this->attributes['checked'])) {
foreach ($this->object_name as $obj_name) {
if (empty($obj_name)) {
continue;
}
zbx_add_post_js('visibility_status_changeds(false, ' . zbx_jsvalue($obj_name) . ', ' . zbx_jsvalue($this->replace_to) . ');');
}
}
return parent::toString($destroy);
}
示例9: __construct
public function __construct(&$form, $name, $value = null, $size = 10)
{
zbx_add_post_js('if (IE7) $$("select option[disabled]").each(function(e) { e.setStyle({color: "gray"}); });');
$this->form =& $form;
$this->name = $name . '_tweenbox';
$this->varname = $name;
$this->value = zbx_toHash($value);
$this->id_l = $this->varname . '_left';
$this->id_r = $this->varname . '_right';
$this->lbox = new CListBox($this->id_l, null, $size);
$this->rbox = new CListBox($this->id_r, null, $size);
$this->lbox->setAttribute('style', 'width: 280px;');
$this->rbox->setAttribute('style', 'width: 280px;');
}
示例10: __construct
/**
* @param array $options['objectOptions'] an array of parameters to be added to the request URL
*
* @see jQuery.multiSelect()
*/
public function __construct(array $options = array())
{
parent::__construct('div', 'yes');
$this->addClass('multiselect');
$this->attr('id', zbx_formatDomId($options['name']));
// url
$url = new Curl('jsrpc.php');
$url->setArgument('type', PAGE_TYPE_TEXT_RETURN_JSON);
$url->setArgument('method', 'multiselect.get');
$url->setArgument('objectName', $options['objectName']);
if (!empty($options['objectOptions'])) {
foreach ($options['objectOptions'] as $optionName => $optionvalue) {
$url->setArgument($optionName, $optionvalue);
}
}
$params = array('id' => $this->getAttribute('id'), 'url' => $url->getUrl(), 'name' => $options['name'], 'labels' => array('No matches found' => _('No matches found'), 'More matches found...' => _('More matches found...'), 'type here to search' => _('type here to search'), 'new' => _('new'), 'Select' => _('Select')), 'data' => empty($options['data']) ? array() : zbx_cleanHashes($options['data']), 'ignored' => isset($options['ignored']) ? $options['ignored'] : null, 'defaultValue' => isset($options['defaultValue']) ? $options['defaultValue'] : null, 'disabled' => isset($options['disabled']) ? $options['disabled'] : false, 'selectedLimit' => isset($options['selectedLimit']) ? $options['selectedLimit'] : null, 'addNew' => isset($options['addNew']) ? $options['addNew'] : false, 'popup' => array('parameters' => isset($options['popup']['parameters']) ? $options['popup']['parameters'] : null, 'width' => isset($options['popup']['width']) ? $options['popup']['width'] : null, 'height' => isset($options['popup']['height']) ? $options['popup']['height'] : null, 'buttonClass' => isset($options['popup']['buttonClass']) ? $options['popup']['buttonClass'] : null));
zbx_add_post_js('jQuery("#' . $this->getAttribute('id') . '").multiSelect(' . CJs::encodeJson($params) . ')');
}
示例11: 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);
}
}
示例12: 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();');
}
示例13: zbx_objectValues
$applications = zbx_objectValues($item['applications'], 'name');
$applications = implode(', ', $applications);
if (empty($applications)) {
$applications = '-';
}
} else {
$applications = '-';
}
$itemTable->addRow(array(new CCheckBox('group_itemid[' . $item['itemid'] . ']', null, null, $item['itemid']), $description, $item['key_'], $item['delay'], $item['history'], in_array($item['value_type'], array(ITEM_VALUE_TYPE_STR, ITEM_VALUE_TYPE_LOG, ITEM_VALUE_TYPE_TEXT)) ? '' : $item['trends'], item_type2str($item['type']), new CCol($applications, 'wraptext'), $status));
}
// create go buttons
$goComboBox = new CComboBox('go');
$goOption = new CComboItem('activate', _('Enable selected'));
$goOption->setAttribute('confirm', _('Enable selected item prototypes?'));
$goComboBox->addItem($goOption);
$goOption = new CComboItem('disable', _('Disable selected'));
$goOption->setAttribute('confirm', _('Disable selected item prototypes?'));
$goComboBox->addItem($goOption);
$goOption = new CComboItem('delete', _('Delete selected'));
$goOption->setAttribute('confirm', _('Delete selected item prototypes?'));
$goComboBox->addItem($goOption);
$goButton = new CSubmit('goButton', _('Go') . ' (0)');
$goButton->setAttribute('id', 'goButton');
zbx_add_post_js('chkbxRange.pageGoName = "group_itemid";');
zbx_add_post_js('chkbxRange.prefix = "' . $this->data['parent_discoveryid'] . '";');
zbx_add_post_js('cookie.prefix = "' . $this->data['parent_discoveryid'] . '";');
// append table to form
$itemForm->addItem(array($this->data['paging'], $itemTable, $this->data['paging'], get_table_header(array($goComboBox, $goButton))));
// append form to widget
$itemsWidget->addItem($itemForm);
return $itemsWidget;
示例14: CRow
$row = new CRow(array(SPACE, $config['event_ack_enable'] ? $ack_cb_col : null, $status, $clock, zbx_date2age($row_event['clock']), zbx_date2age($next_clock, $row_event['clock']), $config['event_ack_enable'] ? $ack : NULL, is_show_all_nodes() ? SPACE : null, $empty_col), 'odd_row');
$row->setAttribute('data-parentid', $trigger['triggerid']);
$row->addStyle('display: none;');
$table->addRow($row);
if ($i > $config['event_show_max']) {
break;
}
}
}
}
//----- GO ------
$footer = null;
if ($config['event_ack_enable']) {
$goBox = new CComboBox('go');
$goBox->addItem('bulkacknowledge', S_BULK_ACKNOWLEDGE);
// goButton name is necessary!!!
$goButton = new CButton('goButton', S_GO . ' (0)');
$goButton->setAttribute('id', 'goButton');
$show_event_col ? zbx_add_post_js('chkbxRange.pageGoName = "events";') : zbx_add_post_js('chkbxRange.pageGoName = "triggers";');
$footer = get_table_header(array($goBox, $goButton));
}
//----
$table = array($paging, $table, $paging, $footer);
$m_form->addItem($table);
$trigg_wdgt->addItem($m_form);
$trigg_wdgt->show();
zbx_add_post_js('blink.init();');
zbx_add_post_js("var switcher = new CSwitcher('{$switcherName}');");
$jsmenu = new CPUMenu(null, 170);
$jsmenu->InsertJavaScript();
include_once 'include/page_footer.php';
示例15: insert_map_form
if (isset($_REQUEST["form"])) {
insert_map_form();
} else {
$form = new CForm();
$form->setName('frm_maps');
$numrows = new CSpan(null, 'info');
$numrows->setAttribute('name', 'numrows');
$header = get_table_header(array(S_MAPS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
show_table_header($header);
$table = new CTableInfo(S_NO_MAPS_DEFINED);
$table->SetHeader(array(new CCheckBox('all_maps', NULL, "checkAll('" . $form->getName() . "','all_maps','maps');"), make_sorting_link(S_NAME, 'sm.name'), make_sorting_link(S_WIDTH, 'sm.width'), make_sorting_link(S_HEIGHT, 'sm.height'), S_MAP));
$result = DBselect('SELECT sm.sysmapid,sm.name,sm.width,sm.height ' . ' FROM sysmaps sm' . ' WHERE ' . DBin_node('sm.sysmapid') . order_by('sm.name,sm.width,sm.height', 'sm.sysmapid'));
while ($row = DBfetch($result)) {
if (!sysmap_accessible($row["sysmapid"], PERM_READ_WRITE)) {
continue;
}
$table->AddRow(array(new CCheckBox('maps[' . $row['sysmapid'] . ']', NULL, NULL, $row['sysmapid']), new CLink($row["name"], "sysmaps.php?form=update" . "&sysmapid=" . $row["sysmapid"] . "#form", 'action'), $row["width"], $row["height"], new CLink(S_EDIT, "sysmap.php?sysmapid=" . $row["sysmapid"])));
}
//----- GO ------
$goBox = new CComboBox('go');
$goBox->addItem('delete', S_DELETE_SELECTED);
// goButton name is necessary!!!
$goButton = new CButton('goButton', S_GO . ' (0)');
$goButton->setAttribute('id', 'goButton');
zbx_add_post_js('chkbxRange.pageGoName = "maps";');
$table->setFooter(new CCol(array($goBox, $goButton)));
$form->addItem($table);
$form->show();
zbx_add_post_js('insert_in_element("numrows","' . $table->getNumRows() . '");');
}
include_once "include/page_footer.php";