Dispo avec le module Kalender Mx

Mais en voici le code source :

(à télécharger ici aussi :
block-Calendar_centerlist_scroll.php.zip car ça fait un peu long là ^^ )
<?php
/**
* KalenderMx v1.4
* Copyright (c) 2004 by A.Ellsel (kalender@pragmamx.org)
* http://www.pragmamx.org & http://www.shiba-design.de
*
* KalenderMx was based on EventCalendar 2.0
* Copyright (c) 2001 Originally by Rob Sutton
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* $Source: D:\CVS/dev-Kalender/html/blocks/block-Calendar_centerlist_scroll.php,v $
* $Revision: 1.8 $
* $Author: Andreas Ellsel $
* $Date: 2006/07/21 13:24:09 $
*/
// // !!!! don't change this 3 lines !!!! ////////////////////////////////////////
$thisfile = basename(__file__);
if (eregi($thisfile, $_SERVER["PHP_SELF"])) die ("You can't access this file directly...");
global $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $bgcolor5, $textcolor1, $textcolor2, $dbi;
// ///////////////////////////////////////////////////////////////////////////////////////////
$mxblockcache = false;
// // Einstellungen fuer den Block ////////////////////////////////////////
// CHANGE THIS IF YOU CHANGE THE CALENDAR-MODULES FOLDER NAME
if (!defined("CAL_MODULE_NAME")) define("CAL_MODULE_NAME", "Kalender");
// /////////////////////////////////////////////////////////////////////////////
// verschiedene Einstellungen
$sort = "asc"; // Sortierung der Liste: asc =aufsteigend / desc =absteigend
$scrolling = 1; // Eintraege seitlich scrollen
$scrolltype = "scroll"; // Art des Scrollens: scroll / alternate
$scrolldelay = 1; // Scrollgeschwindigkeit
$scrollamount = 1; // Scrollgeschwindigkeit
$listcount = 10; // Anzahl der Termine im Block
$listStarttime = 0; // Startzeit des Termins anzeigen: 0=nein / 1=ja
$listEnddate2 = 0; // Enddatum anzeigen, wenn gleich dem Startdatum: 0=nein / 1=ja
$listEndtime = 0; // Ende-Zeit des Termins anzeigen: 0=nein / 1=ja
$listtimebreak = 0; // Start/Endezeit nach Datum umbrechen: 0=nein / 1=ja (erhoeht die Zeile!)
$eventwidth = 200; // Breite des einzelnen Events bei scrolling
$showTitle = 0; // Blockueberschrift anzeigen: 0=nein / 1=ja
$scrolltopmargin = -2; // Abstand des scrollenden Teils von oben: beliebiger integer Wert in px
$showHeader = 0; // Tabellenkopf anzeigen: 0=nein / 1=ja
$showLegend = 0; // Farblegende anzeigen: 0=nein / 1=ja
$showNewlink = 0; // Link 'Termin vorschlagen' anzeigen: 0=nein / 1=ja
$showalldot = 0; // Link (stern) fuer alle Ereignisse 0=nein / 1=ja
$legendCols = 0; // Anzahl der Spalten in der Kategorieliste. 0, wenn Kalendereinstellung verwendet werden soll
// // Definition der Farben und Rahmen ///////////////////////////////////////////////////////
$listheadbgcolor = $bgcolor2; // Hintergrund Listen-Kopf
$listheadtxtcolor = $textcolor2; // Text Listen-Kopf
$listbgcolor1 = $bgcolor1; // Hintergrund erste Zeile
$listtxtcolor1 = $textcolor1; // Text erste Zeile
$listbgcolor2 = $bgcolor2; // Hintergrund naechste Zeile
$listtxtcolor2 = $textcolor2; // Text naechste Zeile
$listbordercolor = $bgcolor2; // Rahmenfarbe um Liste
$scrollbgcolor = $bgcolor1; // Hintergrundfarbe des Marquee-Tags (Zwischenraum Scrollinhalte)
$listtableborder = 0; // html Rahmen um Liste
$listtablecellspacing = 1; // abstand zwischen Events (auch Rahmenbreite)
$listtablecellpadding = 2; // Freiraum innerhalb der Tabellenspalten der einzelnen Termindaten
$listheadbold = 1; // Ueberschriften der Liste in Fettschrift: 0=nein / 1=ja
// // Ende der Einstellungen, ab hier nichts veraendern !! ///////////////////////////////////
// ///////////////////////////////////////////////////////////////////////////////////////////
$listheadbold1 = ($listheadbold) ? "<b>" : "";
$listheadbold2 = ($listheadbold) ? "</b>" : "";
$timebreak = ($listtimebreak && !$scrolling) ? "<br>\n" : "";
$conftest = @include("modules/" . CAL_MODULE_NAME . "/config/config.php");
if (!$conftest) {
$content = "<b>Error!</b><br>You must change the constant '\"CAL_MODULE_NAME\"' in file: <br>" . __file__ . "";
return;
}
if (!empty($legendCols)) {
$calconf['catListCols'] = $legendCols;
}
get_lang(CAL_MODULE_NAME);
if (!defined("CAL_MODULE_PATH")) define("CAL_MODULE_PATH", "modules/" . CAL_MODULE_NAME . "/");
if (!defined("CAL_TABLE_EVENTS")) @include_once(CAL_MODULE_PATH . "includes/functions.php");
$showNewlink = (calIsPostAllowed() && $showNewlink) ? 1 : 0;
if (!calDetectGoodBrowser ()) {
$scrolling = 0;
}
$whereoption = " categorie in(" . calGetSqlEventpoints() . ") AND activ=1";
$d = date("d");
$m = date("n");
$y = date("Y");
$qrydate = "$y-$m-$d";
$qry = "SELECT count(eid) FROM " . CAL_TABLE_EVENTS . "
WHERE (startDate>= '$qrydate' or endDate>= '$qrydate')
and ($whereoption)";
list($icount) = sql_fetch_row(sql_query($qry, $dbi), $dbi);
if ($icount > $listcount) $icount = $listcount;
$content = "\n<!-- $thisfile output start -->\n";
$i = 0;
if ($icount) {
setlocale (LC_TIME, _CALLOCALE);
$imgprops = "align=\"middle\" hspace=\"6\" vspace=\"4\" width=\"9\" height=\"9\" border=\"0\" alt=\"\"";
$fontstyle = ($listStarttime) ? "tiny" : "boxcontent";
if ($icount < 3) {
$scrolling = 0;
}
if ($scrolling) {
srand((double)microtime() * 1000000);
$randmarq = 'm' . md5(uniqid(rand(), 1));
$content .= "<div style=\"position: relative; top: $scrolltopmargin;\">
<marquee id='" . $randmarq . "' behavior='$scrolltype' direction='left' hspace='0' vspace='0' scrollamount='$scrollamount' scrolldelay='$scrolldelay' loop='0' dir='ltr' onMouseOver='this.stop()' onMouseOut='this.start()'>
<table cellspacing=\"$listtablecellspacing\" cellpadding=\"$listtablecellpadding\" style=\"background-color: $listbordercolor; border: ${listtableborder}px solid $listbordercolor;\" border=\"$listtableborder\">
<tr>";
} else {
$content .= "<table width=\"100%\" border=\"$listtableborder\" cellspacing=\"$listtablecellspacing\" cellpadding=\"$listtablecellpadding\" style=\"background-color: $listbordercolor; border: ${listtableborder}px solid $listbordercolor;\">";
if ($showHeader) {
$content .= "<tr style=\"background-color: $listheadbgcolor;\"><td colspan=\"3\" width=\"25%\"><span style=\"color: $listheadtxtcolor;\" class=\"boxcontent\">$listheadbold1" . _CALEVENTDATETEXT . "$listheadbold2</span></td>\n<td width=\"75%\"><span style=\"color: $listheadtxtcolor;\" class=\"boxcontent\">$listheadbold1" . _CALSUBTITLE . "$listheadbold2</span></td>\n</tr>\n";
}
// $content.="<tr style=\"background-color: $listbgcolor2;\"><td width=\"10%\" height=\"1\"></td><td width=\"5%\"></td><td width=\"10%\"></td><td width=\"75%\"></td></tr>\n";
}
$content .= "";
$qry = "SELECT eid, title, hometext, posteddate, topic, informant, year(startDate), month(startDate), dayofmonth(startDate), hour(startTime), minute(startTime), year(endDate), month(endDate), dayofmonth(endDate), hour(endTime), minute(endTime), alldayevent, categorie FROM " . CAL_TABLE_EVENTS . "
WHERE (startDate>= '$qrydate' or endDate>= '$qrydate')
and ($whereoption)
order by startDate $sort, endDate $sort
limit 0,$icount";
$result = sql_query($qry, $dbi);
while (list($eid, $title, $hometext, $posteddate, $topic, $informant, $y1, $m1, $d1, $h1, $mi1, $y2, $m2, $d2, $h2, $mi2, $alldayevent, $categorie) = sql_fetch_row($result, $dbi)) {
$bgcolornew = ($i == 0) ? $listbgcolor1 : $listbgcolor2;
$txtcolornew = ($i == 0) ? $listtxtcolor1 : $listtxtcolor2;
$listrange = "";
$i = ($i == 0) ? 1 : 0;
$title = htmlspecialchars(strip_tags(stripslashes($title)), ENT_QUOTES);
$dateStart = calStrftime(_CALSHORTDATEFORMAT, @mktime(0, 0, 0, $m1, $d1, $y1));
if ($listStarttime && !$alldayevent) {
$dateStart .= $timebreak . ' ' . calStrftime(_CALTIMEFORMAT, @mktime($h1, $mi1, 0, $m1, $d1, $y1));
}
if (!$listEnddate2 && $m1 == $m2 && $d1 == $d2 && $y1 == $y2) {
$dateEnd = ($scrolling) ? '' : ' ';
$listrange = "<span class=\"$fontstyle\"> </span><br>";
} else {
$dateEnd = calStrftime(_CALSHORTDATEFORMAT, @mktime(0, 0, 0, $m2, $d2, $y2));
}
if ($listEndtime && !$alldayevent) {
$dateEnd .= $timebreak . ' ' . calStrftime(_CALTIMEFORMAT, @mktime($h2, $mi2, 0, $m2, $d2, $y2));
}
if ($scrolling) {
$scrolldate = (empty($dateEnd) || $dateStart == $dateEnd) ? $dateStart : "$dateStart " . _CALLISTRANGE . " $dateEnd";
$content .= "<td style=\"background-color: $bgcolornew;\" nowrap width=\"$eventwidth\" align=\"center\"><span style=\"color: $txtcolornew;\" class=\"tiny\">
<img src=\"" . calGetBarImage("ball", $categorie) . "\" $imgprops>" . $scrolldate . "</span><br>\n
<span style=\"color: $txtcolornew;\" class=\"boxcontent\"> <a href=\"" . CAL_MODULE_LINK . "&op=view&eid=$eid\">$title</a></span></td>\n";
} else {
$alttext = ($hometext) ? substr(htmlentities(strip_tags(stripslashes($hometext))), 0, 70) . '...' : "";
$content .= "
<tr style=\"background-color: $bgcolornew;\">";
if ($dateEnd == ' ' && $alldayevent) {
$content .= "
<td width=\"25%\" colspan=\"3\" nowrap><span style=\"color: $txtcolornew;\" class=\"$fontstyle\">$dateStart</span></td>\n";
} else {
$content .= "
<td width=\"10%\" nowrap><span style=\"color: $txtcolornew;\" class=\"$fontstyle\">$dateStart</span></td>\n
<td width=\"5%\" align=\"center\">" . $listrange . "<span style=\"color: $txtcolornew;\" class=\"tiny\">" . _CALLISTRANGE . "</span></td>\n
<td width=\"10%\" nowrap><span style=\"color: $txtcolornew;\" class=\"$fontstyle\">$dateEnd</span></td>\n
";
}
$content .= "
<td width=\"75%\"><span style=\"color: $txtcolornew;\" class=\"boxcontent\"><img src=\"" . calGetBarImage("ball", $categorie) . "\" $imgprops> <a href=\"" . CAL_MODULE_LINK . "&op=view&eid=$eid\" title=\"$alttext\">$title</a></span></td>\n
</tr>\n";
}
}
if ($scrolling) {
// / Mozilla macht Probleme beim scrollen, deshalb hier explizit starten
$content .= "</tr>\n</table></marquee></div>
<script language='JavaScript1.2'>
<!--
if (document.getElementById) { document.getElementById('" . $randmarq . "').start(); }
//-->
</script>
";
} else {
$content .= "</table>";
}
setlocale (LC_TIME, $GLOBALS["locale"]);
} else {
$content .= "<span class=\"tiny\">" . _CAL0EVENTSBLOCK . "<br></span>\n";
}
if ($showLegend) {
$link = CAL_MODULE_LINK . "&op=list";
$content .= calBuildColorLegend("centerblock", $showalldot, $showNewlink);
}
$content .= "\n<!-- $thisfile output end -->\n<!-- KalenderMx © by shiba-design.de -->\n";
$content = ereg_replace("\t", "", $content);
// / Der Blocktitel wird über die Sprachdatei des Kalenders gesteuert,
// / soll statt dessen die Einstellung des Adminmenüs verwendet werden,
// / einfach die folgenden Zeilen löschen oder auskommentieren
$blockfiletitle = ($showTitle) ? "" . _CALLISTDESCRIPTION1 . " $icount " . _CALLISTDESCRIPTION2 . "." : "";
?>