예제 #1
0
<div class="two-colls-right-b">
    <div class="padding">

        <?php 
$this->load->view('pages/trip/listing/list-header-sort-bar');
?>

        <div class="catalog-row">
            <?php 
$redis_functions = new Redisfunctions();
if (!empty($post_records)) {
    foreach ($post_records as $key => $value) {
        $value = (array) $value;
        $post_url_key = $value['post_url_key'];
        $post_details = $redis_functions->get_trip_details($post_url_key);
        $post_title = stripslashes($post_details['post_title']);
        $post_description = getNWordsFromString(stripslashes($post_details['post_description']), 40);
        $post_primary_image = base_url(getImage($post_details['post_primary_image']));
        $post_url = getTripUrl($post_details['post_url_key']);
        $post_total_cost = get_currency_symbol($post_details['post_currency']) . $post_details['post_total_cost'];
        $post_start_end_date_string = '--';
        if (!empty($post_details['post_start_date']) && !empty($post_details['post_end_date'])) {
            $post_date_format = 'd M Y';
            $post_start_end_date_string = date($post_date_format, strtotime($post_details['post_start_date'])) . ' - ' . date($post_date_format, strtotime($post_details['post_end_date']));
        }
        $post_total_days = number_format($post_details['post_total_days']);
        $post_region_cities = array();
        if (!empty($post_details['post_regions'])) {
            foreach ($post_details['post_regions'] as $region_key => $region_value) {
                if (!in_array($region_value->pr_source_city, $post_region_cities)) {
                    $post_region_cities[] = $region_value->pr_source_city;
예제 #2
0
파일: trip.php 프로젝트: arp19690/newtravel
 public function add_to_wishlist($post_url_key)
 {
     if (isset($this->session->userdata['user_id'])) {
         $user_id = $this->session->userdata['user_id'];
         $model = new Common_model();
         $is_owner = $model->fetchSelectedData('post_id', TABLE_POSTS, array('post_user_id' => $user_id, 'post_url_key' => $post_url_key));
         if (!empty($is_owner)) {
             $this->session->set_flashdata('error', 'Sorry, you cannot add your own trip to your wishlist');
         } else {
             $redis_functions = new Redisfunctions();
             $post_details = $redis_functions->get_trip_details($post_url_key);
             $is_exists = $model->fetchSelectedData('wishlist_id', TABLE_WISHLIST, array('wishlist_post_id' => $post_details['post_id'], 'wishlist_user_id' => $user_id, 'wishlist_status' => '1'));
             if (!empty($is_exists)) {
                 $model->updateData(TABLE_WISHLIST, array('wishlist_status' => '0'), array('wishlist_id' => $is_exists[0]['wishlist_id']));
                 $this->session->set_flashdata('error', 'Trip removed from your wishlist');
             } else {
                 $data_array = array('wishlist_user_id' => $user_id, 'wishlist_post_id' => $post_details['post_id'], 'wishlist_created_on' => date('Y-m-d H:i:s'), 'wishlist_ipaddress' => USER_IP, 'wishlist_useragent' => USER_AGENT);
                 $model->insertData(TABLE_WISHLIST, $data_array);
                 $this->session->set_flashdata('success', 'Trip added to your wishlist');
             }
             // updating user redis key
             $redis_functions->set_user_profile_data($this->session->userdata['user_username']);
         }
         redirect(getTripUrl($post_url_key));
     } else {
         display_404_page();
     }
 }
예제 #3
0
 public function paypal_success()
 {
     if ($this->input->get('trip_url_key') && $this->input->get('plan_key') && $this->input->get('id') && $this->input->post()) {
         if ($this->input->post('item_number1') == $this->input->get('trip_url_key')) {
             $user_id = $this->session->userdata['user_id'];
             $user_email = $this->session->userdata['user_email'];
             if ($user_id == getEncryptedString($this->input->get('id'), 'decode')) {
                 $model = new Common_model();
                 $redis_functions = new Redisfunctions();
                 $trip_url_key = $this->input->get('trip_url_key');
                 $featured_plan_key = $this->input->get('plan_key');
                 $post_details = $redis_functions->get_trip_details($trip_url_key);
                 $feature_plan_details = $model->fetchSelectedData('*', TABLE_FEATURED_MASTER, array('pfm_key' => $featured_plan_key));
                 if (!empty($post_details) && !empty($feature_plan_details)) {
                     if ($post_details['post_user_id'] == $user_id) {
                         $paypal_data = $this->input->post();
                         $payment_reference_number = getUniquePaymentReferenceNumber(getEncryptedString($paypal_data['txn_id']));
                         $payment_created_on = date('Y-m-d H:i:s');
                         $data_array = array('payment_reference_number' => $payment_reference_number, 'payment_user_id' => $user_id, 'payment_pfm_id' => $feature_plan_details[0]['pfm_id'], 'payment_post_id' => $post_details['post_id'], 'payment_txn_id' => $paypal_data['txn_id'], 'payment_amount' => $paypal_data['payment_gross'], 'payment_payer_email' => $paypal_data['payer_email'], 'payment_receiver_email' => $paypal_data['receiver_email'], 'payment_status' => '1', 'payment_json' => json_encode($paypal_data), 'payment_created_on' => $payment_created_on);
                         $is_exists = $model->fetchSelectedData('payment_id', TABLE_PAYMENTS, array('payment_post_id' => $post_details['post_id'], 'payment_txn_id' => $paypal_data['txn_id']));
                         if (empty($is_exists)) {
                             $model->insertData(TABLE_PAYMENTS, $data_array);
                             $this->session->set_flashdata('success', 'Payment successful');
                         } else {
                             $this->session->set_flashdata('error', 'Transaction ID already exists');
                             redirect(getTripUrl($trip_url_key));
                         }
                         // Adding post to featured table
                         if ($this->add_post_to_featured($post_details['post_id'], $feature_plan_details[0]['pfm_id']) == FALSE) {
                             $this->session->set_flashdata('error', 'Unauthorized access to post');
                             redirect(getTripUrl($trip_url_key));
                         }
                         // Updating redis table here
                         $redis_functions->set_trip_details($trip_url_key);
                         $redis_functions->set_featured_trips();
                         // Sending invoice email here
                         if (USER_IP != '127.0.0.1') {
                             $invoice_data_array = array('payment_reference_number' => $payment_reference_number, 'payment_created_on' => $payment_created_on, 'payer_user_fullname' => $this->session->userdata['user_fullname'], 'payer_user_email' => $user_email, 'payment_txn_id' => $paypal_data['txn_id'], 'post_title' => $post_details['post_title'], 'pfm_title' => $feature_plan_details['pfm_title'], 'payment_currency' => 'USD', 'payment_amount' => $paypal_data['payment_gross']);
                             $email_model = new Email_model();
                             $invoice_html_data = $email_model->invoice_template($invoice_data_array);
                             $email_model->sendMail($user_email, $invoice_html_data['email_subject'], $invoice_html_data['email_message']);
                         }
                         $page_title = 'Payment confirmed';
                         $input_arr = array(base_url() => 'Home', '#' => $page_title);
                         $breadcrumbs = get_breadcrumbs($input_arr);
                         $data["post_details"] = $post_details;
                         $data["feature_plan_details"] = $feature_plan_details[0];
                         $data["payment_reference_number"] = $payment_reference_number;
                         $data["breadcrumbs"] = $breadcrumbs;
                         $data["page_title"] = $page_title;
                         $data['meta_title'] = $data["page_title"] . ' - ' . $this->redis_functions->get_site_setting('SITE_NAME');
                         $this->template->write_view("content", "pages/payments/paypal-success", $data);
                         $this->template->render();
                     } else {
                         $this->session->set_flashdata('error', 'Unauthorized access');
                         display_404_page();
                     }
                 } else {
                     $this->session->set_flashdata('error', 'No such records found');
                     display_404_page();
                 }
             } else {
                 $this->session->set_flashdata('error', 'Invalid request');
                 display_404_page();
             }
         } else {
             $this->session->set_flashdata('error', 'Invalid request');
             display_404_page();
         }
     } else {
         $this->session->set_flashdata('error', 'Invalid request');
         display_404_page();
     }
 }
예제 #4
0
 public function get_you_may_like($current_url_key, $max_results = 5)
 {
     $redis_functions = new Redisfunctions();
     $post_details = $redis_functions->get_trip_details($current_url_key);
     $post_regions = $post_from_dates = $post_to_dates = $post_activities = $where_arr = $output_data = array();
     // Adding post regions to where str
     if (!empty($post_details['post_regions'])) {
         foreach ($post_details['post_regions'] as $region_key => $region_value) {
             $post_regions[] = $region_value->pr_source_region;
             $post_regions[] = $region_value->pr_destination_region;
             // Adding from and to date of the trip to match
             $post_from_dates[] = $region_value->pr_from_date;
             $post_to_dates[] = $region_value->pr_to_date;
         }
     }
     // Adding post activities
     if (!empty($post_details['post_activities'])) {
         foreach ($post_details['post_activities'] as $activity_key => $activity_value) {
             $post_activities[] = $activity_value->pa_activity_id;
         }
     }
     if (!empty($post_regions)) {
         $imploded_regions = '"' . implode('", "', array_unique($post_regions)) . '"';
         $where_arr[] = 'pr.pr_source_region IN (' . $imploded_regions . ')';
         $where_arr[] = 'pr.pr_destination_region IN (' . $imploded_regions . ')';
     }
     if (!empty($post_from_dates)) {
         $imploded_from_dates = '"' . implode('", "', array_unique($post_from_dates)) . '"';
         $where_arr[] = 'pr.pr_from_date IN (' . $imploded_from_dates . ')';
     }
     if (!empty($post_to_dates)) {
         $imploded_to_dates = '"' . implode('", "', array_unique($post_to_dates)) . '"';
         $where_arr[] = 'pr.pr_to_date IN (' . $imploded_to_dates . ')';
     }
     if (!empty($post_activities)) {
         $imploded_activities = '"' . implode('", "', array_unique($post_activities)) . '"';
         $where_str[] = 'pa.pa_activity_id IN (' . $imploded_activities . ')';
     }
     if (!empty($where_str)) {
         $where_str = 'p.post_url_key != "' . $current_url_key . '" AND (' . implode(' OR ', $where_arr) . ')';
         $records = $search_results = $this->get_search_results('p.post_url_key', $where_str, NULL, NULL, $max_results);
         if (!empty($records)) {
             foreach ($records as $value) {
                 $output_data[] = $redis_functions->get_trip_details($value['post_url_key']);
             }
         }
     }
     return $output_data;
 }