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


PHP Paginate类代码示例

本文整理汇总了PHP中Paginate的典型用法代码示例。如果您正苦于以下问题:PHP Paginate类的具体用法?PHP Paginate怎么用?PHP Paginate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: index

 public function index()
 {
     //$this->test();
     $user_rec = new Usr_Schm();
     $user_rec->username = $_POST['username'] ? $_POST['username'] : "";
     $user_rec->password = $_POST['password'] ? $_POST['password'] : "";
     $user_rec->alias = $_POST['alias'] ? $_POST['alias'] : "";
     $user_rec->email = $_POST['email'] ? $_POST['email'] : "";
     $usernfo_rec = new Usrnfo_Schm();
     $usernfo_rec->im = $_POST['im'] ? $_POST['im'] : "";
     $usernfo_rec->name = $_POST['name'] ? $_POST['name'] : "";
     $usernfo_rec->url = $_POST['url'] ? $_POST['url'] : "";
     if (strlen($_POST['add'])) {
         $this->add($user_rec);
     }
     if (strlen($_POST['edit'])) {
         $this->edit($_POST['uid'], $user_rec, $usernfo_rec);
     }
     if (Util::isal_num($this->get['delete']) && $this->get['delete'] !== "") {
         $this->delete($this->get['delete']);
         $msg[] = "Record has been deleted with id: {$this->get['delete']}";
     }
     if (isset($this->get['page'])) {
         $offset = ($this->get['page'] - 1) * DISPLAY_NUM;
         if ($this->get['page'] <= 0) {
             $offset = 0;
         }
     } else {
         $offset = 0;
     }
     $records = "";
     foreach ($this->getRecords(DISPLAY_NUM, $offset) as $row) {
         $records .= "<tr>" . "<td>{$row['uid']}</td>" . "<td>{$row['username']}</td>" . "<td>{$row['alias']}</td>" . "<td>{$row['email']}</td>" . "<td>{$row['im']}</td>" . "<td>{$row['name']}</td>" . "<td>{$row['url']}</td>" . "<td><a href=\"/Users/edit/{$row['uid']}\">edit</a></td>" . "<td><a href=\"/Users/delete/{$row['uid']}\">delete</a></td>" . "</tr>\n";
     }
     $rec = null;
     if (Util::isal_num($this->get['edit'])) {
         $rec = $this->getRecord($this->get['edit']);
     }
     $output['content'] = $records;
     $paginate = new Paginate();
     $paginate->filename("/Users")->bond_id("page")->total($this->getRecordCount())->page_num($this->get['page'] - 1)->total_devisor(DISPLAY_NUM)->query_arg_array($this->get)->build();
     $output['paginate'] = array('next' => $paginate->getNext(), 'prev' => $paginate->getPrev(), 'pages' => $paginate->getPages());
     if ($this->get['submit'] == "true") {
         echo "<pre>Submitting\n" . $this->outputText() . "</pre>";
         exit;
     }
     $controller = Util::tpl_content('public/controller', 'users_tpl.php', array('get' => $this->get, 'output' => $output, 'rec' => $rec, 'msg' => $msg));
     $index = Util::tpl_content('public/body', 'index_tpl.php', array('get' => $this->get, 'title' => "Users"));
     echo Util::tpl_body($controller, $index);
     if (SYSDEBUG) {
         echo $this->outputLogHTML();
     }
 }
开发者ID:robertkraig,项目名称:simplecms,代码行数:53,代码来源:class.controllers.Control_Users.php

