function column_default($item, $column_name)
 {
     $link_pattern = '<a href="edit.php?post_type=%1s&page=%2$s&action=%3$s&schedule_id=%4$s">%5$s</a>';
     switch ($column_name) {
         case 'id':
         case 'max_people':
         case 'price':
         case 'child_price':
         case 'duration':
             return $item[$column_name];
         case 'tour_date':
             $actions = array('edit' => sprintf($link_pattern, sanitize_text_field($_REQUEST['post_type']), 'schedules', 'edit', $item['id'], 'Edit'), 'delete' => sprintf($link_pattern, sanitize_text_field($_REQUEST['post_type']), 'schedules', 'delete', $item['id'] . '&_wpnonce=' . wp_create_nonce('schedule_delete'), 'Delete'));
             $content = sprintf($link_pattern, sanitize_text_field($_REQUEST['post_type']), 'schedules', 'edit', $item['id'], $item[$column_name]);
             //Return the title contents
             return sprintf('%1$s %2$s', $content, $this->row_actions($actions));
         case 'other':
             if (empty($item['is_daily'])) {
                 return '';
             }
             if (empty($item['date_to']) || $item['date_to'] == '9999-12-31') {
                 return 'daily';
             }
             return 'daily until ' . $item['date_to'];
         case 'st_id':
             return trav_tour_get_schedule_type_title($item['tour_id'], $item['st_id']);
         default:
             return print_r($item, true);
             //Show the whole array for troubleshooting purposes
     }
 }
