本文整理汇总了PHP中Pagination::getPageSize方法的典型用法代码示例。如果您正苦于以下问题:PHP Pagination::getPageSize方法的具体用法?PHP Pagination::getPageSize怎么用?PHP Pagination::getPageSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pagination
的用法示例。
在下文中一共展示了Pagination::getPageSize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lists
public function lists()
{
$page = intval(Input::get('page', 1));
$username = trim(Input::get('username', ''));
$args = ['username' => $username];
$model = new AdminModel();
$count = $model->getCount($args);
$rows = $model->getRows($page, $args);
$page_size = Pagination::getPageSize($count);
return View::make('admin.lists', ['rows' => $rows, 'page' => $page, 'page_size' => $page_size, 'params' => $args]);
}
示例2: lists
public function lists()
{
$page = intval(Input::get('page', 1));
$start_time = Input::get('start_time', '');
$expire = Input::get('expire', '');
$args = ['start_time' => $start_time, 'expire' => $expire];
$model = new ActivityModel();
$count = $model->getCount($args);
$rows = $model->getRows($page, $args);
$page_size = Pagination::getPageSize($count);
return View::make('activity.lists', ['rows' => $rows, 'page' => $page, 'page_size' => $page_size, 'params' => $args]);
}
示例3: lists
public function lists()
{
$page = intval(Input::get('page', 1));
$class = intval(Input::get('class', 0));
$sql = "SELECT t.*, ts.source FROM template as t LEFT JOIN template_source as ts ON ts.template_id = t.id WHERE ts.is_front=" . BaseORM::ENABLE;
$sql1 = "SELECT count(*) as total FROM template as t WHERE 1";
if (!empty($class)) {
$sql .= ' AND t.class=' . $class;
$sql1 .= ' AND t.class=' . $class;
}
$count = DB::select(DB::raw($sql1));
$sql .= " ORDER BY t.id DESC LIMIT " . ($page - 1) * BaseORM::TAKE . "," . BaseORM::TAKE;
$rows = DB::select(DB::raw($sql));
$count = $count[0]->total;
$page_size = Pagination::getPageSize($count, BaseORM::TAKE);
//获得所有分类
$classes = TemplateClassORM::all();
array_ch_key('id', $classes);
$format_classes = array_ch_key('id', $classes);
return View::make('template.lists', ['rows' => $rows, 'page' => $page, 'page_size' => $page_size, 'classes' => $format_classes, 'params' => ['class' => $class]]);
}
示例4: lists
public function lists()
{
$page = intval(Input::get('page', 1));
$mobile = trim(Input::get('mobile', ''));
$status = intval(Input::get('status', -1));
$pay_status = intval(Input::get('pay_status', -1));
$user_id = 0;
if (!empty($mobile)) {
$user = UserORM::whereMobile($mobile)->first();
if (!empty($user)) {
$user_id = $user->id;
} else {
Session::flash('error', '用户未找到');
return Redirect::route('orderLists');
}
}
$sql = "SELECT o.*, u.real_name, u.address, u.mobile FROM orders as o LEFT JOIN user as u ON u.id = o.user_id WHERE 1";
$sql1 = "SELECT count(*) as total FROM orders as o WHERE 1";
if (!empty($user_id)) {
$sql .= " AND o.user_id = {$user_id}";
$sql1 .= " AND o.user_id = {$user_id}";
}
if ($status != -1) {
$sql .= " AND o.status = {$status}";
$sql1 .= " AND o.status = {$status}";
}
if ($pay_status != -1) {
$sql .= " AND o.pay_status = {$pay_status}";
$sql1 .= " AND o.pay_status = {$pay_status}";
}
$count = DB::select(DB::raw($sql1));
$sql .= " ORDER BY o.id DESC LIMIT " . ($page - 1) * BaseORM::TAKE . "," . BaseORM::TAKE;
$rows = DB::select(DB::raw($sql));
$count = $count[0]->total;
$page_size = Pagination::getPageSize($count, BaseORM::TAKE);
return View::make('order.lists', ['rows' => $rows, 'page' => $page, 'page_size' => $page_size, 'params' => ['mobile' => $mobile, 'status' => $status, 'pay_status' => $pay_status]]);
}
示例5: lists
public function lists()
{
$page = intval(Input::get('page', 1));
$mobile = trim(Input::get('mobile', ''));
$class = intval(Input::get('class', 0));
$search_user_id = 0;
if (!empty($mobile)) {
$user = UserORM::whereMobile($mobile)->first();
if (empty($user)) {
Session::flash('error', '用户未找到');
return Redirect::route('albumLists');
} else {
$search_user_id = $user->id;
}
}
$sql = "SELECT a.*, u.mobile, u.real_name, u.address FROM album as a LEFT JOIN user as u ON u.id = a.user_id WHERE 1";
$sql1 = "SELECT count(*) as total FROM album as a WHERE 1";
if (!empty($search_user_id)) {
$sql .= " AND a.user_id = {$search_user_id}";
$sql1 .= " AND a.user_id = {$search_user_id}";
}
if (!empty($class)) {
$sql .= " AND a.class = {$class}";
$sql1 .= " AND a.class = {$class}";
}
$count = DB::select(DB::raw($sql1));
$sql .= " ORDER BY a.id DESC LIMIT " . ($page - 1) * BaseORM::TAKE . "," . BaseORM::TAKE;
$rows = DB::select(DB::raw($sql));
$count = $count[0]->total;
$page_size = Pagination::getPageSize($count, BaseORM::TAKE);
//获得所有分类
$classes = TemplateClassORM::all();
array_ch_key('id', $classes);
$format_classes = array_ch_key('id', $classes);
return View::make('album.lists', ['rows' => $rows, 'page' => $page, 'page_size' => $page_size, 'params' => ['mobile' => $mobile, 'class' => $class], 'classes' => $format_classes]);
}
示例6: actionList
/**
* Lists all schemata.
*/
public function actionList()
{
// Create list for sideBar usage
if ($this->request->getParam('sideBar')) {
$schemata = array();
foreach (Schema::model()->findAll() as $schema) {
$schemata[] = $schema->SCHEMA_NAME;
}
$this->sendJSON($schemata);
} else {
$criteria = new CDbCriteria();
// Pagination
$pages = new Pagination(Schema::model()->count($criteria));
$pages->setupPageSize('pageSize', 'schemata');
$pages->applyLimit($criteria);
$pages->route = '#schemata';
// Sort
$sort = new CSort('Schema');
$sort->attributes = array('name' => 'SCHEMA_NAME', 'tableCount' => 'tableCount', 'collation' => 'DEFAULT_COLLATION_NAME');
$sort->defaultOrder = 'SCHEMA_NAME ASC';
$sort->route = '#schemata';
$sort->applyOrder($criteria);
$criteria->group = 'SCHEMA_NAME';
$criteria->select = 'SCHEMA_NAME, DEFAULT_COLLATION_NAME, COUNT(*) AS tableCount';
$schemaList = Schema::model()->with(array('tables' => array('select' => 'COUNT(tables.TABLE_NAME) AS tableCount')))->together()->findAll($criteria);
$this->render('list', array('schemaList' => $schemaList, 'schemaCount' => $pages->getItemCount(), 'schemaCountThisPage' => min($pages->getPageSize(), $pages->getItemCount() - $pages->getCurrentPage() * $pages->getPageSize()), 'pages' => $pages, 'sort' => $sort));
}
}