Subversion Repositories Applications.bazar

Compare Revisions

Ignore whitespace Rev 382 → Rev 383

/trunk/bibliotheque/bazar.fonct.cal.php
19,17 → 19,19
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bazar.fonct.cal.php,v 1.26 2008-03-13 17:42:10 jp_milcent Exp $
// CVS : $Id: bazar.fonct.cal.php,v 1.27 2008-03-17 18:25:03 jp_milcent Exp $
/**
*
* Fonctions calendrier du module bazar
*
* TODO : ajouter la gestion du multilinguisme
*
*@package bazar
//Auteur original :
*@author David Delon <david.delon@clapas.net>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.26 $ $Date: 2008-03-13 17:42:10 $
*@version $Revision: 1.27 $ $Date: 2008-03-17 18:25:03 $
// +------------------------------------------------------------------------------------------------------+
*/
 
130,6 → 132,15
$url->addQueryString('d', date('j',$curStamp));
$cur = $url->getUrl();
 
// Gestion de l'affichage du filtre des natures d'évènements
$cal_num_annonce = BAZ_NUM_ANNONCE_CALENDRIER;
$ficnat_id = null;
if (isset($_GET['ficnat']) && $_GET['ficnat'] != '*') {
$ficnat_id = $_GET['ficnat'];
$url->addQueryString('ficnat', $_GET['ficnat']);
$cal_num_annonce = $_GET['ficnat'];
}
 
// Gestion de l'affichage des titres des évènements
if (isset($_GET['ctt']) && $_GET['ctt'] == '1') {
$url->addQueryString('tt', '0');
152,6 → 163,11
$tc_txt = 'Tronquer les titres des évènements';
$url->addQueryString('tt', $_GET['tt']);
}
 
// Gestion des champs cachés pour le formulaire de filtre
// Attention à la position dans le fichier...
$ficnat_chps_cache = $url->querystring;
unset($ficnat_chps_cache['ficnat']);
// Navigation
$prevStamp = $month->prevMonth(true);
172,42 → 188,87
$fr_month = array( "1"=>BAZ_JANVIER,"2"=>BAZ_FEVRIER,"3"=>BAZ_MARS,"4"=>BAZ_AVRIL,"5"=>BAZ_MAI,"6"=>BAZ_JUIN,
"7"=>BAZ_JUILLET,"8"=>BAZ_AOUT,"9"=>BAZ_SEPTEMBRE,"10"=>BAZ_OCTOBRE,"11"=>BAZ_NOVEMBRE,"12"=>BAZ_DECEMBRE);
 
