main->get_weekday_abbr_labels(); // Start day of week $week_start = $this->main->get_first_day_of_week(); // Get date suffix $settings = $this->main->get_settings(); // 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; } $rows = 1; ?>
main->date_i18n('F', strtotime($this->year.'-'.$month.'-01'))); ?>
'.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); // Print events if(isset($events[$today]) and count($events[$today])) { echo '
'.esc_html($list_day).'
'; } else { echo '
'.esc_html($list_day).'
'; } if($running_day == 6) { echo '
'; if(($day_counter+1) != $days_in_month || $days_in_this_week == 7) { echo '
'; $rows++; } $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).'
'; } } if($rows == 5) { echo '
'; for($j = 0; $j <= 6; $j++) { echo '
'.esc_html(($x+$j)).'
'; } } ?>