00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00047 function setNavigation($timestamp,$rowSpan)
00048 {
00049 global $DP_language;
00050
00051 $Gui = new Gui();
00052
00053 $today = mktime(0,0,0);
00054 $lastweek = strtotime ("last week" , $timestamp) ;
00055 $nextweek = strtotime ("+7 days" , $timestamp) ;
00056 $rowSpan = $rowSpan+1;
00057
00058 eval ("\$week_navigation = \"".$Gui->getTemplate("week_navigation")."\";");
00059
00060 Return $week_navigation;
00061
00062 }
00063
00064
00071 function setDateInTblHead($timestamp)
00072 {
00073 $ttd = new TimestampToDate;
00074
00075 $ttd->ttd($timestamp);
00076
00077 $S_Datum[monday_full] = $ttd->shorttime ;
00078 $S_Datum[monday_link] = $timestamp ;
00079 $S_Datum[week] = $ttd->weeknumber;
00080
00081 $ttd->ttd(strtotime ("+1 day" , $timestamp));
00082 $S_Datum[tuesday_full] = $ttd->shorttime ;
00083 $S_Datum[tuesday_link] = strtotime ("+1 day" , $timestamp) ;
00084
00085 $ttd->ttd(strtotime ("+2 day" , $timestamp));
00086 $S_Datum[wednesday_full] = $ttd->shorttime ;
00087 $S_Datum[wednesday_link] = strtotime ("+2 day" , $timestamp) ;
00088
00089 $ttd->ttd(strtotime ("+3 day" , $timestamp));
00090 $S_Datum[thursday_full] = $ttd->shorttime ;
00091 $S_Datum[thursday_link] = strtotime ("+3 day" , $timestamp) ;
00092
00093 $ttd->ttd(strtotime ("+4 day" , $timestamp));
00094 $S_Datum[friday_full] = $ttd->shorttime ;
00095 $S_Datum[friday_link] = strtotime ("+4 day" , $timestamp) ;
00096
00097 $ttd->ttd(strtotime ("+5 day" , $timestamp));
00098 $S_Datum[saturday_full] = $ttd->shorttime ;
00099 $S_Datum[saturday_link] = strtotime ("+5 day" , $timestamp) ;
00100
00101 $ttd->ttd(strtotime ("+6 day" , $timestamp));
00102 $S_Datum[sunday_full] = $ttd->shorttime ;
00103 $S_Datum[sunday_link] = strtotime ("+6 day" , $timestamp) ;
00104
00105 Return $S_Datum;
00106
00107 }
00108
00121 function getContent($begin_ts, $end_ts, $DB)
00122 {
00123
00124 global $DP_UId , $_SESSION ;
00125
00126 $Dates = getDateList ($DP_UId, $begin_ts, $end_ts, $_SESSION[DP_Keywords], $DB);
00127 $WholeDates = getWholeDayDateList ($DP_UId, $begin_ts, $end_ts, $_SESSION[DP_Keywords], $DB);
00128 $DATE[0]=$Dates;
00129 $DATE[1]=$WholeDates;
00130 return $DATE;
00131
00132 }
00133
00146 function setDatesInWeek($date_ts, $Dates, $day_ts, $row_height, &$style)
00147 {
00148
00149 global $DP_language, $DP_CSS, $_SESSION;
00150
00151 $ttd = new TimestampToDate;
00152 $Gui = new Gui();
00153
00154 $datesperhalfhourmax = 4 ;
00155 $shorttextmax = 10;
00156 $today_style = $DP_CSS[tblrow1];
00157
00158 $ttd->ttd($date_ts);
00159 $day = $ttd->day_of_month ;
00160
00161 $week_float = $week_float."<td width=\"11%\" height=\"".$row_height."%\" style=\"border-style: solid; border-width: 1 \" ";
00162
00163
00164 if ($date_ts >= mktime(0,0,0) and $date_ts <= mktime(23,59,59))
00165 {
00166 $week_float = $week_float.$today_style." >";
00167 }
00168 else
00169 {
00170 $week_float = $week_float.$style.">";
00171 }
00172
00173
00174 $datebeginend_ts = strtotime ("+30 minutes", $date_ts);
00175 for ($i=0;$i< count($Dates);$i++)
00176 {
00177 if ($Dates[$i][1] >= $date_ts and $Dates[$i][1] < $datebeginend_ts)
00178 {
00179 $datesperhalfhour++;
00180 $ttd->ttd($Dates[$i][1]);
00181
00182 if (strlen ($Dates[$i][5]) >= $shorttextmax)
00183 {
00184 $shortext = substr($Dates[$i][5], 0, $shorttextmax)." ..";
00185 }
00186 else
00187 {
00188 $shortext = $Dates[$i][5];
00189 }
00190 $starttime = $ttd->hour_long.":".$ttd->minutes ;
00191
00192 $ttd->ttd($Dates[$i][2]);
00193 $endtime = $ttd->hour_long.":".$ttd->minutes ;
00194
00195 $alttag = $starttime." bis ".$endtime." [ ".$Dates[$i][5]." ]";
00196
00197 $text = $Dates[$i][6];
00198 $id = rand(1,100);
00199
00200 if($_SESSION[DP_JSscript] != 1 ) {
00201 $week_float = $week_float."<span ".$DP_CSS[small]."><a TITLE=\"".$alttag."\" href=\"dateplaner.php?app=date×tamp=".$day_ts."&date_id=".$Dates[$i][0]."&PHPSESSID=".session_id()."\" target=\"_blank\">".$starttime." - ".$endtime."</a> <br>".$shortext."</span><br>";
00202 }else {
00203 $week_float = $week_float."<span ".$DP_CSS[small]."><a onMouseOver=show('".$id."') onMouseOut=hide('".$id."') href=\"javascript:popup('dateplaner.php?app=date×tamp=".$day_ts."&date_id=".$Dates[$i][0]."&PHPSESSID=".session_id()."','Date','width=600,height=650,directories=no,toolbar=no,location=no,menubar=no,scrollbars=yes,status=yes,resizable=yes,dependent=no')\" >".$starttime." - ".$endtime."</a> <br>".$shortext."</span><br>";
00204 $week_float.= $Gui->setToolTip($starttime, $endtime, $Dates[$i][5], $text, $id );
00205 }
00206
00207 }
00208
00209 if ($datesperhalfhourmax == $datesperhalfhour)
00210 {
00211 $week_float = $week_float."<span ".$DP_CSS[small]."><a href=\"day.php?timestamp=".$date_ts."\">".$DP_language[more]."</a> </span>";
00212 break ;
00213 }
00214 }
00215
00216 $week_float = $week_float."</td>";
00217
00218 Return $week_float;
00219 }
00220
00233 function setDayDatesInWeek($date_ts, $Dates, $row_height, &$style)
00234 {
00235 global $DP_language, $DP_CSS, $_SESSION;
00236 $ttd = new TimestampToDate;
00237 $Gui = new Gui();
00238
00239 $datesperhalfhourmax = 4 ;
00240 $shorttextmax = 12;
00241
00242 $today_style = $DP_CSS[tblrow1];
00243
00244 $ttd->ttd($date_ts);
00245 $day = $ttd->day_of_month ;
00246
00247 $week_float = $week_float."<td width=\"11%\" height=\"".$row_height."%\" style=\"border-style: solid; border-width: 1 \" ";
00248
00249
00250 if ($date_ts >= mktime(0,0,0) and $date_ts <= mktime(23,59,59))
00251 {
00252 $week_float = $week_float.$today_style." >";
00253 }
00254 else
00255 {
00256 $week_float = $week_float.$style.">";
00257 }
00258
00259
00260 $dayend_ts = strtotime ("+23 hours +59 minutes +59 seconds", $date_ts);
00261 for ($i=0;$i< count($Dates);$i++)
00262 {
00263 if ($Dates[$i][1] >= $date_ts and $Dates[$i][2] <= $dayend_ts)
00264 {
00265 $datesperhalfhour++;
00266 $ttd->ttd($Dates[$i][1]);
00267
00268
00269 if (strlen ($Dates[$i][5]) >= $shorttextmax)
00270 {
00271 $shortext = substr($Dates[$i][5], 0, $shorttextmax)." ..";
00272 }
00273 else
00274 {
00275 $shortext = $Dates[$i][5];
00276 }
00277 $alttag = " [ ".$Dates[$i][5]." ]";
00278
00279 $text = $Dates[$i][6];
00280 $id = rand(100,200);
00281
00282
00283 if($_SESSION[DP_JSscript] != 1 ) {
00284 $week_float = $week_float."<span ".$DP_CSS[small]."><a TITLE=\"".$alttag."\" href=\"dateplaner.php?app=date×tamp=".$day_ts."&date_id=".$Dates[$i][0]."&PHPSESSID=".session_id()."\" target=\"_blank\"><b>".$shortext."</b></a> </span><br>";
00285 }else {
00286 $week_float = $week_float."<span ".$DP_CSS[small]."><a onMouseOver=show('".$id."') onMouseOut=hide('".$id."') href=\"javascript:popup('dateplaner.php?app=date×tamp=".$date_ts."&date_id=".$Dates[$i][0]."&PHPSESSID=".session_id()."','Date','width=600,height=650,directories=no,toolbar=no,location=no,menubar=no,scrollbars=yes,status=yes,resizable=yes,dependent=no')\" ><b>".$shortext."</b></a></span><br>";
00287 $week_float.= $Gui->setToolTip($starttime, $endtime, $Dates[$i][5], $text, $id );
00288 }
00289
00290
00291
00292 }
00293 if ($datesperhalfhourmax == $datesperhalfhour)
00294 {
00295 $week_float = $week_float."<span ".$DP_CSS[small]."><a href=\"day.php?timestamp=".$date_ts."\">".$DP_language[more]."</a> </span>";
00296 break ;
00297 }
00298 }
00299
00300 $week_float = $week_float."</td>";
00301 Return $week_float;
00302 }
00303
00320 function setWeekView($week_ts, $DB)
00321
00322 {
00323 global $DP_language, $DP_CSS, $_SESSION;
00324
00325 srand(microtime()*1000000);
00326
00327
00328
00329 $from_time = $_SESSION[DP_Starttime];
00330 $to_time = $_SESSION[DP_Endtime];
00331
00332 $ttd = new TimestampToDate;
00333
00334 $ttd->ttd($week_ts);
00335
00336
00337 if ($ttd->weekdaynumber != 1 )
00338 {
00339 $week_ts = strtotime ("last Monday", $week_ts );
00340 $ttd->ttd($week_ts);
00341 }
00342
00343 $week_ts = mktime(0,0,0,$ttd->monthnumber,$ttd->day_of_month,$ttd->year_long);
00344 $ttd->ttd($week_ts);
00345
00346
00347 $start_ts = $week_ts;
00348 $end_ts = strtotime ("+6 days 23 hours 59 minutes 59 seconds", $week_ts );
00349 $DATE = getContent($start_ts, $end_ts, $DB);
00350 $Dates = $DATE[0];
00351 $WholeDates = $DATE[1];
00352
00353
00354
00355 if($Dates)
00356 {
00357 for ($i=0;$i< count($Dates);$i++)
00358 {
00359 $ttdend = new TimestampToDate;
00360 $ttdend->ttd($Dates[$i][2]);
00361
00362 $end = $ttdend->hour_long.":".$ttdend->minutes.":".$ttdend->seconds;
00363
00364 $ttd->ttd($Dates[$i][1]);
00365 $begin = $ttd->hour_long.":".$ttd->minutes.":".$ttd->seconds;
00366
00367 if ($ttd->hour_short <= (int)$from_time )
00368 {
00369 $from_time = $ttd->hour_short;
00370 }
00371 if ($ttdend->hour_short >= (int)$to_time)
00372 {
00373 $to_time = $ttdend->hour_short+1;
00374 }
00375 }
00376 }
00377
00378
00379 $rows = (($to_time - $from_time)*2)+1;
00380
00381 $row_height = 100/$rows;
00382
00383 $week_navigation = setNavigation($week_ts,$rows);
00384 $S_Datum = setDateInTblHead($week_ts) ;
00385
00386 $monatstag_ts = $week_ts;
00387 $style = $DP_CSS[tblrow2];
00388
00389
00390 $c_rows = 0;
00391 for ($i=0;$i<=7;$i++)
00392 {
00393
00394 if ($i==0)
00395 {
00396 $week_float = $week_float."<tr >\n";
00397 $week_float = $week_float."<td width=\"4%\" height=\"".$row_height."%\" style=\"border-style: solid; border-width: 1\" $DP_CSS[tblrow2] ><center>".$DP_language[o_day_date]."<center></td>";
00398 }
00399 else
00400 {
00401 $week_float = $week_float.setDayDatesInWeek($monatstag_ts, $WholeDates, $row_height, $style);
00402 $monatstag_ts = strtotime ("+1 day", $monatstag_ts );
00403 }
00404 $ttd->ttd($monatstag_ts);
00405 }
00406
00407 $week_float = $week_float."</tr>\n";
00408 $c_rows++;
00409 $ttd->ttd($week_ts);
00410 $week_ts = mktime($from_time,0,0,$ttd->monthnumber,$ttd->day_of_month,$ttd->year_long);
00411 $monatstag_ts = $week_ts;
00412 $style = $DP_CSS[tblrow2];
00413 $day_ts = mktime(0,0,0,$ttd->monthnumber,$ttd->day_of_month,$ttd->year_long);
00414
00415
00416 while($c_rows < $rows)
00417 {
00418 for ($i=0;$i<=7;$i++)
00419 {
00420 if ($i==0)
00421 {
00422
00423 $time = (($c_rows-1)/2)+$from_time;
00424 if (floor($time)!=0)
00425 {
00426 if (($time/floor($time)) > 1)
00427 {
00428 $time = floor ($time).":30";
00429 }
00430 else
00431 {
00432 $time = $time.":00";
00433 }
00434
00435 }
00436 else
00437 {
00438 if (round ($time)==1)
00439 {
00440 $time = "0:30";
00441 }
00442 else
00443 {
00444 $time = "0:00";
00445 }
00446 }
00447 $week_float = $week_float."<tr >\n";
00448 $week_float = $week_float."<td width=\"4%\" height=\"".$row_height."%\" style=\"border-style: solid; border-width: 1\" $DP_CSS[tblrow2] ><center>".$time."<center></td>";
00449 }
00450 else
00451 {
00452 $week_float = $week_float.setDatesInWeek($monatstag_ts, $Dates, $day_ts, $row_height, $style);
00453 $monatstag_ts = strtotime ("+1 day", $monatstag_ts );
00454
00455 }
00456 $ttd->ttd($monatstag_ts);
00457 $day_ts = mktime(0,0,0,$ttd->monthnumber,$ttd->day_of_month,$ttd->year_long);
00458 }
00459 $week_ts = strtotime ("+30 minutes", $week_ts);
00460 $monatstag_ts = $week_ts ;
00461 $week_float = $week_float."</tr>\n";
00462 $c_rows++;
00463 }
00464 $week_float = $week_float."</tr>\n";
00465
00466 $Return[0] = $week_navigation;
00467 $Return[1] = $week_float;
00468 $Return[2] = $S_Datum;
00469
00470 Return $Return;
00471 }
00472 ?>