Exemplo n.º 1
0
 function send_mail_process()
 {
     $message_info = '';
     $email_data = $this->session->flashdata('mail_info');
     $keppo_admin_email = $this->m_custom->web_setting_get('keppo_admin_email', 'set_desc');
     $get_status = send_mail_simple($keppo_admin_email, 'Keppo Inquiry : ' . $email_data['subject'], '<br/>Name : ' . $email_data['name'] . '<br/>Email : ' . $email_data['email'] . '<br/>Phone : ' . $email_data['phone'] . '<br/>Message : ' . $email_data['message'], 'keppo_contact_us_send_email_success', 0);
     if ($get_status) {
         $message_info = add_message_info($message_info, 'Thank you! Success send your email inquiry to Keppo admin.');
     } else {
         $message_info = add_message_info($message_info, 'Some error happen, system send email fail, sorry for this, please call us or manually send to ' . $keppo_admin_email);
     }
     $this->session->set_flashdata('message', $message_info);
     redirect('contact_us', 'refresh');
 }
Exemplo n.º 2
0
 function contact_admin_change()
 {
     if (!check_correct_login_type($this->main_group_id)) {
         redirect('/', 'refresh');
     }
     $message_info = '';
     $login_id = $this->ion_auth->user()->row()->id;
     if (isset($_POST) && !empty($_POST)) {
         $can_redirect_to = 0;
         $msg_content = $this->input->post('msg_content');
         $bank_list_id = $this->input->post('bank_list_id');
         $msg_desc = $this->input->post('msg_desc');
         $msg_remark = $this->input->post('msg_remark');
         // validate form input
         $this->form_validation->set_rules('msg_content', 'Account Holder Name', 'required');
         $this->form_validation->set_rules('bank_list_id', 'Bank Name', 'callback_check_bank_list_id');
         $this->form_validation->set_rules('msg_desc', 'Bank Account No', 'required');
         $this->form_validation->set_rules('msg_remark', 'Extra Info');
         if ($this->input->post('button_action') == "save") {
             if ($this->form_validation->run() === TRUE) {
                 $this->m_custom->user_message_insert_withdraw_request($msg_content, $msg_desc, $msg_remark, $bank_list_id);
                 $message_info = add_message_info($message_info, 'Withdraw request send.');
                 $can_redirect_to = 2;
             }
         }
         if ($this->input->post('button_action') == "back") {
             $can_redirect_to = 2;
         }
         direct_go:
         if ($message_info != NULL) {
             $this->session->set_flashdata('message', $message_info);
         }
         if ($can_redirect_to == 1) {
             redirect(uri_string(), 'refresh');
         } elseif ($can_redirect_to == 2) {
             redirect('user/contact_admin', 'refresh');
         }
     }
     // 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'));
     $previous_bank_list_selected = $this->m_user->get_last_user_bank_info($login_id);
     $this->data['msg_content'] = array('name' => 'msg_content', 'id' => 'msg_content', 'value' => $previous_bank_list_selected == NULL ? $this->form_validation->set_value('msg_content') : $previous_bank_list_selected['msg_content']);
     $this->data['bank_list'] = $this->m_custom->get_dynamic_option_array('bank_name');
     $this->data['bank_list_id'] = array('name' => 'bank_list_id', 'id' => 'bank_list_id');
     $this->data['bank_list_selected'] = $previous_bank_list_selected == NULL ? $this->form_validation->set_value('bank_list_id') : $previous_bank_list_selected['msg_bank_id'];
     $this->data['msg_desc'] = array('name' => 'msg_desc', 'id' => 'msg_desc', 'value' => $previous_bank_list_selected == NULL ? $this->form_validation->set_value('msg_desc') : $previous_bank_list_selected['msg_desc']);
     $minimum_withdraw = $this->config->item('minimum_withdraw_amount');
     $this->data['msg_remark'] = array('name' => 'msg_remark', 'id' => 'msg_remark', 'value' => $this->form_validation->set_value('msg_remark', 'I want to withdraw RM' . $minimum_withdraw . '.'));
     $this->data['page_path_name'] = 'user/contact_admin_change';
     $this->load->view('template/index', $this->data);
 }
