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 update_user_avatar() { $user_service = new User_service(); $user_model = new User_model(); $user_model->set_user_avatar($this->input->post('user_avatar', TRUE)); $user_model->set_user_id($this->input->post('user_id', TRUE)); $result = $user_service->update_user_avatar($user_model); //update session profile pic into new pic $this->session->set_userdata('USER_PROPIC', $this->input->post('user_avatar', TRUE)); echo $result; }