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


PHP Pager::init方法代码示例

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


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

示例1: getPager

 /**
  * {@inheritdoc}
  */
 public function getPager(array $criteria, $page, $limit = 10, array $sort = array())
 {
     $parameters = array();
     $query = $this->getRepository()->createQueryBuilder('t')->select('t');
     if (isset($criteria['enabled'])) {
         $query->andWhere('t.enabled = :enabled');
         $parameters['enabled'] = (bool) $criteria['enabled'];
     }
     $query->setParameters($parameters);
     $pager = new Pager();
     $pager->setMaxPerPage($limit);
     $pager->setQuery(new ProxyQuery($query));
     $pager->setPage($page);
     $pager->init();
     return $pager;
 }
开发者ID:saberyounis,项目名称:Sonata-Project,代码行数:19,代码来源:TagManager.php

示例2: intval

        }
        $type = -1;
        if ($_GET['type'] == '') {
            $type = -1;
        } else {
            $type = intval($_GET['type']);
        }
        if ($type > -1) {
            $cond .= " and type={$type}";
        }
        if (in_array($orderby, array('id', 'posttime', 'hits'))) {
            $orderbystr = $orderby . ' desc';
        }
        $curPage = intval($_GET["page"]);
        $pager = new Pager();
        $pager->init(20, $curPage, "admin.php?inc=article&action=list&k={$keyword}&channelid={$channelid}&orderby={$orderby}&page={page}");
        $rows = $pager->queryRows($db, "articles", $cond, "*", $orderbystr);
        $recstr = _LANG($_AL['all.totalrecords'], array($pager->recordNum));
        echo <<<EOT
\t<div class="div_clear" style="height:10px;"></div>
\t<div class="tips_1">
{$_AL['all.keyword']}: <input class="text_css" type="text" size="20" value="{$keyword}" id="keyword" />
<select id="orderby"><option value="id">{$_AL['all.orderby']}</option><option value="posttime">{$_AL['all.posttime']}</option><option value="hits">{$_AL['all.hits']}</option></select>
<input class="button_css" type="button" value="  {$_AL['all.search']}  " onclick="searcharticle()" />
&nbsp;&nbsp;&nbsp;{$recstr}</div>
\t<table class="table_1" width="100%">
\t\t<tr><td class="td_6"><a class="td_5_1a" href="admin.php?inc=article&action=add&channelid={$channelid}"><img src="images/ico_add.gif" border="0" /> {$_AL['article.add']}</a></td></tr>
\t</table>

EOT;
        echo "<form id=\"articlesform\" onsubmit=\"return false;\">";
开发者ID:rust1989,项目名称:edit,代码行数:31,代码来源:article.php

示例3: trim

