32,7 → 32,7 |
// pris connaissance de la licence CeCILL, et que vous en avez accepté les |
// termes. |
// ---- |
// CVS : $Id: bazar.calendrier.php,v 1.1 2005-09-30 12:34:44 ddelon Exp $ |
// CVS : $Id: bazar.calendrier.php,v 1.2 2005-09-30 14:58:00 ddelon Exp $ |
/** |
* bazar_calendrier : programme affichant les evenements du bazar sous forme de Calendrier |
* |
40,10 → 40,13 |
*@package Bazar |
//Auteur original : |
*@author David DELON <david.delon@clapas.net> |
*@version $Revision: 1.1 $ $Date: 2005-09-30 12:34:44 $ |
*@version $Revision: 1.2 $ $Date: 2005-09-30 14:58:00 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
// TODO : afficher evenement sur plusieur jours |
// TODO : traduction entete mois calendrier |
// Parametrage EVENEMENT : template |
|
// Fonction Calendrier de Pear |
|
76,79 → 79,83 |
|
if (!isset($_GET['y'])) { |
$_GET['y'] = date('Y'); |
$url->addQueryString ('y', $_GET['y']); |
} |
|
if (!isset($_GET['m'])) { |
$_GET['m'] = date('m'); |
$url->addQueryString ('m', $_GET['m']); |
} |
|
if (!isset($_GET['d'])) { |
$_GET['d'] = date('d'); |
$url->addQueryString ('d', $_GET['d']); |
} |
|
|
|
|
// Construction Mois en Cours |
$month = new Calendar_Month_Weekdays($_GET['y'],$_GET['m']); |
|
// Build the month |
$month = new Calendar_Month_Weekdays($_GET['y'],$_GET['m']); |
$curStamp=$month->getTimeStamp(); |
|
// Navigation |
$prevStamp = $month->prevMonth(true); |
$url->addQueryString ('y', date('Y',$prevStamp)); |
$url->addQueryString ('m', date('n',$prevStamp)); |
$url->addQueryString ('d', date('j',$prevStamp)); |
$prev = $url->getUrl(); |
$nextStamp = $month->nextMonth(true); |
$url->addQueryString ('y', date('Y',$nextStamp)); |
$url->addQueryString ('m', date('n',$nextStamp)); |
$url->addQueryString ('d', date('j',$nextStamp)); |
$next = $url->getUrl(); |
|
$curStamp=$month->getTimeStamp(); |
// Create links |
$prevStamp = $month->prevMonth(true); |
$prev = $_SERVER['PHP_SELF'].'?wiki='.$this->tag.'&y='.date('Y',$prevStamp).'&m='.date('n',$prevStamp).'&d='.date('j',$prevStamp); |
$nextStamp = $month->nextMonth(true); |
$next = $_SERVER['PHP_SELF'].'?wiki='.$this->tag.'&y='.date('Y',$nextStamp).'&m='.date('n',$nextStamp).'&d='.date('j',$nextStamp); |
$fr_month=array("1"=>"Janvier","2"=>"Fevrier","3"=>"Mars","4"=>"Avril","5"=>"Mai","6"=>"Juin","7"=>"Juillet","8"=>"Aout","9"=>"Septembre","10"=>"Octobre","11"=>"Novembre","12"=>"Decembre"); |
|
$fr_month=array("1"=>"Janvier","2"=>"Fevrier","3"=>"Mars","4"=>"Avril","5"=>"Mai","6"=>"Juin","7"=>"Juillet","8"=>"Aout","9"=>"Septembre","10"=>"Octobre","11"=>"Novembre","12"=>"Decembre"); |
|
echo "<div class=\"navi\">"; |
echo "<a href=\"".$prev."\"> << </a>"; |
|
echo "<div class=\"navi\">"; |
echo "<a href=\"".$prev."\"> << </a>"; |
echo $fr_month[(date('n',$curStamp))]; |
echo " "; |
echo (date('Y',$curStamp)); |
|
echo $fr_month[(date('n',$curStamp))]; |
echo " "; |
echo (date('Y',$curStamp)); |
echo "<a href=\"".$next."\"> >> </a>"; |
|
echo "<a href=\"".$next."\"> >> </a>"; |
echo "</div>"; |
|
echo "</div>"; |
|
echo "<table class=\"map\">"; |
echo ( "<tr>\n" ); |
echo ( "<td>\n" ); |
// Recherche evenement de la periode selectionnée |
|
// Recherche evenement de la periode selectionnée |
$EvenementSelection=$this->tag.date('Y',$curStamp).date('m',$curStamp); |
|
$pageSelection=$this->tag.date('Y',$curStamp).date('m',$curStamp); |
$selection = array(); |
|
|
// TODO : Selectionner element du mois en cours |
|
$requete_evenements = "SELECT DISTINCT bf_id_fiche, bf_titre, bf_lieu_evenement, bf_date_debut_evenement, bf_date_fin_evenement, bf_description FROM bazar_fiche, bazar_nature where bf_date_debut_evenement=".$EvenementSelection." and bf_ce_nature=bn_id_nature and bn_label_nature='Évènements'"; |
|
|
$resultat_evenement = $db->query($requete_evenements); |
|
(DB::isError($resultat_evenement)) |
? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_evenement->getMessage(), $requete_evenements)) |
: ''; |
|
$selection = array(); |
|
if ($pages = $this->LoadAll("select tag, body from ".$this->config["table_prefix"]."pages where tag like '".mysql_escape_string($pageSelection)."%' and latest = 'Y' and comment_on = '' order by tag ASC, time ASC")) { |
$i=0; |
foreach ( $pages as $page ) { |
$calcom=""; |
|
while ($ligne_evenements = $resultat_evenement->fetchRow(DB_FETCHMODE_OBJECT)) { |
|
// |
// Preparation Calendrier |
// |
|
$Day = new Calendar_Day(date('Y',$curStamp),date('m',$curStamp), substr($page ['tag'], -2)); |
|
// Create the decorator, passing it the Hour |
$DiaryEvent = new DiaryEvent($Day); |
|
|
|
$dayStamp = $Day->thisDay(true); |
$ref = |
$_SERVER['PHP_SELF'].'?wiki='.$this->tag.date('Y',$dayStamp).date('m',$dayStamp).date('d',$dayStamp); |
$url->addQueryString ('y', date('Y',$dayStamp)); |
$url->addQueryString ('m', date('n',$dayStamp)); |
$url->addQueryString ('d', date('j',$dayStamp)); |
$ref = $url->getUrl(); |
|
|
} |
|
$calcom="</ul>".$calcom; |
$calcom="</br>".$ligne_evenements->bf_titre.$calcom; |
|
// Attach the payload |
$DiaryEvent->setEntry($calcom); |
157,76 → 164,72 |
$selection[] = $DiaryEvent; |
|
} |
} |
|
// Affichage Calendrier |
|
|
$month->build($selection); |
|
echo ( "<tr>\n" ); |
echo ( "<td>\n" ); |
|
|
// Affichage Calendrier |
|
|
$month->build($selection); |
|
echo ( "<tr>\n" ); |
echo ( "<td>\n" ); |
|
|
echo "<table class=\"calendar\"> |
<tr> |
|
<th> Lundi </th> |
<th> Mardi </th> |
<th> Mercredi </th> |
<th> Jeudi </th> |
<th> Vendredi </th> |
|
<th> Samedi </th> |
<th> Dimanche </th> |
</tr> |
"; |
|
$todayStamp=time(); |
|
while ( $day = $month->fetch() ) { |
|
$dayStamp = $day->thisDay(true); |
|
if ( $day->isEmpty() ) { |
$class = "other_month"; |
} |
else { |
if ($todayStamp>$dayStamp) { |
$class="previous_month"; |
echo "<table class=\"calendar\"> |
<tr> |
|
<th> Lundi </th> |
<th> Mardi </th> |
<th> Mercredi </th> |
<th> Jeudi </th> |
<th> Vendredi </th> |
|
<th> Samedi </th> |
<th> Dimanche </th> |
</tr> |
"; |
|
$todayStamp=time(); |
|
while ( $day = $month->fetch() ) { |
|
$dayStamp = $day->thisDay(true); |
|
if ( $day->isEmpty() ) { |
$class = "other_month"; |
} |
else { |
$class="current_month"; |
if ($todayStamp>$dayStamp) { |
$class="previous_month"; |
} |
else { |
$class="current_month"; |
} |
} |
} |
|
$link = |
$_SERVER['PHP_SELF'].'?wiki='.$this->tag.date('Y',$dayStamp).date('m',$dayStamp).date('d',$dayStamp); |
|
// isFirst() to find start of week |
if ( $day->isFirst() ) |
echo ( "<tr>\n" ); |
|
|
echo ( "<td class=\"".$class."\"><a href=\"".$link."\">".$day->thisDay()."</a>\n" ); |
|
if ( $day->isSelected() ) { |
$link = |
$_SERVER['PHP_SELF'].'?wiki='.$this->tag.date('Y',$dayStamp).date('m',$dayStamp).date('d',$dayStamp); |
|
echo ( "<a href=\"".$link."\">".$day->getEntry()."</a>\n" ); |
// isFirst() to find start of week |
if ( $day->isFirst() ) |
echo ( "<tr>\n" ); |
|
|
echo ( "<td class=\"".$class."\"><a href=\"".$link."\">".$day->thisDay()."</a>\n" ); |
|
if ( $day->isSelected() ) { |
|
echo ( "<a href=\"".$link."\">".$day->getEntry()."</a>\n" ); |
|
} |
echo ( "</td>\n" ); |
|
// isLast() to find end of week |
if ( $day->isLast() ) |
echo ( "</tr>\n" ); |
} |
echo ( "</td>\n" ); |
|
// isLast() to find end of week |
if ( $day->isLast() ) |
echo ( "</tr>\n" ); |
} |
|
echo "</table>"; |
|
echo ( "</td>\n" ); |
echo ( "</tr>\n" ); |
|
echo "</table>"; |
|
echo "</table>"; |
|
} |
|
?> |