当前位置: 首页>>代码示例>>PHP>>正文


PHP Pager::getPager方法代码示例

本文整理汇总了PHP中Pager::getPager方法的典型用法代码示例。如果您正苦于以下问题:PHP Pager::getPager方法的具体用法?PHP Pager::getPager怎么用?PHP Pager::getPager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pager的用法示例。


在下文中一共展示了Pager::getPager方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 /**
  * 募集一覧
  */
 public function index()
 {
     // 検索条件追加
     $where_query = '';
     $where_value = array();
     // 取得開始位置
     $curpage = ($page = $this->request->getParam('page')) ? $page : 1;
     // 取得数
     $count = $this->collect->query(' SELECT count(*) as count FROM collect JOIN team ' . '  WHERE collect.team_id = team.id  ' . $where_query, $where_value);
     // ページャー設定
     $pager = Pager::getPager($count[0]['count'], $curpage, self::PERPAGE_CNT);
     // 募集一覧取得
     $collects = $this->collect->query('SELECT collect.*, team.name ' . ' FROM collect ' . ' JOIN team  WHERE collect.team_id = team.id ' . $where_query . ' limit ' . $pager['limit'] . ' offset ' . $pager['offset'], $where_value);
     $this->request->set('pager', $pager);
     // viewにセット
     $this->request->set('collects', $collects);
 }
开发者ID:nikitiki,项目名称:matching-system,代码行数:20,代码来源:collects_controller.php

示例2: smarty_function_draw_pager

/**
 * Draw Pager
 *
 * @param $id
 * @param $visualPagesCount
 * @param $exclude
 * @return string
 */
function smarty_function_draw_pager($params, Smarty_Internal_Template &$smarty)
{
    $id = null;
    $visualPagesCount = null;
    $excludedGetsArray = array();
    extract($params);
    if (empty($visualPagesCount)) {
        $visualPagesCount = ConfigManager::getConfig("Pager", "Pager")->AuxConfig->defaultVidualPagesCount;
    }
    if (empty($id)) {
        $id = null;
    }
    if (isset($exclude) and !empty($exclude)) {
        $excludedGetsArray = explode(",", str_replace(" ", "", $exclude));
    }
    $pager = Pager::getPager($id);
    if ($pager instanceof Pager) {
        if (isset($baseLink) and !empty($baseLink)) {
            // Remove heading slash if present and ensure last slash
            $link = RewriteURL::ensureSourceLastDelimiter(ltrim($baseLink, "/"));
        } else {
            $link = RewriteURL::generateCleanBaseLink(Reg::get('nav')->module, Reg::get('nav')->page, ConfigManager::getConfig("SiteNavigation")->AuxConfig->firstLevelDefaultValue) . get_all_get_params(array_merge(array($pager->getUrlParam()), $excludedGetsArray));
        }
        $urlParam = $pager->getUrlParam();
        $currentPageNumber = $pager->getCurrentPageNumber();
        $pagesCount = $pager->getTotalPagesCount();
        if ($pagesCount > 1) {
            $pageNumStart = $currentPageNumber - floor($visualPagesCount / 2);
            if ($pageNumStart < 1) {
                $pageNumStart = 1;
            }
            $pageNumEnd = $pageNumStart + $visualPagesCount - 1;
            if ($pageNumEnd > $pagesCount) {
                $pageNumEnd = $pagesCount;
                $pageNumStart = $pageNumEnd - $visualPagesCount + 1;
                if ($pageNumStart < 1) {
                    $pageNumStart = 1;
                }
            }
            if ($currentPageNumber > 1) {
                $prevPageLink = Reg::get(ConfigManager::getConfig("RewriteURL")->Objects->rewriteURL)->glink($link . $pager->getUrlParam() . ':' . ($currentPageNumber - 1));
                $smarty->assign('pagerPreviousPageLink', $prevPageLink);
            }
            $pagerNumbersArray = array();
            for ($pgNum = $pageNumStart; $pgNum <= $pageNumEnd; $pgNum++) {
                $isCurrent = false;
                if ($pgNum == $currentPageNumber) {
                    $isCurrent = true;
                }
                $pageLink = Reg::get(ConfigManager::getConfig("RewriteURL")->Objects->rewriteURL)->glink($link . $pager->getUrlParam() . ':' . $pgNum);
                array_push($pagerNumbersArray, array("pageNum" => $pgNum, "pageLink" => $pageLink, "isCurrent" => $isCurrent));
            }
            if ($currentPageNumber < $pagesCount) {
                $nextPageLink = Reg::get(ConfigManager::getConfig("RewriteURL")->Objects->rewriteURL)->glink($link . $pager->getUrlParam() . ':' . ($currentPageNumber + 1));
                $smarty->assign('pagerNextPageLink', $nextPageLink);
            }
            $smarty->assign("pagerPageNumStart", $pageNumStart);
            $smarty->assign("pagerPageNumEnd", $pageNumEnd);
            $smarty->assign("pagerCurrentPageNumber", $currentPageNumber);
            $smarty->assign("pagerTotalPagesCount", $pagesCount);
            $smarty->assign("pagerNumbersArray", $pagerNumbersArray);
        }
        if (isset($tplSnippetFile)) {
            $pagerSnippetFileName = $tplSnippetFile;
        } else {
            $pagerSnippetFileName = ConfigManager::getConfig("Pager", "Pager")->AuxConfig->pagerSnippetFileName;
        }
        return $smarty->fetch(Reg::get('smarty')->getFilePathFromTemplate(Reg::get('smarty')->snippetsPath . $pagerSnippetFileName));
    }
}
开发者ID:alexamiryan,项目名称:stingle,代码行数:78,代码来源:function.draw_pager.php

