get_render_path();
// before/after Month
$_1month_before = strtotime('-1 Month', strtotime($this->start_date));
$_1month_after = strtotime('+1 Month', strtotime($this->start_date));
// Current month time
$current_month_time = strtotime($this->start_date);
// Weeks
$weeks = '';
foreach($this->weeks as $week_number=>$week)
{
$first_week_day = $week[0];
$i = 1;
while(strtotime($first_week_day) < $current_month_time)
{
if($i > 7)
{
$first_week_day = $this->weeks[$week_number+1][0];
}
else
{
$first_week_day = (isset($week[$i]) ? $week[$i] : NULL);
$i++;
}
}
$weeks .= '
';
foreach($week as $day)
{
$time = strtotime($day);
$count = isset($this->events[$day]) ? count($this->events[$day]) : 0;
$passed = ($time < strtotime($this->today));
$weeks .= '- '
.''.esc_html($this->main->date_i18n('D', $time)).' '
.esc_html($this->main->date_i18n('j', $time))
.'
';
}
$weeks .= '
';
}
// Generate Events
ob_start();
include $render_path;
$date_events = ob_get_clean();
$navigator_html = '';
// Generate Month Navigator
if($this->next_previous_button)
{
// Show previous month handler if showing past events allowed
if(!isset($this->atts['show_past_events']) or
(isset($this->atts['show_past_events']) and $this->atts['show_past_events']) or
(isset($this->atts['show_past_events']) and !$this->atts['show_past_events'] and strtotime(date('Y-m-t', $_1month_before)) >= time())
)
{
$navigator_html .= '';
}
$navigator_html .= ''.esc_html($this->main->date_i18n('Y F', $current_month_time)).'
';
// Show next month handler if needed
if(!$this->show_only_expired_events or
($this->show_only_expired_events and strtotime(date('Y-m-01', $_1month_after)) <= time())
)
{
$navigator_html .= '';
}
}
$week_html = '
'.sprintf(esc_html__('Week %s', 'modern-events-calendar-lite'), ''.(isset($this->week_of_days[$this->today]) ? $this->week_of_days[$this->today] : 1).'').'
';
$month_html = ''.MEC_kses::element($weeks).'
'.MEC_kses::full($date_events).'
';
// Return the data if called by AJAX
if(isset($this->atts['return_items']) and $this->atts['return_items'])
{
echo json_encode(array(
'month' => $week_html.$month_html,
'navigator' => $navigator_html,
'week_id' => date('Ym', $current_month_time).$this->week_of_days[$this->today],
'active_day' => date('Ymd', strtotime($this->active_date)),
'previous_month' => array('label' => $this->main->date_i18n('Y F', $_1month_before), 'id' => date('Ym', $_1month_before), 'year' => date('Y', $_1month_before), 'month' => date('m', $_1month_before)),
'current_month' => array('label' => $this->main->date_i18n('Y F', $current_month_time), 'id' => date('Ym', $current_month_time), 'year' => date('Y', $current_month_time), 'month' => date('m', $current_month_time)),
'next_month' => array('label' => $this->main->date_i18n('Y F', $_1month_after), 'id' => date('Ym', $_1month_after), 'year' => date('Y', $_1month_after), 'month' => date('m', $_1month_after)),
));
exit;
}
$sed_method = $this->sed_method;
if($sed_method == 'new') $sed_method = '0';
// Generating javascript code tpl
$javascript = '';
// Include javascript code into the page
if($this->main->is_ajax() or $this->main->preview()) echo MEC_kses::full($javascript);
else $this->factory->params('footer', $javascript);
$styling = $this->main->get_styling();
$event_colorskin = (isset($styling['mec_colorskin'] ) || isset($styling['color'])) ? 'colorskin-custom' : '';
?>