Exemple #1
0
 function analysis_report($search_month = NULL, $search_year = NULL, $search_adv_type = NULL, $search_new_user = NULL)
 {
     $message_info = '';
     if (check_correct_login_type($this->main_group_id)) {
         //$this->data['charts'] = $this->getChart($merchant_id);
         $merchant_id = $this->ion_auth->user()->row()->id;
         $merchant_data = $this->m_custom->getUser($merchant_id);
         if (isset($_POST) && !empty($_POST)) {
             if ($this->input->post('button_action') == "search_history") {
                 $search_month = $this->input->post('the_month');
                 $search_year = $this->input->post('the_year');
                 $search_adv_type = $this->input->post('the_adv_type');
                 $search_new_user = $this->input->post('the_new_user');
             }
         }
         $year_list = generate_number_option(get_part_of_date('year', $merchant_data['created_on'], 1), get_part_of_date('year'));
         $this->data['year_list'] = $year_list;
         $this->data['the_year'] = array('name' => 'the_year', 'id' => 'the_year');
         $selected_year = empty($search_year) ? get_part_of_date('year') : $search_year;
         $this->data['the_year_selected'] = $selected_year;
         $month_list = $this->m_custom->month_group_list();
         $this->data['month_list'] = $month_list;
         $this->data['the_month'] = array('name' => 'the_month', 'id' => 'the_month');
         $selected_month = empty($search_month) ? get_part_of_date('month') : $search_month;
         $this->data['the_month_selected'] = $selected_month;
         $adv_type_list = array('' => 'All Advertise', 'hot' => 'Food & Beverage', 'pro' => 'Promotion');
         $this->data['adv_type_list'] = $adv_type_list;
         $this->data['the_adv_type'] = array('name' => 'the_adv_type', 'id' => 'the_adv_type');
         $this->data['the_adv_type_selected'] = empty($search_adv_type) ? "" : $search_adv_type;
         $new_user_list = array('' => 'All User', '1' => 'New User Only');
         $this->data['new_user_list'] = $new_user_list;
         $this->data['the_new_user'] = array('name' => 'the_new_user', 'id' => 'the_new_user');
         $this->data['the_new_user_selected'] = empty($search_new_user) ? "" : $search_new_user;
         $first_day = displayDate(getFirstLastTime($selected_year, $selected_month));
         $last_day = displayDate(getFirstLastTime($selected_year, $selected_month, 1));
         $this->data['first_day'] = $first_day;
         $this->data['last_day'] = $last_day;
         $this->data['message'] = $this->session->flashdata('message');
         $this->data['page_path_name'] = 'merchant/analysis_report';
         $this->load->view('template/index', $this->data);
     } else {
         redirect('/', 'refresh');
     }
 }
