Example #1
0
 public function get_all()
 {
     $count = Cache::remember('items_count', function () {
         return Item::count();
     }, 30);
     $page = Input::get('page', 1);
     $num_pages = 10;
     $per_page = 20;
     $extra_pages = 4;
     $start_total = $num_pages * $per_page > $count ? $count : $num_pages * $per_page;
     $total = $page * $per_page < $start_total - $per_page * $extra_pages ? $start_total : (($page + $extra_pages) * $per_page > $count ? $count : ($page + $extra_pages) * $per_page);
     $items_cache = 'items_' . $page . '_' . $per_page;
     $items = Cache::remember($items_cache, function () use($page, $per_page) {
         return Item::take($per_page)->skip(($page - 1) * $per_page)->get();
     }, 30);
     $items = Paginator::make($items, $total, $per_page);
     $this->layout->page_title = "Admin - All items";
     $this->layout->page_content = View::make('admin.items.all')->with('items', $items)->with('page', $page);
 }
Example #2
0
                     setLocation("act.php?getsunduk={$effekt}");
                     if (function_exists("save_debug")) {
                         save_debug();
                     }
                     exit;
                 }
             }
         }
         if (!isset($_GET['id']) or !is_numeric($_GET['id'])) {
             break;
         }
         if (!isset($_GET['count_item']) or $_GET['count_item'] <= 0 or $_GET['count_item'] != (int) $_GET['count_item'] or !is_numeric($_GET['count_item'])) {
             break;
         }
         $Item = new Item((int) $_GET['id']);
         $Item->take($_GET['id'], $_GET['count_item']);
         break;
 }
 if (function_exists("save_debug")) {
     save_debug();
 }
 if (isset($_GET['house'])) {
     if (isset($_GET['option'])) {
         setLocation("lib/hero.php?house&option=" . $option . "");
     } else {
         setLocation("lib/hero.php?house");
     }
 } else {
     if (getFunc($user_id) == 2) {
         setLocation("craft.php?inv");
     } else {