Subversion-Projekte lars-tiefland.niewerth

Revision

Revision 4 | Revision 18 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
2 lars 1
<?php
1 lars 2
	function generate_pagination2($base_url, $num_items, $per_page, $start_item, $add_prevnext_text = TRUE)
3
	{
4
		global $mode, $common;
5
		if (!$num_items)
6
		{
7
			return "";
8
		}
9
 
10
		$total_pages = ceil($num_items/$per_page);
11
 
12
		if ( $total_pages == 1 )
13
		{
14
			return '<table align="center" class="navig"><tr><th>'.$common["page"]." 1 ".$common["of"].' 1</th></tr></table><br><br>';
15
		}
16
 
17
		$on_page = floor($start_item / $per_page) + 1;
18
 
19
		$page_string = '<table align="center" class="navig"><tr><th colspan="5">'.$common["page"].' '.$on_page.' '.$common["of"].' '.$total_pages.'</th></tr><tr>';
20
 
21
		if ( $add_prevnext_text )
22
		{
23
			if ( $on_page > 1 )
24
			{
25
				$page_string .= "<td><form name=\"nav\" action=$base_url method=\"post\"><input type=\"submit\" value=\"|<<\" title=\"${common["first_page"]}\" class=\"liteoption\"><input type=\"hidden\" name=\"start\" value=\"0\"><input type=\"hidden\" name=\"mode\" value=\"$mode\"></form></td>";
26
				$prev_v=($on_page - 2 ) * $per_page;
27
				$page_string .= "<td><form name=\"nav\" action=$base_url method=\"post\"><input type=\"submit\" value=\"|<\" title=\"${common["previous_page"]}\" class=\"liteoption\"><input type=\"hidden\" name=\"start\" value=\"$prev_v\"><input type=\"hidden\" name=\"mode\" value=\"$mode\"></form></td>";
28
			}
29
			else
30
			{
31
				$page_string .= "<td><form name=\"nav\" action=$base_url method=\"post\"><input type=\"submit\" value=\"|<<\" disabled class=\"liteoption\"><input type=\"hidden\" name=\"start\" value=\"0\"><input type=\"hidden\" name=\"mode\" value=\"$mode\"></form></td>";
32
				$page_string .= "<td><form name=\"nav\" action=$base_url method=\"post\"><input type=\"submit\" value=\"|<\" class=\"liteoption\" disabled><input type=\"hidden\" name=\"start\" value=\"0\"></form></td>";
33
			}
34
		}
35
		if($total_pages >1)
36
		{
37
			$page_opts="";
38
			for ($i=0;$i<$total_pages;$i++)
39
			{
40
				$selected="";
41
				$j=$i+1;
42
				if($j==$on_page)
43
				{
44
					$selected="selected=\"selected\"";
45
				}
46
				$start=($i*$per_page);
47
				$page_opts.="<option value=$start $selected>$j</option>";
48
			}
49
			$page_string.="<td width=\"100\"><form name=\"nav\" action=$base_url method=\"post\"><select name=\"start\">$page_opts</select>&nbsp;&nbsp;<input type=\"submit\" value=\"${common["go"]}\" class=\"liteoption\"><input type=\"hidden\" name=\"mode\" value=\"$mode\"></form></td>";
50
		}
51
 
52
		if ( $add_prevnext_text )
53
		{
54
			if ( $on_page < $total_pages )
55
			{
56
				$next_v=($on_page * $per_page);
57
				$page_string .= "<td><form name=\"nav\" action=$base_url method=\"post\"><input type=\"submit\" value=\">|\" title=\"${common["next_page"]}\" class=\"liteoption\"><input type=\"hidden\" name=\"start\" value=\"$next_v\"><input type=\"hidden\" name=\"mode\" value=\"$mode\"></form></td>";
58
				$max_v=($total_pages -1)*$per_page;
59
				$page_string .= "<td><form name=\"nav\" action=$base_url method=\"post\"><input type=\"submit\" value=\">>|\" title=\"${common["last_page"]}\" class=\"liteoption\"><input type=\"hidden\" name=\"start\" value=\"$max_v\"><input type=\"hidden\" name=\"mode\" value=\"$mode\"></form></td>";
60
			}
61
			else
62
			{
63
				$page_string .= "<td><form name=\"nav\" action=$base_url method=\"post\"><input type=\"submit\" value=\">|\" class=\"liteoption\" disabled><input type=\"hidden\" name=\"start\" value=\"0\"><input type=\"hidden\" name=\"mode\" value=\"$mode\"></form></td>";
64
				$page_string .= "<td><form name=\"nav\" action=$base_url method=\"post\"><input type=\"submit\" value=\">>|\" disabled class=\"liteoption\" disabled><input type=\"hidden\" name=\"start\" value=\"0\"><input type=\"hidden\" name=\"mode\" value=\"$mode\"></form></td>";
65
			}
66
 
67
		}
68
		$page_string.="</tr></table><br><br>";
69
 
70
		return $page_string;
71
	}
