12) || ($month < 0) || ($year > 2099) || ($year < 1900)) {
$year = date("Y");
$month = date("n");
}
// Moving forward
if ($month == 12) {
$month_forward = 1;
$year_forward = $year + 1;
} else {
$month_forward = $month + 1;
$year_forward = $year;
}
// Moving backward
if ($month == 1) {
$month_backward = 12;
$year_backward = $year - 1;
} else {
$month_backward = $month - 1;
$year_backward = $year;
}
if ($day) {
// Make previous - next day navigation possible
// Days in current month
$days_count = date("t", mktime("0", "0", "0", $month, $day, $year));
$day_backward = $day - 1;
$day_month_backward = $month;
$day_year_backward = $year;
$day_forward = $day + 1;
$day_month_forward = $month;
$day_year_forward = $year;
if ($day_backward == 0) {
$day_month_backward = $month - 1;
if ($day_month_backward == 0) {
$day_month_backward = 12;
$day_year_backward = $year - 1;
}
$day_backward = date("t", mktime("0", "0", "0", $day_month_backward, 1, $day_year_backward));
}
if ($day_forward > $days_count) {
$day_month_forward = $month + 1;
if ($day_month_forward > 12) {
$day_month_forward = 1;
$day_year_forward = $year + 1;
}
$day_forward = 1;
}
$area2 .= "
";
$area2 .= "";
/*translation:Previous*/
$area2 .= "
wwwroot}pg/info/calendar?year={$day_year_backward}&month={$day_month_backward}&day={$day_backward}{$subject_addition}\"><<< ". elgg_echo("koolielu:link_calendar_previous") . " ";
$area2 .= "
" . elgg_echo(date("l", mktime("0", "0", "0", $month, $day, $year))). " - " . $day . ". ";
$area2 .= elgg_echo(date("F", mktime("0", "0", "0", $month, 1, $year))) . " ";
$area2 .= $year . " ";
/*translation:Next*/
$area2 .= "
wwwroot}pg/info/calendar?year={$day_year_forward}&month={$day_month_forward}&day={$day_forward}{$subject_addition}\">". elgg_echo("koolielu:link_calendar_next") . " >>> ";
$area2 .= "
";
// Show calendar view
if ($uses_subject) {
$area2 .= "" . elgg_view("koolielu/calendar_view", array("year" => $year, "month" => $month, "is_small" => true, "subject_filter" => $subject_filter)) . "
";
} else {
$area2 .= "" . elgg_view("koolielu/calendar_view", array("year" => $year, "month" => $month, "is_small" => true)) . "
";
}
// Show day view
if ($uses_subject) {
$area2 .= elgg_view("koolielu/calendar_day_view", array("year" => $year, "month" => $month, "day" => $day, "subject" => $subject));
} else {
$area2 .= elgg_view("koolielu/calendar_day_view", array("year" => $year, "month" => $month, "day" => $day));
}
} else {
$area2 .= "";
// Show calendar view
if ($uses_subject) {
$area2 .= "" . elgg_view("koolielu/calendar_view", array("year" => $year, "month" => $month, "is_small" => true, "subject_filter" => $subject_filter)) . "
";
} else {
$area2 .= "" . elgg_view("koolielu/calendar_view", array("year" => $year, "month" => $month, "is_small" => true)) . "
";
}
// Show month view
if ($uses_subject) {
$area2 .= elgg_view("koolielu/calendar_month_view", array("year" => $year, "month" => $month, "subject" => $subject));
} else {
$area2 .= elgg_view("koolielu/calendar_month_view", array("year" => $year, "month" => $month));
}
}
$body = elgg_view_layout('two_columns', $area1, $area2);
page_draw($title, $body);
?>