%PDF- %PDF-
Direktori : /home/ugotscom/www/BOS/application/modules/users/models/ |
Current File : /home/ugotscom/www/BOS/application/modules/users/models/Users_model.php |
<?php class Users_model extends CI_Model{ //get all categories method function get_category(){ $result=$this->db->get('categories'); return $result; } function get_branches(){ $result=$this->db->get('branches'); return $result; } function get_source(){ $result=$this->db->get('enquiry_source'); return $result; } function get_location(){ $result=$this->db->get('locations'); return $result; } //generate dataTable serverside method function get_all_product() { $branch_id =$_SESSION['branch_id']; $this->datatables->select('user_id,name,username,password,status'); $this->datatables->from('users'); $this->datatables->where('user_type_id',4); $this->datatables->where('branch_id',$branch_id); $this->datatables->where('status',1); return $this->datatables->generate(); } //insert data method function insert_product(){ $branch_id =$_SESSION['branch_id']; $data=array( 'name' => $this->input->post('name'), 'email' => $this->input->post('email'), 'phone' => $this->input->post('phone'), 'username' => $this->input->post('username'), 'password' => md5($this->input->post('password')), 'status' => $this->input->post('status'), 'added_user' => $this->input->post('added_user'), 'user_type_id' => 4, 'branch_id' => $this->input->post('branch_id') ); $result=$this->db->insert('users', $data); return $result; } //update data method function update_product(){ $user_id=$this->input->post('user_id'); $data=array( 'name' => $this->input->post('name'), 'password' => $this->input->post('password'), 'email' => $this->input->post('email') ); $this->db->where('user_id',$user_id); $result=$this->db->update('users', $data); return $result; } //delete data method function delete_product(){ $user_id=$this->input->post('user_id'); $this->db->where('user_id',$user_id); $result=$this->db->delete('leads'); return $result; } public function get_customer($id) { $this->db->select('*'); $this->db->from('users'); $this->db->where('user_id',$id); $query = $this->db->get(); $row = $query->row_array(); return $row; } }