コード例 #1
0
ファイル: trip.php プロジェクト: arp19690/newtravel
 public function add_new_step_three($url_key)
 {
     $data = array();
     $user_id = $this->session->userdata["user_id"];
     $model = new Common_model();
     $trip_details = $this->redis_functions->get_trip_details($url_key);
     $post_title = stripslashes($trip_details['post_title']);
     $post_id = $trip_details['post_id'];
     if ($this->input->post() && isset($user_id)) {
         $arr = $this->input->post();
         if (isset($arr['cost_amount']) && !empty($arr['cost_amount'])) {
             $model->deleteData(TABLE_POST_COSTS, array('cost_post_id' => $post_id));
             foreach ($arr['cost_amount'] as $key => $amount) {
                 $post_cost = round($amount, 2);
                 $post_title = addslashes($arr['cost_title'][$key]);
                 $post_currency = addslashes($arr['cost_currency'][$key]);
                 $data_array = array('cost_post_id' => $post_id, 'cost_title' => $post_title, 'cost_title' => $post_title, 'cost_amount' => $post_cost, 'cost_currency' => $post_currency);
                 $model->insertData(TABLE_POST_COSTS, $data_array);
             }
         }
         // setting post details to redis
         $this->redis_functions->set_trip_details($url_key);
         redirect(base_url('trip/post/edit/4/' . $url_key));
     } else {
         $input_arr = array(base_url() => 'Home', base_url('trips') => 'Trips', '#' => $post_title);
         $breadcrumbs = get_breadcrumbs($input_arr);
         $data["breadcrumbs"] = $breadcrumbs;
         $data["post_records"] = $trip_details;
         $data["page_title"] = $post_title;
         $data['meta_title'] = $data["page_title"] . ' - ' . $this->redis_functions->get_site_setting('SITE_NAME');
         $this->template->write_view("content", "pages/trip/post/step-3", $data);
         $this->template->render();
     }
 }