dates ?? array($event->date); // Multiple Day Event $multiple_date = (isset($dates) && $dates[0]['start']['date'] != $dates[0]['end']['date']) ? 'mec-multiple-event' : ''; $first_date = ($start ?? (isset($dates[0]) ? $dates[0]['start']['date'] : NULL)); if(!$first_date) return; $selected_datetime = ($selected_datetime ?? $this->book->timestamp($dates[0]['start'], $dates[0]['end'])); // Settings $settings = $this->main->get_settings(); $ml_settings = $this->main->get_ml_settings(); // Is Booking Enabled for Ongoing Events $booking_ongoing = (isset($settings['booking_ongoing']) and $settings['booking_ongoing']); // Options $event_color = $this->main->get_event_color_dot($event); $allday = isset($event->data->meta['mec_allday']) ? $event->data->meta['mec_allday'] : 0; $date_format = (isset($ml_settings['booking_date_format1']) and trim($ml_settings['booking_date_format1'])) ? $ml_settings['booking_date_format1'] : 'Y-m-d'; $date_format = trim(str_replace(['H', 'h', 'i', 's', 'A', 'a', 'G', 'g', 'B', 'u', 'v', ':'], '', $date_format), ': '); $time_format = get_option('time_format'); // before/after Month $_1month_before = strtotime('first day of -1 month', strtotime($first_date)); $_1month_after = strtotime('first day of +1 month', strtotime($first_date)); $current_month_time = strtotime($first_date); $year = date('Y', strtotime($first_date)); $month = date('m', strtotime($first_date)); $active_day = date('d', strtotime($first_date)); // Start day of week $week_start = $this->main->get_first_day_of_week(); // days and weeks vars $running_day = date('w', mktime(0, 0, 0, $month, 1, $year)); $days_in_month = date('t', mktime(0, 0, 0, $month, 1, $year)); $days_in_previous_month = $this->main->get_days_in_previous_month($month, $year); $days_in_this_week = 1; $day_counter = 0; if($week_start == 1) // Monday { if($running_day != 0) $running_day = $running_day - 1; else $running_day = 6; } elseif($week_start == 6) // Saturday { if($running_day != 6) $running_day = $running_day + 1; else $running_day = 0; } elseif($week_start == 5) // Friday { if($running_day < 4) $running_day = $running_day + 2; elseif($running_day == 5) $running_day = 0; elseif($running_day == 6) $running_day = 1; } $navigator_html = ''; // Show previous navigation if(strtotime(date('Y-m-t', $_1month_before)) >= time()) { $navigator_html .= '
'.esc_html($this->main->date_i18n('M', $_1month_before)).'
'; } $navigator_html .= '

'.esc_html($this->main->date_i18n('F Y', $current_month_time)).'

'; // Show next navigation if(strtotime(date('Y-m-01', $_1month_after)) >= time()) { $navigator_html .= '
'.esc_html($this->main->date_i18n('M', $_1month_after)).'
'; } // Generating javascript code tpl $javascript = ''; // Include javascript code into the page echo MEC_kses::full($javascript); ?>
main->get_weekday_abbr_labels(); echo '
'.implode('
', $headings).'
'; ?>
'.($days_in_previous_month - ($running_day-1-$x)).''; $days_in_this_week++; } // keep going with days .... for($list_day = 1; $list_day <= $days_in_month; $list_day++) { $time = strtotime($year.'-'.$month.'-'.$list_day); $today = date('Y-m-d', $time); $day_id = date('Ymd', $time); $render = ''; $first_day = ''; $default_day = ''; $middle_day = ''; $last_day = ''; $repeat = 0; $is_soldout = true; foreach($dates as $date) { if(!isset($date['fake']) and strtotime($date['start']['date']) <= $time and $time <= strtotime($date['end']['date']) and ($booking_ongoing or (isset($date['start']['timestamp']) and $date['start']['timestamp'] >= current_time('timestamp', 0)))) { $repeat++; $date_timestamp = $this->book->timestamp($date['start'], $date['end']); $start_datetime = $date['start']['date'].' '.sprintf("%02d", $date['start']['hour']).':'.sprintf("%02d", $date['start']['minutes']).' '.$date['start']['ampm']; $date_timestamp_ex = explode(':', $date_timestamp); $soldout = $this->main->is_soldout($event->ID, $start_datetime); if($is_soldout and !$soldout) $is_soldout = false; $render .='
' .(($date['start']['date'] !== $date['end']['date']) ? '
'.strip_tags($this->main->date_label($date['start'], $date['end'], $date_format, ' - ', false, (isset($date['allday']) ? $date['allday'] : 0), $event)).'
' : ($allday != 0 ? esc_html__('All Day' , 'modern-events-calendar-lite') : '')).strip_tags($this->main->date_label($date['start'], $date['end'], $time_format, ' - ', false, (isset($date['allday']) ? $date['allday'] : 0))).(($date['start']['date'] !== $date['end']['date']) ? '
' : '') .'
'; $first_day = strtotime($date['start']['date']) == $time ? ' first-day' : null; $middle_day = (strtotime($date['end']['date']) != $time && strtotime($date['start']['date']) != $time) ? ' middle-day' : null; $last_day = strtotime($date['end']['date']) == $time ? ' last-day' : null; $default_day = strtotime($first_date) == $time ? ' mec-active' : null; } } if($repeat == 1) $date_timestamp_ex = explode(':', $date_timestamp); $repeat_class = $repeat > 1 ? ' mec-has-time-repeat' : ''; $date_for_wrap = $repeat == 1 ? 'data-timestamp="'.esc_attr($date_timestamp).'" data-formatted-date="'.esc_attr($this->main->date_i18n($date_format, $date_timestamp_ex[0])).'"' : ''; $custom_class1 = $repeat == 1 ? ' mec-has-one-repeat-in-day' : ''; $custom_class2 = $repeat >= 1 ? ' mec-has-event-for-booking' : ''; $soldout_class = ($is_soldout ? ' mec-booking-calendar-date-soldout' : ''); echo '
'.$list_day.'
'; echo '
'.MEC_kses::full($render).'
'; echo '
'; if($running_day == 6) { echo '
'; if((($day_counter+1) != $days_in_month) or (($day_counter+1) == $days_in_month and $days_in_this_week == 7)) { echo '
'; } $running_day = -1; $days_in_this_week = 0; } $days_in_this_week++; $running_day++; $day_counter++; } // finish the rest of the days in the week if($days_in_this_week < 8) { for($x = 1; $x <= (8 - $days_in_this_week); $x++) { echo '
'.esc_html($x).'
'; } } ?>