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
00039
00040 if ($_GET[action] == "show") {
00041 $im = ImageCreate (162, 160)
00042 or die ("Kann keinen neuen GD-Bild-Stream erzeugen");
00043 $im = showMinicalendar($_GET[month],$_GET[year], $im, $_GET[DP_Lang]);
00044
00045 ImagePNG($im);
00046
00047
00048
00049
00050 }
00051
00052
00053
00062 function showMinicalendar($month,$year, $im, $DP_Lang)
00063 {
00064
00065
00066 $array_tmp = @file('../lang/dp_'.$DP_Lang.'.lang');
00067 foreach($array_tmp as $v)
00068 {
00069 if ((substr(trim($v),0,13)=='dateplaner#:#') && (substr_count($v,'#:#')>=2))
00070 {
00071 $pos = strpos($v, '#:#', '13');
00072 $offset1 = strpos($v, '#:#', '13')-13;
00073 $offset2 = strpos($v, '###', '13')-$offset1-16;
00074 if($offset2 != (-$offset1-16)) {
00075 $DP_language[trim(substr($v,13,$offset1))] = trim(substr($v, $pos+3,$offset2));
00076 }
00077 else {
00078 $DP_language[trim(substr($v,13,$offset1))] = trim(substr($v, $pos+3));
00079 }
00080 }
00081 }
00082
00083 if(!$month || !$year)
00084 {
00085 $month = date(m);
00086 $year = date(Y);
00087 }
00088
00089
00090 $lastday = strftime("%d.", mktime (0,0,0,$month,0,$year));
00091
00092 $firstday = strftime ("%u", mktime(0,0,0,$month,1,$year))-2;
00093 if ($firstday == -1) $firstday = 6;
00094 $startday = $lastday - $firstday;
00095
00096 $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]);
00097 $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]);
00098
00099 ImageColorAllocate ($im, 144, 144, 144);
00100 $color[1] = ImageColorAllocate ($im,0,0,0);
00101 $color[2] = ImageColorAllocate ($im,144,144,144);
00102 $color[3] = ImageColorAllocate ($im,43,43,43);
00103 $color[4] = ImageColorAllocate ($im,255,255,255);
00104 $color[5] = ImageColorAllocate ($im,200,200,200);
00105 $color[6] = ImageColorAllocate ($im,0,255,0);
00106 $color[7] = ImageColorAllocate ($im,255,200,150);
00107
00108 imagefilledrectangle ($im, 1, 49, 160, 65, $color[3]);
00109 imagefilledrectangle ($im, 1, 66, 20, 158, $color[3]);
00110
00111
00112 imagerectangle ($im, 10, 2, 25, 17, $color[4]);
00113 imagerectangle ($im, 135, 2, 150, 17, $color[4]);
00114 ImageString ($im, 5, 64, 2, $year, $color[4]);
00115 $points = array("20","6","20","12","15","9");
00116 imagefilledpolygon ($im, $points, 3, $color[4]);
00117 $points = array("140","6","140","12","145","9");
00118 imagefilledpolygon ($im, $points, 3, $color[4]);
00119
00120
00121 imageline ( $im, 2, 20 ,158 ,20 , $color[3]);
00122 imageline ( $im, 2, 33 ,158 ,33 , $color[3]);
00123 imageline ( $im, 2, 47 ,158 ,47 , $color[3]);
00124 imageline ( $im, 2, 20 ,2 ,47 , $color[3]);
00125 imageline ( $im, 158, 20 ,158 ,47 , $color[3]);
00126
00127 imageline ( $im, 27, 20 ,27 ,47 , $color[3]);
00128 imageline ( $im, 54, 20 ,54 ,47 , $color[3]);
00129 imageline ( $im, 79, 20 ,79 ,47 , $color[3]);
00130 imageline ( $im, 105, 20 ,105 ,47 , $color[3]);
00131 imageline ( $im, 131, 20 ,131 ,47 , $color[3]);
00132
00133 $c0 = 1;
00134 for($y = 20; $y <= 40; $y = $y+13)
00135 {
00136 for($x = 5; $x <= 137; $x = $x+26)
00137 {
00138 if($month == $c0)
00139 {
00140 $c1=4;
00141 }
00142 else
00143 {
00144 $c1=3;
00145 }
00146 ImageString ($im, 3, $x, $y, $Monatabk[$c0++], $color[$c1]);
00147 }
00148 }
00149
00150
00151 $kw=strftime ("%V", mktime(0,0,0,$month,1,$year));
00152 if (date("w",mktime(0,0,0,$month,1,$year))==1)
00153 {
00154 $kw = $kw-1;
00155 }
00156 else
00157 {
00158 $kw = $kw+0;
00159 }
00160 for($y = 66; $y <= 145; $y = $y+15)
00161 {
00162 ImageString ($im, 3, 4, $y, $kw++, $color[2]);
00163 }
00164
00165
00166 $c0 = 0;
00167 for($x = 5; $x <= 145; $x = $x+20)
00168 {
00169 ImageString ($im, 3, $x, 50, $Tagesnamen[$c0++], $color[5]);
00170 }
00171
00172
00173 $c0 = 3;
00174 for($y = 66; $y <= 145; $y = $y+15)
00175 {
00176 for($x = 25; $x <= 145; $x = $x+20)
00177 {
00178 if($startday > $lastday)
00179 {
00180 if ($c0 == 5)
00181 {
00182 $c0 = 3;
00183 }
00184 else
00185 {
00186 $c0 = 5;
00187 }
00188 $startday = 1;
00189 $monat1 = $month;
00190 $jahr1 = $year;
00191 if($month == 12)
00192 {
00193 $monat1 = 0;
00194 $jahr1 = $year + 1;
00195 }
00196 $lastday = strftime("%d.", mktime (0,0,0,$monat1+1,0,$jahr1));
00197
00198 if($lastday == 29 && !date(L, mktime (0,0,0,$monat1+1,0,$jahr1))) $lastday = 28;
00199 }
00200 if($c0 == 5 && $startday == $tag)
00201 {
00202 imagefilledrectangle ($im, $x-2, $y, $x+14, $y+13, $color[3]);
00203 if($startday == date("d")&& $year == date("Y") && $month == date("n"))
00204 {
00205 ImageString ($im, 3, $x, $y, $startday++ , $color[7]);
00206 }
00207 else
00208 {
00209 ImageString ($im, 3, $x, $y, $startday++ , $color[4]);
00210 }
00211 }
00212 else if($c0 == 5 && $startday == date("d") && $year == date("Y") && $month == date("n"))
00213 {
00214 ImageString ($im, 3, $x, $y, $startday++ , $color[7]);
00215 }
00216 else
00217 {
00218 ImageString ($im, 3, $x, $y, $startday++ , $color[$c0]);
00219 }
00220 }
00221 }
00222
00223 return $im;
00224 }
00225
00226
00233 function setMinicalendar($month, $year, $DP_Lang, $app)
00234 {
00235
00236
00237 if(!$month || !$year)
00238 {
00239 $month = date(m);
00240 $year = date(Y);
00241 }
00242
00243
00244 $lastday = strftime("%d.", mktime (0,0,0,$month,0,$year));
00245 $firstday = strftime ("%u", mktime(0,0,0,$month,1,$year))-2;
00246
00247 if ($firstday == -1) $firstday = 6;
00248
00249 $startday = $lastday - $firstday;
00250
00251
00252 $minical_show = "
00253 <map name='Calendar'>";
00254
00255
00256 $kw=strftime ("%V", mktime(0,0,0,$month,1,$year));
00257 $week_ts=mktime (0,0,0,$month,1,$year);
00258 if (date("w",$week_ts)==1)
00259 {
00260 $week_ts = strtotime ("-1 week", $week_ts );
00261 }
00262 $x = 4;
00263 for($y = 66; $y <= 145; $y = $y+15)
00264 {
00265 $x1 = $x + 15;
00266 $y1 = $y + 15;
00267 $minical_show = $minical_show. "
00268 <area shape=rect coords='$x,$y,$x1,$y1' href='dateplaner.php?app=week×tamp=$week_ts'>";
00269 $week_ts= strtotime ("+1 week", $week_ts );
00270 }
00271
00272
00273 $c0 = false;
00274 for($y = 66; $y <= 145; $y = $y+15)
00275 {
00276 for($x = 25; $x <= 145; $x = $x+20)
00277 {
00278 if($startday > $lastday || $startday == 1)
00279 {
00280 if ($c0 == true)
00281 {
00282 $c0 = false;
00283 }
00284 else
00285 {
00286 $c0 = true;
00287 }
00288 $startday = 1;
00289 $monat1 = $month;
00290 $jahr1 = $year;
00291 if($month == 12)
00292 {
00293 $monat1 = 0;
00294 $jahr1 = $year + 1;
00295 }
00296 $monat1 = $month+1;
00297 $lastday = strftime("%d.", mktime (0,0,0,$monat1,0,$jahr1));
00298 }
00299 if($c0)
00300 {
00301 $x1 = $x + 15;
00302 $y1 = $y + 15;
00303 $day_ts=mktime (0,0,0,$month,$startday,$year);
00304 $minical_show = $minical_show. "
00305 <area shape=rect coords='$x,$y,$x1,$y1' href='dateplaner.php?app=day×tamp=$day_ts'>";
00306 }
00307 $startday++;
00308 }
00309 }
00310
00311
00312 $c0 = 1;
00313 for($y = 20; $y <= 40; $y = $y+13)
00314 {
00315 for($x = 5; $x <= 137; $x = $x+26)
00316 {
00317 $x1 = $x + 20;
00318 $y1 = $y + 10;
00319 $month_ts=mktime (0,0,0,$c0,1,$year);
00320 $minical_show = $minical_show. "
00321 <area shape=rect coords='$x,$y,$x1,$y1' href='dateplaner.php?app=$app&month=$c0&year=$year×tamp=$month_ts'>";
00322 $c0++;
00323 }
00324 }
00325 $minical_show = $minical_show. "
00326 <area shape=rect coords='10,2,25,17' href='dateplaner.php?app=$app&month=$month&year=$year&action=last'>
00327 <area shape=rect coords='135,2,150,17' href='dateplaner.php?app=$app&month=$month&year=$year&action=next'>
00328 </map>
00329
00330 <img src='.".DATEPLANER_ROOT_DIR."/includes/inc.minicalendar.php?action=show&month=".$month."&year=".$year."&DP_Lang=".$DP_Lang."' usemap='#Calendar' border=0>
00331 ";
00332 return $minical_show;
00333
00334 }
00335 ?>