| 2 |
lars |
1 |
<?php
|
| 18 |
lars |
2 |
//Kalender generieren
|
| 3 |
lars |
3 |
function calendar($an_id, $f_id, $y=0, $m=0)
|
|
|
4 |
{
|
|
|
5 |
if ($y===0)
|
|
|
6 |
{
|
|
|
7 |
$y=date("Y");
|
|
|
8 |
}
|
|
|
9 |
if ($m===0)
|
|
|
10 |
{
|
|
|
11 |
$m=date("n");
|
|
|
12 |
}
|
| 32 |
lars |
13 |
$t_date=date("d.m.Y");
|
| 3 |
lars |
14 |
global $smarty;
|
|
|
15 |
$smarty->assign("title","Termine Schritt 2 - Kalender");
|
|
|
16 |
setLocale(LC_ALL,"de_DE");
|
|
|
17 |
$mode=(isset($_GET["mode"]))?$_GET["mode"]:"";
|
|
|
18 |
$smarty->assign("mode",$mode);
|
| 12 |
lars |
19 |
$Month = new Calendar_Month_Weeks($y, $m);
|
| 3 |
lars |
20 |
$m_d=new Calendar_Decorator_Textual($Month);
|
|
|
21 |
$u_d=new Calendar_Decorator_Uri($Month);
|
|
|
22 |
$u_d->setFragments("jahr", "monat", "tag");
|
|
|
23 |
$Month->build();
|
| 12 |
lars |
24 |
|
| 3 |
lars |
25 |
$cal="<table>";
|
| 12 |
lars |
26 |
$cal.="<tr><th colspan=8>
|
| 3 |
lars |
27 |
<form action=termine.php>
|
|
|
28 |
<input type='hidden' name='mode' value='calendar'>
|
|
|
29 |
<input type='hidden' name='an_id' value='$an_id'>
|
|
|
30 |
<input type='hidden' name='f_id' value='$f_id'>
|
|
|
31 |
<input type='hidden' name='monat' value='$m'>
|
|
|
32 |
<input type='hidden' name='jahr' value='".$u_d->prevYear()."'>
|
|
|
33 |
<input class='liteoption' type='submit' value='<<'>
|
|
|
34 |
</form>
|
|
|
35 |
|
|
|
36 |
<form action=termine.php>
|
|
|
37 |
<input type='hidden' name='mode' value='calendar'>
|
|
|
38 |
<input type='hidden' name='an_id' value='$an_id'>
|
|
|
39 |
<input type='hidden' name='f_id' value='$f_id'>
|
|
|
40 |
<input type='hidden' name='monat' value='".$u_d->prevMonth()."'>
|
|
|
41 |
<input type='hidden' name='jahr' value='".(($m==1)?$u_d->prevYear():$y)."'>
|
|
|
42 |
<input class='liteoption' type='submit' value='<'>
|
|
|
43 |
</form>
|
|
|
44 |
".$m_d->thisMonthName()." ".$y."
|
|
|
45 |
<form action=termine.php>
|
|
|
46 |
<input type='hidden' name='mode' value='calendar'>
|
|
|
47 |
<input type='hidden' name='an_id' value='$an_id'>
|
|
|
48 |
<input type='hidden' name='f_id' value='$f_id'>
|
|
|
49 |
<input type='hidden' name='monat' value='".$u_d->nextMonth()."'>
|
|
|
50 |
<input type='hidden' name='jahr' value='".(($m==12)?$u_d->nextYear():$y)."'>
|
|
|
51 |
<input class='liteoption' type='submit' value='>'>
|
|
|
52 |
</form>
|
|
|
53 |
|
|
|
54 |
<form action=termine.php>
|
|
|
55 |
<input type='hidden' name='mode' value='calendar'>
|
|
|
56 |
<input type='hidden' name='an_id' value='$an_id'>
|
|
|
57 |
<input type='hidden' name='f_id' value='$f_id'>
|
|
|
58 |
<input type='hidden' name='monat' value='$m'>
|
|
|
59 |
<input type='hidden' name='jahr' value='".$u_d->nextYear()."'>
|
|
|
60 |
<input class='liteoption' type='submit' value='>>'>
|
|
|
61 |
</form>
|
|
|
62 |
</th></tr>";
|
| 4 |
lars |
63 |
$tage=Calendar_Decorator_Textual::weekdayNames();
|
| 12 |
lars |
64 |
$cal.="<tr><th>KW#</th>";
|
| 4 |
lars |
65 |
for ($tag=1; $tag < 8; $tag++)
|
|
|
66 |
{
|
|
|
67 |
$cal.="<th>".$tage[$tag %7]."</th>";
|
|
|
68 |
}
|
|
|
69 |
$cal.="</tr>";
|
| 12 |
lars |
70 |
while ($Week = $Month->fetch())
|
| 3 |
lars |
71 |
{
|
| 12 |
lars |
72 |
$kw=$Week->thisWeek('n_in_year');
|
|
|
73 |
$Week->build();
|
|
|
74 |
$cal.="<tr><td>$kw</td>";
|
|
|
75 |
while ($Day = $Week->fetch())
|
| 3 |
lars |
76 |
{
|
| 12 |
lars |
77 |
if ($Day->isEmpty())
|
|
|
78 |
{
|
|
|
79 |
$cal.="<td> </td>";
|
|
|
80 |
}
|
|
|
81 |
else
|
|
|
82 |
{
|
| 33 |
lars |
83 |
$x_date=sprintf("%02d",$Day->thisDay()).".$m.$y";
|
|
|
84 |
if($x_date == $t_date)
|
| 31 |
lars |
85 |
{
|
|
|
86 |
$cal.="<td class='cal-today'>";
|
|
|
87 |
}
|
|
|
88 |
else
|
|
|
89 |
{
|
|
|
90 |
$cal.="<td>";
|
|
|
91 |
}
|
|
|
92 |
$cal.="<a href='termine.php?mode=end&an_id=$an_id&f_id=$f_id&jahr=".$Month->thisYear()."&monat=".$Month->thisMonth()."&tag=".$Day->thisDay()."'>".$Day->thisDay()."</a></td>";
|
| 12 |
lars |
93 |
}
|
| 3 |
lars |
94 |
|
| 12 |
lars |
95 |
if ($Day->isLast())
|
|
|
96 |
{
|
|
|
97 |
$cal.="</tr>";
|
|
|
98 |
}
|
| 3 |
lars |
99 |
}
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
$cal.="</table>";
|
|
|
103 |
$smarty->assign("cal",$cal);
|
|
|
104 |
$smarty->display("calendar.tpl");
|
|
|
105 |
}
|
| 1 |
lars |
106 |
?>
|