//product channel
foreach ($cache_channels as $cache_prochannel) {
    if ($cache_prochannel['systemtype'] == '1') {
        break;
    }
}
$k = trim($_GET['k']);
$curPage = intval($_GET["page"]);
$cid = intval($_GET["cid"]);
$pagerlink = $webcore->genUrl("productlist.php?cid={$cid}&page={page}" . (empty($k) ? "" : "&k={$k}"));
$condition = "langid={$_SYS['langid']}";
$condition .= empty($k) ? "" : " and name like '%{$k}%'";
$condition .= empty($cid) ? "" : " and cid in (select id from {$db->pre}procates where id={$cid} or pid={$cid})";
$orderstr = "ordernum,id desc";
$pager = new Pager();
$pager->init(intval($cache_settings['perpagepro']), $curPage, $pagerlink);
$products = $pager->queryRows($db, "products", $condition, "id,cid,type,hits,posttime,alias,name,price1,picids,picpaths", $orderstr);
foreach ($products as $key => $product) {
    $product['link'] = $webcore->genUrl("product.php?id={$product['id']}");
    $product['name'] = htmlFilter($product['name']);
    $product['price1'] = number_format($product['price1'], 2);
    $protmppic = $webcore->getPics($product['picids'], $product['picpaths'], 0, true, true);
    $product['picpath'] = $protmppic['picpath'];
    $products[$key] = $product;
}
unset($protmppic);
if (!empty($cid)) {
    $procate = $cache_procates[$cid];
    empty($procate) && $webcore->checkViewLang('productlist', $cid);
    $headtitle = empty($procate['seotitle']) ? strip_tags($procate['title']) : strip_tags(str_replace(array("\r", "\n"), array('', ''), $procate['seotitle']));
    $headkeywords = empty($procate['metakeywords']) ? $headtitle : strip_tags(str_replace(array("\r", "\n"), array('', ''), $procate['metakeywords']));
开发者ID:rust1989,项目名称:edit,代码行数:31,代码来源:productlist.php

示例4: intval

        }
        $type = -1;
        if ($_GET['type'] == '') {
            $type = -1;
        } else {
            $type = intval($_GET['type']);
        }
        if ($type > -1) {
            $cond .= " and type={$type}";
        }
        if (in_array($orderby, array('ordernum,id', 'posttime', 'hits', 'price1', 'level'))) {
            $orderbystr = $orderby . ' desc';
        }
        $curPage = intval($_GET["page"]);
        $pager = new Pager();
        $pager->init(15, $curPage, "admin.php?inc=products&action=list&k={$keyword}&cid={$cid}&type={$type}&orderby={$orderby}&page={page}");
        $rows = $pager->queryRows($db, "products", $cond, "*", $orderbystr);
        $recstr = _LANG($_AL['all.totalrecords'], array($pager->recordNum));
        echo <<<EOT
\t<div class="div_clear" style="height:10px;"></div>
\t<div class="tips_1">
<select id="cid"><option value="0">{$_AL['products.choosecate']}</option>{$cache_procates_option}</select>
{$_AL['all.keyword']}: <input class="text_css" type="text" size="20" value="{$keyword}" id="keyword" />
<select id="orderby"><option value="ordernum,id">{$_AL['all.orderby']}</option><option value="posttime">{$_AL['all.posttime']}</option><option value="hits">{$_AL['all.hits']}</option><option value="price1">{$_AL['products.price']}</option><option value="level">{$_AL['products.level']}</option></select>
<select id="type"><option value="-1">{$_AL['all.property']}</option><option value="1">{$_AL['products.types'][1]}</option><option value="2">{$_AL['products.types'][2]}</option></select>
<input class="button_css" type="button" value="  {$_AL['all.search']}  " onclick="searchproducts()" />
&nbsp;&nbsp;&nbsp;{$recstr}</div>
\t<table class="table_1" width="100%">
\t\t<tr><td class="td_6"><a class="td_5_1a" href="admin.php?inc=products&action=add"><img src="images/ico_add.gif" border="0" /> {$_AL['products.add']}</a></td></tr>
\t</table>
开发者ID:rust1989,项目名称:edit,代码行数:30,代码来源:products.php

示例5: exit

    exit($_AL['all.notlogin']);
}
$curPage = intval($_GET["page"]);
$folderid = intval($_GET["folderid"]);
if ($folderid > 0) {
    setCookies("lastfolderid", $folderid);
} else {
    $folderid = intval(getCookies("lastfolderid"));
}
//preview
setCookies("lastfoldertype", 2);
$pagerlink = "files.php?page={page}&folderid={$folderid}";
$condition = "folderid={$folderid}";
$orderstr = "id desc";
$pager = new Pager();
$pager->init(10, $curPage, $pagerlink);
$attachements = $pager->queryRows($db, "attachments", $condition, "*", $orderstr);
foreach ($attachements as $key => $att) {
    $att['shortfilename'] = htmlFilter(cutStr($att['filename'], 12));
    $att['filename'] = htmlFilter($att['filename']);
    $att['uploadtime'] = getDateStr($att['uploadtime']);
    $attachements[$key] = $att;
}
$folderrow = $cache_folders[$folderid];
$folderrow['title'] = htmlFilter($folderrow['title']);
print <<<EOT
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>IMAGE</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
开发者ID:JackyMamba,项目名称:SimpleEOW,代码行数:31,代码来源:files.php

