aboutsummaryrefslogtreecommitdiffstats
path: root/day.php
blob: 8f0539b02c662481c8c7e85bd3b3315a264fae2e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<?php

$current_view = "day";
include("./ical_parser.php");

//if ($use_sessions == "yes") {
//	session_start();
//	if (is_array($aArray)) $master_array = $aArray;
//	echo "using sessions";
//}

$starttime = "0700";
$weekstart = 1;
// dpr 20020926: moved variable gridLength to config.inc.php
//$gridLength = 30;
$unix_time = strtotime($getdate);
$today_today = date ("Ymd");
$tomorrows_date = date( "Ymd", strtotime("+1 day",  $unix_time));
$yesterdays_date = date( "Ymd", strtotime("-1 day",  $unix_time));
$display_date = strftime($dateFormat_day, $unix_time);
$nbrGridCols = 1;
if ($master_array[($getdate)]) {
	foreach($master_array[($getdate)] as $ovlKey => $ovlValue) {
		if ($ovlKey != "-1") {
			foreach($ovlValue as $ovl2Value) {
				$nbrGridCols = kgv($nbrGridCols, ($ovl2Value["event_overlap"] + 1));
			}
		}
	} 
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
	<meta http-equiv="content-type" content="text/html;charset=UTF-8">
	<title><?php echo "$calendar_name"; ?></title>
  	<link rel="stylesheet" type="text/css" href="styles/<?php echo "$style_sheet"; ?>">
	<?php include "functions/event.js"; ?>
</head>
<body bgcolor="#FFFFFF">
<center>

<table width="700" border="0" cellspacing="0" cellpadding="0" class="V12">
	<tr>
		<td align="left" width="100"><?php echo "<a class=\"psf\" href=\"day.php?cal=$cal&getdate=$today_today\">$today_lang</a>"; ?></td>
		<td align="center" width="600"><?php echo "<a class=\"psf\" href=\"day.php?cal=$cal&getdate=$getdate\">$day_lang</a> | <a class=\"psf\" href=\"week.php?cal=$cal&getdate=$getdate\">$week_lang</a> | <a class=\"psf\" href=\"month.php?cal=$cal&getdate=$getdate\">$month_lang</a>"; ?></td>
		<td align="right" width="100"><!--[[a class="psf" href="preferences.php"]]Preferences[[/a]]--></td>
	</tr>
	<tr>
		<td colspan="3"><img src="images/spacer.gif" height="10" width="1" alt=""></td>
	</tr>
</table>

<table width="700" border="0" cellspacing="1" cellpadding="2" class="calborder">
<tr>
<td>

<table width="700" border="0" cellspacing="0" cellpadding="0">
    <tr>
     	<td align="center" valign="middle">
      		<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#a1a5a9" class="G10B">
      			<tr>
      				<td bgcolor="#ffffff">
      					<table width="100%" border="0" cellspacing="1" cellpadding="2">
							<tr>
								<td colspan="2">
									<table width="100%" border="0" cellspacing="0" cellpadding="0">
										<tr>
											<td class="G10B" align="left" valign="top" width="100"><?php echo "<a class=\"psf\" href=\"day.php?cal=$cal&getdate=$yesterdays_date\">$last_day_lang</a>"; ?></td>
											<td class="H20" align="center" valign="middle" width="500"><?php echo "$display_date"; ?></td>
											<td class="G10B" align="right" valign="top" width="100"><?php echo "<a class=\"psf\" href=\"day.php?cal=$cal&getdate=$tomorrows_date\">$next_day_lang</a>"; ?></td>
										</tr>
									</table>
								</td>
							</tr>
							<tr>
								<td align="left" valign="middle" class="G10B" width="50%"><?php include('./functions/list_icals.php'); ?></td>
								<td align="right" valign="middle" class="G10B" width="50%"><?php echo "<a class=\"psf\" href=\"$fullpath$cal.ics\">$subscribe_lang</a>&nbsp;|&nbsp;<a class=\"psf\" href=\"$filename\">$download_lang</a>"; ?></td>
							</tr>
						</table>
      				</td>
      			</tr>
      			<tr>
					<td align="center" valign="top">
						<table width="100%" border="0" cellspacing="1" cellpadding="0">
							<?php
							// The all day events returned here.
							$i = 0;
							if (sizeof($master_array[($getdate)]["-1"]) > 0) {
								echo "<tr height=\"30\">\n";
								echo "<td colspan=\"15\" height=\"30\" valign=\"middle\" align=\"center\" class=\"eventbg\">\n";
								echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\">\n";										  
								foreach($master_array[($getdate)]["-1"] as $all_day) {
									$event_text2 = addslashes($all_day["event_text"]);
									$event_text2 = str_replace("\"", "&quot;", $event_text2);
									if ($i > 0) {
										echo "<tr>\n";
										echo "<td bgcolor=\"#eeeeee\" height=\"1\"></td>\n";
										echo "</tr>\n";
									}
									echo "<tr>\n";
									echo "<td valign=\"top\" align=\"center\"><a class=\"psf\" href=\"javascript:openEventInfo('$event_text2', '$calendar_name', '$event_start', '$event_end')\"><font class=\"eventfont\"><i>" . $all_day["event_text"] . "</i></font></a></td>\n";
									echo "</tr>\n";
									$i++;
								}
								echo "</table>\n";
								echo "</td>\n";
								echo "</tr>\n";
							}
							?>

							<tr>
								<td nowrap bgcolor="#a1a5a9" width="60"></td>
								<td nowrap bgcolor="#a1a5a9" width="1"></td>
								<?php for ($m=0;$m < $nbrGridCols;$m++) { 
									echo "<td nowrap bgcolor=\"#a1a5a9\"><img src=\"images/spacer.gif\" width=\"" . (700 / $nbrGridCols) . "\" height=\"1\" alt=\"\"></td>";
								} ?>
							</tr>
							<?php
								// $master_array[($getdate)]["$day_time"]
								$event_length = array ();
								
								foreach ($day_array as $key) {
									$cal_time = $key;	
									$key = strtotime ("$key");
									$key = date ($timeFormat, $key);
																		
									// check for eventstart 
									if (sizeof($master_array[($getdate)]["$cal_time"]) > 0) {
										foreach ($master_array[($getdate)]["$cal_time"] as $eventKey => $loopevent) {
											$drawEvent = drawEventTimes ($loopevent["event_start"], $loopevent["event_end"]);
											$j = 0;
											while ($event_length[$j]) {
												if ($event_length[$j]["state"] == "ended") {
													$event_length[$j] = array ("length" => ($drawEvent["draw_length"] / $gridLength), "key" => $eventKey, "overlap" => $loopevent["event_overlap"],"state" => "begin");
													break;
												}
												$j++;
											}
											if ($j == sizeof($event_length)) {
												array_push ($event_length, array ("length" => ($drawEvent["draw_length"] / $gridLength), "key" => $eventKey, "overlap" => $loopevent["event_overlap"],"state" => "begin"));
											}
										}
									}
									if (ereg("([0-9]{1,2}):00", $key)) {
										echo "<tr height=\"" . $gridLength . "\">\n";
										echo "<td rowspan=\"" . (60 / $gridLength) . "\" align=\"center\" valign=\"top\" bgcolor=\"#f5f5f5\" width=\"60\">$key</td>\n";
										echo "<td  align=\"center\" valign=\"top\" nowrap bgcolor=\"#a1a5a9\" width=\"1\" height=\"" . $gridLength . "\"></td>\n";
									} else {
										echo "<tr height=\"" . $gridLength . "\">\n";
										echo "<td  align=\"center\" valign=\"top\" nowrap bgcolor=\"#a1a5a9\" width=\"1\" height=\"" . $gridLength . "\"></td>\n";
									}
									if (sizeof($event_length) == 0) {
										echo "<td bgcolor=\"#ffffff\" colspan=\"" . $nbrGridCols . "\">&nbsp;</td>\n";
									} else {
										$emptyWidth = $nbrGridCols;
										for ($i=0;$i<sizeof($event_length);$i++) {
								//echo $master_array[($getdate)]["$cal_time"][($event_length[$i]["key"])]["event_text"] . " ind: " . $i . " / anz: " . $event_length[$i]["overlap"] . " = " . eventWidth($i,$event_length[$i]["overlap"]) . "<br />";
											$drawWidth = $nbrGridCols / ($event_length[$i]["overlap"] + 1);
											$emptyWidth = $emptyWidth - $drawWidth;
											switch ($event_length[$i]["state"]) {
												case "begin":
													$event_length[$i]["state"] = "started";
													$event_text 	= $master_array[($getdate)]["$cal_time"][($event_length[$i]["key"])]["event_text"];
													$event_text2 	= addslashes($master_array[($getdate)]["$cal_time"][($event_length[$i]["key"])]["event_text"]);
													$event_text2 	= str_replace("\"", "&quot;", $event_text2);
													$event_start 	= $master_array[($getdate)]["$cal_time"][($event_length[$i]["key"])]["event_start"];
													$event_end		= $master_array[($getdate)]["$cal_time"][($event_length[$i]["key"])]["event_end"];
													$description 	= $master_array[($getdate)]["$cal_time"][($event_length[$i]["key"])]["description"];
													$description 	= str_replace("\"", "&quot;", $description);
													$event_start 	= strtotime ("$event_start");
													$event_start 	= date ($timeFormat, $event_start);
													$event_end 		= strtotime ("$event_end");
													$event_end 		= date ($timeFormat, $event_end);
													echo "<td rowspan=\"" . $event_length[$i]["length"] . "\" colspan=\"" . $drawWidth . "\" align=\"left\" valign=\"top\" class=\"eventbg\">\n";
													echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n";
													echo "<tr>\n";
													echo "<td class=\"eventborder\"><font class=\"eventfont\"><b>$event_start</b> - $event_end</font></td>\n";
													echo "</tr>\n";
													echo "<tr>\n";
													echo "<td>\n";
													echo "<table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\">\n";
													echo "<tr>\n";
													echo "<td class=\"eventbg\"><a class=\"psf\" href=\"javascript:openEventInfo('$event_text2', '$calendar_name', '$event_start', '$event_end', '$description')\"><font class=\"eventfont\">$event_text</font></a></td>\n";
													echo "</tr>\n";
													echo "</table>\n";
													echo "</td>\n";           
													echo "</tr>\n";
													echo "</table>\n";
													echo "</td>\n";
													break;
												case "started":
													break;
												case "ended":
													echo "<td bgcolor=\"#ffffff\" colspan=\"" . $drawWidth . "\">&nbsp;</td>\n";
													break;
											}
											$event_length[$i]["length"]--;
											if ($event_length[$i]["length"] == 0) {
												$event_length[$i]["state"] = "ended";
											}
										}
										//fill emtpy space on the right
										if ($emptyWidth > 0) {
											echo "<td bgcolor=\"#ffffff\" colspan=\"" . $emptyWidth . "\">&nbsp;</td>\n";
										}
										while ($event_length[(sizeof($event_length) - 1)]["state"] == "ended") {
											array_pop($event_length);
										}
										
									}
									echo "</tr>\n";
								}
								
							?>
					</table>
        		</td>
       		</tr>
        	</table>
    	</td>
	</tr>
</table>

</td>
</tr>
</table>
<br>
<?php echo "<font class=\"V9\">$powered_by_lang <a class=\"psf\" href=\"http://sourceforge.net/projects/phpicalendar/\">PHP iCalendar $version_lang</a></font>"; ?>
</center>
</body>
</html>

© 2014-2024 Faster IT GmbH | imprint | privacy policy