// Récupération des infos sur les natures des fiches pour le filtre
$requete_nature_fiche = 'SELECT DISTINCT bn_id_nature, bn_ce_i18n, bn_label_nature '.
'FROM bazar_nature '.
'WHERE bn_id_nature IN ('.BAZ_NUM_ANNONCE_CALENDRIER.') ';
$resultat_nature_fiche = $db->query($requete_nature_fiche);
(DB::isError($resultat_nature_fiche)) ? trigger_error(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_nature_fiche->getMessage(), $requete_nature_fiche), E_USER_WARNING) : '';
// Ajout du javascript
if (defined('PAP_VERSION')) { //si on est dans Papyrus
GEN_stockerStyleExterne( 'bazar_interne', 'client/bazar/bazar.interne.css');
GEN_stockerFichierScript('domLib', '/api/js/domtooltip/domLib.js');
GEN_stockerFichierScript('domTT', '/api/js/domtooltip/domTT.js');
// DomToolTip
$script = 'var domTT_styleClass = "niceTitle";'."\n";
$script .= 'function nicetitleDecorator(el) {'."\n";
$script .= ' var result = el.title;'."\n";
$script .= ' result = result.replace(new RegExp("\n", "g"), "<br />");'."\n";
$script .= ' //if (el.href) {'."\n";
$script .= ' //result += "<p>" + el.href + "<\/p>";'."\n";
$script .= ' //}'."\n";
$script .= ' return result;'."\n";
$script .= '}'."\n";
$script .= 'domTT_replaceTitles(nicetitleDecorator);'."\n";
GEN_stockerCodeScript('var domTT_styleClass = "niceTitle";'."\n");
}
// Titre
if ($type == 'calendrier') {
// Ajout des styles du bazar
if (defined('PAP_VERSION')) { //si on est dans Papyrus
GEN_stockerStyleExterne( 'bazar_interne', 'client/bazar/bazar.interne.css');
GEN_stockerFichierScript('domLib', '/api/js/domtooltip/domLib.js');
GEN_stockerFichierScript('domTT', '/api/js/domtooltip/domTT.js');
// DomToolTip
$script = 'var domTT_styleClass = "niceTitle";'."\n";
$script .= 'function nicetitleDecorator(el) {'."\n";
$script .= ' var result = el.title;'."\n";
$script .= ' result = result.replace(new RegExp("\n", "g"), "<br />");'."\n";
$script .= ' if (el.href) {'."\n";
$script .= ' result += "<p>" + el.href + "</p>";'."\n";
$script .= ' }'."\n";
$script .= ' return result;'."\n";
$script .= '}'."\n";
$script .= 'domTT_replaceTitles(nicetitleDecorator);'."\n";
GEN_stockerCodeScript('var domTT_styleClass = "niceTitle";'."\n");
}
$retour .= '<div id="cal_entete">';
$retour .= '<span class="cal_navigation">';
$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="&lt;&lt;"/></a>';
$retour .= '&nbsp;&nbsp;';
$retour .= '<div id="cal_entete">'."\n";
$retour .= '<span class="cal_navigation">'."\n";
$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="&lt;&lt;"/></a>'."\n";
$retour .= '&nbsp;&nbsp;'."\n";
$retour .= '<span id="cal_encadre_mois_courrant"><a id="cal_mois_courrant" href="'.$cur.'">';
$retour .= $fr_month[(date('n',$curStamp))];
$retour .= '&nbsp;';
$retour .= (date('Y',$curStamp));
$retour .= '</a></span>';
$retour .= '&nbsp;&nbsp;';
$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="&gt;&gt;"/></a>';
$retour .= '</span>';
$retour .= '<h1 id="cal_titre"><img id="cal_titre_img" src="client/bazar/images/cal_titre.png" alt="Calendrier"/></h1>';
$retour .= '</div>';
$retour .= '</a></span>'."\n";
$retour .= '&nbsp;&nbsp;'."\n";
$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="&gt;&gt;"/></a>'."\n";
$retour .= '</span>'."\n";
$retour .= '<h1 id="cal_titre"><img id="cal_titre_img" src="client/bazar/images/cal_titre.png" alt="Calendrier"/></h1>'."\n";
$retour .= '</div>'."\n";
$retour .= '<p>'.'<a href="'.$tc_lien.'">'.$tc_txt.'</a>'.'</p>';
$retour .= '<form action="'.$tc_lien.'" method="get">'."\n";
$retour .= '<a href="'.$tc_lien.'">'.$tc_txt.'</a>'."\n";
$retour .= '<fieldset>'."\n";
$retour .= '<legend>'.'Filtrer : '.'</legend>'."\n";
$retour .= '<select id="ficnat" name="ficnat" class="filtre_'.((!is_null($ficnat_id)) ? $ficnat_id: 'tous').'" onchange="javascript:this.form.submit();">'."\n";
$retour .= '<option id="filtre_tous" value="*" ';
if (isset($_GET['ficnat']) && '*' == $_GET['ficnat']) {
$retour .= 'selected="selected" ';
}
$retour .= '>'.'Tout afficher'.'</option>';
while ($ligne_nature_fiche = $resultat_nature_fiche->fetchRow(DB_FETCHMODE_OBJECT)) {
$opt = '<option class="filtre_'.$ligne_nature_fiche->bn_id_nature.'" value="'.$ligne_nature_fiche->bn_id_nature.'" ';
if (isset($_GET['ficnat']) && $ligne_nature_fiche->bn_id_nature == $_GET['ficnat']) {
$opt .= 'selected="selected" ';
}
$opt .= '>';
$retour .= $opt.$ligne_nature_fiche->bn_label_nature.'</option>'."\n";
}
$retour .= '</select>'."\n";
$retour .= '<input id="ficnat_ok" type="submit" value="'.'OK'.'" onload="javascript:this.setAttribute(\'style\', \'display:none;\')"/>'."\n";
$script_ok = 'if (document.getElementById(\'ficnat_ok\')) {'.
' document.getElementById(\'ficnat_ok\').style.display = \'none\';'.
'}';
$retour.= '<script type="text/javascript">//<![CDATA['."\n".$script_ok.'//]]></script>'."\n";
foreach ($ficnat_chps_cache as $cle => $val) {
$retour .= '<input id="'.$cle.'" name="'.$cle.'" type="hidden" value="'.$val.'" />'."\n";
}
$retour .= '</fieldset>'."\n";
$retour .= '</form>'."\n";
} else {
// Appel du template
ob_start();
222,12 → 283,14
// Recherche evenement de la periode selectionnée
$ts_jour_fin_mois = $month->nextMonth('timestamp');
$ts_jour_debut_mois = $month->thisMonth('timestamp');;
$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 ".
$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, bn_id_nature ".
"FROM bazar_fiche, bazar_nature ".
"WHERE bf_date_debut_evenement < '".date('Y-m-d', $ts_jour_fin_mois)."' ".
"AND bf_date_fin_evenement >= '".date('Y-m-d', $ts_jour_debut_mois)."' ".
"AND bf_ce_nature = bn_id_nature ".
"AND bn_id_nature IN (".BAZ_NUM_ANNONCE_CALENDRIER.") ".
"AND bn_id_nature IN (".$cal_num_annonce.") ".
"AND bf_statut_fiche = 1 ".
"ORDER BY bf_jour_debut_evenement";
387,7 → 450,7
} else {
$titre = $ligne_evenement->bf_titre;
}
$evenemt_xhtml .= '<li class="tooltip" title="'.$ligne_evenement->bf_titre.'"><a class="cal_evenemt" href="'.$link.'">'.$titre.'</a></li>'."\n";
$evenemt_xhtml .= '<li class="tooltip nature_'.$ligne_evenement->bn_id_nature.'" title="'.str_replace('"', '\'', $ligne_evenement->bf_titre).'"><a class="cal_evenemt" href="'.$link.'">'.$titre.'</a></li>'."\n";
$url->removeQueryString ('id_fiches');
}
if ($evenements_nbre > 0) {
399,17 → 462,19
} else {
$lien_date= "<td class=\"".$class."\">".$day->thisDay();
if ($day->isSelected() ) {
$evenements=$day->getEntry();
$id_fiches=array();
while ($ligne_evenement=array_pop($evenements)) {
$id_fiches[]=$ligne_evenement->bf_id_fiche;
$evenements = $day->getEntry();
$id_fiches = array();
$info_fiches = null;
while ($ligne_evenement = array_pop($evenements)) {
$id_fiches[] = $ligne_evenement->bf_id_fiche;
$info_fiches .= '&rArr; '.str_replace('"', '\'', $ligne_evenement->bf_titre)."\n";
}
$url->addQueryString ('id_fiches',$id_fiches);
$url->addQueryString('id_fiches', $id_fiches);
$link = $url->getUrl();
$lien_date= "<td class=\"".$class."\"><a href=\"".$link."\">".$day->thisDay()."</a>\n";
$url->removeQueryString ('id_fiches');
$lien_date = '<td class="'.$class.'"><a href="'.$link.'" class="tooltip" title="'.$info_fiches.'">'.$day->thisDay()."</a>\n";
$url->removeQueryString('id_fiches');
}
$retour.=$lien_date;
$retour .= $lien_date;
}
$retour.= ( "</td>\n" );