示例6: array

        echo <<<EOT
\t<table class="settop"><tr><td class="settop_left"><img src="../language/{$cache_langs[$_SYS['alangid']]['directory']}/flag.gif" title="{$effect_lang}" /></td><td><div id="smalltab_container"></div></td></tr></table>
\t<div class="smalltab_line"></div>
\t<div id="t1">
EOT;
        $dwidth = array(0, 35, 200, 300, 100, 150, 60, 80, 150);
        $cond = "langid={$_SYS['alangid']}";
        $keyword = trim($_GET['k']);
        $orderbystr = 'ordernum,id desc';
        $keyword = str_replace("*", "%", $keyword);
        if (!empty($keyword)) {
            $cond .= " and (title like '%{$keyword}%' or  content like '%{$keyword}%')";
        }
        $curPage = intval($_GET["page"]);
        $pager = new Pager();
        $pager->init(15, $curPage, "admin.php?inc=vote&action=list&k={$keyword}&page={page}");
        $rows = $pager->queryRows($db, "votes", $cond, "*", $orderbystr);
        $recstr = _LANG($_AL['all.totalrecords'], array($pager->recordNum));
        echo <<<EOT
\t<div class="div_clear" style="height:10px;"></div>
\t<div class="tips_1">
{$_AL['all.keyword']}: <input class="text_css" type="text" size="20" value="{$keyword}" id="keyword" />
<input class="button_css" type="button" value="  {$_AL['all.search']}  " onclick="searchvotes()" />
&nbsp;&nbsp;&nbsp;{$recstr}</div>
\t<table class="table_1" width="100%">
\t\t<tr><td class="td_6"><a class="td_5_1a" href="admin.php?inc=vote&action=add"><img src="images/ico_add.gif" border="0" /> {$_AL['vote.add']}</a></td></tr>
\t</table>

EOT;
        echo "<form id=\"votesform\" onsubmit=\"return false;\">";
        echo "<table class=\"table_1\" width=\"100%\">";
开发者ID:rust1989,项目名称:edit,代码行数:31,代码来源:vote.php

示例7: array

\t<div class="smalltab_line"></div>
\t<div id="t1">
EOT;
        $dwidth = array(0, 30, 300, 180, 300, 80, 100);
        $cond = "langid={$_SYS['alangid']}";
        $keyword = trim($_GET['k']);
        $state = $_GET['state'];
        $orderby = "id desc";
        $orderbystr = $orderby;
        $keyword = str_replace("*", "%", $keyword);
        !empty($keyword) && ($cond .= " and (name like '%{$keyword}%' or title like '%{$keyword}%' or remark like '%{$keyword}%' or replier like '%{$keyword}%' or reply like '%{$keyword}%')");
        $state == 'y' && ($cond .= " and state=1");
        $state == 'n' && ($cond .= " and state=0");
        $curPage = intval($_GET["page"]);
        $pager = new Pager();
        $pager->init(10, $curPage, "admin.php?inc=msg&action=list&k={$keyword}&state={$state}&page={page}");
        $rows = $pager->queryRows($db, "msgs", $cond, "*", $orderbystr);
        $recstr = _LANG($_AL['all.totalrecords'], array($pager->recordNum));
        echo <<<EOT
