aboutsummaryrefslogtreecommitdiffstats
path: root/month.php
blob: 2d75f48c63682fd9397c4753e45469c61a5d6466 (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
235
236
237
238
239
<?php 

$current_view = "month";
define('BASE', './');
include(BASE.'functions/ical_parser.php');
if ($minical_view == 'current') $minical_view = 'month';

ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2);
$this_day 				= $day_array2[3]; 
$this_month 			= $day_array2[2];
$this_year 				= $day_array2[1];

$unix_time 				= strtotime($getdate);
$today_today 			= date('Ymd', strtotime("now + $second_offset seconds")); 
$tomorrows_date 		= date( "Ymd", strtotime("+1 day",  $unix_time));
$yesterdays_date 		= date( "Ymd", strtotime("-1 day",  $unix_time));

// find out next month
$next_month_month 		= ($this_month+1 == '13') ? '1' : ($this_month+1);
$next_month_day 		= $this_day;
$next_month_year 		= ($next_month_month == '1') ? ($this_year+1) : $this_year;
while (!checkdate($next_month_month,$next_month_day,$next_month_year)) $next_month_day--;
$next_month_time 		= mktime(0,0,0,$next_month_month,$next_month_day,$next_month_year);

// find out last month
$prev_month_month 		= ($this_month-1 == '0') ? '12' : ($this_month-1);
$prev_month_day 		= $this_day;
$prev_month_year 		= ($prev_month_month == '12') ? ($this_year-1) : $this_year;
while (!checkdate($prev_month_month,$prev_month_day,$prev_month_year)) $prev_month_day--;
$prev_month_time 		= mktime(0,0,0,$prev_month_month,$prev_month_day,$prev_month_year);

$next_month 			= date("Ymd", $next_month_time);
$prev_month 			= date("Ymd", $prev_month_time);
$display_date 			= localizeDate ($dateFormat_month, $unix_time);
$parse_month 			= date ("Ym", $unix_time);
$first_of_month 		= $this_year.$this_month."01";
$start_month_day 		= dateOfWeek($first_of_month, $week_start_day);
$thisday2 				= localizeDate($dateFormat_week_list, $unix_time);
$num_of_events2 			= 0;

include (BASE.'includes/header.inc.php'); 

?>
<center>
<table width="735" border="0" cellspacing="0" cellpadding="0" class="calborder">
	<tr>
		<td align="center" valign="middle" bgcolor="white">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
      			<tr>
      				<td align="left" width="120" class="navback">&nbsp;</td>
      				<td class="navback">
      					<table width="100%" border="0" cellspacing="0" cellpadding="0">
      						<tr>
								<td align="right" width="40%" class="navback"><?php echo "<a class=\"psf\" href=\"month.php?cal=$cal&amp;getdate=$prev_month\"><img src=\"styles/$style_sheet/left_day.gif\" alt=\"[$last_month_lang]\" border=\"0\" align=\"right\"></a>"; ?></td>
								<td align="center" width="20%" class="navback" nowrap valign="middle"><font class="H20"><?php echo $display_date; ?></font></td>
      							<td align="left" width="40%" class="navback"><?php echo "<a class=\"psf\" href=\"month.php?cal=$cal&amp;getdate=$next_month\"><img src=\"styles/$style_sheet/right_day.gif\" alt=\"[$next_month_lang]\" border=\"0\" align=\"left\"></a>"; ?></td>
      						</tr>
      					</table>
      				</td>
      				<td align="right" width="120" class="navback">	
      					<table width="120" border="0" cellpadding="0" cellspacing="0">
							<tr>
								<td><?php echo '<a class="psf" href="day.php?cal='.$cal.'&amp;getdate='.$getdate.'"><img src="styles/'.$style_sheet.'/day_on.gif" alt="'.$day_view_lang.'" border="0"></a></td>'; ?>
								<td><?php echo '<a class="psf" href="week.php?cal='.$cal.'&amp;getdate='.$getdate.'"><img src="styles/'.$style_sheet.'/week_on.gif" alt="'.$week_view_lang.'" border="0"></a></td>'; ?>
								<td><?php echo '<a class="psf" href="month.php?cal='.$cal.'&amp;getdate='.$getdate.'"><img src="styles/'.$style_sheet.'/month_on.gif" alt="'.$month_view_lang.'" border="0"></a></td>'; ?>
								<td><?php echo '<a class="psf" href="year.php?cal='.$cal.'&amp;getdate='.$getdate.'"><img src="styles/'.$style_sheet.'/year_on.gif" alt="'.$year_view_lang.'" border="0"></a></td>'; ?>
							</tr>
						</table>
					</td>
      			</tr>
      		</table>
		</td>
	</tr>
	<tr>
		<td align="center" valign="top">
			<table width="100%" border="0" cellspacing="1" cellpadding="2" class="monthback">
				<tr>
					<?php
						// loops through 7 times, starts with $week_start_day
						$start_day = strtotime($week_start_day);
						for ($i=0; $i<7; $i++) {
							$day_num = date("w", $start_day);
							$day = $daysofweek_lang[$day_num];
							echo '<td valign="top" width="105" height="12" class="dateback"><center class="V9BOLD">'.$day.'</center></td>';
							$start_day = strtotime("+1 day", $start_day);
						}
					?>	
				</tr>
				<tr>	
				<?php 	 
					$sunday 		= strtotime("$start_month_day");
					$i 				= 0;
					$whole_month 	= TRUE;
					do {
						$day 			= date ("j", $sunday);
						$daylink 		= date ("Ymd", $sunday);
						$check_month 	= date ("m", $sunday);
						if ($check_month != $this_month) {
							$day		= '<font class="G10G">'.$day.'</font>';
							$bgclass	= 'class="monthoff"';
						} else {
							if ($today_today == $daylink) {
								$bgclass = 'class="monthon"';
							} else {
								$bgclass = 'class="monthreg"';
							}
						}
						if ($i == 0) echo '<tr height="105">';
						if (isset($master_array[("$daylink")])) {
							echo '<td valign="top" align="left" '.$bgclass.' width="105" height="105">';
							echo '<div align="right"><font class="G10"><a class="psf" href="day.php?cal='.$cal.'&amp;getdate='.$daylink.'">'.$day.'</a></font></div>';
							echo '<div align="left">';
							if ($master_array[("$daylink")]) {
								foreach ($master_array[("$daylink")] as $event_times) {
									foreach ($event_times as $val) {
										$num_of_events2++;
										if (!isset($val["event_start"])) {
											echo '<div align="center" class="V10">';
											openevent("$calendar_name", "", "", $val, $month_event_lines,
											15,
											"<i>",
											"</i>",
											"psf");
											echo '</div>';
										} else {	
											echo '<div align="left" class="V9">&nbsp;';
											$event_start = @$val["event_start"];
											$event_end   = @$val["event_end"];
											$event_start = date($timeFormat, @strtotime ("$event_start"));
											$start2		 = date($timeFormat_small,@strtotime("$event_start"));
											$event_end   = date($timeFormat, @strtotime ("$event_end"));
											@openevent("$calendar_name",
											"$event_start",
											"$event_end",
											$val,
											$month_event_lines,
											11,
											"$start2 ",
											"",
											"ps3");
											echo '</div>';
										}
									}
								}
							}
							echo '</td>';
						} else {
							echo '<td align="center" valign="top" '.$bgclass.' width="105" height="105">';
							echo '<div align="right"><font class="G10"><a class="psf" href="day.php?cal='.$cal.'&amp;getdate='.$daylink.'">'.$day.'</a></font></div>';
							echo '</td>';
						}
						$sunday = strtotime("+1 day", $sunday); 
						$i++;
						if ($i == 7) { 
							echo '</tr>';
							$i = 0;
							$checkagain = date ("m", $sunday);
							if ($checkagain != $this_month) $whole_month = FALSE;	
						}
					} while ($whole_month == TRUE);
				?>
			</table>
		</td>
	</tr>
