Vergyone
Neuer User
- Mitglied seit
- 15 Sep 2005
- Beiträge
- 99
- Punkte für Reaktionen
- 0
- Punkte
- 6
Es gab noch das ursprüngliche von PacmannII wo in der index.php noch kein ?action=kalender vorgesehen war.
Ja meine index.php beruht auf die ursprüngliche und hier sollte lediglich bei Geburtstagen und bei Mülleinträgen nicht das Colorbutton mit der Farbe von Googlekalender, sondern jeweils die Grafik (Müllbild oder Geburtstagstorte) angezeigt werden.
Hatte es auch probiert, aber bin am Script gescheitert, da ich nicht wusste wohin ich im ursprünglichen Script die wenn schleife reinmachen sollte.
Hier mal mein geändertes Script, wo ich einige if schleifen mit Müllabfuhr und Geburtstag eingefügt habe, nur leider bekomme ich einen 500er Fehler. Kann einer mal drüberschauen!!!
PHP:
public function doOutput($image, $style, $updateData, &$yoffset) {
if ($updateData)
$this->doUpdate();
$query = "SELECT * FROM `if_calendar` WHERE (`end` > NOW()) ORDER BY `begin` ASC";
$result = mysql_query($query, $this->dbconn);
if (mysql_num_rows($result) > 0) {
// define styles
$opt_header = array(
'width' => imagesx($image)-290,
'line_height' => 18,
'align' => ALIGN_LEFT
);
$opt_day = array(
'width' => imagesx($image)-290,
'height' => 14,
'line_height' => 14,
'align' => ALIGN_LEFT
);
$opt_entry = array(
'width' => imagesx($image)-290,
'height' => 12,
'line_height' => 12,
'align' => ALIGN_LEFT,
'word_wrap_hyphen' => '...',
'aggressive_word_wrap' => true,
);
// print header
imagettftextboxopt($image, 18, 0, 50, $yoffset, $style['textcolor'], $style['font'], "Nächste Termine", $opt_header);
$icon = ImageCreateFromPNG ( 'resources/icons/clock.png' );
ImageCopy($image, $icon, 20, $yoffset-3, 0, 0, imagesx($icon), imagesy($icon));
ImageDestroy($icon);
$yoffset += 26;
// print calendar
$counter = 0;
$formatDate = "%d.%m.%Y";
$formatTime = "%H:%M";
$today = strftime( $formatDate );
$tomorrow = strftime( $formatDate, strtotime("+1 day", time() ) );
$currently_displayed_day = 0;
while ($row = mysql_fetch_assoc($result)) {
$counter++;
// if end of screen is reached and more than one items left -> cut off and show hint "x more appointments..."
$rest = (mysql_num_rows($result) - $counter) + 1;
if (($yoffset >= (imagesy($image) - 36)) && ($rest > 1)) {
$text = "... $rest weitere Termine";
imagettftextboxopt($image, 14, 0, 24, $yoffset, $style['textcolor'], $style['fontb'], $text, $opt_entry);
$yoffset += 20;
break;
}
// print day name
$begin_date = strftime( $formatDate, strtotime($row['begin']));
// if begin day is before today set begin to today
if (strtotime($begin_date) < strtotime($today))
$begin_date = $today;
// now if begin is after $currently_displayed_day update $currently_displayed_day
if (strtotime($begin_date) > $currently_displayed_day) {
// update currently_displayed_day
$currently_displayed_day = strtotime($begin_date);
// print day name
if( $begin_date == $today )
$dayname = "Heute";
else if( $begin_date == $tomorrow )
$dayname = "Morgen";
else
$dayname = strftime("%A, ".$formatDate, strtotime($begin_date));
imagettftextboxopt($image, 14, 0, 50, $yoffset+4, $style['textcolor'], $style['fontb'], $dayname, $opt_day);
$yoffset += 22;
}
// build appointment time text
$end_date = strftime( $formatDate, strtotime($row['end']));
$begin_time = strftime( $formatTime, strtotime($row['begin']));
$end_time = strftime( $formatTime, strtotime($row['end']));
$text = $row['title'];
if ($row['location'] != null)
$text = $text . ", " . $row['location'];
if (($begin_time == "00:00") && ($end_time == "00:00")) {
// all day event (substract 1 second to get the real end date at 23:59)
$end_date = strftime( $formatDate, strtotime($row['end'])-1);
// if all day event is longer than one day -> print end date
if (strtotime($end_date) != $currently_displayed_day)
$text = $text." (bis ".$end_date.")";
} else {
// normal event with start and end time
$text = $text." (".$begin_time." - ";
// if event ends not this day -> display end date additionally to time
if (strtotime($end_date) != $currently_displayed_day)
$text = $text.$end_date.", ";
$text = $text.$end_time.")";
}
// ------------------------------------------- Müllabfuhr----------------------------------------
if (($row['color']) == "#1B887A")
{
if (strpos($row['title'], 'Blaue') !== false)
$icon = ImageCreateFromPNG ( 'resources/icons/tonne_blau.png' );
if (strpos($row['title'], 'Biotonne') !== false)
$icon = ImageCreateFromPNG ( 'resources/icons/tonne_gruen.png' );
if (strpos($row['title'], 'Gelbe S') !== false)
$icon = ImageCreateFromPNG ( 'resources/icons/gelber_sack.png' );
if (strpos($row['title'], 'Restm') !== false)
$icon = ImageCreateFromPNG ( 'resources/icons/tonne_schwarz.png' );
ImageCopy($image, $icon, 32, $yoffset+8, 0, 0, imagesx($icon), imagesy($icon));
}
else{
// ------------------------------------------- Geburtstag ----------------------------------------
if (($row['color']) == "#5229A3")
{ $icon = ImageCreateFromPNG ( 'resources/icons/birth.png' );
ImageCopy($image, $icon, 32, $yoffset+8, 0, 0, imagesx($icon), imagesy($icon));
ImageDestroy($icon);
}
}else {
// ------------------------------------------- Standard - Button ----------------------------------------
// determine button color
$colorArray = htmlColorToRgb($row['color']);
$color = ImageColorAllocate ($image, $colorArray[0], $colorArray[1], $colorArray[2]);
// print appointment text and button
drawGlassButton($image, $color, 32, $yoffset+8);
}
imagettftextboxopt($image, 12, 0, 50, $yoffset, $style['textcolor'], $style['font'], $text, $opt_entry);
$yoffset += 22;
}
}
$yoffset += 18;
}
Zuletzt bearbeitet: