Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 485 → Rev 805

/trunk/client/bottin/bibliotheque/annuaire.fonct.php
19,7 → 19,7
// | 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: annuaire.fonct.php,v 1.2 2005-09-29 16:13:54 alexandre_tb Exp $
// CVS : $Id: annuaire.fonct.php,v 1.3 2006-04-04 12:23:05 florian Exp $
/**
* Fonctions du module annuaire
*
31,7 → 31,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
45,51 → 45,169
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
/** function parcourirAnnu () Affiche l'annuaire à partir d'une lettre
/** function inscription_onglets() Affiche les onglets de présentation de la structure
*
*
*
* @return string HTML
*/
function inscription_onglets() {
$res='<ul id="onglets_inscription">'."\n";
//partie présentation
$GLOBALS['ins_url']->addQueryString('voir_fiche', $_GET['voir_fiche']);
$res .= '<li id="fiche"><a href="'.$GLOBALS['ins_url']->getURL().'">'.INS_PRESENTATION.'</a>'."\n".'</li>'."\n";
$GLOBALS['ins_url']->removeQueryString('voir_fiche');
//partie abonnement
$GLOBALS['ins_url']->addQueryString('voir_abonnement', $_GET['voir_fiche']);
$res .= '<li id="abonnements"><a href="'.$GLOBALS['ins_url']->getURL().'">'.INS_ABONNEMENTS.'</a></li>'."\n" ;
$GLOBALS['ins_url']->removeQueryString('voir_abonnement');
//partie actualites
$GLOBALS['ins_url']->addQueryString('voir_actus', $_GET['voir_fiche']);
$res .= '<li id="actus"><a href="'.$GLOBALS['ins_url']->getURL().'">'.INS_ACTUALITES.'</a>'."\n".'</li>'."\n";
$GLOBALS['ins_url']->removeQueryString('voir_actus');
//partie ressources
$GLOBALS['ins_url']->addQueryString('voir_ressources', $_GET['voir_fiche']);
$res .= '<li id="ressources"><a href="'.$GLOBALS['ins_url']->getURL().'">'.INS_RESSOURCES.'</a>'."\n".'</li>'."\n";
$GLOBALS['ins_url']->removeQueryString('voir_ressources');
//partie competences
$GLOBALS['ins_url']->addQueryString('voir_competences', $_GET['voir_fiche']);
$res .= '<li id="competences"><a href="'.$GLOBALS['ins_url']->getURL().'">'.INS_COMPETENCES.'</a>'."\n".'</li>'."\n";
$GLOBALS['ins_url']->removeQueryString('voir_competences');
$res.= '</ul>'."\n";
return $res;
}
 
