Exemple #1
0
 public function user_detail($user_id)
 {
     $this->session->set_userdata(array('log_MODULE' => 'user_detail', 'log_MID' => ''));
     $user_id = id_decrypt($user_id);
     $show_modal = 0;
     $dataArr = array();
     $dataArr['image_name'] = '';
     $dataArr['first_name'] = '';
     $dataArr['last_name'] = '';
     $dataArr['email'] = '';
     $dataArr['gender'] = '';
     $dataArr['date'] = '';
     $dataArr['month'] = '';
     $dataArr['comment'] = '';
     $dataArr['country_id'] = 0;
     $dataArr['state_id'] = 0;
     $dataArr['country_name'] = '';
     $dataArr['state_name'] = '';
     $users_details = $this->user_m->superadmin_user_details($user_id);
     $this->custom_log->write_log('custom_log', 'user details is ' . print_r($users_details, true));
     if (!empty($users_details)) {
         $birth_date = explode("-", $users_details->birth_date);
         $dataArr['image_name'] = $users_details->image;
         $dataArr['first_name'] = $users_details->first_name;
         $dataArr['last_name'] = $users_details->last_name;
         $dataArr['gender'] = $users_details->gender;
         $dataArr['date'] = $birth_date[2];
         $dataArr['month'] = $birth_date[1];
         $dataArr['comment'] = $users_details->comment;
         $dataArr['block_status'] = $users_details->block_status;
         $dataArr['email'] = $users_details->email;
         $dataArr['country_id'] = $users_details->country_id;
         $dataArr['state_id'] = $users_details->state_id;
         $dataArr['country_name'] = $users_details->country_name;
         $dataArr['state_name'] = $users_details->state_name;
     }
     if ($_POST) {
         $show_modal = 1;
         $this->custom_log->write_log('custom_log', 'Form submit ' . print_r($_POST, true));
         $dataArr['image_name'] = $this->input->post('image_name');
         $dataArr['first_name'] = $this->input->post('first_name');
         $dataArr['last_name'] = $this->input->post('last_name');
         $dataArr['gender'] = $this->input->post('gender');
         $dataArr['date'] = $this->input->post('date');
         $dataArr['month'] = $this->input->post('month');
         $dataArr['comment'] = $this->input->post('comment');
         //$dataArr['country_id']   = $this->input->post('country_id');
         //$dataArr['state_id']     = $this->input->post('state_id');
         $rules = superadmin_update_rules();
         $this->form_validation->set_rules($rules);
         $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
         if ($this->form_validation->run()) {
             $dataArr['birth_date'] = '0000-' . $dataArr['month'] . '-' . $dataArr['date'];
             $this->user_m->superadmin_update_profile($user_id, $dataArr);
             $this->session->set_flashdata('success', $this->lang->line('success_update_user_details'));
             $this->custom_log->write_log('custom_log', $this->lang->line('success_update_user_details'));
             redirect(base_url() . 'superadmin/superadmin_management/user_detail/' . id_encrypt($user_id));
         }
     }
     $this->data['title'] = 'User Detail';
     $this->data['show_modal'] = $show_modal;
     $this->data['user_id'] = $user_id;
     $this->data['imagePath'] = base_url() . 'uploads/superadmin/thumb50/';
     $this->data['imageUploadPath'] = base_url() . 'superadmin/superadmin_management/upload_image/';
     $this->data['dataArr'] = $dataArr;
     $this->superAdminCustomView('superadmin_managements/user_details', $this->data);
 }
Exemple #2
0
 public function update_superadmin_user($employeeId)
 {
     $result = array();
     $result['imageName'] = '';
     $result['firstName'] = '';
     $result['middleName'] = '';
     $result['lastName'] = '';
     $result['email'] = '';
     $result['birthDay'] = '0000-00-00';
     $result['countryId'] = 154;
     $result['stateId'] = '';
     $result['areaId'] = '';
     $user_detail = $this->CI->user_m->admin_user_details($employeeId);
     $addressId = '';
     //echo "<pre>"; print_r($user_detail); exit;
     if (!empty($user_detail)) {
         $result['imageName'] = $user_detail->imageName;
         $result['firstName'] = $user_detail->firstName;
         $result['middleName'] = $user_detail->middle;
         $result['lastName'] = $user_detail->lastName;
         $result['email'] = $user_detail->email;
         $result['birthDay'] = $user_detail->birthDay;
         $result['stateId'] = $user_detail->state;
         $result['areaId'] = $user_detail->area;
         $result['code'] = $user_detail->code;
         $addressId = $user_detail->addressId;
     }
     if ($_POST) {
         $this->CI->custom_log->write_log('custom_log', 'form submit data is ' . print_r($_POST, true));
         $result['imageName'] = $this->CI->input->post('image_name');
         $result['firstName'] = $this->CI->input->post('first_name');
         $result['middleName'] = $this->CI->input->post('middle_name');
         $result['lastName'] = $this->CI->input->post('last_name');
         $result['date'] = $this->CI->input->post('date');
         $result['month'] = $this->CI->input->post('month');
         $result['stateId'] = $this->CI->input->post('stateId');
         $result['areaId'] = $this->CI->input->post('areaId');
         $rules = superadmin_update_rules();
         $this->CI->form_validation->set_rules($rules);
         $this->CI->form_validation->set_error_delimiters('<div class="error">', '</div>');
         if ($this->CI->form_validation->run()) {
             $result['birthDate'] = '0000-' . $result['month'] . '-' . $result['date'];
             $this->CI->user_m->update_superadmin_user($employeeId, $result);
             $addressId = $this->CI->user_m->add_user_address($result);
             $this->CI->custom_log->write_log('custom_log', 'employee address id is ' . $addressId);
             if (!empty($addressId) && $addressId) {
                 $this->CI->user_m->unactive_user_employee_address($employeeId);
                 $employeeAddressId = $this->CI->user_m->add_user_employee_address($employeeId, $addressId);
                 $this->CI->session->set_flashdata('success', $this->CI->lang->line('success_update_user_details'));
                 $this->CI->custom_log->write_log('custom_log', $this->CI->lang->line('success_update_user_details'));
                 redirect(base_url() . 'superadmin/user_management/user_detail/' . id_encrypt($employeeId));
             }
         }
     }
     $result['stateList'] = $this->CI->location_m->nigeria_state_list();
     return $result;
 }