3 lars 72
 
73
	function calendar($an_id, $f_id, $y=0, $m=0)
74
	{
75
		if ($y===0)
76
		{
77
			$y=date("Y");
78
		}
79
		if ($m===0)
80
		{
81
			$m=date("n");
82
		}
83
		global $smarty;
84
		$smarty->assign("title","Termine Schritt 2 - Kalender");
85
		setLocale(LC_ALL,"de_DE");
86
		$mode=(isset($_GET["mode"]))?$_GET["mode"]:"";
87
		$smarty->assign("mode",$mode);
12 lars 88
		$Month = new Calendar_Month_Weeks($y, $m);
3 lars 89
		$m_d=new Calendar_Decorator_Textual($Month);
90
		$u_d=new Calendar_Decorator_Uri($Month);
91
		$u_d->setFragments("jahr", "monat", "tag");
92
		$Month->build();
12 lars 93
 
3 lars 94
		$cal="<table>";
12 lars 95
		$cal.="<tr><th colspan=8>
3 lars 96
		<form action=termine.php>
97
			<input type='hidden' name='mode' value='calendar'>
98
			<input type='hidden' name='an_id' value='$an_id'>
99
			<input type='hidden' name='f_id' value='$f_id'>
100
			<input type='hidden' name='monat' value='$m'>
101
			<input type='hidden' name='jahr' value='".$u_d->prevYear()."'>
102
			<input class='liteoption' type='submit' value='<<'>
103
		</form>
104
 
105
		<form action=termine.php>
106
			<input type='hidden' name='mode' value='calendar'>
107
			<input type='hidden' name='an_id' value='$an_id'>
108
			<input type='hidden' name='f_id' value='$f_id'>
109
			<input type='hidden' name='monat' value='".$u_d->prevMonth()."'>
110
			<input type='hidden' name='jahr' value='".(($m==1)?$u_d->prevYear():$y)."'>
111
			<input class='liteoption' type='submit' value='<'>
112
		</form>
113
		&nbsp;&nbsp;".$m_d->thisMonthName()." ".$y."&nbsp;&nbsp;
114
		<form action=termine.php>
115
			<input type='hidden' name='mode' value='calendar'>
116
			<input type='hidden' name='an_id' value='$an_id'>
117
			<input type='hidden' name='f_id' value='$f_id'>
118
			<input type='hidden' name='monat' value='".$u_d->nextMonth()."'>
119
			<input type='hidden' name='jahr' value='".(($m==12)?$u_d->nextYear():$y)."'>
120
			<input class='liteoption' type='submit' value='>'>
121
		</form>
122
 
123
		<form action=termine.php>
124
			<input type='hidden' name='mode' value='calendar'>
125
			<input type='hidden' name='an_id' value='$an_id'>
126
			<input type='hidden' name='f_id' value='$f_id'>
127
			<input type='hidden' name='monat' value='$m'>
128
			<input type='hidden' name='jahr' value='".$u_d->nextYear()."'>
129
			<input class='liteoption' type='submit' value='>>'>
130
		</form>
131
		</th></tr>";
4 lars 132
		$tage=Calendar_Decorator_Textual::weekdayNames();
12 lars 133
		$cal.="<tr><th>KW#</th>";
4 lars 134
		for ($tag=1; $tag < 8; $tag++)
135
		{
136
			$cal.="<th>".$tage[$tag %7]."</th>";
137
		}
138
		$cal.="</tr>";
12 lars 139
		while ($Week = $Month->fetch())
3 lars 140
		{
12 lars 141
			$kw=$Week->thisWeek('n_in_year');
142
			$Week->build();
143
			$cal.="<tr><td>$kw</td>";
144
			while ($Day = $Week->fetch())
3 lars 145
			{
12 lars 146
				if ($Day->isEmpty())
147
				{
148
					$cal.="<td>&nbsp;</td>";
149
				}
150
				else
151
				{
152
					$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>";
153
				}
3 lars 154
 
12 lars 155
				if ($Day->isLast())
156
				{
157
					$cal.="</tr>";
158
				}
3 lars 159
			}
160
		}
161
 
162
		$cal.="</table>";
163
		$smarty->assign("cal",$cal);
164
		$smarty->display("calendar.tpl");
165
	}
1 lars 166
?>