function parcourirAnnu() {
 
$res = '<div><table><tr>';
 
// ecrire toutes les lettres avec un lien
for ($i = 65 ; $i <91 ; $i++) {
$res .= '<td><a style="font-size:15px;" href="'.$GLOBALS['ins_url']->getURL().'&amp;lettre=';
$res .= chr($i) ;
$res .= '">';
$res .= chr($i) ;
$res .= '</a></td>'."\n";
}
$res .= '</tr></table></div>'."\n";
 
// si une lettre est selectionne
if (!empty($_REQUEST['lettre'])) {
$requete = 'SELECT '.INS_CHAMPS_ID;
foreach($GLOBALS['annuaire_champs_visibles']['champs_db'] as $i) {
$requete .= ', '.$i;
}
/** function Annuaire_recherche () Moteur de recherche dans l'annuaire des inscrits
*
*
*
* @return string HTML
*/
function Annuaire_recherche() {
$res ='<h2>'.INS_RECHERCHE_ANNUAIRE_DES_INSCRITS.'</h2>'."\n";
$form =& new HTML_QuickForm('form_recherche_annuaire', 'post', str_replace('&amp;', '&', $GLOBALS['ins_url']->getURL()));
$squelette =& $form->defaultRenderer();
$squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'<table>'."\n".'{content}'."\n".'</table>'."\n".'</form>'."\n");
$squelette->setElementTemplate( '<tr>'."\n".
'<td style="padding:5px;text-align:right;">{label}'.
'<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
' : </td>'."\n".
'<td style="padding:5px;text-align:left;">{element}</td>'."\n".
'</tr>'."\n" );
$squelette->setElementTemplate( '<tr>'."\n".'<td colspan=2 style="padding:5px;">{label}{element}</td>'."\n".'</tr>'."\n", 'bouton_rechercher');
$option_type=array ('0' => INS_PERSONNES_OU_STRUCTURES,
'1' => INS_PERSONNES,
'2' => INS_STRUCTURES);
$form->addElement('select', 'nom_type', INS_JE_RECHERCHE, $option_type);
//requete pour recuperer la liste des pays
$requete = 'SELECT '.INS_CHAMPS_ID_PAYS.', '.INS_CHAMPS_LABEL_PAYS.' FROM '.INS_TABLE_PAYS.' WHERE '.INS_CHAMPS_I18N_PAYS.'="fr-FR"';
$resultat = $GLOBALS['ins_db']->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
$option_pays = array('zz' => INS_TOUS_PAYS) ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$option_pays[$ligne[INS_CHAMPS_ID_PAYS]] = $ligne[INS_CHAMPS_LABEL_PAYS] ;
}
$form->addElement('select', 'nom_pays', INS_PAYS, $option_pays);
//requete pour recuperer la liste des départements
$requete = 'SELECT '.INS_CHAMPS_ID_DEPARTEMENT.', '.INS_CHAMPS_NOM_DEPARTEMENT.' FROM '.INS_TABLE_DPT;
$resultat = $GLOBALS['ins_db']->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
$option_departements = array('0' => INS_TOUS_DEPARTEMENTS) ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$option_departements[$ligne[INS_CHAMPS_ID_DEPARTEMENT]] = $ligne[INS_CHAMPS_NOM_DEPARTEMENT] ;
}
$form->addElement('select', 'nom_departement', INS_DEPARTEMENT_POUR_LA_FRANCE, $option_departements);
$form->addElement('text', 'nom_annuaire', INS_NOM_ANNUAIRE);
$form->addElement('submit', 'bouton_rechercher', INS_RECHERCHER);
//valeurs par defaut
$defauts=array('nom_pays'=>'fr','nom_departement'=>'0');
$form->setDefaults($defauts);
//affichage du formulaire
$res .=$form->toHtml();
//on teste si l'on affiche le resultat de la recherche ou
if (isset($_POST['nom_type'])) {
$requete = 'SELECT '.INS_CHAMPS_ID.', '.INS_CHAMPS_NOM.', '.INS_CHAMPS_PRENOM.', '.INS_CHAMPS_VILLE.', '.INS_CHAMPS_CODE_POSTAL;
$requete .= ' FROM '.INS_ANNUAIRE.' WHERE ';
if ($_REQUEST['lettre'] != 'tous') {
$requete .= INS_CHAMPS_NOM.' LIKE "'.$_REQUEST['lettre'].'%"';
} else {
$requete .= '1';
$req_where=0;
if ($_POST['nom_type']==1) {
$requete .= INS_CHAMPS_EST_STRUCTURE.'=0 ';
$req_where=1;
} elseif ($_POST['nom_type']==2) {
$requete .= INS_CHAMPS_EST_STRUCTURE.'=1 ';
$req_where=1;
}
$requete .= ' ORDER BY '.INS_CHAMPS_NOM ;
if ($_POST['nom_pays']!='0'and$_POST['nom_pays']!='zz') {
if ($req_where) {
$requete .= 'AND ';
} else {
$req_where=1;
}
$requete .= INS_CHAMPS_PAYS.'="'.$_POST['nom_pays'].'" ';
}
if ($_POST['nom_departement']!='0') {
if ($req_where) {
$requete .= 'AND ';
} else {
$req_where=1;
}
$requete .= INS_CHAMPS_DEPARTEMENT.'="'.$_POST['nom_departement'].'" ';
}
if ($_POST['nom_annuaire']!='') {
if ($req_where) {
$requete .= 'AND ';
} else {
$req_where=1;
}
$requete .= '('.INS_CHAMPS_NOM.' LIKE "%'.$_POST['nom_annuaire'].'%"'.
' OR '.INS_CHAMPS_PRENOM.' LIKE "%'.$_POST['nom_annuaire'].'%"'.
' OR '.INS_CHAMPS_SIGLE_STRUCTURE.' LIKE "%'.$_POST['nom_annuaire'].'%"'.
' OR '.INS_CHAMPS_DESCRIPTION.' LIKE "%'.$_POST['nom_annuaire'].'%") ';
}
if (!$req_where) $requete .= '1';
$requete .=' ORDER BY '.INS_CHAMPS_NOM;
$resultat = $GLOBALS['ins_db']->query($requete);
if ($resultat->numRows()>0) {
$res .='<h2>'.INS_RESULTATS_RECHERCHE.' ('.$resultat->numRows().' '.INS_ENTREES.')</h2>'."\n";
$res .='<p class="zone_info">'.INS_CLIQUER_ELEMENT_LISTE.'</p>'."\n";
$i=0;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$donnees_membres[$i++]=$ligne;
}
$res .= listes_inscrit($donnees_membres, $GLOBALS['annuaire_champs_visibles']['label_champs']);
} else {
$res .= ANN_PAS_D_INSCRITS;
$res .= listes_inscrit($donnees_membres);
}
}
else {
$res .='<h2>'.INS_RESULTATS_RECHERCHE.'</h2>'."\n";
$res .= '<p class="zone_alert">'.INS_PAS_DE_RESULTATS.'</p>'."\n";
}
} else {
$res .='<h2>'.INS_DIX_DERNIERES_INSCRIPTIONS.'</h2>'."\n";
$requete = 'SELECT '.INS_CHAMPS_ID.', '.INS_CHAMPS_NOM.', '.INS_CHAMPS_PRENOM.', '.INS_CHAMPS_VILLE.', '.INS_CHAMPS_CODE_POSTAL;
$requete .= ' FROM '.INS_ANNUAIRE.' ORDER BY '.INS_CHAMPS_DATE.' DESC LIMIT 0 , 10';
$resultat = $GLOBALS['ins_db']->query($requete);
if ($resultat->numRows()>0) {
$i=0;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$donnees_membres[$i++]=$ligne;
}
$res .= listes_inscrit($donnees_membres, 0);
}
else {
$res .= '<p class="zone_alert">'.INS_PAS_DE_RESULTATS.'</p>'."\n";
}
}
return $res ;
}
 
