mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-29 03:15:58 -04:00
Added comments to some controller functions and improved spacing to improve readibility of code (#120)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
require_once ("Person_controller.php");
|
||||
|
||||
class Customers extends Person_controller
|
||||
{
|
||||
function __construct()
|
||||
@@ -9,17 +10,17 @@ class Customers extends Person_controller
|
||||
|
||||
function index($limit_from=0)
|
||||
{
|
||||
$data['controller_name']=$this->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));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
require_once ("Person_controller.php");
|
||||
|
||||
class Employees extends Person_controller
|
||||
{
|
||||
function __construct()
|
||||
@@ -9,12 +10,12 @@ class Employees extends Person_controller
|
||||
|
||||
function index($limit_from=0)
|
||||
{
|
||||
$data['controller_name']=$this->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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
require_once ("Secure_area.php");
|
||||
require_once ("interfaces/Idata_controller.php");
|
||||
|
||||
class Item_kits extends Secure_area implements iData_controller
|
||||
{
|
||||
function __construct()
|
||||
@@ -45,6 +46,9 @@ class Item_kits extends Secure_area implements iData_controller
|
||||
$this->_remove_duplicate_cookies();
|
||||
}
|
||||
|
||||
/*
|
||||
Returns Item kits table data rows. This will be called with AJAX.
|
||||
*/
|
||||
function search()
|
||||
{
|
||||
$search = $this->input->post('search');
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
require_once ("Secure_area.php");
|
||||
|
||||
class Sales extends Secure_area
|
||||
{
|
||||
function __construct()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
class Secure_area extends CI_Controller
|
||||
{
|
||||
|
||||
private $controller_name;
|
||||
|
||||
/*
|
||||
@@ -37,13 +36,15 @@ class Secure_area extends CI_Controller
|
||||
$this->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
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
require_once ("Person_controller.php");
|
||||
|
||||
class Suppliers extends Person_controller
|
||||
{
|
||||
function __construct()
|
||||
@@ -9,18 +10,18 @@ class Suppliers extends Person_controller
|
||||
|
||||
function index($limit_from=0)
|
||||
{
|
||||
$data['controller_name']=$this->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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user