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
00044 function setNavigation($timestamp)
00045
00046 {
00047
00048 global $DP_language;
00049
00050 $Gui = new Gui();
00051 $ttd = new TimestampToDate;
00052 $rowSpan = 6;
00053
00054 $ttd->ttd($timestamp);
00055 $today = mktime(0,0,0);
00056 $lastweek = strtotime ("last week" , $timestamp) ;
00057 $nextweek = strtotime ("+7 days" , $timestamp) ;
00058
00059 $monthnumber = $ttd->monthnumber;
00060 $jahreszahl = $ttd->year_long;
00061 $timestamp = mktime(0,0,0,$monthnumber,1,$jahreszahl);
00062 $lastmonth = strtotime ("last month", $timestamp) ;
00063 $nextmonth = strtotime ("+1 month", $timestamp) ;
00064 $lastyear = strtotime ("last year" , $timestamp) ;
00065 $nextyear = strtotime ("+1 year" , $timestamp) ;
00066
00067 eval ("\$month_navigation = \"".$Gui->gettemplate("month_navigation")."\";");
00068
00069 Return $month_navigation;
00070
00071 }
00072
00079 function getDayInWeek($week_ts)
00080 {
00081
00082 $ttd = new TimestampToDate;
00083 $ttd->ttd($week_ts);
00084
00085 $daynumber = $ttd->weekdaynumber ;
00086
00087
00088
00089 if ($daynumber==0) {
00090 $daynumber=7;
00091 }
00092
00093 return $daynumber;
00094 }
00095
00096
00109 function getContent($start_ts, $end_ts, $DB)
00110
00111 {
00112 global $DP_UId , $_SESSION ;
00113
00114 $Dates = getDateList ($DP_UId, $start_ts, $end_ts, $_SESSION[DP_Keywords], $DB);
00115 $WholeDates = getWholeDayDateList ($DP_UId, $start_ts, $end_ts, $_SESSION[DP_Keywords], $DB);
00116 $DATE[0]=$Dates;
00117 $DATE[1]=$WholeDates;
00118
00119 return $DATE;
00120 }
00121
00136 function setDaysInMonth($dayinmonth_ts, $DATE, &$style)
00137
00138 {
00139 global $DP_language, $DP_CSS, $templatefolder, $actualtemplate, $_SESSION;
00140
00141 $ttd = new TimestampToDate;
00142 $Gui = new Gui();
00143 $Dates = $DATE[0];
00144 $WholeDates = $DATE[1];
00145
00146 $ttd->ttd($dayinmonth_ts);
00147
00148
00149 if($_SESSION[DP_ScreenWith] == "" or !$_SESSION[DP_ScreenWith]) {
00150 $DP_ScreenHeight = "768";
00151 $DP_ScreenWith = "1024" ;
00152 }else {
00153 $DP_ScreenHeight = $_SESSION[DP_ScreenHeight];
00154 $DP_ScreenWith = $_SESSION[DP_ScreenWith] ;
00155 }
00156
00157
00158 $day = $ttd->day_of_month ;
00159 if ("01" == $day)
00160 {
00161 if ($style == $DP_CSS[tblrow1])
00162 {
00163 $style = $DP_CSS[tblrow2];
00164 }
00165 else
00166 {
00167 $style = $DP_CSS[tblrow1];
00168 }
00169 }
00170
00171
00172
00173 if (!$DP_ScreenHeight)
00174 {
00175 $height ="15%" ;
00176 }
00177 else
00178 {
00179 $height=(15*($DP_ScreenHeight - 150))/100 ;
00180 }
00181
00182 if (!$DP_ScreenWith)
00183 {
00184 $shorttextmax2 = 9;
00185 $shorttextmax = 5;
00186 $width ="13%" ;
00187 }
00188 else
00189 {
00190
00191 $width=(13*($DP_ScreenWith - 180))/100 ;
00192
00193 switch ($DP_ScreenWith)
00194 {
00195 case '800':
00196 $datesperdaymax = 2 ;
00197 $shorttextmax = 1 ;
00198 $shorttextmax2 = 4 ;
00199 break;
00200 case '1024':
00201 $datesperdaymax = 4 ;
00202 $shorttextmax = 3 ;
00203 $shorttextmax2 = 9 ;
00204 break;
00205 case '1280':
00206 $datesperdaymax = 6 ;
00207 $shorttextmax = 8 ;
00208 $shorttextmax2 = 14;
00209 break;
00210 case '1600':
00211 $datesperdaymax = 8 ;
00212 $shorttextmax = 13;
00213 $shorttextmax2 = 18;
00214 break;
00215 default :
00216 $datesperdaymax = 4 ;
00217 $shorttextmax = 3 ;
00218 $shorttextmax2 = 9 ;
00219 }
00220 }
00221
00222 $month_float = $month_float."<td width=\"".$width."\" height=\"".$height."\" valign=\"top\" style=\"border-style: solid; border-width: 1; background-image:url(.".DATEPLANER_ROOT_DIR.$templatefolder."/".$actualtemplate."/images/".$day.".gif); background-repeat:no-repeat ; background-position:center center \" ";
00223
00224
00225 if ($dayinmonth_ts >= mktime(0,0,0) and $dayinmonth_ts <= mktime(23,59,59))
00226 {
00227 $month_float = $month_float."$DP_CSS[tblrow1] >";
00228 $month_float = $month_float."
00229 <table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" style=\"border-collapse: collapse\" width=\"100%\" height=\"100%\">
00230 ";
00231 }
00232 else
00233 {
00234 $month_float = $month_float.$style.">";
00235 $month_float = $month_float."
00236 <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" width=\"100%\" height=\"100%\">
00237 ";
00238 }
00239
00240
00241 if ("01" == $day)
00242 {
00243 $month_float = $month_float."
00244 <tr>
00245 <td height=\"8\" style=\"border-style: solid; border-width: 1\" $DP_CSS[tblheader] ><center><span $DP_CSS[small]>$ttd->monthname</span></center></td>
00246 </tr>
00247 ";
00248 }
00249
00250 $month_float = $month_float.'
00251 <tr>
00252 <td height="*" valign="top">
00253 ';
00254
00255
00256 $endofday_ts = mktime(23,59,59,$ttd->monthnumber,$ttd->day_of_month,$ttd->year_long);
00257
00258
00259 if($WholeDates)
00260 {
00261 for ($i=0;$i<count($WholeDates);$i++)
00262 {
00263 if ($WholeDates[$i][1] >= $dayinmonth_ts and $WholeDates[$i][1] <= $endofday_ts)
00264 {
00265 $datesperday++;
00266 $ttd->ttd($WholeDates[$i][1]);
00267
00268
00269 if (strlen ($WholeDates[$i][5]) >= $shorttextmax2)
00270 {
00271 $shortext = substr($WholeDates[$i][5], 0, $shorttextmax2)." .";
00272 }
00273 else
00274 {
00275 $shortext = $WholeDates[$i][5];
00276 }
00277 $alttag = $WholeDates[$i][5];
00278
00279 $text = $Dates[$i][6];
00280 $id = rand(1,100);
00281
00282
00283 if($_SESSION[DP_JSscript] != 1) {
00284 $month_float = $month_float."<span ".$DP_CSS[small]."><a TITLE=\"".$alttag."\" href=\"dateplaner.php?app=date×tamp=".$dayinmonth_ts."&date_id=".$WholeDates[$i][0]."&PHPSESSID=".session_id()."\" target=\"_blank\" >".$shortext."</a> </span><br>";
00285 }else {
00286 $month_float = $month_float."<span ".$DP_CSS[small]."><a onMouseOver=show('".$id."') onMouseOut=hide('".$id."') href=\"javascript:popup('dateplaner.php?app=date×tamp=".$dayinmonth_ts."&date_id=".$WholeDates[$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')\" >".$shortext."</a> </span><br>";
00287 $month_float.= $Gui->setToolTip($starttime, $endtime, $Dates[$i][5], $text, $id );
00288 }
00289
00290
00291
00292 }
00293 if ($datesperdaymax == $datesperday)
00294 {
00295 $month_float = $month_float."<span ".$DP_CSS[small]."><a href=\"dateplaner.php?app=day×tamp=".$dayinmonth_ts."\">".$DP_language[more]."</a> </span>";
00296 break ;
00297 }
00298 }
00299 }
00300
00301
00302 if($Dates)
00303 {
00304 for ($i=0;$i<count($Dates);$i++)
00305 {
00306 if ($Dates[$i][1] >= $dayinmonth_ts and $Dates[$i][1] <= $endofday_ts)
00307 {
00308 $datesperday++;
00309 $ttd->ttd($Dates[$i][1]);
00310
00311
00312 if (strlen ($Dates[$i][5]) >= $shorttextmax)
00313 {
00314 $shortext = substr($Dates[$i][5], 0, $shorttextmax)." ..";
00315
00316 }
00317 else
00318 {
00319 $shortext = $Dates[$i][5];
00320 }
00321 $text = $Dates[$i][6];
00322 $id = rand(101,200);
00323 $starttime = $ttd->hour_long.":".$ttd->minutes ;
00324 $ttd->ttd($Dates[$i][2]);
00325 $endtime = $ttd->hour_long.":".$ttd->minutes ;
00326 $alttag = $starttime." ".$DP_language[to]." ".$endtime." [ ".$Dates[$i][5]." ]";
00327
00328 if($_SESSION[DP_JSscript] != 1) {
00329 $month_float = $month_float."<span ".$DP_CSS[small]."><a TITLE=\"".$alttag."\" href=\"dateplaner.php?app=date×tamp=".$dayinmonth_ts."&date_id=".$Dates[$i][0]."&PHPSESSID=".session_id()."\" target=\"_blank\" >".$starttime."</a> - ".$shortext."</a> </span><br>";
00330 }else {
00331 $month_float = $month_float."<span ".$DP_CSS[small]."><a onMouseOver=show('".$id."') onMouseOut=hide('".$id."') href=\"javascript:popup('dateplaner.php?app=date×tamp=".$dayinmonth_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."</a> - ".$shortext." </span><br>";
00332 $month_float.= $Gui->setToolTip($starttime, $endtime, $Dates[$i][5], $text, $id );
00333 }
00334
00335 }
00336 if ($datesperdaymax == $datesperday) {
00337
00338 $month_float = $month_float."<span ".$DP_CSS[small]."><a href=\"dateplaner.php?app=day×tamp=".$dayinmonth_ts."\">".$DP_language[more]."</a> </span>";
00339 break ;
00340 }
00341 }
00342 }
00343
00344
00345
00346 $month_float = $month_float."
00347 </center></strong>
00348 </td>
00349 </tr>
00350 <tr>
00351 <td height=\"8\">
00352 <a href=\"javascript:popup('dateplaner.php?app=date×tamp=".$dayinmonth_ts."&PHPSESSID=$PHPSESSID','Date','width=600,height=650,directories=no,toolbar=no,location=no,menubar=no,scrollbars=yes,status=yes,resizable=yes,dependent=no')\" TITLE=\"".$DP_language[new_doc]."\" ".$DP_CSS[navi_new]." >
00353 <img border='0' src='.".DATEPLANER_ROOT_DIR.$templatefolder."/".$actualtemplate."/images/blind_1515.gif' width='15' height='15' align='left' hspace='0'>
00354 </a>
00355 <a href=\"dateplaner.php?app=day×tamp=".$dayinmonth_ts."\" TITLE=\"".$DP_language[open_day]."\" ".$DP_CSS[navi_open].">
00356 <img border='0' src='.".DATEPLANER_ROOT_DIR.$templatefolder."/".$actualtemplate."/images/blind_1515.gif' width='15' height='15' align='left' space='0'>
00357 </a>
00358 </td>
00359 </tr>
00360 </table>
00361 ";
00362 $month_float = $month_float."</td>";
00363
00364 Return $month_float;
00365
00366 }
00367
00368
00369
00386 function setMonthView($week_ts, $week_s, $first_change, $DB)
00387 {
00388
00389 global $DP_CSS ;
00390 srand(microtime()*1000000);
00391
00392 $ttd = new TimestampToDate;
00393 $ttd->ttd($week_ts);
00394 $weeknumber = $ttd->weeknumber;
00395 $monthnumber = $ttd->monthnumber;
00396 $jahreszahl = $ttd->year_long;
00397 $firstDayInMonth_ts = mktime(0,0,0,$monthnumber,1,$jahreszahl);
00398 $month_string = $ttd->monthname." ".$ttd->year_long;
00399
00400
00401
00402 if (($ttd->anzahl_der_tage >= 30 and getDayInWeek($firstDayInMonth_ts) == 7) or
00403 ($ttd->anzahl_der_tage >= 31 and getDayInWeek($firstDayInMonth_ts) >= 6))
00404 {
00405 $weeks = 6;
00406 }
00407 else
00408 {
00409 $weeks = 5;
00410 }
00411
00412
00413
00414 if ($first_change) {
00415 $month_navigation = setNavigation($firstDayInMonth_ts);
00416 }else {
00417 $month_navigation = setNavigation($week_ts);
00418 }
00419
00420 $ttd->ttd($week_ts);
00421
00422
00423 if ($ttd->weekdaynumber != 1 ) {
00424 $week_ts = strtotime ("last Monday", $week_ts );
00425 $ttd->ttd($week_ts);
00426
00427 $week_ts = mktime(0,0,0,$ttd->monthnumber,$ttd->day_of_month,$ttd->year_long);
00428 $ttd->ttd($week_ts);
00429 }
00430
00431
00432
00433 if (!$week_s)
00434 {
00435 $ttd->ttd($firstDayInMonth_ts);
00436
00437 if ($ttd->weekdaynumber != 1 )
00438 {
00439 $mondaybefore_ts = strtotime ("last Monday", $firstDayInMonth_ts );
00440 }
00441 else
00442 {
00443 $mondaybefore_ts = $firstDayInMonth_ts;
00444 }
00445 }
00446 else
00447 {
00448 $mondaybefore_ts = $week_ts;
00449 }
00450
00451
00452 $ttd->ttd($mondaybefore_ts);
00453 $weeknumber = $ttd->weeknumber;
00454
00455 $dayinmonth_ts = $mondaybefore_ts ;
00456 $style = $DP_CSS[tblrow1];
00457
00458
00459
00460 $start_ts = $dayinmonth_ts;
00461 $end_ts = strtotime ("+".$weeks." week", $week_ts );
00462 $DATE = getContent($start_ts, $end_ts, $DB);
00463
00464
00465
00466 while($weeks > 0)
00467 {
00468 for ($i=0;$i<=7;$i++)
00469 {
00470 if ($i==0)
00471 {
00472 $month_float = $month_float."<tr>\n";
00473 $month_float = $month_float."<td width=\"4%\" style=\"border-style: solid; border-width: 1\" $DP_CSS[tblrow2] ><center><a href=\"dateplaner.php?app=week×tamp=".$dayinmonth_ts."\">".$weeknumber."</a><center></td>";
00474 }
00475 else
00476 {
00477 $month_float = $month_float.setDaysInMonth($dayinmonth_ts, $DATE, $style);
00478 $dayinmonth_ts = strtotime ("+1 day", $dayinmonth_ts );
00479 }
00480 $ttd->ttd($dayinmonth_ts);
00481 }
00482 $weeknumber = $ttd->weeknumber;
00483 $month_float = $month_float."</tr>\n";
00484 $weeks--;
00485 }
00486 $month_float = $month_float."</tr>\n";
00487
00488 $Return[0] = $month_navigation;
00489 $Return[1] = $month_float;
00490 $Return[2] = $month_string;
00491
00492 Return $Return;
00493
00494 }
00495 ?>