| Line 23... |
Line 23... |
| 23 |
/**
|
23 |
/**
|
| 24 |
*
|
24 |
*
|
| 25 |
* Fonctions calendrier du module bazar
|
25 |
* Fonctions calendrier du module bazar
|
| 26 |
*
|
26 |
*
|
| 27 |
* TODO : ajouter la gestion du multilinguisme
|
27 |
* TODO : ajouter la gestion du multilinguisme
|
| 28 |
*
|
28 |
*
|
| 29 |
*@package bazar
|
29 |
*@package bazar
|
| 30 |
//Auteur original :
|
30 |
//Auteur original :
|
| 31 |
*@author David Delon <david.delon@clapas.net>
|
31 |
*@author David Delon <david.delon@clapas.net>
|
| 32 |
//Autres auteurs :
|
32 |
//Autres auteurs :
|
| 33 |
*@copyright Tela-Botanica 2000-2004
|
33 |
*@copyright Tela-Botanica 2000-2004
|
| Line 39... |
Line 39... |
| 39 |
// | ENTETE du PROGRAMME |
|
39 |
// | ENTETE du PROGRAMME |
|
| 40 |
// +------------------------------------------------------------------------------------------------------+
|
40 |
// +------------------------------------------------------------------------------------------------------+
|
| Line 41... |
Line 41... |
| 41 |
|
41 |
|
| 42 |
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Month/Weekdays.php';
|
42 |
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Month/Weekdays.php';
|
| 43 |
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Day.php';
|
43 |
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Day.php';
|
| Line 44... |
Line 44... |
| 44 |
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Decorator.php';
|
44 |
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Decorator.php';
|
| 45 |
|
45 |
|
| 46 |
// +------------------------------------------------------------------------------------------------------+
|
46 |
// +------------------------------------------------------------------------------------------------------+
|
| Line 55... |
Line 55... |
| 55 |
Calendar_Decorator::Calendar_Decorator($calendar);
|
55 |
Calendar_Decorator::Calendar_Decorator($calendar);
|
| 56 |
}
|
56 |
}
|
| 57 |
function setEntry($entry)
|
57 |
function setEntry($entry)
|
| 58 |
{
|
58 |
{
|
| 59 |
$this->entry[] = $entry;
|
59 |
$this->entry[] = $entry;
|
| 60 |
|
60 |
|
| 61 |
}
|
61 |
}
|
| 62 |
function getEntry()
|
62 |
function getEntry()
|
| 63 |
{
|
63 |
{
|
| 64 |
return $this->entry;
|
64 |
return $this->entry;
|
| 65 |
}
|
65 |
}
|
| 66 |
}
|
66 |
}
|
| Line 67... |
Line 67... |
| 67 |
|
67 |
|
| 68 |
|
68 |
|
| 69 |
// $type : calendrier
|
69 |
// $type : calendrier
|
| Line 74... |
Line 74... |
| 74 |
$balise = isset ($arguments[0]) ? $arguments[0] : '';
|
74 |
$balise = isset ($arguments[0]) ? $arguments[0] : '';
|
| 75 |
$tab_arguments = $arguments;
|
75 |
$tab_arguments = $arguments;
|
| 76 |
if (is_string ($tab_arguments)) {
|
76 |
if (is_string ($tab_arguments)) {
|
| 77 |
$tab_arguments = substr($tab_arguments, 1);
|
77 |
$tab_arguments = substr($tab_arguments, 1);
|
| 78 |
} else {
|
78 |
} else {
|
| 79 |
unset($tab_arguments[0]);
|
79 |
unset($tab_arguments[0]);
|
| 80 |
}
|
80 |
}
|
| 81 |
if (is_array($tab_arguments)) {
|
81 |
if (is_array($tab_arguments)) {
|
| 82 |
foreach($tab_arguments as $argument) {
|
82 |
foreach($tab_arguments as $argument) {
|
| 83 |
if ($argument != '') {
|
83 |
if ($argument != '') {
|
| 84 |
$tab_parametres = explode('=', $argument, 2);
|
84 |
$tab_parametres = explode('=', $argument, 2);
|
| 85 |
if (is_array($tab_parametres)) {
|
85 |
if (is_array($tab_parametres)) {
|
| 86 |
$options[$tab_parametres[0]] =
|
86 |
$options[$tab_parametres[0]] =
|
| 87 |
(isset($tab_parametres[1])? trim($tab_parametres[1], '"') : '') ;
|
87 |
(isset($tab_parametres[1])? trim($tab_parametres[1], '"') : '') ;
|
| 88 |
}
|
88 |
}
|
| 89 |
}
|
89 |
}
|
| 90 |
}
|
90 |
}
|
| 91 |
}
|
91 |
}
|
| 92 |
|
92 |
|
| 93 |
if (!isset($options['template'])) {
|
93 |
if (!isset($options['template'])) {
|
| 94 |
$options['template'] = BAZ_CHEMIN_SQUELETTE.BAZ_SQUELETTE_DEFAUT;
|
94 |
$options['template'] = BAZ_CHEMIN_SQUELETTE.BAZ_SQUELETTE_DEFAUT;
|
| 95 |
} else {
|
95 |
} else {
|
| 96 |
if (file_exists(BAZ_CHEMIN_SQUELETTE.$options['template'])) {
|
96 |
if (file_exists(BAZ_CHEMIN_SQUELETTE.$options['template'])) {
|
| 97 |
$options['template'] = BAZ_CHEMIN_SQUELETTE.$options['template'];
|
97 |
$options['template'] = BAZ_CHEMIN_SQUELETTE.$options['template'];
|
| 98 |
}
|
98 |
}
|
| 99 |
}
|
99 |
}
|
| 100 |
|
100 |
|
| 101 |
$retour = '';
|
101 |
$retour = '';
|
| Line 102... |
Line 102... |
| 102 |
|
102 |
|
| 103 |
$url = $GLOBALS['_GEN_commun']['url'] ;
|
103 |
$url = $GLOBALS['_GEN_commun']['url'] ;
|
| 104 |
$db =& $GLOBALS['_GEN_commun']['pear_db'] ;
|
104 |
$db =& $GLOBALS['_GEN_commun']['pear_db'] ;
|
| 105 |
$auth =& $GLOBALS['_GEN_commun']['pear_auth'] ;
|
105 |
$auth =& $GLOBALS['_GEN_commun']['pear_auth'] ;
|
| 106 |
|
106 |
|
| 107 |
// Nettoyage de l'url de la query string
|
107 |
// Nettoyage de l'url de la query string
|
| 108 |
$chaine_url = $url->getQueryString();
|
108 |
$chaine_url = $url->getQueryString();
|
| 109 |
$tab_params = explode('&', $chaine_url);
|
109 |
$tab_params = explode('&', $chaine_url);
|
| 110 |
if (count($tab_params) == 0) {
|
110 |
if (count($tab_params) == 0) {
|
| 111 |
$tab_params = explode('&', $chaine_url);
|
111 |
$tab_params = explode('&', $chaine_url);
|
| 112 |
}
|
112 |
}
|
| 113 |
foreach ($tab_params as $param) {
|
113 |
foreach ($tab_params as $param) {
|
| 114 |
$tab_parametre = explode('=', $param);
|
114 |
$tab_parametre = explode('=', $param);
|
| 115 |
$url->removeQueryString($tab_parametre[0]);
|
115 |
$url->removeQueryString($tab_parametre[0]);
|
| 116 |
}
|
116 |
}
|
| 117 |
|
117 |
|
| 118 |
if (!isset($_GET['y'])) {
|
118 |
if (!isset($_GET['y'])) {
|
| 119 |
$_GET['y'] = date('Y');
|
119 |
$_GET['y'] = date('Y');
|
| 120 |
}
|
120 |
}
|
| 121 |
|
121 |
|
| 122 |
if (!isset($_GET['m'])) {
|
122 |
if (!isset($_GET['m'])) {
|
| 123 |
$_GET['m'] = date('m');
|
123 |
$_GET['m'] = date('m');
|
| 124 |
}
|
124 |
}
|
| 125 |
|
125 |
|
| 126 |
// Construction Mois en Cours
|
126 |
// Construction Mois en Cours
|
| Line 127... |
Line 127... |
| 127 |
$month = new Calendar_Month_Weekdays($_GET['y'],$_GET['m']);
|
127 |
$month = new Calendar_Month_Weekdays($_GET['y'],$_GET['m']);
|
| 128 |
|
128 |
|
| 129 |
$curStamp = $month->getTimeStamp();
|
129 |
$curStamp = $month->getTimeStamp();
|
| Line 165... |
Line 165... |
| 165 |
}
|
165 |
}
|
| Line 166... |
Line 166... |
| 166 |
|
166 |
|
| 167 |
// Gestion des champs cachés pour le formulaire de filtre
|
167 |
// Gestion des champs cachés pour le formulaire de filtre
|
| 168 |
// Attention à la position dans le fichier...
|
168 |
// Attention à la position dans le fichier...
|
| 169 |
$ficnat_chps_cache = $url->querystring;
|
169 |
$ficnat_chps_cache = $url->querystring;
|
| 170 |
unset($ficnat_chps_cache['ficnat']);
|
170 |
unset($ficnat_chps_cache['ficnat']);
|
| 171 |
|
171 |
|
| 172 |
// Navigation
|
172 |
// Navigation
|
| 173 |
$prevStamp = $month->prevMonth(true);
|
173 |
$prevStamp = $month->prevMonth(true);
|
| 174 |
$url->addQueryString('y', date('Y',$prevStamp));
|
174 |
$url->addQueryString('y', date('Y',$prevStamp));
|
| 175 |
$url->addQueryString('m', date('n',$prevStamp));
|
175 |
$url->addQueryString('m', date('n',$prevStamp));
|
| 176 |
$url->addQueryString('d', date('j',$prevStamp));
|
176 |
$url->addQueryString('d', date('j',$prevStamp));
|
| 177 |
$prev = $url->getUrl();
|
177 |
$prev = $url->getUrl();
|
| 178 |
|
178 |
|
| 179 |
$nextStamp = $month->nextMonth(true);
|
179 |
$nextStamp = $month->nextMonth(true);
|
| 180 |
$url->addQueryString('y', date('Y',$nextStamp));
|
180 |
$url->addQueryString('y', date('Y',$nextStamp));
|
| 181 |
$url->addQueryString('m', date('n',$nextStamp));
|
181 |
$url->addQueryString('m', date('n',$nextStamp));
|
| 182 |
$url->addQueryString('d', date('j',$nextStamp));
|
182 |
$url->addQueryString('d', date('j',$nextStamp));
|
| 183 |
$next = $url->getUrl();
|
183 |
$next = $url->getUrl();
|
| 184 |
|
184 |
|
| 185 |
// Suppression du paramêtre de troncage des titres
|
185 |
// Suppression du paramêtre de troncage des titres
|
| 186 |
$url->removeQueryString('tt');
|
186 |
$url->removeQueryString('tt');
|
| 187 |
|
187 |
|
| 188 |
$fr_month = array( "1"=>BAZ_JANVIER,"2"=>BAZ_FEVRIER,"3"=>BAZ_MARS,"4"=>BAZ_AVRIL,"5"=>BAZ_MAI,"6"=>BAZ_JUIN,
|
188 |
$fr_month = array( "1"=>BAZ_JANVIER,"2"=>BAZ_FEVRIER,"3"=>BAZ_MARS,"4"=>BAZ_AVRIL,"5"=>BAZ_MAI,"6"=>BAZ_JUIN,
|
| Line 189... |
Line 189... |
| 189 |
"7"=>BAZ_JUILLET,"8"=>BAZ_AOUT,"9"=>BAZ_SEPTEMBRE,"10"=>BAZ_OCTOBRE,"11"=>BAZ_NOVEMBRE,"12"=>BAZ_DECEMBRE);
|
189 |
"7"=>BAZ_JUILLET,"8"=>BAZ_AOUT,"9"=>BAZ_SEPTEMBRE,"10"=>BAZ_OCTOBRE,"11"=>BAZ_NOVEMBRE,"12"=>BAZ_DECEMBRE);
|
| 190 |
|
190 |
|
| 191 |
// Récupération des infos sur les natures des fiches pour le filtre
|
191 |
// Récupération des infos sur les natures des fiches pour le filtre
|
| 192 |
$requete_nature_fiche = 'SELECT DISTINCT bn_id_nature, bn_ce_i18n, bn_label_nature '.
|
192 |
$requete_nature_fiche = 'SELECT DISTINCT bn_id_nature, bn_ce_i18n, bn_label_nature '.
|
| 193 |
'FROM bazar_nature '.
|
193 |
'FROM bazar_nature '.
|
| 194 |
'WHERE bn_id_nature IN ('.BAZ_NUM_ANNONCE_CALENDRIER.') ';
|
194 |
'WHERE bn_id_nature IN ('.BAZ_NUM_ANNONCE_CALENDRIER.') ';
|
| 195 |
$resultat_nature_fiche = $db->query($requete_nature_fiche);
|
195 |
$resultat_nature_fiche = $db->query($requete_nature_fiche);
|
| 196 |
(DB::isError($resultat_nature_fiche)) ? trigger_error(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_nature_fiche->getMessage(), $requete_nature_fiche), E_USER_WARNING) : '';
|
196 |
(DB::isError($resultat_nature_fiche)) ? trigger_error(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_nature_fiche->getMessage(), $requete_nature_fiche), E_USER_WARNING) : '';
|
| 197 |
|
197 |
|
| 198 |
// Ajout du javascript et des styles du bazar
|
198 |
// Ajout du javascript et des styles du bazar
|
| 199 |
if (defined('PAP_VERSION')) { //si on est dans Papyrus
|
199 |
if (defined('PAP_VERSION')) { //si on est dans Papyrus
|
| 200 |
GEN_stockerStyleExterne( 'bazar_interne', 'client/bazar/bazar.interne.css');
|
200 |
GEN_stockerStyleExterne( 'bazar_interne', 'client/bazar/bazar.interne.css');
|
| 201 |
GEN_stockerFichierScript('domLib', '/api/js/domtooltip/domLib.js');
|
201 |
GEN_stockerFichierScript('domLib', '/api/js/domtooltip/domLib.js');
|
| 202 |
GEN_stockerFichierScript('domTT', '/api/js/domtooltip/domTT.js');
|
202 |
GEN_stockerFichierScript('domTT', '/api/js/domtooltip/domTT.js');
|
| 203 |
|
203 |
|
| 204 |
// DomToolTip
|
204 |
// DomToolTip
|
| 205 |
$script = 'var domTT_styleClass = "niceTitle";'."\n";
|
205 |
$script = 'var domTT_styleClass = "niceTitle";'."\n";
|
| 206 |
$script .= 'function nicetitleDecorator(el) {'."\n";
|
206 |
$script .= 'function nicetitleDecorator(el) {'."\n";
|
| Line 212... |
Line 212... |
| 212 |
$script .= ' return result;'."\n";
|
212 |
$script .= ' return result;'."\n";
|
| 213 |
$script .= '}'."\n";
|
213 |
$script .= '}'."\n";
|
| 214 |
$script .= 'domTT_replaceTitles(nicetitleDecorator);'."\n";
|
214 |
$script .= 'domTT_replaceTitles(nicetitleDecorator);'."\n";
|
| 215 |
GEN_stockerCodeScript('var domTT_styleClass = "niceTitle";'."\n");
|
215 |
GEN_stockerCodeScript('var domTT_styleClass = "niceTitle";'."\n");
|
| 216 |
}
|
216 |
}
|
| 217 |
|
217 |
|
| 218 |
// Titre
|
218 |
// Titre
|
| 219 |
if ($type == 'calendrier') {
|
219 |
if ($type == 'calendrier') {
|
| 220 |
$retour .= '<div id="cal_entete">'."\n";
|
220 |
$retour .= '<div id="cal_entete">'."\n";
|
| 221 |
$retour .= '<span class="cal_navigation">'."\n";
|
221 |
$retour .= '<span class="cal_navigation">'."\n";
|
| 222 |
$retour .= '<a id="cal_precedent_lien" href="'.$prev.'" title="Allez au mois précédent"><img id="cal_precedent_img" src="client/bazar/images/cal_precedent.png" alt="<<"/></a>'."\n";
|
222 |
$retour .= '<a id="cal_precedent_lien" href="'.$prev.'" title="Allez au mois précédent"><img id="cal_precedent_img" src="client/bazar/images/cal_precedent.png" alt="<<"/></a>'."\n";
|
| 223 |
$retour .= ' '."\n";
|
223 |
$retour .= ' '."\n";
|
| 224 |
$retour .= '<span id="cal_encadre_mois_courrant"><a id="cal_mois_courrant" href="'.$cur.'">';
|
224 |
$retour .= '<span id="cal_encadre_mois_courrant"><a id="cal_mois_courrant" href="'.$cur.'">';
|
| 225 |
$retour .= $fr_month[(date('n',$curStamp))];
|
225 |
$retour .= $fr_month[(date('n',$curStamp))];
|
| 226 |
$retour .= ' ';
|
226 |
$retour .= ' ';
|
| 227 |
$retour .= (date('Y',$curStamp));
|
227 |
$retour .= (date('Y',$curStamp));
|
| 228 |
$retour .= '</a></span>'."\n";
|
228 |
$retour .= '</a></span>'."\n";
|
| 229 |
$retour .= ' '."\n";
|
229 |
$retour .= ' '."\n";
|
| 230 |
$retour .= '<a id="cal_suivant_lien" href="'.$next.'" title="Allez au mois suivant"><img id="cal_suivant_img" src="client/bazar/images/cal_suivant.png" alt=">>"/></a>'."\n";
|
230 |
$retour .= '<a id="cal_suivant_lien" href="'.$next.'" title="Allez au mois suivant"><img id="cal_suivant_img" src="client/bazar/images/cal_suivant.png" alt=">>"/></a>'."\n";
|
| 231 |
$retour .= '</span>'."\n";
|
231 |
$retour .= '</span>'."\n";
|
| 232 |
$retour .= '<h1 id="cal_titre"><img id="cal_titre_img" src="client/bazar/images/cal_titre.png" alt="Calendrier"/></h1>'."\n";
|
232 |
$retour .= '<h1 id="cal_titre"><img id="cal_titre_img" src="client/bazar/images/cal_titre.png" alt="Calendrier"/></h1>'."\n";
|
| 233 |
$retour .= '</div>'."\n";
|
233 |
$retour .= '</div>'."\n";
|
| 234 |
|
234 |
|
| 235 |
$retour .= '<form action="'.$tc_lien.'" method="get">'."\n";
|
235 |
$retour .= '<form action="'.$tc_lien.'" method="get">'."\n";
|
| 236 |
$retour .= '<a href="'.$tc_lien.'">'.$tc_txt.'</a>'."\n";
|
236 |
$retour .= '<a href="'.$tc_lien.'">'.$tc_txt.'</a>'."\n";
|
| 237 |
$retour .= '<fieldset>'."\n";
|
237 |
$retour .= '<fieldset>'."\n";
|
| 238 |
$retour .= '<legend>'.'Filtrer : '.'</legend>'."\n";
|
238 |
$retour .= '<legend>'.'Filtrer : '.'</legend>'."\n";
|
| 239 |
$retour .= '<select id="ficnat" name="ficnat" class="filtre_'.((!is_null($ficnat_id)) ? $ficnat_id: 'tous').'" onchange="javascript:this.form.submit();">'."\n";
|
239 |
$retour .= '<select id="ficnat" name="ficnat" class="filtre_'.((!is_null($ficnat_id)) ? $ficnat_id: 'tous').'" onchange="javascript:this.form.submit();">'."\n";
|
| 240 |
|
240 |
|
| 241 |
$retour .= '<option id="filtre_tous" value="*" ';
|
241 |
$retour .= '<option id="filtre_tous" value="*" ';
|
| 242 |
if (isset($_GET['ficnat']) && '*' == $_GET['ficnat']) {
|
242 |
if (isset($_GET['ficnat']) && '*' == $_GET['ficnat']) {
|
| 243 |
$retour .= 'selected="selected" ';
|
243 |
$retour .= 'selected="selected" ';
|
| 244 |
}
|
244 |
}
|
| 245 |
$retour .= '>'.'Tout afficher'.'</option>';
|
245 |
$retour .= '>'.'Tout afficher'.'</option>';
|
| 246 |
|
246 |
|
| 247 |
while ($ligne_nature_fiche = $resultat_nature_fiche->fetchRow(DB_FETCHMODE_OBJECT)) {
|
247 |
while ($ligne_nature_fiche = $resultat_nature_fiche->fetchRow(DB_FETCHMODE_OBJECT)) {
|
| 248 |
$opt = '<option class="filtre_'.$ligne_nature_fiche->bn_id_nature.'" value="'.$ligne_nature_fiche->bn_id_nature.'" ';
|
248 |
$opt = '<option class="filtre_'.$ligne_nature_fiche->bn_id_nature.'" value="'.$ligne_nature_fiche->bn_id_nature.'" ';
|
| 249 |
if (isset($_GET['ficnat']) && $ligne_nature_fiche->bn_id_nature == $_GET['ficnat']) {
|
249 |
if (isset($_GET['ficnat']) && $ligne_nature_fiche->bn_id_nature == $_GET['ficnat']) {
|
| 250 |
$opt .= 'selected="selected" ';
|
250 |
$opt .= 'selected="selected" ';
|
| 251 |
}
|
251 |
}
|
| 252 |
$opt .= '>';
|
252 |
$opt .= '>';
|
| 253 |
|
253 |
|
| 254 |
$retour .= $opt.$ligne_nature_fiche->bn_label_nature.'</option>'."\n";
|
254 |
$retour .= $opt.$ligne_nature_fiche->bn_label_nature.'</option>'."\n";
|
| 255 |
}
|
255 |
}
|
| 256 |
|
256 |
|
| 257 |
$retour .= '</select>'."\n";
|
257 |
$retour .= '</select>'."\n";
|
| 258 |
$retour .= '<input id="ficnat_ok" type="submit" value="'.'OK'.'" onload="javascript:this.setAttribute(\'style\', \'display:none;\')"/>'."\n";
|
258 |
$retour .= '<input id="ficnat_ok" type="submit" value="'.'OK'.'" onload="javascript:this.setAttribute(\'style\', \'display:none;\')"/>'."\n";
|
| 259 |
$script_ok = 'if (document.getElementById(\'ficnat_ok\')) {'.
|
259 |
$script_ok = 'if (document.getElementById(\'ficnat_ok\')) {'.
|
| 260 |
' document.getElementById(\'ficnat_ok\').style.display = \'none\';'.
|
260 |
' document.getElementById(\'ficnat_ok\').style.display = \'none\';'.
|
| 261 |
'}';
|
261 |
'}';
|
| Line 263... |
Line 263... |
| 263 |
foreach ($ficnat_chps_cache as $cle => $val) {
|
263 |
foreach ($ficnat_chps_cache as $cle => $val) {
|
| 264 |
$retour .= '<input id="'.$cle.'" name="'.$cle.'" type="hidden" value="'.$val.'" />'."\n";
|
264 |
$retour .= '<input id="'.$cle.'" name="'.$cle.'" type="hidden" value="'.$val.'" />'."\n";
|
| 265 |
}
|
265 |
}
|
| 266 |
$retour .= '</fieldset>'."\n";
|
266 |
$retour .= '</fieldset>'."\n";
|
| 267 |
$retour .= '</form>'."\n";
|
267 |
$retour .= '</form>'."\n";
|
| 268 |
|
268 |
|
| 269 |
} else {
|
269 |
} else {
|
| 270 |
// Appel du template
|
270 |
// Appel du template
|
| 271 |
ob_start();
|
271 |
ob_start();
|
| 272 |
include $options['template'];
|
272 |
include $options['template'];
|
| 273 |
$retour .= ob_get_contents();
|
273 |
$retour .= ob_get_contents();
|
| 274 |
ob_end_clean();
|
274 |
ob_end_clean();
|
| 275 |
}
|
275 |
}
|
| 276 |
// Vue Mois calendrier ou vue applette
|
276 |
// Vue Mois calendrier ou vue applette
|
| 277 |
|
277 |
|
| 278 |
if ((!isset($_GET['id_fiche']) && $type == 'calendrier') || ($type == 'calendrier_applette')){
|
278 |
if ((!isset($_GET['id_fiche']) && $type == 'calendrier') || ($type == 'calendrier_applette')){
|
| 279 |
// trigger_error('ICI', E_USER_NOTICE);
|
279 |
// trigger_error('ICI', E_USER_NOTICE);
|
| 280 |
// Recherche evenement de la periode selectionnée
|
280 |
// Recherche evenement de la periode selectionnée
|
| 281 |
$ts_jour_fin_mois = $month->nextMonth('timestamp');
|
281 |
$ts_jour_fin_mois = $month->nextMonth('timestamp');
|
| 282 |
$ts_jour_debut_mois = $month->thisMonth('timestamp');;
|
282 |
$ts_jour_debut_mois = $month->thisMonth('timestamp');;
|
| 283 |
$requete_evenements = "SELECT DISTINCT bf_id_fiche, bf_titre, bf_lieu_evenement, ".
|
283 |
$requete_evenements = "SELECT DISTINCT bf_id_fiche, bf_titre, bf_lieu_evenement, ".
|
| 284 |
" DAY(bf_date_debut_evenement) AS bf_jour_debut_evenement, bf_date_debut_evenement, ".
|
284 |
" DAY(bf_date_debut_evenement) AS bf_jour_debut_evenement, bf_date_debut_evenement, ".
|
| 285 |
" bf_date_fin_evenement, bf_description, bn_id_nature ".
|
285 |
" bf_date_fin_evenement, bf_description, bn_id_nature ".
|
| 286 |
"FROM bazar_fiche, bazar_nature ".
|
286 |
"FROM bazar_fiche, bazar_nature ".
|
| 287 |
"WHERE bf_date_debut_evenement < '".date('Y-m-d', $ts_jour_fin_mois)."' ".
|
287 |
"WHERE bf_date_debut_evenement < '".date('Y-m-d', $ts_jour_fin_mois)."' ".
|
| 288 |
"AND bf_date_fin_evenement >= '".date('Y-m-d', $ts_jour_debut_mois)."' ".
|
288 |
"AND bf_date_fin_evenement >= '".date('Y-m-d', $ts_jour_debut_mois)."' ".
|
| 289 |
"AND bf_ce_nature = bn_id_nature ".
|
289 |
"AND bf_ce_nature = bn_id_nature ".
|
| 290 |
"AND bn_id_nature IN (".$cal_num_annonce.") ".
|
290 |
"AND bn_id_nature IN (".$cal_num_annonce.") ".
|
| 291 |
"AND bf_statut_fiche = 1 ".
|
291 |
"AND bf_statut_fiche = 1 ".
|
| 292 |
"ORDER BY bf_jour_debut_evenement";
|
292 |
"ORDER BY bf_jour_debut_evenement";
|
| 293 |
|
293 |
|
| 294 |
$resultat_evenement = $db->query($requete_evenements);
|
294 |
$resultat_evenement = $db->query($requete_evenements);
|
| 295 |
|
295 |
|
| 296 |
(DB::isError($resultat_evenement)) ? trigger_error(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_evenement->getMessage(), $requete_evenements), E_USER_WARNING) : '';
|
296 |
(DB::isError($resultat_evenement)) ? trigger_error(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_evenement->getMessage(), $requete_evenements), E_USER_WARNING) : '';
|
| Line 297... |
Line 297... |
| 297 |
|
297 |
|
| 298 |
$selection = array();
|
298 |
$selection = array();
|
| 299 |
$evenements = array();
|
299 |
$evenements = array();
|
| 300 |
$annee = date('Y', $curStamp);
|
300 |
$annee = date('Y', $curStamp);
|
| 301 |
$mois = date('m', $curStamp);
|
301 |
$mois = date('m', $curStamp);
|
| 302 |
$tablo_jours = array();
|
302 |
$tablo_jours = array();
|
| 303 |
while ($ligne_evenements = $resultat_evenement->fetchRow(DB_FETCHMODE_OBJECT)) {
|
303 |
while ($ligne_evenements = $resultat_evenement->fetchRow(DB_FETCHMODE_OBJECT)) {
|
| 304 |
list($annee_debut, $mois_debut, $jour_debut) = explode('-', $ligne_evenements->bf_date_debut_evenement);
|
304 |
list($annee_debut, $mois_debut, $jour_debut) = explode('-', $ligne_evenements->bf_date_debut_evenement);
|
| 305 |
list($annee_fin, $mois_fin, $jour_fin) = explode('-', $ligne_evenements->bf_date_fin_evenement);
|
305 |
list($annee_fin, $mois_fin, $jour_fin) = explode('-', $ligne_evenements->bf_date_fin_evenement);
|
| 306 |
|
306 |
|
| 307 |
$Calendrier = new Calendar($annee_debut, $mois_debut, $jour_debut);
|
307 |
$Calendrier = new Calendar($annee_debut, $mois_debut, $jour_debut);
|
| 308 |
$ts_jour_suivant = $Calendrier->thisDay('timestamp');
|
308 |
$ts_jour_suivant = $Calendrier->thisDay('timestamp');
|
| 309 |
$ts_jour_fin = mktime(0,0,0,$mois_fin, $jour_fin, $annee_fin);
|
309 |
$ts_jour_fin = mktime(0,0,0,$mois_fin, $jour_fin, $annee_fin);
|
| 310 |
|
- |
|
| 311 |
if ($ts_jour_suivant < $ts_jour_fin) {
|
- |
|
| 312 |
//echo "$ts_jour_suivant-";
|
310 |
|
| 313 |
$naviguer = true;
|
- |
|
| 314 |
while ($naviguer) {
|
- |
|
| 315 |
// Si le jours suivant est inférieur à la date de fin, on continue...
|
311 |
$naviguer = true;
|
| 316 |
if ($ts_jour_suivant <= $ts_jour_fin) {
|
312 |
while ($naviguer && ($ts_jour_suivant <= $ts_jour_fin)) {
|
| 317 |
// Si le jours suivant est inférieur à la date de fin du mois courrant, on continue...
|
313 |
// Si le jours suivant est inferieur a la date de fin du mois courrant, on continue...
|
| 318 |
if ($ts_jour_suivant < $ts_jour_fin_mois) {
|
314 |
if ($ts_jour_suivant < $ts_jour_fin_mois) {
|
| 319 |
$cle_j = date('Y-m-d', $ts_jour_suivant);
|
315 |
$cle_j = date('Y-m-d', $ts_jour_suivant);
|
| 320 |
if (!isset($tablo_jours[$cle_j])) {
|
316 |
if (!isset($tablo_jours[$cle_j])) {
|
| 321 |
$tablo_jours[$cle_j]['Calendar_Day'] = new Calendar_Day(date('Y', $ts_jour_suivant),date('m', $ts_jour_suivant), date('d', $ts_jour_suivant));
|
317 |
$tablo_jours[$cle_j]['Calendar_Day'] = new Calendar_Day(date('Y', $ts_jour_suivant),date('m', $ts_jour_suivant), date('d', $ts_jour_suivant));
|
| 322 |
$tablo_jours[$cle_j]['Diary_Event'] = new DiaryEvent($tablo_jours[$cle_j]['Calendar_Day']);
|
- |
|
| 323 |
}
|
- |
|
| 324 |
$tablo_jours[$cle_j]['Diary_Event']->setEntry($ligne_evenements);
|
- |
|
| 325 |
|
- |
|
| 326 |
$ts_jour_suivant = $Calendrier->nextDay('timestamp');
|
- |
|
| 327 |
//echo "ici$ts_jour_suivant-";
|
- |
|
| 328 |
$Calendrier->setTimestamp($ts_jour_suivant);
|
- |
|
| 329 |
//echo "la".$Calendrier->thisDay('timestamp')."-";
|
- |
|
| 330 |
} else {
|
- |
|
| 331 |
$naviguer = false;
|
- |
|
| 332 |
}
|
- |
|
| 333 |
} else {
|
- |
|
| 334 |
$naviguer = false;
|
318 |
$tablo_jours[$cle_j]['Diary_Event'] = new DiaryEvent($tablo_jours[$cle_j]['Calendar_Day']);
|
| - |
|
319 |
}
|
| - |
|
320 |
$tablo_jours[$cle_j]['Diary_Event']->setEntry($ligne_evenements);
|
| - |
|
321 |
|
| - |
|
322 |
$ts_jour_suivant = $Calendrier->nextDay('timestamp');
|
| - |
|
323 |
//echo "ici$ts_jour_suivant-";
|
| - |
|
324 |
$Calendrier->setTimestamp($ts_jour_suivant);
|
| - |
|
325 |
//echo "la".$Calendrier->thisDay('timestamp')."-";
|
| - |
|
326 |
} else {
|
| 335 |
}
|
327 |
$naviguer = false;
|
| 336 |
}
|
- |
|
| 337 |
} else {
|
- |
|
| 338 |
$curday_ymd = $annee.$mois.$ligne_evenements->bf_jour_debut_evenement;
|
- |
|
| 339 |
$cle_j = $annee.'-'.$mois.'-'.sprintf('%02s', $ligne_evenements->bf_jour_debut_evenement);
|
- |
|
| 340 |
if (!isset($tablo_jours[$cle_j])) {
|
- |
|
| 341 |
$tablo_jours[$cle_j]['Calendar_Day'] = new Calendar_Day($annee, $mois, $ligne_evenements->bf_jour_debut_evenement);
|
- |
|
| 342 |
$tablo_jours[$cle_j]['Diary_Event'] = new DiaryEvent($tablo_jours[$cle_j]['Calendar_Day']);
|
- |
|
| 343 |
}
|
- |
|
| 344 |
$tablo_jours[$cle_j]['Diary_Event']->setEntry($ligne_evenements);
|
328 |
}
|
| 345 |
}
|
329 |
}
|
| - |
|
330 |
}
|
| - |
|
331 |
|
| 346 |
}
|
332 |
|
| 347 |
// Add the decorator to the selection
|
333 |
// Add the decorator to the selection
|
| 348 |
foreach ($tablo_jours as $jour) {
|
334 |
foreach ($tablo_jours as $jour) {
|
| 349 |
$selection[] = $jour['Diary_Event'];
|
335 |
$selection[] = $jour['Diary_Event'];
|
| 350 |
}
|
336 |
}
|
| 351 |
|
337 |
|
| 352 |
// Affichage Calendrier
|
338 |
// Affichage Calendrier
|
| 353 |
$month->build($selection);
|
339 |
$month->build($selection);
|
| 354 |
if ($type == 'calendrier') {
|
340 |
if ($type == 'calendrier') {
|
| 355 |
$retour.= '<table class="calendrier">'.
|
341 |
$retour.= '<table class="calendrier">'.
|
| Line 362... |
Line 348... |
| 362 |
'<col class="cal_samedi"/>'.
|
348 |
'<col class="cal_samedi"/>'.
|
| 363 |
'<col class="cal_dimanche"/>'.
|
349 |
'<col class="cal_dimanche"/>'.
|
| 364 |
'</colgroup>'.
|
350 |
'</colgroup>'.
|
| 365 |
'<thead>'.
|
351 |
'<thead>'.
|
| 366 |
"<tr>
|
352 |
"<tr>
|
| 367 |
|
353 |
|
| 368 |
<th> ". BAZ_LUNDI ."</th>
|
354 |
<th> ". BAZ_LUNDI ."</th>
|
| 369 |
<th> ". BAZ_MARDI ."</th>
|
355 |
<th> ". BAZ_MARDI ."</th>
|
| 370 |
<th> ". BAZ_MERCREDI ."</th>
|
356 |
<th> ". BAZ_MERCREDI ."</th>
|
| 371 |
<th> ". BAZ_JEUDI ."</th>
|
357 |
<th> ". BAZ_JEUDI ."</th>
|
| 372 |
<th> ". BAZ_VENDREDI ."</th>
|
358 |
<th> ". BAZ_VENDREDI ."</th>
|
| Line 385... |
Line 371... |
| 385 |
'<col class="cal_samedi"/>'.
|
371 |
'<col class="cal_samedi"/>'.
|
| 386 |
'<col class="cal_dimanche"/>'.
|
372 |
'<col class="cal_dimanche"/>'.
|
| 387 |
'</colgroup>'.
|
373 |
'</colgroup>'.
|
| 388 |
'<thead>'.
|
374 |
'<thead>'.
|
| 389 |
"<tr>
|
375 |
"<tr>
|
| 390 |
|
376 |
|
| 391 |
<th> ". BAZ_LUNDI_COURT ."</th>
|
377 |
<th> ". BAZ_LUNDI_COURT ."</th>
|
| 392 |
<th> ". BAZ_MARDI_COURT ."</th>
|
378 |
<th> ". BAZ_MARDI_COURT ."</th>
|
| 393 |
<th> ". BAZ_MERCREDI_COURT ."</th>
|
379 |
<th> ". BAZ_MERCREDI_COURT ."</th>
|
| 394 |
<th> ". BAZ_JEUDI_COURT ."</th>
|
380 |
<th> ". BAZ_JEUDI_COURT ."</th>
|
| 395 |
<th> ". BAZ_VENDREDI_COURT ."</th>
|
381 |
<th> ". BAZ_VENDREDI_COURT ."</th>
|
| 396 |
<th> ". BAZ_SAMEDI_COURT ."</th>
|
382 |
<th> ". BAZ_SAMEDI_COURT ."</th>
|
| 397 |
<th> ". BAZ_DIMANCHE_COURT ."</th>
|
383 |
<th> ". BAZ_DIMANCHE_COURT ."</th>
|
| 398 |
</tr>
|
384 |
</tr>
|
| 399 |
".'</thead>'.'<tbody>';
|
385 |
".'</thead>'.'<tbody>';
|
| 400 |
}
|
386 |
}
|
| 401 |
|
387 |
|
| 402 |
$todayStamp=time();
|
388 |
$todayStamp=time();
|
| 403 |
$today_ymd=date('Ymd',$todayStamp);
|
389 |
$today_ymd=date('Ymd',$todayStamp);
|
| Line 404... |
Line 390... |
| 404 |
|
390 |
|
| 405 |
// Other month : mois
|
391 |
// Other month : mois
|
| 406 |
while ($day = $month->fetch() ) {
|
392 |
while ($day = $month->fetch() ) {
|
| 407 |
$dayStamp = $day->thisDay(true);
|
393 |
$dayStamp = $day->thisDay(true);
|
| 408 |
$day_ymd = date('Ymd',$dayStamp);
|
394 |
$day_ymd = date('Ymd',$dayStamp);
|
| 409 |
if ( $day->isEmpty() ) {
|
395 |
if ( $day->isEmpty() ) {
|
| Line 417... |
Line 403... |
| 417 |
} else {
|
403 |
} else {
|
| 418 |
$class="cal_mc current_month";
|
404 |
$class="cal_mc current_month";
|
| 419 |
}
|
405 |
}
|
| 420 |
}
|
406 |
}
|
| 421 |
}
|
407 |
}
|
| 422 |
|
408 |
|
| 423 |
$url->addQueryString ('y', date('Y',$dayStamp));
|
409 |
$url->addQueryString ('y', date('Y',$dayStamp));
|
| 424 |
$url->addQueryString ('m', date('n',$dayStamp));
|
410 |
$url->addQueryString ('m', date('n',$dayStamp));
|
| 425 |
$url->addQueryString ('d', date('j',$dayStamp));
|
411 |
$url->addQueryString ('d', date('j',$dayStamp));
|
| 426 |
$link = $url->getUrl();
|
412 |
$link = $url->getUrl();
|
| 427 |
|
413 |
|
| 428 |
// isFirst() to find start of week
|
414 |
// isFirst() to find start of week
|
| 429 |
if ($day->isFirst()) {
|
415 |
if ($day->isFirst()) {
|
| 430 |
$retour.= ( "<tr>\n" );
|
416 |
$retour.= ( "<tr>\n" );
|
| 431 |
}
|
417 |
}
|
| 432 |
if ($type == 'calendrier') {
|
418 |
if ($type == 'calendrier') {
|
| Line 438... |
Line 424... |
| 438 |
while ($ligne_evenement = array_pop($evenements)) {
|
424 |
while ($ligne_evenement = array_pop($evenements)) {
|
| 439 |
$id_fiches = array();
|
425 |
$id_fiches = array();
|
| 440 |
$id_fiches[] = $ligne_evenement->bf_id_fiche;
|
426 |
$id_fiches[] = $ligne_evenement->bf_id_fiche;
|
| 441 |
$url->addQueryString ('id_fiches',$id_fiches);
|
427 |
$url->addQueryString ('id_fiches',$id_fiches);
|
| 442 |
$link = $url->getUrl();
|
428 |
$link = $url->getUrl();
|
| 443 |
|
429 |
|
| 444 |
if (!isset($_GET['tt']) || (isset($_GET['tt']) && $_GET['tt'] == '1')) {
|
430 |
if (!isset($_GET['tt']) || (isset($_GET['tt']) && $_GET['tt'] == '1')) {
|
| 445 |
$titre_taille = strlen($ligne_evenement->bf_titre);
|
431 |
$titre_taille = strlen($ligne_evenement->bf_titre);
|
| 446 |
$titre = ($titre_taille > 20)?substr($ligne_evenement->bf_titre, 0, 20).'...':$ligne_evenement->bf_titre;
|
432 |
$titre = ($titre_taille > 20)?substr($ligne_evenement->bf_titre, 0, 20).'...':$ligne_evenement->bf_titre;
|
| 447 |
} else {
|
433 |
} else {
|
| 448 |
$titre = $ligne_evenement->bf_titre;
|
434 |
$titre = $ligne_evenement->bf_titre;
|
| Line 472... |
Line 458... |
| 472 |
$url->removeQueryString('id_fiches');
|
458 |
$url->removeQueryString('id_fiches');
|
| 473 |
}
|
459 |
}
|
| 474 |
$retour .= $lien_date;
|
460 |
$retour .= $lien_date;
|
| 475 |
}
|
461 |
}
|
| 476 |
$retour.= ( "</td>\n" );
|
462 |
$retour.= ( "</td>\n" );
|
| 477 |
|
463 |
|
| 478 |
// isLast() to find end of week
|
464 |
// isLast() to find end of week
|
| 479 |
if ( $day->isLast() ) {
|
465 |
if ( $day->isLast() ) {
|
| 480 |
$retour.= ( "</tr>\n" );
|
466 |
$retour.= ( "</tr>\n" );
|
| 481 |
}
|
467 |
}
|
| 482 |
}
|
468 |
}
|
| 483 |
$retour.= "</tbody></table>";
|
469 |
$retour.= "</tbody></table>";
|
| 484 |
}
|
470 |
}
|
| 485 |
$retour.= '<script type="text/javascript">//<![CDATA['."\n".$script.'//]]></script>'."\n";
|
471 |
$retour.= '<script type="text/javascript">//<![CDATA['."\n".$script.'//]]></script>'."\n";
|
| 486 |
// Vue detail
|
472 |
// Vue detail
|
| 487 |
|
473 |
|
| 488 |
if ((isset($_GET['id_fiches']))) {
|
474 |
if ((isset($_GET['id_fiches']))) {
|
| 489 |
// Ajout d'un titre pour la page avec la date
|
475 |
// Ajout d'un titre pour la page avec la date
|
| 490 |
$jours = array ('dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi') ;
|
476 |
$jours = array ('dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi') ;
|
| 491 |
$mois = array ('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre',
|
477 |
$mois = array ('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre',
|
| 492 |
'octobre', 'novembre', 'décembre') ;
|
478 |
'octobre', 'novembre', 'décembre') ;
|
| 493 |
$timestamp = strtotime ($_GET['y'].'/'.$_GET['m'].'/'.$_GET['d']) ;
|
479 |
$timestamp = strtotime ($_GET['y'].'/'.$_GET['m'].'/'.$_GET['d']) ;
|
| 494 |
|
480 |
|
| 495 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_NAVIGATION'] = '';
|
481 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_NAVIGATION'] = '';
|
| 496 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_TETE'] = '';
|
482 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_TETE'] = '';
|
| 497 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_CORPS'] = '<h1>'.$jours[date('w', $timestamp)].
|
483 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_CORPS'] = '<h1>'.$jours[date('w', $timestamp)].
|
| 498 |
' '.$_GET['d'].' '.$mois[$_GET['m']-1].' '.$_GET['y'].'</h1>' ;
|
484 |
' '.$_GET['d'].' '.$mois[$_GET['m']-1].' '.$_GET['y'].'</h1>' ;
|
| 499 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_CORPS'] .= baz_voir_fiches(0,$_GET['id_fiches'] );
|
485 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_CORPS'] .= baz_voir_fiches(0,$_GET['id_fiches'] );
|
| Line 500... |
Line 486... |
| 500 |
|
486 |
|
| 501 |
$GLOBALS['_GEN_commun']['info_menu'] = '';
|
487 |
$GLOBALS['_GEN_commun']['info_menu'] = '';
|
| 502 |
|
488 |
|
| 503 |
// Un lien pour retourner au calendrier
|
489 |
// Un lien pour retourner au calendrier
|
| 504 |
$url->removeQueryString('id_fiches');
|
490 |
$url->removeQueryString('id_fiches');
|
| 505 |
$url->removeQueryString('y');
|
491 |
$url->removeQueryString('y');
|
| 506 |
$url->removeQueryString('m');
|
492 |
$url->removeQueryString('m');
|
| Line 511... |
Line 497... |
| 511 |
// Nettoyage de l'url
|
497 |
// Nettoyage de l'url
|
| 512 |
$url->removeQueryString('id_fiches');
|
498 |
$url->removeQueryString('id_fiches');
|
| 513 |
$url->removeQueryString('y');
|
499 |
$url->removeQueryString('y');
|
| 514 |
$url->removeQueryString('m');
|
500 |
$url->removeQueryString('m');
|
| 515 |
$url->removeQueryString('d');
|
501 |
$url->removeQueryString('d');
|
| 516 |
|
502 |
|
| 517 |
|
503 |
|
| 518 |
return $retour;
|
504 |
return $retour;
|
| 519 |
}
|
505 |
}
|
| 520 |
?>
|
506 |
?>
|
| 521 |
|
507 |
|