本文整理汇总了PHP中Projects::paginate方法的典型用法代码示例。如果您正苦于以下问题:PHP Projects::paginate方法的具体用法?PHP Projects::paginate怎么用?PHP Projects::paginate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Projects
的用法示例。
在下文中一共展示了Projects::paginate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filterAction
/**
* Filter action
*
* This action is called through ajax on filter change like tags & order
*
* @access public
* @return void
*
* @author Ole Aass <ole.aass@gmx.com>
*/
public function filterAction()
{
if ($this->request->isPost() && $this->request->isAjax()) {
$tags = $this->request->getPost('tags');
$currentPage = $this->request->getPost('page', 'int');
$counter = $this->request->getPost('counter', 'int');
$projects = new Projects();
if (empty($tags)) {
$list = $projects->findAll();
} else {
$tags = array_keys($tags);
$list = $projects->findByTags($tags);
}
$page = $projects->paginate($list, $currentPage, $counter);
$page->counter = $counter;
$this->view->setVar('page', $page);
$this->view->partial('index/projects');
}
}
示例2: paginateByGroup
/**
* Paginate projects by group
*
* @param ProjectGroup $group
* @param integer $page
* @param integer $per_page
* @return array
*/
function paginateByGroup($group, $page = 1, $per_page = 10)
{
return Projects::paginate(array('conditions' => array('group_id = ? AND type = ?', $group->getId(), PROJECT_TYPE_NORMAL), 'order_by' => 'created_on DESC'), $page, $per_page);
}