fixes for improper calculations of weekdaystarts

This commit is contained in:
skeeter 2000-11-19 17:01:30 +00:00
parent 1d0e2c5998
commit c6e22e175f
6 changed files with 40 additions and 76 deletions

View File

@ -16,7 +16,7 @@
$phpgw_info["flags"] = array("currentapp" => "calendar", "enable_calendar_class" => True, "enable_nextmatchs_class" => True, "enable_template_class" => True);
if (isset($friendly) && (int)$friendly==1){
if (isset($friendly) && $friendly){
$phpgw_info["flags"]["noheader"] = True;
$phpgw_info["flags"]["nonavbar"] = True;
$phpgw_info["flags"]["nocalendarheader"] = True;
@ -28,25 +28,6 @@
$view = "day";
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;
}
$now = $phpgw->calendar->splitdate(mktime (2, 0, 0, $thismonth, $thisday, $thisyear));
$phpgw->template->set_file(array("day" => "day.tpl"));

View File

@ -1,8 +1,32 @@
<?php
global $date, $year, $month, $day, $thisyear, $thismonth, $thisday;
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;
}
if (!isset($phpgw_info["flags"]["nocalendarheader"]) ||
!$phpgw_info["flags"]["nocalendarheader"]) {
?>
?>
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
@ -10,17 +34,17 @@
&nbsp;
</td>
<td width="2%">
<a href="<?php echo $phpgw->link("day.php","year=".$phpgw->common->show_date(time(),"Y")."&month=".$phpgw->common->show_date(time(),"m")."&day=".$phpgw->common->show_date(time(),"d")); ?>">
<a href="<?php echo $phpgw->link("day.php","day=".$phpgw->calendar->today["day"]."&month=".$phpgw->calendar->today["month"]."&year=".$phpgw->calendar->today["year"]); ?>">
<img src="<?php echo $phpgw_info["server"]["app_images"]; ?>/today.gif" alt="<?php echo lang("Today"); ?>" border="0">
</a>
</td>
<td width="2%" align="left">
<a href="<?php echo $phpgw->link("week.php","date=".$phpgw->common->show_date(time(),"Ymd")); ?>">
<a href="<?php echo $phpgw->link("week.php","day=".$phpgw->calendar->today["day"]."&month=".$phpgw->calendar->today["month"]."&year=".$phpgw->calendar->today["year"]); ?>">
<img src="<?php echo $phpgw_info["server"]["app_images"]; ?>/week.gif" alt="<?php echo lang("This week"); ?>" border="0">
</a>
</td>
<td width="2%" align="left">
<a href="<?php echo $phpgw->link("index.php","date=".$phpgw->common->show_date(time(),"Ymd")); ?>">
<a href="<?php echo $phpgw->link("index.php","day=".$phpgw->calendar->today["day"]."&month=".$phpgw->calendar->today["month"]."&year=".$phpgw->calendar->today["year"]); ?>">
<img src="<?php echo $phpgw_info["server"]["app_images"]; ?>/month.gif" alt="<?php echo lang("This month"); ?>" border="0">
</a>
</td>
@ -39,6 +63,6 @@
</td>
</tr>
</table>
<?php
<?php
}
?>
?>

View File

@ -17,31 +17,14 @@
$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;
$phpgw_info["flags"]["nocalendarheader"] = True;
} else {
$friendly = 0;
}
include("../header.inc.php");
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));

View File

@ -9,7 +9,6 @@
}
</style>
</head>
<table border="0" width="100%">
<tr>
<td align="left" valign="top">
@ -17,7 +16,7 @@
</td>
<td align="middle">
<font size="+2" color="#000000"><b>{month_identifier}</b></font>
<font color="#000000" size="+1" color="{bg_text}"><br>{username}</font>
<font size="+1" color="#000000"><br>{username}</font>
</td>
<td align="right" valign="top">
{small_calendar_next}

View File

@ -19,12 +19,8 @@
</td>
<td align="center" valign="top">
{small_calendar_this}
<font size="+2" color="{bg_text"}">
<b>{week_identifier}</b>
</font>
<font size="+1" color="{bg_text}"><br>
{username}
</font>
<font size="+2" color="#000000"><b>{week_identifier}</b></font>
<font size="+2" color="#000000"><br>{username}</font>
</td>
<td align="right">
{next_week_link}

View File

@ -13,44 +13,25 @@
\**************************************************************************/
/* $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;
$phpgw_info["flags"]["nocalendarheader"] = True;
} else {
$friendly = 0;
}
include("../header.inc.php");
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));
$nextmonth = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth + 1,1,$thisyear));
$prevmonth = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth - 1,1,$thisyear));
if($phpgw_info["user"]["preferences"]["calednar"]["workweekstarts"] == "Sunday") {
if($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] == "Sunday") {
$start = 7200;
} else {
$start = 93600;