本文整理汇总了PHP中CUrl::getUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP CUrl::getUrl方法的具体用法?PHP CUrl::getUrl怎么用?PHP CUrl::getUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUrl
的用法示例。
在下文中一共展示了CUrl::getUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redirect
function redirect($url)
{
$curl = new CUrl($url);
$curl->setArgument('sid', null);
header('Location: ' . $curl->getUrl());
exit;
}
示例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: setVars
public function setVars($value = null)
{
$url = '?cancel=1';
if (!empty($value)) {
$url .= $value;
}
$uri = new CUrl($url);
$url = $uri->getUrl();
return $this->setAttribute('onclick', "javascript: return redirect('" . $url . "');");
}
示例4: 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; }');
}
示例5: resetGetParams
function resetGetParams($params, $newURL = null)
{
zbx_value2array($params);
$redirect = false;
$url = new CUrl($newURL);
foreach ($params as $num => $param) {
if (!isset($_GET[$param])) {
continue;
}
$redirect = true;
$url->setArgument($param, null);
}
if ($redirect) {
jsRedirect($url->getUrl());
include_once 'include/page_footer.php';
}
}
示例6: __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('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) . ');');
}
示例7: DBend
$result = DBend($result);
if ($page['type'] == PAGE_TYPE_JS && $result) {
echo 'switchElementClass("addrm_fav", "iconminus", "iconplus");';
}
}
}
if (!empty($_REQUEST['period']) || !empty($_REQUEST['stime'])) {
CScreenBase::calculateTime(array('profileIdx' => 'web.screens', 'profileIdx2' => $pageFilter->graphid, 'updateProfile' => true, 'period' => getRequest('period'), 'stime' => getRequest('stime')));
$curl = new CUrl();
$curl->removeArgument('period');
$curl->removeArgument('stime');
ob_end_clean();
DBstart();
CProfile::flush();
DBend();
redirect($curl->getUrl());
}
ob_end_flush();
if ($page['type'] == PAGE_TYPE_JS || $page['type'] == PAGE_TYPE_HTML_BLOCK) {
require_once dirname(__FILE__) . '/include/page_footer.php';
exit;
}
/*
* Display
*/
$data = array('pageFilter' => $pageFilter, 'graphid' => $pageFilter->graphid, 'fullscreen' => $_REQUEST['fullscreen']);
// render view
$chartsView = new CView('monitoring.charts', $data);
$chartsView->render();
$chartsView->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
示例8: CLink
$req->setArgument('print', null);
$link = new CLink(bold('«' . S_BACK_BIG), $req->getUrl(), 'small_font', null, 'nosid');
$link->setAttribute('style', 'padding-left: 10px;');
$printview = new CDiv($link, 'printless');
$printview->setAttribute('style', 'border: 1px #333 dotted;');
$printview->Show();
}
if (!defined('ZBX_PAGE_NO_MENU')) {
COpt::compare_files_with_menu($ZBX_MENU);
$help = new CLink(S_HELP, 'http://www.zabbix.com/documentation/', 'small_font', null, 'nosid');
$help->setTarget('_blank');
$support = new CLink(S_GET_SUPPORT, 'http://www.zabbix.com/support.php', 'small_font', null, 'nosid');
$support->setTarget('_blank');
$req = new CUrl($_SERVER['REQUEST_URI']);
$req->setArgument('print', 1);
$printview = new CLink(S_PRINT, $req->getUrl(), 'small_font', null, 'nosid');
$page_header_r_col = array($help, '|', $support, '|', $printview);
if ($USER_DETAILS['alias'] != ZBX_GUEST_USER) {
$page_header_r_col[] = array('|');
array_push($page_header_r_col, new CLink(S_PROFILE, 'profile.php', 'small_font', null, 'nosid'), '|');
if ($USER_DETAILS['debug_mode'] == GROUP_DEBUG_MODE_ENABLED) {
$debug = new CLink(S_DEBUG, '#debug', 'small_font', null, 'nosid');
$d_script = " if(!isset('state', this)) this.state = 'none'; " . " if(this.state == 'none') this.state = 'block'; " . " else this.state = 'none'; " . " showHideByName('zbx_gebug_info', this.state);";
$debug->setAttribute('onclick', 'javascript: ' . $d_script);
array_push($page_header_r_col, $debug, '|');
}
array_push($page_header_r_col, new CLink(S_LOGOUT, 'index.php?reconnect=1', 'small_font', null, 'nosid'));
} else {
$page_header_r_col[] = array('|', new CLink(S_LOGIN, 'index.php?reconnect=1', 'small_font', null, 'nosid'));
}
$logo = new CLink(new CDiv(SPACE, 'zabbix_logo'), 'http://www.zabbix.com/', 'image', null, 'nosid');
示例9: getGraphUrl
/**
* Return the URL for the graph.
*
* @param array $itemIds
*
* @return string
*/
protected function getGraphUrl(array $itemIds)
{
$url = new CUrl('chart.php');
$url->setArgument('period', $this->timeline['period']);
$url->setArgument('stime', $this->timeline['stime']);
$url->setArgument('itemids', $itemIds);
$url->setArgument('type', $this->graphType);
if ($this->action == HISTORY_BATCH_GRAPH) {
$url->setArgument('batch', 1);
}
return $url->getUrl() . $this->getProfileUrlParams();
}
示例10: getPagingLine
/**
* Returns paging line.
*
* @param array $items list of items
* @param string $sortorder the order in which items are sorted ASC or DESC
* @param CUrl $url URL object containing arguments and query
*
* @return CDiv
*/
function getPagingLine(&$items, $sortorder, CUrl $url)
{
global $page;
$rowsPerPage = CWebUser::$data['rows_per_page'];
$itemsCount = count($items);
$pagesCount = $itemsCount > 0 ? ceil($itemsCount / $rowsPerPage) : 1;
$currentPage = getPageNumber();
if ($currentPage < 1) {
$currentPage = 1;
} elseif ($currentPage > $pagesCount) {
$currentPage = $pagesCount;
}
$start = ($currentPage - 1) * $rowsPerPage;
$tags = [];
if ($pagesCount > 1) {
// For MVC pages $page is not set
if (isset($page['file'])) {
CProfile::update('web.paging.lastpage', $page['file'], PROFILE_TYPE_STR);
CProfile::update('web.paging.page', $currentPage, PROFILE_TYPE_INT);
} elseif (isset($_REQUEST['action'])) {
CProfile::update('web.paging.lastpage', $_REQUEST['action'], PROFILE_TYPE_STR);
CProfile::update('web.paging.page', $currentPage, PROFILE_TYPE_INT);
}
// 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;
if ($startPage > 1) {
$url->setArgument('page', 1);
$tags[] = new CLink(_('First'), $url->getUrl());
}
if ($currentPage > 1) {
$url->setArgument('page', $currentPage - 1);
$tags[] = new CLink((new CSpan())->addClass(ZBX_STYLE_ARROW_LEFT), $url->getUrl());
}
for ($p = $startPage; $p <= $endPage; $p++) {
$url->setArgument('page', $p);
$link = new CLink($p, $url->getUrl());
if ($p == $currentPage) {
$link->addClass(ZBX_STYLE_PAGING_SELECTED);
}
$tags[] = $link;
}
if ($currentPage < $pagesCount) {
$url->setArgument('page', $currentPage + 1);
$tags[] = new CLink((new CSpan())->addClass(ZBX_STYLE_ARROW_RIGHT), $url->getUrl());
}
if ($p < $pagesCount) {
$url->setArgument('page', $pagesCount);
$tags[] = new CLink(_('Last'), $url->getUrl());
}
}
if ($pagesCount == 1) {
$table_stats = _s('Displaying %1$s of %2$s found', $itemsCount, $itemsCount);
} else {
$config = select_config();
$end = $start + $rowsPerPage;
if ($end > $itemsCount) {
$end = $itemsCount;
}
$total = $itemsCount;
if ($config['search_limit'] < $itemsCount) {
if ($sortorder == ZBX_SORT_UP) {
array_pop($items);
} else {
array_shift($items);
}
$total .= '+';
}
$table_stats = _s('Displaying %1$s to %2$s of %3$s found', $start + 1, $end, $total);
}
// trim array with items to contain items for current page
$items = array_slice($items, $start, $rowsPerPage, true);
return (new CDiv())->addClass(ZBX_STYLE_TABLE_PAGING)->addItem((new CDiv())->addClass(ZBX_STYLE_PAGING_BTN_CONTAINER)->addItem($tags)->addItem((new CDiv())->addClass(ZBX_STYLE_TABLE_STATS)->addItem($table_stats)));
}
示例11: CLink
$icons->addItem((new CLink(SPACE, 'profile.php'))->addClass(ZBX_STYLE_TOP_NAV_PROFILE)->setAttribute('title', getUserFullname($data['user'])));
}
$icons->addItem((new CLink(SPACE, 'index.php?reconnect=1'))->addClass(ZBX_STYLE_TOP_NAV_SIGNOUT)->setAttribute('title', _('Sign out'))->addSID());
// 1st level menu
$top_menu = (new CDiv())->addItem(new CLink((new CDiv())->addClass(ZBX_STYLE_LOGO), 'zabbix.php?action=dashboard.view'))->addItem((new CList($data['menu']['main_menu']))->addClass(ZBX_STYLE_TOP_NAV))->addItem($icons)->addClass(ZBX_STYLE_TOP_NAV_CONTAINER)->setId('mmenu');
$sub_menu_div = (new CDiv())->addClass(ZBX_STYLE_TOP_SUBNAV_CONTAINER)->onMouseover('javascript: MMenu.submenu_mouseOver();')->onMouseout('javascript: MMenu.mouseOut();');
// 2nd level menu
foreach ($data['menu']['sub_menus'] as $label => $sub_menu) {
$sub_menu_row = (new CList())->addClass(ZBX_STYLE_TOP_SUBNAV)->setId('sub_' . $label);
foreach ($sub_menu as $id => $sub_page) {
$url = new CUrl($sub_page['menu_url']);
if ($sub_page['menu_action'] !== null) {
$url->setArgument('action', $sub_page['menu_action']);
}
$url->setArgument('ddreset', 1)->removeArgument('sid');
$sub_menu_item = new CLink($sub_page['menu_text'], $url->getUrl());
if ($sub_page['selected']) {
$sub_menu_item->addClass(ZBX_STYLE_SELECTED);
}
$sub_menu_row->addItem($sub_menu_item);
}
if ($data['menu']['selected'] === $label) {
$sub_menu_row->setAttribute('style', 'display: block;');
insert_js('MMenu.def_label = ' . zbx_jsvalue($label));
} else {
$sub_menu_row->setAttribute('style', 'display: none;');
}
$sub_menu_div->addItem($sub_menu_row);
}
if ($data['server_name'] !== '') {
$sub_menu_div->addItem((new CDiv($data['server_name']))->addClass(ZBX_STYLE_SERVER_NAME));
示例12: CUrl
$req = new CUrl();
$req->setArgument('print', null);
$link = new CLink(bold('«' . _('BACK')), $req->getUrl(), 'small_font', null, 'nosid');
$link->setAttribute('style', 'padding-left: 10px;');
$printview = new CDiv($link, 'printless');
$printview->setAttribute('style', 'border: 1px #333 dotted;');
$printview->show();
}
if (!defined('ZBX_PAGE_NO_MENU')) {
$help = new CLink(_('Help'), 'http://www.zabbix.com/documentation/', 'small_font', null, 'nosid');
$help->setTarget('_blank');
$support = new CLink(_('Get support'), 'http://www.zabbix.com/support.php', 'small_font', null, 'nosid');
$support->setTarget('_blank');
$req = new CUrl($_SERVER['REQUEST_URI']);
$req->setArgument('print', 1);
$printview = new CLink(_('Print'), $req->getUrl(), 'small_font', null, 'nosid');
$page_header_r_col = array($help, '|', $support, '|', $printview);
if (CWebUser::$data['alias'] != ZBX_GUEST_USER) {
$page_header_r_col[] = array('|');
array_push($page_header_r_col, new CLink(_('Profile'), 'profile.php', 'small_font', null, 'nosid'), '|');
if (CWebUser::$data['debug_mode'] == GROUP_DEBUG_MODE_ENABLED) {
$debug = new CLink(_('Debug'), '#debug', 'small_font', null, 'nosid');
$d_script = " if (!isset('state', this)) { this.state = 'none'; }" . " if (this.state == 'none') { this.state = 'block'; }" . " else { this.state = 'none'; }" . " showHideByName('zbx_gebug_info', this.state);";
$debug->setAttribute('onclick', 'javascript: ' . $d_script);
array_push($page_header_r_col, $debug, '|');
}
// it is not possible to logout from HTTP authentication
$chck = $page['file'] == 'authentication.php' && isset($_REQUEST['save'], $_REQUEST['config']);
if ($chck && $_REQUEST['config'] == ZBX_AUTH_HTTP || !$chck && $config['authentication_type'] == ZBX_AUTH_HTTP) {
$logout = new CLink(_('Logout'), '', 'small_font', null, 'nosid');
$logout->setHint(_s('It is not possible to logout from HTTP authentication.'), null, null, false);
示例13: get_icon
function get_icon($type, $params = array())
{
switch ($type) {
case 'favourite':
if (CFavorite::exists($params['fav'], $params['elid'], $params['elname'])) {
$icon = new CIcon(_('Remove from favourites'), 'iconminus', 'rm4favorites("' . $params['elname'] . '", "' . $params['elid'] . '");');
} else {
$icon = new CIcon(_('Add to favourites'), 'iconplus', 'add2favorites("' . $params['elname'] . '", "' . $params['elid'] . '");');
}
$icon->setAttribute('id', 'addrm_fav');
return $icon;
case 'fullscreen':
$url = new CUrl();
$url->setArgument('fullscreen', $params['fullscreen'] ? '0' : '1');
return new CIcon($params['fullscreen'] ? _('Normal view') : _('Fullscreen'), 'fullscreen', "document.location = '" . $url->getUrl() . "';");
case 'reset':
return new CIcon(_('Reset'), 'iconreset', 'timeControl.objectReset();');
}
return null;
}
示例14: array
} else {
if (isset($_REQUEST['triggers'])) {
$options = array('output' => API_OUTPUT_SHORTEN, 'acknowledged' => 0, 'triggerids' => $_REQUEST['triggers']);
$_REQUEST['events'] = CEvent::get($options);
}
}
$eventsData = array('eventids' => zbx_objectValues($_REQUEST['events'], 'eventid'), 'message' => $_REQUEST['message']);
$result = CEvent::acknowledge($eventsData);
show_messages($result, S_EVENT_ACKNOWLEDGED, S_CANNOT_ACKNOWLEDGE_EVENT);
if ($result) {
$event_acknowledged = true;
add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_TRIGGER, S_ACKNOWLEDGE_ADDED . ' [' . $bulk ? ' BULK ACKNOWLEDGE ' : expand_trigger_description_by_data($event_trigger) . ']' . ' [' . $_REQUEST['message'] . ']');
}
if (isset($_REQUEST['saveandreturn'])) {
$url = new CUrl(urldecode($_REQUEST['backurl']));
jsRedirect($url->getUrl());
exit;
}
}
$msg = $bulk ? ' BULK ACKNOWLEDGE ' : expand_trigger_description_by_data($event_trigger);
show_table_header(array(S_ALARM_ACKNOWLEDGES_BIG . ': ', $msg));
print SBR;
if ($bulk) {
$title = S_ACKNOWLEDGE_ALARM_BY;
$btn_txt2 = S_ACKNOWLEDGE . ' ' . S_AND_SYMB . ' ' . S_RETURN;
} else {
$db_acks = get_acknowledges_by_eventid($_REQUEST['eventid']);
if ($db_acks) {
$table = new CTable(null, 'ack_msgs');
$table->setAlign('center');
while ($db_ack = DBfetch($db_acks)) {
示例15: get_icon
function get_icon($type, $params = [])
{
switch ($type) {
case 'favourite':
if (CFavorite::exists($params['fav'], $params['elid'], $params['elname'])) {
$icon = (new CRedirectButton(SPACE, null))->addClass(ZBX_STYLE_BTN_REMOVE_FAV)->setTitle(_('Remove from favourites'))->onClick('rm4favorites("' . $params['elname'] . '", "' . $params['elid'] . '");');
} else {
$icon = (new CRedirectButton(SPACE, null))->addClass(ZBX_STYLE_BTN_ADD_FAV)->setTitle(_('Add to favourites'))->onClick('add2favorites("' . $params['elname'] . '", "' . $params['elid'] . '");');
}
$icon->setId('addrm_fav');
return $icon;
case 'fullscreen':
$url = new CUrl();
if ($params['fullscreen'] == 0) {
$url->setArgument('fullscreen', '1');
$icon = (new CRedirectButton(SPACE, $url->getUrl()))->setTitle(_('Fullscreen'))->addClass(ZBX_STYLE_BTN_MAX);
} else {
$url->setArgument('fullscreen', '0');
$icon = (new CRedirectButton(SPACE, $url->getUrl()))->setTitle(_('Normal view'))->addClass(ZBX_STYLE_BTN_MIN);
}
return $icon;
case 'dashconf':
$icon = (new CRedirectButton(SPACE, 'dashconf.php'))->addClass(ZBX_STYLE_BTN_CONF)->setTitle(_('Configure'));
if ($params['enabled']) {
$icon = [$icon, (new CDiv())->addClass(ZBX_STYLE_ACTIVE_INDIC)];
}
return $icon;
case 'screenconf':
return (new CRedirectButton(SPACE, null))->addClass(ZBX_STYLE_BTN_CONF)->setTitle(_('Refresh time'));
case 'overviewhelp':
return (new CRedirectButton(SPACE, null))->addClass(ZBX_STYLE_BTN_INFO);
case 'reset':
return (new CRedirectButton(SPACE, null))->addClass(ZBX_STYLE_BTN_RESET)->setTitle(_('Reset'))->onClick('timeControl.objectReset();');
}
return null;
}