function add_new_user()
 {
     $user_model = new User_model();
     $user_service = new User_service();
     $user_model->set_user_id($this->input->post('user_id', TRUE));
     $user_model->set_user_fname($this->input->post('user_fname', TRUE));
     $user_model->set_user_lname($this->input->post('user_lname', TRUE));
     $user_model->set_user_password(md5($this->input->post('user_password', TRUE)));
     $user_model->set_user_email($this->input->post('user_email', TRUE));
     $user_model->set_user_type($this->input->post('user_type', TRUE));
     $user_model->set_user_job($this->input->post('user_job', TRUE));
     $user_model->set_user_bday($this->input->post('user_bday', TRUE));
     $user_model->set_user_contact($this->input->post('user_contact', TRUE));
     $user_model->set_user_avatar('default_cover_pic.png');
     $user_model->set_del_ind('1');
     $user_model->set_added_by($this->session->userdata('USER_CODE'));
     $user_model->set_added_date(date("Y-m-d H:i:s"));
     echo $user_service->add_new_user($user_model);
 }
 function logout()
 {
     $user_login_status_model = new User_model();
     $user_service = new User_service();
     $user_login_status_model->set_is_online('N');
     $user_login_status_model->set_user_id($this->session->userdata('USER_ID'));
     $user_service->update_online_status($user_login_status_model);
     $this->session->sess_destroy();
     redirect(site_url() . '/login/login_controller');
 }
 function update_user_cover_image()
 {
     $user_service = new User_service();
     $user_model = new User_model();
     $user_model->set_user_cover_image($this->input->post('user_cover_image', TRUE));
     $user_model->set_user_id($this->input->post('user_id', TRUE));
     $result = $user_service->update_user_cover_image($user_model);
     //update session profile pic into new pic
     $this->session->set_userdata('USER_COVERPIC', $this->input->post('user_cover_image', TRUE));
     echo $result;
 }