New file |
0,0 → 1,232 |
<?php |
/*vim: set expandtab tabstop=4 shiftwidth=4: */ |
// Copyright (C) 1999-2004 Tela Botanica (accueil@tela-botanica.org) |
// |
// Ce logiciel est un programme informatique servant à gérer du contenu et des |
// applications web. |
|
// Ce logiciel est régi par la licence CeCILL soumise au droit français et |
// respectant les principes de diffusion des logiciels libres. Vous pouvez |
// utiliser, modifier et/ou redistribuer ce programme sous les conditions |
// de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA |
// sur le site "http://www.cecill.info". |
|
// En contrepartie de l'accessibilité au code source et des droits de copie, |
// de modification et de redistribution accordés par cette licence, il n'est |
// offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons, |
// seule une responsabilité restreinte pèse sur l'auteur du programme, le |
// titulaire des droits patrimoniaux et les concédants successifs. |
|
// A cet égard l'attention de l'utilisateur est attirée sur les risques |
// associés au chargement, à l'utilisation, à la modification et/ou au |
// développement et à la reproduction du logiciel par l'utilisateur étant |
// donné sa spécificité de logiciel libre, qui peut le rendre complexe à |
// manipuler et qui le réserve donc à des développeurs et des professionnels |
// avertis possédant des connaissances informatiques approfondies. Les |
// utilisateurs sont donc invités à charger et tester l'adéquation du |
// logiciel à leurs besoins dans des conditions permettant d'assurer la |
// sécurité de leurs systèmes et ou de leurs données et, plus généralement, |
// à l'utiliser et l'exploiter dans les mêmes conditions de sécurité. |
|
// Le fait que vous puissiez accéder à cet en-tête signifie que vous avez |
// 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 $ |
/** |
* bazar_calendrier : programme affichant les evenements du bazar sous forme de Calendrier |
* |
* |
*@package Bazar |
//Auteur original : |
*@author David DELON <david.delon@clapas.net> |
*@version $Revision: 1.1 $ $Date: 2005-09-30 12:34:44 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
|
// Fonction Calendrier de Pear |
|
require_once 'Calendar/Month/Weekdays.php'; |
require_once 'Calendar/Day.php'; |
require_once 'Calendar/Decorator.php'; |
|
|
// Classe Utilitaire pour Calendrier |
|
class DiaryEvent extends Calendar_Decorator { |
var $entry; |
function DiaryEvent($calendar) { |
Calendar_Decorator::Calendar_Decorator($calendar); |
} |
function setEntry($entry) { |
$this->entry = $entry; |
} |
function getEntry() { |
return $this->entry; |
} |
} |
|
|
function afficherContenuCorps() { |
|
$url = $GLOBALS['_GEN_commun']['url'] ; |
$db = &$GLOBALS['_GEN_commun']['pear_db'] ; |
$auth = &$GLOBALS['_GEN_commun']['pear_auth'] ; |
|
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']); |
} |
|
|
|
|
|
// Build the month |
$month = new Calendar_Month_Weekdays($_GET['y'],$_GET['m']); |
|
$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"); |
|
|
echo "<div class=\"navi\">"; |
echo "<a href=\"".$prev."\"> << </a>"; |
|
echo $fr_month[(date('n',$curStamp))]; |
echo " "; |
echo (date('Y',$curStamp)); |
|
echo "<a href=\"".$next."\"> >> </a>"; |
|
echo "</div>"; |
|
echo "<table class=\"map\">"; |
echo ( "<tr>\n" ); |
echo ( "<td>\n" ); |
|
// Recherche evenement de la periode selectionnée |
|
$pageSelection=$this->tag.date('Y',$curStamp).date('m',$curStamp); |
|
$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 ) { |
|
// |
// 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); |
|
|
} |
|
$calcom="</ul>".$calcom; |
|
// Attach the payload |
$DiaryEvent->setEntry($calcom); |
|
// Add the decorator to the selection |
$selection[] = $DiaryEvent; |
|
} |
} |
|
|
// 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"; |
} |
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() ) { |
|
echo ( "<a href=\"".$link."\">".$day->getEntry()."</a>\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>"; |
?> |