Exemple #2
0
 function profile()
 {
     if (!check_correct_login_type($this->main_group_id)) {
         redirect('/', 'refresh');
     }
     $user_id = $this->ion_auth->user()->row()->id;
     $user = $this->ion_auth->user($user_id)->row();
     $this->m_custom->promo_code_insert_user($user_id);
     $this->m_custom->promo_code_temp_register($user_id);
     if (isset($_POST) && !empty($_POST)) {
         if ($this->input->post('button_action') == "confirm") {
             $this->d_year = $_POST['year'];
             $this->d_month = $_POST['month'];
             $this->d_day = $_POST['day'];
             $_POST['dob'] = $this->d_year . '-' . $this->d_month . '-' . $this->d_day;
         }
     }
     $tables = $this->config->item('tables', 'ion_auth');
     // validate form input
     $this->form_validation->set_rules('first_name', $this->lang->line('create_user_fname_label'), 'required');
     $this->form_validation->set_rules('last_name', $this->lang->line('create_user_validation_lname_label'));
     $this->form_validation->set_rules('description', $this->lang->line('create_user_validation_description_label'));
     //$this->form_validation->set_rules('phone', $this->lang->line('create_user_phone_label'), 'required|valid_contact_number');
     $this->form_validation->set_rules('phone', $this->lang->line('create_user_phone_label'), 'required');
     $this->form_validation->set_rules('dob', $this->lang->line('create_user_dob_label'), 'callback_date_check');
     $this->form_validation->set_rules('username', $this->lang->line('create_user_validation_username_label'), 'trim|required|is_unique_edit[' . $tables['users'] . '.username.' . $user_id . ']');
     $this->form_validation->set_rules('email', $this->lang->line('create_user_validation_email_label'), 'trim|required|valid_email|is_unique_edit[' . $tables['users'] . '.email.' . $user_id . ']');
     $this->form_validation->set_rules('race_other', $this->lang->line('create_user_race_other_label'));
     $this->form_validation->set_rules('instagram_url', $this->lang->line('create_user_validation_instagram_label'));
     $this->form_validation->set_rules('facebook_url', $this->lang->line('create_user_validation_facebook_label'));
     $this->form_validation->set_rules('blog_url', $this->lang->line('create_user_validation_blogger_url_label'));
     $this->form_validation->set_rules('photography_url', $this->lang->line('create_user_validation_photography_url_label'));
     if (isset($_POST) && !empty($_POST)) {
         $upload_rule = array('upload_path' => $this->album_user_profile, 'allowed_types' => $this->config->item('allowed_types_image'), 'max_size' => $this->config->item('max_size'), 'max_width' => $this->config->item('max_width'), 'max_height' => $this->config->item('max_height'));
         $this->load->library('upload', $upload_rule);
         if ($this->input->post('button_action') == "confirm") {
             // do we have a valid request?
             //                if ($this->_valid_csrf_nonce() === FALSE || $user_id != $this->input->post('id'))
             //                {
             //                    show_error($this->lang->line('error_csrf'));
             //                }
             if ($this->form_validation->run() === TRUE) {
                 $first_name = $this->input->post('first_name');
                 $last_name = $this->input->post('last_name');
                 $username = strtolower($this->input->post('username'));
                 $email = strtolower($this->input->post('email'));
                 $race_other = $this->input->post('race_other');
                 $is_blogger = $this->input->post('is_blogger');
                 $blog_url = $this->input->post('blog_url');
                 $instagram_url = $this->input->post('instagram_url');
                 $facebook_url = $this->input->post('facebook_url');
                 $is_photographer = $this->input->post('is_photographer');
                 $photography_url = $this->input->post('photography_url');
                 $age = age_count($this->input->post('dob'));
                 $blogger_list_selected = array();
                 $post_blogger_list = $this->input->post('blogger_list');
                 if (!empty($post_blogger_list)) {
                     foreach ($post_blogger_list as $key => $value) {
                         $blogger_list_selected[] = $value;
                     }
                 }
                 $photography_list_selected = array();
                 $post_photography_list = $this->input->post('photography_list');
                 if (!empty($post_photography_list)) {
                     foreach ($post_photography_list as $key => $value) {
                         $photography_list_selected[] = $value;
                     }
                 }
                 $current_profile = $user->profile_image;
                 if (!empty($_FILES['userfile']['name'])) {
                     if (!$this->upload->do_upload()) {
                         $error = array('error' => $this->upload->display_errors());
                         $this->session->set_flashdata('message', $this->upload->display_errors());
                     } else {
                         $current_profile = $this->upload->data('file_name');
                     }
                 }
                 $data = array('first_name' => $first_name, 'last_name' => $last_name, 'description' => $this->input->post('description'), 'phone' => $this->input->post('phone'), 'us_birthday' => $this->input->post('dob'), 'us_age' => $age, 'us_gender_id' => $this->input->post('gender_id'), 'us_race_id' => $this->input->post('race_id'), 'us_race_other' => $race_other, 'username' => $username, 'email' => $email, 'us_is_blogger' => $is_blogger, 'us_blog_url' => $blog_url, 'us_instagram_url' => $instagram_url, 'us_facebook_url' => $facebook_url, 'us_is_photographer' => $is_photographer, 'us_photography_url' => $photography_url, 'profile_image' => $current_profile);
                 // check to see if we are updating the user
                 if ($this->ion_auth->update($user->id, $data)) {
                     // redirect them back to the admin page if admin, or to the base url if non admin
                     $this->m_custom->many_insert_or_remove('blogger', $user_id, $blogger_list_selected);
                     $this->m_custom->many_insert_or_remove('photography', $user_id, $photography_list_selected);
                     $this->session->set_flashdata('message', $this->ion_auth->messages());
                     $user = $this->ion_auth->user($user_id)->row();
                     redirect('all/user_dashboard/' . $user_id, 'refresh');
                 } else {
                     // redirect them back to the admin page if admin, or to the base url if non admin
                     $this->session->set_flashdata('message', $this->ion_auth->errors());
                 }
             }
         }
         if ($this->input->post('button_action') == "change_image") {
             if (!$this->upload->do_upload()) {
                 $error = array('error' => $this->upload->display_errors());
                 $this->session->set_flashdata('message', $this->upload->display_errors());
             } else {
                 $image_data = array('upload_data' => $this->upload->data());
                 //$this->ion_auth->set_message('image_upload_successful');
                 $data = array('profile_image' => $this->upload->data('file_name'));
                 if ($this->ion_auth->update($user_id, $data)) {
                     $this->session->set_flashdata('message', 'User profile image success update.');
                 } else {
                     $this->session->set_flashdata('message', $this->ion_auth->errors());
                 }
             }
             redirect('all/user_dashboard/' . $user_id, 'refresh');
         }
     }
     $this->data['image_path'] = $this->album_user_profile;
     $this->data['image'] = $user->profile_image;
     // display the edit user form
     $this->data['csrf'] = $this->_get_csrf_nonce();
     // set the flash data error message if there is one
     $this->data['message'] = validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message'));
     // pass the user to the view
     $this->data['user'] = $user;
     $this->data['title'] = "Profile";
     $this->data['can_edit'] = 1;
     $this->data['user_id'] = $user_id;
     $the_date = explode('-', $user->us_birthday);
     $this->data['b_year'] = $the_date[0];
     $this->data['b_month'] = $the_date[1];
     $this->data['b_day'] = $the_date[2];
     $this->data['username'] = array('name' => 'username', 'id' => 'username', 'type' => 'text', 'value' => $this->form_validation->set_value('username', $user->username));
     $this->data['first_name'] = array('name' => 'first_name', 'id' => 'first_name', 'type' => 'text', 'value' => $this->form_validation->set_value('first_name', $user->first_name));
     $this->data['last_name'] = array('name' => 'last_name', 'id' => 'last_name', 'type' => 'text', 'value' => $this->form_validation->set_value('last_name', $user->last_name));
     $promo_code = $this->m_custom->promo_code_get('user', $user->id, 1);
     $this->data['promo_code_no'] = array('name' => 'promo_code_no', 'id' => 'promo_code_no', 'type' => 'text', 'readonly' => 'true', 'value' => $promo_code);
     $this->data['promo_code_url'] = $this->m_custom->generate_promo_code_list_link($promo_code, 32);
     $this->data['description'] = array('name' => 'description', 'id' => 'description', 'value' => $this->form_validation->set_value('description', $user->description));
     $this->data['email'] = array('name' => 'email', 'id' => 'email', 'type' => 'text', 'value' => $this->form_validation->set_value('email', $user->email));
     $this->data['day_list'] = generate_number_option(1, 31);
     $this->data['day'] = array('name' => 'day', 'id' => 'day');
     $this->data['month_list'] = $this->ion_auth->get_static_option_list('month');
     $this->data['month'] = array('name' => 'month', 'id' => 'month');
     $this->data['year_list'] = generate_number_option(1930, 2010);
     $this->data['year'] = array('name' => 'year', 'id' => 'year');
     $this->data['age'] = array('name' => 'age', 'id' => 'age', 'type' => 'text', 'readonly' => 'true', 'value' => age_count($user->us_birthday));
     $this->data['gender_list'] = $this->ion_auth->get_static_option_list('gender');
     $this->data['gender_id'] = array('name' => 'gender_id', 'id' => 'gender_id');
     $this->data['us_gender_id'] = $user->us_gender_id;
     $this->data['race_list'] = $this->ion_auth->get_static_option_list('race');
     $this->data['race_id'] = array('name' => 'race_id', 'id' => 'race_id', 'onchange' => 'showraceother()');
     $this->data['us_race_id'] = $user->us_race_id;
     $this->data['race_other'] = array('name' => 'race_other', 'id' => 'race_other', 'type' => 'text', 'style' => $this->m_custom->display_static_option($user->us_race_id) == 'Other' ? 'display:inline' : 'display:none', 'value' => $this->form_validation->set_value('race_other', $user->us_race_other));
     $this->data['race_other_attributes'] = array('id' => 'race_other_label', 'style' => $this->m_custom->display_static_option($user->us_race_id) == 'Other' ? 'display:inline' : 'display:none');
     $this->data['phone'] = array('name' => 'phone', 'id' => 'phone', 'type' => 'text', 'value' => $this->form_validation->set_value('phone', $user->phone), 'class' => 'phone_blur');
     $this->data['instagram_url'] = array('name' => 'instagram_url', 'id' => 'instagram_url', 'type' => 'text', 'value' => $this->form_validation->set_value('instagram_url', $user->us_instagram_url));
     $this->data['facebook_url'] = array('name' => 'facebook_url', 'id' => 'facebook_url', 'type' => 'text', 'value' => $this->form_validation->set_value('facebook_url', $user->us_facebook_url));
     //Blogger Function
     $us_is_blogger = $user->us_is_blogger;
     $this->data['us_is_blogger'] = $us_is_blogger;
     $this->data['is_blogger'] = array('name' => 'is_blogger', 'id' => 'is_blogger', 'checked' => $us_is_blogger == "1" ? TRUE : FALSE, 'onclick' => "checkbox_showhide('is_blogger','profile-blogger-div')", 'value' => $this->form_validation->set_value('is_blogger', $us_is_blogger));
     $this->data['blog_url'] = array('name' => 'blog_url', 'id' => 'blog_url', 'type' => 'text', 'value' => $this->form_validation->set_value('blog_url', $user->us_blog_url));
     $this->data['blogger_list'] = $this->m_custom->get_dynamic_option_array('photography');
     $this->data['blogger_current'] = empty($user) ? array() : $this->m_custom->many_get_childlist('blogger', $user->id);
     //Photographer Function
     $us_is_photographer = $user->us_is_photographer;
     $this->data['us_is_photographer'] = $us_is_photographer;
     $this->data['is_photographer'] = array('name' => 'is_photographer', 'id' => 'is_photographer', 'checked' => $us_is_photographer == "1" ? TRUE : FALSE, 'onclick' => "checkbox_showhide('is_photographer','profile-photographer-div')", 'value' => $this->form_validation->set_value('is_photographer', $us_is_photographer));
     $this->data['photography_url'] = array('name' => 'photography_url', 'id' => 'photography_url', 'type' => 'text', 'value' => $this->form_validation->set_value('photography_url', $user->us_photography_url));
     $this->data['photography_list'] = $this->m_custom->get_dynamic_option_array('photography');
     $this->data['photography_current'] = empty($user) ? array() : $this->m_custom->many_get_childlist('photography', $user->id);
     $this->data['temp_folder'] = $this->temp_folder;
     $this->data['page_path_name'] = 'user/profile';
     $this->load->view('template/index', $this->data);
 }
