thought i would post examples.php with employees_management() re-factored to a coding style that reduces repetition:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/* class assumes the following autoloader config settings:
$autoload['libraries'] = array('database', 'grocery_CRUD');
$autoload['helper'] = array('security', 'url');
*/
class Examples extends CI_Controller {
public function __construct()
{
parent::__construct();
}
public function _example_output($output = null)
{
$this->load->view('example.php',$output);
}
public function employees_management()
{
$this->_example_output(
$this->grocery_crud
->set_table('employees')
->set_relation('officeCode','offices','city')
->display_as('officeCode','Office City')
->set_subject('Employee')
->required_fields('lastName')
->set_field_upload('file_url','assets/uploads/files')
->render()
);
}
