Ordog23

Untitled

Jan 12th, 2013
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.56 KB | None | 0 0
  1.  
  2. class Controller_Test extends Controller {
  3.     public function action_list($offset = NULL) {
  4.         $books = new Books();
  5.        print_r($books->get_list($offset));
  6.     }
  7. }
  8.  
  9. ----
  10.  
  11.  public function get_list($start = null) {
  12.         if ($start == NULL) {
  13.             $offset = 0;
  14.         } else {
  15.             $offset = $start * 30;
  16.         }
  17.         $books = array();
  18.         $book = Model_Book::query()->limit(30)->offset($offset)->get();
  19.  
  20.         foreach ($book as $b) {
  21.             \Arr::insert($books, $b, 0);
  22.         }
  23.         return $books;
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment