diff --git a/calendar/day.php b/calendar/day.php index 24f0c527b9..d16af185fd 100644 --- a/calendar/day.php +++ b/calendar/day.php @@ -26,6 +26,30 @@ include("../header.inc.php"); + if(isset($friendly) && $friendly) { + if(!isset($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"])) + $phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] = "Sunday"; + + if (isset($date) && strlen($date) > 0) { + $thisyear = substr($date, 0, 4); + $thismonth = substr($date, 4, 2); + $thisday = substr($date, 6, 2); + } else { + if (!isset($day) || !$day) + $thisday = $phpgw->calendar->today["day"]; + else + $thisday = $day; + if (!isset($month) || !$month) + $thismonth = $phpgw->calendar->today["month"]; + else + $thismonth = $month; + if (!isset($year) || !$year) + $thisyear = $phpgw->calendar->today["year"]; + else + $thisyear = $year; + } + } + $view = "day"; $now = $phpgw->calendar->splitdate(mktime (2, 0, 0, $thismonth, $thisday, $thisyear)); diff --git a/calendar/index.php b/calendar/index.php index 163ab91fa3..f946e03aed 100755 --- a/calendar/index.php +++ b/calendar/index.php @@ -15,6 +15,7 @@ /* $Id$ */ $phpgw_info["flags"] = array("currentapp" => "calendar", "enable_calendar_class" => True, "enable_nextmatchs_class" => True); + if (isset($friendly) && $friendly){ $phpgw_info["flags"]["noheader"] = True; $phpgw_info["flags"]["nonavbar"] = True; @@ -25,6 +26,30 @@ include("../header.inc.php"); + if(isset($friendly) && $friendly) { + if(!isset($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"])) + $phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] = "Sunday"; + + if (isset($date) && strlen($date) > 0) { + $thisyear = substr($date, 0, 4); + $thismonth = substr($date, 4, 2); + $thisday = substr($date, 6, 2); + } else { + if (!isset($day) || !$day) + $thisday = $phpgw->calendar->today["day"]; + else + $thisday = $day; + if (!isset($month) || !$month) + $thismonth = $phpgw->calendar->today["month"]; + else + $thismonth = $month; + if (!isset($year) || !$year) + $thisyear = $phpgw->calendar->today["year"]; + else + $thisyear = $year; + } + } + $next = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth + 1,1,$thisyear)); $prev = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth - 1,1,$thisyear)); diff --git a/calendar/week.php b/calendar/week.php index b4c53d39fc..d83e730ba1 100755 --- a/calendar/week.php +++ b/calendar/week.php @@ -19,12 +19,36 @@ if (isset($friendly) && $friendly){ $phpgw_info["flags"]["noheader"] = True; $phpgw_info["flags"]["nonavbar"] = True; - $phpgw_info["flags"]["nocalendarheader"] = True; +// $phpgw_info["flags"]["nocalendarheader"] = True; } else { $friendly = 0; } include("../header.inc.php"); + if(isset($friendly) && $friendly) { + if(!isset($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"])) + $phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] = "Sunday"; + + if (isset($date) && strlen($date) > 0) { + $thisyear = substr($date, 0, 4); + $thismonth = substr($date, 4, 2); + $thisday = substr($date, 6, 2); + } else { + if (!isset($day) || !$day) + $thisday = $phpgw->calendar->today["day"]; + else + $thisday = $day; + if (!isset($month) || !$month) + $thismonth = $phpgw->calendar->today["month"]; + else + $thismonth = $month; + if (!isset($year) || !$year) + $thisyear = $phpgw->calendar->today["year"]; + else + $thisyear = $year; + } + } + $next = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth,$thisday + 7,$thisyear)); $prev = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth,$thisday - 7,$thisyear)); @@ -76,7 +100,7 @@ $phpgw->template->set_var("week_display",$phpgw->calendar->display_large_week($thisday,$thismonth,$thisyear,true)); if (!$friendly) { - $param = "year=".$now["year"]."&month=".$now["month"]."&friendly=1"; + $param = "year=".$thisyear."&month=".$thismonth."&day=".$thisday."&friendly=1"; $phpgw->template->set_var("print","link($PHP_SELF,$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window." . "status = '" . lang("Generate printer-friendly version"). "'\">[". lang("Printer Friendly") . "]"); $phpgw->template->parse("out","week");