示例2: action_index

 public function action_index()
 {
     $photosets = ORM::factory('Photoset')->order_by('order', 'ASC');
     $paginate = Paginate::factory($photosets)->paginate(NULL, NULL, 10)->render();
     $photosets = $photosets->find_all();
     //нумерация с 1 для каждого отдельного фотосета
     /*$photo = ORM::factory('Photosets_Attachment')->order_by('photoset_id')->find_all();
       $i =0;
       $photo_id = array();//массив с id фотосетов
       foreach ($photo as $var)
       {
           if (in_array($var->photoset_id,$photo_id))
               continue;
           else
           {
               $photo_id[$i]=$var->photoset_id;
               $i++;
           }
       }
       foreach ($photo_id as $var)
       {
           $cat = ORM::factory('Photosets_Attachment')->where('photoset_id','=',$var)->find_all();
           $i =1;
           foreach ($cat as $val)
           {
               $val->order = $i;
               $val->save();
               $i++;
           }
       }*/
     $this->set('photosets', $photosets);
     $this->set('paginate', $paginate);
 }
开发者ID:HappyKennyD,项目名称:teest,代码行数:33,代码来源:Photosets.php

示例3: action_index

 public function action_index()
 {
     $type = $this->request->param('type');
     $search = Security::xss_clean(Arr::get($_POST, 'search', ''));
     if ($post = $this->request->post()) {
         $title = Security::xss_clean(Arr::get($post, 'title1', ''));
         if ($title != '') {
             $titles = ORM::factory('Specprojecttitle', $type);
             $titles->title = $title;
             $titles->save();
             message::success('Успешно изменено');
             $this->redirect('manage/specprojects/' . $type);
         } else {
             message::error('Поле не может быть пустым.');
             $this->redirect('manage/specprojects/' . $type);
         }
     }
     if (!empty($search)) {
         $this->redirect('manage/specprojects/' . $type . '/search/' . $search);
     }
     $public = ORM::factory('Publication')->join('spec_projects', 'LEFT')->on('publication.id', '=', 'spec_projects.id_publication')->select('publication.*', 'spec_projects.spec_published', 'spec_projects.in_slider', 'spec_projects.in_middle', 'spec_projects.in_bottom')->where('spec_projects.sproject', '=', $type)->order_by('order', 'desc')->order_by('date', 'DESC');
     $paginate = Paginate::factory($public)->paginate(NULL, NULL, 10)->render();
     $public = $public->find_all();
     $title = ORM::factory('Specprojecttitle', $type)->title;
     $this->set('title', $title);
     $this->set('list', $public)->set('type', $type);
     $this->set('paginate', $paginate);
 }
开发者ID:HappyKennyD,项目名称:teest,代码行数:28,代码来源:Specprojects.php

示例4: action_index

 public function action_index()
 {
     header('Access-Control-Allow-Origin: *');
     $category = (int) $this->request->param('id', 0);
     //SEO. закрываем сортировку
     if ($category != 0) {
         $sort = 1;
         Kotwig_View::set_global('sort', $sort);
     }
     //end_SEO
     $categories = ORM::factory('Photosets_Category')->find_all();
     foreach ($categories as $c) {
         $this->data['categories'][] = array('id' => $c->id, 'name' => $c->name);
     }
     $this->data['category'] = $category;
     $photosets = ORM::factory('Photoset')->where('published', '=', 1)->where('show_' . $this->language, '=', 1)->order_by('order', 'asc');
     if ($category != 0) {
         $photosets = $photosets->where('category_id', '=', $category);
     }
     $photosets = $photosets->order_by('order', 'ASC');
     $paginate = Paginate::factory($photosets)->paginate(NULL, NULL, 12)->page_count();
     $photosets = $photosets->find_all();
     if (count($photosets) < 1) {
         $this->data['error'] = 'Error photo';
     }
     $this->data['pagecount'] = $paginate;
     foreach ($photosets as $p) {
         $img = $p->isCover() ? 'http://' . $_SERVER['HTTP_HOST'] . URL::media('images/w300-h225-ccc-si/' . $p->pathCover()) : 'http://' . $_SERVER['HTTP_HOST'] . URL::media('images/w300-h225-ccc-si/media/images/nocover.jpg');
         $this->data['photosets'][] = array('url' => 'http://' . $_SERVER['HTTP_HOST'] . '/' . $this->language . URL::site('api/smartphoto/view/' . $p->id), 'image' => $img, 'name' => $p->name(), 'category' => $p->category->name);
     }
     $this->response->body(json_encode($this->data));
 }
