Subversion-Projekte lars-tiefland.niewerth

Revision

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