Line 17... |
Line 17... |
17 |
// | |
|
17 |
// | |
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
19 |
// | License along with this library; if not, write to the Free Software |
|
19 |
// | License along with this library; if not, write to the Free Software |
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
22 |
// CVS : $Id: bazar.fonct.cal.php,v 1.11 2007-02-15 14:18:38 jp_milcent Exp $
|
22 |
// CVS : $Id: bazar.fonct.cal.php,v 1.12 2007-02-15 18:16:45 jp_milcent Exp $
|
23 |
/**
|
23 |
/**
|
24 |
*
|
24 |
*
|
25 |
* Fonctions calendrier du module bazar
|
25 |
* Fonctions calendrier du module bazar
|
26 |
*
|
26 |
*
|
27 |
*@package bazar
|
27 |
*@package bazar
|
28 |
//Auteur original :
|
28 |
//Auteur original :
|
29 |
*@author David Delon <david.delon@clapas.net>
|
29 |
*@author David Delon <david.delon@clapas.net>
|
30 |
//Autres auteurs :
|
30 |
//Autres auteurs :
|
31 |
*@copyright Tela-Botanica 2000-2004
|
31 |
*@copyright Tela-Botanica 2000-2004
|
32 |
*@version $Revision: 1.11 $ $Date: 2007-02-15 14:18:38 $
|
32 |
*@version $Revision: 1.12 $ $Date: 2007-02-15 18:16:45 $
|
33 |
// +------------------------------------------------------------------------------------------------------+
|
33 |
// +------------------------------------------------------------------------------------------------------+
|
34 |
*/
|
34 |
*/
|
Line 35... |
Line 35... |
35 |
|
35 |
|
36 |
// +------------------------------------------------------------------------------------------------------+
|
36 |
// +------------------------------------------------------------------------------------------------------+
|
37 |
// | ENTETE du PROGRAMME |
|
37 |
// | ENTETE du PROGRAMME |
|
38 |
// +------------------------------------------------------------------------------------------------------+
|
- |
|
39 |
|
38 |
// +------------------------------------------------------------------------------------------------------+
|
40 |
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Month/Weekdays.php';
|
39 |
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Month/Weekdays.php';
|
41 |
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Day.php';
|
40 |
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Day.php';
|
Line 67... |
Line 66... |
67 |
// $type : calendrier
|
66 |
// $type : calendrier
|
68 |
// $type : calendrier_appplette
|
67 |
// $type : calendrier_appplette
|
Line 69... |
Line 68... |
69 |
|
68 |
|
Line 70... |
Line -... |
70 |
function GestionAffichageCalendrier($type='calendrier') {
|
- |
|
71 |
|
69 |
function GestionAffichageCalendrier($type='calendrier') {
|
72 |
|
70 |
|
73 |
$retour='';
|
71 |
$retour='';
|
74 |
|
72 |
|
75 |
$url = $GLOBALS['_GEN_commun']['url'] ;
|
73 |
$url = $GLOBALS['_GEN_commun']['url'] ;
|
Line -... |
Line 74... |
- |
|
74 |
$db = &$GLOBALS['_GEN_commun']['pear_db'] ;
|
- |
|
75 |
$auth = &$GLOBALS['_GEN_commun']['pear_auth'] ;
|
- |
|
76 |
|
- |
|
77 |
// Nettoyage de l'url de la query string
|
- |
|
78 |
$chaine_url = $url->getQueryString();
|
- |
|
79 |
$tab_params = explode('&', $chaine_url);
|
- |
|
80 |
if (count($tab_params) == 0) {
|
- |
|
81 |
$tab_params = explode('&', $chaine_url);
|
- |
|
82 |
}
|
- |
|
83 |
foreach ($tab_params as $param) {
|
- |
|
84 |
$tab_parametre = explode('=', $param);
|
76 |
$db = &$GLOBALS['_GEN_commun']['pear_db'] ;
|
85 |
$url->removeQueryString($tab_parametre[0]);
|
77 |
$auth = &$GLOBALS['_GEN_commun']['pear_auth'] ;
|
86 |
}
|
78 |
|
87 |
|
Line 79... |
Line 88... |
79 |
if (!isset($_GET['y'])) {
|
88 |
if (!isset($_GET['y'])) {
|
80 |
$_GET['y'] = date('Y');
|
89 |
$_GET['y'] = date('Y');
|
81 |
}
|
90 |
}
|
Line 82... |
Line -... |
82 |
|
- |
|
83 |
if (!isset($_GET['m'])) {
|
91 |
|
84 |
$_GET['m'] = date('m');
|
92 |
if (!isset($_GET['m'])) {
|
Line 85... |
Line 93... |
85 |
}
|
93 |
$_GET['m'] = date('m');
|
86 |
|
94 |
}
|
Line 128... |
Line 136... |
128 |
// Vue Mois calendrier ou vue applette
|
136 |
// Vue Mois calendrier ou vue applette
|
Line 129... |
Line 137... |
129 |
|
137 |
|
Line 130... |
Line 138... |
130 |
if ((!isset($_GET['id_fiche']) && ($type=='calendrier')) || ($type=='calendrier_applette')){
|
138 |
if ((!isset($_GET['id_fiche']) && ($type=='calendrier')) || ($type=='calendrier_applette')){
|
131 |
|
- |
|
- |
|
139 |
|
132 |
// Recherche evenement de la periode selectionnée
|
140 |
// Recherche evenement de la periode selectionnée
|
133 |
|
- |
|
134 |
// TODO : Selectionner element du mois en cours
|
141 |
$ts_jour_fin_mois = $month->nextMonth('timestamp');
|
135 |
|
142 |
$ts_jour_debut_mois = $month->thisMonth('timestamp');;
|
136 |
$requete_evenements = "SELECT DISTINCT bf_id_fiche, bf_titre, bf_lieu_evenement, DAY(bf_date_debut_evenement) AS bf_jour_debut_evenement , bf_date_fin_evenement, bf_description ".
|
143 |
$requete_evenements = "SELECT DISTINCT bf_id_fiche, bf_titre, bf_lieu_evenement, DAY(bf_date_debut_evenement) AS bf_jour_debut_evenement, bf_date_debut_evenement, bf_date_fin_evenement, bf_description ".
|
137 |
"FROM bazar_fiche, bazar_nature ".
|
144 |
"FROM bazar_fiche, bazar_nature ".
|
138 |
"WHERE YEAR(bf_date_debut_evenement) = ".date('Y',$curStamp)." ".
|
145 |
"WHERE bf_date_debut_evenement < '".date('Y-m-d', $ts_jour_fin_mois)."' ".
|
139 |
"AND month(bf_date_debut_evenement) = ".date('m',$curStamp)." ".
|
146 |
"AND bf_date_fin_evenement >= '".date('Y-m-d', $ts_jour_debut_mois)."' ".
|
140 |
"AND bf_ce_nature = bn_id_nature ".
|
- |
|
141 |
"AND bn_id_nature IN (".BAZ_NUM_ANNONCE_CALENDRIER.")";
|
147 |
"AND bf_ce_nature = bn_id_nature ".
|
142 |
|
- |
|
143 |
$resultat_evenement = $db->query($requete_evenements);
|
148 |
"AND bn_id_nature IN (".BAZ_NUM_ANNONCE_CALENDRIER.")";
|
144 |
|
149 |
$resultat_evenement = $db->query($requete_evenements);
|
145 |
(DB::isError($resultat_evenement))
|
150 |
(DB::isError($resultat_evenement))
|
146 |
? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_evenement->getMessage(), $requete_evenements))
|
151 |
? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_evenement->getMessage(), $requete_evenements))
|
147 |
: '';
|
- |
|
148 |
|
- |
|
149 |
$calcom="";
|
152 |
: '';
|
150 |
|
153 |
|
151 |
$selection=array();
|
- |
|
- |
|
154 |
$selection = array();
|
- |
|
155 |
$evenements = array();
|
152 |
$evenements=array();
|
156 |
$annee = date('Y', $curStamp);
|
153 |
|
- |
|
154 |
$prev_curday_ymd=0;
|
157 |
$mois = date('m', $curStamp);
|
155 |
|
- |
|
156 |
while ($ligne_evenements = $resultat_evenement->fetchRow(DB_FETCHMODE_OBJECT)) {
|
158 |
$tablo_jours = array();
|
157 |
|
- |
|
158 |
$curday_ymd=date('Ym',$curStamp).$ligne_evenements->bf_jour_debut_evenement;
|
159 |
while ($ligne_evenements = $resultat_evenement->fetchRow(DB_FETCHMODE_OBJECT)) {
|
159 |
if ($curday_ymd!=$prev_curday_ymd) {
|
- |
|
160 |
$Day = new Calendar_Day(date('Y',$curStamp),date('m',$curStamp), $ligne_evenements->bf_jour_debut_evenement);
|
- |
|
161 |
$DiaryEvent = new DiaryEvent($Day);
|
- |
|
162 |
$prev_curday_ymd=$curday_ymd;
|
- |
|
163 |
}
|
- |
|
Line -... |
Line 160... |
- |
|
160 |
list($annee_debut, $mois_debut, $jour_debut) = explode('-', $ligne_evenements->bf_date_debut_evenement);
|
- |
|
161 |
list($annee_fin, $mois_fin, $jour_fin) = explode('-', $ligne_evenements->bf_date_fin_evenement);
|
- |
|
162 |
|
- |
|
163 |
$Calendrier = new Calendar($annee_debut, $mois_debut, $jour_debut);
|
- |
|
164 |
$ts_jour_suivant = $Calendrier->thisDay('timestamp');
|
164 |
|
165 |
$ts_jour_fin = mktime(0,0,0,$mois_fin, $jour_fin, $annee_fin);
|
165 |
$DiaryEvent->setEntry($ligne_evenements);
|
166 |
|
- |
|
167 |
if ($ts_jour_suivant < $ts_jour_fin) {
|
- |
|
168 |
//echo "$ts_jour_suivant-";
|
- |
|
169 |
$naviguer = true;
|
- |
|
170 |
while ($naviguer) {
|
- |
|
171 |
// Si le jours suivant est inférieur à la date de fin, on continue...
|
- |
|
172 |
if ($ts_jour_suivant <= $ts_jour_fin) {
|
- |
|
173 |
// Si le jours suivant est inférieur à la date de fin du mois courrant, on continue...
|
- |
|
174 |
if ($ts_jour_suivant < $ts_jour_fin_mois) {
|
- |
|
175 |
$cle_j = date('Y-m-d', $ts_jour_suivant);
|
- |
|
176 |
if (!isset($tablo_jours[$cle_j])) {
|
- |
|
177 |
$tablo_jours[$cle_j]['Calendar_Day'] = new Calendar_Day(date('Y', $ts_jour_suivant),date('m', $ts_jour_suivant), date('d', $ts_jour_suivant));
|
166 |
|
178 |
$tablo_jours[$cle_j]['Diary_Event'] = new DiaryEvent($tablo_jours[$cle_j]['Calendar_Day']);
|
- |
|
179 |
}
|
- |
|
180 |
$tablo_jours[$cle_j]['Diary_Event']->setEntry($ligne_evenements);
|
- |
|
181 |
|
- |
|
182 |
$ts_jour_suivant = $Calendrier->nextDay('timestamp');
|
- |
|
183 |
//echo "ici$ts_jour_suivant-";
|
- |
|
184 |
$Calendrier->setTimestamp($ts_jour_suivant);
|
- |
|
185 |
//echo "la".$Calendrier->thisDay('timestamp')."-";
|
- |
|
186 |
} else {
|
- |
|
187 |
$naviguer = false;
|
- |
|
188 |
}
|
- |
|
189 |
} else {
|
- |
|
190 |
$naviguer = false;
|
- |
|
191 |
}
|
- |
|
192 |
}
|
- |
|
193 |
} else {
|
- |
|
194 |
$curday_ymd = $annee.$mois.$ligne_evenements->bf_jour_debut_evenement;
|
- |
|
195 |
$cle_j = $annee.'-'.$mois.'-'.$ligne_evenements->bf_jour_debut_evenement;
|
- |
|
196 |
if (!isset($tablo_jours[$cle_j])) {
|
- |
|
197 |
$tablo_jours[$cle_j]['Calendar_Day'] = new Calendar_Day($annee, $mois, $ligne_evenements->bf_jour_debut_evenement);
|
- |
|
198 |
$tablo_jours[$cle_j]['Diary_Event'] = new DiaryEvent($tablo_jours[$cle_j]['Calendar_Day']);
|
167 |
// Add the decorator to the selection
|
199 |
}
|
- |
|
200 |
$tablo_jours[$cle_j]['Diary_Event']->setEntry($ligne_evenements);
|
- |
|
201 |
}
|
- |
|
202 |
}
|
- |
|
203 |
// Add the decorator to the selection
|
- |
|
204 |
foreach ($tablo_jours as $jour) {
|
- |
|
205 |
$selection[] = $jour['Diary_Event'];
|
- |
|
206 |
}
|
- |
|
207 |
|
- |
|
208 |
// $calcom = "";
|
- |
|
209 |
// $selection = array();
|
- |
|
210 |
// $evenements = array();
|
- |
|
211 |
// $prev_curday_ymd=0;
|
- |
|
212 |
// while ($ligne_evenements = $resultat_evenement->fetchRow(DB_FETCHMODE_OBJECT)) {
|
- |
|
213 |
//
|
- |
|
214 |
// $curday_ymd=date('Ym',$curStamp).$ligne_evenements->bf_jour_debut_evenement;
|
- |
|
215 |
// if ($curday_ymd!=$prev_curday_ymd) {
|
- |
|
216 |
// $Day = new Calendar_Day(date('Y',$curStamp),date('m',$curStamp), $ligne_evenements->bf_jour_debut_evenement);
|
- |
|
217 |
// $DiaryEvent = new DiaryEvent($Day);
|
- |
|
218 |
// $prev_curday_ymd=$curday_ymd;
|
- |
|
219 |
// }
|
- |
|
220 |
// $DiaryEvent->setEntry($ligne_evenements);
|
- |
|
221 |
//
|
Line 168... |
Line 222... |
168 |
$selection[] = $DiaryEvent;
|
222 |
// // Add the decorator to the selection
|
169 |
|
- |
|
170 |
}
|
- |
|
171 |
|
223 |
// $selection[] = $DiaryEvent;
|
172 |
// Affichage Calendrier
|
- |
|
173 |
|
224 |
// }
|
174 |
|
225 |
|
175 |
$month->build($selection);
|
226 |
// Affichage Calendrier
|
Line 176... |
Line 227... |
176 |
|
227 |
$month->build($selection);
|
Line 290... |
Line 341... |
290 |
// Vue detail
|
341 |
// Vue detail
|
Line 291... |
Line 342... |
291 |
|
342 |
|
292 |
if ((isset($_GET['id_fiches']))) {
|
343 |
if ((isset($_GET['id_fiches']))) {
|
293 |
// Ajout des styles du bazar
|
344 |
// Ajout des styles du bazar
|
294 |
if (defined('PAP_VERSION')) { //si on est dans Papyrus
|
345 |
if (defined('PAP_VERSION')) { //si on est dans Papyrus
|
295 |
GEN_stockerStyleExterne( 'bazar_interne', 'client/bazar/bazar.interne.css');
|
346 |
//GEN_stockerStyleExterne( 'bazar_interne', 'client/bazar/bazar.interne.css');
|
Line 296... |
Line 347... |
296 |
}
|
347 |
}
|
297 |
|
348 |
|
298 |
// Ajout d'un titre pour la page avec la date
|
349 |
// Ajout d'un titre pour la page avec la date
|
299 |
$jours = array ('lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi', 'dimanche') ;
|
350 |
$jours = array ('lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi', 'dimanche') ;
|
300 |
$mois = array ('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre',
|
351 |
$mois = array ('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre',
|
- |
|
352 |
'octobre', 'novembre', 'décembre') ;
|
- |
|
353 |
$timestamp = strtotime ($_GET['y'].'/'.$_GET['m'].'/'.$_GET['d']) ;
|
- |
|
354 |
|
301 |
'octobre', 'novembre', 'décembre') ;
|
355 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_NAVIGATION'] = '';
|
302 |
$timestamp = strtotime ($_GET['y'].'/'.$_GET['m'].'/'.$_GET['d']) ;
|
356 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_TETE'] = '';
|
303 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_CORPS'] = '<h1>'.$jours[date('w', $timestamp)].
|
357 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_CORPS'] = '<h1>'.$jours[date('w', $timestamp)].
|
- |
|
358 |
' '.$_GET['d'].' '.$mois[$_GET['m']-1].' '.$_GET['y'].'</h1>' ;
|
- |
|
359 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_CORPS'] .= baz_voir_fiches(0,$_GET['id_fiches'] );
|
304 |
' '.$_GET['d'].' '.$mois[$_GET['m']-1].' '.$_GET['y'].'</h1>' ;
|
360 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_PIED'] = '';
|
Line 305... |
Line 361... |
305 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_CORPS'] .= baz_voir_fiches(0,$_GET['id_fiches'] );
|
361 |
$GLOBALS['_GEN_commun']['info_menu'] = '';
|
Line 306... |
Line 362... |
306 |
}
|
362 |
}
|