Beispiel #2
0
 function trav_tour_send_confirmation_email($booking_no, $booking_pincode, $type = 'new', $subject = '', $description = '')
 {
     global $wpdb, $logo_url, $trav_options;
     $booking_data = trav_tour_get_booking_data($booking_no, $booking_pincode);
     if (!empty($booking_data)) {
         // server variables
         $admin_email = get_option('admin_email');
         $home_url = esc_url(home_url());
         $site_name = $_SERVER['SERVER_NAME'];
         $logo_url = esc_url($logo_url);
         $tour_book_conf_url = '';
         if (isset($trav_options['tour_booking_confirmation_page']) && !empty($trav_options['tour_booking_confirmation_page'])) {
             $tour_book_conf_url = trav_get_permalink_clang($trav_options['tour_booking_confirmation_page']);
         }
         $booking_data['tour_id'] = trav_tour_clang_id($booking_data['tour_id']);
         $st_data = trav_tour_get_schedule_type_data($booking_data['tour_id'], $booking_data['st_id']);
         $schedule_data = trav_tour_get_schedule_data($booking_data);
         // tour info
         $tour_name = get_the_title($booking_data['tour_id']);
         $tour_url = esc_url(trav_get_permalink_clang($booking_data['tour_id']));
         $tour_thumbnail = get_the_post_thumbnail($booking_data['tour_id'], 'list-thumb');
         $tour_address = get_post_meta($booking_data['tour_id'], 'trav_tour_address', true);
         $tour_city = trav_tour_get_city($booking_data['tour_id']);
         $tour_country = trav_tour_get_country($booking_data['tour_id']);
         $tour_phone = get_post_meta($booking_data['tour_id'], 'trav_tour_phone', true);
         $tour_email = get_post_meta($booking_data['tour_id'], 'trav_tour_email', true);
         $tour_duration = '';
         if (!empty($schedule_data) && $schedule_data['success'] == 1) {
             $tour_duration = $schedule_data['schedule_data']['duration'];
         }
         $tour_st_title = esc_html(trav_tour_get_schedule_type_title($booking_data['tour_id'], $booking_data['st_id']));
         $tour_st_description = esc_html($st_data['description']);
         $tour_st_time = esc_html($st_data['time']);
         if (empty($tour_address)) {
             $tour_address = $tour_city . ' ' . $tour_country;
         }
         $tour_date = date('l, F, j, Y', trav_strtotime($booking_data['tour_date']));
         // booking info
         $booking_no = $booking_data['booking_no'];
         $booking_pincode = $booking_data['pin_code'];
         $booking_adults = $booking_data['adults'];
         $booking_kids = $booking_data['kids'];
         $booking_total_price = esc_html(trav_get_price_field($booking_data['total_price'] * $booking_data['exchange_rate'], $booking_data['currency_code'], 0));
         $booking_deposit_price = esc_html($booking_data['deposit_price'] . $booking_data['currency_code']);
         $booking_deposit_paid = esc_html(empty($booking_data['deposit_paid']) ? 'No' : 'Yes');
         $booking_update_url = esc_url(add_query_arg(array('booking_no' => $booking_data['booking_no'], 'pin_code' => $booking_data['pin_code']), $tour_book_conf_url));
         // customer info
         $customer_first_name = $booking_data['first_name'];
         $customer_last_name = $booking_data['last_name'];
         $customer_email = $booking_data['email'];
         $customer_country_code = $booking_data['country_code'];
         $customer_phone = $booking_data['phone'];
         $customer_address = $booking_data['address'];
         $customer_city = $booking_data['city'];
         $customer_zip = $booking_data['zip'];
         $customer_country = $booking_data['country'];
         $customer_special_requirements = $booking_data['special_requirements'];
         $variables = array('home_url', 'site_name', 'logo_url', 'tour_name', 'tour_url', 'tour_thumbnail', 'tour_country', 'tour_city', 'tour_address', 'tour_phone', 'tour_email', 'tour_date', 'tour_duration', 'tour_st_title', 'tour_st_description', 'tour_st_time', 'booking_no', 'booking_pincode', 'booking_adults', 'booking_kids', 'booking_total_price', 'booking_deposit_price', 'booking_deposit_paid', 'booking_update_url', 'customer_first_name', 'customer_last_name', 'customer_email', 'customer_country_code', 'customer_phone', 'customer_address', 'customer_city', 'customer_zip', 'customer_country', 'customer_special_requirements');
         if (empty($subject)) {
             if ($type == 'new') {
                 $subject = empty($trav_options['tour_confirm_email_subject']) ? 'Booking Confirmation Email Subject' : $trav_options['tour_confirm_email_subject'];
             } elseif ($type == 'update') {
                 $subject = empty($trav_options['tour_update_email_subject']) ? 'Booking Updated Email Subject' : $trav_options['tour_update_email_subject'];
             } elseif ($type == 'cancel') {
                 $subject = empty($trav_options['tour_cancel_email_subject']) ? 'Booking Canceled Email Subject' : $trav_options['tour_cancel_email_subject'];
             }
         }
         if (empty($description)) {
             if ($type == 'new') {
                 $description = empty($trav_options['tour_confirm_email_description']) ? 'Booking Confirmation Email Description' : $trav_options['tour_confirm_email_description'];
             } elseif ($type == 'update') {
                 $description = empty($trav_options['tour_update_email_description']) ? 'Booking Confirmation Email Description' : $trav_options['tour_update_email_description'];
             } elseif ($type == 'cancel') {
                 $description = empty($trav_options['tour_cancel_email_description']) ? 'Booking Confirmation Email Description' : $trav_options['tour_cancel_email_description'];
             }
         }
         foreach ($variables as $variable) {
             $subject = str_replace("[" . $variable . "]", ${$variable}, $subject);
             $description = str_replace("[" . $variable . "]", ${$variable}, $description);
         }
         $mail_sent = trav_send_mail($site_name, $admin_email, $customer_email, $subject, $description);
         /* mailing function to business owner */
         $bowner_address = '';
         if (!empty($trav_options['tour_booked_notify_bowner'])) {
             if ($type == 'new') {
                 $subject = empty($trav_options['tour_bowner_email_subject']) ? 'You received a booking' : $trav_options['tour_bowner_email_subject'];
                 $description = empty($trav_options['tour_bowner_email_description']) ? 'Booking Details' : $trav_options['tour_bowner_email_description'];
             } elseif ($type == 'update') {
                 $subject = empty($trav_options['tour_update_bowner_email_subject']) ? 'A booking is updated' : $trav_options['tour_update_bowner_email_subject'];
                 $description = empty($trav_options['tour_update_bowner_email_description']) ? 'Booking Details' : $trav_options['tour_update_bowner_email_description'];
             } elseif ($type == 'cancel') {
                 $subject = empty($trav_options['tour_cancel_bowner_email_subject']) ? 'A booking is canceled' : $trav_options['tour_cancel_bowner_email_subject'];
                 $description = empty($trav_options['tour_cancel_bowner_email_description']) ? 'Booking Details' : $trav_options['tour_cancel_bowner_email_description'];
             }
             foreach ($variables as $variable) {
                 $subject = str_replace("[" . $variable . "]", ${$variable}, $subject);
                 $description = str_replace("[" . $variable . "]", ${$variable}, $description);
             }
             if (!empty($tour_email)) {
                 $bowner_address = $tour_email;
             } else {
                 $post_author_id = get_post_field('post_author', $booking_data['tour_id']);
                 $bowner = get_user_by('id', $post_author_id);
                 if (!empty($bowner)) {
                     $bowner_address = $bowner->user_email;
                 }
             }
             if (!empty($bowner_address)) {
                 trav_send_mail($site_name, $admin_email, $bowner_address, $subject, $description);
             }
         }
         /* mailing function to admin */
         if (!empty($trav_options['tour_booked_notify_admin'])) {
             if ($bowner_address != $admin_email) {
                 if ($type == 'new') {
                     $subject = empty($trav_options['tour_admin_email_subject']) ? 'You received a booking' : $trav_options['tour_admin_email_subject'];
                     $description = empty($trav_options['tour_admin_email_description']) ? 'Booking Details' : $trav_options['tour_admin_email_description'];
                 } elseif ($type == 'update') {
                     $subject = empty($trav_options['tour_update_admin_email_subject']) ? 'A booking is updated' : $trav_options['tour_update_admin_email_subject'];
                     $description = empty($trav_options['tour_update_admin_email_description']) ? 'Booking Details' : $trav_options['tour_update_admin_email_description'];
                 } elseif ($type == 'cancel') {
                     $subject = empty($trav_options['tour_cancel_admin_email_subject']) ? 'A booking is canceled' : $trav_options['tour_cancel_admin_email_subject'];
                     $description = empty($trav_options['tour_cancel_admin_email_description']) ? 'Booking Details' : $trav_options['tour_cancel_admin_email_description'];
                 }
                 foreach ($variables as $variable) {
                     $subject = str_replace("[" . $variable . "]", ${$variable}, $subject);
                     $description = str_replace("[" . $variable . "]", ${$variable}, $description);
                 }
                 trav_send_mail($site_name, $admin_email, $admin_email, $subject, $description);
             }
         }
         return true;
     }
     return false;
 }