100,51 → 218,34
* @return Renvoie le code HTML de la liste des inscrits
*/
 
function listes_inscrit(& $donnees_membres, & $entete , $case_a_cocher=true) {
$res = '<div>'."\n";
if ($case_a_cocher) {$res .= '<form action="'.$GLOBALS['ins_url']->getURL().'"&amp;lettre='.$_REQUEST['lettre'].'" method="post" name="formmail">'."\n";}
$res .= '<table id="table_inscrit">'."\n".'<colgroup>'."\n";
if ($case_a_cocher) {$res .= '<col />';}
foreach($entete as $i) {$res .= '<col />'; }
$res .= '</colgroup>'."\n".'<thead>'."\n";
if ($case_a_cocher) {$res .= '<th>&nbsp;</th>'."\n";}
foreach($entete as $i) {
$res .= '<th>'.$i.'</th>'."\n";
}
$res .= '</thead>'."\n";
$indic=0;
$i=1;
foreach($entete as $i) {
if ($indic==0) {
$res.='<tr class="ligne_impaire">'."\n";
$indic=1;
}
else {
$res.='<tr class="ligne_paire">'."\n";
$indic=0;
}
}
function listes_inscrit(& $donnees_membres, $affiche_form_mail=1) {
$res = '';
if ($GLOBALS['AUTH']->getAuth()&&$affiche_form_mail) {$res .= '<form action="'.$GLOBALS['ins_url']->getURL().'" method="post" name="formmail">'."\n";}
$res .= '<ul>'."\n";
for ($i=0;$i<count($donnees_membres);$i++) {
$id = array_shift($donnees_membres[$i]);
if ($case_a_cocher) {$res.='<td><input type="checkbox" name="select[]" value="'.$id.'"></td>'."\n";}
foreach($donnees_membres[$i] as $valeur) $res .= '<td>'.$valeur.'</td>'."\n" ;
$res .= '</tr>'."\n";
$id = array_shift($donnees_membres[$i]);
$GLOBALS['ins_url']->addQueryString('voir_fiche', $id);
$res .= '<li><a href="'.$GLOBALS['ins_url']->getURL().'">'."\n";
if ($GLOBALS['AUTH']->getAuth()&&$affiche_form_mail) {
$res.='<input type="checkbox" name="select[]" value="'.$id.'">'."\n";
}
$res .= '<strong>'.$donnees_membres[$i][INS_CHAMPS_NOM].
'&nbsp;'.$donnees_membres[$i][INS_CHAMPS_PRENOM].'</strong>'."\n".
'&nbsp;'.$donnees_membres[$i][INS_CHAMPS_CODE_POSTAL].
'&nbsp;'.$donnees_membres[$i][INS_CHAMPS_VILLE];
$res .= '</a></li>'."\n";
}
$res .= '</table></div>'."\n";
if ($case_a_cocher) {
$res .= '<div class="texte">'.ANN_CHECK_UNCHECK ;
$res .= '&nbsp;<input type="checkbox" name="selecttotal" onclick="javascript:setCheckboxes(\'formmail\');"></div>';
$res .= '<h3>'.ANN_ENVOYER_MAIL.'</h3>'."\n";
$res .= '<div>'."\n".'<table border="0">'."\n"
.'<tr><td class="texte">'.ANN_SUJET.' :</td>'."\n"
.'<td><input class="forml" type="text" name="titre_mail" size="60"></td>'."\n"
.'</tr><tr><td class="texte" valign="top">'.ANN_MESSAGE.'&nbsp;:&nbsp;</td>'."\n"
.'<td><textarea class="forml" name="corps" rows="5" cols="60"></textarea></td>'."\n"
.'</tr><tr><td></td><td align="center">';
$res.='<input type="submit" value="'.ANN_ENVOYER.'">';
$res.='</td>'."\n".'</tr>'."\n".'</table>'."\n".'</div>'."\n".'</form>'."\n";
$res .= '</ul>'."\n";
if ($GLOBALS['AUTH']->getAuth()&&$affiche_form_mail) {
$res .= INS_CHECK_UNCHECK ;
$res .= '&nbsp;<input type="checkbox" name="selecttotal" onclick="javascript:setCheckboxes(\'formmail\');"><br />';
$res .= '<h3>'.INS_ENVOYER_MAIL.'</h3>'."\n";
$res .= '<p style="text-align:right;">'.INS_SUJET.'&nbsp;:&nbsp;<input style="border:1px solid #000;width:450px;" type="text" name="titre_mail"><br />'."\n".
INS_MESSAGE.'&nbsp;:&nbsp;<textarea style="border:1px solid #000;width:450px;" name="corps" rows="5" cols="60"></textarea></p>'."\n".
'<p style="width:100px;margin:4px auto;text-align:center;"><input type="submit" value="'.INS_ENVOYER.'" /></p>'."\n".
'</form>'."\n";
} else {
if ($affiche_form_mail) $res .='<br /><p class="zone_info">'.INS_PAS_IDENTIFIE.'</p>'."\n";
}
return $res ;
}
192,6 → 293,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.2 2005/09/29 16:13:54 alexandre_tb
* En cours de production.
*
* Revision 1.1 2005/09/22 14:02:49 ddelon
* nettoyage annuaire et php5
*