\t<div class="div_clear" style="height:10px;"></div>
\t<div class="tips_1">
{$_AL['all.keyword']}: <input class="text_css" type="text" size="20" value="{$keyword}" id="keyword" /> <select id="state"><option value="all">{$_AL['msg.cond0']}</option><option value="y">{$_AL['msg.cond1']}</option><option value="n">{$_AL['msg.cond2']}</option></select> <input class="button_css" type="button" value="  {$_AL['all.search']}  " onclick="searchmsg()" />
&nbsp;&nbsp;&nbsp;{$recstr}</div>
EOT;
        echo "<form id=\"msgsform\" onsubmit=\"return false;\">";
        echo "<table class=\"table_1\" width=\"100%\">";
        echo "<tr style=\"font-weight:bold;color:#333333;\"><td class=\"row_0\">" . "<div class=\"rowdiv_0\" style=\"width:{$dwidth[1]}px;\">{$_AL['all.select']}</div>" . "<div class=\"rowdiv_0\" style=\"width:{$dwidth[2]}px;padding:0px 10px;\">{$_AL['msg.title']}/{$_AL['msg.user']}</div>" . "<div class=\"rowdiv_0\" style=\"width:{$dwidth[3]}px;\">{$_AL['msg.email']}/{$_AL['msg.contact']}/{$_AL['msg.ip']}</div>" . "<div class=\"rowdiv_0\" style=\"width:{$dwidth[4]}px;padding:0px 10px;\">{$_AL['msg.lastreply']}</div>" . "<div class=\"rowdiv_0\" style=\"width:{$dwidth[5]}px;\">&nbsp;{$_AL['msg.verify.state']}</div>" . "<div class=\"rowdiv_0\" style=\"width:{$dwidth[6]}px;\">{$_AL['all.control']}</div>" . "";
        for ($i = 0; $i < count($rows); $i++) {
            $row = $rows[$i];
            $row['posttime'] = $row['posttime'] == 0 ? "——" : getDateStr($row['posttime']);
            $row['replytime'] = $row['replytime'] == 0 ? "——" : getDateStr($row['replytime']);
开发者ID:rust1989,项目名称:edit,代码行数:31,代码来源:msg.php

示例8: array

        echo <<<EOT
\t<table class="settop"><tr><td class="settop_left"><img src="../language/{$cache_langs[$_SYS['alangid']]['directory']}/flag.gif" title="{$effect_lang}" /></td><td><div id="smalltab_container"></div></td></tr></table>
\t<div class="smalltab_line"></div>
\t<div id="t1"></div>
\t<div id="t2">
EOT;
        $dwidth = array(0, 35, 300, 300, 100, 130, 80, 80, 150);
        $cond = "langid={$_SYS['alangid']}";
        $keyword = $_GET['k'];
        $keyword = str_replace("*", "%", $keyword);
        if (!empty($keyword)) {
            $cond .= " and (tkey like '%{$keyword}%' or  tvalue like '%{$keyword}%')";
        }
        $curPage = intval($_GET["page"]);
        $pager = new Pager();
        $pager->init(10, $curPage, "admin.php?inc=template&action=varlist&k={$keyword}&page={page}");
        $rows = $pager->queryRows($db, "templatevars", $cond, "*", "tkey");
        echo <<<EOT
\t<div class="div_clear" style="height:10px;"></div>
\t<div class="tips_1">
{$_AL['all.keyword']}: <input class="text_css" type="text" size="20" value="{$keyword}" id="keyword" />
<input class="button_css" type="button" value="  {$_AL['all.search']}  " onclick="searchvar()" />
</div>
\t<table class="table_1" width="100%">
\t\t<tr><td class="td_6"><a class="td_5_1a" href="admin.php?inc=template&action=addvar"><img src="images/ico_add.gif" border="0" /> {$_AL['template.addvar']}</a></td></tr>
\t</table>

EOT;
        echo "<form id=\"varform\" onsubmit=\"return false;\">";
        echo "<table class=\"table_1\" width=\"100%\">";
        echo "<tr style=\"font-weight:bold;color:#333333;\"><td class=\"row_0\">" . "<div class=\"rowdiv_0\" style=\"width:{$dwidth[1]}px;\">{$_AL['all.select']}</div>" . "<div class=\"rowdiv_0\" style=\"width:{$dwidth[2]}px;\">{$_AL['template.varname']}</div>" . "<div class=\"rowdiv_0\" style=\"width:{$dwidth[3]}px;\">{$_AL['template.vardesc']}</div>" . "<div class=\"rowdiv_0\" style=\"width:{$dwidth[4]}px;\">{$_AL['all.control']}</div>" . "";
开发者ID:rust1989,项目名称:edit,代码行数:31,代码来源:template.php

示例9: array

\t<div id="smalltab_container"></div>
\t<div class="smalltab_line"></div>
\t<div id="t1">
EOT;
        $dwidth = array(0, 35, 190, 130, 160, 160, 130, 100);
        $membername = $_GET['membername'];
        $cond .= empty($membername) ? "" : "membername like '%{$membername}%'";
        $orderby = $_GET['orderby'];
        $orderby = empty($orderby) ? "id" : $orderby;
        $orderbystr = '';
        if (in_array($orderby, array('id', 'signuptime', 'logintime'))) {
            $orderbystr = $orderby . ' desc';
        }
        $curPage = intval($_GET["page"]);
        $pager = new Pager();
        $pager->init(10, $curPage, "admin.php?inc=member&action=search&membername={$membername}&orderby={$orderby}&page={page}");
        $rows = $pager->queryRows($db, "members", $cond, "*", $orderbystr);
        $recstr = _LANG($_AL['all.totalrecords'], array($pager->recordNum));
        echo <<<EOT
\t<div class="div_clear" style="height:10px;"></div>
\t<div class="tips_1">
\t{$_AL['all.keyword']}: <input class="text_css" type="text" size="20" value="{$membername}" id="membername" /> <select id="orderby"><option value="id">{$_AL['all.orderby']}</option><option value="signuptime">{$_AL['member.signuptime']}</option><option value="logintime">{$_AL['member.lastlogin.time']}</option></select> <input class="button_css" type="button" value="  {$_AL['all.search']}  " onclick="searchmember()" />&nbsp;&nbsp;&nbsp;{$recstr}</div>
EOT;
        echo "<form id=\"membersform\" onsubmit=\"return false;\">";
        echo "<table class=\"table_1\" width=\"100%\">";
        echo "<tr style=\"font-weight:bold;color:#333333;\"><td class=\"row_0\"><div class=\"rowdiv_0\" style=\"width:{$dwidth[1]}px;\"><span class=\"warning\">{$_AL['all.delete']}</span></div><div class=\"rowdiv_0\" style=\"width:{$dwidth[2]}px;\">{$_AL['member.name']}/{$_AL['member.email']}</div><div class=\"rowdiv_0\" style=\"width:{$dwidth[3]}px;\">{$_AL['member.realname']}/{$_AL['member.phone']}</div><div class=\"rowdiv_0\" style=\"width:{$dwidth[4]}px;\">{$_AL['member.qq']}/{$_AL['member.msn']}</div><div class=\"rowdiv_0\" style=\"width:{$dwidth[5]}px;\">{$_AL['member.signuptime']}/{$_AL['member.lastlogin.time']}</div><div class=\"rowdiv_0\" style=\"width:{$dwidth[6]}px;\">{$_AL['member.signupip']}</div><div class=\"rowdiv_0\" style=\"width:{$dwidth[7]}px;\">{$_AL['all.control']}</div></td></tr>";
        for ($i = 0; $i < count($rows); $i++) {
            $row = $rows[$i];
            $row['signuptime'] = getDateStr($row['signuptime']);
            $row['logintime'] = empty($row['logintime']) ? '--' : getDateStr($row['logintime']);
            $row['membername'] = htmlFilter($row['membername']);
开发者ID:rust1989,项目名称:edit,代码行数:31,代码来源:member.php

示例10: array

        /************************************** adduser END ************************************************/
        /************************************** manager/search BEGIN ************************************************/
    /************************************** adduser END ************************************************/
    /************************************** manager/search BEGIN ************************************************/
    case "manager":
        require_once './../inc/pager.php';
        echo <<<EOT
\t<div id="smalltab_container"></div>
\t<div class="smalltab_line"></div>
\t<div id="t1">
EOT;
        $dwidth = array(0, 35, 120, 100, 140, 160, 160, 150);
        $curPage = intval($_GET["page"]);
        $pager = new Pager();
        $cond = "ishidden=0";
        $pager->init(10, $curPage, "admin.php?inc=user&action=search&username={$username}&userid={$userid}&groupid={$groupid}&page={page}");
        $rows = $pager->queryRows($db, "users", $cond, "*", "id desc");
        echo <<<EOT
\t<div class="div_clear" style="height:10px;"></div>
EOT;
        echo "<form id=\"usersform\" onsubmit=\"return false;\">";
        echo "<table class=\"table_1\" width=\"100%\">";
        echo "<tr style=\"font-weight:bold;color:#333333;\"><td class=\"row_0\"><div class=\"rowdiv_0\" style=\"width:{$dwidth[1]}px;\"><span class=\"warning\">{$_AL['all.delete']}</span></div><div class=\"rowdiv_0\" style=\"width:{$dwidth[2]}px;\">{$_AL['user.username']}</div><div class=\"rowdiv_0\" style=\"width:{$dwidth[3]}px;\">{$_AL['user.realname']}</div><div class=\"rowdiv_0\" style=\"width:{$dwidth[4]}px;\">{$_AL['user.lastip']}</div><div class=\"rowdiv_0\" style=\"width:{$dwidth[5]}px;\">{$_AL['user.lastlogin']}</div><div class=\"rowdiv_0\" style=\"width:{$dwidth[6]}px;\">{$_AL['user.addtime']}</div><div class=\"rowdiv_0\" style=\"width:{$dwidth[7]}px;\">{$_AL['all.control']}</div></td></tr>";
        for ($i = 0; $i < count($rows); $i++) {
            $row = $rows[$i];
            $row['lastip'] = empty($row['lastip']) ? '--' : $row['lastip'];
            $row['lasttime'] = empty($row['lasttime']) ? '--' : getDateStr($row['lasttime']);
            $row['addtime'] = empty($row['addtime']) ? '--' : getDateStr($row['addtime']);
            $row['username'] = htmlFilter($row['username']);
            $row['realname'] = htmlFilter($row['realname']);
            $checkboxstr = '';
开发者ID:rust1989,项目名称:edit,代码行数:31,代码来源:user.php

示例11: intval

       $state = -1;
       if ($_GET['state'] == '') {
           $state = -1;
       } else {
           $state = intval($_GET['state']);
       }
       if ($state > -1) {
           $cond .= " and state={$state}";
       }
       if (in_array($orderby, array('id', 'createtime', 'total'))) {
           $orderbystr = $orderby . ' desc';
       }
       $curPage = intval($_GET["page"]);
       $pager = new Pager();
       $countrow = $db->row_select_one("orders", $cond, "count(1) as total");
       $pager->init(10, $curPage, "admin.php?inc=order&action=list&k={$keyword}&state={$state}&orderby={$orderby}&page={page}");
       /*
       $rows = $pager->queryRowsBySQL($db,"
       SELECT * FROM `{$db->pre}orders` OT,
       (SELECT orderid,
       GROUP_CONCAT(proid ORDER BY id DESC SEPARATOR '{$SPRT}') as proids, 
       GROUP_CONCAT(price ORDER BY id DESC SEPARATOR '{$SPRT}') as prices,
       GROUP_CONCAT(proname ORDER BY id DESC SEPARATOR '{$SPRT}') as pronames,
       GROUP_CONCAT(pronum ORDER BY id DESC SEPARATOR '{$SPRT}') as pronums 
       FROM `{$db->pre}orderdetails` WHERE langid={$_SYS['alangid']} GROUP BY orderid) ODT
       WHERE {$cond} AND OT.id=ODT.orderid ORDER BY {$orderbystr}",$countrow['total']);
       $recstr=_LANG($_AL['all.totalrecords'], array($pager->recordNum));
       */
       $rows = $pager->queryRows($db, "orders", "{$cond} AND langid={$_SYS['alangid']}", "*", "{$orderbystr}");
       echo <<<EOT
t<div class="div_clear" style="height:10px;"></div>
开发者ID:rust1989,项目名称:edit,代码行数:31,代码来源:order.php


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