Exemplo n.º 3
0
 function upload_hotdeal()
 {
     if (!check_correct_login_type($this->main_group_id) && !check_correct_login_type($this->group_id_supervisor)) {
         redirect('/', 'refresh');
     }
     $message_info = '';
     $merchant_id = $this->ion_auth->user()->row()->id;
     $do_by_type = $this->main_group_id;
     $do_by_id = $merchant_id;
     //merchant or supervisor also can use this assign because this is depend on login
     //if is login by supervisor then need change some setting
     if (check_correct_login_type($this->group_id_supervisor)) {
         $merchant_id = $this->ion_auth->user()->row()->su_merchant_id;
         $do_by_type = $this->group_id_supervisor;
     }
     $merchant_data = $this->m_custom->get_one_table_record('users', 'id', $merchant_id);
     $hotdeal_per_day = $this->m_custom->web_setting_get('merchant_max_hotdeal_per_day');
     $search_date = NULL;
     //$search_date = '31-08-2015';
     //$search_date = toggle_date_format($search_date);
     //If more then 5 active hotdeal for today uploaded already, auto increase 1 more upload box
     $box_number_update = $this->box_number;
     $hotdeal_today_count = $this->m_merchant->get_merchant_today_hotdeal($merchant_id, 1, $search_date);
     if ($hotdeal_today_count >= $box_number_update) {
         $box_number_update = $hotdeal_today_count + 1;
     }
     if (isset($_POST) && !empty($_POST)) {
         if ($this->input->post('button_action') == "upload_hotdeal") {
             $upload_rule = array('upload_path' => $this->album_merchant, '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);
             //To loop hotdeal box dynamic
             for ($i = 0; $i < $box_number_update; $i++) {
                 $hotdeal_today_count_update = $this->m_merchant->get_merchant_today_hotdeal($merchant_id, 1, $search_date, 1);
                 $hotdeal_id = $this->input->post('hotdeal_id-' . $i);
                 $hotdeal_file = "hotdeal-file-" . $i;
                 //$sub_category_id = $this->input->post('category-' . $i);
                 $sub_category_id = $merchant_data->me_sub_category_id;
                 //merchant cannot change sub category anymore
                 $title = $this->input->post('title-' . $i);
                 $description = $this->input->post('desc-' . $i);
                 $hotdeal_hour = check_is_positive_numeric($this->input->post('hour-' . $i));
                 $hotdeal_hour = $hotdeal_hour * 24;
                 $original_price = check_is_positive_decimal($this->input->post('original_price-' . $i));
                 $hotdeal_price_before = check_is_positive_decimal($this->input->post('price_before-' . $i));
                 $hotdeal_price_after = check_is_positive_decimal($this->input->post('price_after-' . $i));
                 $price_before_show = $this->input->post('price_before_show-' . $i) == null ? 0 : 1;
                 $price_after_show = $this->input->post('price_after_show-' . $i) == null ? 0 : 1;
                 if ($hotdeal_hour > 1440) {
                     $message_info = add_message_info($message_info, 'Food & Beverage please put in a valid hour between 0 to 60(Max 2 months only).', $title);
                     $hotdeal_hour = 0;
                 }
                 //To check is this an old food & beverage or new food & beverage, if new food & beverage is 0
                 if ($hotdeal_id == 0) {
                     if ($hotdeal_today_count_update >= $hotdeal_per_day) {
                         $message_info = add_message_info($message_info, 'Already reach max ' . $hotdeal_per_day . ' food & beverage per day.');
                         //redirect('merchant/upload_hotdeal', 'refresh');
                         goto direct_go;
                     }
                     //For Multiple Image Upload
                     $have_hidden_image = 0;
                     $post_hidden_image = $this->input->post('hideimage-' . $i);
                     if (!empty($post_hidden_image)) {
                         $have_hidden_image = 1;
                         goto HiddenImageSkip;
                     }
                     //To check new food & beverage is it got image upload or not
                     if (!empty($_FILES[$hotdeal_file]['name'])) {
                         if (!$this->upload->do_upload($hotdeal_file)) {
                             //$error = array('error' => $this->upload->display_errors());
                             $message_info = add_message_info($message_info, $this->upload->display_errors(), $title);
                         } else {
                             HiddenImageSkip:
                             $image_file_name = '';
                             if ($have_hidden_image == 0) {
                                 $image_data = array('upload_data' => $this->upload->data());
                                 $image_file_name = $image_data['upload_data']['file_name'];
                             } else {
                                 $from_path = $this->temp_folder_cut . $post_hidden_image;
                                 $to_path = $this->album_merchant . $post_hidden_image;
                                 if (file_exists($from_path)) {
                                     rename($from_path, $to_path);
                                 }
                                 $image_file_name = $post_hidden_image;
                             }
                             resize_image($this->album_merchant . $image_file_name);
                             $data = array('advertise_type' => 'hot', 'merchant_id' => $merchant_id, 'sub_category_id' => $sub_category_id, 'title' => $title, 'description' => $description, 'image' => $image_file_name, 'post_hour' => $hotdeal_hour, 'original_price' => $original_price, 'price_before' => $hotdeal_price_before, 'price_after' => $hotdeal_price_after, 'price_before_show' => $price_before_show, 'price_after_show' => $price_after_show, 'start_time' => get_part_of_date('all'), 'end_time' => $hotdeal_hour == 0 ? add_hour_to_date(99999) : add_hour_to_date($hotdeal_hour), 'month_id' => get_part_of_date('month'), 'year' => get_part_of_date('year'));
                             $new_id = $this->m_custom->get_id_after_insert('advertise', $data);
                             if ($new_id) {
                                 $this->m_custom->insert_row_log('advertise', $new_id, $do_by_id, $do_by_type);
                                 if ($do_by_type == $this->group_id_supervisor) {
                                     $this->m_custom->notification_process('advertise', $new_id);
                                 }
                                 $message_info = add_message_info($message_info, 'Food & Beverage success create.', $title);
                             } else {
                                 $message_info = add_message_info($message_info, $this->ion_auth->errors(), $title);
                             }
                         }
                     }
                 } else {
                     $image_data = NULL;
                     $previous_image_name = $this->m_custom->get_one_table_record('advertise', 'advertise_id', $hotdeal_id)->image;
                     //To check old deal got change image or not, if got then upload the new one and delete previous image
                     if (!empty($_FILES[$hotdeal_file]['name'])) {
                         if (!$this->upload->do_upload($hotdeal_file)) {
                             //$error = array('error' => $this->upload->display_errors());
                             $message_info = add_message_info($message_info, $this->upload->display_errors(), $title);
                         } else {
                             $image_data = array('upload_data' => $this->upload->data());
                             if (!IsNullOrEmptyString($previous_image_name)) {
                                 delete_file($this->album_merchant . $previous_image_name);
                             }
                         }
                     }
                     $previous_start_time = $this->m_custom->get_one_table_record('advertise', 'advertise_id', $hotdeal_id)->start_time;
                     //To update previous food & beverage
                     $data = array('sub_category_id' => $sub_category_id, 'title' => $title, 'description' => $description, 'image' => empty($image_data) ? $previous_image_name : $image_data['upload_data']['file_name'], 'post_hour' => $hotdeal_hour, 'original_price' => $original_price, 'price_before' => $hotdeal_price_before, 'price_after' => $hotdeal_price_after, 'price_before_show' => $price_before_show, 'price_after_show' => $price_after_show, 'end_time' => $hotdeal_hour == 0 ? add_hour_to_date(99999, $previous_start_time) : add_hour_to_date($hotdeal_hour, $previous_start_time));
                     $hotdeal_hide = $this->input->post('hotdeal_hide-' . $i);
                     if ($hotdeal_hide == null) {
                         if ($this->m_custom->simple_update('advertise', $data, 'advertise_id', $hotdeal_id)) {
                             $this->m_custom->update_row_log('advertise', $hotdeal_id, $do_by_id, $do_by_type);
                             $message_info = add_message_info($message_info, 'Food & Beverage success update.', $title);
                         } else {
                             $message_info = add_message_info($message_info, $this->ion_auth->errors(), $title);
                         }
                     } else {
                         //If this food & beverage is being remove by tick the remove check box
                         $data = array('hide_flag' => 1);
                         if ($this->m_custom->simple_update('advertise', $data, 'advertise_id', $hotdeal_id)) {
                             $this->m_custom->remove_row_log('advertise', $hotdeal_id, $do_by_id, $do_by_type);
                             $this->m_merchant->hotdeal_hide($hotdeal_id);
                             $message_info = add_message_info($message_info, 'Food & Beverage success remove.', $title);
                         } else {
                             $message_info = add_message_info($message_info, $this->ion_auth->errors(), $title);
                         }
                     }
                 }
             }
             direct_go:
             $this->session->set_flashdata('message', $message_info);
             $this->m_custom->remove_image_temp();
             //redirect('merchant/upload_hotdeal', 'refresh');
             redirect('all/merchant_dashboard/' . $this->session->userdata('company_slug') . '//' . $merchant_id, 'refresh');
         }
     }
     //To get today food & beverage result row
     $hotdeal_today_result = $this->m_merchant->get_merchant_today_hotdeal($merchant_id, 0, $search_date);
     $this->data['hotdeal_today_count'] = $this->m_merchant->get_merchant_today_hotdeal($merchant_id, 1, $search_date, 1);
     $this->data['hotdeal_today_count_removed'] = $this->m_merchant->get_merchant_today_hotdeal_removed($merchant_id, $search_date);
     //$this->data['hour_list'] = generate_number_option(1, 24);
     $this->data['sub_category_list'] = $this->m_custom->getSubCategoryList(NULL, NULL, $merchant_data->me_category_id);
     //To dynamic create the food & beverage box
     for ($i = 0; $i < $box_number_update; $i++) {
         $hotdeal_title = 'hotdeal_title' . $i;
         $this->data[$hotdeal_title] = array('name' => 'title-' . $i, 'id' => 'title-' . $i, 'value' => empty($hotdeal_today_result[$i]) ? '' : $hotdeal_today_result[$i]['title'], 'maxlength' => '20');
         $hotdeal_image = 'hotdeal_image' . $i;
         $this->data[$hotdeal_image] = empty($hotdeal_today_result[$i]) ? $this->config->item('empty_image') : $this->album_merchant . $hotdeal_today_result[$i]['image'];
         $hotdeal_category = 'hotdeal_category' . $i;
         $this->data[$hotdeal_category] = array('name' => 'category-' . $i, 'id' => 'category-' . $i);
         $hotdeal_category_selected = 'hotdeal_category_selected' . $i;
         $this->data[$hotdeal_category_selected] = empty($hotdeal_today_result[$i]) ? $merchant_data->me_sub_category_id : $hotdeal_today_result[$i]['sub_category_id'];
         //$default_desc = PHP_EOL . PHP_EOL . PHP_EOL . '<b>Original Price RM</b>';
         $hotdeal_desc = 'hotdeal_desc' . $i;
         $this->data[$hotdeal_desc] = 'desc-' . $i;
         $hotdeal_desc_value = 'hotdeal_desc_value' . $i;
         $this->data[$hotdeal_desc_value] = empty($hotdeal_today_result[$i]) ? '' : $hotdeal_today_result[$i]['description'];
         //            $hotdeal_desc = 'hotdeal_desc' . $i;
         //            $this->data[$hotdeal_desc] = array(
         //                'name' => 'desc-' . $i,
         //                'id' => 'desc-' . $i,
         //                'value' => empty($hotdeal_today_result[$i]) ? '' : $hotdeal_today_result[$i]['description'],
         //            );
         $hotdeal_hour = 'hotdeal_hour' . $i;
         $this->data[$hotdeal_hour] = array('name' => 'hour-' . $i, 'id' => 'hour-' . $i, 'value' => empty($hotdeal_today_result[$i]) ? '' : $hotdeal_today_result[$i]['post_hour'] / 24, 'onkeypress' => 'return isNumber(event)');
         //$hotdeal_hour_selected = 'hotdeal_hour_selected' . $i;
         //$this->data[$hotdeal_hour_selected] = empty($hotdeal_today_result[$i]) ? '' : $hotdeal_today_result[$i]['post_hour'];
         $hotdeal_original_price = 'original_price' . $i;
         $this->data[$hotdeal_original_price] = array('name' => 'original_price-' . $i, 'id' => 'original_price-' . $i, 'value' => empty($hotdeal_today_result[$i]) ? '' : $hotdeal_today_result[$i]['original_price'], 'onkeypress' => 'return isNumber(event)');
         $hotdeal_price_before = 'hotdeal_price_before' . $i;
         $this->data[$hotdeal_price_before] = array('name' => 'price_before-' . $i, 'id' => 'price_before-' . $i, 'value' => empty($hotdeal_today_result[$i]) ? '' : $hotdeal_today_result[$i]['price_before'], 'onkeypress' => 'return isNumber(event)');
         $hotdeal_price_after = 'hotdeal_price_after' . $i;
         $this->data[$hotdeal_price_after] = array('name' => 'price_after-' . $i, 'id' => 'price_after-' . $i, 'value' => empty($hotdeal_today_result[$i]) ? '' : $hotdeal_today_result[$i]['price_after'], 'onkeypress' => 'return isNumber(event)');
         $price_before_show = 'price_before_show' . $i;
         $price_before_show_value = empty($hotdeal_today_result[$i]) ? '' : $hotdeal_today_result[$i]['price_before_show'];
         $this->data[$price_before_show] = array('name' => 'price_before_show-' . $i, 'id' => 'price_before_show-' . $i, 'checked' => $price_before_show_value == "1" ? TRUE : FALSE, 'value' => empty($hotdeal_today_result[$i]) ? '99' : $hotdeal_today_result[$i]['advertise_id']);
         $price_after_show = 'price_after_show' . $i;
         $price_after_show_value = empty($hotdeal_today_result[$i]) ? '' : $hotdeal_today_result[$i]['price_after_show'];
         $this->data[$price_after_show] = array('name' => 'price_after_show-' . $i, 'id' => 'price_after_show-' . $i, 'checked' => $price_after_show_value == "1" ? TRUE : FALSE, 'value' => empty($hotdeal_today_result[$i]) ? '99' : $hotdeal_today_result[$i]['advertise_id']);
         $advertise_id = empty($hotdeal_today_result[$i]) ? '0' : $hotdeal_today_result[$i]['advertise_id'];
         $advertise_id_value = 'advertise_id_value' . $i;
         $this->data[$advertise_id_value] = $advertise_id;
         $hotdeal_id = 'hotdeal_id' . $i;
         $this->data[$hotdeal_id] = array('hotdeal_id-' . $i => $advertise_id);
         $hotdeal_hide = 'hotdeal_hide' . $i;
         $this->data[$hotdeal_hide] = array('name' => 'hotdeal_hide-' . $i, 'id' => 'hotdeal_hide-' . $i, 'value' => $advertise_id);
     }
     $this->data['box_number'] = $box_number_update;
     $this->data['hotdeal_per_day'] = $this->m_custom->web_setting_get('merchant_max_hotdeal_per_day');
     $this->data['temp_folder'] = $this->temp_folder;
     $this->data['temp_folder_cut'] = $this->temp_folder_cut;
     $this->data['empty_image'] = $this->config->item('empty_image');
     $this->data['message'] = $this->session->flashdata('message');
     $this->data['page_path_name'] = 'merchant/upload_hotdeal';
     $this->load->view('template/index', $this->data);
 }
Exemplo n.º 4
0
 function manage_trans_config()
 {
     if (!$this->m_admin->check_is_any_admin(76)) {
         redirect('/', 'refresh');
     }
     $message_info = '';
     $login_id = $this->login_id;
     $login_type = $this->login_type;
     $editable_list = $this->m_admin->trans_config_get_all('editable', 1);
     if (isset($_POST) && !empty($_POST)) {
         $can_redirect_to = 0;
         foreach ($editable_list as $row) {
             $conf_type = $row['conf_type'];
             $conf_slug = generate_label_name($row['conf_name']) . $row['trans_conf_id'];
             $post_data = 'post_data' . $row['trans_conf_id'];
             $field_desc = $row['conf_name'] . ' (' . $row['trans_conf_desc'] . ')';
             if ($conf_type == 'can') {
                 $post_list[$post_data] = check_is_positive_numeric($this->input->post($conf_slug));
                 $this->form_validation->set_rules($conf_slug, $field_desc, 'trim|required|integer');
             } else {
                 $post_list[$post_data] = check_is_positive_decimal($this->input->post($conf_slug));
                 $this->form_validation->set_rules($conf_slug, $field_desc, 'trim|required|numeric');
             }
         }
         if ($this->input->post('button_action') == "save") {
             if ($this->form_validation->run() === TRUE) {
                 foreach ($editable_list as $row) {
                     $post_data = 'post_data' . $row['trans_conf_id'];
                     $update_value = format_decimal($post_list[$post_data]);
                     $this->m_admin->trans_config_set($row['trans_conf_id'], $update_value);
                 }
                 $message_info = add_message_info($message_info, 'Transaction Config success update.');
                 $can_redirect_to = 1;
             }
         }
         direct_go:
         if ($message_info != NULL) {
             $this->session->set_flashdata('message', $message_info);
         }
         if ($can_redirect_to == 1) {
             redirect(uri_string(), 'refresh');
         }
     }
     // 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'));
     foreach ($editable_list as $row) {
         $conf_slug = generate_label_name($row['conf_name']) . $row['trans_conf_id'];
         $conf_value = $this->m_admin->trans_config_get($row['trans_conf_id']);
         $this->data[$conf_slug] = array('name' => $conf_slug, 'id' => $conf_slug, 'type' => 'text', 'style' => 'text-align:right;width:50px', 'value' => $this->form_validation->set_value($conf_slug, $conf_value));
     }
     $this->data['editable_list'] = $editable_list;
     $this->data['page_path_name'] = 'admin/manage_trans_config';
     $this->load->view('template/index', $this->data);
 }
Exemplo n.º 5
0
 public function comment_add()
 {
     $message_info = '';
     $current_url = '/';
     if (isset($_POST) && !empty($_POST)) {
         $current_url = $this->input->post('current_url');
         $refer_id = $this->input->post('item_id');
         $refer_type = $this->input->post('item_type');
         $comment = sensitive_word($this->input->post('comment'));
         if (IsNullOrEmptyString($comment)) {
             $message_info = add_message_info($message_info, 'Comment cannot be empty.');
         } else {
             $this->m_custom->activity_comment($refer_id, $refer_type, $comment);
             $message_info = add_message_info($message_info, 'Comment success add.');
         }
         $this->session->set_flashdata('message', $message_info);
     }
     redirect($current_url, 'refresh');
 }