/** Main meta box. */
function ajde_evcal_show_box()
{
    global $eventon, $ajde;
    $evcal_opt1 = get_option('evcal_options_evcal_1');
    $evcal_opt2 = get_option('evcal_options_evcal_2');
    // Use nonce for verification
    wp_nonce_field(plugin_basename(__FILE__), 'evo_noncename');
    // The actual fields for data entry
    $p_id = get_the_ID();
    $ev_vals = get_post_custom($p_id);
    $evcal_allday = !empty($ev_vals["evcal_allday"]) ? $ev_vals["evcal_allday"][0] : null;
    $show_style_code = $evcal_allday == 'yes' ? "style='display:none'" : null;
    $select_a_arr = array('AM', 'PM');
    // --- TIME variations
    $evcal_date_format = eventon_get_timeNdate_format($evcal_opt1);
    $time_hour_span = $evcal_date_format[2] ? 25 : 13;
    // GET DATE and TIME values
    $_START = !empty($ev_vals['evcal_srow'][0]) ? eventon_get_editevent_kaalaya($ev_vals['evcal_srow'][0], $evcal_date_format[1], $evcal_date_format[2]) : false;
    $_END = !empty($ev_vals['evcal_erow'][0]) ? eventon_get_editevent_kaalaya($ev_vals['evcal_erow'][0], $evcal_date_format[1], $evcal_date_format[2]) : false;
    //print_r($_START);
    //print_r($ev_vals);
    ?>


<?php 
    // --------------------------
    // HTML - Subtitle
    ob_start();
    ?>

			<div class='evcal_data_block_style1'>
				<div class='evcal_db_data'>
					<input type='text' id='evcal_subtitle' name='evcal_subtitle' value="<?php 
    echo evo_meta($ev_vals, 'evcal_subtitle', true);
    ?>
" style='width:100%'/>
				</div>
			</div>
		<?php 
    $_html_ST = ob_get_clean();
    $__hiddenVAL_ST = '';
    // --------------------------
    // HTML - date
    ob_start();
    ?>

		<!-- date and time formats to use -->
		<input type='hidden' name='_evo_date_format' value='<?php 
    echo $evcal_date_format[1];
    ?>
'/>
		<input type='hidden' name='_evo_time_format' value='<?php 
    echo $evcal_date_format[2] ? '24h' : '12h';
    ?>
'/>	
		<div id='evcal_dates' date_format='<?php 
    echo $evcal_date_format[0];
    ?>
'>	
			<p class='yesno_row evo fcw'>
				<?php 
    echo $ajde->wp_admin->html_yesnobtn(array('id' => 'evcal_allday_yn_btn', 'var' => $evcal_allday, 'attr' => array('allday_switch' => '1')));
    ?>
			
				<input type='hidden' name='evcal_allday' value="<?php 
    echo $evcal_allday == 'yes' ? 'yes' : 'no';
    ?>
"/>
				<label for='evcal_allday_yn_btn'><?php 
    _e('All Day Event', 'eventon');
    ?>
</label>
			</p>
			<p style='clear:both'></p>
			
			<!-- START TIME-->
			<div class='evo_start_event evo_datetimes'>
				<div class='evo_date'>
					<p id='evcal_start_date_label'><?php 
    _e('Event Start Date', 'eventon');
    ?>
</p>
					<input id='evo_dp_from' class='evcal_data_picker datapicker_on' type='text' id='evcal_start_date' name='evcal_start_date' value='<?php 
    echo $_START ? $_START[0] : null;
    ?>
' placeholder='<?php 
    echo $evcal_date_format[1];
    ?>
'/>					
					<span><?php 
    _e('Select a Date', 'eventon');
    ?>
</span>
				</div>					
				<div class='evcal_date_time switch_for_evsdate evcal_time_selector' <?php 
    echo $show_style_code;
    ?>
>
					<div class='evcal_select'>
						<select id='evcal_start_time_hour' class='evcal_date_select' name='evcal_start_time_hour'>
							<?php 
    //echo "<option value=''>--</option>";
    $start_time_h = $_START ? $_START[1] : null;
    for ($x = 1; $x < $time_hour_span; $x++) {
        $y = $time_hour_span == 25 ? sprintf("%02d", $x - 1) : $x;
        echo "<option value='{$y}'" . ($start_time_h == $y ? 'selected="selected"' : '') . ">{$y}</option>";
    }
    ?>

						</select>
					</div><p style='display:inline; font-size:24px;padding:4px 2px'>:</p>
					<div class='evcal_select'>						
						<select id='evcal_start_time_min' class='evcal_date_select' name='evcal_start_time_min'>
							<?php 
    //echo "<option value=''>--</option>";
    $start_time_m = $_START ? $_START[2] : null;
    for ($x = 0; $x < 12; $x++) {
        $min = $x < 2 ? '0' . $x * 5 : $x * 5;
        echo "<option value='{$min}'" . ($start_time_m == $min ? 'selected="selected"' : '') . ">{$min}</option>";
    }
    ?>

						</select>
					</div>
					
					<?php 
    if (!$evcal_date_format[2]) {
        ?>

					<div class='evcal_select evcal_ampm_sel'>
						<select name='evcal_st_ampm' id='evcal_st_ampm' >
							<?php 
        $evcal_st_ampm = $_START ? $_START[3] : null;
        foreach ($select_a_arr as $sar) {
            echo "<option value='" . $sar . "' " . ($evcal_st_ampm == $sar ? 'selected="selected"' : '') . ">" . $sar . "</option>";
        }
        ?>
								
						</select>
					</div>	
					<?php 
    }
    ?>

					<br/>
					<span><?php 
    _e('Select a Time', 'eventon');
    ?>
</span>
				</div><div class='clear'></div>
			</div>
			
			<!-- END TIME -->
			<?php 
    $evo_hide_endtime = !empty($ev_vals["evo_hide_endtime"]) ? $ev_vals["evo_hide_endtime"][0] : null;
    ?>

			<div class='evo_end_event evo_datetimes switch_for_evsdate'>
				<div class='evo_enddate_selection' style='<?php 
    echo $evo_hide_endtime == 'yes' ? 'opacity:0.5' : null;
    ?>
'>
				<div class='evo_date'>
					<p><?php 
    _e('Event End Date', 'eventon');
    ?>
</p>
					<input id='evo_dp_to' class='evcal_data_picker datapicker_on' type='text' id='evcal_end_date' name='evcal_end_date' value='<?php 
    echo $_END ? $_END[0] : null;
    ?>
'/>					
					<span><?php 
    _e('Select a Date', 'eventon');
    ?>
</span>					
				</div>
				<div class='evcal_date_time evcal_time_selector' <?php 
    echo $show_style_code;
    ?>
>
					<div class='evcal_select'>
						<select class='evcal_date_select' name='evcal_end_time_hour'>
							<?php 
    //echo "<option value=''>--</option>";
    $end_time_h = $_END ? $_END[1] : null;
    for ($x = 1; $x < $time_hour_span; $x++) {
        $y = $time_hour_span == 25 ? sprintf("%02d", $x - 1) : $x;
        echo "<option value='{$y}'" . ($end_time_h == $y ? 'selected="selected"' : '') . ">{$y}</option>";
    }
    ?>

						</select>
					</div><p style='display:inline; font-size:24px;padding:4px'>:</p>
					<div class='evcal_select'>
						<select class='evcal_date_select' name='evcal_end_time_min'>
							<?php 
    //echo "<option value=''>--</option>";
    $end_time_m = $_END[2] ? $_END[2] : null;
    for ($x = 0; $x < 12; $x++) {
        $min = $x < 2 ? '0' . $x * 5 : $x * 5;
        echo "<option value='{$min}'" . ($end_time_m == $min ? 'selected="selected"' : '') . ">{$min}</option>";
    }
    ?>

						</select>
					</div>					
					<?php 
    if (!$evcal_date_format[2]) {
        ?>

					<div class='evcal_select evcal_ampm_sel'>
						<select name='evcal_et_ampm'>
							<?php 
        $evcal_et_ampm = $_END ? $_END[3] : null;
        foreach ($select_a_arr as $sar) {
            echo "<option value='" . $sar . "' " . ($evcal_et_ampm == $sar ? 'selected="selected"' : '') . ">" . $sar . "</option>";
        }
        ?>
								
						</select>
					</div>
					<?php 
    }
    ?>

					<br/>
					<span><?php 
    _e('Select the Time', 'eventon');
    ?>
</span>
				</div><div class='clear'></div>
				</div>

				<!-- timezone value -->				
				<p style='padding-top:10px'><input type='text' name='evo_event_timezone' value='<?php 
    echo !empty($ev_vals["evo_event_timezone"]) ? $ev_vals["evo_event_timezone"][0] : null;
    ?>
' placeholder='<?php 
    _e('Timezone text eg.PST', 'eventon');
    ?>
'/><label for=""><?php 
    _e('Event timezone', 'eventon');
    $ajde->wp_admin->tooltips(__('Timezone text you type in here ex. PST will show next to event time on calendar.', 'eventon'), '', true);
    ?>
</label></p>
				
				
				<!-- end time yes/no option -->					
				<p class='yesno_row evo '>
					<?php 
    echo $ajde->wp_admin->html_yesnobtn(array('id' => 'evo_endtime', 'var' => $evo_hide_endtime, 'attr' => array('afterstatement' => 'evo_span_hidden_end')));
    ?>

					
					<input type='hidden' name='evo_hide_endtime' value="<?php 
    echo $evo_hide_endtime == 'yes' ? 'yes' : 'no';
    ?>
"/>
					<label for='evo_hide_endtime'><?php 
    _e('Hide End Time from calendar', 'eventon');
    ?>
</label>
				</p>
				<?php 
    // span event to hidden end time
    $evo_span_hidden_end = !empty($ev_vals["evo_span_hidden_end"]) ? $ev_vals["evo_span_hidden_end"][0] : null;
    $evo_span_hidd_display = $evo_hide_endtime && $evo_hide_endtime == 'yes' ? 'block' : 'none';
    ?>

				<p class='yesno_row evo ' id='evo_span_hidden_end' style='display:<?php 
    echo $evo_span_hidd_display;
    ?>
'>
					<?php 
    echo $ajde->wp_admin->html_yesnobtn(array('id' => 'evo_span_hidden_end', 'var' => $evo_span_hidden_end));
    ?>

					
					<input type='hidden' name='evo_span_hidden_end' value="<?php 
    echo $evo_span_hidden_end == 'yes' ? 'yes' : 'no';
    ?>
"/>
					<label for='evo_span_hidden_end'><?php 
    _e('Span the event until hidden end time', 'eventon');
    $ajde->wp_admin->tooltips(__('If event end time goes beyond start time +  and you want the event to show in the calendar until end time expire, select this.', 'eventon'), '', true);
    ?>
</label>
				</p>

				<?php 
    // Year long event
    $evo_year_long = !empty($ev_vals["evo_year_long"]) ? $ev_vals["evo_year_long"][0] : null;
    $event_year = !empty($ev_vals["event_year"]) ? $ev_vals["event_year"][0] : null;
    ?>

				<p class='yesno_row evo ' id='evo_year_long' >
					<?php 
    echo $ajde->wp_admin->html_yesnobtn(array('id' => 'evo_year_long', 'var' => $evo_year_long));
    ?>

					
					<input type='hidden' name='evo_year_long' value="<?php 
    echo $evo_year_long == 'yes' ? 'yes' : 'no';
    ?>
"/>					
					<label for='evo_year_long'><?php 
    _e('Show this event for the entire year', 'eventon');
    $ajde->wp_admin->tooltips(__('This will show this event on every month of the year. The year will be based off the start date you choose above', 'eventon'), '', true);
    ?>
</label>
				</p>
				<input id='evo_event_year' type='hidden' name='event_year' value="<?php 
    echo $event_year;
    ?>
"/>

				<p style='clear:both'></p>
			</div>
			<div style='clear:both'></div>			
			<?php 
    // Recurring events
    $evcal_repeat = !empty($ev_vals["evcal_repeat"]) ? $ev_vals["evcal_repeat"][0] : null;
    ?>

			<div id='evcal_rep' class='evd'>
				<div class='evcalr_1'>
					<p class='yesno_row evo '>
						<?php 
    echo $ajde->wp_admin->html_yesnobtn(array('id' => 'evd_repeat', 'var' => $evcal_repeat, 'attr' => array('afterstatement' => 'evo_editevent_repeatevents')));
    ?>
						
						<input type='hidden' name='evcal_repeat' value="<?php 
    echo $evcal_repeat == 'yes' ? 'yes' : 'no';
    ?>
"/>
						<label for='evcal_repeat'><?php 
    _e('Repeating event', 'eventon');
    ?>
</label>
					</p>
					<p style='clear:both'></p>
				</div>
				<p class='eventon_ev_post_set_line'></p>
				<?php 
    // initial values
    $display = !empty($ev_vals["evcal_repeat"]) && $evcal_repeat == 'yes' ? '' : 'none';
    // repeat frequency array
    $repeat_freq = apply_filters('evo_repeat_intervals', array('daily' => 'days', 'weekly' => 'weeks', 'monthly' => 'months', 'yearly' => 'years', 'custom' => 'custom'));
    $evcal_rep_gap = !empty($ev_vals['evcal_rep_gap']) ? $ev_vals['evcal_rep_gap'][0] : 1;
    $freq = !empty($ev_vals["evcal_rep_freq"]) ? $repeat_freq[$ev_vals["evcal_rep_freq"][0]] : null;
    ?>

				<div id='evo_editevent_repeatevents' class='evcalr_2 evo_repeat_options' style='display:<?php 
    echo $display;
    ?>
'>

					<p class='repeat_type evcalr_2_freq evcalr_2_p'><span class='evo_form_label'><?php 
    _e('Event Repeat Type', 'eventon');
    ?>
:</span> <select id='evcal_rep_freq' name='evcal_rep_freq'>
					<?php 
    $evcal_rep_freq = !empty($ev_vals['evcal_rep_freq']) ? $ev_vals['evcal_rep_freq'][0] : null;
    foreach ($repeat_freq as $refv => $ref) {
        echo "<option field='" . $ref . "' value='" . $refv . "' " . ($evcal_rep_freq == $refv ? 'selected="selected"' : '') . ">" . $refv . "</option>";
    }
    ?>
</select></p><!--.repeat_type-->
					
					<div class='evo_preset_repeat_settings' style='display:<?php 
    echo !empty($ev_vals['evcal_rep_freq']) && $ev_vals['evcal_rep_freq'][0] == 'custom' ? 'none' : 'block';
    ?>
'>		
						<p class='gap evcalr_2_rep evcalr_2_p'><span class='evo_form_label'><?php 
    _e('Gap between repeats', 'eventon');
    ?>
:</span>
						<input type='number' name='evcal_rep_gap' min='1' max='100' value='<?php 
    echo $evcal_rep_gap;
    ?>
' placeholder='1'/>	 <span id='evcal_re'><?php 
    echo $freq;
    ?>
</span></p>
					<?php 
    // repeat number
    $evcal_rep_num = !empty($ev_vals['evcal_rep_num']) ? $ev_vals['evcal_rep_num'][0] : 1;
    // repeat by
    $evp_repeat_rb = !empty($ev_vals['evp_repeat_rb']) ? $ev_vals['evp_repeat_rb'][0] : null;
    $evo_rep_WK = !empty($ev_vals['evo_rep_WK']) ? unserialize($ev_vals['evo_rep_WK'][0]) : array();
    $evo_repeat_wom = !empty($ev_vals['evo_repeat_wom']) ? $ev_vals['evo_repeat_wom'][0] : null;
    // display none section
    $__display_none_1 = !empty($ev_vals['evcal_rep_freq']) && $ev_vals['evcal_rep_freq'][0] == 'monthly' ? 'block' : 'none';
    $__display_none_2 = $__display_none_1 == 'block' && !empty($ev_vals['evp_repeat_rb']) && $ev_vals['evp_repeat_rb'][0] == 'dow' ? 'block' : 'none';
    ?>

						
					<?php 
    // monthly only
    ?>

						<p class='repeat_by evcalr_2_p evo_rep_month' style='display:<?php 
    echo $__display_none_1;
    ?>
'>
							<span class='evo_form_label'><?php 
    _e('Repeat by', 'eventon');
    ?>
:</span>
							<select id='evo_rep_by' name='evp_repeat_rb'>
								<option value='dom' <?php 
    echo 'dom' == $evp_repeat_rb ? 'selected="selected"' : null;
    ?>
><?php 
    _e('Day of the month', 'eventon');
    ?>
</option>
								<option value='dow' <?php 
    echo 'dow' == $evp_repeat_rb ? 'selected="selected"' : null;
    ?>
><?php 
    _e('Day of the week', 'eventon');
    ?>
</option>
							</select>
						</p>
						<p class='evo_days_list evo_rep_month_2'  style='display:<?php 
    echo $__display_none_2;
    ?>
'>
							<span class='evo_form_label'><?php 
    _e('Repeat on selected days', 'eventon');
    ?>
: </span>
							<?php 
    $days = array('S', 'M', 'T', 'W', 'T', 'F', 'S');
    for ($x = 0; $x < 7; $x++) {
        echo "<em><input type='checkbox' name='evo_rep_WK[]' value='{$x}' " . (in_array($x, $evo_rep_WK) ? 'checked="checked"' : null) . "><label>" . $days[$x] . "</label></em>";
    }
    ?>

						</p>
						<p class='evcalr_2_p evo_rep_month_2'  style='display:<?php 
    echo $__display_none_2;
    ?>
'>
							<span class='evo_form_label'><?php 
    _e('Week of month to repeat', 'eventon');
    ?>
: </span>
							<select id='evo_wom' name='evo_repeat_wom'>
								<option value='none' <?php 
    echo 'none' == $evo_repeat_wom ? 'selected="selected"' : null;
    ?>
><?php 
    _e('None', 'eventon');
    ?>
</option>
								<?php 
    for ($x = 0; $x < 7; $x++) {
        echo "<option value='{$x}' " . ($x == $evo_repeat_wom ? 'selected="selected"' : null) . ">{$x}</option>";
    }
    ?>

							</select>
						</p>
					
						<p class='evo_month_rep_value evo_rep_month_2' style='display:none'></p>
						
						<p class='evcalr_2_numr evcalr_2_p'><span class='evo_form_label'><?php 
    _e('Number of repeats', 'eventon');
    ?>
:</span>
							<input type='number' name='evcal_rep_num' min='1' value='<?php 
    echo $evcal_rep_num;
    ?>
' placeholder='1'/>						
						</p>
					</div><!--evo_preset_repeat_settings-->
					
					<!-- Custom repeat -->
					<div class='repeat_information' style='display:<?php 
    echo !empty($ev_vals['evcal_rep_freq']) && $ev_vals['evcal_rep_freq'][0] == 'custom' ? 'block' : 'none';
    ?>
'>
						<p><?php 
    _e('CUSTOM REPEAT TIMES', 'eventon');
    ?>
<br/><i style='opacity:0.7'><?php 
    _e('NOTE: Below repeat intervals are in addition to the above main event time.', 'eventon');
    ?>
</i></p>
						<?php 
    //print_r(unserialize($ev_vals['aaa'][0]));
    date_default_timezone_set('UTC');
    echo "<ul class='evo_custom_repeat_list'>";
    $count = 0;
    if (!empty($ev_vals['repeat_intervals'])) {
        $repeat_times = unserialize($ev_vals['repeat_intervals'][0]);
        // datre format sting to display for repeats
        $date_format_string = $evcal_date_format[1] . ' ' . ($evcal_date_format[2] ? 'G:i' : 'h:ia');
        foreach ($repeat_times as $rt) {
            echo '<li style="display:' . ($count == 0 || $count > 3 ? 'none' : 'block') . '" class="' . ($count == 0 ? 'initial' : '') . ($count > 3 ? ' over' : '') . '"><span>' . __('from', 'eventon') . '</span> ' . date($date_format_string, $rt[0]) . ' <span class="e">End</span> ' . date($date_format_string, $rt[1]) . '<em alt="Delete">x</em>
									<input type="hidden" name="repeat_intervals[' . $count . '][0]" value="' . $rt[0] . '"/><input type="hidden" name="repeat_intervals[' . $count . '][1]" value="' . $rt[1] . '"/></li>';
            $count++;
        }
    }
    echo "</ul>";
    echo $count > 3 && !empty($ev_vals['repeat_intervals']) ? "<p style='padding-bottom:20px'>There are " . ($count - 1) . " repeat intervals. <span class='evo_repeat_interval_view_all' data-show='no'>" . __('View All', 'eventon') . "</span></p>" : null;
    ?>

						<div class='evo_repeat_interval_new' style='display:none'>
							<p><span><?php 
    _e('FROM', 'eventon');
    ?>
:</span><input class='ristD' name='repeat_date'/> <input class='ristT' name='repeat_time'/><br/><span><?php 
    _e('TO', 'eventon');
    ?>
:</span><input class='rietD' name='repeat_date'/> <input class='rietT' name='repeat_time'/></p>
						</div>
						<p class='evo_repeat_interval_button'><a id='evo_add_repeat_interval' class='button_evo'>+ <?php 
    _e('Add New Repeat Interval', 'eventon');
    ?>
</a><span></span></p>
					</div>	
				</div>
			</div>	
		</div>
		
		<?php 
    $_html_TD = ob_get_clean();
    $__hiddenVAL_TD = '';
    // --------------------------
    // HTML - location
    ob_start();
    ?>

			<div class='evcal_data_block_style1'>
				<p class='edb_icon evcal_edb_map'></p>
				<div class='evcal_db_data'>			
					<p>
					<?php 
    // location terms for event post
    $loc_term_id = $termMeta = '';
    $location_terms = get_the_terms($p_id, 'event_location');
    if ($location_terms && !is_wp_error($location_terms)) {
        foreach ($location_terms as $location_term) {
            $loc_term_id = $location_term->term_id;
            $termMeta = get_option("taxonomy_{$loc_term_id}");
        }
    }
    //print_r($location_terms);
    // GET all available location terms
    $terms = get_terms('event_location', array('hide_empty' => false));
    if (count($terms) > 0) {
        echo "<select id='evcal_location_field' name='evcal_location_name_select' class='evo_select_field'>\r\r\n\t\t\t\t\t\t\t\t<option value=''>" . __('Select a saved location', 'eventon') . "</option>";
        foreach ($terms as $term) {
            $loc_img_src = $loc_img_id = '';
            $t_id = $term->term_id;
            $term_meta = get_option("taxonomy_{$t_id}");
            $__selected = $loc_term_id == $t_id ? "selected='selected'" : null;
            // location image
            $loc_img_id = !empty($term_meta['evo_loc_img']) ? $term_meta['evo_loc_img'] : null;
            $img_src = !empty($loc_img_id) ? wp_get_attachment_image_src($loc_img_id, 'medium') : false;
            $loc_img_src = $img_src ? $img_src[0] : '';
            echo "<option value='" . $term->name . "' data-tid='{$t_id}' data-address='" . (!empty($term_meta['location_address']) ? esc_attr($term_meta['location_address']) : '') . "' data-lat='" . (!empty($term_meta['location_lat']) ? esc_attr($term_meta['location_lat']) : '') . "' data-lon='" . (!empty($term_meta['location_lon']) ? esc_attr($term_meta['location_lon']) : '') . "' {$__selected} data-loc_img_id='" . $loc_img_id . "' data-loc_img_src='{$loc_img_src}'>" . $term->name . "</option>";
        }
        echo "</select> <label for='evcal_location_field'>" . __('Choose already saved location or type new one below', 'eventon') . "</label>";
    }
    ?>

					<input id='evo_location_tax' type='hidden' name='evo_location_tax_id' value='<?php 
    echo $loc_term_id;
    ?>
'/>
					<input type='text' id='evcal_location_name' name='evcal_location_name' value="<?php 
    echo evo_meta($ev_vals, 'evcal_location_name', true);
    ?>
" style='width:100%' placeholder='<?php 
    _e('eg. Irving City Park', 'eventon');
    ?>
'/><label for='evcal_location_name'><?php 
    _e('Event Location Name', 'eventon');
    ?>
</label></p>
					<p><input type='text' id='evcal_location' name='evcal_location' value="<?php 
    echo evo_meta($ev_vals, 'evcal_location', true);
    ?>
" style='width:100%' placeholder='<?php 
    _e('eg. 12 Rue de Rivoli, Paris', 'eventon');
    ?>
'/><label for='evcal_location'><?php 
    _e('Event Location Address', 'eventon');
    ?>
</label></p>
					
					
					<p><input type='text' id='evcal_lat' class='evcal_latlon' name='evcal_lat' value='<?php 
    echo evo_meta($ev_vals, 'evcal_lat');
    ?>
' placeholder='<?php 
    _e('Latitude', 'eventon');
    ?>
'/>
					<input type='text' id='evcal_lon' class='evcal_latlon' name='evcal_lon' value='<?php 
    echo evo_meta($ev_vals, 'evcal_lon');
    ?>
' placeholder='<?php 
    _e('Longitude', 'eventon');
    ?>
'/></p>
					<p><i><?php 
    _e('NOTE: If Latlon provided, Latlon will be used for generating google maps while location address will be shown as text address. <br/>Location address field is <b>REQUIRED</b> for this to work.', 'eventon');
    ?>
 <a style='color:#B3DDEC' href='http://itouchmap.com/latlong.html' target='_blank'><?php 
    _e('Find LanLat for address', 'eventon');
    ?>
</a></i></p>

					<!-- image -->
					<?php 
    $loc_img_id = !empty($ev_vals['evo_loc_img']) ? $ev_vals['evo_loc_img'][0] : false;
    // image soruce array
    $img_src = $loc_img_id ? wp_get_attachment_image_src($loc_img_id, 'medium') : null;
    $loc_img_src = !empty($img_src) ? $img_src[0] : null;
    $__button_text = !empty($loc_img_id) ? __('Remove Image', 'eventon') : __('Choose Image', 'eventon');
    $__button_text_not = empty($loc_img_id) ? __('Remove Image', 'eventon') : __('Choose Image', 'eventon');
    $__button_class = !empty($loc_img_id) ? 'removeimg' : 'chooseimg';
    // /echo $loc_img_id.' '.$img_src.'66';
    ?>

					<div class='evo_metafield_image' style='padding-top:10px'>						
						<p >
							<input id='evo_loc_img_id' class='evo_loc_img custom_upload_image evo_meta_img' name="evo_loc_img" type="hidden" value="<?php 
    echo $loc_img_id ? $loc_img_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 $loc_img_src;
    ?>
' style='<?php 
    echo !empty($loc_img_id) ? '' : 'display:none';
    ?>
'/>
                    		</span>
                    		<label><?php 
    _e('Event Location Image', 'eventon');
    ?>
</label>
                    	</p>
                    </div>
					
					<!-- HIDE google map option -->
					<p class='yesno_row evo'>
						<?php 
    $location_val = !empty($ev_vals["evcal_gmap_gen"]) ? $ev_vals["evcal_gmap_gen"][0] : 'yes';
    echo $ajde->wp_admin->html_yesnobtn(array('id' => 'evo_genGmap', 'var' => $location_val));
    ?>

						
						<input type='hidden' name='evcal_gmap_gen' value="<?php 
    echo !empty($ev_vals["evcal_gmap_gen"]) && $ev_vals["evcal_gmap_gen"][0] == 'yes' ? 'yes' : (empty($ev_vals["evcal_gmap_gen"]) ? 'yes' : 'no');
    ?>
"/>
						<label for='evcal_gmap_gen'><?php 
    _e('Generate Google Map from the address', 'eventon');
    ?>
</label>
					</p>
					<p style='clear:both'></p>

					<!-- Show location name over image -->
					<p class='yesno_row evo'>
						<?php 
    $evcal_name_over_img = !empty($ev_vals["evcal_name_over_img"]) ? $ev_vals["evcal_name_over_img"][0] : 'no';
    echo $ajde->wp_admin->html_yesnobtn(array('id' => 'evcal_name_over_img', 'var' => $evcal_name_over_img));
    ?>

						
						<input type='hidden' name='evcal_name_over_img' value="<?php 
    echo !empty($ev_vals["evcal_name_over_img"]) && $ev_vals["evcal_name_over_img"][0] == 'yes' ? 'yes' : 'no';
    ?>
"/>
						<label for='evcal_name_over_img'><?php 
    _e('Show location name & address over location image (If location image exist)', 'eventon');
    ?>
</label>
					</p>
					<p style='clear:both'></p>
				</div>
			</div>
		<?php 
    $_html_LOC = ob_get_clean();
    $__hiddenVAL_LOC = '';
    // --------------------------
    // HTML - Organizer
    ob_start();
    ?>

			<div class='evcal_data_block_style1'>
				<p class='edb_icon evcal_edb_map'></p>
				<div class='evcal_db_data'>			
					<p>
					<?php 
    // organier terms for event post
    $organizer_terms = get_the_terms($p_id, 'event_organizer');
    $termMeta = $org_term_id = '';
    if ($organizer_terms && !is_wp_error($organizer_terms)) {
        foreach ($organizer_terms as $org_term) {
            $org_term_id = $org_term->term_id;
            $termMeta = get_option("taxonomy_{$org_term_id}");
        }
    }
    // Get all available organizer terms
    $terms = get_terms('event_organizer', array('hide_empty' => false));
    if (count($terms) > 0) {
        echo "<select id='evcal_organizer_field' name='evcal_organizer_name_select' class='evo_select_field'>\r\r\n\t\t\t\t\t\t\t\t<option value=''>" . __('Select a saved organizer', 'eventon') . "</option>";
        foreach ($terms as $term) {
            $ORG_imgid = $ORG_imgsrc = '';
            $t_id = $term->term_id;
            $term_meta = get_option("taxonomy_{$t_id}");
            $__selected = $org_term_id == $t_id ? "selected='selected'" : null;
            // organizer image
            $ORG_imgid = !empty($term_meta['evo_org_img']) ? $term_meta['evo_org_img'] : null;
            $img_src = !empty($ORG_imgid) ? wp_get_attachment_image_src($ORG_imgid, 'medium') : false;
            $ORG_imgsrc = $img_src ? $img_src[0] : '';
            echo "<option value='" . $term->name . "' data-tid='{$t_id}' data-contact='" . (!empty($term_meta['evcal_org_contact']) ? esc_attr($term_meta['evcal_org_contact']) : '') . "' data-img='" . (!empty($term_meta['evo_org_img']) ? esc_attr($term_meta['evo_org_img']) : '') . "' {$__selected} data-imgsrc='{$ORG_imgsrc}' data-exlink='" . (!empty($term_meta['evcal_org_exlink']) ? esc_attr($term_meta['evcal_org_exlink']) : '') . "'>" . $term->name . "</option>";
        }
        echo "</select> <label for='evcal_organizer_field'>" . __('Choose already saved organizer or type new one below. NOTE: if you retype an existing organizer it will replace old information for that saved organizer', 'eventon') . "</label>";
    }
    ?>

					<input id='evo_organizer_tax_id' type='hidden' name='evo_organizer_tax_id' value='<?php 
    echo $org_term_id;
    ?>
'/>
					<input type='text' id='evcal_organizer_name' name='evcal_organizer' value="<?php 
    echo !empty($ev_vals["evcal_organizer"]) ? $ev_vals["evcal_organizer"][0] : null;
    ?>
" style='width:100%' placeholder='<?php 
    _e('eg. Blue Light Band', 'eventon');
    ?>
'/><label for='evcal_organizer'><?php 
    _e('Event Organizer Name', 'eventon');
    ?>
</label></p>
					<?php 
    $organizer_contact_info = !empty($termMeta["evcal_org_contact"]) ? $termMeta["evcal_org_contact"] : (!empty($ev_vals['evcal_org_contact']) ? $ev_vals['evcal_org_contact'][0] : false);
    $organizer_contact_info = $organizer_contact_info ? stripslashes(str_replace('"', "'", $organizer_contact_info)) : null;
    ?>

					<p><input type='text' id='evcal_org_contact' name='evcal_org_contact' value="<?php 
    echo $organizer_contact_info;
    ?>
" style='width:100%' placeholder='<?php 
    _e('eg. noone[at] thismail.com', 'eventon');
    ?>
'/><label for='evcal_org_contact'><?php 
    _e('(Optional) Organizer Contact Information', 'eventon');
    ?>
</label></p>

					<?php 
    // organizer external link
    $organizer_exlink = !empty($termMeta["evcal_org_exlink"]) ? $termMeta["evcal_org_exlink"] : (!empty($ev_vals['evcal_org_exlink']) ? $ev_vals['evcal_org_exlink'][0] : false);
    ?>

					<p><input type='text' id='evcal_org_exlink' name='evcal_org_exlink' value="<?php 
    echo $organizer_exlink;
    ?>
" style='width:100%' placeholder='<?php 
    _e('eg. http://www.mysite.com/user', 'eventon');
    ?>
'/><label for='evcal_org_exlink'><?php 
    _e('Link to the organizers page', 'eventon');
    ?>
</label></p>
					
					<!-- image -->
					<?php 
    $org_img_id = !empty($ev_vals['evo_org_img']) ? $ev_vals['evo_org_img'][0] : false;
    // image soruce array
    $img_src = $org_img_id ? wp_get_attachment_image_src($org_img_id, 'medium') : null;
    $org_img_src = !empty($img_src) ? $img_src[0] : null;
    $__button_text = !empty($org_img_id) ? __('Remove Image', 'eventon') : __('Choose Image', 'eventon');
    $__button_text_not = empty($org_img_id) ? __('Remove Image', 'eventon') : __('Choose Image', 'eventon');
    $__button_class = !empty($org_img_id) ? 'removeimg' : 'chooseimg';
    // /echo $loc_img_id.' '.$img_src.'66';
    ?>

					<div class='evo_metafield_image' style='padding-top:10px'>
						<p>
							<input id='evo_org_img_id' class='evo_org_img custom_upload_image evo_meta_img' name="evo_org_img" type="hidden" value="<?php 
    echo $org_img_id ? $org_img_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_org_image_src image_src'>
                    			<img src='<?php 
    echo $org_img_src;
    ?>
' style='<?php 
    echo !empty($org_img_id) ? '' : 'display:none;';
    ?>
 margin-top:8px'/>
                    		</span>
                    		<label><?php 
    _e('Event Organizer Image', 'eventon');
    ?>
 (<?php 
    _e('Recommended Resolution 80x80px', 'eventon');
    ?>
)</label>
                    	</p>
                    </div>
					
					<!-- yea no field - hide organizer field from eventcard -->
					<p class='yesno_row evo'>
						<?php 
    $evo_evcrd_field_org = !empty($ev_vals["evo_evcrd_field_org"]) ? $ev_vals["evo_evcrd_field_org"][0] : null;
    echo $ajde->wp_admin->html_yesnobtn(array('id' => 'evo_org_field_ec', 'var' => $evo_evcrd_field_org));
    ?>

						
						<input type='hidden' name='evo_evcrd_field_org' value="<?php 
    echo !empty($ev_vals["evo_evcrd_field_org"]) && $ev_vals["evo_evcrd_field_org"][0] == 'yes' ? 'yes' : 'no';
    ?>
"/>
						<label for='evo_evcrd_field_org'><?php 
    _e('Hide Organizer field from EventCard', 'eventon');
    ?>
</label>
					</p>
					<p style='clear:both'></p>
				</div>
			</div>

		<?php 
    $_html_OR = ob_get_clean();
    $__hiddenVAL_OR = '';
    // --------------------------
    // HTML - User Interaction
    ob_start();
    ?>

			<div class='evcal_data_block_style1'>
				<div class='evcal_db_data'>
					
					<?php 
    $exlink_option = !empty($ev_vals["_evcal_exlink_option"]) ? $ev_vals["_evcal_exlink_option"][0] : 1;
    $exlink_target = !empty($ev_vals["_evcal_exlink_target"]) && $ev_vals["_evcal_exlink_target"][0] == 'yes' ? $ev_vals["_evcal_exlink_target"][0] : null;
    //echo $ev_vals["_evcal_exlink_target"][0].'tt';
    ?>

					
					<input id='evcal_exlink_option' type='hidden' name='_evcal_exlink_option' value='<?php 
    echo $exlink_option;
    ?>
'/>
					
					<input id='evcal_exlink_target' type='hidden' name='_evcal_exlink_target' value='<?php 
    echo $exlink_target;
    ?>
'/>
					
					<?php 
    $display_link_input = !empty($ev_vals["_evcal_exlink_option"]) && $ev_vals["_evcal_exlink_option"][0] != '1' ? 'display:block' : 'display:none';
    ?>

					<p <?php 
    echo $exlink_option == '1' || $exlink_option == '3' ? "style='display:none'" : null;
    ?>
 id='evo_new_window_io' class='<?php 
    echo $exlink_target == 'yes' ? 'selected' : null;
    ?>
'><span></span> <?php 
    _e('Open in new window', 'eventon');
    ?>
</p>
					
					<!-- external link field-->
					<input id='evcal_exlink' placeholder='<?php 
    _e('Type the URL address', 'eventon');
    ?>
' type='text' name='evcal_exlink' value='<?php 
    echo !empty($ev_vals["evcal_exlink"]) ? $ev_vals["evcal_exlink"][0] : null;
    ?>
' style='width:100%; <?php 
    echo $display_link_input;
    ?>
'/>
					
					<div class='evcal_db_uis'>
						<a link='no'  class='evcal_db_ui evcal_db_ui_1 <?php 
    echo $exlink_option == '1' ? 'selected' : null;
    ?>
' title='<?php 
    _e('Slide Down Event Card', 'eventon');
    ?>
' value='1'></a>
						
						<!-- open as link-->
						<a link='yes' class='evcal_db_ui evcal_db_ui_2 <?php 
    echo $exlink_option == '2' ? 'selected' : null;
    ?>
' title='<?php 
    _e('External Link', 'eventon');
    ?>
' value='2'></a>	
						
						<!-- open as popup -->
						<a link='yes' class='evcal_db_ui evcal_db_ui_3 <?php 
    echo $exlink_option == '3' ? ' selected' : null;
    ?>
' title='<?php 
    _e('Popup Window', 'eventon');
    ?>
' value='3'></a>
						
						<?php 
    // (-- addon --)
    if (has_action('evcal_ui_click_additions')) {
        do_action('evcal_ui_click_additions');
    }
    ?>
							
						<div class='clear'></div>
					</div>
				</div>
			</div>
		<?php 
    $_html_UIN = ob_get_clean();
    $__hiddenVAL_UIN = '';
    // --------------------------
    // HTML - Learn More
    ob_start();
    ?>

			<div class='evcal_data_block_style1'>
				<div class='evcal_db_data'>
					<input type='text' id='evcal_lmlink' name='evcal_lmlink' value='<?php 
    echo !empty($ev_vals["evcal_lmlink"]) ? $ev_vals["evcal_lmlink"][0] : null;
    ?>
' style='width:100%'/><br/>
					<input type='checkbox' name='evcal_lmlink_target' value='yes' <?php 
    echo !empty($ev_vals["evcal_lmlink_target"]) && $ev_vals["evcal_lmlink_target"][0] == 'yes' ? 'checked="checked"' : null;
    ?>
/> <?php 
    _e('Open in New window', 'eventon');
    ?>

				</div>
			</div>
		<?php 
    $_html_LM = ob_get_clean();
    $__hiddenVAL_LM = '';
    /** custom fields **/
    $evMB_custom = array();
    $num = evo_calculate_cmd_count($evcal_opt1);
    for ($x = 1; $x <= $num; $x++) {
        if (eventon_is_custom_meta_field_good($x)) {
            // initial values
            $fa_icon_class = $evcal_opt1['evcal__fai_00c' . $x];
            $visibility_type = !empty($evcal_opt1['evcal_ec_f' . $x . 'a4']) ? $evcal_opt1['evcal_ec_f' . $x . 'a4'] : 'all';
            ob_start();
            echo "<div class='evcal_data_block_style1'>\r\r\n\t\t\t\t\t\t<div class='evcal_db_data'>";
            // FIELD
            $__saved_field_value = !empty($ev_vals["_evcal_ec_f" . $x . "a1_cus"]) ? $ev_vals["_evcal_ec_f" . $x . "a1_cus"][0] : null;
            $__field_id = '_evcal_ec_f' . $x . 'a1_cus';
            // wysiwyg editor
            if (!empty($evcal_opt1['evcal_ec_f' . $x . 'a2']) && $evcal_opt1['evcal_ec_f' . $x . 'a2'] == 'textarea') {
                wp_editor($__saved_field_value, $__field_id);
                // button
            } elseif (!empty($evcal_opt1['evcal_ec_f' . $x . 'a2']) && $evcal_opt1['evcal_ec_f' . $x . 'a2'] == 'button') {
                $__saved_field_link = !empty($ev_vals["_evcal_ec_f" . $x . "a1_cusL"]) ? $ev_vals["_evcal_ec_f" . $x . "a1_cusL"][0] : null;
                echo "<input type='text' id='" . $__field_id . "' name='_evcal_ec_f" . $x . "a1_cus' ";
                echo 'value="' . $__saved_field_value . '"';
                echo "style='width:100%' placeholder='Button Text' title='Button Text'/>";
                echo "<input type='text' id='" . $__field_id . "' name='_evcal_ec_f" . $x . "a1_cusL' ";
                echo 'value="' . $__saved_field_link . '"';
                echo "style='width:100%' placeholder='Button Link' title='Button Link'/>";
                $onw = !empty($ev_vals["_evcal_ec_f" . $x . "_onw"]) ? $ev_vals["_evcal_ec_f" . $x . "_onw"][0] : null;
                ?>

						<input type='checkbox' name='_evcal_ec_f<?php 
                echo $x;
                ?>
_onw' value='yes' <?php 
                echo !empty($onw) && $onw == 'yes' ? 'checked="checked"' : null;
                ?>
/> <?php 
                _e('Open in New window', 'eventon');
                ?>

						<?php 
                // text
            } else {
                echo "<input type='text' id='" . $__field_id . "' name='_evcal_ec_f" . $x . "a1_cus' ";
                echo 'value="' . $__saved_field_value . '"';
                echo "style='width:100%'/>";
            }
            echo "</div></div>";
            $__html = ob_get_clean();
            $evMB_custom[] = array('id' => 'evcal_ec_f' . $x . 'a1', 'variation' => 'customfield', 'name' => $evcal_opt1['evcal_ec_f' . $x . 'a1'], 'iconURL' => $fa_icon_class, 'iconPOS' => '', 'visibility_type' => $visibility_type, 'type' => 'code', 'content' => $__html, 'slug' => 'evcal_ec_f' . $x . 'a1');
        }
        // end if
    }
    // end foreach
    // array of all meta boxes
    $metabox_array = apply_filters('eventon_event_metaboxs', array(array('id' => 'ev_subtitle', 'name' => __('Event SubTitle', 'eventon'), 'variation' => 'customfield', 'hiddenVal' => $__hiddenVAL_ST, 'iconURL' => 'fa-pencil', 'iconPOS' => '', 'type' => 'code', 'content' => $_html_ST, 'slug' => 'ev_subtitle'), array('id' => 'ev_timedate', 'name' => __('Time and Date', 'eventon'), 'hiddenVal' => $__hiddenVAL_TD, 'iconURL' => 'fa-clock-o', 'variation' => 'customfield', 'iconPOS' => '', 'type' => 'code', 'content' => $_html_TD, 'slug' => 'ev_timedate'), array('id' => 'ev_location', 'name' => __('Location and Venue', 'eventon'), 'hiddenVal' => $__hiddenVAL_LOC, 'iconURL' => 'fa-map-marker', 'variation' => 'customfield', 'iconPOS' => '', 'type' => 'code', 'content' => $_html_LOC, 'slug' => 'ev_location', 'guide' => ''), array('id' => 'ev_organizer', 'name' => __('Organizer', 'eventon'), 'hiddenVal' => $__hiddenVAL_OR, 'iconURL' => 'fa-microphone', 'variation' => 'customfield', 'iconPOS' => '', 'type' => 'code', 'content' => $_html_OR, 'slug' => 'ev_organizer'), array('id' => 'ev_uint', 'name' => __('User Interaction for event click', 'eventon'), 'hiddenVal' => $__hiddenVAL_UIN, 'iconURL' => 'fa-street-view', 'variation' => 'customfield', 'iconPOS' => '', 'type' => 'code', 'content' => $_html_UIN, 'slug' => 'ev_uint', 'guide' => 'This define how you want the events to expand following a click on the eventTop by a user'), array('id' => 'ev_learnmore', 'name' => __('Learn more about event link', 'eventon'), 'hiddenVal' => $__hiddenVAL_LM, 'iconURL' => 'fa-random', 'variation' => 'customfield', 'iconPOS' => '', 'type' => 'code', 'content' => $_html_LM, 'slug' => 'ev_learnmore', 'guide' => 'This will create a learn more link in the event card. Make sure your links start with http://')));
    // combine array with custom fields
    $metabox_array = !empty($evMB_custom) && count($evMB_custom) > 0 ? array_merge($metabox_array, $evMB_custom) : $metabox_array;
    $closedmeta = eventon_get_collapse_metaboxes($p_id);
    //print_r($closedmeta);
    ?>
	
	
	<div id='evo_mb' class='eventon_mb'>
		<input type='hidden' id='evo_collapse_meta_boxes' name='evo_collapse_meta_boxes' value=''/>
	<?php 
    // initial values
    $visibility_types = array('all' => __('Everyone', 'eventon'), 'admin' => __('Admin Only', 'eventon'), 'loggedin' => __('Loggedin Users Only', 'eventon'));
    // FOREACH metabox item
    foreach ($metabox_array as $mBOX) {
        // ICONS
        $icon_style = !empty($mBOX['iconURL']) ? 'background-image:url(' . $mBOX['iconURL'] . ')' : 'background-position:' . $mBOX['iconPOS'];
        $icon_class = !empty($mBOX['iconPOS']) ? 'evIcons' : 'evII';
        $guide = !empty($mBOX['guide']) ? $ajde->wp_admin->tooltips($mBOX['guide']) : null;
        $hiddenVal = !empty($mBOX['hiddenVal']) ? '<span class="hiddenVal">' . $mBOX['hiddenVal'] . '</span>' : null;
        // visibility type ONLY for custom meta fields
        $visibility_type = !empty($mBOX['visibility_type']) ? "<span class='visibility_type'>" . __('Visibility Type:', 'eventon') . ' ' . $visibility_types[$mBOX['visibility_type']] . '</span>' : false;
        $closed = !empty($closedmeta) && in_array($mBOX['id'], $closedmeta) ? 'closed' : null;
        ?>

		<div class='evomb_section' id='<?php 
        echo $mBOX['id'];
        ?>
'>			
			<div class='evomb_header'>
				<?php 
        // custom field with icons
        if (!empty($mBOX['variation']) && $mBOX['variation'] == 'customfield') {
            ?>
	
					<span class='evomb_icon <?php 
            echo $icon_class;
            ?>
'><i class='fa <?php 
            echo $mBOX['iconURL'];
            ?>
'></i></span>
					
				<?php 
        } else {
            ?>

					<span class='evomb_icon <?php 
            echo $icon_class;
            ?>
' style='<?php 
            echo $icon_style;
            ?>
'></span>
				<?php 
        }
        ?>

				<p><?php 
        echo $mBOX['name'];
        echo $hiddenVal;
        echo $guide;
        echo $visibility_type;
        ?>
</p>
			</div>
			<div class='evomb_body <?php 
        echo $closed;
        ?>
' box_id='<?php 
        echo $mBOX['id'];
        ?>
'>
				<?php 
        echo $mBOX['content'];
        ?>

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

		<div class='evMB_end'></div>
	</div>

<?php 
}
Beispiel #2
0
    function ajde_evcal_show_box()
    {
        global $eventon, $ajde, $post;
        $evcal_opt1 = get_option('evcal_options_evcal_1');
        $evcal_opt2 = get_option('evcal_options_evcal_2');
        // Use nonce for verification
        wp_nonce_field(plugin_basename(__FILE__), 'evo_noncename');
        // The actual fields for data entry
        $p_id = get_the_ID();
        $ev_vals = get_post_custom($p_id);
        $evcal_allday = !empty($ev_vals["evcal_allday"]) ? $ev_vals["evcal_allday"][0] : null;
        $show_style_code = $evcal_allday == 'yes' ? "style='display:none'" : null;
        $select_a_arr = array('AM', 'PM');
        // array of all meta boxes
        $metabox_array = apply_filters('eventon_event_metaboxs', array(array('id' => 'ev_subtitle', 'name' => __('Event SubTitle', 'eventon'), 'variation' => 'customfield', 'hiddenVal' => '', 'iconURL' => 'fa-pencil', 'iconPOS' => '', 'type' => 'code', 'content' => '', 'slug' => 'ev_subtitle'), array('id' => 'ev_timedate', 'name' => __('Time and Date', 'eventon'), 'hiddenVal' => '', 'iconURL' => 'fa-clock-o', 'variation' => 'customfield', 'iconPOS' => '', 'type' => 'code', 'content' => '', 'slug' => 'ev_timedate'), array('id' => 'ev_location', 'name' => __('Location and Venue', 'eventon'), 'hiddenVal' => '', 'iconURL' => 'fa-map-marker', 'variation' => 'customfield', 'iconPOS' => '', 'type' => 'code', 'content' => '', 'slug' => 'ev_location', 'guide' => ''), array('id' => 'ev_organizer', 'name' => __('Organizer', 'eventon'), 'hiddenVal' => '', 'iconURL' => 'fa-microphone', 'variation' => 'customfield', 'iconPOS' => '', 'type' => 'code', 'content' => '', 'slug' => 'ev_organizer'), array('id' => 'ev_uint', 'name' => __('User Interaction for event click', 'eventon'), 'hiddenVal' => '', 'iconURL' => 'fa-street-view', 'variation' => 'customfield', 'iconPOS' => '', 'type' => 'code', 'content' => '', 'slug' => 'ev_uint', 'guide' => 'This define how you want the events to expand following a click on the eventTop by a user'), array('id' => 'ev_learnmore', 'name' => __('Learn more about event link', 'eventon'), 'hiddenVal' => '', 'iconURL' => 'fa-random', 'variation' => 'customfield', 'iconPOS' => '', 'type' => 'code', 'content' => '', 'slug' => 'ev_learnmore', 'guide' => 'This will create a learn more link in the event card. Make sure your links start with http://')));
        // Custom Meta fields for events
        $num = evo_calculate_cmd_count($evcal_opt1);
        for ($x = 1; $x <= $num; $x++) {
            if (!eventon_is_custom_meta_field_good($x)) {
                continue;
            }
            $fa_icon_class = $evcal_opt1['evcal__fai_00c' . $x];
            $visibility_type = !empty($evcal_opt1['evcal_ec_f' . $x . 'a4']) ? $evcal_opt1['evcal_ec_f' . $x . 'a4'] : 'all';
            $metabox_array[] = array('id' => 'evcal_ec_f' . $x . 'a1', 'variation' => 'customfield', 'name' => $evcal_opt1['evcal_ec_f' . $x . 'a1'], 'iconURL' => $fa_icon_class, 'iconPOS' => '', 'fieldtype' => 'custommetafield', 'x' => $x, 'visibility_type' => $visibility_type, 'type' => 'code', 'content' => '', 'slug' => 'evcal_ec_f' . $x . 'a1');
        }
        // combine array with custom fields
        // $metabox_array = (!empty($evMB_custom) && count($evMB_custom)>0)? array_merge($metabox_array , $evMB_custom): $metabox_array;
        $closedmeta = eventon_get_collapse_metaboxes($p_id);
        //print_r($closedmeta);
        ?>
	
		
		<div id='evo_mb' class='eventon_mb'>
			<input type='hidden' id='evo_collapse_meta_boxes' name='evo_collapse_meta_boxes' value=''/>
		<?php 
        // initial values
        $visibility_types = array('all' => __('Everyone', 'eventon'), 'admin' => __('Admin Only', 'eventon'), 'loggedin' => __('Loggedin Users Only', 'eventon'));
        // FOREACH metabox item
        foreach ($metabox_array as $mBOX) {
            // initials
            $icon_style = !empty($mBOX['iconURL']) ? 'background-image:url(' . $mBOX['iconURL'] . ')' : 'background-position:' . $mBOX['iconPOS'];
            $icon_class = !empty($mBOX['iconPOS']) ? 'evIcons' : 'evII';
            $guide = !empty($mBOX['guide']) ? $ajde->wp_admin->tooltips($mBOX['guide']) : null;
            $hiddenVal = !empty($mBOX['hiddenVal']) ? '<span class="hiddenVal">' . $mBOX['hiddenVal'] . '</span>' : null;
            // visibility type ONLY for custom meta fields
            $visibility_type = !empty($mBOX['visibility_type']) ? "<span class='visibility_type'>" . __('Visibility Type:', 'eventon') . ' ' . $visibility_types[$mBOX['visibility_type']] . '</span>' : false;
            $closed = !empty($closedmeta) && in_array($mBOX['id'], $closedmeta) ? 'closed' : null;
            ?>
			<div class='evomb_section' id='<?php 
            echo $mBOX['id'];
            ?>
'>			
				<div class='evomb_header'>
					<?php 
            // custom field with icons
            if (!empty($mBOX['variation']) && $mBOX['variation'] == 'customfield') {
                ?>
	
						<span class='evomb_icon <?php 
                echo $icon_class;
                ?>
'><i class='fa <?php 
                echo $mBOX['iconURL'];
                ?>
'></i></span>
						
					<?php 
            } else {
                ?>
						<span class='evomb_icon <?php 
                echo $icon_class;
                ?>
' style='<?php 
                echo $icon_style;
                ?>
'></span>
					<?php 
            }
            ?>
					<p><?php 
            echo $mBOX['name'];
            echo $hiddenVal;
            echo $guide;
            echo $visibility_type;
            ?>
</p>
				</div>
				<div class='evomb_body <?php 
            echo $closed;
            ?>
' box_id='<?php 
            echo $mBOX['id'];
            ?>
'>
				<?php 
            if (!empty($mBOX['content'])) {
                echo $mBOX['content'];
            } else {
                switch ($mBOX['id']) {
                    case 'ev_learnmore':
                        echo "<div class='evcal_data_block_style1'>\r\n\t\t\t\t\t\t\t<div class='evcal_db_data'>\r\n\t\t\t\t\t\t\t\t<input type='text' id='evcal_lmlink' name='evcal_lmlink' value='" . (!empty($ev_vals["evcal_lmlink"]) ? $ev_vals["evcal_lmlink"][0] : null) . "' style='width:100%'/><br/>";
                        ?>
								<span class='yesno_row evo'>
									<?php 
                        $openInNewWindow = !empty($ev_vals["evcal_lmlink_target"]) ? $ev_vals["evcal_lmlink_target"][0] : null;
                        echo $ajde->wp_admin->html_yesnobtn(array('id' => 'evcal_lmlink_target', 'var' => $openInNewWindow, 'input' => true, 'label' => __('Open in New window', 'eventon')));
                        ?>
											
								</span>

							<?php 
                        echo "</div></div>";
                        break;
                    case 'ev_uint':
                        ?>
							<div class='evcal_data_block_style1'>
								<div class='evcal_db_data'>										
									<?php 
                        $exlink_option = !empty($ev_vals["_evcal_exlink_option"]) ? $ev_vals["_evcal_exlink_option"][0] : 1;
                        $exlink_target = !empty($ev_vals["_evcal_exlink_target"]) && $ev_vals["_evcal_exlink_target"][0] == 'yes' ? $ev_vals["_evcal_exlink_target"][0] : null;
                        ?>
										
									<input id='evcal_exlink_option' type='hidden' name='_evcal_exlink_option' value='<?php 
                        echo $exlink_option;
                        ?>
'/>
									
									<input id='evcal_exlink_target' type='hidden' name='_evcal_exlink_target' value='<?php 
                        echo $exlink_target;
                        ?>
'/>
									
									<?php 
                        $display_link_input = $exlink_option != '1' ? 'display:block' : 'display:none';
                        ?>
									<p <?php 
                        echo $exlink_option == '1' || $exlink_option == '3' ? "style='display:none'" : null;
                        ?>
 id='evo_new_window_io' class='<?php 
                        echo $exlink_target == 'yes' ? 'selected' : null;
                        ?>
'><span></span> <?php 
                        _e('Open in new window', 'eventon');
                        ?>
</p>
									
									<!-- external link field-->
									<input id='evcal_exlink' placeholder='<?php 
                        _e('Type the URL address', 'eventon');
                        ?>
' type='text' name='evcal_exlink' value='<?php 
                        echo !empty($ev_vals["evcal_exlink"]) ? $ev_vals["evcal_exlink"][0] : null;
                        ?>
' style='width:100%; <?php 
                        echo $display_link_input;
                        ?>
'/>
									
									<div class='evcal_db_uis'>
										<a link='no'  class='evcal_db_ui evcal_db_ui_0 <?php 
                        echo $exlink_option == 'X' ? 'selected' : null;
                        ?>
' title='<?php 
                        _e('Do nothing', 'eventon');
                        ?>
' value='X'></a>

										<a link='no'  class='evcal_db_ui evcal_db_ui_1 <?php 
                        echo $exlink_option == '1' ? 'selected' : null;
                        ?>
' title='<?php 
                        _e('Slide Down Event Card', 'eventon');
                        ?>
' value='1'></a>
										
										<!-- open as link-->
										<a link='yes' class='evcal_db_ui evcal_db_ui_2 <?php 
                        echo $exlink_option == '2' ? 'selected' : null;
                        ?>
' title='<?php 
                        _e('External Link', 'eventon');
                        ?>
' value='2'></a>	
										
										<!-- open as popup -->
										<a link='yes' class='evcal_db_ui evcal_db_ui_3 <?php 
                        echo $exlink_option == '3' ? ' selected' : null;
                        ?>
' title='<?php 
                        _e('Popup Window', 'eventon');
                        ?>
' value='3'></a>
										
										<!-- single event -->
										<a link='yes' linkval='<?php 
                        echo get_permalink($p_id);
                        ?>
' class='evcal_db_ui evcal_db_ui_4 <?php 
                        echo $exlink_option == '4' ? 'selected' : null;
                        ?>
' title='Open Event Page' value='4'></a>
										
										<?php 
                        // (-- addon --)
                        //if(has_action('evcal_ui_click_additions')){do_action('evcal_ui_click_additions');}
                        ?>
							
										<div class='clear'></div>
									</div>
								</div>
							</div>
							<?php 
                        break;
                    case 'ev_organizer':
                        ?>
							<div class='evcal_data_block_style1'>
								<p class='edb_icon evcal_edb_map'></p>
								<div class='evcal_db_data'>
									<div class='evcal_location_data_section'>		
									<p>
									<?php 
                        // organier terms for event post
                        $termMeta = $evo_organizer_tax_id = '';
                        $organizer_terms = wp_get_post_terms($p_id, 'event_organizer');
                        if ($organizer_terms && !is_wp_error($organizer_terms)) {
                            $evo_organizer_tax_id = $organizer_terms[0]->term_id;
                            $termMeta = evo_get_term_meta('event_organizer', $evo_organizer_tax_id, '', true);
                            //$termMeta = get_option( "taxonomy_$evo_organizer_tax_id");
                        }
                        // Get all available organizer terms
                        $terms = get_terms('event_organizer', array('hide_empty' => false));
                        if (count($terms) > 0) {
                            echo "<select id='evcal_organizer_field' name='evcal_organizer_name_select' class='evo_select_field' style='max-width:425px; margin-right:5px;'>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value='-'>" . __('Select a saved organizer', 'eventon') . "</option>";
                            foreach ($terms as $term) {
                                $ORG_imgid = $ORG_imgsrc = $data = '';
                                $t_id = $term->term_id;
                                //$term_meta = get_option( "taxonomy_$t_id" );
                                $term_meta = evo_get_term_meta('event_organizer', $t_id, '', true);
                                $__selected = $evo_organizer_tax_id == $t_id ? "selected='selected'" : null;
                                // organizer image
                                $ORG_imgid = !empty($term_meta['evo_org_img']) ? $term_meta['evo_org_img'] : null;
                                $img_src = !empty($ORG_imgid) ? wp_get_attachment_image_src($ORG_imgid, 'medium') : false;
                                $ORG_imgsrc = $img_src ? $img_src[0] : '';
                                // each term meta data for organizer taxonomy
                                foreach (array('tid' => $t_id, 'contact' => $this->termmeta($term_meta, 'evcal_org_contact'), 'img' => $this->termmeta($term_meta, 'evo_org_img'), 'imgsrc' => $ORG_imgsrc, 'exlink' => $this->termmeta($term_meta, 'evcal_org_exlink'), 'address' => $this->termmeta($term_meta, 'evcal_org_address'), 'exlinkopen' => $this->termmeta($term_meta, '_evocal_org_exlink_target')) as $key => $val) {
                                    $data .= 'data-' . $key . '="' . $val . '"';
                                }
                                echo "<option value='" . $term->name . "' {$data} {$__selected} >" . $term->name . "</option>";
                            }
                            echo "</select>";
                            echo "<span class='evoselectfield_data_view evo_btn' style='display:" . ($evo_organizer_tax_id ? 'inline-block' : 'none') . "'>" . __('Edit Organizer', 'eventon') . "</span>";
                            echo "<label for='evcal_organizer_field'>" . __('Choose already saved organizer or type new one below. NOTE: if you retype an existing organizer it will replace old information for that saved organizer', 'eventon') . "</label>";
                        }
                        ?>

									
									<input id='evo_organizer_tax_id' type='hidden' name='evo_organizer_tax_id' value='<?php 
                        echo $evo_organizer_tax_id;
                        ?>
'/>
									</p>
									
									<div class='evoselectfield_saved_data' style='display:<?php 
                        echo $evo_organizer_tax_id ? 'none' : '';
                        ?>
'>
										<p><input type='text' id='evcal_organizer_name' name='evcal_organizer' value="<?php 
                        echo !empty($organizer_terms[0]) ? $organizer_terms[0]->name : '';
                        ?>
" style='width:100%' placeholder='<?php 
                        _e('eg. Blue Light Band', 'eventon');
                        ?>
'/><label for='evcal_organizer'><?php 
                        _e('Event Organizer Name', 'eventon');
                        ?>
</label></p>
										<!-- organizer contact -->
										<p><input type='text' id='evcal_org_contact' name='evcal_org_contact' value="<?php 
                        echo $this->termmeta($termMeta, 'evcal_org_contact');
                        ?>
" style='width:100%' placeholder='<?php 
                        _e('eg. noone[at] thismail.com', 'eventon');
                        ?>
'/><label for='evcal_org_contact'><?php 
                        _e('(Optional) Organizer Contact Information', 'eventon');
                        ?>
</label></p>

										<!-- organizer address-->
										<p><input type='text' id='evcal_org_address' name='evcal_org_address' value="<?php 
                        echo $this->termmeta($termMeta, 'evcal_org_address');
                        ?>
" style='width:100%' placeholder='<?php 
                        _e('eg. 123 Everywhere St., Neverland AB', 'eventon');
                        ?>
'/><label for='evcal_org_address'><?php 
                        _e('(Optional) Organizer Address', 'eventon');
                        ?>
</label></p>

										<!-- organizer link -->
										<p><input type='text' id='evcal_org_exlink' name='evcal_org_exlink' value="<?php 
                        echo $this->termmeta($termMeta, 'evcal_org_exlink');
                        ?>
" style='width:100%' placeholder='<?php 
                        _e('eg. http://www.mysite.com/user', 'eventon');
                        ?>
'/>

											<span class='yesno_row evo'>
												<?php 
                        $_evocal_org_exlink_target = $this->termmeta($termMeta, '_evocal_org_exlink_target');
                        echo $ajde->wp_admin->html_yesnobtn(array('id' => '_evocal_org_exlink_target', 'var' => $_evocal_org_exlink_target, 'input' => true, 'label' => __('Open organizer link in new window', 'eventon')));
                        ?>
											
											</span>

										<label for='evcal_org_exlink'><?php 
                        _e('Link to the organizers page', 'eventon');
                        ?>
</label></p>
										
										<!-- image -->
										<?php 
                        $org_img_id = $this->termmeta($termMeta, 'evo_org_img');
                        // image soruce array
                        $img_src = $org_img_id ? wp_get_attachment_image_src($org_img_id, 'medium') : null;
                        $org_img_src = !empty($img_src) ? $img_src[0] : null;
                        $__button_text = !empty($org_img_id) ? __('Remove Image', 'eventon') : __('Choose Image', 'eventon');
                        $__button_text_not = empty($org_img_id) ? __('Remove Image', 'eventon') : __('Choose Image', 'eventon');
                        $__button_class = !empty($org_img_id) ? 'removeimg' : 'chooseimg';
                        // /echo $loc_img_id.' '.$img_src.'66';
                        ?>
										<div class='evo_metafield_image' style='padding-top:10px'>
											<p>
												<input id='evo_org_img_id' class='evo_org_img custom_upload_image evo_meta_img' name="evo_org_img" type="hidden" value="<?php 
                        echo $org_img_id ? $org_img_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_org_image_src image_src'>
					                    			<img src='<?php 
                        echo $org_img_src;
                        ?>
' style='<?php 
                        echo !empty($org_img_id) ? '' : 'display:none;';
                        ?>
 margin-top:8px'/>
					                    		</span>
					                    		<label><?php 
                        _e('Event Organizer Image', 'eventon');
                        ?>
 (<?php 
                        _e('Recommended Resolution 80x80px', 'eventon');
                        ?>
)</label>
					                    	</p>
					                    </div>

				                    </div> <!-- evoselectfield_saved_data-->

				                    </div><!--.evcal_location_data_section-->
									
									<!-- yea no field - hide organizer field from eventcard -->
									<p class='yesno_row evo'>
										<?php 
                        $evo_evcrd_field_org = !empty($ev_vals["evo_evcrd_field_org"]) ? $ev_vals["evo_evcrd_field_org"][0] : null;
                        echo $ajde->wp_admin->html_yesnobtn(array('id' => 'evo_org_field_ec', 'var' => $evo_evcrd_field_org));
                        ?>
										
										<input type='hidden' name='evo_evcrd_field_org' value="<?php 
                        echo !empty($ev_vals["evo_evcrd_field_org"]) && $ev_vals["evo_evcrd_field_org"][0] == 'yes' ? 'yes' : 'no';
                        ?>
"/>
										<label for='evo_evcrd_field_org'><?php 
                        _e('Hide Organizer field from EventCard', 'eventon');
                        ?>
</label>
									</p>
									<p style='clear:both'></p>
								</div>
							</div>
							<?php 
                        break;
                    case 'ev_location':
                        // $opt = get_option( "evo_tax_meta");
                        // print_r($opt);
                        ?>
							<div class='evcal_data_block_style1'>
								<p class='edb_icon evcal_edb_map'></p>
								<div class='evcal_db_data'>
									<div class='evcal_location_data_section'>	
									<p>
									<?php 
                        //$opt = get_option( "evo_tax_meta");
                        //print_r($opt);
                        // location terms for event post
                        $evo_location_tax_id = $termMeta = $evoLocSlug = '';
                        $location_terms = wp_get_post_terms($p_id, 'event_location');
                        if ($location_terms && !is_wp_error($location_terms)) {
                            $evo_location_tax_id = $location_terms[0]->term_id;
                            $evoLocSlug = $location_terms[0]->slug;
                            $termMeta = evo_get_term_meta('event_location', $evo_location_tax_id, '', true);
                        }
                        // GET all available location terms
                        $terms = get_terms('event_location', array('hide_empty' => false));
                        if (count($terms) > 0) {
                            echo "<select id='evcal_location_field' name='evcal_location_name_select' class='evo_select_field' style='max-width:400px; margin-right:5px'>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value='-'>" . __('Select a saved location', 'eventon') . "</option>";
                            foreach ($terms as $term) {
                                $loc_img_src = $loc_img_id = $data = '';
                                $t_id = $term->term_id;
                                //$term_meta = get_option( "taxonomy_$t_id" );
                                $term_meta = evo_get_term_meta('event_location', $t_id, '', true);
                                $__selected = $evo_location_tax_id == $t_id ? "selected='selected'" : null;
                                // location image
                                $loc_img_id = $this->termmeta($term_meta, 'evo_loc_img');
                                $img_src = !empty($loc_img_id) ? wp_get_attachment_image_src($loc_img_id, 'medium') : false;
                                $loc_img_src = $img_src ? $img_src[0] : '';
                                $locationName = str_replace('"', "'", $term->name);
                                // option data fields
                                foreach (array('tid' => $t_id, 'address' => $this->termmeta($term_meta, 'location_address'), 'lat' => $this->termmeta($term_meta, 'location_lat'), 'lon' => $this->termmeta($term_meta, 'location_lon'), 'loc_img_id' => $loc_img_id, 'loc_img_src' => $loc_img_src, 'link' => $this->termmeta($term_meta, 'evcal_location_link')) as $key => $var) {
                                    $data .= 'data-' . $key . '="' . $var . '"';
                                }
                                echo "<option value='" . $locationName . "' {$data} {$__selected} >" . $term->name . "</option>";
                            }
                            echo "</select>";
                            echo "<span class='evoselectfield_data_view evo_btn' style='display:" . ($evo_location_tax_id ? '' : 'none') . "'>" . __('Edit Location', 'eventon') . "</span>";
                            echo "<label for='evcal_location_field'>" . __('Choose already saved location or type new one below', 'eventon') . "</label>";
                        }
                        ?>
									<input id='evo_location_tax' type='hidden' name='evo_location_tax_id' value='<?php 
                        echo $evo_location_tax_id;
                        ?>
'/>
									<input type='hidden' name='evo_location_tax_id_old' value='<?php 
                        echo $evo_location_tax_id;
                        ?>
'/>
									<input id='evo_location_slug' type='hidden' name='evo_location_tax_slug' value='<?php 
                        echo $evoLocSlug;
                        ?>
'/>
									</p>

									<div class='evoselectfield_saved_data' style='display:<?php 
                        echo $evo_location_tax_id ? 'none' : '';
                        ?>
'>
									<?php 
                        $locationNAME = !empty($location_terms[0]) ? $location_terms[0]->name : (!empty($ev_vals["evcal_location_name"]) ? $ev_vals["evcal_location_name"][0] : '');
                        ?>
									<p><input type='text' id='evcal_location_name' name='evcal_location_name' value="<?php 
                        echo $locationNAME;
                        ?>
" style='width:100%' placeholder='<?php 
                        _e('eg. Irving City Park', 'eventon');
                        ?>
'/><label for='evcal_location_name'><?php 
                        _e('Event Location Name', 'eventon');
                        ?>
</label></p>

									<?php 
                        $locationADD = !empty($termMeta['location_address']) ? stripslashes($termMeta['location_address']) : (!empty($ev_vals["evcal_location"]) ? $ev_vals["evcal_location"][0] : '');
                        ?>
									<p><input type='text' id='evcal_location' name='evcal_location' value="<?php 
                        echo $locationADD;
                        ?>
" style='width:100%' placeholder='<?php 
                        _e('eg. 12 Rue de Rivoli, Paris', 'eventon');
                        ?>
'/><label for='evcal_location'><?php 
                        _e('Event Location Address', 'eventon');
                        ?>
</label></p>
												
									<!-- location lat lon -->
									<p><input type='text' id='evcal_lat' class='evcal_latlon' name='evcal_lat' value='<?php 
                        echo $this->termmeta($termMeta, 'location_lat');
                        ?>
' placeholder='<?php 
                        _e('Latitude', 'eventon');
                        ?>
' title='<?php 
                        _e('Latitude', 'eventon');
                        ?>
'/>
									<input type='text' id='evcal_lon' class='evcal_latlon' name='evcal_lon' value='<?php 
                        echo $this->termmeta($termMeta, 'location_lon');
                        ?>
' placeholder='<?php 
                        _e('Longitude', 'eventon');
                        ?>
' title='<?php 
                        _e('Longitude', 'eventon');
                        ?>
'/></p>
									<p><i><?php 
                        _e('<b>NOTE:</b> LatLong will be auto generated for address provided for faster google map drawing. If location marker is not correct feel free to edit the LatLong values to correct location marker coordinates above. <br/>Location address field is <b>REQUIRED</b> for this to work.', 'eventon');
                        ?>
 <br/><a style='color:#B3DDEC' href='http://itouchmap.com/latlong.html' target='_blank'><?php 
                        _e('Find LanLat for address', 'eventon');
                        ?>
</a></i></p>

									<!-- Location link -->
									<p><input type='text' id='evcal_location_link' name='evcal_location_link' value="<?php 
                        echo $this->termmeta($termMeta, 'evcal_location_link');
                        ?>
" style='width:100%' placeholder='<?php 
                        _e('eg. http://www.locationlink.com', 'eventon');
                        ?>
'/><label for='evcal_location_link'><?php 
                        _e('Event Location Link', 'eventon');
                        ?>
</label></p>

									<!-- image -->
										<?php 
                        $loc_img_id = $this->termmeta($termMeta, 'evo_loc_img');
                        // image soruce array
                        $img_src = $loc_img_id ? wp_get_attachment_image_src($loc_img_id, 'medium') : null;
                        $loc_img_src = !empty($img_src) ? $img_src[0] : null;
                        $__button_text = !empty($loc_img_id) ? __('Remove Image', 'eventon') : __('Choose Image', 'eventon');
                        $__button_text_not = empty($loc_img_id) ? __('Remove Image', 'eventon') : __('Choose Image', 'eventon');
                        $__button_class = !empty($loc_img_id) ? 'removeimg' : 'chooseimg';
                        // /echo $loc_img_id.' '.$img_src.'66';
                        ?>
										<div class='evo_metafield_image' style='padding-top:10px'>					
											<p >
												<input id='evo_loc_img_id' class='evo_loc_img custom_upload_image evo_meta_img' name="evo_loc_img" type="hidden" value="<?php 
                        echo $loc_img_id ? $loc_img_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 $loc_img_src;
                        ?>
' style='<?php 
                        echo !empty($loc_img_id) ? '' : 'display:none';
                        ?>
'/>
					                    		</span>
					                    		<label><?php 
                        _e('Event Location Image', 'eventon');
                        ?>
</label>
					                    	</p>
					                    </div>
									</div><!--evoselectfield_saved_data-->
									</div><!--.evcal_location_data_section-->

									<!-- HIDE Location name from eventcard -->
										<p class='yesno_row evo'>
											<?php 
                        $locationNM_val = !empty($ev_vals["evcal_hide_locname"]) ? $ev_vals["evcal_hide_locname"][0] : 'no';
                        echo $ajde->wp_admin->html_yesnobtn(array('id' => 'evo_locname', 'var' => $locationNM_val));
                        ?>
											
											<input type='hidden' name='evcal_hide_locname' value="<?php 
                        echo !empty($ev_vals["evcal_hide_locname"]) && $ev_vals["evcal_hide_locname"][0] == 'yes' ? 'yes' : 'no';
                        ?>
"/>
											<label for='evcal_hide_locname'><?php 
                        _e('Hide Location Name from Event Card', 'eventon');
                        ?>
</label>
										</p>
										<p style='clear:both'></p>

									<!-- HIDE google map option -->
										<p class='yesno_row evo'>
											<?php 
                        $location_val = !empty($ev_vals["evcal_gmap_gen"]) ? $ev_vals["evcal_gmap_gen"][0] : 'yes';
                        echo $ajde->wp_admin->html_yesnobtn(array('id' => 'evo_genGmap', 'var' => $location_val));
                        ?>
											
											<input type='hidden' name='evcal_gmap_gen' value="<?php 
                        echo !empty($ev_vals["evcal_gmap_gen"]) && $ev_vals["evcal_gmap_gen"][0] == 'yes' ? 'yes' : (empty($ev_vals["evcal_gmap_gen"]) ? 'yes' : 'no');
                        ?>
"/>
											<label for='evcal_gmap_gen'><?php 
                        _e('Generate Google Map from the address', 'eventon');
                        ?>
</label>
										</p>
										<p style='clear:both'></p>

									<!-- Show location name over image -->
										<p class='yesno_row evo'>
											<?php 
                        $evcal_name_over_img = !empty($ev_vals["evcal_name_over_img"]) ? $ev_vals["evcal_name_over_img"][0] : 'no';
                        echo $ajde->wp_admin->html_yesnobtn(array('id' => 'evcal_name_over_img', 'var' => $evcal_name_over_img));
                        ?>
											
											<input type='hidden' name='evcal_name_over_img' value="<?php 
                        echo !empty($ev_vals["evcal_name_over_img"]) && $ev_vals["evcal_name_over_img"][0] == 'yes' ? 'yes' : 'no';
                        ?>
"/>
											<label for='evcal_name_over_img'><?php 
                        _e('Show location name & address over location image (If location image exist)', 'eventon');
                        ?>
</label>
										</p><p style='clear:both'></p>
								</div>
							</div>
							<?php 
                        break;
                    case 'ev_timedate':
                        // Minute increment
                        $minIncre = !empty($evcal_opt1['evo_minute_increment']) ? (int) $evcal_opt1['evo_minute_increment'] : 60;
                        $minADJ = 60 / $minIncre;
                        // --- TIME variations
                        //$evcal_date_format = eventon_get_timeNdate_format($evcal_opt1);
                        $wp_time_format = get_option('time_format');
                        $hr24 = strpos($wp_time_format, 'H') !== false || strpos($wp_time_format, 'G') !== false ? true : false;
                        $evcal_date_format = array('yy/mm/dd', 'Y/m/d', $hr24);
                        $time_hour_span = $evcal_date_format[2] ? 25 : 13;
                        // GET DATE and TIME values
                        $_START = !empty($ev_vals['evcal_srow'][0]) ? eventon_get_editevent_kaalaya($ev_vals['evcal_srow'][0], $evcal_date_format[1], $evcal_date_format[2]) : false;
                        $_END = !empty($ev_vals['evcal_erow'][0]) ? eventon_get_editevent_kaalaya($ev_vals['evcal_erow'][0], $evcal_date_format[1], $evcal_date_format[2]) : false;
                        // date and time formats used in edit page
                        $used_js_dateFormat = $evcal_date_format[0];
                        $used_dateFormat = $evcal_date_format[1];
                        $used_timeFormat = $evcal_date_format[2] ? '24h' : '12h';
                        ob_start();
                        ?>
							<!-- date and time formats to use -->
							<input type='hidden' name='_evo_date_format' value='<?php 
                        echo $used_dateFormat;
                        ?>
'/>
							<input type='hidden' name='_evo_time_format' value='<?php 
                        echo $used_timeFormat;
                        ?>
'/>	
							<div id='evcal_dates' date_format='<?php 
                        echo $used_js_dateFormat;
                        ?>
'>	
								<p class='yesno_row evo fcw'>
									<?php 
                        echo $ajde->wp_admin->html_yesnobtn(array('id' => 'evcal_allday_yn_btn', 'var' => $evcal_allday, 'attr' => array('allday_switch' => '1')));
                        ?>
			
									<input type='hidden' name='evcal_allday' value="<?php 
                        echo $evcal_allday == 'yes' ? 'yes' : 'no';
                        ?>
"/>
									<label for='evcal_allday_yn_btn'><?php 
                        _e('All Day Event', 'eventon');
                        ?>
</label>
								</p><p style='clear:both'></p>
								
								<!-- START TIME-->
								<div class='evo_start_event evo_datetimes'>
									<div class='evo_date'>
										<p id='evcal_start_date_label'><?php 
                        _e('Event Start Date', 'eventon');
                        ?>
</p>
										<input id='evo_dp_from' class='evcal_data_picker datapicker_on' type='text' id='evcal_start_date' name='evcal_start_date' value='<?php 
                        echo $_START ? $_START[0] : null;
                        ?>
' placeholder='<?php 
                        echo $used_dateFormat;
                        ?>
'/>					
										<span><?php 
                        _e('Select a Date', 'eventon');
                        ?>
</span>
									</div>					
									<div class='evcal_date_time switch_for_evsdate evcal_time_selector' <?php 
                        echo $show_style_code;
                        ?>
>
										<div class='evcal_select'>
											<select id='evcal_start_time_hour' class='evcal_date_select' name='evcal_start_time_hour'>
												<?php 
                        //echo "<option value=''>--</option>";
                        $start_time_h = $_START ? $_START[1] : null;
                        for ($x = 1; $x < $time_hour_span; $x++) {
                            $y = $time_hour_span == 25 ? sprintf("%02d", $x - 1) : $x;
                            echo "<option value='{$y}'" . ($start_time_h == $y ? 'selected="selected"' : '') . ">{$y}</option>";
                        }
                        ?>
											</select>
										</div><p style='display:inline; font-size:24px;padding:4px 2px'>:</p>
										<div class='evcal_select'>						
											<select id='evcal_start_time_min' class='evcal_date_select' name='evcal_start_time_min'>
												<?php 
                        //echo "<option value=''>--</option>";
                        $start_time_m = $_START ? $_START[2] : null;
                        for ($x = 0; $x < $minIncre; $x++) {
                            $min = $minADJ * $x;
                            $min = $min < 10 ? '0' . $min : $min;
                            echo "<option value='{$min}'" . ($start_time_m == $min ? 'selected="selected"' : '') . ">{$min}</option>";
                        }
                        ?>
											</select>
										</div>
										
										<?php 
                        if (!$evcal_date_format[2]) {
                            ?>
										<div class='evcal_select evcal_ampm_sel'>
											<select name='evcal_st_ampm' id='evcal_st_ampm' >
												<?php 
                            $evcal_st_ampm = $_START ? $_START[3] : null;
                            foreach ($select_a_arr as $sar) {
                                echo "<option value='" . $sar . "' " . ($evcal_st_ampm == $sar ? 'selected="selected"' : '') . ">" . $sar . "</option>";
                            }
                            ?>
								
											</select>
										</div>	
										<?php 
                        }
                        ?>
										<br/>
										<span><?php 
                        _e('Select a Time', 'eventon');
                        ?>
</span>
									</div><div class='clear'></div>
								</div>
								
								<!-- END TIME -->
								<?php 
                        $evo_hide_endtime = !empty($ev_vals["evo_hide_endtime"]) ? $ev_vals["evo_hide_endtime"][0] : null;
                        ?>
								<div class='evo_end_event evo_datetimes switch_for_evsdate'>
									<div class='evo_enddate_selection' style='<?php 
                        echo $evo_hide_endtime == 'yes' ? 'opacity:0.5' : null;
                        ?>
'>
									<div class='evo_date'>
										<p><?php 
                        _e('Event End Date', 'eventon');
                        ?>
</p>
										<input id='evo_dp_to' class='evcal_data_picker datapicker_on' type='text' id='evcal_end_date' name='evcal_end_date' value='<?php 
                        echo $_END ? $_END[0] : null;
                        ?>
' placeholder='<?php 
                        echo $used_dateFormat;
                        ?>
'/>					
										<span><?php 
                        _e('Select a Date', 'eventon');
                        ?>
</span>					
									</div>
									<div class='evcal_date_time evcal_time_selector' <?php 
                        echo $show_style_code;
                        ?>
>
										<div class='evcal_select'>
											<select class='evcal_date_select' name='evcal_end_time_hour'>
												<?php 
                        //echo "<option value=''>--</option>";
                        $end_time_h = $_END ? $_END[1] : null;
                        for ($x = 1; $x < $time_hour_span; $x++) {
                            $y = $time_hour_span == 25 ? sprintf("%02d", $x - 1) : $x;
                            echo "<option value='{$y}'" . ($end_time_h == $y ? 'selected="selected"' : '') . ">{$y}</option>";
                        }
                        ?>
											</select>
										</div><p style='display:inline; font-size:24px;padding:4px'>:</p>
										<div class='evcal_select'>
											<select class='evcal_date_select' name='evcal_end_time_min'>
												<?php 
                        //echo "<option value=''>--</option>";
                        $end_time_m = $_END[2] ? $_END[2] : null;
                        for ($x = 0; $x < $minIncre; $x++) {
                            $min = $minADJ * $x;
                            $min = $min < 10 ? '0' . $min : $min;
                            echo "<option value='{$min}'" . ($end_time_m == $min ? 'selected="selected"' : '') . ">{$min}</option>";
                        }
                        ?>
											</select>
										</div>					
										<?php 
                        if (!$evcal_date_format[2]) {
                            ?>
										<div class='evcal_select evcal_ampm_sel'>
											<select name='evcal_et_ampm'>
												<?php 
                            $evcal_et_ampm = $_END ? $_END[3] : null;
                            foreach ($select_a_arr as $sar) {
                                echo "<option value='" . $sar . "' " . ($evcal_et_ampm == $sar ? 'selected="selected"' : '') . ">" . $sar . "</option>";
                            }
                            ?>
								
											</select>
										</div>
										<?php 
                        }
                        ?>
										<br/>
										<span><?php 
                        _e('Select the Time', 'eventon');
                        ?>
</span>
									</div><div class='clear'></div>
								</div>
							</div>

							<!-- how time look on frontend -->
							<?php 
                        if (!empty($ev_vals['evcal_srow'])) {
                            $dtime = new evo_datetime();
                            $val = $dtime->get_formatted_smart_time_piece($ev_vals['evcal_srow'][0], $ev_vals);
                            echo "<p class='evo_datetime_frontendview' style='margin-top:10px'>" . __('Default Date/time format:', 'eventon') . ' ' . $val . "</p>";
                        }
                        ?>

								<!-- timezone value -->				
									<p style='padding-top:10px'><input type='text' name='evo_event_timezone' value='<?php 
                        echo !empty($ev_vals["evo_event_timezone"]) ? $ev_vals["evo_event_timezone"][0] : null;
                        ?>
' placeholder='<?php 
                        _e('Timezone text eg.PST', 'eventon');
                        ?>
'/><label for=""><?php 
                        _e('Event timezone', 'eventon');
                        $ajde->wp_admin->tooltips(__('Timezone text you type in here ex. PST will show next to event time on calendar.', 'eventon'), '', true);
                        ?>
</label></p>
									
									<!-- end time yes/no option -->					
									<p class='yesno_row evo '>
										<?php 
                        echo $ajde->wp_admin->html_yesnobtn(array('id' => 'evo_endtime', 'var' => $evo_hide_endtime, 'attr' => array('afterstatement' => 'evo_span_hidden_end')));
                        ?>
										
										<input type='hidden' name='evo_hide_endtime' value="<?php 
                        echo $evo_hide_endtime == 'yes' ? 'yes' : 'no';
                        ?>
"/>
										<label for='evo_hide_endtime'><?php 
                        _e('Hide End Time from calendar', 'eventon');
                        ?>
</label>
									</p>
									<?php 
                        // span event to hidden end time
                        $evo_span_hidden_end = !empty($ev_vals["evo_span_hidden_end"]) ? $ev_vals["evo_span_hidden_end"][0] : null;
                        $evo_span_hidd_display = $evo_hide_endtime && $evo_hide_endtime == 'yes' ? 'block' : 'none';
                        ?>
									<p class='yesno_row evo ' id='evo_span_hidden_end' style='display:<?php 
                        echo $evo_span_hidd_display;
                        ?>
'>
										<?php 
                        echo $ajde->wp_admin->html_yesnobtn(array('id' => 'evo_span_hidden_end', 'var' => $evo_span_hidden_end));
                        ?>
										
										<input type='hidden' name='evo_span_hidden_end' value="<?php 
                        echo $evo_span_hidden_end == 'yes' ? 'yes' : 'no';
                        ?>
"/>
										<label for='evo_span_hidden_end'><?php 
                        _e('Span the event until hidden end time', 'eventon');
                        $ajde->wp_admin->tooltips(__('If event end time goes beyond start time +  and you want the event to show in the calendar until end time expire, select this.', 'eventon'), '', true);
                        ?>
</label>
									</p>

									<?php 
                        // month long event
                        $_evo_month_long = !empty($ev_vals["_evo_month_long"]) ? $ev_vals["_evo_month_long"][0] : null;
                        $_event_month = !empty($ev_vals["_event_month"]) ? $ev_vals["_event_month"][0] : null;
                        ?>
									<p class='yesno_row evo ' id='_evo_month_long' >
										<?php 
                        echo $ajde->wp_admin->html_yesnobtn(array('id' => '_evo_month_long', 'var' => $_evo_month_long));
                        ?>
										
										<input type='hidden' name='_evo_month_long' value="<?php 
                        echo $_evo_month_long == 'yes' ? 'yes' : 'no';
                        ?>
"/>					
										<label for='_evo_month_long'><?php 
                        _e('Show this event for the entire start event Month', 'eventon');
                        $ajde->wp_admin->tooltips(__('This will show this event for the entire month that the event start date is set to.', 'eventon'), '', true);
                        ?>
</label>
									</p>
									<input id='evo_event_month' type='hidden' name='_event_month' value="<?php 
                        echo $_event_month;
                        ?>
"/><p style='clear:both'></p>
									

									<?php 
                        // Year long event
                        $evo_year_long = !empty($ev_vals["evo_year_long"]) ? $ev_vals["evo_year_long"][0] : null;
                        $event_year = !empty($ev_vals["event_year"]) ? $ev_vals["event_year"][0] : null;
                        ?>
									<p class='yesno_row evo ' id='evo_year_long' >
										<?php 
                        echo $ajde->wp_admin->html_yesnobtn(array('id' => 'evo_year_long', 'var' => $evo_year_long));
                        ?>
										
										<input type='hidden' name='evo_year_long' value="<?php 
                        echo $evo_year_long == 'yes' ? 'yes' : 'no';
                        ?>
"/>					
										<label for='evo_year_long'><?php 
                        _e('Show this event for the entire start event Year', 'eventon');
                        $ajde->wp_admin->tooltips(__('This will show this event on every month of the year. The year will be based off the start date you choose above. If year long is set, month long will be overridden.', 'eventon'), '', true);
                        ?>
</label>
									</p>
									<input id='evo_event_year' type='hidden' name='event_year' value="<?php 
                        echo $event_year;
                        ?>
"/><p style='clear:both'></p>

								</div>
								<div style='clear:both'></div>			
								<?php 
                        // Recurring events
                        $evcal_repeat = !empty($ev_vals["evcal_repeat"]) ? $ev_vals["evcal_repeat"][0] : null;
                        ?>
								<div id='evcal_rep' class='evd'>
									<div class='evcalr_1'>
										<p class='yesno_row evo '>
											<?php 
                        echo $ajde->wp_admin->html_yesnobtn(array('id' => 'evd_repeat', 'var' => $evcal_repeat, 'attr' => array('afterstatement' => 'evo_editevent_repeatevents')));
                        ?>
						
											<input type='hidden' name='evcal_repeat' value="<?php 
                        echo $evcal_repeat == 'yes' ? 'yes' : 'no';
                        ?>
"/>
											<label for='evcal_repeat'><?php 
                        _e('Repeating event', 'eventon');
                        ?>
</label>
										</p><p style='clear:both'></p>
									</div>
									<p class='eventon_ev_post_set_line'></p>
									<?php 
                        // initial values
                        $display = !empty($ev_vals["evcal_repeat"]) && $evcal_repeat == 'yes' ? '' : 'none';
                        // repeat frequency array
                        $repeat_freq = apply_filters('evo_repeat_intervals', array('daily' => 'days', 'weekly' => 'weeks', 'monthly' => 'months', 'yearly' => 'years', 'custom' => 'custom'));
                        $evcal_rep_gap = !empty($ev_vals['evcal_rep_gap']) ? $ev_vals['evcal_rep_gap'][0] : 1;
                        $freq = !empty($ev_vals["evcal_rep_freq"]) ? $repeat_freq[$ev_vals["evcal_rep_freq"][0]] : null;
                        ?>
									<div id='evo_editevent_repeatevents' class='evcalr_2 evo_repeat_options' style='display:<?php 
                        echo $display;
                        ?>
'>
										
										<!-- REPEAT SERIES -->
										<div class='repeat_series'>
											<p class='yesno_row evo '>
												<?php 
                        $_evcal_rep_series = evo_meta($ev_vals, '_evcal_rep_series');
                        $display = evo_meta_yesno($ev_vals, '_evcal_rep_series', 'yes', '', 'none');
                        echo $ajde->wp_admin->html_yesnobtn(array('id' => 'evo_repeat', 'var' => $_evcal_rep_series));
                        ?>
						
												<input type='hidden' name='_evcal_rep_series' value="<?php 
                        echo $_evcal_rep_series == 'yes' ? 'yes' : 'no';
                        ?>
"/>
												<label for='_evcal_rep_series'><?php 
                        _e('Show other future repeating instances of this event on event card', 'eventon');
                        ?>
</label>
											</p><p style='clear:both'></p>
										</div>

										<p class='repeat_type evcalr_2_freq evcalr_2_p'><span class='evo_form_label'><?php 
                        _e('Event Repeat Type', 'eventon');
                        ?>
:</span> <select id='evcal_rep_freq' name='evcal_rep_freq'>
										<?php 
                        $evcal_rep_freq = !empty($ev_vals['evcal_rep_freq']) ? $ev_vals['evcal_rep_freq'][0] : null;
                        foreach ($repeat_freq as $refv => $ref) {
                            echo "<option field='" . $ref . "' value='" . $refv . "' " . ($evcal_rep_freq == $refv ? 'selected="selected"' : '') . ">" . $refv . "</option>";
                        }
                        ?>
</select></p><!--.repeat_type-->
										
										<div class='evo_preset_repeat_settings' style='display:<?php 
                        echo !empty($ev_vals['evcal_rep_freq']) && $ev_vals['evcal_rep_freq'][0] == 'custom' ? 'none' : 'block';
                        ?>
'>		
											<p class='gap evcalr_2_rep evcalr_2_p'><span class='evo_form_label'><?php 
                        _e('Gap between repeats', 'eventon');
                        ?>
:</span>
											<input type='number' name='evcal_rep_gap' min='1' max='100' value='<?php 
                        echo $evcal_rep_gap;
                        ?>
' placeholder='1'/>	 <span id='evcal_re'><?php 
                        echo $freq;
                        ?>
</span></p>
										<?php 
                        // repeat number
                        $evcal_rep_num = !empty($ev_vals['evcal_rep_num']) ? $ev_vals['evcal_rep_num'][0] : 1;
                        // repeat by
                        $evp_repeat_rb = !empty($ev_vals['evp_repeat_rb']) ? $ev_vals['evp_repeat_rb'][0] : null;
                        $evo_rep_WK = !empty($ev_vals['evo_rep_WK']) ? unserialize($ev_vals['evo_rep_WK'][0]) : array();
                        $evo_repeat_wom = !empty($ev_vals['evo_repeat_wom']) ? $ev_vals['evo_repeat_wom'][0] : null;
                        // display none section
                        $__display_none_1 = !empty($ev_vals['evcal_rep_freq']) && $ev_vals['evcal_rep_freq'][0] == 'monthly' ? 'block' : 'none';
                        $__display_none_2 = $__display_none_1 == 'block' && !empty($ev_vals['evp_repeat_rb']) && $ev_vals['evp_repeat_rb'][0] == 'dow' ? 'block' : 'none';
                        ?>
										<?php 
                        // monthly only
                        ?>
											<p class='repeat_by evcalr_2_p evo_rep_month' style='display:<?php 
                        echo $__display_none_1;
                        ?>
'>
												<span class='evo_form_label'><?php 
                        _e('Repeat by', 'eventon');
                        ?>
:</span>
												<select id='evo_rep_by' name='evp_repeat_rb'>
													<option value='dom' <?php 
                        echo 'dom' == $evp_repeat_rb ? 'selected="selected"' : null;
                        ?>
><?php 
                        _e('Day of the month', 'eventon');
                        ?>
</option>
													<option value='dow' <?php 
                        echo 'dow' == $evp_repeat_rb ? 'selected="selected"' : null;
                        ?>
><?php 
                        _e('Day of the week', 'eventon');
                        ?>
</option>
												</select>
											</p>
											<p class='evo_days_list evo_rep_month_2'  style='display:<?php 
                        echo $__display_none_2;
                        ?>
'>
												<span class='evo_form_label'><?php 
                        _e('Repeat on selected days', 'eventon');
                        ?>
: </span>
												<?php 
                        $days = array('S', 'M', 'T', 'W', 'T', 'F', 'S');
                        for ($x = 0; $x < 7; $x++) {
                            echo "<em><input type='checkbox' name='evo_rep_WK[]' value='{$x}' " . (in_array($x, $evo_rep_WK) ? 'checked="checked"' : null) . "><label>" . $days[$x] . "</label></em>";
                        }
                        ?>
											</p>
											<p class='evcalr_2_p evo_rep_month_2'  style='display:<?php 
                        echo $__display_none_2;
                        ?>
'>
												<span class='evo_form_label'><?php 
                        _e('Week of month to repeat', 'eventon');
                        ?>
: </span>
												<select id='evo_wom' name='evo_repeat_wom'>
													<?php 
                        // week of the month for repeat
                        echo "<option value='1' " . ($evo_repeat_wom == 1 ? 'selected="selected"' : null) . ">" . __('First', 'eventon') . "</option>";
                        echo "<option value='2' " . ($evo_repeat_wom == 2 ? 'selected="selected"' : null) . ">" . __('Second', 'eventon') . "</option>";
                        echo "<option value='3' " . ($evo_repeat_wom == 3 ? 'selected="selected"' : null) . ">" . __('Third', 'eventon') . "</option>";
                        echo "<option value='4' " . ($evo_repeat_wom == 4 ? 'selected="selected"' : null) . ">" . __('Fourth', 'eventon') . "</option>";
                        echo "<option value='5' " . ($evo_repeat_wom == 5 ? 'selected="selected"' : null) . ">" . __('Fifth', 'eventon') . "</option>";
                        echo "<option value='-1' " . ($evo_repeat_wom == -1 ? 'selected="selected"' : null) . ">" . __('Last', 'eventon') . "</option>";
                        ?>
												</select>
											</p>										
											<p class='evo_month_rep_value evo_rep_month_2' style='display:none'></p>
											<p class='evcalr_2_numr evcalr_2_p'><span class='evo_form_label'><?php 
                        _e('Number of repeats', 'eventon');
                        ?>
:</span>
												<input type='number' name='evcal_rep_num' min='1' value='<?php 
                        echo $evcal_rep_num;
                        ?>
' placeholder='1'/>						
											</p>
										</div><!--evo_preset_repeat_settings-->
										
										<!-- Custom repeat -->
										<div class='repeat_information' style='display:<?php 
                        echo !empty($ev_vals['evcal_rep_freq']) && $ev_vals['evcal_rep_freq'][0] == 'custom' ? 'block' : 'none';
                        ?>
'>
											<p><?php 
                        _e('CUSTOM REPEAT TIMES', 'eventon');
                        ?>
<br/><i style='opacity:0.7'><?php 
                        _e('NOTE: Below repeat intervals are in addition to the above main event time.', 'eventon');
                        ?>
</i></p>
											<?php 
                        //print_r(unserialize($ev_vals['aaa'][0]));
                        date_default_timezone_set('UTC');
                        echo "<p id='no_repeats' style='display:none;opacity:0.7'>There are no additional custom repeats!</p>";
                        echo "<ul class='evo_custom_repeat_list'>";
                        $count = 0;
                        if (!empty($ev_vals['repeat_intervals'])) {
                            $repeat_times = unserialize($ev_vals['repeat_intervals'][0]);
                            //print_r($repeat_times);
                            // datre format sting to display for repeats
                            $date_format_string = $evcal_date_format[1] . ' ' . ($evcal_date_format[2] ? 'G:i' : 'h:ia');
                            foreach ($repeat_times as $rt) {
                                echo '<li style="display:' . ($count == 0 || $count > 3 ? 'none' : 'block') . '" class="' . ($count == 0 ? 'initial' : '') . ($count > 3 ? ' over' : '') . '"><span>' . __('from', 'eventon') . '</span> ' . date($date_format_string, $rt[0]) . ' <span class="e">End</span> ' . date($date_format_string, $rt[1]) . '<em alt="Delete">x</em>
														<input type="hidden" name="repeat_intervals[' . $count . '][0]" value="' . $rt[0] . '"/><input type="hidden" name="repeat_intervals[' . $count . '][1]" value="' . $rt[1] . '"/></li>';
                                $count++;
                            }
                        }
                        echo "</ul>";
                        echo $count > 3 && !empty($ev_vals['repeat_intervals']) ? "<p style='padding-bottom:20px'>There are " . ($count - 1) . " repeat intervals. <span class='evo_repeat_interval_view_all' data-show='no'>" . __('View All', 'eventon') . "</span></p>" : null;
                        ?>
											<div class='evo_repeat_interval_new' style='display:none'>
												<p><span><?php 
                        _e('FROM', 'eventon');
                        ?>
:</span><input class='ristD' name='repeat_date'/> <input class='ristT' name='repeat_time'/><br/><span><?php 
                        _e('TO', 'eventon');
                        ?>
:</span><input class='rietD' name='repeat_date'/> <input class='rietT' name='repeat_time'/></p>
											</div>
											<p class='evo_repeat_interval_button'><a id='evo_add_repeat_interval' class='button_evo'>+ <?php 
                        _e('Add New Repeat Interval', 'eventon');
                        ?>
</a><span></span></p>
										</div>	
									</div>
								</div>	
							<?php 
                        break;
                    case 'ev_subtitle':
                        echo "<div class='evcal_data_block_style1'>\r\n\t\t\t\t\t\t\t\t<div class='evcal_db_data'>\r\n\t\t\t\t\t\t\t\t\t<input type='text' id='evcal_subtitle' name='evcal_subtitle' value='" . evo_meta($ev_vals, 'evcal_subtitle', true) . "' style='width:100%'/>\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t</div>";
                        break;
                }
                // for custom meta field for evnet
                if (!empty($mBOX['fieldtype']) && $mBOX['fieldtype'] == 'custommetafield') {
                    $x = $mBOX['x'];
                    echo "<div class='evcal_data_block_style1'>\r\n\t\t\t\t\t\t\t\t<div class='evcal_db_data'>";
                    // FIELD
                    $__saved_field_value = !empty($ev_vals["_evcal_ec_f" . $x . "a1_cus"]) ? $ev_vals["_evcal_ec_f" . $x . "a1_cus"][0] : null;
                    $__field_id = '_evcal_ec_f' . $x . 'a1_cus';
                    // wysiwyg editor
                    if (!empty($evcal_opt1['evcal_ec_f' . $x . 'a2']) && $evcal_opt1['evcal_ec_f' . $x . 'a2'] == 'textarea') {
                        wp_editor($__saved_field_value, $__field_id);
                        // button
                    } elseif (!empty($evcal_opt1['evcal_ec_f' . $x . 'a2']) && $evcal_opt1['evcal_ec_f' . $x . 'a2'] == 'button') {
                        $__saved_field_link = !empty($ev_vals["_evcal_ec_f" . $x . "a1_cusL"]) ? $ev_vals["_evcal_ec_f" . $x . "a1_cusL"][0] : null;
                        echo "<input type='text' id='" . $__field_id . "' name='_evcal_ec_f" . $x . "a1_cus' ";
                        echo 'value="' . $__saved_field_value . '"';
                        echo "style='width:100%' placeholder='Button Text' title='Button Text'/>";
                        echo "<input type='text' id='" . $__field_id . "' name='_evcal_ec_f" . $x . "a1_cusL' ";
                        echo 'value="' . $__saved_field_link . '"';
                        echo "style='width:100%' placeholder='Button Link' title='Button Link'/>";
                        $onw = !empty($ev_vals["_evcal_ec_f" . $x . "_onw"]) ? $ev_vals["_evcal_ec_f" . $x . "_onw"][0] : null;
                        ?>

								<span class='yesno_row evo'>
									<?php 
                        $openInNewWindow = !empty($ev_vals['_evcal_ec_f' . $x . '_onw']) ? $ev_vals['_evcal_ec_f' . $x . '_onw'][0] : null;
                        echo $ajde->wp_admin->html_yesnobtn(array('id' => '_evcal_ec_f' . $x . '_onw', 'var' => $openInNewWindow, 'input' => true, 'label' => __('Open in New window', 'eventon')));
                        ?>
											
								</span>
								<?php 
                        // text
                    } else {
                        echo "<input type='text' id='" . $__field_id . "' name='_evcal_ec_f" . $x . "a1_cus' ";
                        echo 'value="' . $__saved_field_value . '"';
                        echo "style='width:100%'/>";
                    }
                    echo "</div></div>";
                }
            }
            ?>
					
				</div>
			</div>
		<?php 
        }
        ?>
				<div class='evomb_section' id='<?php 
        echo $mBOX['id'];
        ?>
'>			
					<div class='evomb_header'>
						<span class="evomb_icon evII"><i class="fa fa-plug"></i></span>
						<p>Additional Functionality</p>
					</div>
					<p style='padding:15px 25px; margin:0' class="evomb_body_additional">Looking for additional functionality including event tickets, frontend event submissions, RSVP to events, photo gallery and more? Check out <a href='http://www.myeventon.com/addons/' target='_blank'>eventON addons</a>.</p>
				</div>	
			<div class='evMB_end'></div>
		</div>
	<?php 
    }
				<?php 
echo $__item_p_beg;
echo $eventon_rs->lang('evoRSLX_008', 'Event Time', $lang);
?>
:</span> <?php 
echo $__date['html_prettytime'];
?>
</p>


				<?php 
echo $__item_p_beg;
echo $eventon_rs->lang('evoRSLX_003a', 'Receive Updates', $lang);
?>
:</span> <?php 
echo evo_meta($rsvp_pmv, 'updates');
?>
</p>
				<?php 
//additional fields
for ($x = 1; $x < 4; $x++) {
    if (evo_settings_val('evors_addf' . $x, $optRS) && !empty($optRS['evors_addf' . $x . '_1']) && !empty($rsvp_pmv['evors_addf' . $x . '_1'])) {
        echo $__item_p_beg . $optRS['evors_addf' . $x . '_1'] . ": </span>" . (!empty($rsvp_pmv['evors_addf' . $x . '_1']) ? $rsvp_pmv['evors_addf' . $x . '_1'][0] : '-') . "</p>";
    }
}
?>
			</div>
		</td>
	</tr>
	<?php 
$rsvp_edit_link = get_edit_post_link($args['rsvp_id']);
/** Main meta box. */
function ajde_evcal_show_box()
{
    global $eventon;
    $evcal_opt1 = get_option('evcal_options_evcal_1');
    $evcal_opt2 = get_option('evcal_options_evcal_2');
    // Use nonce for verification
    wp_nonce_field(plugin_basename(__FILE__), 'evo_noncename');
    // The actual fields for data entry
    $p_id = get_the_ID();
    $ev_vals = get_post_custom($p_id);
    $evcal_allday = !empty($ev_vals["evcal_allday"]) ? $ev_vals["evcal_allday"][0] : null;
    $show_style_code = $evcal_allday == 'yes' ? "style='display:none'" : null;
    $select_a_arr = array('AM', 'PM');
    // --- TIME variations
    $evcal_date_format = eventon_get_timeNdate_format($evcal_opt1);
    $time_hour_span = $evcal_date_format[2] ? 25 : 13;
    // GET DATE and TIME values
    $_START = !empty($ev_vals['evcal_srow'][0]) ? eventon_get_editevent_kaalaya($ev_vals['evcal_srow'][0], $evcal_date_format[1], $evcal_date_format[2]) : false;
    $_END = !empty($ev_vals['evcal_erow'][0]) ? eventon_get_editevent_kaalaya($ev_vals['evcal_erow'][0], $evcal_date_format[1], $evcal_date_format[2]) : false;
    //print_r($_START);
    //print_r($ev_vals);
    ?>

<?php 
    // --------------------------
    // HTML - Subtitle
    ob_start();
    ?>
			<div class='evcal_data_block_style1'>
				<div class='evcal_db_data'>
					<input type='text' id='evcal_subtitle' name='evcal_subtitle' value="<?php 
    echo evo_meta($ev_vals, 'evcal_subtitle', true);
    ?>
" style='width:100%'/>
				</div>
			</div>
		<?php 
    $_html_ST = ob_get_clean();
    $__hiddenVAL_ST = '';
    // --------------------------
    // HTML - date
    ob_start();
    ?>
		<!-- date and time formats to use -->
		<input type='hidden' name='_evo_date_format' value='<?php 
    echo $evcal_date_format[1];
    ?>
'/>
		<input type='hidden' name='_evo_time_format' value='<?php 
    echo $evcal_date_format[2] ? '24h' : '12h';
    ?>
'/>	
		<div id='evcal_dates' date_format='<?php 
    echo $evcal_date_format[0];
    ?>
'>
			
			
			<p class='yesno_leg_line fcw'>
				<?php 
    echo eventon_html_yesnobtn(array('id' => 'evcal_allday_yn_btn', 'var' => $evcal_allday, 'attr' => array('allday_switch' => '1')));
    ?>
			
				<input type='hidden' name='evcal_allday' value="<?php 
    echo $evcal_allday == 'yes' ? 'yes' : 'no';
    ?>
"/>
				<label for='evcal_allday_yn_btn'><?php 
    _e('All Day Event', 'eventon');
    ?>
</label>
			</p>
			<p style='clear:both'></p>
			
			<!-- START TIME-->
			<div class='evo_start_event evo_datetimes'>
				<div class='evo_date'>
					<p id='evcal_start_date_label'><?php 
    _e('Event Start Date', 'eventon');
    ?>
</p>
					<input id='evo_dp_from' class='evcal_data_picker datapicker_on' type='text' id='evcal_start_date' name='evcal_start_date' value='<?php 
    echo $_START ? $_START[0] : null;
    ?>
' placeholder='<?php 
    echo $evcal_date_format[1];
    ?>
'/>					
					<span><?php 
    _e('Select a Date', 'eventon');
    ?>
</span>
				</div>					
				<div class='evcal_date_time switch_for_evsdate evcal_time_selector' <?php 
    echo $show_style_code;
    ?>
>
					<div class='evcal_select'>
						<select id='evcal_start_time_hour' class='evcal_date_select' name='evcal_start_time_hour'>
							<?php 
    //echo "<option value=''>--</option>";
    $start_time_h = $_START ? $_START[1] : null;
    for ($x = 1; $x < $time_hour_span; $x++) {
        echo "<option value='{$x}'" . ($start_time_h == $x ? 'selected="selected"' : '') . ">{$x}</option>";
    }
    ?>
						</select>
					</div><p style='display:inline; font-size:24px;padding:4px 2px'>:</p>
					<div class='evcal_select'>
						
						<select id='evcal_start_time_min' class='evcal_date_select' name='evcal_start_time_min'>
							<?php 
    //echo "<option value=''>--</option>";
    $start_time_m = $_START ? $_START[2] : null;
    for ($x = 0; $x < 12; $x++) {
        $min = $x < 2 ? '0' . $x * 5 : $x * 5;
        echo "<option value='{$min}'" . ($start_time_m == $min ? 'selected="selected"' : '') . ">{$min}</option>";
    }
    ?>
						</select>
					</div>
					
					<?php 
    if (!$evcal_date_format[2]) {
        ?>
					<div class='evcal_select evcal_ampm_sel'>
						<select name='evcal_st_ampm' id='evcal_st_ampm' >
							<?php 
        $evcal_st_ampm = $_START ? $_START[3] : null;
        foreach ($select_a_arr as $sar) {
            echo "<option value='" . $sar . "' " . ($evcal_st_ampm == $sar ? 'selected="selected"' : '') . ">" . $sar . "</option>";
        }
        ?>
								
						</select>
					</div>	
					<?php 
    }
    ?>
					<br/>
					<span><?php 
    _e('Select a Time', 'eventon');
    ?>
</span>
				</div><div class='clear'></div>
			</div>
			
			
			
			<!-- END TIME -->
			<?php 
    $evo_hide_endtime = !empty($ev_vals["evo_hide_endtime"]) ? $ev_vals["evo_hide_endtime"][0] : null;
    ?>
			<div class='evo_end_event evo_datetimes switch_for_evsdate'>
				<div class='evo_enddate_selection' style='<?php 
    echo $evo_hide_endtime == 'yes' ? 'opacity:0.5' : null;
    ?>
'>
				<div class='evo_date'>
					<p><?php 
    _e('Event End Date', 'eventon');
    ?>
</p>
					<input id='evo_dp_to' class='evcal_data_picker datapicker_on' type='text' id='evcal_end_date' name='evcal_end_date' value='<?php 
    echo $_END ? $_END[0] : null;
    ?>
'/>					
					<span><?php 
    _e('Select a Date', 'eventon');
    ?>
</span>
					
				</div>
				<div class='evcal_date_time evcal_time_selector' <?php 
    echo $show_style_code;
    ?>
>
					<div class='evcal_select'>
						<select class='evcal_date_select' name='evcal_end_time_hour'>
							<?php 
    //echo "<option value=''>--</option>";
    $end_time_h = $_END ? $_END[1] : null;
    for ($x = 1; $x < $time_hour_span; $x++) {
        echo "<option value='{$x}'" . ($end_time_h == $x ? 'selected="selected"' : '') . ">{$x}</option>";
    }
    ?>
						</select>
					</div><p style='display:inline; font-size:24px;padding:4px'>:</p>
					<div class='evcal_select'>
						<select class='evcal_date_select' name='evcal_end_time_min'>
							<?php 
    //echo "<option value=''>--</option>";
    $end_time_m = $_END[2] ? $_END[2] : null;
    for ($x = 0; $x < 12; $x++) {
        $min = $x < 2 ? '0' . $x * 5 : $x * 5;
        echo "<option value='{$min}'" . ($end_time_m == $min ? 'selected="selected"' : '') . ">{$min}</option>";
    }
    ?>
						</select>
					</div>
					
					<?php 
    if (!$evcal_date_format[2]) {
        ?>
					<div class='evcal_select evcal_ampm_sel'>
						<select name='evcal_et_ampm'>
							<?php 
        $evcal_et_ampm = $_END ? $_END[3] : null;
        foreach ($select_a_arr as $sar) {
            echo "<option value='" . $sar . "' " . ($evcal_et_ampm == $sar ? 'selected="selected"' : '') . ">" . $sar . "</option>";
        }
        ?>
								
						</select>
					</div>
					<?php 
    }
    ?>
					<br/>
					<span><?php 
    _e('Select the Time', 'eventon');
    ?>
</span>
				</div><div class='clear'></div>
				</div>
				
				
				<!-- end time yes/no option -->					
				<p class='yesno_leg_line '>
					<?php 
    echo eventon_html_yesnobtn(array('id' => 'evo_endtime', 'var' => $evo_hide_endtime, 'attr' => array('afterstatement' => 'evo_span_hidden_end')));
    ?>
					
					<input type='hidden' name='evo_hide_endtime' value="<?php 
    echo $evo_hide_endtime == 'yes' ? 'yes' : 'no';
    ?>
"/>
					<label for='evo_hide_endtime'><?php 
    _e('Hide End Time from calendar', 'eventon');
    ?>
</label>
				</p>
				<?php 
    // span event to hidden end time
    $evo_span_hidden_end = !empty($ev_vals["evo_span_hidden_end"]) ? $ev_vals["evo_span_hidden_end"][0] : null;
    $evo_span_hidd_display = $evo_hide_endtime && $evo_hide_endtime == 'yes' ? 'block' : 'none';
    ?>
				<p class='yesno_leg_line ' id='evo_span_hidden_end' style='display:<?php 
    echo $evo_span_hidd_display;
    ?>
'>
					<?php 
    echo eventon_html_yesnobtn(array('id' => 'evo_span_hidden_end', 'var' => $evo_span_hidden_end));
    ?>
					
					<input type='hidden' name='evo_span_hidden_end' value="<?php 
    echo $evo_span_hidden_end == 'yes' ? 'yes' : 'no';
    ?>
"/>
					<label for='evo_span_hidden_end'><?php 
    _e('Span the event until hidden end time', 'eventon');
    $eventon->throw_guide(__('If event end time goes beyond start time +  and you want the event to show in the calendar until end time expire, select this.', 'eventon'));
    ?>
</label>
				</p>

				<?php 
    // Year long event
    $evo_year_long = !empty($ev_vals["evo_year_long"]) ? $ev_vals["evo_year_long"][0] : null;
    $event_year = !empty($ev_vals["event_year"]) ? $ev_vals["event_year"][0] : null;
    ?>
				<p class='yesno_leg_line ' id='evo_year_long' >
					<?php 
    echo eventon_html_yesnobtn(array('id' => 'evo_year_long', 'var' => $evo_year_long));
    ?>
					
					<input type='hidden' name='evo_year_long' value="<?php 
    echo $evo_year_long == 'yes' ? 'yes' : 'no';
    ?>
"/>
					<input id='evo_event_year' type='hidden' name='event_year' value="<?php 
    echo $event_year;
    ?>
"/>
					<label for='evo_year_long'><?php 
    _e('Show this event for the entire year', 'eventon');
    $eventon->throw_guide(__('This will show this event on every month of the year. The year will be based off the start date you choose above', 'eventon'));
    ?>
</label>
				</p>

				<p style='clear:both'></p>
			</div>
			<div style='clear:both'></div>
			
			<?php 
    // Recurring events
    $evcal_repeat = !empty($ev_vals["evcal_repeat"]) ? $ev_vals["evcal_repeat"][0] : null;
    ?>
			<div id='evcal_rep' class='evd'>



				<div class='evcalr_1'>
					<p class='yesno_leg_line '>
						<?php 
    echo eventon_html_yesnobtn(array('id' => 'evd_repeat', 'var' => $evcal_repeat));
    ?>
						
						<input type='hidden' name='evcal_repeat' value="<?php 
    echo $evcal_repeat == 'yes' ? 'yes' : 'no';
    ?>
"/>
						<label for='evcal_repeat'><?php 
    _e('Repeating event', 'eventon');
    ?>
</label>
					</p>
					<p style='clear:both'></p>
				</div>
				<p class='eventon_ev_post_set_line'></p>
				<?php 
    $display = !empty($ev_vals["evcal_repeat"]) && $evcal_repeat == 'yes' ? '' : 'none';
    ?>
				<div class='evcalr_2' style='display:<?php 
    echo $display;
    ?>
'>
					
					<?php 
    // repeat frequency array
    $repeat_freq = apply_filters('evo_repeat_intervals', array('weekly' => 'weeks', 'monthly' => 'months', 'yearly' => 'years'));
    ?>

					<p class='evcalr_2_freq evcalr_2_p'><span class='evo_form_label'><?php 
    _e('Frequency', 'eventon');
    ?>
:</span> <select id='evcal_rep_freq' name='evcal_rep_freq'>
					<?php 
    $evcal_rep_freq = !empty($ev_vals['evcal_rep_freq']) ? $ev_vals['evcal_rep_freq'][0] : null;
    foreach ($repeat_freq as $refv => $ref) {
        echo "<option field='" . $ref . "' value='" . $refv . "' " . ($evcal_rep_freq == $refv ? 'selected="selected"' : '') . ">" . $refv . "</option>";
    }
    ?>
</select></p>
					
					<?php 
    $evcal_rep_gap = !empty($ev_vals['evcal_rep_gap']) ? $ev_vals['evcal_rep_gap'][0] : 1;
    $freq = !empty($ev_vals["evcal_rep_freq"]) ? $repeat_freq[$ev_vals["evcal_rep_freq"][0]] : null;
    if (!empty($ev_vals['repeat_intervals'])) {
        //print_r(unserialize($ev_vals['repeat_intervals'][0]));
    }
    ?>
						
					<p class='evcalr_2_rep evcalr_2_p'><span class='evo_form_label'><?php 
    _e('Gap between repeats', 'eventon');
    ?>
:</span>
						<input type='number' name='evcal_rep_gap' min='1' max='100' value='<?php 
    echo $evcal_rep_gap;
    ?>
' placeholder='1'/>	 <span id='evcal_re'><?php 
    echo $freq;
    ?>
</span></p>
					
					
					
					<?php 
    // repeat number
    $evcal_rep_num = !empty($ev_vals['evcal_rep_num']) ? $ev_vals['evcal_rep_num'][0] : 1;
    // repeat by
    $evp_repeat_rb = !empty($ev_vals['evp_repeat_rb']) ? $ev_vals['evp_repeat_rb'][0] : null;
    $evo_rep_WK = !empty($ev_vals['evo_rep_WK']) ? unserialize($ev_vals['evo_rep_WK'][0]) : array();
    $evo_repeat_wom = !empty($ev_vals['evo_repeat_wom']) ? $ev_vals['evo_repeat_wom'][0] : null;
    // display none section
    $__display_none_1 = !empty($ev_vals['evcal_rep_freq']) && $ev_vals['evcal_rep_freq'][0] == 'monthly' ? 'block' : 'none';
    $__display_none_2 = $__display_none_1 == 'block' && !empty($ev_vals['evp_repeat_rb']) && $ev_vals['evp_repeat_rb'][0] == 'dow' ? 'block' : 'none';
    ?>
						
					<?php 
    // monthly only
    ?>
						<p class='evcalr_2_p evo_rep_month' style='display:<?php 
    echo $__display_none_1;
    ?>
'>
							<span class='evo_form_label'><?php 
    _e('Repeat by', 'eventon');
    ?>
:</span>
							<select id='evo_rep_by' name='evp_repeat_rb'>
								<option value='dom' <?php 
    echo 'dom' == $evp_repeat_rb ? 'selected="selected"' : null;
    ?>
><?php 
    _e('Day of the month', 'eventon');
    ?>
</option>
								<option value='dow' <?php 
    echo 'dow' == $evp_repeat_rb ? 'selected="selected"' : null;
    ?>
><?php 
    _e('Day of the week', 'eventon');
    ?>
</option>
							</select>
						</p>
						<p class='evo_days_list evo_rep_month_2'  style='display:<?php 
    echo $__display_none_2;
    ?>
'>
							<span class='evo_form_label'><?php 
    _e('Repeat on selected days', 'eventon');
    ?>
: </span>
							<em><input type='checkbox' name='evo_rep_WK[]' value='0' <?php 
    echo in_array('0', $evo_rep_WK) ? 'checked="checked"' : null;
    ?>
><label>S</label></em>
							<em><input type='checkbox' name='evo_rep_WK[]' value='1' <?php 
    echo in_array('1', $evo_rep_WK) ? 'checked="checked"' : null;
    ?>
><label>M</label></em>
							<em><input type='checkbox' name='evo_rep_WK[]' value='2' <?php 
    echo in_array('2', $evo_rep_WK) ? 'checked="checked"' : null;
    ?>
><label>T</label></em>
							<em><input type='checkbox' name='evo_rep_WK[]' value='3' <?php 
    echo in_array('3', $evo_rep_WK) ? 'checked="checked"' : null;
    ?>
><label>W</label></em>
							<em><input type='checkbox' name='evo_rep_WK[]' value='4' <?php 
    echo in_array('4', $evo_rep_WK) ? 'checked="checked"' : null;
    ?>
><label>T</label></em>
							<em><input type='checkbox' name='evo_rep_WK[]' value='5' <?php 
    echo in_array('5', $evo_rep_WK) ? 'checked="checked"' : null;
    ?>
><label>F</label></em>
							<em><input type='checkbox' name='evo_rep_WK[]' value='6' <?php 
    echo in_array('6', $evo_rep_WK) ? 'checked="checked"' : null;
    ?>
><label>S</label></em>
						</p>
						<p class='evcalr_2_p evo_rep_month_2'  style='display:<?php 
    echo $__display_none_2;
    ?>
'>
							<span class='evo_form_label'><?php 
    _e('Week of month to repeat', 'eventon');
    ?>
: </span>
							<select id='evo_wom' name='evo_repeat_wom'>
								<option value='none' <?php 
    echo 'none' == $evo_repeat_wom ? 'checked="checked"' : null;
    ?>
>None</option>
								<option value='1' <?php 
    echo '1' == $evo_repeat_wom ? 'selected="selected"' : null;
    ?>
><?php 
    _e('First', 'eventon');
    ?>
</option>
								<option value='2' <?php 
    echo '2' == $evo_repeat_wom ? 'selected="selected"' : null;
    ?>
><?php 
    _e('Second', 'eventon');
    ?>
</option>
								<option value='3' <?php 
    echo '3' == $evo_repeat_wom ? 'selected="selected"' : null;
    ?>
><?php 
    _e('Third', 'eventon');
    ?>
</option>
								<option value='4' <?php 
    echo '4' == $evo_repeat_wom ? 'selected="selected"' : null;
    ?>
><?php 
    _e('Fourth', 'eventon');
    ?>
</option>
								<option value='-1' <?php 
    echo '-1' == $evo_repeat_wom ? 'selected="selected"' : null;
    ?>
><?php 
    _e('Last', 'eventon');
    ?>
</option>
							</select>
						</p>
					
						<p class='evo_month_rep_value evo_rep_month_2' style='display:none'></p>
						
						<p class='evcalr_2_numr evcalr_2_p'><span class='evo_form_label'><?php 
    _e('Number of repeats', 'eventon');
    ?>
:</span>
							<input type='number' name='evcal_rep_num' min='1' max='100' value='<?php 
    echo $evcal_rep_num;
    ?>
' placeholder='1'/>						
						</p>

					<div class='repeat_information'>
						<?php 
    /* 
    						<p>Repeat Times:</p>
    						<?php
    
    date_default_timezone_set('UTC');
    $repeat_times = (unserialize($ev_vals['repeat_intervals'][0]));
    if(!empty($repeat_times)){
    	foreach($repeat_times as $rt){
    		echo 'start '.date('d-m-y',$rt[0]).' End '.date('d-m-y',$rt[1]).'</br>';
    	}
    }
    */
    ?>
					</div>	
				</div>
			</div>	
			
		</div>
		
		<?php 
    $_html_TD = ob_get_clean();
    $__hiddenVAL_TD = '';
    // --------------------------
    // HTML - location
    ob_start();
    ?>
			<div class='evcal_data_block_style1'>
				<p class='edb_icon evcal_edb_map'></p>
				<div class='evcal_db_data'>			
					<p>
					<?php 
    // location terms for event post
    $loc_term_id = $termMeta = '';
    $location_terms = get_the_terms($p_id, 'event_location');
    if ($location_terms && !is_wp_error($location_terms)) {
        foreach ($location_terms as $location_term) {
            $loc_term_id = $location_term->term_id;
            $termMeta = get_option("taxonomy_{$loc_term_id}");
        }
    }
    //print_r($location_terms);
    // GET all available location terms
    $terms = get_terms('event_location', array('hide_empty' => false));
    if (count($terms) > 0) {
        echo "<select id='evcal_location_field' name='evcal_location_name_select' class='evo_select_field'>\n\t\t\t\t\t\t\t\t<option value=''>" . __('Select a saved location', 'eventon') . "</option>";
        foreach ($terms as $term) {
            $loc_img_src = $loc_img_id = '';
            $t_id = $term->term_id;
            $term_meta = get_option("taxonomy_{$t_id}");
            $__selected = $loc_term_id == $t_id ? "selected='selected'" : null;
            // location image
            $loc_img_id = !empty($term_meta['evo_loc_img']) ? $term_meta['evo_loc_img'] : null;
            $img_src = !empty($loc_img_id) ? wp_get_attachment_image_src($loc_img_id, 'medium') : false;
            $loc_img_src = $img_src ? $img_src[0] : '';
            echo "<option value='" . $term->name . "' data-tid='{$t_id}' data-address='" . (!empty($term_meta['location_address']) ? esc_attr($term_meta['location_address']) : '') . "' data-lat='" . (!empty($term_meta['location_lat']) ? esc_attr($term_meta['location_lat']) : '') . "' data-lon='" . (!empty($term_meta['location_lon']) ? esc_attr($term_meta['location_lon']) : '') . "' {$__selected} data-loc_img_id='" . $loc_img_id . "' data-loc_img_src='{$loc_img_src}'>" . $term->name . "</option>";
        }
        echo "</select> <label for='evcal_location_field'>" . __('Choose already saved location or type new one below', 'eventon') . "</label>";
    }
    ?>
					<input id='evo_location_tax' type='hidden' name='evo_location_tax_id' value='<?php 
    echo $loc_term_id;
    ?>
'/>
					<input type='text' id='evcal_location_name' name='evcal_location_name' value="<?php 
    echo evo_meta($ev_vals, 'evcal_location_name', true);
    ?>
" style='width:100%' placeholder='eg. Irving City Park'/><label for='evcal_location_name'><?php 
    _e('Event Location Name', 'eventon');
    ?>
</label></p>
					<p><input type='text' id='evcal_location' name='evcal_location' value="<?php 
    echo evo_meta($ev_vals, 'evcal_location', true);
    ?>
" style='width:100%' placeholder='eg. 12 Rue de Rivoli, Paris'/><label for='evcal_location'><?php 
    _e('Event Location Address', 'eventon');
    ?>
</label></p>
					
					
					<p><input type='text' id='evcal_lat' class='evcal_latlon' name='evcal_lat' value='<?php 
    echo evo_meta($ev_vals, 'evcal_lat');
    ?>
' placeholder='<?php 
    _e('Latitude', 'eventon');
    ?>
'/>
					<input type='text' id='evcal_lon' class='evcal_latlon' name='evcal_lon' value='<?php 
    echo evo_meta($ev_vals, 'evcal_lon');
    ?>
' placeholder='<?php 
    _e('Longitude', 'eventon');
    ?>
'/></p>
					<p><i>(NOTE: If Latlon provided, Latlon will be used for generating google maps while location address will be shown as text address. Location address field is required for this to work. <a href='http://itouchmap.com/latlong.html' target='_blank'>Find LanLat for address</a>)</i></p>

					<!-- image -->
					<?php 
    $loc_img_id = !empty($ev_vals['evo_loc_img']) ? $ev_vals['evo_loc_img'][0] : false;
    // image soruce array
    $img_src = $loc_img_id ? wp_get_attachment_image_src($loc_img_id, 'medium') : null;
    $loc_img_src = !empty($img_src) ? $img_src[0] : null;
    $__button_text = !empty($loc_img_id) ? __('Remove Image', 'eventon') : __('Choose Image', 'eventon');
    $__button_text_not = empty($loc_img_id) ? __('Remove Image', 'eventon') : __('Choose Image', 'eventon');
    $__button_class = !empty($loc_img_id) ? 'removeimg' : 'chooseimg';
    // /echo $loc_img_id.' '.$img_src.'66';
    ?>
					<div class='evo_metafield_image' style='padding-top:10px'>
						
						<p >
							<input id='evo_loc_img_id' class='evo_loc_img' name="evo_loc_img" type="hidden" class="custom_upload_image" value="<?php 
    echo $loc_img_id ? $loc_img_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'>
                    			<img src='<?php 
    echo $loc_img_src;
    ?>
' style='<?php 
    echo !empty($loc_img_id) ? '' : 'display:none';
    ?>
'/>
                    		</span>
                    		<label><?php 
    _e('Event Location Image', 'eventon');
    ?>
</label>
                    	</p>

                    </div>
					
					<!-- HIDE google map option -->
					<p class='yesno_leg_line'>
						<?php 
    $location_val = !empty($ev_vals["evcal_gmap_gen"]) ? $ev_vals["evcal_gmap_gen"][0] : 'yes';
    echo eventon_html_yesnobtn(array('id' => 'evo_genGmap', 'var' => $location_val));
    ?>
						
						<input type='hidden' name='evcal_gmap_gen' value="<?php 
    echo !empty($ev_vals["evcal_gmap_gen"]) && $ev_vals["evcal_gmap_gen"][0] == 'yes' ? 'yes' : (empty($ev_vals["evcal_gmap_gen"]) ? 'yes' : 'no');
    ?>
"/>
						<label for='evcal_gmap_gen'><?php 
    _e('Generate Google Map from the address', 'eventon');
    ?>
</label>
					</p>
					<p style='clear:both'></p>

					<!-- Show location name over image -->
					<p class='yesno_leg_line'>
						<?php 
    $evcal_name_over_img = !empty($ev_vals["evcal_name_over_img"]) ? $ev_vals["evcal_name_over_img"][0] : 'no';
    echo eventon_html_yesnobtn(array('id' => 'evcal_name_over_img', 'var' => $evcal_name_over_img));
    ?>
						
						<input type='hidden' name='evcal_name_over_img' value="<?php 
    echo !empty($ev_vals["evcal_name_over_img"]) && $ev_vals["evcal_name_over_img"][0] == 'yes' ? 'yes' : 'no';
    ?>
"/>
						<label for='evcal_name_over_img'><?php 
    _e('Show location name & address over location image (If location image exist)', 'eventon');
    ?>
</label>
					</p>
					<p style='clear:both'></p>
				</div>
			</div>
		<?php 
    $_html_LOC = ob_get_clean();
    $__hiddenVAL_LOC = '';
    // --------------------------
    // HTML - Organizer
    ob_start();
    ?>

			<div class='evcal_data_block_style1'>
				<p class='edb_icon evcal_edb_map'></p>
				<div class='evcal_db_data'>			
					<p>
					<?php 
    // organier terms for event post
    $organizer_terms = get_the_terms($p_id, 'event_organizer');
    $termMeta = $org_term_id = '';
    if ($organizer_terms && !is_wp_error($organizer_terms)) {
        foreach ($organizer_terms as $org_term) {
            $org_term_id = $org_term->term_id;
            $termMeta = get_option("taxonomy_{$org_term_id}");
        }
    }
    // Get all available organizer terms
    $terms = get_terms('event_organizer', array('hide_empty' => false));
    if (count($terms) > 0) {
        echo "<select id='evcal_organizer_field' name='evcal_organizer_name_select' class='evo_select_field'>\n\t\t\t\t\t\t\t\t<option value=''>" . __('Select a saved organizer', 'eventon') . "</option>";
        foreach ($terms as $term) {
            $t_id = $term->term_id;
            $term_meta = get_option("taxonomy_{$t_id}");
            $__selected = $org_term_id == $t_id ? "selected='selected'" : null;
            echo "<option value='" . $term->name . "' data-tid='{$t_id}' data-contact='" . (!empty($term_meta['evcal_org_contact']) ? esc_attr($term_meta['evcal_org_contact']) : '') . "' data-img='" . (!empty($term_meta['evcal_org_img']) ? esc_attr($term_meta['evcal_org_img']) : '') . "' {$__selected}>" . $term->name . "</option>";
        }
        echo "</select> <label for='evcal_organizer_field'>" . __('Choose already saved organier or type new one below', 'eventon') . "</label>";
    }
    ?>
					<input id='evo_organizer_tax_id' type='hidden' name='evo_organizer_tax_id' value='<?php 
    echo $org_term_id;
    ?>
'/>
					<input type='text' id='evcal_organizer_name' name='evcal_organizer' value="<?php 
    echo !empty($ev_vals["evcal_organizer"]) ? $ev_vals["evcal_organizer"][0] : null;
    ?>
" style='width:100%' placeholder='eg. Blue Light Band'/><label for='evcal_organizer'><?php 
    _e('Event Organizer Name', 'eventon');
    ?>
</label></p>
					<p><input type='text' id='evcal_org_contact' name='evcal_org_contact' value="<?php 
    echo !empty($termMeta["evcal_org_contact"]) ? $termMeta["evcal_org_contact"] : null;
    ?>
" style='width:100%' placeholder='eg. noone[at] thismail.com'/><label for='evcal_org_contact'><?php 
    _e('(Optional) Organizer Contact Information', 'eventon');
    ?>
</label></p>
					
					<?php 
    /*<p><input type='text' id='evcal_org_img' name='evcal_org_img' value="<?php echo (!empty($termMeta["evcal_org_img"]) )? $termMeta["evcal_org_img"]:null?>" style='width:100%' placeholder='eg. URL to image'/><label for='evcal_evo_evcrd_field_org'><?php _e('(Optional) Organizer Image URL','eventon')?></label></p>*/
    ?>
					
					
					
					<!-- yea no field - hide organizer field from eventcard -->
					<p class='yesno_leg_line'>
						<?php 
    $evo_evcrd_field_org = !empty($ev_vals["evo_evcrd_field_org"]) ? $ev_vals["evo_evcrd_field_org"][0] : null;
    echo eventon_html_yesnobtn(array('id' => 'evo_org_field_ec', 'var' => $evo_evcrd_field_org));
    ?>
						
						<input type='hidden' name='evo_evcrd_field_org' value="<?php 
    echo !empty($ev_vals["evo_evcrd_field_org"]) && $ev_vals["evo_evcrd_field_org"][0] == 'yes' ? 'yes' : 'no';
    ?>
"/>
						<label for='evo_evcrd_field_org'><?php 
    _e('Hide Organizer field from EventCard', 'eventon');
    ?>
</label>
					</p>
					<p style='clear:both'></p>
				</div>
			</div>

		<?php 
    $_html_OR = ob_get_clean();
    $__hiddenVAL_OR = '';
    // --------------------------
    // HTML - User Interaction
    ob_start();
    ?>
			<div class='evcal_data_block_style1'>
				<div class='evcal_db_data'>
					
					<?php 
    $exlink_option = !empty($ev_vals["_evcal_exlink_option"]) ? $ev_vals["_evcal_exlink_option"][0] : 1;
    $exlink_target = !empty($ev_vals["_evcal_exlink_target"]) && $ev_vals["_evcal_exlink_target"][0] == 'yes' ? $ev_vals["_evcal_exlink_target"][0] : null;
    //echo $ev_vals["_evcal_exlink_target"][0].'tt';
    ?>
					
					<input id='evcal_exlink_option' type='hidden' name='_evcal_exlink_option' value='<?php 
    echo $exlink_option;
    ?>
'/>
					
					<input id='evcal_exlink_target' type='hidden' name='_evcal_exlink_target' value='<?php 
    echo $exlink_target;
    ?>
'/>
					
					<?php 
    $display_link_input = !empty($ev_vals["_evcal_exlink_option"]) && $ev_vals["_evcal_exlink_option"][0] != '1' ? 'display:block' : 'display:none';
    ?>
					<p <?php 
    echo $exlink_option == '1' || $exlink_option == '3' ? "style='display:none'" : null;
    ?>
 id='evo_new_window_io' class='<?php 
    echo $exlink_target == 'yes' ? 'selected' : null;
    ?>
'><span></span> <?php 
    _e('Open in new window', 'eventon');
    ?>
</p>
					
					<!-- external link field-->
					<input id='evcal_exlink' placeholder='<?php 
    _e('Type the URL address', 'eventon');
    ?>
' type='text' name='evcal_exlink' value='<?php 
    echo !empty($ev_vals["evcal_exlink"]) ? $ev_vals["evcal_exlink"][0] : null;
    ?>
' style='width:100%; <?php 
    echo $display_link_input;
    ?>
'/>
					
					<div class='evcal_db_uis'>
						<a link='no'  class='evcal_db_ui evcal_db_ui_1 <?php 
    echo $exlink_option == '1' ? 'selected' : null;
    ?>
' title='<?php 
    _e('Slide Down Event Card', 'eventon');
    ?>
' value='1'></a>
						
						<!-- open as link-->
						<a link='yes' class='evcal_db_ui evcal_db_ui_2 <?php 
    echo $exlink_option == '2' ? 'selected' : null;
    ?>
' title='<?php 
    _e('External Link', 'eventon');
    ?>
' value='2'></a>	
						
						<!-- open as popup -->
						<a link='yes' class='evcal_db_ui evcal_db_ui_3 <?php 
    echo $exlink_option == '3' ? ' selected' : null;
    ?>
' title='<?php 
    _e('Popup Window', 'eventon');
    ?>
' value='3'></a>
						
						<?php 
    // (-- addon --)
    if (has_action('evcal_ui_click_additions')) {
        do_action('evcal_ui_click_additions');
    }
    ?>
							
						<div class='clear'></div>
					</div>
				</div>
			</div>
		<?php 
    $_html_UIN = ob_get_clean();
    $__hiddenVAL_UIN = '';
    // --------------------------
    // HTML - Learn More
    ob_start();
    ?>
			<div class='evcal_data_block_style1'>
				<div class='evcal_db_data'>
					<input type='text' id='evcal_lmlink' name='evcal_lmlink' value='<?php 
    echo !empty($ev_vals["evcal_lmlink"]) ? $ev_vals["evcal_lmlink"][0] : null;
    ?>
' style='width:100%'/><br/>
					<input type='checkbox' name='evcal_lmlink_target' value='yes' <?php 
    echo !empty($ev_vals["evcal_lmlink_target"]) && $ev_vals["evcal_lmlink_target"][0] == 'yes' ? 'checked="checked"' : null;
    ?>
/> <?php 
    _e('Open in New window', 'eventon');
    ?>
				</div>
			</div>
		<?php 
    $_html_LM = ob_get_clean();
    $__hiddenVAL_LM = '';
    /** custom fields **/
    $evMB_custom = array();
    $num = evo_calculate_cmd_count($evcal_opt1);
    for ($x = 1; $x <= $num; $x++) {
        if (eventon_is_custom_meta_field_good($x)) {
            $fa_icon_class = $evcal_opt1['evcal__fai_00c' . $x];
            ob_start();
            echo "<div class='evcal_data_block_style1'>\n\t\t\t\t\t\t<div class='evcal_db_data'>";
            // FIELD
            $__saved_field_value = !empty($ev_vals["_evcal_ec_f" . $x . "a1_cus"]) ? $ev_vals["_evcal_ec_f" . $x . "a1_cus"][0] : null;
            $__field_id = '_evcal_ec_f' . $x . 'a1_cus';
            // wysiwyg editor
            if (!empty($evcal_opt1['evcal_ec_f' . $x . 'a2']) && $evcal_opt1['evcal_ec_f' . $x . 'a2'] == 'textarea') {
                wp_editor($__saved_field_value, $__field_id);
                // button
            } elseif (!empty($evcal_opt1['evcal_ec_f' . $x . 'a2']) && $evcal_opt1['evcal_ec_f' . $x . 'a2'] == 'button') {
                $__saved_field_link = !empty($ev_vals["_evcal_ec_f" . $x . "a1_cusL"]) ? $ev_vals["_evcal_ec_f" . $x . "a1_cusL"][0] : null;
                echo "<input type='text' id='" . $__field_id . "' name='_evcal_ec_f" . $x . "a1_cus' ";
                echo 'value="' . $__saved_field_value . '"';
                echo "style='width:100%' placeholder='Button Text' title='Button Text'/>";
                echo "<input type='text' id='" . $__field_id . "' name='_evcal_ec_f" . $x . "a1_cusL' ";
                echo 'value="' . $__saved_field_link . '"';
                echo "style='width:100%' placeholder='Button Link' title='Button Link'/>";
                $onw = !empty($ev_vals["_evcal_ec_f" . $x . "_onw"]) ? $ev_vals["_evcal_ec_f" . $x . "_onw"][0] : null;
                ?>
						<input type='checkbox' name='_evcal_ec_f<?php 
                echo $x;
                ?>
_onw' value='yes' <?php 
                echo !empty($onw) && $onw == 'yes' ? 'checked="checked"' : null;
                ?>
/> <?php 
                _e('Open in New window', 'eventon');
                ?>
						<?php 
                // text
            } else {
                echo "<input type='text' id='" . $__field_id . "' name='_evcal_ec_f" . $x . "a1_cus' ";
                echo 'value="' . $__saved_field_value . '"';
                echo "style='width:100%'/>";
            }
            echo "</div></div>";
            $__html = ob_get_clean();
            $evMB_custom[] = array('id' => 'evcal_ec_f' . $x . 'a1', 'variation' => 'customfield', 'name' => $evcal_opt1['evcal_ec_f' . $x . 'a1'], 'iconURL' => $fa_icon_class, 'iconPOS' => '', 'type' => 'code', 'content' => $__html, 'slug' => 'evcal_ec_f' . $x . 'a1');
        }
    }
    // array of all meta boxes
    $metabox_array = apply_filters('eventon_event_metaboxs', array(array('id' => 'ev_subtitle', 'name' => __('Event SubTitle', 'eventon'), 'variation' => 'customfield', 'hiddenVal' => $__hiddenVAL_ST, 'iconURL' => 'fa-pencil', 'iconPOS' => '', 'type' => 'code', 'content' => $_html_ST, 'slug' => 'ev_subtitle'), array('id' => 'ev_timedate', 'name' => __('Time and Date', 'eventon'), 'hiddenVal' => $__hiddenVAL_TD, 'iconURL' => '', 'iconPOS' => '0 -190px', 'type' => 'code', 'content' => $_html_TD, 'slug' => 'ev_timedate'), array('id' => 'ev_location', 'name' => __('Location and Venue', 'eventon'), 'hiddenVal' => $__hiddenVAL_LOC, 'iconURL' => '', 'iconPOS' => '0 -225px', 'type' => 'code', 'content' => $_html_LOC, 'slug' => 'ev_location', 'guide' => ''), array('id' => 'ev_organizer', 'name' => __('Organizer', 'eventon'), 'hiddenVal' => $__hiddenVAL_OR, 'iconURL' => '', 'iconPOS' => '0 -31px', 'type' => 'code', 'content' => $_html_OR, 'slug' => 'ev_organizer'), array('id' => 'ev_uint', 'name' => __('User Interaction for event click', 'eventon'), 'hiddenVal' => $__hiddenVAL_UIN, 'iconURL' => '', 'iconPOS' => '0 -262px', 'type' => 'code', 'content' => $_html_UIN, 'slug' => 'ev_uint', 'guide' => 'This define how you want the events to expand following a click on the eventTop by a user'), array('id' => 'ev_learnmore', 'name' => __('Learn more about event link', 'eventon'), 'hiddenVal' => $__hiddenVAL_LM, 'iconURL' => '', 'iconPOS' => '0 -96px', 'type' => 'code', 'content' => $_html_LM, 'slug' => 'ev_learnmore', 'guide' => 'This will create a learn more link in the event card. Make sure your links start with http://')));
    // combine array with custom fields
    $metabox_array = !empty($evMB_custom) && count($evMB_custom) > 0 ? array_merge($metabox_array, $evMB_custom) : $metabox_array;
    $closedmeta = eventon_get_collapse_metaboxes($p_id);
    //print_r($closedmeta);
    ?>
	
	
	<div id='evo_mb' class='eventon_mb'>
		<input type='hidden' id='evo_collapse_meta_boxes' name='evo_collapse_meta_boxes' value=''/>
	<?php 
    foreach ($metabox_array as $mBOX) {
        // ICONS
        $icon_style = !empty($mBOX['iconURL']) ? 'background-image:url(' . $mBOX['iconURL'] . ')' : 'background-position:' . $mBOX['iconPOS'];
        $icon_class = !empty($mBOX['iconPOS']) ? 'evIcons' : 'evII';
        $guide = !empty($mBOX['guide']) ? $eventon->throw_guide($mBOX['guide'], '', false) : null;
        $hiddenVal = !empty($mBOX['hiddenVal']) ? '<span class="hiddenVal">' . $mBOX['hiddenVal'] . '</span>' : null;
        $closed = !empty($closedmeta) && in_array($mBOX['id'], $closedmeta) ? 'closed' : null;
        ?>
	
	
		<div class='evomb_section' id='<?php 
        echo $mBOX['id'];
        ?>
'>			
			<div class='evomb_header'>
				<?php 
        // custom field with icons
        if (!empty($mBOX['variation']) && $mBOX['variation'] == 'customfield') {
            ?>
	
					<span class='evomb_icon <?php 
            echo $icon_class;
            ?>
'><i class='fa <?php 
            echo $mBOX['iconURL'];
            ?>
'></i></span>
					
				<?php 
        } else {
            ?>
					<span class='evomb_icon <?php 
            echo $icon_class;
            ?>
' style='<?php 
            echo $icon_style;
            ?>
'></span>
				<?php 
        }
        ?>
				<p><?php 
        echo $mBOX['name'];
        echo $hiddenVal;
        echo $guide;
        ?>
</p>
			</div>
			<div class='evomb_body <?php 
        echo $closed;
        ?>
' box_id='<?php 
        echo $mBOX['id'];
        ?>
'>
				<?php 
        echo $mBOX['content'];
        ?>
			</div>
		</div>
	<?php 
    }
    ?>
		<div class='evMB_end'></div>
	</div>

	
	
	
	

<?php 
}
    /** GENERATE individual event data	 */
    public function generate_event_data($event_list_array, $focus_month_beg_range = '', $FOCUS_month_int = '', $FOCUS_year_int = '')
    {
        $months_event_array = '';
        // Initial variables
        $wp_time_format = get_option('time_format');
        $default_event_color = !empty($this->evopt1['evcal_hexcode']) ? '#' . $this->evopt1['evcal_hexcode'] : '#206177';
        $__shortC_arg = $this->shortcode_args;
        // user interavtion for the calendar
        $calendar_ux_val = !empty($__shortC_arg['ux_val']) ? $__shortC_arg['ux_val'] : '0';
        $__count = 0;
        // EVENT CARD open by default variables
        $_is_eventCardOpen = !empty($__shortC_arg['evc_open']) && $__shortC_arg['evc_open'] == 'yes' ? true : ($this->is_eventcard_open ? true : false);
        $eventcard_script_class = $_is_eventCardOpen ? "gmaponload" : null;
        $this->is_eventcard_open = false;
        // check featured events are prioritized
        $__feature_events = !empty($__shortC_arg['ft_event_priority']) && $__shortC_arg['ft_event_priority'] != 'no' ? true : false;
        // GET EventTop fields - v2.1.17
        $eventop_fields = !empty($this->evopt1['evcal_top_fields']) ? $this->evopt1['evcal_top_fields'] : null;
        // Number of activated taxnomonies v 2.2.15
        $_active_tax = evo_get_ett_count($this->evopt1);
        // eventCARD HTML
        require_once AJDE_EVCAL_PATH . '/includes/eventon_eventCard.php';
        require_once AJDE_EVCAL_PATH . '/includes/eventon-eventTop.php';
        // check if single event exist
        $_sin_ev_ex = in_array('eventon-single-event/eventon-single-event.php', get_option('active_plugins')) ? true : false;
        // EACH EVENT
        if (is_array($event_list_array)) {
            foreach ($event_list_array as $event_) {
                // Intials
                $html_event_detail_card = '';
                $_eventClasses = $_eventInClasses = array();
                $_eventAttr = $_eventInAttr = array();
                $__count++;
                $event_id = $event_['event_id'];
                $event_start_unix = $event_['event_start_unix'];
                $event_end_unix = $event_['event_end_unix'];
                $event_type = $event_['event_type'];
                $ev_vals = $event_['event_pmv'];
                $event = get_post($event_id);
                $_eventInClasses[] = $eventcard_script_class;
                // set how a single event would interact
                $event_ux_val = !empty($ev_vals['_evcal_exlink_option']) ? $ev_vals['_evcal_exlink_option'][0] : 1;
                $event_permalink = get_permalink($event_id);
                $event_ux_val = $calendar_ux_val != '1' ? $calendar_ux_val : $event_ux_val;
                // whether eventcard elements need to be included or not
                $_event_card_on = $calendar_ux_val == '4' || $calendar_ux_val == 'X' || $event_ux_val == '4' || $event_ux_val == '2' ? false : true;
                $_event_card_on = $_is_eventCardOpen ? true : $_event_card_on;
                // if event card is forced to open then
                $html_tag = $event_ux_val == '1' ? 'div' : 'a';
                $html_tag = $_event_card_on ? 'a' : $html_tag;
                //echo ($_is_eventCardOpen?3:4). ' '.($_event_card_on?3:4). ' '.$calendar_ux_val.' '.$event_ux_val;
                // year long or not
                $__year_long_event = !empty($ev_vals['evo_year_long']) && $ev_vals['evo_year_long'][0] == 'yes' ? true : 0;
                // define variables
                $ev_other_data = $ev_other_data_top = $html_event_type_info = $_event_date_HTML = $_eventcard = $html_event_type_2_info = '';
                $_is_end_date = true;
                // UNIX date values
                $DATE_start_val = eventon_get_formatted_time($event_start_unix);
                if (empty($event_end_unix)) {
                    $_is_end_date = false;
                    $DATE_end_val = $DATE_start_val;
                } else {
                    $DATE_end_val = eventon_get_formatted_time($event_end_unix);
                }
                // if this event featured
                $_eventInClasses['__featured'] = $this->helper->evo_meta('_featured', $ev_vals, 'tf');
                $_eventInClasses['_cancel'] = $this->helper->evo_meta('_cancel', $ev_vals, 'tf');
                // GET: repeat interval for this event
                $__repeatInterval = !empty($event_['event_repeat_interval']) ? $event_['event_repeat_interval'] : (!empty($_GET['ri']) ? $_GET['ri'] : 0);
                // Unique ID generation
                $unique_varied_id = 'evc' . $event_start_unix . uniqid() . $event_id;
                $unique_id = 'evc_' . $event_start_unix . $event_id;
                // All day event variables
                $_is_allday = $this->helper->evo_meta('evcal_allday', $ev_vals, 'tf');
                $_hide_endtime = $this->helper->evo_meta('evo_hide_endtime', $ev_vals, 'tf');
                $evcal_lang_allday = $this->lang('evcal_lang_allday', 'All Day');
                /*
                	evo_hide_endtime
                	NOTE: if its set to hide end time, meaning end time and date would be empty on wp-admin, which will fall into same start end month category.
                */
                $_event_date_HTML = $this->generate_time_($DATE_start_val, $DATE_end_val, $ev_vals, $evcal_lang_allday, $focus_month_beg_range, $FOCUS_month_int, $event_start_unix, $event_end_unix);
                // (---) hook for addons
                $_event_date_HTML = apply_filters('eventon_eventcard_date_html', $_event_date_HTML, $event_id);
                // EACH DATA FIELD
                // EVENT FEATURES IMAGE
                $img_id = get_post_thumbnail_id($event_id);
                $img_med_src = $img_thumb_src = '';
                if ($img_id != '') {
                    $img_src = wp_get_attachment_image_src($img_id, 'full');
                    $img_med_src = wp_get_attachment_image_src($img_id, 'medium');
                    $img_thumb_src = wp_get_attachment_image_src($img_id, 'thumbnail');
                    // append to eventcard array
                    $_eventcard['ftimage'] = array('img' => $img_src, 'hovereffect' => !empty($this->evopt1['evo_ftimghover']) ? $this->evopt1['evo_ftimghover'] : null, 'clickeffect' => !empty($this->evopt1['evo_ftimgclick']) ? $this->evopt1['evo_ftimgclick'] : null, 'min_height' => !empty($this->evopt1['evo_ftimgheight']) ? $this->evopt1['evo_ftimgheight'] : 400, 'ftimg_sty' => !empty($this->evopt1['evo_ftimg_height_sty']) ? $this->evopt1['evo_ftimg_height_sty'] : 'minimized');
                }
                // EVENT DESCRIPTION
                $evcal_event_content = $event->post_content;
                if (!empty($evcal_event_content)) {
                    $event_full_description = $evcal_event_content;
                } else {
                    // event description compatibility from older versions.
                    $event_full_description = !empty($ev_vals['evcal_description']) ? $ev_vals['evcal_description'][0] : null;
                }
                if (!empty($event_full_description)) {
                    $except = $event->post_excerpt;
                    $event_excerpt = eventon_get_event_excerpt($event_full_description, 30, $except);
                    $_eventcard['eventdetails'] = array('fulltext' => $event_full_description, 'excerpt' => $event_excerpt);
                }
                // EVENT LOCATION
                $lonlat = !empty($ev_vals['evcal_lat']) && !empty($ev_vals['evcal_lon']) ? 'data-latlng="' . $ev_vals['evcal_lat'][0] . ',' . $ev_vals['evcal_lon'][0] . '" ' : null;
                $__location = $this->helper->evo_meta('evcal_location', $ev_vals, 'null');
                // location name
                $__location_name = stripslashes(evo_meta($ev_vals, 'evcal_location_name'));
                $_eventcard['timelocation'] = array('timetext' => $_event_date_HTML['html_prettytime'], 'location' => $__location, 'location_name' => $__location_name, 'timezone' => !empty($ev_vals['evo_event_timezone']) ? $ev_vals['evo_event_timezone'][0] : null);
                // Location Image
                $loc_img_id = $this->helper->evo_meta('evo_loc_img', $ev_vals, 'null');
                if (!empty($loc_img_id)) {
                    $_eventcard['locImg'] = array('id' => $loc_img_id, 'fullheight' => !empty($this->evopt1['evo_locimgheight']) ? $this->evopt1['evo_locimgheight'] : 400);
                    // location name and address
                    if (evo_check_yn($ev_vals, 'evcal_name_over_img') && !empty($__location_name)) {
                        $_eventcard['locImg']['locName'] = $__location_name;
                        if (!empty($__location)) {
                            $_eventcard['locImg']['locAdd'] = $__location;
                        }
                    }
                }
                // GOOGLE maps
                if ($this->google_maps_load && ($__location || !empty($lonlat)) && (!empty($ev_vals['evcal_gmap_gen']) && $ev_vals['evcal_gmap_gen'][0] == 'yes')) {
                    $_eventcard['gmap'] = array('id' => $unique_varied_id);
                    // GET directions
                    if ($this->evopt1['evo_getdir'] == 'yes' && !empty($ev_vals['evcal_location'])) {
                        $_eventcard['getdirection'] = array('fromaddress' => $ev_vals['evcal_location'][0]);
                    }
                } else {
                    $_eventInAttr['data-gmap_status'] = 'null';
                }
                // EVENT BRITE
                // check if eventbrite actually used in this event
                if ($_event_card_on && !empty($ev_vals['evcal_eventb_data_set']) && $ev_vals['evcal_eventb_data_set'][0] == 'yes') {
                    // Event brite capacity
                    if (!empty($ev_vals['evcal_eventb_tprice']) && !empty($ev_vals['evcal_eventb_url'])) {
                        $_eventcard['eventbrite'] = array('capacity' => !empty($ev_vals['evcal_eventb_capacity']) ? $ev_vals['evcal_eventb_capacity'][0] : null, 'tix_price' => $ev_vals['evcal_eventb_tprice'][0], 'url' => $ev_vals['evcal_eventb_url'][0]);
                    }
                }
                // PAYPAL Code
                if (!empty($ev_vals['evcal_paypal_item_price'][0]) && $this->evopt1['evcal_paypal_pay'] == 'yes') {
                    $_eventcard['paypal'] = array('title' => $event->post_title, 'price' => $ev_vals['evcal_paypal_item_price'][0], 'text' => !empty($ev_vals['evcal_paypal_text']) ? $ev_vals['evcal_paypal_text'][0] : null);
                }
                // Event Organizer
                if (!empty($ev_vals['evcal_organizer']) && (!empty($ev_vals['evo_evcrd_field_org']) && $ev_vals['evo_evcrd_field_org'][0] != 'yes')) {
                    $_eventcard['organizer'] = array('value' => $ev_vals['evcal_organizer'][0], 'contact' => !empty($ev_vals['evcal_org_contact']) ? $ev_vals['evcal_org_contact'][0] : null, 'imgid' => !empty($ev_vals['evo_org_img']) ? $ev_vals['evo_org_img'][0] : null);
                }
                // Custom fields
                $_cmf_count = evo_retrieve_cmd_count($this->evopt1);
                for ($x = 1; $x < $_cmf_count + 1; $x++) {
                    if (!empty($this->evopt1['evcal_ec_f' . $x . 'a1']) && !empty($this->evopt1['evcal__fai_00c' . $x]) && !empty($ev_vals["_evcal_ec_f" . $x . "a1_cus"])) {
                        // check if hide this from eventCard set to yes
                        if (empty($this->evopt1['evcal_ec_f' . $x . 'a3']) || $this->evopt1['evcal_ec_f' . $x . 'a3'] == 'no') {
                            $faicon = $this->evopt1['evcal__fai_00c' . $x];
                            $_eventcard['customfield' . $x] = array('imgurl' => $faicon, 'x' => $x, 'value' => $ev_vals["_evcal_ec_f" . $x . "a1_cus"][0], 'valueL' => !empty($ev_vals["_evcal_ec_f" . $x . "a1_cusL"]) ? $ev_vals["_evcal_ec_f" . $x . "a1_cusL"][0] : null, '_target' => !empty($ev_vals["_evcal_ec_f" . $x . "_onw"]) ? $ev_vals["_evcal_ec_f" . $x . "_onw"][0] : null, 'type' => $this->evopt1['evcal_ec_f' . $x . 'a2']);
                        }
                    }
                }
                // LEARN MORE and ICS
                if (!empty($ev_vals['evcal_lmlink']) || !empty($this->evopt1['evo_ics']) && $this->evopt1['evo_ics'] == 'yes') {
                    $_eventcard['learnmoreICS'] = array('event_id' => $event_id, 'learnmorelink' => !empty($ev_vals['evcal_lmlink']) ? $ev_vals['evcal_lmlink'][0] : null, 'learnmore_target' => !empty($ev_vals['evcal_lmlink_target']) && $ev_vals['evcal_lmlink_target'][0] == 'yes' ? 'target="_blank"' : null, 'estart' => $event_start_unix, 'eend' => $event_end_unix, 'etitle' => $event->post_title, 'evals' => $ev_vals);
                }
                // =======================
                /** CONSTRUCT the EVENT CARD	 **/
                if ($_event_card_on && !empty($_eventcard) && count($_eventcard) > 0) {
                    // filter hook for eventcard content array - updated 2.2.20
                    $_eventcard = apply_filters('eventon_eventcard_array', $_eventcard, $ev_vals, $event_id, $__repeatInterval);
                    // if an order is set reorder things
                    if (!empty($this->evopt1['evoCard_order'])) {
                        $_eventcard = $this->helper->eventcard_sort($_eventcard, $this->evopt1);
                    }
                    ob_start();
                    echo "<div class='event_description evcal_eventcard " . ($_is_eventCardOpen ? 'open' : null) . "' " . ($_is_eventCardOpen ? 'style="display:block"' : 'style="display:none"') . ">";
                    echo eventon_eventcard_print($_eventcard, $this->evopt1, $this->evopt2);
                    // (---) hook for addons
                    do_action('eventon_eventcard_additions', $event_id, $this->__calendar_type, $event->post_title, $event_full_description, $img_thumb_src, $__repeatInterval);
                    echo "</div>";
                    $html_event_detail_card = ob_get_clean();
                }
                /** Trigger attributes **/
                $event_description_trigger = "desc_trig";
                $_eventInAttr['data-gmtrig'] = !empty($ev_vals['evcal_gmap_gen']) && $ev_vals['evcal_gmap_gen'][0] == 'yes' ? '1' : '0';
                // Generate tax terms for event top
                $html_event_type_tax_ar = array();
                $_tax_names_array = evo_get_localized_ettNames('', $this->evopt1, $this->evopt2);
                //$_tax_names_array = evo_get_ettNames($this->evopt1);
                //print_r($_tax_names_array);
                $evcal_terms_ = '';
                if (!empty($eventop_fields)) {
                    // foreach active tax
                    for ($b = 1; $b <= $_active_tax; $b++) {
                        $__tx_content = '';
                        $__tax_slug = 'event_type' . ($b == 1 ? '' : '_' . $b);
                        $__tax_fields = 'eventtype' . ($b == 1 ? '' : $b);
                        // for override evc colors
                        if ($b == 1) {
                            $evcal_terms_ = wp_get_post_terms($event_id, $__tax_slug);
                        }
                        if (in_array($__tax_fields, $eventop_fields)) {
                            $evcal_terms = !empty($evcal_terms_) && $b == 1 ? $evcal_terms_ : wp_get_post_terms($event_id, $__tax_slug);
                            if ($evcal_terms) {
                                $__tax_name = $_tax_names_array[$b];
                                $__tx_content .= "<span class='evcal_event_types ett{$b}'><em><i>" . $__tax_name . ":</i></em>";
                                $i = 1;
                                foreach ($evcal_terms as $termA) {
                                    // get translated tax term name
                                    $term_name = $this->lang('evolang_' . $__tax_slug . '_' . $termA->term_id, $termA->name);
                                    // tax term slug as class name
                                    $_eventInClasses[] = 'evo_' . $termA->slug;
                                    $__tx_content .= "<em data-filter='{$__tax_slug}'>" . $term_name . (count($evcal_terms) != $i ? ',' : '') . "</em>";
                                    $i++;
                                }
                                $__tx_content .= "<i class='clear'></i></span>";
                                $html_event_type_tax_ar[$b] = $__tx_content;
                            }
                        }
                    }
                }
                $_html_tax_content = count($html_event_type_tax_ar) > 0 ? implode('', $html_event_type_tax_ar) : null;
                // event color
                $event_color = eventon_get_hex_color($ev_vals, $default_event_color);
                // override event colors
                if (!empty($__shortC_arg['etc_override']) && $__shortC_arg['etc_override'] == 'yes' && !empty($evcal_terms_)) {
                    $ev_id = $evcal_terms_[0]->term_id;
                    $ev_color = get_option("evo_et_taxonomy_{$ev_id}");
                    $event_color = !empty($ev_color['et_color']) ? $ev_color['et_color'] : $event_color;
                    // remove additional '#' in the hex code
                    $event_color = '#' . str_replace('#', '', $event_color);
                }
                // if UX to be open in new window then use link to single event or that link
                $link_append = array();
                $_link_text = '';
                if (!empty($__shortC_arg['lang']) && $__shortC_arg['lang'] != 'L1') {
                    $link_append['l'] = $__shortC_arg['lang'];
                }
                // append repeat interval value to event link
                $link_append['ri'] = $__repeatInterval;
                if (!empty($link_append)) {
                    foreach ($link_append as $lp => $lpk) {
                        if ($lp == 'ri' && $lpk == '0') {
                            continue;
                        }
                        $_link_text .= $lp . '=' . $lpk . '&';
                    }
                }
                // passing URL variables values
                $_link_text_append = strpos($event_permalink, '?') === false ? '?' : '&';
                $_link_text = !empty($_link_text) ? $_link_text_append . $_link_text : null;
                $_eventInAttr['rest'][] = !empty($ev_vals['evcal_exlink']) && $event_ux_val != '1' ? 'data-exlk="1" href="' . $ev_vals['evcal_exlink'][0] . $_link_text . '"' : 'data-exlk="0"';
                // target
                $_eventInAttr['rest'][] = !empty($ev_vals['_evcal_exlink_target']) && $ev_vals['_evcal_exlink_target'][0] == 'yes' ? 'target="_blank"' : null;
                // EVENT LOCATION
                if (evo_location_exists($ev_vals)) {
                    $location_address = !empty($ev_vals['evcal_location']) ? $ev_vals['evcal_location'][0] : null;
                    // location as LON LAT
                    $event_location_variables = (!empty($lonlat) ? $lonlat : null) . ' data-location_address="' . $location_address . '" ';
                    // conditional schema data for event
                    if (!empty($this->evopt1['evo_schema']) && $this->evopt1['evo_schema'] == 'yes') {
                        $__scheme_data_location = '';
                    } else {
                        $__scheme_data_location = '
									<item style="display:none" itemprop="location" itemscope itemtype="http://schema.org/Place">
										' . (!empty($__location_name) ? '<span itemprop="name">' . $__location_name . '</span>' : '') . '
										<span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
											<item itemprop="streetAddress">' . $location_address . '</item>
										</span>
									</item>';
                    }
                    $ev_location = !empty($location_address) ? '<em class="evcal_location" ' . (!empty($lonlat) ? $lonlat : null) . ' data-add_str="' . $location_address . '">' . $location_address . '</em>' : null;
                    // location type
                    $event_location_variables .= !empty($lonlat) ? 'data-location_type="lonlat"' : 'data-location_type="address"';
                    // location name
                    $event_location_variables .= !empty($ev_vals['evcal_location_name']) ? ' data-location_name="' . $ev_vals['evcal_location_name'][0] . '"' : null;
                    // location status
                    $event_location_variables .= ' data-location_status="true"';
                } else {
                    // location status
                    $ev_location = $event_location_variables = $__scheme_data_location = null;
                    $event_location_variables .= ' data-location_status="false"';
                }
                // EVENT tags
                $_event_tags = wp_get_post_tags($event_id);
                // EVENT TOP
                $eventtop_html = $eventop_fields_ = $__eventtop = '';
                // CHECK for event top fields array
                $eventop_fields_ = is_array($eventop_fields) ? true : false;
                // featured image
                if (!empty($img_thumb_src) && !empty($__shortC_arg['show_et_ft_img']) && $__shortC_arg['show_et_ft_img'] == 'yes') {
                    $__eventtop['ft_img'] = array('url' => $img_thumb_src[0], 'url_med' => !empty($img_med_src[0]) ? $img_med_src[0] : '');
                }
                // date block
                if (!$__year_long_event) {
                    // date number
                    $___day_name = $eventop_fields_ && in_array('dayname', $eventop_fields) ? "<em class='evo_day' >" . $DATE_start_val['D'] . "</em>" : null;
                    $__eventtop['day_block'] = array('start' => $DATE_start_val, 'color' => $event_color, 'day_name' => $___day_name, 'html' => $_event_date_HTML);
                }
                // event titles
                $__eventtop['titles'] = array('yearlong' => $__year_long_event, 'loc_vars' => $event_location_variables, 'title' => isset($event->post_title) ? $event->post_title : '', 'cancel' => $_eventInClasses['_cancel'], 'cancel_reason' => $this->helper->evo_meta('_cancel_reason', $ev_vals, 'null'), 'subtitle' => !empty($ev_vals['evcal_subtitle']) ? $ev_vals['evcal_subtitle'][0] : null);
                // below title
                $__eventtop['belowtitle'] = array('fields_' => $eventop_fields_, 'fields' => $eventop_fields, 'evvals' => $ev_vals, 'html' => $_event_date_HTML, 'location' => $ev_location, 'locationname' => !empty($ev_vals['evcal_location_name']) ? $ev_vals['evcal_location_name'][0] : null, 'tax' => $_html_tax_content, 'tags' => $_event_tags, 'cmdcount' => $_cmf_count, 'timezone' => !empty($ev_vals['evo_event_timezone']) ? $ev_vals['evo_event_timezone'][0] : null);
                // close eventtop
                $_passVal = array('eventid' => $event_id, 'ri' => $__repeatInterval, 'fields_' => $eventop_fields_, 'fields' => $eventop_fields);
                $__eventtop = apply_filters('eventon_eventtop_one', $__eventtop, $ev_vals, $_passVal);
                $__eventtop['close1'] = array();
                $__eventtop = apply_filters('eventon_eventtop_two', $__eventtop, $ev_vals, $_passVal);
                $__eventtop['close2'] = array();
                // CONSTRUCT event top html
                if (!empty($__eventtop) && count($__eventtop) > 0) {
                    ob_start();
                    echo eventon_get_eventtop_print($__eventtop, $this->evopt1, $this->evopt2);
                    $eventtop_html = ob_get_clean();
                    $eventtop_html = apply_filters('eventon_eventtop_html', $eventtop_html);
                } else {
                    $eventtop_html = null;
                }
                // (---) hook for addons
                $html_info_line = apply_filters('eventon_event_cal_short_info_line', $eventtop_html);
                // SCHEME SEO
                // conditional schema data
                if (!empty($this->evopt1['evo_schema']) && $this->evopt1['evo_schema'] == 'yes') {
                    $__scheme_data = '<div class="evo_event_schema" style="display:none" >
							<a href="' . $event_permalink . '"></a></div>';
                    $__scheme_attributes = '';
                } else {
                    $event_permalink = $_sin_ev_ex ? $event_permalink . $_link_text : "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
                    $__scheme_data = '<div class="evo_event_schema" style="display:none" >
							<a href="' . $event_permalink . '" itemprop="url"></a>				
							<time itemprop="startDate" datetime="' . $DATE_start_val['Y'] . '-' . $DATE_start_val['n'] . '-' . $DATE_start_val['j'] . '"></time>
							<time itemprop="endDate" datetime="' . $DATE_end_val['Y'] . '-' . $DATE_end_val['n'] . '-' . $DATE_end_val['j'] . '"></time>' . $__scheme_data_location . '</div>';
                    $__scheme_attributes = "itemscope itemtype='http://schema.org/Event'";
                }
                // CLASES - attribute
                $_eventClasses[] = 'eventon_list_event';
                $_eventClasses[] = 'event';
                $_eventInClasses[] = $_event_date_HTML['class_daylength'];
                $_eventInClasses[] = 'evcal_list_a';
                $_eventInClasses_ = $this->helper->get_eventinclasses(array('existing_classes' => $_eventInClasses, 'show_et_ft_img' => !empty($__shortC_arg['show_et_ft_img']) ? $__shortC_arg['show_et_ft_img'] : 'no', 'img_thumb_src' => $img_thumb_src, 'event_type' => $event_type, 'event_description_trigger' => $event_description_trigger));
                // show limit styles
                if (!empty($__shortC_arg['show_limit']) && $__shortC_arg['show_limit'] == 'yes' && !empty($__shortC_arg['event_count']) && $__shortC_arg['event_count'] > 0 && $__count > $__shortC_arg['event_count']) {
                    $_eventAttr['style'][] = "display:none";
                    $_eventClasses[] = 'evSL';
                }
                $eventbefore = '';
                // TILES STYLE
                if (!empty($__shortC_arg['tiles']) && $__shortC_arg['tiles'] == 'yes') {
                    // boxy event colors
                    // if featured image exists for an event
                    if (!empty($img_med_src) && $__shortC_arg['tile_bg'] == 1) {
                        $_this_style = 'background-image: url(' . $img_med_src[0] . '); background-color:' . $event_color . ';';
                        $_eventClasses[] = 'hasbgimg';
                    } else {
                        $_this_style = 'background-color: ' . $event_color . ';';
                    }
                    // support different tile style
                    if (!empty($__shortC_arg['tile_style']) && $__shortC_arg['tile_style'] != '0') {
                        $eventbefore = '<div class="evo_topbar" style="' . $_this_style . '"></div>';
                    } else {
                        $_eventAttr['style'][] = $_this_style;
                    }
                    // tile height
                    if ($__shortC_arg['tile_height'] != 0) {
                        $_eventAttr['style'][] = 'height: ' . $__shortC_arg['tile_height'] . 'px;';
                    }
                    // tile count
                    if ($__shortC_arg['tile_count'] != 2) {
                        //$perct = (int)(100/$__shortC_arg['tile_count']);
                        //$_eventAttr['style'][] = 'width: '.$perct.'%;';
                    }
                } else {
                    $_eventInAttr['style'][] = 'border-color: ' . $event_color . ';';
                }
                $_eventAttr['id'] = 'event_' . $event_id;
                $_eventAttr['class'] = $this->helper->implode($_eventClasses);
                $_eventAttr['data-event_id'] = $event_id;
                $_eventAttr['data-ri'] = $__repeatInterval;
                $_eventAttr['data-colr'] = $event_color;
                $_eventAttr['rest'][] = $__scheme_attributes;
                $atts = $this->helper->get_attrs($_eventAttr);
                $_eventInAttr['id'] = $unique_id;
                $_eventInAttr['class'] = $_eventInClasses_;
                $_eventInAttr['data-ux_val'] = $event_ux_val;
                $attsIn = $this->helper->get_attrs($_eventInAttr);
                // build the event HTML
                $event_html_code = "<div {$atts}>{$eventbefore}{$__scheme_data}\r\n\t\t\t\t<{$html_tag} {$attsIn}>{$html_info_line}</{$html_tag}>" . $html_event_detail_card . "<div class='clear end'></div></div>";
                // prepare output
                $months_event_array[] = array('event_id' => $event_id, 'srow' => $event_start_unix, 'erow' => $event_end_unix, 'content' => $event_html_code);
            }
        } else {
            $months_event_array;
        }
        return $months_event_array;
    }
Beispiel #6
0
    function frontend_box($object, $helpers)
    {
        global $evotx, $woocommerce;
        $txmeta = get_post_custom($object->event_id);
        // not show event tickets if tickets to show only for loggedin users
        if (!empty($evotx->evotx_opt['evotx_loggedinuser']) && $evotx->evotx_opt['evotx_loggedinuser'] == 'yes' && !is_user_logged_in()) {
            return;
        }
        if (!empty($txmeta['evotx_tix']) && $txmeta['evotx_tix'][0] == 'yes') {
            // get options array
            $woo_product_id = $txmeta['tx_woocommerce_product_id'][0];
            $woometa = get_post_custom($woo_product_id);
            $opt = $helpers['evoOPT2'];
            ob_start();
            ?>

				<div class='evorow evcal_evdata_row bordb evcal_evrow_sm evo_metarow_tix <?php 
            echo $helpers['end_row_class'];
            ?>
' data-tx='' data-event_id='<?php 
            echo $object->event_id;
            ?>
' data-ri='<?php 
            echo $object->repeat_interval;
            ?>
'>
					<span class='evcal_evdata_icons'><i class='fa <?php 
            echo get_eventON_icon('evcal__evotx_001', 'fa-tags', $helpers['evOPT']);
            ?>
'></i></span>
					<div class='evcal_evdata_cell'>							
						<h3 class='evo_h3'><?php 
            echo eventon_get_custom_language($opt, 'evoTX_001', 'Ticket Section Title');
            ?>
</h3>
						<p class='evo_data_val'><?php 
            echo evo_meta($woometa, '_tx_text');
            ?>
</p>

						<?php 
            // ticket image id - if exists
            $_tix_image_id = !empty($txmeta['_tix_image_id']) ? $txmeta['_tix_image_id'][0] : false;
            ?>

						<div class='evoTX_wc <?php 
            echo $_tix_image_id ? 'tximg' : '';
            ?>
' data-si='<?php 
            echo !empty($woometa['_sold_individually']) ? $woometa['_sold_individually'][0] : '-';
            ?>
' >
							<div class='evoTX_wc_section'>

							<?php 
            $_repeat_in_stock = true;
            $capacity_of_this_repeat = 'none';
            // check if capacity managed by repeat intervals of event
            if (evo_check_yn($txmeta, '_manage_repeat_cap') && evo_check_yn($txmeta, 'evcal_repeat') && !empty($txmeta['repeat_intervals']) && !empty($txmeta['ri_capacity']) && $product->product_type == 'simple') {
                $ri_capacity = unserialize($txmeta['ri_capacity'][0]);
                $capacity_of_this_repeat = isset($ri_capacity[$object->repeat_interval]) ? $ri_capacity[$object->repeat_interval] : 0;
                $_repeat_in_stock = $capacity_of_this_repeat == 0 ? false : true;
            }
            // get the woocommerce product
            $_pf = new WC_Product_Factory();
            $product = $_pf->get_product($woo_product_id);
            if (!$_repeat_in_stock || !empty($woometa['_stock_status']) && $woometa['_stock_status'][0] == 'outofstock') {
                echo "<p class='evotx_soldout'>" . eventon_get_custom_language($opt, 'evoTX_012', 'Sold Out!') . "</p>";
            } else {
                // SIMPLE product
                if ($product->product_type == 'simple') {
                    $url = $evotx->addon_data['plugin_path'] . '/templates/template-add-to-cart-single.php';
                    include $url;
                }
                // end simple product
                // VARIABLE Product
                if ($product->product_type == 'variable') {
                    include $evotx->addon_data['plugin_path'] . '/templates/template-add-to-cart-variable.php';
                }
            }
            // is_in_stock()
            ?>
							
							<?php 
            // show remaining tickets or not
            if ($_repeat_in_stock && evo_check_yn($txmeta, '_show_remain_tix') && evo_check_yn($woometa, '_manage_stock') && !empty($woometa['_stock']) && $woometa['_stock_status'][0] == 'instock' && (!empty($txmeta['remaining_count']) && (int) $txmeta['remaining_count'][0] >= $woometa['_stock'][0] || empty($txmeta['remaining_count'])) && $product->product_type == 'simple') {
                // get the remaining ticket
                // count for event
                // show this remaining total only for simple events
                $remaining_count = $capacity_of_this_repeat != 'none' ? $capacity_of_this_repeat : $woometa['_stock'][0];
                $remaining_count = (int) $remaining_count;
                echo "<p class='evotx_remaining' data-count='{$remaining_count}'><span>" . $remaining_count . "</span> " . eventon_get_custom_language($opt, 'evoTX_013', 'Tickets remaining!') . "</p>";
            }
            ?>

							<?php 
            // inquire before buy form
            include 'html-ticket-inquery.php';
            ?>

							<?php 
            ?>

							</div><!-- .evoTX_wc_section -->
							<?php 
            // content for ticket image seciton
            if ($_tix_image_id) {
                $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;
                ?>
								<div class='evotx_image'>
									<img src='<?php 
                echo $tix_img_src;
                ?>
'/>
									<?php 
                if (!empty($txmeta['_tx_img_text'])) {
                    ?>
										<p class='evotx_caption'><?php 
                    echo $txmeta['_tx_img_text'][0];
                    ?>
</p>
									<?php 
                }
                ?>
								</div><div class="clear"></div>
							<?php 
            }
            ?>
						</div>						
					</div>

					
					<div class='tx_wc_notic' style='display:none'>
						<p><b></b><span><?php 
            echo eventon_get_custom_language($opt, 'evoTX_009', 'Successfully added to cart!');
            ?>
</span> <a class='evcal_btn view_cart' href='<?php 
            echo $woocommerce->cart->get_cart_url();
            ?>
'><?php 
            echo eventon_get_custom_language($opt, 'evoTX_011', 'View cart');
            ?>
</a> <a class='evcal_btn checkout' href='<?php 
            echo $woocommerce->cart->get_checkout_url();
            ?>
'><?php 
            echo eventon_get_custom_language($opt, 'evoTX_010', 'Checkout');
            ?>
</a><em></em></p>
					</div>
				<?php 
            echo $helpers['end'];
            ?>
 
				</div>


			<?php 
            $output = ob_get_clean();
            return $output;
        }
    }
				<?php 
echo $__item_p_beg;
echo $eventon_rs->lang('evoRSLX_002', 'Primary Contact on RSVP', $lang);
?>
:</span> <?php 
echo $args['last_name'] . ' ' . $args['first_name'];
?>
</p>

				<?php 
echo $__item_p_beg;
echo $eventon_rs->lang('evoRSLX_003', 'Spaces', $lang);
?>
:</span> <?php 
echo evo_meta($rsvp_pmv, 'count');
?>
</p>

				<p style='<?php 
echo $__styles_02;
?>
 padding-bottom:40px;'><span style='<?php 
echo $__styles_02a;
?>
'><?php 
echo $eventon_rs->lang('evoRSLX_008', 'Event Time', $lang);
?>
:</span> <?php 
echo $__date['html_prettytime'];
?>
/**  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();
}
    /** GENERATE individual event data	 */
    public function generate_event_data($event_list_array, $focus_month_beg_range = '', $FOCUS_month_int = '', $FOCUS_year_int = '')
    {
        $months_event_array = '';
        // Initial variables
        $wp_time_format = get_option('time_format');
        $default_event_color = !empty($this->evopt1['evcal_hexcode']) ? '#' . $this->evopt1['evcal_hexcode'] : '#206177';
        $__shortC_arg = $this->shortcode_args;
        $__count = 0;
        // EVENT CARD open by default variables
        $_is_eventCardOpen = !empty($__shortC_arg['evc_open']) && $__shortC_arg['evc_open'] == 'yes' ? true : ($this->is_eventcard_open ? true : false);
        $eventcard_script_class = $_is_eventCardOpen ? "gmaponload" : null;
        $this->is_eventcard_open = false;
        // check featured events are prioritized
        $__feature_events = !empty($__shortC_arg['ft_event_priority']) && $__shortC_arg['ft_event_priority'] != 'no' ? true : false;
        // GET EventTop fields - v2.1.17
        $eventop_fields = !empty($this->evopt1['evcal_top_fields']) ? $this->evopt1['evcal_top_fields'] : null;
        // Number of activated taxnomonies v 2.2.15
        $_active_tax = evo_get_ett_count($this->evopt1);
        // eventCARD HTML
        require_once AJDE_EVCAL_PATH . '/includes/eventon_eventCard.php';
        // check if single event exist
        $_sin_ev_ex = in_array('eventon-single-event/eventon-single-event.php', get_option('active_plugins')) ? true : false;
        // EACH EVENT
        if (is_array($event_list_array)) {
            foreach ($event_list_array as $event_) {
                $__count++;
                //print_r($event);
                $event_id = $event_['event_id'];
                $event_start_unix = $event_['event_start_unix'];
                $event_end_unix = $event_['event_end_unix'];
                $event_type = $event_['event_type'];
                $ev_vals = $event_['event_pmv'];
                $event = get_post($event_id);
                // year long or not
                $__year_long_event = !empty($ev_vals['evo_year_long']) && $ev_vals['evo_year_long'][0] == 'yes' ? true : 0;
                // define variables
                $ev_other_data = $ev_other_data_top = $html_event_type_info = $_event_date_HTML = $_eventcard = $html_event_type_2_info = '';
                $_is_end_date = true;
                $DATE_start_val = eventon_get_formatted_time($event_start_unix);
                if (empty($event_end_unix)) {
                    $_is_end_date = false;
                    $DATE_end_val = $DATE_start_val;
                } else {
                    $DATE_end_val = eventon_get_formatted_time($event_end_unix);
                }
                // if this event featured
                $__featured = !empty($ev_vals['_featured']) && $ev_vals['_featured'][0] == 'yes' ? true : false;
                // GET: repeat interval for this event
                $__repeatInterval = !empty($event_['event_repeat_interval']) ? $event_['event_repeat_interval'] : (!empty($_GET['ri']) ? $_GET['ri'] : 0);
                // Unique ID generation
                $unique_varied_id = 'evc' . $event_start_unix . uniqid() . $event_id;
                $unique_id = 'evc_' . $event_start_unix . $event_id;
                // All day event variables
                $_is_allday = !empty($ev_vals['evcal_allday']) && $ev_vals['evcal_allday'][0] == 'yes' ? true : false;
                $_hide_endtime = !empty($ev_vals['evo_hide_endtime']) && $ev_vals['evo_hide_endtime'][0] == 'yes' ? true : false;
                $evcal_lang_allday = eventon_get_custom_language($this->evopt2, 'evcal_lang_allday', 'All Day');
                /*
                	evo_hide_endtime
                	NOTE: if its set to hide end time, meaning end time and date would be empty on wp-admin, which will fall into same start end month category.
                */
                $_event_date_HTML = $this->generate_time_($DATE_start_val, $DATE_end_val, $ev_vals, $evcal_lang_allday, $focus_month_beg_range, $FOCUS_month_int, $event_start_unix, $event_end_unix);
                // (---) hook for addons
                if (has_filter('eventon_eventcard_date_html')) {
                    $_event_date_HTML = apply_filters('eventon_eventcard_date_html', $_event_date_HTML, $event_id);
                }
                // EACH DATA FIELD
                // EVENT FEATURES IMAGE
                $img_id = get_post_thumbnail_id($event_id);
                $img_med_src = '';
                if ($img_id != '') {
                    $img_src = wp_get_attachment_image_src($img_id, 'full');
                    $img_med_src = wp_get_attachment_image_src($img_id, 'medium');
                    $img_thumb_src = wp_get_attachment_image_src($img_id, 'thumbnail');
                    // append to eventcard array
                    $_eventcard['ftimage'] = array('img' => $img_src, 'hovereffect' => !empty($this->evopt1['evo_ftimghover']) ? $this->evopt1['evo_ftimghover'] : null, 'clickeffect' => !empty($this->evopt1['evo_ftimgclick']) ? $this->evopt1['evo_ftimgclick'] : null, 'min_height' => !empty($this->evopt1['evo_ftimgheight']) ? $this->evopt1['evo_ftimgheight'] : 400, 'ftimg_sty' => !empty($this->evopt1['evo_ftimg_height_sty']) ? $this->evopt1['evo_ftimg_height_sty'] : 'minimized');
                } else {
                    $img_thumb_src = '';
                }
                // EVENT DESCRIPTION
                $evcal_event_content = $event->post_content;
                if (!empty($evcal_event_content)) {
                    $event_full_description = $evcal_event_content;
                } else {
                    // event description compatibility from older versions.
                    $event_full_description = !empty($ev_vals['evcal_description']) ? $ev_vals['evcal_description'][0] : null;
                }
                if (!empty($event_full_description)) {
                    $except = $event->post_excerpt;
                    $event_excerpt = eventon_get_event_excerpt($event_full_description, 30, $except);
                    $_eventcard['eventdetails'] = array('fulltext' => $event_full_description, 'excerpt' => $event_excerpt);
                }
                // EVENT LOCATION
                $lonlat = !empty($ev_vals['evcal_lat']) && !empty($ev_vals['evcal_lon']) ? 'data-latlng="' . $ev_vals['evcal_lat'][0] . ',' . $ev_vals['evcal_lon'][0] . '" ' : null;
                $__location = evo_meta($ev_vals, 'evcal_location');
                // location name
                $__location_name = evo_meta($ev_vals, 'evcal_location_name');
                $_eventcard['timelocation'] = array('timetext' => $_event_date_HTML['html_prettytime'], 'location' => $__location, 'location_name' => $__location_name);
                // Location Image
                $loc_img_id = !empty($ev_vals['evo_loc_img']) ? $ev_vals['evo_loc_img'][0] : null;
                if (!empty($loc_img_id)) {
                    $_eventcard['locImg'] = array('id' => $loc_img_id, 'fullheight' => !empty($this->evopt1['evo_locimgheight']) ? $this->evopt1['evo_locimgheight'] : 400);
                    // location name and address
                    if (evo_check_yn($ev_vals, 'evcal_name_over_img') && !empty($__location_name)) {
                        $_eventcard['locImg']['locName'] = $__location_name;
                        if (!empty($__location)) {
                            $_eventcard['locImg']['locAdd'] = $__location;
                        }
                    }
                }
                // GOOGLE maps
                if ($this->google_maps_load && !empty($ev_vals['evcal_location']) && (!empty($ev_vals['evcal_gmap_gen']) && $ev_vals['evcal_gmap_gen'][0] == 'yes')) {
                    $gmap_api_status = '';
                    $_eventcard['gmap'] = array('id' => $unique_varied_id);
                    // GET directions
                    if ($this->evopt1['evo_getdir'] == 'yes') {
                        $_eventcard['getdirection'] = array('fromaddress' => $ev_vals['evcal_location'][0]);
                    }
                } else {
                    $gmap_api_status = 'data-gmap_status="null"';
                }
                // EVENT BRITE
                // check if eventbrite actually used in this event
                if (!empty($ev_vals['evcal_eventb_data_set']) && $ev_vals['evcal_eventb_data_set'][0] == 'yes') {
                    // Event brite capacity
                    if (!empty($ev_vals['evcal_eventb_tprice']) && !empty($ev_vals['evcal_eventb_url'])) {
                        $_eventcard['eventbrite'] = array('capacity' => !empty($ev_vals['evcal_eventb_capacity']) ? $ev_vals['evcal_eventb_capacity'][0] : null, 'tix_price' => $ev_vals['evcal_eventb_tprice'][0], 'url' => $ev_vals['evcal_eventb_url'][0]);
                    }
                }
                // PAYPAL Code
                if (!empty($ev_vals['evcal_paypal_item_price'][0]) && $this->evopt1['evcal_paypal_pay'] == 'yes') {
                    $_eventcard['paypal'] = array('title' => $event->post_title, 'price' => $ev_vals['evcal_paypal_item_price'][0], 'text' => !empty($ev_vals['evcal_paypal_text']) ? $ev_vals['evcal_paypal_text'][0] : null);
                }
                // Event Organizer
                if (!empty($ev_vals['evcal_organizer']) && (!empty($ev_vals['evo_evcrd_field_org']) && $ev_vals['evo_evcrd_field_org'][0] != 'yes')) {
                    $_eventcard['organizer'] = array('value' => $ev_vals['evcal_organizer'][0], 'contact' => !empty($ev_vals['evcal_org_contact']) ? $ev_vals['evcal_org_contact'][0] : null, 'img' => !empty($ev_vals['evcal_org_img']) ? $ev_vals['evcal_org_img'][0] : null);
                }
                // Custom fields
                $_cmf_count = evo_retrieve_cmd_count($this->evopt1);
                for ($x = 1; $x < $_cmf_count + 1; $x++) {
                    if (!empty($this->evopt1['evcal_ec_f' . $x . 'a1']) && !empty($this->evopt1['evcal__fai_00c' . $x]) && !empty($ev_vals["_evcal_ec_f" . $x . "a1_cus"])) {
                        // check if hide this from eventCard set to yes
                        if (empty($this->evopt1['evcal_ec_f' . $x . 'a3']) || $this->evopt1['evcal_ec_f' . $x . 'a3'] == 'no') {
                            $faicon = $this->evopt1['evcal__fai_00c' . $x];
                            $_eventcard['customfield' . $x] = array('imgurl' => $faicon, 'x' => $x, 'value' => $ev_vals["_evcal_ec_f" . $x . "a1_cus"][0], 'valueL' => !empty($ev_vals["_evcal_ec_f" . $x . "a1_cusL"]) ? $ev_vals["_evcal_ec_f" . $x . "a1_cusL"][0] : null, '_target' => !empty($ev_vals["_evcal_ec_f" . $x . "_onw"]) ? $ev_vals["_evcal_ec_f" . $x . "_onw"][0] : null, 'type' => $this->evopt1['evcal_ec_f' . $x . 'a2']);
                        }
                    }
                }
                // LEARN MORE and ICS
                if (!empty($ev_vals['evcal_lmlink']) || !empty($this->evopt1['evo_ics']) && $this->evopt1['evo_ics'] == 'yes') {
                    $_eventcard['learnmoreICS'] = array('event_id' => $event_id, 'learnmorelink' => !empty($ev_vals['evcal_lmlink']) ? $ev_vals['evcal_lmlink'][0] : null, 'learnmore_target' => !empty($ev_vals['evcal_lmlink_target']) && $ev_vals['evcal_lmlink_target'][0] == 'yes' ? 'target="_blank"' : null, 'estart' => $event_start_unix, 'eend' => $event_end_unix, 'etitle' => $event->post_title, 'evals' => $ev_vals);
                }
                // =======================
                /** CONSTRUCT the EVENT CARD	 **/
                if (!empty($_eventcard) && count($_eventcard) > 0) {
                    // filter hook for eventcard content array - updated 2.2.20
                    $_eventcard = apply_filters('eventon_eventcard_array', $_eventcard, $ev_vals, $event_id, $__repeatInterval);
                    // if an order is set reorder things
                    $_eventcard = eventon_EVC_sort($_eventcard, $this->evopt1['evoCard_order']);
                    ob_start();
                    echo "<div class='event_description evcal_eventcard " . ($_is_eventCardOpen ? 'open' : null) . "' " . ($_is_eventCardOpen ? 'style="display:block"' : 'style="display:none"') . ">";
                    echo eventon_eventcard_print($_eventcard, $this->evopt1, $this->evopt2);
                    // (---) hook for addons
                    if (has_action('eventon_eventcard_additions')) {
                        do_action('eventon_eventcard_additions', $event_id, $this->__calendar_type, $event->post_title, $event_full_description, $img_thumb_src);
                    }
                    echo "</div>";
                    $html_event_detail_card = ob_get_clean();
                } else {
                    $html_event_detail_card = null;
                }
                /** Trigger attributes **/
                $event_description_trigger = !empty($html_event_detail_card) ? "desc_trig" : null;
                $gmap_trigger = !empty($ev_vals['evcal_gmap_gen']) && $ev_vals['evcal_gmap_gen'][0] == 'yes' ? 'data-gmtrig="1"' : 'data-gmtrig="0"';
                // Generate tax terms for event top
                $html_event_type_tax_ar = array();
                $_tax_names_array = evo_get_ettNames($this->evopt1);
                $term_class = $evcal_terms_ = '';
                if (!empty($eventop_fields)) {
                    // foreach active tax
                    for ($b = 1; $b <= $_active_tax; $b++) {
                        $__tx_content = '';
                        $__tax_slug = 'event_type' . ($b == 1 ? '' : '_' . $b);
                        $__tax_fields = 'eventtype' . ($b == 1 ? '' : $b);
                        // for override evc colors
                        if ($b == 1) {
                            $evcal_terms_ = wp_get_post_terms($event_id, $__tax_slug);
                        }
                        if (in_array($__tax_fields, $eventop_fields)) {
                            $evcal_terms = !empty($evcal_terms_) && $b == 1 ? $evcal_terms_ : wp_get_post_terms($event_id, $__tax_slug);
                            if ($evcal_terms) {
                                $__tax_name = $_tax_names_array[$b];
                                $__tx_content .= "<span class='evcal_event_types ett{$b}'><em><i>" . $__tax_name . ":</i></em>";
                                foreach ($evcal_terms as $termA) {
                                    // add tax term slug to event element class names
                                    $term_class .= ' evo_' . $termA->slug;
                                    $__tx_content .= "<em data-filter='{$__tax_slug}'>" . $termA->name . "</em>";
                                }
                                $__tx_content .= "<i class='clear'></i></span>";
                                $html_event_type_tax_ar[$b] = $__tx_content;
                            }
                        }
                    }
                }
                $_html_tax_content = count($html_event_type_tax_ar) > 0 ? implode('', $html_event_type_tax_ar) : null;
                //event color
                $event_color = eventon_get_hex_color($ev_vals, $default_event_color);
                // override event colors
                if (!empty($__shortC_arg['etc_override']) && $__shortC_arg['etc_override'] == 'yes' && !empty($evcal_terms_)) {
                    $ev_id = $evcal_terms_[0]->term_id;
                    $ev_color = get_option("evo_et_taxonomy_{$ev_id}");
                    $event_color = !empty($ev_color['et_color']) ? '#' . $ev_color['et_color'] : $event_color;
                }
                // event ex link
                $exlink_option = !empty($ev_vals['_evcal_exlink_option']) ? $ev_vals['_evcal_exlink_option'][0] : 1;
                $event_permalink = get_permalink($event_id);
                // if UX to be open in new window then use link to single event or that link
                $link_append = array();
                $_link_text = '';
                if (!empty($__shortC_arg['lang']) && $__shortC_arg['lang'] != 'L1') {
                    $link_append['l'] = $__shortC_arg['lang'];
                }
                $link_append['ri'] = $__repeatInterval;
                if (!empty($link_append)) {
                    foreach ($link_append as $lp => $lpk) {
                        if ($lp == 'ri' && $lpk == '0') {
                            continue;
                        }
                        $_link_text .= $lp . '=' . $lpk . '&';
                    }
                }
                $_link_text = !empty($_link_text) ? '?' . $_link_text : null;
                $href = !empty($ev_vals['evcal_exlink']) && $exlink_option != '1' ? 'data-exlk="1" href="' . $ev_vals['evcal_exlink'][0] . $_link_text . '"' : 'data-exlk="0"';
                // target
                $target_ex = !empty($ev_vals['_evcal_exlink_target']) && $ev_vals['_evcal_exlink_target'][0] == 'yes' ? 'target="_blank"' : null;
                // EVENT LOCATION
                if (evo_location_exists($ev_vals)) {
                    $location_address = !empty($ev_vals['evcal_location']) ? $ev_vals['evcal_location'][0] : null;
                    // location as LON LAT
                    $event_location_variables = (!empty($lonlat) ? $lonlat : null) . ' data-location_address="' . $location_address . '" ';
                    // conditional schema data for event
                    if (!empty($this->evopt1['evo_schema']) && $this->evopt1['evo_schema'] == 'yes') {
                        $__scheme_data_location = '';
                    } else {
                        $__scheme_data_location = '
									<item style="display:none" itemprop="location" itemscope itemtype="http://schema.org/Place">
										<span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
											<item itemprop="streetAddress">' . $location_address . '</item>
										</span>
									</item>';
                    }
                    $ev_location = '<em class="evcal_location" ' . (!empty($lonlat) ? $lonlat : null) . ' data-add_str="' . $location_address . '">' . $location_address . '</em>';
                    // location type
                    $event_location_variables .= !empty($lonlat) ? 'data-location_type="lonlat"' : 'data-location_type="address"';
                    // location name
                    $event_location_variables .= !empty($ev_vals['evcal_location_name']) ? ' data-location_name="' . $ev_vals['evcal_location_name'][0] . '"' : null;
                    // location status
                    $event_location_variables .= ' data-location_status="true"';
                } else {
                    // location status
                    $ev_location = $event_location_variables = $__scheme_data_location = null;
                    $event_location_variables .= ' data-location_status="false"';
                }
                /* -------------------
                			// 	HTML		
                			// 	EventTop - building of the eventTop section
                			-------------*/
                $eventtop_html = $eventop_fields_ = '';
                // featured image
                $eventtop_html[] = !empty($img_thumb_src) && !empty($__shortC_arg['show_et_ft_img']) && $__shortC_arg['show_et_ft_img'] == 'yes' ? "<span class='ev_ftImg' style='background-image:url(" . $img_thumb_src[0] . ")'></span>" : null;
                // CHECK for event top fields array
                $eventop_fields_ = is_array($eventop_fields) ? true : false;
                // date number
                $___day_name = $eventop_fields_ && in_array('dayname', $eventop_fields) ? "<em class='evo_day' >" . $DATE_start_val['D'] . "</em>" : null;
                if (!$__year_long_event) {
                    $eventtop_html[] = "<span class='evcal_cblock' data-bgcolor='" . $event_color . "' data-smon='" . $DATE_start_val['F'] . "' data-syr='" . $DATE_start_val['Y'] . "'><em class='evo_date' >" . $___day_name . $_event_date_HTML['html_date'] . '</em>';
                }
                // time for events
                $eventtop_html[] = "<em class='evo_time'>" . $_event_date_HTML['html_time'] . "</em>";
                $eventtop_html[] = "<em class='clear'></em></span>";
                // event title
                $eventtop_html[] = "<span class='evcal_desc evo_info " . ($__year_long_event ? 'yrl' : null) . "' {$event_location_variables} ><span class='evcal_desc2 evcal_event_title' itemprop='name'>" . $event->post_title . "</span>";
                // subtitle
                if (!empty($ev_vals['evcal_subtitle'])) {
                    $eventtop_html[] = "<span class='evcal_event_subtitle' >" . $ev_vals['evcal_subtitle'][0] . "</span>";
                }
                $eventtop_html[] = "<span class='evcal_desc_info' >";
                // time
                if ($eventop_fields_ && in_array('time', $eventop_fields)) {
                    $eventtop_html[] = "<em class='evcal_time'>" . $_event_date_HTML['html_fromto'] . "</em> ";
                }
                // location
                if ($eventop_fields_ && in_array('location', $eventop_fields)) {
                    $eventtop_html[] = $ev_location;
                }
                // location Name
                if ($eventop_fields_ && in_array('locationame', $eventop_fields)) {
                    $__location_name = !empty($ev_vals['evcal_location_name']) ? $ev_vals['evcal_location_name'][0] : null;
                    $eventtop_html[] = !empty($__location_name) ? '<em class="evcal_location event_location_name">' . $__location_name . '</em>' : null;
                }
                $eventtop_html[] = "</span><span class='evcal_desc3'>";
                // organizer
                if ($eventop_fields_ && in_array('organizer', $eventop_fields) && !empty($ev_vals['evcal_organizer'])) {
                    $eventtop_html[] = "<em class='evcal_oganizer'><i>" . eventon_get_custom_language($this->evopt2, 'evcal_evcard_org', 'Event Organized By') . ':</i> ' . $ev_vals['evcal_organizer'][0] . "</em>";
                }
                // event type
                if (!empty($_html_tax_content)) {
                    $eventtop_html[] = $_html_tax_content;
                }
                // custom meta fields
                for ($x = 1; $x < $_cmf_count + 1; $x++) {
                    if ($eventop_fields_ && in_array('cmd' . $x, $eventop_fields) && !empty($ev_vals['_evcal_ec_f' . $x . 'a1_cus'])) {
                        $def = $this->evopt1['evcal_ec_f' . $x . 'a1'];
                        // default custom meta field name
                        $i18n_nam = eventon_get_custom_language($this->evopt2, 'evcal_cmd_' . $x, $def);
                        $eventtop_html[] = ($x == 1 ? "<b class='clear'></b>" : null) . "<em class='evcal_cmd'><i>" . $i18n_nam . ':</i> ' . $ev_vals['_evcal_ec_f' . $x . 'a1_cus'][0] . "</em> ";
                    }
                }
                $eventtop_html[] = "</span>";
                $eventtop_html[] = "</span><em class='clear'></em>";
                $eventtop_html = apply_filters('eventon_eventtop_html', $eventtop_html);
                // --
                // Combine the event top individual sections
                $html_info_line = implode('', $eventtop_html);
                // (---) hook for addons
                if (has_filter('eventon_event_cal_short_info_line')) {
                    $html_info_line = apply_filters('eventon_event_cal_short_info_line', $html_info_line);
                }
                // SCHEME SEO
                // conditional schema data
                if (!empty($this->evopt1['evo_schema']) && $this->evopt1['evo_schema'] == 'yes') {
                    $__scheme_data = '<div class="evo_event_schema" style="display:none" >
							<a href="' . $event_permalink . '"></a></div>';
                    $__scheme_attributes = '';
                } else {
                    $event_permalink = $_sin_ev_ex ? $event_permalink : "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
                    $__scheme_data = '<div class="evo_event_schema" style="display:none" >
							<a href="' . $event_permalink . '" itemprop="url"></a>				
							<time itemprop="startDate" datetime="' . $DATE_start_val['Y'] . '-' . $DATE_start_val['n'] . '-' . $DATE_start_val['j'] . '"></time>
							<time itemprop="endDate" datetime="' . $DATE_end_val['Y'] . '-' . $DATE_end_val['n'] . '-' . $DATE_end_val['j'] . '"></time>' . $__scheme_data_location . '</div>';
                    $__scheme_attributes = "itemscope itemtype='http://schema.org/Event'";
                }
                // ## Eventon Calendar events list -- single event
                // CLASES - attribute
                $_eventClasses = array();
                $_eventAttr = array();
                $_eventClasses[] = 'eventon_list_event';
                $_eventClasses[] = 'event';
                $_ft_imgClass = !empty($img_thumb_src) && !empty($__shortC_arg['show_et_ft_img']) && $__shortC_arg['show_et_ft_img'] == 'yes' ? 'hasFtIMG' : null;
                $__attr_class = "evcal_list_a " . $event_description_trigger . " " . $_event_date_HTML['class_daylength'] . " " . ($event_type != 'nr' ? 'event_repeat ' : null) . $eventcard_script_class . $_ft_imgClass;
                $_ft_event = $__feature_events && !empty($ev_vals['_featured']) && $ev_vals['_featured'][0] == 'yes' ? ' ft_event ' : null;
                // class attribute for event
                $__a_class = $__attr_class . $_ft_event . $term_class . ($__featured ? ' featured_event' : null);
                // show limit styles
                if (!empty($__shortC_arg['show_limit']) && $__shortC_arg['show_limit'] == 'yes' && !empty($__shortC_arg['event_count']) && $__shortC_arg['event_count'] > 0 && $__count > $__shortC_arg['event_count']) {
                    $show_limit_styles = 'style="display:none"';
                    $_eventClasses[] = 'evSL';
                } else {
                    $show_limit_styles = '';
                }
                // event color for the row/box
                $___styles_a = $___styles = '';
                // TILES STYLE
                if (!empty($__shortC_arg['tiles']) && $__shortC_arg['tiles'] == 'yes') {
                    // boxy event colors
                    // if featured image exists for an event
                    if (!empty($img_med_src) && $__shortC_arg['tile_bg'] == 1) {
                        $___styles_a[] = 'background-image: url(' . $img_med_src[0] . '); background-color:' . $event_color . ';';
                        $_eventClasses[] = 'hasbgimg';
                    } else {
                        $___styles_a[] = 'background-color: ' . $event_color . ';';
                    }
                    // tile height
                    if ($__shortC_arg['tile_height'] != 0) {
                        $___styles_a[] = 'height: ' . $__shortC_arg['tile_height'] . 'px;';
                    }
                    // tile count
                    if ($__shortC_arg['tile_count'] != 2) {
                        $perct = (int) (100 / $__shortC_arg['tile_count']);
                        $___styles_a[] = 'width: ' . $perct . '%;';
                    }
                    $___styles = '';
                } else {
                    $___styles[] = 'border-color: ' . $event_color . ';';
                    $___styles_a[] = '';
                }
                // div or an e tag
                $html_tag = $exlink_option == '1' ? 'div' : 'a';
                // process passed on array
                if (!empty($___styles_a)) {
                    $___styles_a = 'style="' . implode(' ', $___styles_a) . '"';
                }
                if (!empty($___styles)) {
                    $___styles = 'style="' . implode(' ', $___styles) . '"';
                }
                $event_html_code = "<div id='event_{$event_id}' class='" . implode(' ', $_eventClasses) . "' data-event_id='{$event_id}' data-ri='{$__repeatInterval}' {$__scheme_attributes} {$show_limit_styles} {$___styles_a} data-colr='{$event_color}'>{$__scheme_data}\n\t\t\t\t<{$html_tag} id='" . $unique_id . "' class='" . $__a_class . "' " . $href . " " . $target_ex . " " . $___styles . " " . $gmap_trigger . " " . (!empty($gmap_api_status) ? $gmap_api_status : null) . " data-ux_val='{$exlink_option}'>{$html_info_line}</{$html_tag}>" . $html_event_detail_card . "<div class='clear end'></div></div>";
                //evc_open
                // prepare output
                $months_event_array[] = array('event_id' => $event_id, 'srow' => $event_start_unix, 'erow' => $event_end_unix, 'content' => $event_html_code);
            }
        } else {
            $months_event_array;
        }
        return $months_event_array;
    }
Beispiel #10
0
 function frontend_box($object, $helpers)
 {
     global $eventon_rs;
     $event_pmv = get_post_custom($object->event_id);
     // loggedin user
     $currentUserID = $this->functions->current_user_id();
     $currentUserRSVP = $this->functions->get_userloggedin_user_rsvp_status($object->event_id, $object->__repeatInterval);
     // RSVP enabled for this event
     if (empty($event_pmv['evors_rsvp']) || !empty($event_pmv['evors_rsvp']) && $event_pmv['evors_rsvp'][0] == 'no') {
         return;
     }
     $lang = !empty($eventon->evo_generator->shortcode_args['lang']) ? $eventon->evo_generator->shortcode_args['lang'] : 'L1';
     $optRS = $this->optRS;
     $is_user_logged_in = is_user_logged_in();
     // if only loggedin users can see rsvp form
     if (evo_settings_val('evors_onlylogu', $optRS) && !$is_user_logged_in) {
         return $this->rsvp_for_none_loggedin($helpers, $object);
         return;
     }
     // if close rsvp is set and check time
     $close_time = evo_meta($event_pmv, 'evors_close_time');
     if (!empty($close_time)) {
         date_default_timezone_set('UTC');
         $time = time() + get_option('gmt_offset', 0) * 3600;
         $close_t = (int) $close_time * 60;
         // adjust event end time for repeat intervals
         $row_endTime = $this->get_correct_event_end_time($event_pmv, $object->__repeatInterval);
         $change_t = (int) $row_endTime - $close_t;
         if ($change_t <= $time) {
             return;
         }
     }
     // show rsvp count
     if (evo_meta_yesno($event_pmv, 'evors_show_rsvp', 'yes', true, false)) {
         $countARR = array('y' => ' (' . $this->functions->get_rsvp_count($event_pmv, 'y', $object->__repeatInterval) . ')', 'n' => ' (' . $this->functions->get_rsvp_count($event_pmv, 'n', $object->__repeatInterval) . ')', 'm' => ' (' . $this->functions->get_rsvp_count($event_pmv, 'm', $object->__repeatInterval) . ')');
     } else {
         $countARR = array();
     }
     // get options array
     $opt = $helpers['evoOPT2'];
     $fields_options = !empty($optRS['evors_ffields']) ? $optRS['evors_ffields'] : false;
     // change rsvp button
     $_txt_changersvp = eventon_get_custom_language($opt, 'evoRSL_005a', 'Change my RSVP');
     $changeRSVP = !empty($optRS['evors_hide_change']) && $optRS['evors_hide_change'] == 'yes' ? '' : "<span class='change' data-val='ch'>" . $_txt_changersvp . "</span>";
     ob_start();
     $remaining_rsvp = $this->functions->remaining_rsvp($event_pmv, $object->__repeatInterval, $object->event_id);
     echo "<div class='evorow evcal_evdata_row bordb evcal_evrow_sm evo_metarow_rsvp" . $helpers['end_row_class'] . "' data-rsvp='' data-event_id='" . $object->event_id . "'>\r\n\t\t\t\t\t\t\t<span class='evcal_evdata_icons'><i class='fa " . get_eventON_icon('evcal__evors_001', 'fa-envelope', $helpers['evOPT']) . "'></i></span>\r\n\t\t\t\t\t\t\t<div class='evcal_evdata_cell'>\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<h3 class='evo_h3'>" . eventon_get_custom_language($opt, 'evoRSL_001', 'RSVP to event') . "</h3>";
     // RSVPing allowed and spaces left
     $eventtop_rsvp = !empty($this->optRS['evors_eventop_rsvp']) && $this->optRS['evors_eventop_rsvp'] == 'yes' ? true : false;
     //echo "<div class='evorsvp_eventcard_column'>";
     if ($remaining_rsvp == true || $remaining_rsvp > 0 || $currentUserRSVP) {
         echo "<div class='evoRS_status_option_selection' data-etitle='" . get_the_title($object->event_id) . "' data-eid='" . $object->event_id . "' data-ri='{$object->__repeatInterval}' data-cap='" . (is_int($remaining_rsvp) ? $remaining_rsvp : 'na') . "' data-precap='" . $this->functions->is_per_rsvp_max_set($event_pmv) . "'>";
         // if already RSVPED
         if ($currentUserRSVP) {
             echo "<p class='nobrbr loggedinuser' data-uid='{$currentUserID}' data-eid='{$object->event_id}' data-ri='{$object->__repeatInterval}'>";
             echo !$eventtop_rsvp ? evo_lang('You have already RSVP-ed') . ": <em class='evors_rsvped_status_user'>" . $this->rsvp_array_[$currentUserRSVP] . "</em> " : '';
             $changeRSVP_ = !empty($optRS['evors_hide_change']) && $optRS['evors_hide_change'] == 'yes' ? '' : "<span class='change' data-val='chu'>" . $_txt_changersvp . "</span>";
             echo $changeRSVP_ . "</p>";
         } else {
             // if user loggedin OR eventtop RSVP is disabled
             if (!$eventtop_rsvp || !is_user_logged_in()) {
                 echo "<p>" . $this->get_rsvp_choices($opt, $optRS, $countARR) . $changeRSVP . "</p>";
             }
         }
         echo "</div>";
     }
     // spots remaining
     if ($this->functions->show_spots_remaining($event_pmv)) {
         // no more spaces
         if (!$remaining_rsvp) {
             echo "<p class='remaining_count no_spots_left'>" . eventon_get_custom_language($opt, 'evoRSL_002a', 'No more spots left!') . "</p>";
         } else {
             echo "<p class='remaining_count'>" . $remaining_rsvp . " " . eventon_get_custom_language($opt, 'evoRSL_002b', 'Spots remaining') . "</p>";
         }
     }
     // whos coming section
     if ($this->functions->show_whoscoming($event_pmv)) {
         $attendee_icons = $this->GET_attendees_icons($object->event_id, $object->__repeatInterval);
         if ($attendee_icons) {
             echo "<p class='evors_whos_coming_title'>" . eventon_get_custom_language($opt, 'evoRSL_002a', 'Who is coming to the event') . "</p><p class='evors_whos_coming'>" . $attendee_icons . "</p>";
         }
     }
     // subtitle for rsvp section
     echo "<p class='evo_data_val'>";
     if (!$remaining_rsvp) {
         echo eventon_get_custom_language($opt, 'evoRSL_002d', "RSVPing is closed at this time.");
     } else {
         if (!$currentUserRSVP) {
             echo eventon_get_custom_language($opt, 'evoRSL_002', 'Make sure to RSVP to this amazing event!');
         }
     }
     echo "</p>";
     // additional information to rsvped logged in user
     if (!empty($event_pmv['evors_additional_data']) && $currentUserRSVP) {
         echo "<h3 class='evo_h3 additional_info'>" . evo_lang('Additional Information', $lang, $opt) . "</h3>";
         echo "<p class='evo_data_val'>" . $event_pmv['evors_additional_data'][0] . "</p>";
     }
     //echo "</div><div class='evorsvp_eventcard_column'>";
     //echo "</div>";
     echo "</div>" . $helpers['end'];
     echo "</div>";
     return ob_get_clean();
 }