diff --git a/application/controllers/Customers.php b/application/controllers/Customers.php index 6a5cd13b6..c1d155a76 100644 --- a/application/controllers/Customers.php +++ b/application/controllers/Customers.php @@ -1,5 +1,6 @@ get_controller_name(); - $data['form_width']=$this->get_form_width(); + $data['controller_name'] = $this->get_controller_name(); + $data['form_width'] = $this->get_form_width(); $lines_per_page = $this->Appconfig->get('lines_per_page'); - $customers = $this->Customer->get_all($lines_per_page,$limit_from); - $data['links'] = $this->_initialize_pagination($this->Customer,$lines_per_page,$limit_from); - $data['manage_table']=get_people_manage_table($customers,$this); - $this->load->view('people/manage',$data); + $customers = $this->Customer->get_all($lines_per_page, $limit_from); + $data['links'] = $this->_initialize_pagination($this->Customer, $lines_per_page, $limit_from); + $data['manage_table'] = get_people_manage_table($customers, $this); + $this->load->view('people/manage', $data); } /* - Returns customer table data rows. This will be called with AJAX. + Returns customer table data rows. This will be called with AJAX. */ function search() { @@ -29,7 +30,7 @@ class Customers extends Person_controller $customers = $this->Customer->search($search, $lines_per_page, $limit_from); $total_rows = $this->Customer->get_found_rows($search); $links = $this->_initialize_pagination($this->Customer,$lines_per_page, $limit_from, $total_rows); - $data_rows=get_people_manage_table_data_rows($customers,$this); + $data_rows = get_people_manage_table_data_rows($customers, $this); echo json_encode(array('total_rows' => $total_rows, 'rows' => $data_rows, 'pagination' => $links)); } diff --git a/application/controllers/Employees.php b/application/controllers/Employees.php index 3f0c2f0d2..c228d5a78 100644 --- a/application/controllers/Employees.php +++ b/application/controllers/Employees.php @@ -1,5 +1,6 @@ get_controller_name(); - $data['form_width']=$this->get_form_width(); + $data['controller_name'] = $this->get_controller_name(); + $data['form_width'] = $this->get_form_width(); $lines_per_page = $this->Appconfig->get('lines_per_page'); - $suppliers = $this->Employee->get_all($lines_per_page,$limit_from); - $data['links'] = $this->_initialize_pagination($this->Employee,$lines_per_page,$limit_from); - $data['manage_table']=get_people_manage_table($suppliers,$this); + $suppliers = $this->Employee->get_all($lines_per_page, $limit_from); + $data['links'] = $this->_initialize_pagination($this->Employee, $lines_per_page, $limit_from); + $data['manage_table'] = get_people_manage_table($suppliers, $this); $this->load->view('suppliers/manage',$data); } @@ -29,7 +30,7 @@ class Employees extends Person_controller $employees = $this->Employee->search($search, $limit_from, $lines_per_page); $total_rows = $this->Employee->get_found_rows($search); $links = $this->_initialize_pagination($this->Employee, $lines_per_page, $limit_from, $total_rows); - $data_rows=get_people_manage_table_data_rows($employees,$this); + $data_rows = get_people_manage_table_data_rows($employees, $this); echo json_encode(array('rows' => $data_rows, 'pagination' => $links)); } diff --git a/application/controllers/Giftcards.php b/application/controllers/Giftcards.php index 826d19cb5..bbb0d57ba 100644 --- a/application/controllers/Giftcards.php +++ b/application/controllers/Giftcards.php @@ -20,6 +20,9 @@ class Giftcards extends Secure_area implements iData_controller $this->load->view('giftcards/manage', $data); } + /* + Returns Giftcards table data rows. This will be called with AJAX. + */ function search() { $search = $this->input->post('search'); diff --git a/application/controllers/Item_kits.php b/application/controllers/Item_kits.php index 82cfe2a0c..26bc52112 100644 --- a/application/controllers/Item_kits.php +++ b/application/controllers/Item_kits.php @@ -1,6 +1,7 @@ _remove_duplicate_cookies(); } + /* + Returns Item kits table data rows. This will be called with AJAX. + */ function search() { $search = $this->input->post('search'); diff --git a/application/controllers/Items.php b/application/controllers/Items.php index 0bf69f7ee..d9a35a00f 100644 --- a/application/controllers/Items.php +++ b/application/controllers/Items.php @@ -48,6 +48,9 @@ class Items extends Secure_area implements iData_controller echo json_encode($this->Item->find_item_info($item_number)); } + /* + Returns Items table data rows. This will be called with AJAX. + */ function search() { $search = $this->input->post('search'); diff --git a/application/controllers/Sales.php b/application/controllers/Sales.php index 284502cad..a3a7cd0f8 100644 --- a/application/controllers/Sales.php +++ b/application/controllers/Sales.php @@ -1,5 +1,6 @@ load->vars($data); } - function get_controller_name() { + function get_controller_name() + { return strtolower($this->controller_name); } function _initialize_pagination($object, $lines_per_page, $limit_from = 0, $total_rows = -1, $function='index', $filter='') { $this->load->library('pagination'); + $config['base_url'] = site_url($this->get_controller_name() . "/$function/" . $filter); $config['total_rows'] = $total_rows > -1 ? $total_rows : call_user_func(array($object, 'get_total_rows')); $config['per_page'] = $lines_per_page; @@ -54,11 +55,12 @@ class Secure_area extends CI_Controller $config['cur_page'] = $limit_from > 0 ? $limit_from : 0; $config['page_query_string'] = FALSE; $config['uri_segment'] = 0; + $this->pagination->initialize($config); + return $this->pagination->create_links(); } - - + function _remove_duplicate_cookies () { //php < 5.3 doesn't have header remove so this function will fatal error otherwise diff --git a/application/controllers/Suppliers.php b/application/controllers/Suppliers.php index 291dc245d..3f77ad3bc 100644 --- a/application/controllers/Suppliers.php +++ b/application/controllers/Suppliers.php @@ -1,5 +1,6 @@ get_controller_name(); - $data['form_width']=$this->get_form_width(); + $data['controller_name'] = $this->get_controller_name(); + $data['form_width'] = $this->get_form_width(); $lines_per_page = $this->Appconfig->get('lines_per_page'); $suppliers = $this->Supplier->get_all($lines_per_page); - $data['links'] = $this->_initialize_pagination($this->Supplier,$lines_per_page,$limit_from); - $data['manage_table']=get_supplier_manage_table($suppliers,$this); - $this->load->view('suppliers/manage',$data); + $data['links'] = $this->_initialize_pagination($this->Supplier, $lines_per_page, $limit_from); + $data['manage_table'] = get_supplier_manage_table($suppliers, $this); + $this->load->view('suppliers/manage', $data); } /* - Returns supplier table data rows. This will be called with AJAX. + Returns Supplier table data rows. This will be called with AJAX. */ function search() { @@ -30,7 +31,7 @@ class Suppliers extends Person_controller $suppliers = $this->Supplier->search($search, $lines_per_page, $limit_from); $total_rows = $this->Supplier->get_found_rows($search); $links = $this->_initialize_pagination($this->Supplier, $lines_per_page, $limit_from, $total_rows); - $data_rows=get_supplier_manage_table_data_rows($suppliers,$this); + $data_rows = get_supplier_manage_table_data_rows($suppliers, $this); echo json_encode(array('total_rows' => $total_rows, 'rows' => $data_rows, 'pagination' => $links)); }