Ejemplo n.º 1
0
 /**
  * Test pages
  */
 public function test($slug = FALSE, $param1 = FALSE, $param2 = FALSE, $param3 = FALSE)
 {
     if ($slug) {
         $data['title'] = "Test";
         if ($slug == "show_username") {
             $username = $this->flexi_auth->get_user_identity();
             $data['test_str'] = $username ? "Username: "******"Not Logged In";
         } else {
             if ($slug == "show_user_id") {
                 $user_id = $this->flexi_auth->get_user_id();
                 $data['test_str'] = $user_id ? "User id: " . $user_id : "Not Logged In";
             } else {
                 if ($slug == "insert-user") {
                     $user_id = $this->flexi_auth->insert_user("*****@*****.**", FALSE, "password123", FALSE, 3, TRUE);
                     $data['test_str'] = $user_id ? "User id: " . $user_id : "Failed";
                 } else {
                     if ($slug == "log_in") {
                         $user_id = $this->flexi_auth->login("*****@*****.**", "password123", TRUE);
                         $username = $this->flexi_auth->get_user_identity();
                         $data['test_str'] = $username ? "Username: "******"Not Logged In";
                     } else {
                         if ($slug == "log_out") {
                             $user_id = $this->flexi_auth->logout();
                             $username = $this->flexi_auth->get_user_identity();
                             $data['test_str'] = $username ? "Username: "******"Logged Out";
                         } else {
                             if ($slug == "insert-group-admin") {
                                 $group_id = $this->flexi_auth->insert_group("Administrators", "Site Administrators", TRUE);
                                 $data['test_str'] = $group_id ? "Group id: " . $group_id : "Failed";
                             } else {
                                 if ($slug == "insert-group-premium") {
                                     $group_id = $this->flexi_auth->insert_group("PremiumUsers", "Premium Users");
                                     $data['test_str'] = $group_id ? "Group id: " . $group_id : "Failed";
                                 } else {
                                     if ($slug == "insert_group_standard") {
                                         $group_id = $this->flexi_auth->insert_group("StandardUsers", "Standard Users");
                                         $data['test_str'] = $group_id ? "Group id: " . $group_id : "Failed";
                                     } else {
                                         if ($slug == "get_garment_info") {
                                             $result = $this->garment_model->get_garment_info($param1, $this->flexi_auth->get_user_id());
                                             $data['test_str'] = $result;
                                         } else {
                                             if ($slug == "get_batch_garment_info") {
                                                 $result = $this->garment_model->get_batch_garment_info($param1, $param2, $this->flexi_auth->get_user_id());
                                                 $data['test_str'] = $result;
                                             } else {
                                                 if ($slug == "get_category") {
                                                     $result = $this->category_model->get_category($param1);
                                                     $data['test_str'] = $result;
                                                 } else {
                                                     if ($slug == "get_batch_garment_info_by_occasion_name") {
                                                         $result = $this->garment_model->get_batch_garment_info_by_occasion_name(0, 140, FALSE, $param1);
                                                         $data['test_str'] = $result;
                                                     } else {
                                                         if ($slug == "colour_occasion") {
                                                             $data['test_str'] = $this->data;
                                                         } else {
                                                             if ($slug == "get_available_categories") {
                                                                 $result = $this->deep_search_model->get_available_categories();
                                                                 $data['test_str'] = $result;
                                                             } else {
                                                                 if ($slug == "get_initial_field_criteria") {
                                                                     $result = $this->deep_search_model->get_initial_field_criteria($param1);
                                                                     $data['test_str'] = $result;
                                                                 } else {
                                                                     if ($slug == "get_new_field_criteria") {
                                                                         $result = $this->deep_search_model->get_new_field_criteria($param1, $param2, array('3429'), $param3);
                                                                         $data['test_str'] = $result;
                                                                     } else {
                                                                         if ($slug == "judge_field_by_criteria_id") {
                                                                             $result = $this->deep_search_model->judge_field_by_criteria_id("/3434/", "", array('3434', '3447'));
                                                                             $data['test_str'] = $result;
                                                                         } else {
                                                                             if ($slug == "get_batch_garment_info_from_quick_search") {
                                                                                 $result = $this->garment_model->get_batch_garment_info_from_quick_search(0, 140, 99, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
                                                                                 $data['test_str'] = $result;
                                                                             } else {
                                                                                 if ($slug == "get_batch_garment_info_by_favorite") {
                                                                                     $result = $this->garment_model->get_batch_garment_info_by_favorite(0, 140, 99);
                                                                                     $data['test_str'] = $result;
                                                                                 } else {
                                                                                     if ($slug == "encode_url") {
                                                                                         $this->load->helper(array('url_encode'));
                                                                                         $result = base64_encode_url('http://slimages.macys.com/is/image/MCY/products/5/optimized/2356675_fpx.tif?$filterlrg$&wid=370');
                                                                                         $data['test_str'] = $result;
                                                                                     } else {
                                                                                         if ($slug == "insert_garment_image") {
                                                                                             $this->load->helper(array('url_encode'));
                                                                                             $result = $this->garment_model->insert_garment_image(base64_decode_url($param1));
                                                                                             $data['test_str'] = $result;
                                                                                         } else {
                                                                                             if ($slug == "get_initial_field_criteria_for_assessment") {
                                                                                                 $result = $this->deep_search_model->get_initial_field_criteria_for_assessment($param1, $param2);
                                                                                                 $data['test_str'] = $result;
                                                                                             } else {
                                                                                                 if ($slug == "insert_garment_specs") {
                                                                                                     $result = $this->deep_search_model->insert_garment_specs(24994, array(2120, 2126, 2247, 2169, 2252, 2194, 3859, 2138, 2199, 2871, 2202, 2220, 2230));
                                                                                                     $data['test_str'] = $result;
                                                                                                 } else {
                                                                                                     $data['test_str'] = $slug;
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $this->load->view('catalog/test', $data);
     } else {
         show_404();
     }
 }
Ejemplo n.º 2
0
 /**
  * Garment Import Service for this controller.
  */
 public function garment_import()
 {
     $this->load->helper('url_encode');
     $name = $this->input->post('name', TRUE);
     $brand = $this->input->post('brand', TRUE);
     $store = $this->input->post('store', TRUE);
     $price_range = $this->input->post('price_range', TRUE);
     $season = $this->input->post('season', TRUE);
     $category_id = $this->input->post('category', TRUE);
     $occasion_ids = $this->input->post('occasions', TRUE);
     $colour_ids = $this->input->post('colours', TRUE);
     $image_url = $this->input->post('image_url', TRUE);
     $extra_image1_url = $this->input->post('extra_image1_url', TRUE);
     $extra_image2_url = $this->input->post('extra_image2_url', TRUE);
     $image_url = $this->input->post('image_url', TRUE);
     $size_region = $this->input->post('size_region', TRUE);
     $size_sizes = $this->input->post('size_sizes', TRUE);
     $url = prep_url(base64_decode_url($this->input->post('url', TRUE)));
     $description = $this->input->post('description', TRUE);
     $is_standard = FALSE;
     $is_pattern = $this->input->post('pattern', TRUE);
     if ($this->flexi_auth->is_logged_in()) {
         $user_id = $this->flexi_auth->get_user_id();
         $is_standard = $this->flexi_auth->in_group(array('Administrators', 'Uploaders'));
     } else {
         redirect('/', 'refresh');
     }
     //validation
     $errors = TRUE;
     //save image
     $image_path = $this->garment_model->insert_garment_image($image_url);
     //save extra image
     /* $extra_image1_path = NULL;
     		$extra_image2_path = NULL;
     		if (!empty($extra_image1_url)) {
     			$extra_image1_path = $this->garment_model->insert_garment_image($extra_image1_url);
     		}
     		if (!empty($extra_image2_url)) {
     			$extra_image2_path = $this->garment_model->insert_garment_image($extra_image2_url);
     		} */
     //insert garment
     $garment_id = $this->garment_model->insert_garment($user_id, $name, $brand, $store, $url, $image_url, $price_range, $category_id, $image_path, $extra_image1_url, $extra_image2_url, $description, $is_standard, $is_pattern);
     //insert occasions
     $this->occasion_model->insert_garment_occasion($garment_id, $occasion_ids);
     //insert colours
     $this->colour_model->insert_garment_colour($garment_id, $colour_ids);
     //insert dresing_room
     $this->garment_model->insert_garment_dressing_room($garment_id, $user_id);
     //insert sizes
     if (!empty($size_region)) {
         $this->size_model->insert_garment_size($garment_id, $size_region, $size_sizes);
     }
     print $garment_id;
 }