开发者ID:HappyKennyD,项目名称:teest,代码行数:32,代码来源:Smartphoto.php

示例5: action_questions

 public function action_questions()
 {
     $list = ORM::factory('Expert_Question')->where('is_answered', '=', 1);
     $search = Security::xss_clean(Arr::get($_POST, 'search', ''));
     if (!empty($search)) {
         $list->and_where('question', 'LIKE', '%' . $search . '%');
     }
     $list = $list->order_by('date', 'DESC');
     $paginate = Paginate::factory($list)->paginate(NULL, NULL, 10)->render();
     $list = $list->find_all();
     $this->set('search', $search);
     $this->set('list', $list);
     $this->set('paginate', $paginate);
     if ($this->request->method() == Request::POST) {
         if (Auth::instance()->logged_in()) {
             try {
                 $user_id = Auth::instance()->get_user()->id;
                 $question = ORM::factory('Expert_Question');
                 $question->user_id = $user_id;
                 $question->question = Arr::get($_POST, 'question', '');
                 $question->date = date('Y-m-d H:i:s');
                 $question->save();
             } catch (ORM_Validation_Exception $e) {
             }
         } else {
             Message::success(i18n::get('You have to login'));
         }
     }
     $this->add_cumb('Question-answer', '/');
 }
开发者ID:HappyKennyD,项目名称:teest,代码行数:30,代码来源:Expert.php

示例6: action_index

 public function action_index()
 {
     if ($this->request->method() == HTTP_Request::POST) {
         try {
             $post = $this->request->post();
             if ($post['action'] == 'delete') {
                 foreach ($post['messages'] as $message) {
                     $message = ORM::factory('Message')->where('id', '=', $message)->where('receiver_id', '=', $this->user->id)->where('sent', '=', 1)->find();
                     if ($message->loaded()) {
                         $message->delete();
                     }
                 }
                 Hint::success('You have deleted the selected messages');
             }
             $this->redirect(Route::url('message.outbox'));
         } catch (ORM_Validation_Exception $e) {
             Hint::error($e->errors('models'));
         }
     }
     $this->view = new View_Message_Outbox();
     // TODO: Add pagination
     $messages = ORM::factory('Message')->where('receiver_id', '=', $this->user->id)->where('sent', '=', 1)->order_by('created', 'DESC');
     $paginate = Paginate::factory($messages)->execute();
     $this->view->pagination = $paginate->render();
     $this->view->messages = $paginate->result();
     $this->view->outbox = 1;
 }
开发者ID:modulargaming,项目名称:message,代码行数:27,代码来源:Outbox.php

示例7: action_index

 public function action_index()
 {
     header('Access-Control-Allow-Origin: *');
     $search = Security::xss_clean(isset($_GET['search']) ? $_GET['search'] : '');
     if (!empty($search)) {
         $query_b = '%' . $search . '%';
         $this->searchText = Database::instance()->escape($search);
         $query_a = DB::expr(' AGAINST(' . $this->searchText . ') ');
         $list = ORM::factory('Publication')->distinct('true')->where(DB::expr('MATCH(title_' . $this->language . ')'), '', $query_a)->or_where(DB::expr('MATCH(desc_' . $this->language . ')'), '', $query_a)->or_where(DB::expr('MATCH(text_' . $this->language . ')'), '', $query_a)->or_where('title_' . $this->language, 'like', $query_b)->and_where('published', '=', 1)->limit($this->limit)->offset($this->offset)->find_all();
     } else {
         $list = ORM::factory('Publication')->where('title_' . $this->language, '<>', '')->where('published', '=', 1)->order_by('order', 'DESC');
         $this->data['page_count'] = Paginate::factory($list)->paginate(NULL, NULL, 10)->page_count();
         $list = $list->find_all();
     }
     $pub = array();
     $this->data['search'] = $search;
     foreach ($list as $k => $v) {
         $pub['id'] = $v->id;
         $pub['url'] = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $this->language . URL::site('api/smartpublications/view/' . $v->id);
         $pub['title'] = $v->title;
         $pub['desc'] = strip_tags($v->desc);
         $pub['image'] = 'http://' . $_SERVER['HTTP_HOST'] . URL::media('/images/w205-h160/' . $v->picture->file_path);
         $this->data['publications'][] = $pub;
     }
     $this->response->body(json_encode($this->data));
 }
