本文整理汇总了PHP中Curl::removeArgument方法的典型用法代码示例。如果您正苦于以下问题:PHP Curl::removeArgument方法的具体用法?PHP Curl::removeArgument怎么用?PHP Curl::removeArgument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Curl
的用法示例。
在下文中一共展示了Curl::removeArgument方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
//.........这里部分代码省略.........
示例3: elseif
} elseif ($_REQUEST['favaction'] == 'remove') {
$result = rm4favorites('web.favorite.graphids', $_REQUEST['favid'], $_REQUEST['favobj']);
if ($result) {
echo '$("addrm_fav").title = "' . _('Add to favourites') . '";' . "\n";
echo '$("addrm_fav").onclick = function() { add2favorites("graphid", "' . $_REQUEST['favid'] . '"); }' . "\n";
}
}
if ($page['type'] == PAGE_TYPE_JS && $result) {
echo 'switchElementsClass("addrm_fav", "iconminus", "iconplus");';
}
}
}
if (!empty($_REQUEST['period']) || !empty($_REQUEST['stime'])) {
CScreenBase::calculateTime(array('profileIdx' => 'web.screens', 'profileIdx2' => $pageFilter->graphid, 'updateProfile' => true, 'period' => get_request('period'), 'stime' => get_request('stime')));
$curl = new Curl($_SERVER['REQUEST_URI']);
$curl->removeArgument('period');
$curl->removeArgument('stime');
ob_end_clean();
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' => get_request('fullscreen'));
// render view
$chartsView = new CView('monitoring.charts', $data);