function add_admin() { $user_model = new User_model(); $user_service = new User_service(); $avatar = $this->input->post('profile_pic', TRUE); $user_model->set_title($this->input->post('title', TRUE)); $user_model->set_name($this->input->post('name', TRUE)); if ($avatar == '') { $user_model->set_profile_pic('avatar.png'); } else { $user_model->set_profile_pic($avatar); } $user_model->set_user_name($this->input->post('user_name', TRUE)); $user_model->set_user_type($this->input->post('user_type', TRUE)); $user_model->set_email($this->input->post('email', TRUE)); $user_model->set_address($this->input->post('address', TRUE)); $user_model->set_contact_no_1($this->input->post('contact_no_1', TRUE)); $user_model->set_contact_no_2($this->input->post('contact_no_2', TRUE)); $user_model->set_password(md5($this->input->post('password', TRUE))); $user_model->set_added_by($this->session->userdata('USER_ID')); $user_model->set_added_date(date("Y-m-d H:i:s")); $user_model->set_account_activation_code('code'); $user_model->set_is_online('0'); // $body_type_model->set_updated_date(date("Y-m-d H:i:s")); // $body_type_model->set_updated_by(1); $user_model->set_is_published('1'); $user_model->set_is_deleted('0'); echo $user_service->add_user($user_model); }
function update_user() { $user_model = new User_model(); $user_service = new User_service(); $avatar = $this->input->post('profile_pic', TRUE); if ($avatar == '') { $user_model->set_profile_pic('avatar.png'); } else { $user_model->set_profile_pic($avatar); } $user_model->set_id($this->session->userdata('USER_ID')); $user_model->set_title($this->input->post('title', TRUE)); $user_model->set_name($this->input->post('name', TRUE)); $user_model->set_user_name($this->input->post('user_name', TRUE)); $user_model->set_user_type($this->input->post('user_type', TRUE)); $user_model->set_email($this->input->post('email', TRUE)); $user_model->set_address($this->input->post('address', TRUE)); $user_model->set_contact_no_1($this->input->post('contact_no_1', TRUE)); $user_model->set_contact_no_2($this->input->post('contact_no_2', TRUE)); $user_model->set_password($this->input->post('password', TRUE)); $user_model->set_profile_pic($this->input->post('profile_pic', TRUE)); $user_model->set_updated_by($this->session->userdata('USER_ID')); $user_model->set_updated_date(date("Y-m-d H:i:s")); echo $user_service->update_user($user_model); }