Exemple #3
0
 function analysis_report_user($search_month = NULL, $search_year = NULL)
 {
     $message_info = '';
     if (!$this->m_admin->check_is_any_admin(63)) {
         redirect('/', 'refresh');
     }
     if (isset($_POST) && !empty($_POST)) {
         if ($this->input->post('button_action') == "search_history") {
             $search_month = $this->input->post('the_month');
             $search_year = $this->input->post('the_year');
         }
     }
     $year_list = generate_number_option(2015, get_part_of_date('year'));
     $this->data['year_list'] = $year_list;
     $this->data['the_year'] = array('name' => 'the_year', 'id' => 'the_year');
     $selected_year = empty($search_year) ? get_part_of_date('year') : $search_year;
     $this->data['the_year_selected'] = $selected_year;
     $month_list = $this->m_custom->month_group_list();
     $this->data['month_list'] = $month_list;
     $this->data['the_month'] = array('name' => 'the_month', 'id' => 'the_month');
     $selected_month = empty($search_month) ? get_part_of_date('month') : $search_month;
     $this->data['the_month_selected'] = $selected_month;
     $first_day = displayDate(getFirstLastTime($selected_year, $selected_month));
     $last_day = displayDate(getFirstLastTime($selected_year, $selected_month, 1));
     $this->data['first_day'] = $first_day;
     $this->data['last_day'] = $last_day;
     $this->data['message'] = $this->session->flashdata('message');
     $this->data['page_path_name'] = 'admin/analysis_report_user';
     $this->load->view('template/index', $this->data);
 }