开发者ID:HappyKennyD,项目名称:teest,代码行数:26,代码来源:Smartpublications.php

示例8: action_index

 public function action_index()
 {
     header('Access-Control-Allow-Origin: *');
     $id = $this->request->param('id', 0);
     //SEO. закрываем сортировку
     if ($id != 0) {
         $sort = 1;
         Kotwig_View::set_global('sort', $sort);
     }
     //end_SEO
     $category = ORM::factory('Category', $id);
     $video = ORM::factory('Video')->where('published', '=', 1)->and_where('language', '=', $this->language);
     if ($category->loaded()) {
         $video = $video->and_where_open()->and_where('category_id', '=', $id);
         if ($category->has_children()) {
             $video = $video->or_where('category_id', 'IN', $category->children->as_array('id'));
         }
         $video = $video->and_where_close();
     }
     $video = $video->order_by('date', 'DESC');
     $paginate = Paginate::factory($video)->paginate(NULL, NULL, 12)->page_count();
     $video = $video->find_all();
     $cat = ORM::factory('Category')->fulltree;
     foreach ($cat as $c) {
         $this->data['cat'][] = array('id' => $c->id, 'name' => $c->name, 'level' => $c->lvl, 'url' => 'http://' . $_SERVER['HTTP_HOST'] . '/' . $this->language . URL::site('api/smartvideo/' . $c->id));
     }
     foreach ($video as $v) {
         $this->data['video'][] = array('id' => $v->id, 'link' => $v->link, 'title' => $v->title, 'description' => $v->description, 'preview' => 'http://img.youtube.com/vi/' . $v->link . '/1.jpg', 'url' => 'http://' . $_SERVER['HTTP_HOST'] . '/' . $this->language . URL::site('api/smartvideo/view/' . $v->id), 'category' => $v->category->name);
     }
     $this->data['sel_id'] = $id;
     $this->data['page_count'] = $paginate;
     $this->response->body(json_encode($this->data));
 }
开发者ID:HappyKennyD,项目名称:teest,代码行数:33,代码来源:Smartvideo.php

示例9: action_delete

 public function action_delete()
 {
     $id = (int) $this->request->param('id', 0);
     $expert = ORM::factory('Expert_Opinion', $id);
     if (!$expert->loaded()) {
         $this->redirect('manage/expertopinions');
     }
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         $loger = new Loger('delete', $expert->title);
         $loger->logThis($expert);
         $expert->delete();
         $list = ORM::factory('Expert_Opinion');
         $paginate = Paginate::factory($list);
         $list = $list->find_all();
         $last_page = $paginate->page_count();
         if ($this->page > $last_page) {
             $this->page = $this->page - 1;
         }
         if ($this->page <= 0) {
             $this->page = 1;
         }
         Message::success(i18n::get('The position of the expert removed'));
         $this->redirect('manage/expertopinions/page-' . $this->page);
     } else {
         $this->set('item', $expert)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/expertopinions/page-' . $this->page));
     }
 }
开发者ID:HappyKennyD,项目名称:teest,代码行数:28,代码来源:Expertopinions.php