示例3: smarty_function_draw_pager

/**
 * Draw Pager
 *
 * @param $id
 * @param $visualPagesCount
 * @param $exclude
 * @param $additionalParams
 * @param $linkClass
 * @return string
 */
function smarty_function_draw_pager($params, Smarty_Internal_Template &$smarty)
{
    $id = null;
    $visualPagesCount = null;
    $excludedGetsArray = array();
    extract($params);
    if (empty($visualPagesCount)) {
        $visualPagesCount = ConfigManager::getConfig("Pager", "Pager")->AuxConfig->defaultVisualPagesCount;
    }
    if (empty($id)) {
        $id = null;
    }
    if (isset($exclude) and !empty($exclude)) {
        $excludedGetsArray = explode(",", str_replace(" ", "", $exclude));
    }
    $pager = Pager::getPager($id);
    if ($pager instanceof Pager) {
        if (isset($baseLink) and !empty($baseLink)) {
            // Remove heading slash if present
            $link = ltrim($baseLink, "/");
            $link = Reg::get(ConfigManager::getConfig("RewriteURL")->Objects->rewriteURL)->glink($link);
        } else {
            $link = getCurrentUrl(array_merge(array($pager->getUrlParam()), $excludedGetsArray));
        }
        if (isset($additionalParams) and !empty($additionalParams)) {
            RewriteURL::ensureLastSlash($additionalParams);
            $urlParam = $additionalParams . $pager->getUrlParam();
        } else {
            $urlParam = $pager->getUrlParam();
        }
        $currentPageNumber = $pager->getCurrentPageNumber();
        $pagesCount = $pager->getTotalPagesCount();
        if ($pagesCount > 1) {
            $pageNumStart = $currentPageNumber - floor($visualPagesCount / 2);
            if ($pageNumStart < 1) {
                $pageNumStart = 1;
            }
            $pageNumEnd = $pageNumStart + $visualPagesCount - 1;
            if ($pageNumEnd > $pagesCount) {
                $pageNumEnd = $pagesCount;
                $pageNumStart = $pageNumEnd - $visualPagesCount + 1;
                if ($pageNumStart < 1) {
                    $pageNumStart = 1;
                }
            }
            if ($pageNumStart > 1) {
                $pagerFirstPageLink = $link . $urlParam . ':1';
                $smarty->assign('pagerFirstPageLink', $pagerFirstPageLink);
            }
            if ($pageNumEnd < $pagesCount) {
                $pagerLastPageLink = $link . $urlParam . ':' . $pagesCount;
                $smarty->assign('pagerLastPageLink', $pagerLastPageLink);
            }
            if ($currentPageNumber > 1) {
                $prevPageLink = $link . $urlParam . ':' . ($currentPageNumber - 1);
                $smarty->assign('pagerPreviousPageLink', $prevPageLink);
            }
            $pagerNumbersArray = array();
            for ($pgNum = $pageNumStart; $pgNum <= $pageNumEnd; $pgNum++) {
                $isCurrent = false;
                if ($pgNum == $currentPageNumber) {
                    $isCurrent = true;
                }
                $pageLink = $link . $urlParam . ':' . $pgNum;
                array_push($pagerNumbersArray, array("pageNum" => $pgNum, "pageLink" => $pageLink, "isCurrent" => $isCurrent));
            }
            if ($currentPageNumber < $pagesCount) {
                $nextPageLink = $link . $urlParam . ':' . ($currentPageNumber + 1);
                $smarty->assign('pagerNextPageLink', $nextPageLink);
            }
            if (isset($linkClass) and !empty($linkClass)) {
                $smarty->assign("linkClass", $linkClass);
            }
            $smarty->assign("pagerPageNumStart", $pageNumStart);
            $smarty->assign("pagerPageNumEnd", $pageNumEnd);
            $smarty->assign("pagerCurrentPageNumber", $currentPageNumber);
            $smarty->assign("pagerTotalPagesCount", $pagesCount);
            $smarty->assign("pagerNumbersArray", $pagerNumbersArray);
        }
        if (isset($tplChunkFile)) {
            $pagerChunkFileName = $tplChunkFile;
        } else {
            $pagerChunkFileName = ConfigManager::getConfig("Pager", "Pager")->AuxConfig->pagerChunkFileName;
        }
        return $smarty->fetch($smarty->getChunkPath($pagerChunkFileName));
    }
}
开发者ID:Welvin,项目名称:stingle,代码行数:97,代码来源:function.draw_pager.php


注:本文中的Pager::getPager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。