4 |
andreas |
1 |
<?php
|
|
|
2 |
/*
|
|
|
3 |
Copyright (C) 2003-2004 MJG/04-Inconceivable.org
|
|
|
4 |
See file LICENSE for licensing details.
|
|
|
5 |
See file VERSION for versioning/author/source details
|
|
|
6 |
See file CHANGELOG for changes from version to version
|
|
|
7 |
|
|
|
8 |
Heavily altered by Andreas Theofilu; made it working
|
|
|
9 |
with PostgreSQL and made it fit into ProjectManager.
|
|
|
10 |
*/
|
|
|
11 |
|
|
|
12 |
// Include configuration data & core functions
|
|
|
13 |
require_once('version.inc');
|
|
|
14 |
require_once('dbaccess.inc');
|
|
|
15 |
require_once('language.inc');
|
|
|
16 |
require_once('header.inc');
|
|
|
17 |
require_once('helper.inc');
|
|
|
18 |
require_once('crypt.inc');
|
|
|
19 |
require_once('menu.inc');
|
|
|
20 |
require_once('settings.inc');
|
|
|
21 |
include("./global_config.inc.php");
|
|
|
22 |
|
|
|
23 |
$func = $_REQUEST['func'];
|
|
|
24 |
|
|
|
25 |
// connect to the database
|
|
|
26 |
$CONF['dbConn'] = OpenDB();
|
|
|
27 |
// If "del" is set and contains a number > 0 then we have to delete an entry.
|
|
|
28 |
if (isset($del) && $del > 0) {
|
|
|
29 |
$sqlQuery = "DELETE FROM calendar where ca_num = $del";
|
|
|
30 |
|
|
|
31 |
if (!TQueryDB($CONF['dbConn'], $sqlQuery))
|
|
|
32 |
Error("Fehler beim Löschen eines Kalendereintrags!");
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
// If "func" is set we have to check what function we must execute.
|
|
|
36 |
if (isset($func)) {
|
|
|
37 |
if ($func == "DONE" && isset($id) && $id > 0) { // Set the entry to "done"
|
|
|
38 |
$sqlQuery = "UPDATE calendar SET ca_status = 0 WHERE ca_num = $id";
|
|
|
39 |
|
|
|
40 |
if (!TQueryDB($CONF['dbConn'], $sqlQuery))
|
|
|
41 |
Error("Fehler beim setzen des Status!");
|
|
|
42 |
}
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
// Load and display day title and content in fields
|
|
|
46 |
if (isset($id)) {
|
|
|
47 |
$sqlQuery = "SELECT ca_title, ca_text, ca_num, ca_prnum, ca_task, ca_date, ";
|
|
|
48 |
$sqlQuery .= "ca_end, ca_status, ca_writer, ca_minum, ca_priority, mi_nname,";
|
|
|
49 |
$sqlQuery .= "mi_vname FROM calendar left join mitarbeiter on mi_num = ca_minum ";
|
|
|
50 |
$sqlQuery .= "WHERE ca_num = $id";
|
|
|
51 |
$sql_date = 0;
|
|
|
52 |
} else {
|
|
|
53 |
$sql_date = gmmktime(0, 0, 0, $month, $today, $year);
|
|
|
54 |
$sqlQuery = "SELECT ca_title, ca_text, ca_num, ca_prnum, ca_task, ca_date,";
|
|
|
55 |
$sqlQuery .= "ca_end, ca_status, ca_writer, ca_minum, ca_priority,";
|
|
|
56 |
$sqlQuery .= "mi_nname, mi_vname ";
|
|
|
57 |
$sqlQuery .= "FROM calendar left join mitarbeiter on mi_num = ca_minum ";
|
|
|
58 |
$sqlQuery .= "WHERE ca_date = $sql_date and ";
|
|
|
59 |
$sqlQuery .= "(ca_minum = $unum or ca_minum is null or ca_minum <= 0 or ";
|
|
|
60 |
$sqlQuery .= "ca_writer = $unum)";
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
if ( $sqlExec = QueryDB($CONF['dbConn'], $sqlQuery) )
|
|
|
64 |
{
|
|
|
65 |
if ($sqlExec)
|
|
|
66 |
$nr = numrowsDB($sqlExec);
|
|
|
67 |
else
|
|
|
68 |
$nr = 0;
|
|
|
69 |
|
|
|
70 |
if ( $nr > 0 )
|
|
|
71 |
{
|
|
|
72 |
$data = fetchDB($sqlExec, 0);
|
|
|
73 |
|
|
|
74 |
if ($sql_date == 0) {
|
|
|
75 |
$ca_date = $data[5];
|
|
|
76 |
$month = gmdate("n", $ca_date);
|
|
|
77 |
$today = gmdate("j", $ca_date);
|
|
|
78 |
$year = gmdate("Y", $ca_date);
|
|
|
79 |
$daylong = gmdate("l",gmmktime(1,1,1,$month,$today,$year));
|
|
|
80 |
$monthlong = gmdate("F",gmmktime(1,1,1,$month,$today,$year));
|
|
|
81 |
$dayone = gmdate("w",gmmktime(1,1,1,$month,1,$year));
|
|
|
82 |
$numdays = gmdate("t",gmmktime(1,1,1,$month,1,$year));
|
|
|
83 |
$next_year = $year + 1;
|
|
|
84 |
$last_year = $year - 1;
|
|
|
85 |
if ($today > $numdays) { $today--; }
|
|
|
86 |
$sql_date = $ca_date;
|
|
|
87 |
}
|
|
|
88 |
|
|
|
89 |
$ca_title = $data[0];
|
|
|
90 |
$ca_text = $data[1];
|
|
|
91 |
$ca_num = $data[2];
|
|
|
92 |
$ca_prnum = $data[3];
|
|
|
93 |
$ca_task = $data[4];
|
|
|
94 |
$ca_end = $data[6];
|
|
|
95 |
$ca_status = $data[7];
|
|
|
96 |
$ca_writer = $data[8];
|
|
|
97 |
$ca_minum = $data[9];
|
|
|
98 |
$ca_priority = $data[10];
|
|
|
99 |
$mi_nname = $data[11];
|
|
|
100 |
$mi_vname = $data[12];
|
|
|
101 |
|
|
|
102 |
if (isset($ca_task) && $ca_task > 0) {
|
|
|
103 |
$query = "select ta_name from task where ta_num = $ca_task";
|
|
|
104 |
$result = QueryDB ($CONF['dbConn'], $query);
|
|
|
105 |
|
|
|
106 |
if (!$result) {
|
|
|
107 |
$ta_name = "";
|
|
|
108 |
} else {
|
|
|
109 |
$data = fetchDB($result, 0);
|
|
|
110 |
$ta_name = $data[0];
|
|
|
111 |
}
|
|
|
112 |
} else
|
|
|
113 |
$ta_name = "";
|
|
|
114 |
|
|
|
115 |
$EVENT['title'] = $ca_title;
|
|
|
116 |
$EVENT['event'] = stripslashes($ca_text);
|
|
|
117 |
$EVENT['html'] = 1;
|
|
|
118 |
$EVENT['date'] = $sql_date;
|
|
|
119 |
$EVENT['id'] = $ca_num;
|
|
|
120 |
$EVENT['task'] = $ta_name;
|
|
|
121 |
$EVENT['prnum'] = $ca_prnum;
|
|
|
122 |
}
|
|
|
123 |
}
|
|
|
124 |
|
|
|
125 |
//begin outer table structure
|
|
|
126 |
echo "<table align='center' border=\"0\" cellpadding=\"4\" cellspacing=\"4\" width=\"528\">
|
|
|
127 |
<tr>
|
|
|
128 |
<td>
|
|
|
129 |
<table class=\"input\" width=\"311\">
|
|
|
130 |
<tr>
|
|
|
131 |
<td bgcolor=\"white\" valign=\"middle\" align=\"center\"><b>$daylong, $monthlong $today, $year</b></td>
|
|
|
132 |
</tr>
|
|
|
133 |
</table>
|
|
|
134 |
</td>
|
|
|
135 |
<td valign=\"middle\" align=\"center\">
|
|
|
136 |
<table class=\"input\" width=\"100%\">
|
|
|
137 |
<tr>
|
|
|
138 |
<td valign=\"middle\" align=\"center\"><a href=\"appt.php?year=$last_year&today=$today&month=$month&header=1&menu=0\" onmouseover=\"document.calb2.src='" . $CONF['url_images'] . "/ltab2over.gif'\" onmouseout=\"document.calb2.src='" . $CONF['url_images'] . "/ltab2.gif'\"><img src=\"" . $CONF['url_images'] . "/ltab2.gif\" border=\"0\" name=\"calb2\"></a></td><td> </td>
|
|
|
139 |
<td valign=\"middle\" align=\"center\"><b>$year</b></td>
|
|
|
140 |
<td> </td><td valign=\"middle\" align=\"center\"><a href=\"appt.php?year=$next_year&today=$today&month=$month&header=1&menu=0\" onmouseover=\"document.calb1.src='" . $CONF['url_images'] . "/rtab2over.gif'\" onmouseout=\"document.calb1.src='" . $CONF['url_images'] . "/rtab2.gif'\"><img src=\"" . $CONF['url_images'] . "/rtab2.gif\" border=\"0\" name=\"calb1\"></a></td>
|
|
|
141 |
</tr>
|
|
|
142 |
</table>
|
|
|
143 |
</td>
|
|
|
144 |
</tr>
|
|
|
145 |
<tr>
|
|
|
146 |
<td valign=\"top\">";
|
|
|
147 |
$hi = 425;
|
|
|
148 |
|
|
|
149 |
if (isset($ca_prnum) || isset($ca_task) || isset($ca_minum) || isset($ca_status)) {
|
|
|
150 |
echo " <table class=\"input\" width=\"100%\">";
|
|
|
151 |
echo " <tr><td class=\"cellbg\" valign=\"top\" width=\"40%\">Status:</td>";
|
|
|
152 |
|
|
|
153 |
if ($ca_status > 0)
|
|
|
154 |
$st = "<font color=\"#a00000\">Offen</font>";
|
|
|
155 |
else
|
|
|
156 |
$st = "<font color=\"#00a000\">Erledigt</font>";
|
|
|
157 |
|
|
|
158 |
$hi -= 20;
|
|
|
159 |
echo " <td class=\"cellbg\" valign=\"top\" width=\"65%\"><b>$st</b></td></tr>\n";
|
|
|
160 |
|
|
|
161 |
if (isset($ca_prnum)) {
|
|
|
162 |
echo " <tr><td class=\"cellbg\" valign=\"top\" width=\"35%\">Projektnummer:</td>
|
|
|
163 |
<td class=\"cellbg\" valign=\"top\" width=\"65%\"><b>" . $EVENT['prnum'] . "</b></td></tr>\n";
|
|
|
164 |
$hi -= 20;
|
|
|
165 |
}
|
|
|
166 |
|
|
|
167 |
if (isset($ca_task)) {
|
|
|
168 |
echo " <tr><td class=\"cellbg\" valign=\"top\" width=\"35%\">Taskname:</td>
|
|
|
169 |
<td class=\"cellbg\" valign=\"top\" width=\"65%\">" . $EVENT['task'] . "</td></tr>\n";
|
|
|
170 |
$hi -= 20;
|
|
|
171 |
}
|
|
|
172 |
|
|
|
173 |
if (isset($ca_minum)) {
|
|
|
174 |
echo " <tr><td class=\"cellbg\" valign=\"top\" width=\"35%\">Für Mitarbeiter:</td>
|
|
|
175 |
<td class=\"cellbg\" valign=\"top\" width=\"65%\">$mi_nname $mi_vname</td></tr>\n";
|
|
|
176 |
$hi -= 20;
|
|
|
177 |
}
|
|
|
178 |
|
|
|
179 |
if (isset($ca_end)) {
|
|
|
180 |
echo " <tr><td class=\"cellbg\" valign=\"top\" width=\"40%\">Erledigt bis:</td>";
|
|
|
181 |
echo " <td class=\"cellbg\" valign=\"top\" width=\"65%\"><b>" . gmdate($dtformatshort, $ca_end) . "</b></td></tr>\n";
|
|
|
182 |
$hi -= 20;
|
|
|
183 |
}
|
|
|
184 |
|
|
|
185 |
echo " <tr><td class=\"cellbg\" valign=\"top\" width=\"40%\">Priorität:</td>";
|
|
|
186 |
|
|
|
187 |
switch($ca_priority) {
|
|
|
188 |
case 0: $prio = "Niedrig"; break;
|
|
|
189 |
case 1: $prio = "Normal"; break;
|
|
|
190 |
case 2: $prio = "Hoch"; break;
|
|
|
191 |
default: $prio = "Niedrig";
|
|
|
192 |
}
|
|
|
193 |
|
|
|
194 |
echo " <td class=\"cellbg\" valign=\"top\" width=\"65%\">$prio</td></tr>\n";
|
|
|
195 |
|
|
|
196 |
echo " </table><br>";
|
|
|
197 |
}
|
|
|
198 |
|
|
|
199 |
echo " <table class=\"input\" width=\"100%\" height=\"$hi\">
|
|
|
200 |
<tr>
|
|
|
201 |
<td class=\"cellbg\" valign=\"top\">";
|
|
|
202 |
|
|
|
203 |
|
|
|
204 |
/* Show event text if there is an event */
|
|
|
205 |
if ( isset($EVENT['id']) )
|
|
|
206 |
{
|
|
|
207 |
echo "<div class=\"eventheading\">" . $EVENT['title'] . "</div>\n";
|
|
|
208 |
echo "<div class='navbar'></div><br />\n";
|
|
|
209 |
echo wordwrap($EVENT['event'], 60, "<br>");
|
|
|
210 |
}
|
|
|
211 |
else
|
|
|
212 |
{
|
|
|
213 |
echo "<div align='center' class='eventheading_noevent'> Keine Einträge für diesen Tag! </div>\n";
|
|
|
214 |
}
|
|
|
215 |
|
|
|
216 |
echo "</td></tr></table>";
|
|
|
217 |
echo "<br><center>";
|
|
|
218 |
|
|
|
219 |
echo "<table border=0 cellspacing=3 cellpadding=3><tr>\n";
|
|
|
220 |
echo "<td>";
|
|
|
221 |
ButtonLink("Neuer Termin", "calentry.php", "year=$year&today=$today&month=$month&header=1&menu=0");
|
|
|
222 |
echo "</td>";
|
|
|
223 |
// echo "<td><a href='calentry.php?year=$year&today=$today&month=$month&header=1&menu=0'>";
|
|
|
224 |
// echo "<img src=\"image/button_calentnew.png\" border=0 alt=\"Neuer Eintrag\"></a></td>\n";
|
|
|
225 |
$num_button = 1;
|
|
|
226 |
|
|
|
227 |
if ($ca_status && ($ca_minum == $unum || $rstufe == 1)) {
|
|
|
228 |
echo "<td>";
|
|
|
229 |
ButtonLink("Erledigt", "appt.php", "year=$year&today=$today&month=$month&id=$ca_num&func=DONE&header=1&menu=0");
|
|
|
230 |
echo "</td>";
|
|
|
231 |
// echo "<td><a href='appt.php?year=$year&today=$today&month=$month&id=$ca_num&func=DONE&header=1&menu=0'>";
|
|
|
232 |
// echo "<img src=\"image/button_calfin.png\" border=0 alt=\"Task erledigt\"></a></td>\n";
|
|
|
233 |
$num_button++;
|
|
|
234 |
}
|
|
|
235 |
|
|
|
236 |
if ($ca_status && ((isset($ca_writer) && $ca_writer == $unum) || $rstufe == 1)) {
|
|
|
237 |
if (($num_button % 3) == 0)
|
|
|
238 |
echo "</tr><tr>\n";
|
|
|
239 |
|
|
|
240 |
$tdate = gmdate($dtformatshort, $ca_date);
|
|
|
241 |
$tend = gmdate($dtformatshort, $ca_end);
|
|
|
242 |
echo "<td>";
|
|
|
243 |
ButtonLink("Editieren", "calentry.php",
|
|
|
244 |
"ca_num=$ca_num&ca_prnum=$ca_prnum&ca_task=$ca_task&" .
|
|
|
245 |
"ca_minum=$ca_minum&ca_date=$tdate&ca_priority=$ca_priority&" .
|
|
|
246 |
"ca_end=$tend&ca_title=$ca_title&ca_text=" . urlencode($ca_text) .
|
|
|
247 |
"&func=edit&header=1&menu=0");
|
|
|
248 |
echo "</td>";
|
|
|
249 |
// echo "<td><a href=\"calentry.php?ca_num=$ca_num&ca_prnum=$ca_prnum";
|
|
|
250 |
// echo "&ca_task=$ca_task&ca_minum=$ca_minum&ca_date=$tdate&ca_priority=$ca_priority";
|
|
|
251 |
// echo "&ca_end=$tend&ca_title=$ca_title&ca_text=$ca_text&func=edit&header=1&menu=0\">";
|
|
|
252 |
// echo "<img src=\"image/button_edit.png\" border=0 alt=\"Eintrag editieren\"></a></td>\n";
|
|
|
253 |
$num_button++;
|
|
|
254 |
}
|
|
|
255 |
|
|
|
256 |
if (isset($ca_num) && $ca_num > 0 && $ca_status == 0 && ($ca_writer == $unum || $rstufe == 1)) {
|
|
|
257 |
if (($num_button % 3) == 0)
|
|
|
258 |
echo "</tr><tr>\n";
|
|
|
259 |
|
|
|
260 |
echo "<td>";
|
|
|
261 |
ButtonLink("Eintrag Löschen", "appt.php", "year=$year&today=$today&month=$month&del=$ca_num&header=1&menu=0");
|
|
|
262 |
echo "</td>";
|
|
|
263 |
// echo "<td><a href='appt.php?year=$year&today=$today&month=$month&del=$ca_num&header=1&menu=0'>";
|
|
|
264 |
// echo "<img src=\"image/button_calentdel.png\" border=0 alt=\"Eintrag Löschen\"></a></td>\n";
|
|
|
265 |
$num_button++;
|
|
|
266 |
}
|
|
|
267 |
|
|
|
268 |
echo "</tr></table>\n";
|
|
|
269 |
echo "</center>";
|
|
|
270 |
echo " <td valign=\"top\">
|
|
|
271 |
|
|
|
272 |
<table class=\"input\" width=\"250\">
|
|
|
273 |
<tr>
|
|
|
274 |
<td valign=\"middle\" align=\"center\" onClick=\"window.location='appt.php?year=$year&today=1&month=1&header=1&menu=0';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"appt.php?year=$year&today=1&month=1&header=1&menu=0\" class=\"normal\">Jan</a> </td>
|
|
|
275 |
<td valign=\"middle\" align=\"center\" onClick=\"window.location='appt.php?year=$year&today=1&month=2&header=1&menu=0';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"appt.php?year=$year&today=1&month=2&header=1&menu=0\" class=\"normal\">Feb</a> </td>
|
|
|
276 |
<td valign=\"middle\" align=\"center\" onClick=\"window.location='appt.php?year=$year&today=1&month=3&header=1&menu=0';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"appt.php?year=$year&today=1&month=3&header=1&menu=0\" class=\"normal\">Mär</a> </td>
|
|
|
277 |
<td valign=\"middle\" align=\"center\" onClick=\"window.location='appt.php?year=$year&today=1&month=4&header=1&menu=0';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"appt.php?year=$year&today=1&month=4&header=1&menu=0\" class=\"normal\">Apr</a> </td>
|
|
|
278 |
<td valign=\"middle\" align=\"center\" onClick=\"window.location='appt.php?year=$year&today=1&month=5&header=1&menu=0';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"appt.php?year=$year&today=1&month=5&header=1&menu=0\" class=\"normal\">Mai</a> </td>
|
|
|
279 |
<td valign=\"middle\" align=\"center\" onClick=\"window.location='appt.php?year=$year&today=1&month=6&header=1&menu=0';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"appt.php?year=$year&today=1&month=6&header=1&menu=0\" class=\"normal\">Jun</a> </td>
|
|
|
280 |
</tr>
|
|
|
281 |
<tr>
|
|
|
282 |
<td valign=\"middle\" align=\"center\" onClick=\"window.location='appt.php?year=$year&today=1&month=7&header=1&menu=0';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"appt.php?year=$year&today=1&month=7&header=1&menu=0\" class=\"normal\">Jul</a> </td>
|
|
|
283 |
<td valign=\"middle\" align=\"center\" onClick=\"window.location='appt.php?year=$year&today=1&month=8&header=1&menu=0';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"appt.php?year=$year&today=1&month=8&header=1&menu=0\" class=\"normal\">Aug</a> </td>
|
|
|
284 |
<td valign=\"middle\" align=\"center\" onClick=\"window.location='appt.php?year=$year&today=1&month=9&header=1&menu=0';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"appt.php?year=$year&today=1&month=9&header=1&menu=0\" class=\"normal\">Sep</a> </td>
|
|
|
285 |
<td valign=\"middle\" align=\"center\" onClick=\"window.location='appt.php?year=$year&today=1&month=10&header=1&menu=0';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"appt.php?year=$year&today=1&month=10&header=1&menu=0\" class=\"normal\">Okt</a> </td>
|
|
|
286 |
<td valign=\"middle\" align=\"center\" onClick=\"window.location='appt.php?year=$year&today=1&month=11&header=1&menu=0';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"appt.php?year=$year&today=1&month=11&header=1&menu=0\" class=\"normal\">Nov</a> </td>
|
|
|
287 |
<td valign=\"middle\" align=\"center\" onClick=\"window.location='appt.php?year=$year&today=1&month=12&header=1&menu=0';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"appt.php?year=$year&today=1&month=12&header=1&menu=0\" class=\"normal\">Dez</a> </td>
|
|
|
288 |
</tr>
|
|
|
289 |
</table><br />\n";
|
|
|
290 |
|
|
|
291 |
|
|
|
292 |
//display name of month
|
|
|
293 |
echo "<table class=\"input\" width=\"250\">\n<tr>\n";
|
|
|
294 |
echo "<td class=\"cellbg\" colspan=\"7\" valign=\"middle\" align=\"center\"><font class=\"regheading\"><b>" . gmdate("F",gmmktime(1,1,1,$month,1,$year)) . "</b></font>\n</td>\n";
|
|
|
295 |
echo "</tr>\n<tr>\n";
|
|
|
296 |
|
|
|
297 |
|
|
|
298 |
//display day names
|
|
|
299 |
foreach($alldays as $value) {
|
|
|
300 |
echo "<td class=\"cellbg\" valign=\"middle\" align=\"center\" width=\"10%\"><font class=\"normaltext\" size=\"1\"><b>$value</b></font></td>\n";
|
|
|
301 |
}
|
|
|
302 |
echo "</tr>\n<tr>\n";
|
|
|
303 |
|
|
|
304 |
|
|
|
305 |
//display blank days as nbsp's
|
|
|
306 |
for ($i = 0; $i < $dayone; $i++) {
|
|
|
307 |
echo "<td class=\"cellbg\" valign=\"middle\" align=\"center\"><font class=\"normaltext\" size=\"1\"> </font></td>\n";
|
|
|
308 |
}
|
|
|
309 |
|
|
|
310 |
|
|
|
311 |
//display days
|
|
|
312 |
for ($zz = 1; $zz <= $numdays; $zz++) {
|
|
|
313 |
if ($i >= 7) {
|
|
|
314 |
print("</tr>\n<tr>\n"); $i=0;
|
|
|
315 |
}
|
|
|
316 |
|
|
|
317 |
//check current day for an event
|
|
|
318 |
$result_found = 0;
|
|
|
319 |
|
|
|
320 |
if ($zz == $today) { //mark todays cell regardless
|
|
|
321 |
echo "<td valign=\"middle\" align=\"center\" onClick=\"window.location='appt.php?year=$year&today=$zz&month=$month&header=1&menu=0';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='celltoday'\" class=\"celltoday\"><a href=\"appt.php?year=$year&today=$zz&month=$month&header=1&menu=0\" class=\"today\">$zz</a></font></td>\n";
|
|
|
322 |
$result_found = 1;
|
|
|
323 |
}
|
|
|
324 |
|
|
|
325 |
if ($result_found != 1) {//search for event on this day and mark cell if title not empty
|
|
|
326 |
$sql_currentday = gmmktime(0, 0, 0, $month, $zz, $year);
|
|
|
327 |
$eventQuery = "SELECT distinct ca_title, ca_date ";
|
|
|
328 |
$eventQuery .= "FROM calendar ";
|
|
|
329 |
$eventQuery .= "WHERE ca_date = '$sql_currentday'";
|
|
|
330 |
|
|
|
331 |
if ($rstufe != 1) {
|
|
|
332 |
$eventQuery .= " and (ca_minum = $unum or ca_minum is null ";
|
|
|
333 |
$eventQuery .= "or ca_writer = $unum)";
|
|
|
334 |
}
|
|
|
335 |
|
|
|
336 |
$eventExec = QueryDB($CONF['dbConn'], $eventQuery);
|
|
|
337 |
$nr = numrowsDB($eventExec);
|
|
|
338 |
$j = 0;
|
|
|
339 |
$old_date = 0;
|
|
|
340 |
|
|
|
341 |
while($j < $nr) {
|
|
|
342 |
$data = fetchDB($eventExec, $j);
|
|
|
343 |
$row['title'] = $data[0];
|
|
|
344 |
$row['date'] = $data[1];
|
|
|
345 |
|
|
|
346 |
if (strlen($row["title"]) > 0 && $row['date'] != $old_date) {
|
|
|
347 |
echo "<td valign=\"middle\" align=\"center\" onClick=\"window.location='";
|
|
|
348 |
echo "appt.php?year=$year&today=$zz&month=$month&header=1&menu=0';";
|
|
|
349 |
echo "\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellevent'";
|
|
|
350 |
echo "\" class=\"cellevent\"><a href=\"appt.php";
|
|
|
351 |
echo "?year=$year&today=$zz&month=$month&header=1&menu=0\" class=\"normal\">$zz</a></td>\n";
|
|
|
352 |
$result_found = 1;
|
|
|
353 |
}
|
|
|
354 |
|
|
|
355 |
$old_date = $row['date'];
|
|
|
356 |
$j++;
|
|
|
357 |
}
|
|
|
358 |
}
|
|
|
359 |
|
|
|
360 |
if ($result_found != 1) {//show default cell style for day
|
|
|
361 |
echo "<td valign=\"middle\" align=\"center\" onClick=\"window.location='appt.php?year=$year&today=$zz&month=$month&header=1&menu=0';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"><a href=\"appt.php?year=$year&today=$zz&month=$month&header=1&menu=0\" class=\"normal\">$zz</a></td>\n";
|
|
|
362 |
}
|
|
|
363 |
|
|
|
364 |
$i++; $result_found = 0;
|
|
|
365 |
}
|
|
|
366 |
|
|
|
367 |
$create_emptys = 7 - (($dayone + $numdays) % 7);
|
|
|
368 |
if ($create_emptys == 7) { $create_emptys = 0; }
|
|
|
369 |
|
|
|
370 |
//display blank remaining cells
|
|
|
371 |
if ($create_emptys != 0) {
|
|
|
372 |
echo "<td class=\"cellbg\" valign=\"middle\" align=\"center\" colspan=\"$create_emptys\"><font class=\"normaltext\"> </font></td>\n";
|
|
|
373 |
}
|
|
|
374 |
|
|
|
375 |
echo "</tr>\n";
|
|
|
376 |
echo "</table><br />\n";
|
|
|
377 |
|
|
|
378 |
|
|
|
379 |
//weekly display
|
|
|
380 |
echo "<table class=\"input\" width=\"250\">\n<tr>\n";
|
|
|
381 |
echo "<td valign=\"middle\" align=\"center\" class=\"cellbg\"><font class=\"regheading\"><b>Die ganze Woche</b></font></td></tr>\n";
|
|
|
382 |
|
|
|
383 |
|
|
|
384 |
for ($i = $today; $i <= ($today + 6); $i++)
|
|
|
385 |
{
|
|
|
386 |
//determine if days rollover into next month
|
|
|
387 |
$current_day = $i;
|
|
|
388 |
$current_year = $year;
|
|
|
389 |
$current_month = $month;
|
|
|
390 |
|
|
|
391 |
if ($i > $numdays)
|
|
|
392 |
{
|
|
|
393 |
$current_day = ($i - $numdays);
|
|
|
394 |
$current_month = $month + 1;
|
|
|
395 |
|
|
|
396 |
if ($current_month > 12)
|
|
|
397 |
{
|
|
|
398 |
$current_month = 1; $current_year = $year + 1;
|
|
|
399 |
}
|
|
|
400 |
}
|
|
|
401 |
|
|
|
402 |
$dayname = gmdate("l",gmmktime(1,1,1,$current_month,$current_day,$current_year));
|
|
|
403 |
$sql_currentday = gmmktime(0, 0, 0, $current_month, $current_day, $current_year);
|
|
|
404 |
$eventQuery = "SELECT ca_title, ca_num ";
|
|
|
405 |
$eventQuery .= "FROM calendar ";
|
|
|
406 |
$eventQuery .= "WHERE ca_date = '$sql_currentday'";
|
|
|
407 |
|
|
|
408 |
if ($rstufe != 1) {
|
|
|
409 |
$eventQuery .= " and (ca_minum = $unum or ca_minum is null ";
|
|
|
410 |
$eventQuery .= "or ca_writer = $unum)";
|
|
|
411 |
}
|
|
|
412 |
|
|
|
413 |
$eventExec = QueryDB($CONF['dbConn'], $eventQuery);
|
|
|
414 |
|
|
|
415 |
if ( $eventExec )
|
|
|
416 |
{
|
|
|
417 |
$j=0;
|
|
|
418 |
$nr = numrowsDB($eventExec);
|
|
|
419 |
|
|
|
420 |
while($j < $nr)
|
|
|
421 |
{
|
|
|
422 |
$data = fetchDB($eventExec, $j);
|
|
|
423 |
$row['title'] = $data[0];
|
|
|
424 |
$row['id'] = $data[1];
|
|
|
425 |
|
|
|
426 |
if (strlen($row["title"]) > 0)
|
|
|
427 |
{
|
|
|
428 |
$this_days_title[$j] = stripslashes($row["title"]);
|
|
|
429 |
$this_days_title[$j] = htmlspecialchars($this_days_title[$j]);
|
|
|
430 |
$this_id[$j] = $row['id'];
|
|
|
431 |
}
|
|
|
432 |
|
|
|
433 |
$j++;
|
|
|
434 |
}
|
|
|
435 |
|
|
|
436 |
if ( $j==0 )
|
|
|
437 |
{
|
|
|
438 |
$this_days_title[0] = "";
|
|
|
439 |
}
|
|
|
440 |
}
|
|
|
441 |
|
|
|
442 |
// echo "<tr onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\" height=\"30\">
|
|
|
443 |
// <td valign=\"top\" onClick=\"window.location='" .$_SERVER['PHP_SELF']. "?year=$current_year&today=$current_day&month=$current_month&header=$header';\"><a href=\"".$_SERVER['PHP_SELF']."?year=$current_year&today=$current_day&month=$current_month&header=$header\" class=\"normal\">$dayname - $current_day</a><br />\n";
|
|
|
444 |
echo "<tr onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\" height=\"30\">
|
|
|
445 |
<td valign=\"top\"><a href=\"appt.php?year=$current_year&today=$current_day&month=$current_month&header=1&menu=0\" class=\"normal\">$dayname - $current_day</a><br />\n";
|
|
|
446 |
|
|
|
447 |
|
|
|
448 |
//display day title if exists
|
|
|
449 |
$a = 0;
|
|
|
450 |
|
|
|
451 |
if ($nr > 0)
|
|
|
452 |
echo "<font class=\"eventtitle\">";
|
|
|
453 |
|
|
|
454 |
while ($a <= $j) {
|
|
|
455 |
if ( strlen($this_days_title[$a]) > 0 ) {
|
|
|
456 |
echo "<a href=\"appt.php?today=$current_day&month=$current_month&year=$current_year&id=";
|
|
|
457 |
echo $this_id[$a] . "&header=1&menu=0\">" . $this_days_title[$a] . "</a><br>\n";
|
|
|
458 |
}
|
|
|
459 |
|
|
|
460 |
$a++;
|
|
|
461 |
}
|
|
|
462 |
|
|
|
463 |
if ($nr > 0)
|
|
|
464 |
echo "</font>\n";
|
|
|
465 |
|
|
|
466 |
echo "</td></tr>\n";
|
|
|
467 |
$this_days_title = "";
|
|
|
468 |
}
|
|
|
469 |
echo "</table>\n";
|
|
|
470 |
|
|
|
471 |
echo "<center><a href=\"appt.php?header=1&menu=0\" class=\"normal\">Heutiger Tag</a></center>";
|
|
|
472 |
|
|
|
473 |
|
|
|
474 |
//end outer table
|
|
|
475 |
echo "</td>
|
|
|
476 |
</tr>
|
|
|
477 |
</table>\n";
|
|
|
478 |
|
|
|
479 |
require('footer.inc');
|
|
|
480 |
?>
|
|
|
481 |
|