Beispiel #1
0
    function evoTX_ajax_06()
    {
        $evoOpt = get_evoOPT_array(1);
        $event_id = $_POST['event_id'];
        $ri = $_POST['ri'];
        add_filter('wp_mail_content_type', create_function('', 'return "text/html";'));
        $_event_pmv = get_post_custom($event_id);
        // get email address
        $_to_mail = !empty($_event_pmv['_tx_inq_email']) ? $_event_pmv['_tx_inq_email'][0] : (!empty($evoOpt['evotx_tix_inquiries_def_email']) ? $evoOpt['evotx_tix_inquiries_def_email'] : get_option('admin_email'));
        // get subject
        $subject = !empty($_event_pmv['_tx_inq_subject']) ? $_event_pmv['_tx_inq_subject'][0] : (!empty($evoOpt['evotx_tix_inquiries_def_subject']) ? $evoOpt['evotx_tix_inquiries_def_subject'] : 'New Ticket Sale Inquery');
        $headers = 'From: ' . $_POST['email'];
        ob_start();
        ?>
				<p>Event: <br/><?php 
        echo get_the_title($event_id);
        ?>
</p>
				<p>From: <br/><?php 
        echo $_POST['name'];
        ?>
</p>
				<p>Message: <br/><?php 
        echo $_POST['message'];
        ?>
</p>
			<?php 
        $body = ob_get_clean();
        $send_wp_mail = wp_mail($_to_mail, $subject, $body, $headers);
    }
Beispiel #2
0
 function __construct()
 {
     // event top inclusion
     // /add_filter('eventon_eventtop_one', array($this, 'eventop'), 10, 3);
     // /add_filter('evo_eventtop_adds', array($this, 'eventtop_adds'), 10, 1);
     // /add_filter('eventon_eventtop_evotx', array($this, 'eventtop_content'), 10, 2);
     $this->opt2 = get_evoOPT_array(2);
     // event card inclusion
     add_filter('eventon_eventCard_evotx', array($this, 'frontend_box'), 10, 2);
     add_filter('eventon_eventcard_array', array($this, 'eventcard_array'), 10, 4);
     add_filter('evo_eventcard_adds', array($this, 'eventcard_adds'), 10, 1);
     // scripts and styles
     add_action('init', array($this, 'register_styles_scripts'), 15);
     add_action('wp_enqueue_scripts', array($this, 'load_styles'), 10);
     // thank you page tickets
     add_action('woocommerce_thankyou', array($this, 'wc_order_tix'), 10, 1);
     add_action('woocommerce_view_order', array($this, 'wc_order_tix'), 10, 1);
     // order item name in emails
     add_filter('woocommerce_order_item_name', array($this, 'order_item_name'), 10, 2);
     // Passing Repeat interval related actions
     add_filter('woocommerce_add_cart_item_data', array($this, 'wdm_add_item_data'), 1, 2);
     add_filter('woocommerce_get_cart_item_from_session', array($this, 'wdm_get_cart_items_from_session'), 1, 3);
     // display custom date in cart
     add_filter('woocommerce_checkout_cart_item_quantity', array($this, 'wdm_add_user_custom_option_from_session_into_cart'), 1, 3);
     add_filter('woocommerce_cart_item_price', array($this, 'wdm_add_user_custom_option_from_session_into_cart'), 1, 3);
     // saving meta data
     add_action('woocommerce_add_order_item_meta', array($this, 'wdm_add_values_to_order_item_meta'), 1, 2);
     add_action('woocommerce_before_cart_item_quantity_zero', array($this, 'wdm_remove_user_custom_data_options_from_cart'), 1, 1);
     add_action('woocommerce_checkout_order_processed', array($this, 'create_evo_tickets'), 10, 1);
     // adding extra fields for ticket names
 }
