本文整理汇总了PHP中Curl::setArgument方法的典型用法代码示例。如果您正苦于以下问题:PHP Curl::setArgument方法的具体用法?PHP Curl::setArgument怎么用?PHP Curl::setArgument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Curl
的用法示例。
在下文中一共展示了Curl::setArgument方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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) . ')');
}
示例2: get_icon
function get_icon($name, $params = array())
{
switch ($name) {
case 'favourite':
if (infavorites($params['fav'], $params['elid'], $params['elname'])) {
$icon = new CIcon(_('Remove from favourites'), 'iconminus', 'rm4favorites("' . $params['elname'] . '", "' . $params['elid'] . '", 0);');
} else {
$icon = new CIcon(_('Add to favourites'), 'iconplus', 'add2favorites("' . $params['elname'] . '", "' . $params['elid'] . '");');
}
$icon->setAttribute('id', 'addrm_fav');
break;
case 'fullscreen':
$url = new Curl();
$url->setArgument('fullscreen', $params['fullscreen'] ? '0' : '1');
$icon = new CIcon($_REQUEST['fullscreen'] ? _('Normal view') : _('Fullscreen'), 'fullscreen', "document.location = '" . $url->getUrl() . "';");
break;
case 'menu':
$icon = new CIcon(_('Menu'), 'iconmenu', 'create_page_menu(event, "' . $params['menu'] . '");');
break;
case 'reset':
$icon = new CIcon(_('Reset'), 'iconreset', 'timeControl.objectReset();');
break;
}
return $icon;
}
示例3: getPagingLine
/**
* Returns paging line.
*
* @param array $items list of items
* @param array $removeUrlParams params to remove from URL
* @param array $urlParams params to add in URL
*
* @return CTable
*/
function getPagingLine(&$items, array $removeUrlParams = array(), array $urlParams = array())
{
global $page;
$config = select_config();
$searchLimit = '';
if ($config['search_limit'] < count($items)) {
array_pop($items);
$searchLimit = '+';
}
$rowsPerPage = CWebUser::$data['rows_per_page'];
$itemsCount = count($items);
$pagesCount = $itemsCount > 0 ? ceil($itemsCount / $rowsPerPage) : 1;
$currentPage = getPageNumber();
if ($currentPage < 1) {
$currentPage = 1;
}
if ($itemsCount < ($currentPage - 1) * $rowsPerPage) {
$currentPage = $pagesCount;
}
$start = ($currentPage - 1) * $rowsPerPage;
CProfile::update('web.paging.lastpage', $page['file'], PROFILE_TYPE_STR);
CProfile::update('web.paging.page', $currentPage, PROFILE_TYPE_INT);
// trim array with items to contain items for current page
$items = array_slice($items, $start, $rowsPerPage, true);
// viewed pages (better to use not odd)
$pagingNavRange = 11;
$endPage = $currentPage + floor($pagingNavRange / 2);
if ($endPage < $pagingNavRange) {
$endPage = $pagingNavRange;
}
if ($endPage > $pagesCount) {
$endPage = $pagesCount;
}
$startPage = $endPage > $pagingNavRange ? $endPage - $pagingNavRange + 1 : 1;
$pageLine = array();
$table = null;
if ($pagesCount > 1) {
$url = new Curl();
if (is_array($urlParams) && $urlParams) {
foreach ($urlParams as $key => $value) {
$url->setArgument($key, $value);
}
}
$removeUrlParams = array_merge($removeUrlParams, array('go', 'form', 'delete', 'cancel'));
foreach ($removeUrlParams as $param) {
$url->removeArgument($param);
}
if ($startPage > 1) {
$url->setArgument('page', 1);
$pageLine[] = new CLink('<< ' . _x('First', 'page navigation'), $url->getUrl(), null, null, true);
$pageLine[] = ' ';
}
if ($currentPage > 1) {
$url->setArgument('page', $currentPage - 1);
$pageLine[] = new CLink('< ' . _x('Previous', 'page navigation'), $url->getUrl(), null, null, true);
$pageLine[] = ' | ';
}
for ($p = $startPage; $p <= $pagesCount; $p++) {
if ($p > $endPage) {
break;
}
if ($p == $currentPage) {
$pagespan = new CSpan($p, 'bold textcolorstyles');
} else {
$url->setArgument('page', $p);
$pagespan = new CLink($p, $url->getUrl(), null, null, true);
}
$pageLine[] = $pagespan;
$pageLine[] = ' | ';
}
array_pop($pageLine);
if ($currentPage < $pagesCount) {
$pageLine[] = ' | ';
$url->setArgument('page', $currentPage + 1);
$pageLine[] = new CLink(_x('Next', 'page navigation') . ' >', $url->getUrl(), null, null, true);
}
if ($p < $pagesCount) {
$pageLine[] = ' ';
$url->setArgument('page', $pagesCount);
$pageLine[] = new CLink(_x('Last', 'page navigation') . ' >>', $url->getUrl(), null, null, true);
}
$table = new CTable(null, 'paging');
$table->addRow(new CCol($pageLine));
}
$viewFromPage = ($currentPage - 1) * $rowsPerPage + 1;
$viewTillPage = $currentPage * $rowsPerPage;
if ($viewTillPage > $itemsCount) {
$viewTillPage = $itemsCount;
}
$pageView = array();
$pageView[] = _('Displaying') . SPACE;
//.........这里部分代码省略.........
示例4: access_deny
function access_deny()
{
global $USER_DETAILS;
include_once 'include/page_header.php';
if ($USER_DETAILS['alias'] != ZBX_GUEST_USER) {
show_error_message(S_NO_PERMISSIONS);
} else {
$req = new Curl($_SERVER['REQUEST_URI']);
$req->setArgument('sid', null);
$table = new CTable(null, 'warning');
$table->setAlign('center');
$table->setHeader(new CCol(S_CONFIG_ERROR_YOU_ARE_NOT_LOGGED_IN_HEAD, 'left'), 'header');
$table->addRow(new CCol(array(S_CONFIG_NOT_LOGGED_IN_ACCESS_DENIED, SPACE, bold(ZBX_GUEST_USER), '. ', S_CONFIG_ERROR_YOU_MUST_LOGIN, BR(), S_CONFIG_NOT_LOGGED_IN_NOTE), 'center'));
$url = urlencode($req->toString());
$footer = new CCol(array(new CButton('login', S_LOGIN, "javascript: document.location = 'index.php?request={$url}';"), new CButton('back', S_CANCEL, 'javascript: window.history.back();')), 'left');
$table->setFooter($footer, 'footer');
$table->show();
}
include_once 'include/page_footer.php';
}
示例5: pager
function pager($items, $itemsPerPage, $currentPage, $urlParams = array(), $removeUrlParams = array())
{
$startPage = 1;
$pagesCount = floor($items / $itemsPerPage) + 1;
$endPage = $pagesCount;
$url = new Curl();
$pageLine = array();
if (is_array($urlParams) && $urlParams) {
foreach ($urlParams as $key => $value) {
$url->setArgument($key, $value);
}
}
$removeUrlParams = array_merge($removeUrlParams, array('go', 'form', 'delete', 'cancel'));
foreach ($removeUrlParams as $param) {
$url->removeArgument($param);
}
if ($startPage > 1) {
$url->setArgument('page', 1);
$pageLine[] = new CLink('<< ' . _x('First', 'page navigation'), $url->getUrl(), null, null, true);
$pageLine[] = ' ';
}
if ($currentPage > 1) {
$url->setArgument('page', $currentPage - 1);
$pageLine[] = new CLink('< ' . _x('Previous', 'page navigation'), $url->getUrl(), null, null, true);
$pageLine[] = ' | ';
}
for ($p = $startPage; $p <= $pagesCount; $p++) {
if ($p > $endPage) {
break;
}
if ($p == $currentPage) {
$pagespan = new CSpan($p, 'bold textcolorstyles');
} else {
$url->setArgument('page', $p);
$pagespan = new CLink($p, $url->getUrl(), null, null, true);
}
$pageLine[] = $pagespan;
$pageLine[] = ' | ';
}
array_pop($pageLine);
if ($currentPage < $pagesCount) {
$pageLine[] = ' | ';
$url->setArgument('page', $currentPage + 1);
$pageLine[] = new CLink(_x('Next', 'page navigation') . ' >', $url->getUrl(), null, null, true);
}
if ($p < $pagesCount) {
$pageLine[] = ' ';
$url->setArgument('page', $pagesCount);
$pageLine[] = new CLink(_x('Last', 'page navigation') . ' >>', $url->getUrl(), null, null, true);
}
$table = new CTable(null, 'paging');
$table->addRow(new CCol($pageLine));
$pageView = array();
$pageView[] = _('Displaying') . SPACE;
if ($items > $itemsPerPage) {
$pageView[] = new CSpan($itemsPerPage * $currentPage, 'info');
$pageView[] = SPACE . _('to') . SPACE;
}
$to = min($itemsPerPage * $currentPage + $itemsPerPage, $items);
$pageView[] = new CSpan($to, 'info');
$pageView[] = SPACE . _('of') . SPACE;
$pageView[] = new CSpan($items, 'info');
$pageView[] = SPACE . _('found');
$pageView = new CSpan($pageView);
zbx_add_post_js('insertInElement("numrows", ' . zbx_jsvalue($pageView->toString()) . ', "div");');
return $table;
}
示例6: get_screen
//.........这里部分代码省略.........
$options = array('hostids' => $_REQUEST['hostid'], 'output' => array('hostid', 'host'));
$hosts = CHost::get($options);
$host = reset($hosts);
$options = array('graphids' => $resourceid, 'output' => API_OUTPUT_EXTEND, 'select_hosts' => API_OUTPUT_REFER, 'select_graph_items' => API_OUTPUT_EXTEND);
$graph = CGraph::get($options);
$graph = reset($graph);
if (count($graph['hosts']) == 1) {
// if items from one host we change them, or set calculated if not exist on that host
if ($graph['ymax_type'] == GRAPH_YAXIS_TYPE_ITEM_VALUE && $graph['ymax_itemid']) {
$new_dinamic = get_same_graphitems_for_host(array(array('itemid' => $graph['ymax_itemid'])), $_REQUEST['hostid'], false);
$new_dinamic = reset($new_dinamic);
if (isset($new_dinamic['itemid']) && $new_dinamic['itemid'] > 0) {
$graph['ymax_itemid'] = $new_dinamic['itemid'];
} else {
$graph['ymax_type'] = GRAPH_YAXIS_TYPE_CALCULATED;
}
}
if ($graph['ymin_type'] == GRAPH_YAXIS_TYPE_ITEM_VALUE && $graph['ymin_itemid']) {
$new_dinamic = get_same_graphitems_for_host(array(array('itemid' => $graph['ymin_itemid'])), $_REQUEST['hostid'], false);
$new_dinamic = reset($new_dinamic);
if (isset($new_dinamic['itemid']) && $new_dinamic['itemid'] > 0) {
$graph['ymin_itemid'] = $new_dinamic['itemid'];
} else {
$graph['ymin_type'] = GRAPH_YAXIS_TYPE_CALCULATED;
}
}
}
$url = $graph['graphtype'] == GRAPH_TYPE_PIE || $graph['graphtype'] == GRAPH_TYPE_EXPLODED ? 'chart7.php' : 'chart3.php';
$url = new Curl($url);
foreach ($graph as $name => $value) {
if ($name == 'width' || $name == 'height') {
continue;
}
$url->setArgument($name, $value);
}
$new_items = get_same_graphitems_for_host($graph['gitems'], $_REQUEST['hostid'], false);
foreach ($new_items as $gitem) {
unset($gitem['gitemid']);
unset($gitem['graphid']);
foreach ($gitem as $name => $value) {
$url->setArgument('items[' . $gitem['itemid'] . '][' . $name . ']', $value);
}
}
$url->setArgument('name', $host['host'] . ': ' . $graph['name']);
$url = $url->getUrl();
}
//-------------
$objData = array('id' => $resourceid, 'domid' => $dom_graph_id, 'containerid' => $containerid, 'objDims' => $graphDims, 'loadSBox' => 0, 'loadImage' => 1, 'loadScroll' => 0, 'dynamic' => 0);
$default = false;
if ($graphDims['graphtype'] == GRAPH_TYPE_PIE || $graphDims['graphtype'] == GRAPH_TYPE_EXPLODED) {
if ($dynamic == SCREEN_SIMPLE_ITEM || empty($url)) {
$url = 'chart6.php?graphid=' . $resourceid;
$default = true;
}
$timeline = array();
$timeline['period'] = $effectiveperiod;
$timeline['starttime'] = date('YmdHis', get_min_itemclock_by_graphid($resourceid));
if (isset($_REQUEST['stime'])) {
$timeline['usertime'] = date('YmdHis', zbxDateToTime($_REQUEST['stime']) + $timeline['period']);
}
// $src = $url.'&width='.$width.'&height='.$height.'&legend='.$legend.'&graph3d='.$graph3d;
$src = $url . '&width=' . $width . '&height=' . $height . '&legend=' . $legend . '&graph3d=' . $graph3d . '&period=' . $effectiveperiod . url_param('stime');
$objData['src'] = $src;
} else {
if ($dynamic == SCREEN_SIMPLE_ITEM || empty($url)) {
$url = 'chart2.php?graphid=' . $resourceid;
示例7: CForm
} else {
$filterForm = new CForm('get');
$filterForm->addItem(array(_('Group') . SPACE, $this->data['pageFilter']->getGroupsCB(true)));
$filterForm->addItem(array(SPACE . _('Host') . SPACE, $this->data['pageFilter']->getHostsCB(true)));
$triggersWidget->addHeader(_('Triggers'), $filterForm);
$triggersWidget->addHeaderRowNumber(array('[ ', new CLink($this->data['showdisabled'] ? _('Hide disabled triggers') : _('Show disabled triggers'), 'triggers.php?' . 'hostid=' . $this->data['hostid'] . '&showdisabled=' . ($this->data['showdisabled'] ? 0 : 1)), ' ]'));
}
// create form
$triggersForm = new CForm();
$triggersForm->setName('triggersForm');
$triggersForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']);
$triggersForm->addVar('hostid', $this->data['hostid']);
// create table
$link = new Curl();
if (!empty($this->data['parent_discoveryid'])) {
$link->setArgument('parent_discoveryid', $this->data['parent_discoveryid']);
}
$link->setArgument('hostid', $this->data['hostid']);
$link = $link->getUrl();
$triggersTable = new CTableInfo(_('No triggers found.'));
$triggersTable->setHeader(array(new CCheckBox('all_triggers', null, "checkAll('" . $triggersForm->getName() . "', 'all_triggers', 'g_triggerid');"), $this->data['displayNodes'] ? _('Node') : null, make_sorting_header(_('Severity'), 'priority', $link), empty($this->data['hostid']) ? _('Host') : null, make_sorting_header(_('Name'), 'description', $link), _('Expression'), make_sorting_header(_('Status'), 'status', $link), $data['showErrorColumn'] ? _('Error') : null));
foreach ($this->data['triggers'] as $tnum => $trigger) {
$triggerid = $trigger['triggerid'];
$trigger['discoveryRuleid'] = $this->data['parent_discoveryid'];
$description = array();
$trigger['hosts'] = zbx_toHash($trigger['hosts'], 'hostid');
$trigger['items'] = zbx_toHash($trigger['items'], 'itemid');
$trigger['functions'] = zbx_toHash($trigger['functions'], 'functionid');
if ($trigger['templateid'] > 0) {
if (!isset($this->data['realHosts'][$triggerid])) {
$description[] = new CSpan(empty($this->data['parent_discoveryid']) ? _('Host') : _('Template'), 'unknown');
示例8: get_icon
function get_icon($name, $params = array())
{
switch ($name) {
case 'favourite':
if (infavorites($params['fav'], $params['elid'], $params['elname'])) {
$icon = new CIcon(S_REMOVE_FROM . ' ' . S_FAVOURITES, 'iconminus', 'rm4favorites("' . $params['elname'] . '","' . $params['elid'] . '", 0);');
} else {
$icon = new CIcon(S_ADD_TO . ' ' . S_FAVOURITES, 'iconplus', 'add2favorites("' . $params['elname'] . '","' . $params['elid'] . '");');
}
$icon->setAttribute('id', 'addrm_fav');
break;
case 'fullscreen':
$url = new Curl();
$url->setArgument('fullscreen', $params['fullscreen'] ? '0' : '1');
$icon = new CIcon($_REQUEST['fullscreen'] ? S_NORMAL . ' ' . S_VIEW : S_FULLSCREEN, 'fullscreen', "document.location = '" . $url->getUrl() . "';");
break;
case 'menu':
$icon = new CIcon(S_MENU, 'iconmenu', 'create_page_menu(event, "' . $params['menu'] . '");');
break;
case 'reset':
$icon = new CIcon(S_RESET, 'iconreset', 'timeControl.objectReset("' . $params['id'] . '");');
break;
}
return $icon;
}
示例9: make_sorting_header
function make_sorting_header($obj, $tabfield, $url = '')
{
global $page;
$sortorder = $_REQUEST['sort'] == $tabfield && $_REQUEST['sortorder'] == ZBX_SORT_UP ? ZBX_SORT_DOWN : ZBX_SORT_UP;
$link = new Curl($url);
if (empty($url)) {
$link->formatGetArguments();
}
$link->setArgument('sort', $tabfield);
$link->setArgument('sortorder', $sortorder);
$url = $link->getUrl();
if ($page['type'] != PAGE_TYPE_HTML && defined('ZBX_PAGE_MAIN_HAT')) {
$script = "javascript: return updater.onetime_update('" . ZBX_PAGE_MAIN_HAT . "','" . $url . "');";
} else {
$script = "javascript: redirect('" . $url . "');";
}
zbx_value2array($obj);
$div = new CDiv();
$div->setAttribute('style', 'float:left;');
foreach ($obj as $enum => $el) {
if (is_object($el) || $el === SPACE) {
$div->addItem($el);
} else {
$div->addItem(new CSpan($el, 'underline'));
}
}
$div->addItem(SPACE);
$img = null;
if (isset($_REQUEST['sort']) && $tabfield == $_REQUEST['sort']) {
if ($sortorder == ZBX_SORT_UP) {
$img = new CDiv(SPACE, 'icon_sortdown');
} else {
$img = new CDiv(SPACE, 'icon_sortup');
}
$img->setAttribute('style', 'float: left;');
}
$col = new CCol(array($div, $img), 'nowrap hover_grey');
$col->setAttribute('onclick', $script);
return $col;
}
示例10: access_deny
function access_deny()
{
global $USER_DETAILS;
include_once 'include/page_header.php';
if ($USER_DETAILS['alias'] != ZBX_GUEST_USER) {
show_error_message(S_NO_PERMISSIONS);
} else {
$req = new Curl($_SERVER['REQUEST_URI']);
$req->setArgument('sid', null);
$warning_msg = array('You cannot view this URL as a ', bold(ZBX_GUEST_USER), '. ', 'You must login to view this page.', BR(), 'If you think this message is wrong, ', ' please consult your administrators about getting the necessary permissions.');
$table = new CTable(null, 'warning');
$table->setAlign('center');
$table->setHeader(new CCol('You are not logged in', 'left'), 'header');
$table->addRow(new CCol($warning_msg));
$url = urlencode($req->toString());
$footer = new CCol(array(new CButton('login', S_LOGIN, "javascript: document.location = 'index.php?request={$url}';"), new CButton('back', S_CANCEL, 'javascript: window.history.back();')), 'left');
$table->setFooter($footer, 'footer');
$table->show();
}
include_once 'include/page_footer.php';
}