mage-eventpress/inc/template-prts/single-events.php

230 lines
8.5 KiB
PHP
Raw Normal View History

2020-01-22 07:15:24 -05:00
<?php
get_header();
the_post();
2020-04-28 06:37:33 -04:00
global $post, $woocommerce;
2020-12-13 07:25:42 -05:00
if ( post_password_required() ) {
echo get_the_password_form(); // WPCS: XSS ok.
}else{
2020-04-28 06:37:33 -04:00
$event_meta = get_post_custom(get_the_id());
$author_terms = get_the_terms(get_the_id(), 'mep_org');
$book_count = get_post_meta(get_the_id(), 'total_booking', true);
$user_api = mep_get_option('google-map-api', 'general_setting_sec', '');
$mep_full_name = strip_tags($event_meta['mep_full_name'][0]);
$mep_reg_email = strip_tags($event_meta['mep_reg_email'][0]);
$mep_reg_phone = strip_tags($event_meta['mep_reg_phone'][0]);
$mep_reg_address = strip_tags($event_meta['mep_reg_address'][0]);
$mep_reg_designation = strip_tags($event_meta['mep_reg_designation'][0]);
$mep_reg_website = strip_tags($event_meta['mep_reg_website'][0]);
$mep_reg_veg = strip_tags($event_meta['mep_reg_veg'][0]);
$mep_reg_company = strip_tags($event_meta['mep_reg_company'][0]);
$mep_reg_gender = strip_tags($event_meta['mep_reg_gender'][0]);
$mep_reg_tshirtsize = strip_tags($event_meta['mep_reg_tshirtsize'][0]);
$global_template = mep_get_option('mep_global_single_template', 'general_setting_sec', 'default-theme.php');
$current_template = $event_meta['mep_event_template'][0];
$_current_template = $current_template ? $current_template : $global_template;
$currency_pos = get_option('woocommerce_currency_pos');
2020-07-12 06:42:13 -04:00
do_action('mep_event_single_page_after_header');
?>
<div class="mep-events-wrapper">
2020-04-28 06:37:33 -04:00
<?php
2020-11-05 07:16:20 -05:00
2020-04-28 06:37:33 -04:00
do_action('woocommerce_before_single_product');
2020-11-05 07:16:20 -05:00
2020-04-28 06:37:33 -04:00
$theme_name = "/themes/$_current_template";
require_once(mep_template_file_path($theme_name));
if (comments_open() || get_comments_number()) {
comments_template();
}
?>
</div>
<div class="mep-related-events-sec">
<?php do_action('after-single-events'); ?>
</div>
2020-04-28 06:37:33 -04:00
<?php
$builder_version = mep_get_builder_version();
2020-09-14 00:50:46 -04:00
$mep_event_faq = get_post_meta(get_the_id(), 'mep_event_faq', true) ? get_post_meta(get_the_id(), 'mep_event_faq', true) : [];
2020-04-28 06:37:33 -04:00
if($builder_version < 3.5){
?>
2018-02-27 06:35:08 -05:00
<script>
2018-07-02 04:39:41 -04:00
jQuery('#quantity_5a7abbd1bff73').click(function() {
2018-02-27 06:35:08 -05:00
var $form = jQuery('form'); //on a real app it would be better to have a class or ID
var $totalQuant = jQuery('#quantity_5a7abbd1bff73', $form);
2018-07-02 04:39:41 -04:00
jQuery('#quantity_5a7abbd1bff73', $form).change(calculateTotal);
2018-02-27 06:35:08 -05:00
function calculateTotal() {
2018-07-02 04:39:41 -04:00
var sum = jQuery('#rowtotal').val();
2019-04-07 07:15:31 -04:00
jQuery('#usertotal').html('<?php if($currency_pos=="left"){ echo get_woocommerce_currency_symbol(); } ?>' + sum * parseInt( $totalQuant.val() || 0, 10) + "<?php if($currency_pos=="right"){ echo get_woocommerce_currency_symbol(); } ?>");
2018-07-02 04:39:41 -04:00
}
});
jQuery(document).ready(function () {
2020-09-14 00:50:46 -04:00
<?php if(sizeof($mep_event_faq) > 0 && !is_admin() ){ ?>
2018-07-05 06:10:06 -04:00
jQuery( "#mep-event-accordion" ).accordion({
collapsible: true,
active: false
});
2020-09-14 00:50:46 -04:00
<?php } ?>
2018-07-02 04:39:41 -04:00
jQuery(document).on("change", ".etp", function() {
var sum = 0;
jQuery(".etp").each(function(){
sum += +jQuery(this).val();
});
jQuery("#ttyttl").html(sum);
});
jQuery("#ttypelist").change(function () {
2018-07-05 06:10:06 -04:00
vallllp = jQuery(this).val()+"_";
var n = vallllp.split('_');
var price = n[0];
var ctt = 99;
2018-07-02 04:39:41 -04:00
if(vallllp!="_"){
var currentValue = parseInt(ctt);
jQuery('#rowtotal').val(currentValue += parseFloat(price));
}
if(vallllp=="_"){
2018-07-05 06:10:06 -04:00
jQuery('#eventtp').attr('value', 0);
jQuery('#eventtp').attr('max', 0);
jQuery("#ttypeprice_show").html("")
2018-07-02 04:39:41 -04:00
}
});
2020-01-22 07:15:24 -05:00
2018-07-02 04:39:41 -04:00
function updateTotal() {
var total = 0;
vallllp = jQuery(this).val()+"_";
2018-07-05 06:10:06 -04:00
var n = vallllp.split('_');
var price = n[0];
2018-07-02 04:39:41 -04:00
total += parseFloat(price);
2019-05-22 23:55:01 -04:00
jQuery('#rowtotal').val(total);
2018-02-27 06:35:08 -05:00
}
2018-07-02 04:39:41 -04:00
//Bind the change event
jQuery(".extra-qty-box").on('change', function() {
var sum = 0;
var total = <?php if($event_meta['_price'][0]){ echo $event_meta['_price'][0]; }else{ echo 0; } ?>;
jQuery('.price_jq').each(function () {
var price = jQuery(this);
var count = price.closest('tr').find('.extra-qty-box');
sum = (price.html() * count.val());
total = total + sum;
2019-05-22 23:55:01 -04:00
// price.closest('tr').find('.cart_total_price').html(sum + "â‚´");
2018-07-02 04:39:41 -04:00
});
2020-11-05 07:16:20 -05:00
//Fix Tony 5.9.2020: Immer 2 Nachkommastellen anzeigen
total = total.toFixed(2);
//End of fix
2019-04-07 07:15:31 -04:00
jQuery('#usertotal').html("<?php if($currency_pos=="left"){ echo get_woocommerce_currency_symbol(); } ?>" + total + "<?php if($currency_pos=="right"){ echo get_woocommerce_currency_symbol(); } ?>");
2018-07-02 04:39:41 -04:00
jQuery('#rowtotal').val(total);
}).change(); //trigger change event on page load
2020-01-22 07:15:24 -05:00
<?php
2018-07-02 04:39:41 -04:00
$mep_event_ticket_type = get_post_meta($post->ID, 'mep_event_ticket_type', true);
if($mep_event_ticket_type){
$count =1;
$event_id = $post->ID;
$event_more_date[0]['event_more_start_date'] = date('Y-m-d',strtotime(get_post_meta($event_id,'event_start_date',true)));
$event_more_date[0]['event_more_start_time'] = date('H:i',strtotime(get_post_meta($event_id,'event_start_time',true)));
$event_more_date[0]['event_more_end_date'] = date('Y-m-d',strtotime(get_post_meta($event_id,'event_end_date',true)));
$event_more_date[0]['event_more_end_time'] = date('H:i',strtotime(get_post_meta($event_id,'event_end_time',true)));
2020-04-08 14:30:01 -04:00
$event_more_dates = get_post_meta($event_id,'mep_event_more_date',true) ? get_post_meta($event_id,'mep_event_more_date',true) : array();
$recurring = get_post_meta($event_id, 'mep_enable_recurring', true) ? get_post_meta($event_id, 'mep_enable_recurring', true) : 'no';
if($recurring == 'yes'){
$event_multi_date = array_merge($event_more_date,$event_more_dates);
}else{
$event_multi_date = $event_more_date;
}
2020-01-22 07:15:24 -05:00
foreach($event_multi_date as $event_date){
2020-04-28 06:37:33 -04:00
$start_date = $recurring == 'yes' ? date('Y-m-d H:i:s', strtotime($event_date['event_more_start_date'] . ' ' . $event_date['event_more_start_time'])) : date('Y-m-d H:i:s', strtotime(mep_get_event_expire_date($event_id)));
if(strtotime(current_time('Y-m-d H:i:s')) < strtotime($start_date)){
2018-07-02 04:39:41 -04:00
foreach ( $mep_event_ticket_type as $field ) {
2020-09-20 07:49:01 -04:00
$qm = mep_remove_apostopie($field['option_name_t']);
2018-07-02 04:39:41 -04:00
?>
2020-04-28 06:37:33 -04:00
var inputs = jQuery("#ttyttl").html() || 0;
var inputs = jQuery('#eventpxtp_<?php echo $count; ?>').val() || 0;
2020-02-05 07:47:07 -05:00
var input = parseInt(inputs);
var children=jQuery('#dadainfo_<?php echo $count; ?> > div').length || 0;
var selected_ticket = jQuery('#ttyttl').html();
if(input < children){
jQuery('#dadainfo_<?php echo $count; ?>').empty();
children=0;
}
for (var i = children+1; i <= input; i++) {
jQuery('#dadainfo_<?php echo $count; ?>').append(
jQuery('<div/>')
.attr("id", "newDiv" + i)
2020-07-12 06:42:13 -04:00
.html("<?php do_action('mep_reg_fields',$start_date, get_the_id(), $qm); ?>")
2020-02-05 07:47:07 -05:00
);
}
2018-07-02 04:39:41 -04:00
jQuery('#eventpxtp_<?php echo $count; ?>').on('change', function () {
var inputs = jQuery("#ttyttl").html() || 0;
2018-07-02 04:39:41 -04:00
var inputs = jQuery('#eventpxtp_<?php echo $count; ?>').val() || 0;
var input = parseInt(inputs);
2020-01-22 07:15:24 -05:00
var children=jQuery('#dadainfo_<?php echo $count; ?> > div').length || 0;
jQuery(document).on("change", ".etp", function() {
2019-05-22 23:55:01 -04:00
var TotalQty = 0;
jQuery(".etp").each(function(){
TotalQty += +jQuery(this).val();
2019-05-22 23:55:01 -04:00
});
});
2018-07-02 04:39:41 -04:00
if(input < children){
jQuery('#dadainfo_<?php echo $count; ?>').empty();
children=0;
}
for (var i = children+1; i <= input; i++) {
jQuery('#dadainfo_<?php echo $count; ?>').append(
jQuery('<div/>')
.attr("id", "newDiv" + i)
2020-07-12 06:42:13 -04:00
.html("<?php do_action('mep_reg_fields',$start_date, get_the_id(), $qm); ?>")
);
2018-07-02 04:39:41 -04:00
}
});
2020-01-22 07:15:24 -05:00
<?php
2018-07-02 04:39:41 -04:00
$count++;
2018-07-05 06:10:06 -04:00
}
}
}
2018-07-02 04:39:41 -04:00
}else{
?>
2020-01-22 07:15:24 -05:00
jQuery('#quantity_5a7abbd1bff73').on('change', function () {
2018-07-02 04:39:41 -04:00
var input = jQuery('#quantity_5a7abbd1bff73').val() || 0;
2020-01-22 07:15:24 -05:00
var children=jQuery('#divParent > div').length || 0;
2018-07-02 04:39:41 -04:00
if(input < children){
jQuery('#divParent').empty();
children=0;
2020-01-22 07:15:24 -05:00
}
2018-07-02 04:39:41 -04:00
for (var i = children+1; i <= input; i++) {
jQuery('#divParent').append(
jQuery('<div/>')
2020-04-28 06:37:33 -04:00
.attr("id", "newDiv" + i)
2018-07-02 04:39:41 -04:00
});
<?php
2020-01-22 07:15:24 -05:00
}
2018-07-02 04:39:41 -04:00
?>
2018-02-27 06:35:08 -05:00
});
</script>
2020-04-28 06:37:33 -04:00
<?php
}else{
do_action('mep_event_single_template_end',get_the_id());
2020-12-13 07:25:42 -05:00
}
do_action('mep_event_single_page_before_footer');
}
2020-07-12 06:42:13 -04:00
get_footer();