示例10: action_index

 public function action_index()
 {
     if ($this->request->method() == HTTP_Request::POST) {
         try {
             if ($this->request->post('active')) {
                 $pet = ORM::factory('User_Pet')->where('user_pet.id', '=', $this->request->post('active'))->where('user_id', '=', $this->user->id)->find();
                 $pet->active = time();
                 $pet->save();
                 Hint::success($pet->name . ' is now your active pet.');
             }
             if ($this->request->post('abandon')) {
                 $pet = ORM::factory('User_Pet')->where('user_pet.id', '=', $this->request->post('abandon'))->where('user_id', '=', $this->user->id)->find();
                 $pet->user_id = NULL;
                 $pet->abandoned = time();
                 $pet->save();
                 Hint::success('You have abandoned ' . $pet->name . '.');
             }
             $this->redirect(Route::get('pets')->uri());
         } catch (ORM_Validation_Exception $e) {
             Hint::error($e->errors('models'));
         }
     }
     $this->view = new View_Pet_Index();
     $pets = ORM::factory('User_Pet')->where('user_id', '=', $this->user->id)->order_by('active', 'desc');
     $paginate = Paginate::factory($pets)->execute();
     $this->view->pagination = $paginate->render();
     $this->view->pets = $paginate->result();
     $this->view->pets_count = count($pets);
     $this->view->href = array('create' => Route::url('pet.create'), 'adopt' => Route::url('pet.adopt'));
 }
开发者ID:modulargaming,项目名称:pet,代码行数:30,代码来源:Index.php

示例11: action_index

 public function action_index()
 {
     $list = ORM::factory('Material')->where('is_journal', '=', 1)->where('is_moderator', '=', 0);
     $sort = Security::xss_clean(Arr::get($_GET, 'sort', 'work'));
     switch ($sort) {
         case "work":
             $list->and_where('status', '=', 2);
             $this->set('sort', 'work');
             break;
         case "accept":
             $list->where('status', '=', 1);
             $this->set('sort', 'accept');
             break;
         case "reject":
             $list->and_where('status', '=', 0);
             $this->set('sort', 'reject');
             break;
         default:
             $this->set('sort', 'all');
     }
     $list->order_by('date', 'DESC');
     $paginate = Paginate::factory($list)->paginate(NULL, NULL, 10)->render();
     $list = $list->find_all();
     $this->set('materials', $list);
     $this->set('paginate', $paginate);
 }
开发者ID:HappyKennyD,项目名称:teest,代码行数:26,代码来源:Ehistory.php

示例12: action_index

 public function action_index()
 {
     $comments = ORM::factory('Expert_Comment')->order_by('date', 'desc');
     $paginate = Paginate::factory($comments)->set_view('manage/paginate')->paginate()->render();
     $comments = $comments->find_all();
     $this->set('paginate', $paginate)->set('comments', $comments);
 }
开发者ID:HappyKennyD,项目名称:teest,代码行数:7,代码来源:Expertcomments.php

示例13: action_index

 public function action_index()
 {
     $scorms = ORM::factory('Education')->where('language', '=', $this->language)->order_by('number');
     $paginate = Paginate::factory($scorms)->paginate(null, null, 10)->render();
     $scorms = $scorms->find_all();
     $this->set('education', $scorms);
     $this->set('paginate', $paginate);
 }
开发者ID:HappyKennyD,项目名称:teest,代码行数:8,代码来源:Education.php

示例14: action_index

 public function action_index()
 {
     $thanks = ORM::factory('Thank')->where('published', '=', 1)->order_by('order');
     $paginate = Paginate::factory($thanks)->paginate(NULL, NULL, 10)->render();
     $thanks = $thanks->find_all();
     $this->add_cumb('About project', '/');
     $this->set('thanks', $thanks);
     $this->set('paginate', $paginate);
 }
开发者ID:HappyKennyD,项目名称:teest,代码行数:9,代码来源:Thanks.php

示例15: action_ehistory

 public function action_ehistory()
 {
     $list = ORM::factory('Material')->where('status', '=', 1)->and_where('is_journal', '=', 1);
     $list->order_by('date', 'DESC');
     $paginate = Paginate::factory($list)->paginate(NULL, NULL, 10)->render();
     $list = $list->find_all();
     $this->set('materials', $list);
     $this->set('paginate', $paginate);
 }
开发者ID:HappyKennyD,项目名称:teest,代码行数:9,代码来源:Materials.php


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