本文整理汇总了PHP中Pagination::set_config方法的典型用法代码示例。如果您正苦于以下问题:PHP Pagination::set_config方法的具体用法?PHP Pagination::set_config怎么用?PHP Pagination::set_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pagination
的用法示例。
在下文中一共展示了Pagination::set_config方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_nextlink_inactive
/**
* last page: next inactive
*
*/
public function test_nextlink_inactive()
{
Pagination::set_config(array('current_page' => 2));
$output = Pagination::next_link('next');
$expected = ' <span class="next-inactive"><a href="#">next »</a> </span>';
$this->assertEquals($expected, $output);
}
示例2: action_log
public function action_log()
{
$config = array('pagination_url' => 'user/' . $this->username, 'total_items' => $this->log_count, 'uri_segment' => 3);
Pagination::set_config($config);
$data['posts'] = Model_Post::find('all', array('where' => array_merge(array(array('user_id', $this->user->id)), $this->status_where), 'order_by' => array(array('serial_dive_no', 'desc')), 'limit' => Pagination::$per_page, 'offset' => Pagination::$offset));
$data['pager'] = Pagination::create_links();
$this->template->content->content = View::forge('user/log', $data, false);
return $this->template;
}
示例3: action_index
public function action_index()
{
$config = array('pagination_url' => 'admin/users/index', 'total_items' => DB::count_records('users'), 'uri_segment' => 4);
Pagination::set_config($config);
$data['posts'] = Model_User::find('all', array('related' => array('profiles'), 'limit' => Pagination::$per_page, 'offset' => Pagination::$offset, 'order_by' => array(array('id', 'desc'))));
$data['pager'] = Pagination::create_links();
$this->template->title = "Users";
$this->template->content = View::forge('admin/users/index', $data, false);
}
示例4: pagedata
public static function pagedata($lines = 10)
{
//配列の初期化
$data = array();
//データ件数の取得
$count = Model_User::count();
//Paginationの環境設定
$config = array('pagination_url' => 'admin/index', 'uri_segment' => 3, 'num_links' => 2, 'per_page' => $lines, 'total_items' => $count);
//Paginationのセット
Pagination::set_config($config);
$pagination = Pagination::forge('mypagination', $config);
//ページデータの取得
$data['users'] = Model_User::find('all', array('limit' => $pagination->per_page, 'offset' => $pagination->offset, 'order_by' => array('created_at' => 'desc')));
return $data;
}
示例5: action_detail
public function action_detail()
{
//\Model\Imp::sendMail();
$bbstype = @$_GET['bbstype'] ? $_GET['bbstype'] : 0;
$count = \Model\imp::GetResCount($bbstype);
Pagination::set_config(\Model\Imp::getPaginationConfig($count));
//////##########
$input = \Model\Imp::setDefaultPost($_POST, $_GET, Session::get());
$postid = @$_GET['postid'] ? $_GET['postid'] : false;
$view = View::forge('imp/detail', '', false);
//記事がない場合のテストよろ
$view->set('post1', \Model\Imp::getPost1($bbstype, $postid));
$view->set('postid', $postid);
$view->set('content', \Model\Imp::getRes($input));
$this->template->content = $view;
return $this->template;
}
示例6: action_index
/**
* The basic sales message
*
* @access public
* @return Response
*/
public function action_index($page = 1)
{
/* initialize */
$mongodb = \Mongo_Db::instance();
$data = array();
$where = array();
$pagination_params = array();
$from_time = strtotime("yesterday");
$to_time = strtotime("today - 1sec");
/* get値がない場合、つまり初期アクセス時にはデータの表示はしないで表示 */
if (\Input::get() == array()) {
/* Viewに渡すデータ */
$params = array('data' => array(), 'error' => 'データが見つかりませんでした。', 'config' => array(), 'offset' => 0, 'from_time' => date('Y-m-d H:i:s', $from_time), 'to_time' => date('Y-m-d H:i:s', $to_time));
$this->template->content = View::forge('sales/index', $params);
return;
}
/* データ作成 */
foreach (\Input::get() as $key => $value) {
/* 空の場合は飛ばす */
if (empty($value)) {
continue;
}
/* 各パラメータ作成 */
switch ($key) {
case 'user_id':
case 'client_type':
case 'status':
case 'item_id':
case 'num':
case 'price':
case 'user_id':
$where[$key] = $value;
$pagination_params[$key] = $value;
break;
case 'limit':
$pagination_params[$key] = $value;
break;
case 'from_time':
$pagination_params[$key] = $value;
$from_time = strtotime($value);
break;
case 'to_time':
$pagination_params[$key] = $value;
$to_time = strtotime($value);
break;
default:
break;
}
}
$limit = \Input::get('limit') ? \Input::get('limit') : 20;
$offset = ($page - 1) * $limit;
$count = $mongodb->where($where)->where_lte('timestamp', (string) $to_time)->where_gte('timestamp', (string) $from_time)->count('payment');
/* 件数が多すぎるので件数だけ渡して却下 */
if ($count >= 1000000 || $count == 0) {
$error = $count == 0 ? 'データが見つかりませんでした。' : $count . '件見つかりました。件数が多すぎる為表示することができません。';
/* Viewに渡すデータ */
$params = array('data' => array(), 'error' => $error, 'config' => array(), 'offset' => 0, 'from_time' => date('Y-m-d H:i:s', $from_time), 'to_time' => date('Y-m-d H:i:s', $to_time));
$this->template->content = View::forge('sales/index', $params);
return;
}
$data = $mongodb->where($where)->offset($offset)->limit($limit)->where_lte('timestamp', (string) $to_time)->where_gte('timestamp', (string) $from_time)->get('payment');
/* 時間フォーマットの変更 */
foreach ($data as $key => $value) {
$data[$key]['time'] = date("Y-m-d H:i:s", $value['timestamp']);
}
/* pagination 作成 */
$config = array('pagination_url' => 'sales/index', 'pagination_param' => '?' . http_build_query($pagination_params), 'total_items' => $count, 'per_page' => $limit);
Pagination::set_config($config);
/* Viewに渡すデータ */
$params = array('data' => $data, 'config' => $config, 'offset' => $offset, 'from_time' => date('Y-m-d H:i:s', $from_time), 'to_time' => date('Y-m-d H:i:s', $to_time));
$this->template->content = View::forge('sales/index', $params);
return;
}
示例7: action_error
public function action_error($page = 1)
{
/* initialize */
$mongodb = \Mongo_Db::instance();
$count = $mongodb->count('error');
$limit = \Input::get('limit') ? \Input::get('limit') : 20;
$offset = ($page - 1) * $limit;
$data = $mongodb->offset($offset)->limit($limit)->order_by(array('timestamp' => 'desc'))->get('error');
/* 件数が多すぎるので件数だけ渡して却下 */
if ($count == 0) {
$error = 'データが見つかりませんでした。';
/* Viewに渡すデータ */
$params = array('data' => array(), 'error' => $error, 'config' => array(), 'offset' => 0);
$this->template->content = View::forge('users/error', $params);
return;
}
/* 時間フォーマットの変更 */
foreach ($data as $key => $value) {
$data[$key]['time'] = date("Y-m-d H:i:s", $value['time']->sec);
}
/* pagination 作成 */
$config = array('pagination_url' => 'users/error', 'total_items' => $count, 'per_page' => $limit);
Pagination::set_config($config);
/* Viewに渡すデータ */
$params = array('data' => $data, 'config' => $config, 'offset' => $offset);
$this->template->content = View::forge('users/error', $params);
return;
}