Subversion-Projekte lars-tiefland.niewerth

Revision

Revision 2 | Revision 4 | 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
		require_once 'Calendar/Month/Weekdays.php';
85
		require_once 'Calendar/Decorator/Textual.php';
86
		require_once 'Calendar/Decorator/Uri.php';
87
		$smarty->assign("title","Termine Schritt 2 - Kalender");
88
		setLocale(LC_ALL,"de_DE");
89
		$mode=(isset($_GET["mode"]))?$_GET["mode"]:"";
90
		$smarty->assign("mode",$mode);
91
		$Month = new Calendar_Month_Weekdays($y, $m);
92
		$m_d=new Calendar_Decorator_Textual($Month);
93
		$u_d=new Calendar_Decorator_Uri($Month);
94
		$u_d->setFragments("jahr", "monat", "tag");
95
		$Month->build();
96
 
97
		$cal="<table>";
98
		$cal.="<tr><th colspan=7>
99
		<form action=termine.php>
100
			<input type='hidden' name='mode' value='calendar'>
101
			<input type='hidden' name='an_id' value='$an_id'>
102
			<input type='hidden' name='f_id' value='$f_id'>
103
			<input type='hidden' name='monat' value='$m'>
104
			<input type='hidden' name='jahr' value='".$u_d->prevYear()."'>
105
			<input class='liteoption' type='submit' value='<<'>
106
		</form>
107
 
108
		<form action=termine.php>
109
			<input type='hidden' name='mode' value='calendar'>
110
			<input type='hidden' name='an_id' value='$an_id'>
111
			<input type='hidden' name='f_id' value='$f_id'>
112
			<input type='hidden' name='monat' value='".$u_d->prevMonth()."'>
113
			<input type='hidden' name='jahr' value='".(($m==1)?$u_d->prevYear():$y)."'>
114
			<input class='liteoption' type='submit' value='<'>
115
		</form>
116
		&nbsp;&nbsp;".$m_d->thisMonthName()." ".$y."&nbsp;&nbsp;
117
		<form action=termine.php>
118
			<input type='hidden' name='mode' value='calendar'>
119
			<input type='hidden' name='an_id' value='$an_id'>
120
			<input type='hidden' name='f_id' value='$f_id'>
121
			<input type='hidden' name='monat' value='".$u_d->nextMonth()."'>
122
			<input type='hidden' name='jahr' value='".(($m==12)?$u_d->nextYear():$y)."'>
123
			<input class='liteoption' type='submit' value='>'>
124
		</form>
125
 
126
		<form action=termine.php>
127
			<input type='hidden' name='mode' value='calendar'>
128
			<input type='hidden' name='an_id' value='$an_id'>
129
			<input type='hidden' name='f_id' value='$f_id'>
130
			<input type='hidden' name='monat' value='$m'>
131
			<input type='hidden' name='jahr' value='".$u_d->nextYear()."'>
132
			<input class='liteoption' type='submit' value='>>'>
133
		</form>
134
		</th></tr>";
135
		$cal.="<tr><th>Mo</th><th>Di</th><th>Mi</th><th>Do</th><th>Fr</th><th>Sa</th><th>So</th></tr>";
136
		while ($Day = $Month->fetch())
137
		{
138
			if ($Day->isFirst())
139
			{
140
				$cal.="<tr>";
141
			}
142
 
143
			if ($Day->isEmpty())
144
			{
145
				$cal.="<td>&nbsp;</td>";
146
			}
147
			else
148
			{
149
				$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>";
150
			}
151
 
152
			if ($Day->isLast())
153
			{
154
				$cal.="</tr>";
155
			}
156
		}
157
 
158
		$cal.="</table>";
159
		$smarty->assign("cal",$cal);
160
		$smarty->display("calendar.tpl");
161
	}
1 lars 162
?>