Subversion-Projekte lars-tiefland.niewerth

Revision

Revision 12 | Revision 19 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

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