00001 <?php 00002 /* 00003 +-----------------------------------------------------------------------------+ 00004 | ILIAS open source | 00005 | Dateplaner Modul | 00006 +-----------------------------------------------------------------------------+ 00007 | Copyright (c) 2004 ILIAS open source & University of Applied Sciences Bremen| 00008 | | 00009 | This program is free software; you can redistribute it and/or | 00010 | modify it under the terms of the GNU General Public License | 00011 | as published by the Free Software Foundation; either version 2 | 00012 | of the License, or (at your option) any later version. | 00013 | | 00014 | This program is distributed in the hope that it will be useful, | 00015 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 00016 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 00017 | GNU General Public License for more details. | 00018 | | 00019 | You should have received a copy of the GNU General Public License | 00020 | along with this program; if not, write to the Free Software | 00021 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 00022 +-----------------------------------------------------------------------------+ 00023 */ 00024 00034 //require('./classes/class.ilMiniCal.php'); 00035 00036 // it is an action required to generate images.. 00037 //if ($_GET[action] == "show") { 00038 00039 // $im = ImageCreate (162, 160) 00040 // or die ("Kann keinen neuen GD-Bild-Stream erzeugen"); 00041 // $im = showMinicalendar($_GET[month],$_GET[year], $im, $_GET[DP_Lang]); 00042 // $CALENDAR = $MiniCal->show($month, $year); 00043 // Ilias3 + GD >1.6.1 00044 // ImagePNG($im); 00045 00046 // Ilias2 + GD <1.6.1 00047 //ImageGif($im); 00048 00049 //} 00050 00051 00052 00061 // 00062 //include ('./classes/class.ilMiniCal.php'); 00063 00064 function showMinicalendar($month,$year, $im, $DP_Lang) 00065 { 00066 00067 /* 00068 //language 00069 if(file_exists('../lang/dp_'.$DP_Lang.'.lang')) //checks whether lang-file exists; if not english is used as fallback solution 00070 { 00071 00072 $z = 0; 00073 $test = $DP_language; 00074 $array_tmp = @file('../lang/dp_'.$DP_Lang.'.lang'); 00075 foreach($array_tmp as $v) 00076 { 00077 if ((substr(trim($v),0,13)=='dateplaner#:#') && (substr_count($v,'#:#')>=2)) 00078 {//Line mustn't start with a ';' and must contain at least one '=' symbol. 00079 $z++; 00080 $pos = strpos($v, '#:#', '13'); 00081 $offset1 = strpos($v, '#:#', '13')-13; 00082 $offset2 = strpos($v, '###', '13')-$offset1-16; 00083 if($offset2 != (-$offset1-16)) 00084 { 00085 $DP_language[trim(substr($v,13,$offset1))] = trim(substr($v, $pos+3,$offset2)); 00086 } 00087 else 00088 { 00089 $DP_language[trim(substr($v,13,$offset1))] = trim(substr($v, $pos+3)); 00090 } 00091 } 00092 00093 } 00094 00095 } 00096 else 00097 { 00098 $DP_Lang = "en"; 00099 $array_tmp = @file('../lang/dp_'.$DP_Lang.'.lang'); 00100 foreach($array_tmp as $v) 00101 { 00102 if ((substr(trim($v),0,13)=='dateplaner#:#') && (substr_count($v,'#:#')>=2)) 00103 {//Line mustn't start with a ';' and must contain at least one '=' symbol. 00104 $pos = strpos($v, '#:#', '13'); 00105 $offset1 = strpos($v, '#:#', '13')-13; 00106 $offset2 = strpos($v, '###', '13')-$offset1-16; 00107 if($offset2 != (-$offset1-16)) 00108 { 00109 $DP_language[trim(substr($v,13,$offset1))] = trim(substr($v, $pos+3,$offset2)); 00110 } 00111 else 00112 { 00113 $DP_language[trim(substr($v,13,$offset1))] = trim(substr($v, $pos+3)); 00114 } 00115 } 00116 } 00117 } 00118 00119 00120 if(!$month || !$year) 00121 { 00122 $month = date(m); 00123 $year = date(Y); 00124 } 00125 00126 //Wieviele Tage hat der vorherige month 00127 $lastday = strftime("%d.", mktime (0,0,0,$month,0,$year)); 00128 //Welcher Wochentag ist der 1. des Monats 00129 $firstday = strftime ("%u", mktime(0,0,0,$month,1,$year))-2; 00130 if ($firstday == -1) $firstday = 6; 00131 $startday = $lastday - $firstday; 00132 00133 $Tagesnamen = array($DP_language[wk_short], $DP_language[Mo_short], $DP_language[Tu_short], $DP_language[We_short], $DP_language[Th_short], $DP_language[Fr_short], $DP_language[Sa_short], $DP_language[Su_short]); 00134 $Monatabk = array("", $DP_language[short_01], $DP_language[short_02], $DP_language[short_03], $DP_language[short_04], $DP_language[short_05], $DP_language[short_06], $DP_language[short_07], $DP_language[short_08], $DP_language[short_09], $DP_language[short_10], $DP_language[short_11], $DP_language[short_12]); 00135 00136 00137 ImageColorAllocate ($im, 144, 144, 144); 00138 $color[1] = ImageColorAllocate ($im,0,0,0); //schwarz 00139 $color[2] = ImageColorAllocate ($im,144,144,144); //blau 00140 $color[3] = ImageColorAllocate ($im,43,43,43); // dunkelblau 00141 $color[4] = ImageColorAllocate ($im,255,255,255); //weiss 00142 $color[5] = ImageColorAllocate ($im,200,200,200); //hellblau 00143 $color[6] = ImageColorAllocate ($im,0,255,0); //ausblenden hellblau 00144 $color[7] = ImageColorAllocate ($im,255,200,150); //rot 00145 00146 imagefilledrectangle ($im, 1, 49, 160, 65, $color[3]); 00147 imagefilledrectangle ($im, 1, 66, 20, 158, $color[3]); 00148 00149 //ANZEIGE DES jahres und dessen navigation 00150 imagerectangle ($im, 10, 2, 25, 17, $color[4]); 00151 imagerectangle ($im, 135, 2, 150, 17, $color[4]); 00152 ImageString ($im, 5, 64, 2, $year, $color[4]); 00153 $points = array("20","6","20","12","15","9"); 00154 imagefilledpolygon ($im, $points, 3, $color[4]); 00155 $points = array("140","6","140","12","145","9"); 00156 imagefilledpolygon ($im, $points, 3, $color[4]); 00157 00158 //Anzeige des monats und der navigation 00159 imageline ( $im, 2, 20 ,158 ,20 , $color[3]); 00160 imageline ( $im, 2, 33 ,158 ,33 , $color[3]); 00161 imageline ( $im, 2, 47 ,158 ,47 , $color[3]); 00162 imageline ( $im, 2, 20 ,2 ,47 , $color[3]); 00163 imageline ( $im, 158, 20 ,158 ,47 , $color[3]); 00164 00165 imageline ( $im, 27, 20 ,27 ,47 , $color[3]); 00166 imageline ( $im, 54, 20 ,54 ,47 , $color[3]); 00167 imageline ( $im, 79, 20 ,79 ,47 , $color[3]); 00168 imageline ( $im, 105, 20 ,105 ,47 , $color[3]); 00169 imageline ( $im, 131, 20 ,131 ,47 , $color[3]); 00170 00171 $c0 = 1; 00172 for($y = 20; $y <= 40; $y = $y+13) 00173 { 00174 for($x = 5; $x <= 137; $x = $x+26) 00175 { 00176 if($month == $c0) 00177 { 00178 $c1=4; 00179 } 00180 else 00181 { 00182 $c1=3; 00183 } 00184 ImageString ($im, 3, $x, $y, $Monatabk[$c0++], $color[$c1]); 00185 } 00186 } 00187 00188 //Kalenderwoche 00189 $kw=strftime ("%V", mktime(0,0,0,$month,1,$year)); 00190 if (date("w",mktime(0,0,0,$month,1,$year))==1) 00191 { 00192 $kw = $kw-1; 00193 } 00194 else 00195 { 00196 $kw = $kw+0; 00197 } 00198 for($y = 66; $y <= 145; $y = $y+15) 00199 { 00200 ImageString ($im, 3, 4, $y, $kw++, $color[2]); 00201 } 00202 00203 //Wochentage MO DI MI... 00204 $c0 = 0; 00205 for($x = 5; $x <= 145; $x = $x+20) 00206 { 00207 ImageString ($im, 3, $x, 50, $Tagesnamen[$c0++], $color[5]); 00208 } 00209 00210 //Tage des Monats, bzw. der Tagesnummern 00211 $c0 = 3; 00212 for($y = 66; $y <= 145; $y = $y+15) 00213 { 00214 for($x = 25; $x <= 145; $x = $x+20) 00215 { 00216 if($startday > $lastday) 00217 { 00218 if ($c0 == 5) 00219 { 00220 $c0 = 3; 00221 } 00222 else 00223 { 00224 $c0 = 5; 00225 } 00226 $startday = 1; 00227 $monat1 = $month; 00228 $jahr1 = $year; 00229 if($month == 12) 00230 { 00231 $monat1 = 0; 00232 $jahr1 = $year + 1; 00233 } 00234 $lastday = strftime("%d.", mktime (0,0,0,$monat1+1,0,$jahr1)); 00235 //Pr�fung, ob Schaltjahr 00236 if($lastday == 29 && !date(L, mktime (0,0,0,$monat1+1,0,$jahr1))) $lastday = 28; 00237 } 00238 if($c0 == 5 && $startday == $tag) 00239 { 00240 imagefilledrectangle ($im, $x-2, $y, $x+14, $y+13, $color[3]); 00241 if($startday == date("d")&& $year == date("Y") && $month == date("n")) 00242 { 00243 ImageString ($im, 3, $x, $y, $startday++ , $color[7]); 00244 } 00245 else 00246 { 00247 ImageString ($im, 3, $x, $y, $startday++ , $color[4]); 00248 } 00249 } 00250 else if($c0 == 5 && $startday == date("d") && $year == date("Y") && $month == date("n")) 00251 { 00252 ImageString ($im, 3, $x, $y, $startday++ , $color[7]); 00253 } 00254 else 00255 { 00256 ImageString ($im, 3, $x, $y, $startday++ , $color[$c0]); 00257 } 00258 } 00259 } 00260 00261 return $im; 00262 */ 00263 } // end func 00264 00265 00273 function setMinicalendar($month, $year, $DP_Lang, $app) 00274 { 00275 /* 00276 00277 if(!$month || !$year) 00278 { 00279 $month = date(m); 00280 $year = date(Y); 00281 } 00282 00283 00284 $lastday = strftime("%d", mktime (0,0,0,$month,0,$year)); 00285 $firstday = strftime ("%u", mktime(0,0,0,$month,1,$year))-2; 00286 00287 if ($firstday == -1) $firstday = 6; 00288 00289 $startday = $lastday - $firstday; 00290 00291 // generiere Bildmaps 00292 $minical_show = " 00293 <map name='Calendar'>"; 00294 00295 //Kalenderwoche 00296 $kw=strftime ("%V", mktime(0,0,0,$month,1,$year)); 00297 $week_ts=mktime (0,0,0,$month,1,$year); 00298 if (date("w",$week_ts)==1) 00299 { 00300 $week_ts = strtotime ("-1 week", $week_ts ); 00301 } 00302 $x = 4; 00303 for($y = 66; $y <= 145; $y = $y+15) 00304 { 00305 $x1 = $x + 15; 00306 $y1 = $y + 15; 00307 $minical_show = $minical_show. " 00308 <area shape=rect coords='$x,$y,$x1,$y1' href='dateplaner.php?app=week×tamp=$week_ts'>"; 00309 $week_ts= strtotime ("+1 week", $week_ts ); 00310 } 00311 00312 00313 $c0 = false; 00314 for($y = 66; $y <= 145; $y = $y+15) 00315 { 00316 for($x = 25; $x <= 145; $x = $x+20) 00317 { 00318 if($startday > $lastday || $startday == 1) 00319 { 00320 if ($c0 == true) 00321 { 00322 $c0 = false; 00323 } 00324 else 00325 { 00326 $c0 = true; 00327 } 00328 $startday = 1; 00329 $monat1 = $month; 00330 $jahr1 = $year; 00331 if($month == 12) 00332 { 00333 $monat1 = 0; 00334 $jahr1 = $year + 1; 00335 } 00336 $monat1 = $month+1; 00337 $lastday = strftime("%d.", mktime (0,0,0,$monat1,0,$jahr1)); 00338 } 00339 if($c0) 00340 { 00341 $x1 = $x + 15; 00342 $y1 = $y + 15; 00343 $day_ts=mktime (0,0,0,$month,$startday,$year); 00344 $minical_show = $minical_show. " 00345 <area shape=rect coords='$x,$y,$x1,$y1' href='dateplaner.php?app=day×tamp=$day_ts'>"; 00346 } 00347 $startday++; 00348 } 00349 } 00350 00351 //Monatsnavigation 00352 $c0 = 1; 00353 for($y = 20; $y <= 40; $y = $y+13) 00354 { 00355 for($x = 5; $x <= 137; $x = $x+26) 00356 { 00357 $x1 = $x + 20; 00358 $y1 = $y + 10; 00359 $month_ts=mktime (0,0,0,$c0,1,$year); 00360 $minical_show = $minical_show. " 00361 <area shape=rect coords='$x,$y,$x1,$y1' href='dateplaner.php?app=$app&month=$c0&year=$year×tamp=$month_ts'>"; 00362 $c0++; 00363 } 00364 } 00365 $minical_show = $minical_show. " 00366 <area shape=rect coords='10,2,25,17' href='dateplaner.php?app=$app&month=$month&year=$year&action=last'> 00367 <area shape=rect coords='135,2,150,17' href='dateplaner.php?app=$app&month=$month&year=$year&action=next'> 00368 </map> 00369 00370 <img src='.".DATEPLANER_ROOT_DIR."/includes/inc.minicalendar.php?action=show&month=".$month."&year=".$year."&DP_Lang=".$DP_Lang."' usemap='#Calendar' border=0> 00371 "; 00372 return $minical_show; 00373 */ 00374 } // end func 00375 ?>
1.7.1