mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-03-03 09:31:24 +01:00
index.php now uses the api
This commit is contained in:
parent
8fd703f1eb
commit
13fe67088c
@ -11,12 +11,13 @@
|
|||||||
* option) any later version. *
|
* option) any later version. *
|
||||||
\**************************************************************************/
|
\**************************************************************************/
|
||||||
|
|
||||||
if ($friendly) {
|
if (isset($friendly) && $friendly){
|
||||||
include($phpgw_info["server"]["api_dir"]."/footer.inc.php");
|
$phpgw->common->phpgw_footer();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $phpgw_info["flags"]["nocalendarfooter"]) {
|
if (!isset($phpgw_info["flags"]["nocalendarheader"]) ||
|
||||||
|
!$phpgw_info["flags"]["nocalendarheader"]) {
|
||||||
?>
|
?>
|
||||||
<BR CLEAR="all">
|
<BR CLEAR="all">
|
||||||
<HR CLEAR="all">
|
<HR CLEAR="all">
|
||||||
@ -126,4 +127,4 @@
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -204,13 +204,13 @@
|
|||||||
$thismonth = substr($date, 4, 2);
|
$thismonth = substr($date, 4, 2);
|
||||||
|
|
||||||
for ($i=0; $i < count($repeated_events); $i++ ) {
|
for ($i=0; $i < count($repeated_events); $i++ ) {
|
||||||
$start = date_to_epoch($repeated_events[$i][cal_date]);
|
$start = date_to_epoch($repeated_events[$i]["cal_date"]);
|
||||||
$end = date_to_epoch($repeated_events[$i][cal_end]);
|
$end = date_to_epoch($repeated_events[$i]["cal_end"]);
|
||||||
|
|
||||||
$freq = $repeated_events[$i][cal_frequency];
|
$freq = $repeated_events[$i]["cal_frequency"];
|
||||||
// only repeat after the beginning, and if there is an end
|
// only repeat after the beginning, and if there is an end
|
||||||
// before the end
|
// before the end
|
||||||
if ($repeated_events[$i][cal_end] && date("Ymd",$date) > date("Ymd",$end) )
|
if ($repeated_events[$i]["cal_end"] && date("Ymd",$date) > date("Ymd",$end) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (date("Ymd",$date) < date("Ymd",$start))
|
if (date("Ymd",$date) < date("Ymd",$start))
|
||||||
@ -218,14 +218,14 @@
|
|||||||
|
|
||||||
$id = $repeated_events[$i][cal_id];
|
$id = $repeated_events[$i][cal_id];
|
||||||
|
|
||||||
if ($repeated_events[$i][cal_type] == 'daily') {
|
if ($repeated_events[$i]["cal_type"] == 'daily') {
|
||||||
if ( (floor(($date - $start)/86400)%$freq) )
|
if ( (floor(($date - $start)/86400)%$freq) )
|
||||||
continue;
|
continue;
|
||||||
link_to_entry( $id, "rpt.gif", $repeated_events[$i][cal_description]);
|
link_to_entry( $id, "rpt.gif", $repeated_events[$i]["cal_description"]);
|
||||||
echo $repeated_events[$i][cal_name] . "<br>";
|
echo $repeated_events[$i]["cal_name"] . "<br>";
|
||||||
} else if ($repeated_events[$i][cal_type] == 'weekly') {
|
} else if ($repeated_events[$i]["cal_type"] == 'weekly') {
|
||||||
$dow = date("w", $date);
|
$dow = date("w", $date);
|
||||||
$isDay = substr($repeated_events[$i][cal_days], $dow, 1);
|
$isDay = substr($repeated_events[$i]["cal_days"], $dow, 1);
|
||||||
|
|
||||||
/*if ( (floor($diff/86400)%$freq) ) // Whats this for ?
|
/*if ( (floor($diff/86400)%$freq) ) // Whats this for ?
|
||||||
** continue;
|
** continue;
|
||||||
@ -234,10 +234,10 @@
|
|||||||
if (floor(($date - $start)/604800)%$freq)
|
if (floor(($date - $start)/604800)%$freq)
|
||||||
continue;
|
continue;
|
||||||
if (strcmp($isDay,"y") == 0) {
|
if (strcmp($isDay,"y") == 0) {
|
||||||
link_to_entry($id, "rpt.gif", $repeated_events[$i][cal_description]);
|
link_to_entry($id, "rpt.gif", $repeated_events[$i]["cal_description"]);
|
||||||
echo $repeated_events[$i][cal_name] . "<br>";
|
echo $repeated_events[$i]["cal_name"] . "<br>";
|
||||||
}
|
}
|
||||||
} else if ($repeated_events[$i][cal_type] == 'monthlyByDay') {
|
} else if ($repeated_events[$i]["cal_type"] == 'monthlyByDay') {
|
||||||
$dowS = date("w", $start);
|
$dowS = date("w", $start);
|
||||||
$dayS = floor(date("d", $start)/7);
|
$dayS = floor(date("d", $start)/7);
|
||||||
$mthS = date("m", $start);
|
$mthS = date("m", $start);
|
||||||
@ -250,10 +250,10 @@
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (($dowS == $dow) && ($day == $dayS)) {
|
if (($dowS == $dow) && ($day == $dayS)) {
|
||||||
link_to_entry($id, "rpt.gif", $repeated_events[$i][cal_description]);
|
link_to_entry($id, "rpt.gif", $repeated_events[$i]["cal_description"]);
|
||||||
echo $repeated_events[$i][cal_name] . "<br>";
|
echo $repeated_events[$i]["cal_name"] . "<br>";
|
||||||
}
|
}
|
||||||
} else if ($repeated_events[$i][cal_type] == 'monthlyByDate') {
|
} else if ($repeated_events[$i]["cal_type"] == 'monthlyByDate') {
|
||||||
$mthS = date("m", $start);
|
$mthS = date("m", $start);
|
||||||
$yrS = date("Y", $start);
|
$yrS = date("Y", $start);
|
||||||
$mth = date("m", $date);
|
$mth = date("m", $date);
|
||||||
@ -261,17 +261,17 @@
|
|||||||
if ((($yr - $yrS)*12 + $mth - $mthS) % $freq)
|
if ((($yr - $yrS)*12 + $mth - $mthS) % $freq)
|
||||||
continue;
|
continue;
|
||||||
if (date("d", $date) == date("d", $start)) {
|
if (date("d", $date) == date("d", $start)) {
|
||||||
link_to_entry($id, "rpt.gif", $repeated_events[$i][cal_description]);
|
link_to_entry($id, "rpt.gif", $repeated_events[$i]["cal_description"]);
|
||||||
echo $repeated_events[$i][cal_name] . "<br>";
|
echo $repeated_events[$i]["cal_name"] . "<br>";
|
||||||
}
|
}
|
||||||
} else if ($repeated_events[$i][cal_type] == 'yearly') {
|
} else if ($repeated_events[$i]["cal_type"] == 'yearly') {
|
||||||
$yrS = date("Y", $start);
|
$yrS = date("Y", $start);
|
||||||
$yr = date("Y", $date);
|
$yr = date("Y", $date);
|
||||||
if (($yr - $yrS)%$freq)
|
if (($yr - $yrS)%$freq)
|
||||||
continue;
|
continue;
|
||||||
if (date("dm", $date) == date("dm", $start)) {
|
if (date("dm", $date) == date("dm", $start)) {
|
||||||
link_to_entry($id, "rpt.gif", $repeated_events[$i][cal_description]);
|
link_to_entry($id, "rpt.gif", $repeated_events[$i]["cal_description"]);
|
||||||
echo $repeated_events[$i][cal_name] . "<br>";
|
echo $repeated_events[$i]["cal_name"] . "<br>";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// unknown rpt type - because of all our else ifs
|
// unknown rpt type - because of all our else ifs
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
if (! $phpgw_info["flags"]["nocalendarheader"]) {
|
|
||||||
|
if (!isset($phpgw_info["flags"]["nocalendarheader"]) ||
|
||||||
|
!$phpgw_info["flags"]["nocalendarheader"]) {
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<table border="0" width="100%" cellpadding="0" cellspacing="0">
|
<table border="0" width="100%" cellpadding="0" cellspacing="0">
|
||||||
@ -25,7 +27,9 @@
|
|||||||
<td align="right">
|
<td align="right">
|
||||||
<form action="<?php echo $phpgw->link("search.php"); ?>" method="POST">
|
<form action="<?php echo $phpgw->link("search.php"); ?>" method="POST">
|
||||||
<input type="hidden" name="from" value="<?php echo $PHP_SELF; ?>">
|
<input type="hidden" name="from" value="<?php echo $PHP_SELF; ?>">
|
||||||
|
<?php if(isset($date) && $date) { ?>
|
||||||
<input type="hidden" name="date" value="<?php echo $date; ?>">
|
<input type="hidden" name="date" value="<?php echo $date; ?>">
|
||||||
|
<?php } ?>
|
||||||
<input type="hidden" name="month" value="<?php echo $thismonth; ?>">
|
<input type="hidden" name="month" value="<?php echo $thismonth; ?>">
|
||||||
<input type="hidden" name="day" value="<?php echo $thisday; ?>">
|
<input type="hidden" name="day" value="<?php echo $thisday; ?>">
|
||||||
<input type="hidden" name="year" value="<?php echo $thisyear; ?>">
|
<input type="hidden" name="year" value="<?php echo $thisyear; ?>">
|
||||||
@ -37,4 +41,4 @@
|
|||||||
</table>
|
</table>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -14,40 +14,39 @@
|
|||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
if ($friendly) {
|
if (isset($friendly) && $friendly){
|
||||||
$phpgw_info["flags"]["noheader"] = True;
|
$phpgw_info["flags"]["noheader"] = True;
|
||||||
|
} else {
|
||||||
|
$friendly = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$phpgw_info["flags"]["currentapp"] = "calendar";
|
$phpgw_info["flags"]["currentapp"] = "calendar";
|
||||||
include("../header.inc.php");
|
include("../header.inc.php");
|
||||||
if (strlen($date) > 0) {
|
|
||||||
|
if (isset($date) && strlen($date) > 0) {
|
||||||
$thisyear = substr($date, 0, 4);
|
$thisyear = substr($date, 0, 4);
|
||||||
$thismonth = substr($date, 4, 2);
|
$thismonth = substr($date, 4, 2);
|
||||||
$thisday = substr($date, 6, 2);
|
$thisday = substr($date, 6, 2);
|
||||||
} else {
|
} else {
|
||||||
if ($day == 0)
|
if (!isset($day) || !$day)
|
||||||
$thisday = date("d");
|
$thisday = $phpgw->calendar->today["day"];
|
||||||
else
|
else
|
||||||
$thisday = $day;
|
$thisday = $day;
|
||||||
if ($month == 0)
|
if (!isset($month) || !$month)
|
||||||
$thismonth = date("m");
|
$thismonth = $phpgw->calendar->today["month"];
|
||||||
else
|
else
|
||||||
$thismonth = $month;
|
$thismonth = $month;
|
||||||
if ($year == 0)
|
if (!isset($year) || !$year)
|
||||||
$thisyear = date("Y");
|
$thisyear = $phpgw->calendar->today["year"];
|
||||||
else
|
else
|
||||||
$thisyear = $year;
|
$thisyear = $year;
|
||||||
}
|
}
|
||||||
|
|
||||||
$next = mktime(2,0,0,$thismonth + 1,1,$thisyear);
|
$next = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth + 1,1,$thisyear));
|
||||||
$nextyear = date("Y", $next);
|
// $nextdate = date("Ymd");
|
||||||
$nextmonth = date("m", $next);
|
|
||||||
$nextdate = date("Ymd");
|
|
||||||
|
|
||||||
$prev = mktime(2,0,0,$thismonth - 1,1,$thisyear);
|
$prev = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth - 1,1,$thisyear));
|
||||||
$prevyear = date("Y",$prev);
|
// $prevdate = date("Ymd");
|
||||||
$prevmonth = date("m",$prev);
|
|
||||||
$prevdate = date("Ymd");
|
|
||||||
|
|
||||||
if ($friendly) {
|
if ($friendly) {
|
||||||
echo "<body bgcolor=\"".$phpgw_info["theme"][bg_color]."\">";
|
echo "<body bgcolor=\"".$phpgw_info["theme"][bg_color]."\">";
|
||||||
@ -69,10 +68,10 @@
|
|||||||
<table border="0" width="100%">
|
<table border="0" width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<?php
|
<?php
|
||||||
if (! $friendly) {
|
// if (! $friendly) {
|
||||||
echo "<td align=\"left\">";
|
echo "<td align=\"left\">";
|
||||||
display_small_month($prevmonth,$prevyear,True);
|
echo $phpgw->calendar->display_small_month($prev["month"],$prev["year"],True,"edit_entry.php");
|
||||||
}
|
// }
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<td align="middle"><font size="+2" color="#000000"><B>
|
<td align="middle"><font size="+2" color="#000000"><B>
|
||||||
@ -88,86 +87,24 @@
|
|||||||
?>
|
?>
|
||||||
</font></td>
|
</font></td>
|
||||||
<?php
|
<?php
|
||||||
if (! $friendly) {
|
// if (! $friendly) {
|
||||||
echo "<td align=\"right\">";
|
echo "<td align=\"right\">";
|
||||||
display_small_month($nextmonth,$nextyear,True);
|
echo $phpgw->calendar->display_small_month($next["month"],$next["year"],True,"edit_entry.php");
|
||||||
}
|
// }
|
||||||
?>
|
?>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<table width="100%" border="0" bordercolor="#FFFFFF" cellspacing="2" cellpadding="2">
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<th width="14%" bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]; ?>"><font color="<?php echo $phpgw_info["theme"]["th_text"]; ?>"><?php echo lang("Sun"); ?></font></th>
|
|
||||||
<th width="14%" bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]; ?>"><font color="<?php echo $phpgw_info["theme"]["th_text"]; ?>"><?php echo lang("Mon"); ?></font></th>
|
|
||||||
<th width="14%" bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]; ?>"><font color="<?php echo $phpgw_info["theme"]["th_text"]; ?>"><?php echo lang("Tue"); ?></font></th>
|
|
||||||
<th width="14%" bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]; ?>"><font color="<?php echo $phpgw_info["theme"]["th_text"]; ?>"><?php echo lang("Wed"); ?></font></th>
|
|
||||||
<th width="14%" bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]; ?>"><font color="<?php echo $phpgw_info["theme"]["th_text"]; ?>"><?php echo lang("Thu"); ?></font></th>
|
|
||||||
<th width="14%" bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]; ?>"><font color="<?php echo $phpgw_info["theme"]["th_text"]; ?>"><?php echo lang("Fri"); ?></font></th>
|
|
||||||
<th width="14%" bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]; ?>"><font color="<?php echo $phpgw_info["theme"]["th_text"]; ?>"><?php echo lang("Sat"); ?></font></th>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
echo $phpgw->calendar->display_large_month($thismonth,$thisyear,True,"edit_entry.php");
|
||||||
|
|
||||||
/* Pre-Load the repeated events for quckier access */
|
/* Pre-Load the repeated events for quckier access */
|
||||||
$repeated_events = read_repeated_events();
|
$repeated_events = read_repeated_events();
|
||||||
|
|
||||||
// We add 2 hours on to the time so that the switch to DST doesn't
|
|
||||||
// throw us off. So, all our dates are 2AM for that day.
|
|
||||||
// $sun = get_sunday_before($thisyear,$thismonth,1) + 7200;
|
|
||||||
$sun = get_sunday_before($thisyear,$thismonth,1) + 7200;
|
|
||||||
// generate values for first day and last day of month
|
|
||||||
$monthstart = mktime(2,0,0,$thismonth,1,$thisyear);
|
|
||||||
$monthend = mktime(2,0,0,$thismonth + 1,0,$thisyear);
|
|
||||||
|
|
||||||
// debugging
|
|
||||||
//echo "<P>sun = " . date("D, m-d-Y", $sun) . "<BR>";
|
|
||||||
//echo "<P>monthstart = " . date("D, m-d-Y", $monthstart) . "<BR>";
|
|
||||||
//echo "<P>monthend = " . date("D, m-d-Y", $monthend) . "<BR>";
|
|
||||||
|
|
||||||
$today = mktime(2,0,0,date("m"),date("d"),date("Y"));
|
|
||||||
|
|
||||||
for ($i = $sun; date("Ymd",$i) <= date("Ymd",$monthend); $i += (24 * 3600 * 7) ) {
|
|
||||||
$cellcolor = $phpgw->nextmatchs->alternate_row_color($cellcolor);
|
|
||||||
|
|
||||||
echo "<tr>\n";
|
|
||||||
for ($j = 0; $j < 7; $j++) {
|
|
||||||
$date = $i + ($j * 24 * 3600);
|
|
||||||
if (date("Ymd",$date) >= date("Ymd",$monthstart) &&
|
|
||||||
date("Ymd",$date) <= date("Ymd",$monthend)) {
|
|
||||||
echo "<td valign=\"top\" width=\"75\" height=\"75\"";
|
|
||||||
if (date("Ymd",$date) == date("Ymd",$today)) {
|
|
||||||
echo " bgcolor=\"".$phpgw_info["theme"]["cal_today"]."\">";
|
|
||||||
} else {
|
|
||||||
echo " bgcolor=\"$cellcolor\">";
|
|
||||||
}
|
|
||||||
|
|
||||||
print_date_entries($date,$friendly,$phpgw_info["user"]["sessionid"]);
|
|
||||||
|
|
||||||
$thirsday=$i+24*3600*4;
|
|
||||||
if ($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] == "Sunday" && $j == 0) {
|
|
||||||
echo "<font size=\"-2\"><a href=\"".$phpgw->link("week.php","date=".date("Ymd",$date))."\">week " .(int)((date("z",$thirsday)+7)/7) . "</a></font>";
|
|
||||||
}
|
|
||||||
if ($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] == "Monday" && $j == 1) {
|
|
||||||
echo "<font size=\"-2\"><a href=\"".$phpgw->link("week.php","date=" . date("Ymd",$date)) . "\">week " . (int)((date("z",$thirsday)+7)/7) . "</a></font>";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "</td>\n";
|
|
||||||
} else {
|
|
||||||
echo "<td></td>\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</table>
|
|
||||||
<p>
|
<p>
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (! $friendly) {
|
if (!$friendly) {
|
||||||
$param = "";
|
$param = "";
|
||||||
if ($thisyear)
|
if ($thisyear)
|
||||||
$param .= "year=$thisyear&month=$thismonth&";
|
$param .= "year=$thisyear&month=$thismonth&";
|
||||||
|
Loading…
Reference in New Issue
Block a user