Ejemplo n.º 1
0
 public function action_paginate()
 {
     if (DataTables::is_request()) {
         $orm = ORM::factory('Avatar');
         $paginate = Paginate::factory($orm)->columns(array('id', 'title', 'img', 'default'));
         $datatables = DataTables::factory($paginate)->execute();
         foreach ($datatables->result() as $avatar) {
             $datatables->add_row(array(URL::base() . 'assets/img/avatars/' . $avatar->img, $avatar->title, $avatar->default, $avatar->id));
         }
         $datatables->render($this->response);
     } else {
         throw HTTP_Exception::factory(500, 'error');
     }
 }
Ejemplo n.º 2
0
 public function action_paginate()
 {
     if (!$this->user->can('Admin_Forum_Category_Paginate')) {
         throw HTTP_Exception::factory('403', 'Permission denied to view admin forum category paginate');
     }
     if (DataTables::is_request()) {
         $orm = ORM::factory('Forum_Category');
         $paginate = Paginate::factory($orm)->columns(array('id', 'title', 'locked'));
         $datatables = DataTables::factory($paginate)->execute();
         foreach ($datatables->result() as $category) {
             $datatables->add_row(array($category->title, $category->locked, $category->id));
         }
         $datatables->render($this->response);
     } else {
         throw HTTP_Exception::factory('500', 'Internal server error');
     }
 }
Ejemplo n.º 3
0
 public function action_paginate()
 {
     if (!$this->user->can('Admin_Item_Types_Paginate')) {
         throw HTTP_Exception::factory('403', 'Permission denied to view admin item types paginate');
     }
     if (DataTables::is_request()) {
         $orm = ORM::factory('Item_Type');
         $paginate = Paginate::factory($orm)->columns(array('id', 'name'));
         $datatables = DataTables::factory($paginate)->execute();
         foreach ($datatables->result() as $avatar) {
             $datatables->add_row(array($avatar->name, $avatar->id));
         }
         $datatables->render($this->response);
     } else {
         throw HTTP_Exception::factory(500, 'Internal server error');
     }
 }
Ejemplo n.º 4
0
 public function action_paginate()
 {
     if (!$this->user->can('Admin_User_Role_Paginate')) {
         throw HTTP_Exception::factory('403', 'Permission denied to view admin user role paginate');
     }
     if (DataTables::is_request()) {
         $orm = ORM::factory('Role');
         $paginate = Paginate::factory($orm)->columns(array('id', 'name', 'description'));
         $datatables = DataTables::factory($paginate)->execute();
         foreach ($datatables->result() as $role) {
             $datatables->add_row(array($role->name, $role->description, $role->id));
         }
         $datatables->render($this->response);
     } else {
         throw HTTP_Exception::factory('500', 'Internal server error');
     }
 }
Ejemplo n.º 5
0
 public function action_paginate()
 {
     if (!$this->user->can('Admin_Item_Shops_Paginate')) {
         throw HTTP_Exception::factory('403', 'Permission denied to view admin item shops paginate');
     }
     if (DataTables::is_request()) {
         $orm = ORM::factory('Shop');
         $paginate = Paginate::factory($orm)->columns(array('shop.id', 'title', 'status', 'stock_type'))->search_columns(array('title', 'status', 'stock_type'));
         $datatables = DataTables::factory($paginate)->execute();
         foreach ($datatables->result() as $shop) {
             $datatables->add_row(array($shop->title, $shop->status, $shop->stock_type, $shop->id));
         }
         $datatables->render($this->response);
     } else {
         throw HTTP_Exception::factory(500, 'Internal server error');
     }
 }
Ejemplo n.º 6
0
 public function action_paginate()
 {
     if (!$this->user->can('Admin_User_Log_Paginate')) {
         throw HTTP_Exception::factory('403', 'Permission denied to view admin user log paginate');
     }
     if (DataTables::is_request()) {
         $orm = ORM::factory('Log');
         $paginate = Paginate::factory($orm)->columns(array('id', 'user_id', 'location', 'alias', 'time', 'type'))->search_columns(array('user.username', 'alias', 'location', 'type'));
         $datatables = DataTables::factory($paginate)->execute();
         foreach ($datatables->result() as $log) {
             $datatables->add_row(array($log->type, $log->alias, $log->user->username, $log->location, $log->time, $log->id));
         }
         $datatables->render($this->response);
     } else {
         throw HTTP_Exception::factory(500, 'error');
     }
 }
Ejemplo n.º 7
0
 public function action_paginate()
 {
     if (!$this->user->can('Admin_Item_Recipes_Paginate')) {
         throw HTTP_Exception::factory('403', 'Permission denied to view admin item recipies paginate');
     }
     if (DataTables::is_request()) {
         $orm = ORM::factory('Item_Recipe');
         $paginate = Paginate::factory($orm)->columns(array('id', 'name', 'materials', 'crafted_item_id'))->search_columns(array('item.name'));
         $datatables = DataTables::factory($paginate)->execute();
         foreach ($datatables->result() as $recipe) {
             $datatables->add_row(array($recipe->name, $recipe->materials->count_all(), $recipe->item->img(), $recipe->id));
         }
         $datatables->render($this->response);
     } else {
         throw HTTP_Exception::factory(500, 'Internal server error');
     }
 }
Ejemplo n.º 8
0
 /**
  * Setter/Getter for jquery DataTables support
  *
  * @param  array  $columns  Columns for setting [Optional]
  * @return object DataTables
  */
 public function dataTables(array $columns = NULL)
 {
     if (!empty($columns)) {
         $this->_datatables = DataTables::factory($this)->columns($columns)->execute();
     }
     return $this->_datatables;
 }
Ejemplo n.º 9
0
 public function action_paginate()
 {
     if (!$this->user->can('Admin_Item_Paginate')) {
         throw HTTP_Exception::factory('403', 'Permission denied to view admin item paginate');
     }
     if (DataTables::is_request()) {
         $orm = ORM::factory('Item');
         $paginate = Paginate::factory($orm)->columns(array('item.id', 'item.name', 'image', 'status', 'type.name'))->search_columns(array('item.name', 'status', 'type.name'));
         $datatables = DataTables::factory($paginate)->execute();
         foreach ($datatables->result() as $item) {
             $datatables->add_row(array($item->img(), $item->name, $item->status, $item->type->name, $item->id));
         }
         $datatables->render($this->response);
     } else {
         throw HTTP_Exception::factory(500, 'Internal server error');
     }
 }