</table>
<?php include (BASE.'includes/calendar_nav.php'); ?>
<?php if (($this_months_events == "yes") && ($num_of_events2 > 0)) { ?>	
<br>
			<table width="737" border="0" cellspacing="0" cellpadding="3" class="calborder">
				<tr>
					<td colspan="3" align="center" class="sideback" nowrap><div style="height: 16px;" class="G10BOLD"><?php echo "$this_months_lang"; ?></div></td>
				</tr>
				<?php	
					$first_time = TRUE;
					// Iterate the entire master array
					foreach($master_array as $key => $val) {
						
						// Pull out only this months
						ereg ("([0-9]{6})([0-9]{2})", $key, $regs);
						if ($regs[1] == $parse_month) {
							$dayofmonth = strtotime ($key);
							$dayofmonth = localizeDate ($dateFormat_week_list, $dayofmonth);
							$i = 0;
							if ($today_today == $key) {
								$fontclass="G10BOLD";
							} else {
								$fontclass="G10B";
							}
							
							// Pull out each day
							foreach ($val as $new_val) {
								
								// Pull out each time
								foreach ($new_val as $new_key2 => $new_val2) {
								if ($new_val2["event_text"]) {	
									if (isset($new_val2["event_start"])) {
										$event_start 	= $new_val2["event_start"];
										$event_end 		= $new_val2["event_end"];
										$event_start 	= date ($timeFormat, strtotime ("$event_start"));
										$event_end 		= date ($timeFormat, strtotime ("$event_end"));
										$event_start2	= $event_start;
									} else {
										$event_start = "$all_day_lang";
										$event_start2 = '';
										$event_end = '';													
									}
		
									echo "<tr align=\"left\" valign=\"top\">\n";
									echo "<td width =\"155\" class=\"$fontclass\" nowrap><a class=\"psf\" href=\"day.php?cal=$cal&amp;getdate=$key\">$dayofmonth</a> <font class=\"V9G\">($event_start)</font></td>\n";
									if ($first_time == TRUE) {
										echo "<td width=\"5\" class=\"montheventline\" rowspan=\"$num_of_events2\"></td>";
										$first_time = FALSE;
									}
									echo "<td>\n";
									openevent("$calendar_name",
									"$event_start",
									"$event_end",
									$new_val2,
									0,
									65,
									"<font class=\"G10B\">",
									"</font>",
									"psf");
									echo "</td>\n";
									echo "</tr>\n";
								}

								}
							}
						}
					}
				
				?>
			</table>		
<?php } ?>
</center>
<?php include (BASE.'includes/footer.inc.php'); ?>


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