/**  Event META BOX for ajde_events CPT */
function evotx_metabox_content()
{
    global $post, $evotx, $eventon, $evotx_admin;
    $woometa = '';
    $fmeta = get_post_meta($post->ID);
    $woo_product = !empty($fmeta['tx_woocommerce_product_id']) ? $fmeta['tx_woocommerce_product_id'][0] : null;
    // get options
    $evoOpt = get_evoOPT_array(1);
    // if woocommerce ticket has been created
    if ($woo_product) {
        $woometa = get_post_custom($woo_product);
    }
    $__woo_currencySYM = get_woocommerce_currency_symbol();
    //print_r($woometa);
    ob_start();
    $evotx_tix = !empty($fmeta['evotx_tix']) ? $fmeta['evotx_tix'][0] : null;
    ?>
		<div class='eventon_mb'>
		<div class="evotx">
			<input type='hidden' name='tx_woocommerce_product_id' value="<?php 
    echo evo_meta($fmeta, 'tx_woocommerce_product_id');
    ?>
"/>

			<p class='yesno_leg_line ' style='padding:10px'>
				<?php 
    echo eventon_html_yesnobtn(array('id' => 'evotx_activate', 'var' => $evotx_tix, 'attr' => array('afterstatement' => 'evotx_details')));
    ?>
				
				<input type='hidden' name='evotx_tix' value="<?php 
    echo $evotx_tix == 'yes' ? 'yes' : 'no';
    ?>
"/>
				<label for='evotx_tix'><?php 
    _e('Activate tickets for this Event', 'eventon');
    echo $eventon->throw_guide('You can allow ticket selling via Woocommerce for this event in here.', '', false);
    ?>
</label>
			</p>
			<div id='evotx_details' class='evotx_details evomb_body ' <?php 
    echo $evotx_tix == 'yes' ? null : 'style="display:none"';
    ?>
>
				
				
				<div class="evotx_tickets" >
				
					<h4><?php 
    _e('Ticket Info for this event', 'eventon');
    ?>
</h4>
					<table width='100%' border='0' cellspacing='0'>
						<?php 
    $product_type = 'simple';
    // product type
    if ($woo_product && function_exists('get_product')) {
        $product = new WC_Product($woo_product);
        $product_type = $evotx_admin->get_product_type($woo_product);
        $product_type = !empty($product_type) ? $product_type : 'simple';
        ?>
							<tr><td><?php 
        _e('Ticket Pricing Type', 'eventon');
        ?>
</td><td><?php 
        echo $product_type;
        ?>
</td></tr>
						<?php 
    }
    ?>

						<input type='hidden' name='tx_product_type' value='<?php 
    echo $product_type;
    ?>
'/>

						<!-- Price-->
						<?php 
    if (!empty($product_type) && $product_type == 'variable') {
        ?>
							<tr><td><?php 
        printf(__('Ticket price (%s)', 'eventon'), $__woo_currencySYM);
        ?>
</td><td><p><?php 
        echo $__woo_currencySYM . ' ' . evo_meta($woometa, '_min_variation_price') . ' - ' . evo_meta($woometa, '_max_variation_price');
        ?>
</p>
							<p class='marb20'><a href='<?php 
        echo get_edit_post_link($woo_product);
        ?>
' style='color:#fff'><?php 
        _e('Edit Price Variations');
        ?>
</a></p></td></tr>				
							
						<?php 
    } else {
        ?>
							<!-- Regular Price-->
							<tr><td><?php 
        printf(__('Ticket price (%s)', 'eventon'), $__woo_currencySYM);
        ?>
</td><td><input type='text' id='_regular_price' name='_regular_price' value="<?php 
        echo evo_meta($woometa, '_regular_price');
        ?>
"/></td></tr>

							<!-- Sale Price-->
							<tr><td><?php 
        printf(__('Sale price (%s)', 'eventon'), $__woo_currencySYM);
        ?>
</td><td><input type='text' id='_sale_price' name='_sale_price' value="<?php 
        echo evo_meta($woometa, '_sale_price');
        ?>
"/></td></tr>
						<?php 
    }
    ?>

						<?php 
    do_action('evotx_edit_event_ticket_tablerow', $post->ID, $woo_product);
    ?>
								


						<!-- SKU-->
						<tr><td><?php 
    _e('Ticket SKU', 'eventon');
    echo $eventon->throw_guide('SKU refers to a Stock-keeping unit, a unique identifier for each distinct menu item that can be ordered.', '', false);
    ?>
</td><td><input type='text' name='_sku' value='<?php 
    echo evo_meta($woometa, '_sku');
    ?>
'/></td></tr>

						<!-- Desc-->
						<tr><td><?php 
    _e('Short Ticket Detail', 'eventon');
    ?>
</td><td><input type='text' name='_tx_desc' value='<?php 
    echo evo_meta($woometa, '_tx_desc');
    ?>
'/></td></tr>
						
						<!-- manage capacity -->
							<?php 
    $_manage_cap = evo_meta_yesno($woometa, '_manage_stock', 'yes', 'yes', 'no');
    ?>
							<tr><td colspan='2'>
								<p class='yesno_leg_line ' >
									<?php 
    echo eventon_html_yesnobtn(array('id' => 'evotx_mcap', 'var' => $_manage_cap, 'attr' => array('afterstatement' => 'exotc_cap')));
    ?>
									<input type='hidden' name='_manage_stock' value="<?php 
    echo $_manage_cap;
    ?>
"/>
									<label for='_manage_stock'><?php 
    _e('Manage Capacity');
    ?>
</label>
								</p>
							</td></tr>
							
							<tbody id='exotc_cap' style='display:<?php 
    echo evo_meta_yesno($woometa, '_manage_stock', 'yes', '', 'none');
    ?>
'>
							<tr ><td><?php 
    _e('CAPACITY', 'eventon');
    ?>
</td><td><input type='text' id="_stock" name="_stock" value="<?php 
    echo evo_meta($woometa, '_stock');
    ?>
"/></td></tr>
						
						<!-- stock status -->
							<?php 
    $_stock_status = !empty($woometa['_stock_status']) && $woometa['_stock_status'][0] == 'outofstock' ? 'outofstock' : 'instock';
    $_stock_status_yesno = !empty($woometa['_stock_status']) && $woometa['_stock_status'][0] == 'outofstock' ? 'yes' : 'no';
    ?>
							<tr><td colspan='2'>
								<p class='yesno_leg_line '>
									<?php 
    echo eventon_html_yesnobtn(array('id' => 'evotx_mcap', 'var' => $_stock_status_yesno, 'no' => 'no'));
    ?>
									<input type='hidden' name='_stock_status' value="<?php 
    echo $_stock_status;
    ?>
"/>
									<label for='_stock_status'><?php 
    _e('Make ticket out of stock', 'eventon');
    echo $eventon->throw_guide('Set stock status of tickets. Setting this to yes would make tickets not available for sale anymore', '', false);
    ?>
</label>
								</p>
							</td></tr>
			
						<!-- Manage Capcity seperate for repeating events -->
							<?php 
    if (!empty($fmeta['evcal_repeat']) && $fmeta['evcal_repeat'][0] == 'yes' && $product_type == 'simple') {
        $manage_repeat_cap = evo_meta_yesno($fmeta, '_manage_repeat_cap', 'yes', 'yes', 'no');
        ?>
							<tr><td colspan='2'>
								<p class='yesno_leg_line ' >
									<?php 
        echo eventon_html_yesnobtn(array('id' => 'evotx_mcap', 'var' => $manage_repeat_cap, 'attr' => array('afterstatement' => 'evotx_ri_cap')));
        ?>
									<input type='hidden' name='_manage_repeat_cap' value="<?php 
        echo $manage_repeat_cap;
        ?>
"/>

									<label for='_manage_repeat_cap'><?php 
        _e('Manage capacity seperate for each repeating event');
        echo $eventon->throw_guide('This will show remaining tickets for this event on front-end', '', false);
        ?>
</label>
								</p>
							<?php 
        $repeat_intervals = !empty($fmeta['repeat_intervals']) ? unserialize($fmeta['repeat_intervals'][0]) : false;
        ?>
								<div id='evotx_ri_cap' class='evotx_repeat_capacity' style='padding-top:15px; padding-bottom:20px;display:<?php 
        echo evo_meta_yesno($fmeta, '_manage_repeat_cap', 'yes', '', 'none');
        ?>
'>
									<p><em style='opacity:0.6'><?php 
        _e('NOTE: The capacity above should match the total number of capacity for each repeat occurance below for this event.', 'eventon');
        ?>
</em></p>
									<?php 
        // if repeat intervals set
        if ($repeat_intervals && count($repeat_intervals) > 0) {
            $count = 0;
            // get saved capacities for repeats
            $ri_capacity = !empty($fmeta['ri_capacity']) ? unserialize($fmeta['ri_capacity'][0]) : false;
            //print_r($ri_capacity);
            //print_r($repeat_intervals);
            echo "<div class='evotx_ri_cap_inputs'>";
            // for each repeat interval
            foreach ($repeat_intervals as $interval) {
                $TIME = $evotx_admin->get_format_time($interval[0]);
                echo "<p style='display:" . ($count > 4 ? 'none' : 'block') . "'><input type='text' name='ri_capacity[]' value='" . ($ri_capacity && !empty($ri_capacity[$count]) ? $ri_capacity[$count] : '0') . "'/> " . $TIME[0] . "</p>";
                $count++;
            }
            echo "</div>";
            echo count($repeat_intervals) > 5 ? "<p class='evotx_ri_view_more'><a class='button_evo'>Click here</a> to view the rest of repeat occurances.</p>" : null;
        }
        ?>
								</div>
							</td></tr>
							<?php 
    }
    ?>

						<!-- show remaining -->
							<?php 
    $remain_tix = evo_meta_yesno($fmeta, '_show_remain_tix', 'yes', 'yes', 'no');
    ?>
							<tr><td colspan='2'>
								<p class='yesno_leg_line ' >
									<?php 
    echo eventon_html_yesnobtn(array('id' => 'evotx_mcap', 'var' => $remain_tix, 'attr' => array('afterstatement' => 'evotx_showre_count')));
    ?>
									<input type='hidden' name='_show_remain_tix' value="<?php 
    echo $remain_tix;
    ?>
"/>
									<label for='_show_remain_tix'><?php 
    _e('Show remaining tickets');
    echo $eventon->throw_guide('This will show remaining tickets for this event on front-end', '', false);
    ?>
</label>
								</p>
							</td></tr>
							<tr id='evotx_showre_count' style='display:<?php 
    echo evo_meta_yesno($fmeta, '_show_remain_tix', 'yes', '', 'none');
    ?>
'><td><?php 
    _e('Show remaining count at', 'eventon');
    echo $eventon->throw_guide('Show remaining count when remaining count go below this number.', '', false);
    ?>
</td><td><input type='text' id="remaining_count" name="remaining_count" placeholder='20' value="<?php 
    echo evo_meta($fmeta, 'remaining_count');
    ?>
"/></td></tr>	
							</tbody>
							
						<!-- sold individually -->
							<?php 
    $_sold_ind = evo_meta_yesno($woometa, '_sold_individually', 'yes', 'yes', 'no');
    ?>
							<tr><td colspan='2'>
								<p class='yesno_leg_line ' >
									<?php 
    echo eventon_html_yesnobtn(array('id' => 'evotx_mcap', 'var' => $_sold_ind));
    ?>
				
									<input type='hidden' name="_sold_individually" value="<?php 
    echo $_sold_ind;
    ?>
"/>
									<label for='_sold_individually'><?php 
    _e('Sold Individually', 'eventon');
    echo $eventon->throw_guide('Enable this to only allow one ticket per person', '', false);
    ?>
</label>
								</p>
							</td></tr>	

						<!-- Field details-->
							<tr><td style='padding:5px 25px;' colspan='2'><?php 
    _e('Ticket Field description', 'eventon');
    echo $eventon->throw_guide('Use this to type instruction text that will appear above add to cart section on calendar.', '', false);
    ?>
<br/><input style='width:100%; margin-top:5px'type='text' name='_tx_text' value='<?php 
    echo evo_meta($woometa, '_tx_text');
    ?>
'/></td></tr>

						<!-- ticket image -->
							<?php 
    // tix_image_id
    $_tix_image_id = !empty($fmeta['_tix_image_id']) ? $fmeta['_tix_image_id'][0] : false;
    // image soruce array
    $img_src = $_tix_image_id ? wp_get_attachment_image_src($_tix_image_id, 'medium') : null;
    $tix_img_src = !empty($img_src) ? $img_src[0] : null;
    // button texts & Class names
    $__button_text = !empty($_tix_image_id) ? __('Remove Image', 'eventon') : __('Choose Image', 'eventon');
    $__button_text_not = empty($_tix_image_id) ? __('Remove Image', 'eventon') : __('Choose Image', 'eventon');
    $__button_class = !empty($_tix_image_id) ? 'removeimg' : 'chooseimg';
    ?>
							<tr><td style='padding:5px 25px;' colspan='2'>
								<div class='evo_metafield_image' style='padding-top:10px'>
									<p >
										<label style='padding-bottom:5px; display:inline-block'><?php 
    _e('Ticket Image', 'eventon');
    ?>
</label><br/>
										<span style=''></span>
										<input id='_tix_image_id' class='custom_upload_image evo_meta_img' name="_tix_image_id" type="hidden" value="<?php 
    echo $_tix_image_id ? $_tix_image_id : null;
    ?>
" /> 
			                    		<input class="custom_upload_image_button button <?php 
    echo $__button_class;
    ?>
" data-txt='<?php 
    echo $__button_text_not;
    ?>
' type="button" value="<?php 
    echo $__button_text;
    ?>
" /><br/>
			                    		<span class='evo_loc_image_src image_src'>
			                    			<img src='<?php 
    echo $tix_img_src;
    ?>
' style='<?php 
    echo !empty($_tix_image_id) ? '' : 'display:none';
    ?>
'/>
			                    		</span>		                    		
			                    	</p>
			                    	<?php 
    _e('Ticket Image Caption', 'eventon');
    echo $eventon->throw_guide('Caption text that will appear under ticket image.', '', false);
    ?>
<br/><input style='width:100%; margin-top:5px'type='text' name='_tx_img_text' value='<?php 
    echo evo_meta($fmeta, '_tx_img_text');
    ?>
'/>
			                    </div>
							</td></tr>

						<?php 
    // inquire before buying
    $_allow_inquire = evo_meta_yesno($fmeta, '_allow_inquire', 'yes', 'yes', 'no');
    $_tx_inq_subject = !empty($fmeta['_tx_inq_subject']) ? $fmeta['_tx_inq_subject'][0] : (!empty($evoOpt['evotx_tix_inquiries_def_subject']) ? $evoOpt['evotx_tix_inquiries_def_subject'] : 'New Ticket Sale Inquery');
    $_tx_inq_email = !empty($fmeta['_tx_inq_email']) ? $fmeta['_tx_inq_email'][0] : (!empty($evoOpt['evotx_tix_inquiries_def_email']) ? $evoOpt['evotx_tix_inquiries_def_email'] : get_option('admin_email'));
    ?>
						<tr><td colspan='2'>
							<p class='yesno_leg_line ' >
								<?php 
    echo eventon_html_yesnobtn(array('id' => 'evotx_showinq', 'var' => $_allow_inquire, 'attr' => array('afterstatement' => 'evotx_show_inq')));
    ?>
								<input type='hidden' name='_allow_inquire' value="<?php 
    echo $_allow_inquire;
    ?>
"/>
								<label for='_allow_inquire'><?php 
    _e('Allow customers to submit inquiries.');
    echo $eventon->throw_guide('With this customers can submit inquiries via this form before buying tickets on front-end.', '', false);
    ?>
</label>
							</p>
						</td></tr>
						<tr id='evotx_show_inq' style='display:<?php 
    echo evo_meta_yesno($fmeta, '_allow_inquire', 'yes', '', 'none');
    ?>
'><td colspan='2'><?php 
    _e('Override Default Email Address to receive Inquiries', 'eventon');
    ?>
<br/>
							<input style='width:100%; margin-top:5px'type='text' name='_tx_inq_email' placeholder='<?php 
    echo $_tx_inq_email;
    ?>
' value='<?php 
    echo $_tx_inq_email;
    ?>
'/>
							<?php 
    _e('Override Default Subject for Inquiries Email', 'eventon');
    ?>
<br/>
							<input style='width:100%; margin-top:5px'type='text' name='_tx_inq_subject' placeholder='<?php 
    echo $_tx_inq_subject;
    ?>
' value='<?php 
    echo evo_meta($fmeta, '_tx_inq_subject');
    ?>
'/>
							<p style='padding-top:5px;opacity:0.6'><i><?php 
    _e('NOTE: Front-end fields for Inquiries form can be customized from', 'eventon');
    ?>
 <a style='color:#B3DDEC' href='<?php 
    echo admin_url();
    ?>
admin.php?page=eventon&tab=evcal_2'>EventON Languages</a></i></p>
						</td></tr>	
					</table>
					<?php 
    // DOWNLOAD CSV link
    $exportURL = add_query_arg(array('action' => 'the_ajax_evotx_a3', 'e_id' => $post->ID, 'pid' => $woo_product), admin_url('admin-ajax.php'));
    ?>

					<?php 
    if ($woo_product) {
        ?>
						<p class='actions'><a class='button_evo edit' href='<?php 
        echo get_edit_post_link($woo_product);
        ?>
'  title='<?php 
        _e('Further Edit', 'eventon');
        ?>
'></a></p>
					<?php 
    }
    ?>
					<div class='clear'></div>		
				</div>	

				<?php 
    echo $eventon->output_eventon_pop_window(array('class' => 'evotx_lightbox', 'content' => 'Loading...', 'title' => 'Event Attendees', 'type' => 'padded', 'max_height' => '500'));
    ?>

				<!-- Attendee section -->
					<?php 
    if (!empty($woometa['total_sales']) && $woometa['total_sales'] > 0) {
        ?>
					<div class='evoTX_metabox_attendee_other'>
						<p><?php 
        _e('Attendees for event', 'eventon');
        ?>
</p>
						<p class="actions">
							<a id='evotx_attendees' data-eid='<?php 
        echo $post->ID;
        ?>
' data-wcid='<?php 
        echo evo_meta($fmeta, 'tx_woocommerce_product_id');
        ?>
' data-popc='evotx_lightbox' class='button_evo attendees ajde_popup_trig' title='<?php 
        _e('View Attendees', 'eventon');
        ?>
'><?php 
        _e('View Attendees', 'eventon');
        ?>
</a><a class='button_evo download' href="<?php 
        echo $exportURL;
        ?>
"><?php 
        _e('Download (CSV)', 'eventon');
        ?>
</a>
						</p>

					</div>
					<?php 
    }
    ?>
			</div>			
		</div>
		</div>

		<?php 
    echo ob_get_clean();
}