(description) * @version GIT: $Id$ * @since Version 0.0.1 * @filesource * */ class User extends Admin_Controller { /** * [__construct description] * * @method __construct */ public function __construct() { // To inherit directly the attributes of the parent class. parent::__construct(); $this->load->model('MY_Model'); $this->load->model('user_model'); // $this->load->helper(array('form', 'url')); } public function index() { $this->layout->set('users', "abc"); $this->layout->buffer('main_content', 'User/index'); $this->layout->render('default_layout'); } public function userList() { $user_list = $this->user_model->get_user(user()->business_id); $this->layout->set('tableData', $user_list); $this->layout->buffer('main_content', 'User/user_list'); $this->layout->render('default_layout'); } public function addUser($id='empty') { if($id != 'empty') { $userData = $this->Asset_model->get_asset_by_md5_id($id,user()->business_id); $this->layout->set('assetData', $userData); } $this->layout->buffer('main_content', 'User/add_user'); $this->layout->render('default_layout'); } public function createUser() { $data=$this->input->post(); $data['business_id'] = user()->business_id; $data['created_by'] = user()->id; // $data['role'] = "user"; unset($data['confirm_password']); $data['password'] = hash_password($this->input->post('password')); $table="users"; $create_assets = $this->MY_Model->insert($data,$table); redirect('user/userList'); } public function editUser($id) { $table="asset"; $assetData = $this->user_model->get_asset_by_md5_id($id,user()->business_id); $this->layout->set('editData', $assetData); $this->layout->buffer('main_content', 'User/edit_user'); $this->layout->render('default_layout'); } public function editUsers() { $table="users"; $action = $this->input->post(); $id = $this->input->post('id'); $assetData = $this->MY_Model->edit_option($action, $id, $table); redirect('user/userList'); } public function deleteAsset($id) { $Data = $this->user_model->delete_asset_by_md5_id($id,user()->business_id); redirect('user/userList'); } }