Beispiel #3
0
" class="hover-effect middle-block">
						<?php 
echo get_the_post_thumbnail($booking_data['tour_id'], 'thumbnail', array('class' => 'middle-item'));
?>
					</a>
					<div class="travel-title">
						<h5 class="box-title"><a href="<?php 
echo esc_url($tour_url);
?>
"><?php 
echo esc_html(get_the_title($booking_data['tour_id']));
?>
</a>
							<small>
								<?php 
echo trav_tour_get_schedule_type_title($booking_data['tour_id'], $booking_data['st_id']);
?>
							</small>
						</h5>
						<a href="<?php 
echo esc_url($tour_url);
?>
" class="button"><?php 
_e('EDIT', 'trav');
?>
</a>
					</div>
				</figure>
				<div class="details">
					<div class="icon-box style12 style13 full-width">
						<div class="icon-wrapper">
$deposit_rate = empty($deposit_rate) ? 0 : $deposit_rate;
$tour_date = trav_tophptime($booking_data['tour_date']);
// if deposit is required and it is not paid process payment
if (!empty($deposit_rate) && empty($booking_data['deposit_paid'])) {
    // init payment variables
    $ItemName = '';
    if ($deposit_rate < 100) {
        $ItemName = sprintf(__('Deposit(%d%%) for ', 'trav'), $deposit_rate);
    } else {
        $ItemName = __('Deposit for ', 'trav');
    }
    $ItemName .= get_the_title($tour_id) . ' ' . trav_tour_get_schedule_type_title($tour_id, $st_id);
    $payment_data = array();
    $payment_data['item_name'] = $ItemName;
    $payment_data['item_number'] = $tour_id . '-' . $st_id;
    $payment_data['item_desc'] = __('Tour Date', 'trav') . ' ' . $tour_date . ' ' . get_the_title($tour_id) . ' ' . trav_tour_get_schedule_type_title($tour_id, $st_id);
    $payment_data['item_qty'] = 1;
    $payment_data['item_price'] = $booking_data['deposit_price'];
    $payment_data['item_total_price'] = $payment_data['item_qty'] * $payment_data['item_price'];
    $payment_data['grand_total'] = $payment_data['item_total_price'];
    $payment_data['currency'] = strtoupper($booking_data['currency_code']);
    $payment_data['return_url'] = trav_get_current_page_url() . '?booking_no=' . $booking_data['booking_no'] . '&pin_code=' . $booking_data['pin_code'] . '&payment=success';
    $payment_data['cancel_url'] = trav_get_current_page_url() . '?booking_no=' . $booking_data['booking_no'] . '&pin_code=' . $booking_data['pin_code'] . '&payment=failed';
    $payment_data['status'] = '';
    $payment_data['deposit_rate'] = $deposit_rate;
    if (!empty($_REQUEST['transaction_id']) && !empty($_SESSION['booking_data'][$_REQUEST['transaction_id']])) {
        $payment_data['status'] = 'before';
    }
    $payment_result = trav_process_payment($payment_data);
    if ($payment_result) {
        if (!empty($payment_result['success']) && $payment_result['method'] == 'paypal') {
 function column_schedule_type($item)
 {
     return trav_tour_get_schedule_type_title($item['tour_id'], $item['st_id']);
 }
Beispiel #6
0
        }
        if (!empty(${$field})) {
            $content = $value['pre'] . ${$field} . $value['sur'];
            echo sprintf($dt_dd, esc_html($value['label']), esc_html($content));
        }
    }
    ?>
	</dl>
	<hr />

	<?php 
    if (!empty($st_id)) {
        ?>

		<h4><?php 
        echo esc_html(trav_tour_get_schedule_type_title($tour_id, $st_id));
        ?>
</h4>
		<dl class="term-description">
			<?php 
        $st_data = trav_tour_get_schedule_type_data($tour_id, $st_id);
        if (!empty($st_data)) {
            $tour_detail_fields = array('description' => __('Description', 'trav'), 'time' => __('Time', 'trav'));
            foreach ($tour_detail_fields as $field => $label) {
                ${$field} = empty($st_data["{$field}"]) ? '' : $st_data["{$field}"];
                if (!empty(${$field})) {
                    echo sprintf($dt_dd, esc_html($label), esc_html(${$field}));
                }
            }
        }
        ?>