Subversion Repositories Applications.papyrus

Rev

Rev 425 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 425 Rev 446
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: inscription.fonct.php,v 1.3 2005-07-21 18:24:37 florian Exp $
22
// CVS : $Id: inscription.fonct.php,v 1.4 2005-09-22 13:30:49 florian Exp $
23
// CVS : $Id: inscription.fonct.php,v 1.3 2005-07-21 18:24:37 florian Exp $
23
// CVS : $Id: inscription.fonct.php,v 1.4 2005-09-22 13:30:49 florian Exp $
24
/**
24
/**
25
* Fonctions du module inscription
25
* Fonctions du module inscription
26
*
26
*
27
* Fonctions du module inscription
27
* Fonctions du module inscription
28
*
28
*
Line 30... Line 30...
30
//Auteur original :
30
//Auteur original :
31
*@author        Alexandre Granier <alexandre@tela-botanica.org>
31
*@author        Alexandre Granier <alexandre@tela-botanica.org>
32
//Autres auteurs :
32
//Autres auteurs :
33
*@author        Aucun
33
*@author        Aucun
34
*@copyright     Tela-Botanica 2000-2004
34
*@copyright     Tela-Botanica 2000-2004
35
*@version       $Revision: 1.3 $ $Date: 2005-07-21 18:24:37 $
35
*@version       $Revision: 1.4 $ $Date: 2005-09-22 13:30:49 $
36
*@version       $Revision: 1.3 $ $Date: 2005-07-21 18:24:37 $
36
*@version       $Revision: 1.4 $ $Date: 2005-09-22 13:30:49 $
37
// +------------------------------------------------------------------------------------------------------+
37
// +------------------------------------------------------------------------------------------------------+
38
*/
38
*/
Line 39... Line 39...
39
 
39
 
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
Line 95... Line 95...
95
    //--------------------------------------------------------------------------
95
    //--------------------------------------------------------------------------
96
    // Le formulaire
96
    // Le formulaire
97
    //--------------------------------------------------------------------------
97
    //--------------------------------------------------------------------------
98
    $res = '';
98
    $res = '';
99
    if ($msg!='') {$res .= $msg.'<br /><br />';}
99
    if ($msg!='') {$res .= $msg.'<br /><br />';}
100
    $res .= '<br /><div>'.INS_DEJA_INSCRIT.'</div><br />'."\n" ;
100
    $res .= '<br /><h3>'.INS_DEJA_INSCRIT.'</h3><br />'."\n" ;
101
    $GLOBALS['ins_url']->removeQueryString('action') ;
101
    $GLOBALS['ins_url']->removeQueryString('action') ;
102
    $form = new HTML_QuickForm('inscription_identification', 'post', str_replace ('&amp;', '&', $GLOBALS['ins_url']->getURL())) ;
102
    $form = new HTML_QuickForm('inscription_identification', 'post', str_replace ('&amp;', '&', $GLOBALS['ins_url']->getURL())) ;
-
 
103
    $squelette =& $form->defaultRenderer();
-
 
104
    $squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
-
 
105
    $squelette->setElementTemplate( '<label>{label}&nbsp;</label>'."\n".'{element}<br />'."\n");
103
    $form->addElement('text', 'username', INS_EMAIL) ;
106
    $form->addElement('text', 'username', INS_EMAIL) ;
104
    $form->addElement('password', 'password', INS_MOT_DE_PASSE) ;
107
    $form->addElement('password', 'password', INS_MOT_DE_PASSE) ;
105
    $form->addElement('submit', 'valider', INS_VALIDER);
108
    $form->addElement('submit', 'valider', INS_VALIDER);
106
    $res .= $form->toHTML()."\n" ;
109
    $res .= $form->toHTML()."\n" ;
107
    $res .= '<div>'.INS_TEXTE_PERDU.'</div><br />'."\n" ;
110
    $res .= '<span style="font-size:11px;">'.INS_TEXTE_PERDU.'</span><br /><br />'."\n" ;
Line 108... Line 111...
108
    
111
    
109
    $GLOBALS['ins_url']->addQueryString('action', 'inscription') ;
112
    $GLOBALS['ins_url']->addQueryString('action', 'inscription') ;
110
    $form = new HTML_QuickForm('inscription_personne', 'post', preg_replace ('/&amp;/', '&', str_replace ('&amp;', '&', $GLOBALS['ins_url']->getURL()))) ;
113
    $form = new HTML_QuickForm('inscription_personne', 'post', preg_replace ('/&amp;/', '&', str_replace ('&amp;', '&', $GLOBALS['ins_url']->getURL()))) ;
111
    $form->addElement('submit', 'Inscription', INS_INSCRIPTION_PERSONNE) ;
114
    $form->addElement('submit', 'Inscription', INS_INSCRIPTION_PERSONNE) ;
Line 114... Line 117...
114
	    $form = new HTML_QuickForm('inscription_structure', 'post', preg_replace ('/&amp;/', '&', str_replace ('&amp;', '&', $GLOBALS['ins_url']->getURL()))) ;
117
	    $form = new HTML_QuickForm('inscription_structure', 'post', preg_replace ('/&amp;/', '&', str_replace ('&amp;', '&', $GLOBALS['ins_url']->getURL()))) ;
115
	    $form->addElement('hidden', 'form_structure', 1) ;
118
	    $form->addElement('hidden', 'form_structure', 1) ;
116
	    $form->addElement('submit', 'bouton_form_structure', INS_INSCRIPTION_STRUCTURE) ;
119
	    $form->addElement('submit', 'bouton_form_structure', INS_INSCRIPTION_STRUCTURE) ;
117
	    $res .= $form->toHTML() ;
120
	    $res .= $form->toHTML() ;
118
    }
121
    }
119
    $res .= "<div>".INS_LAIUS_INSCRIPTION_2."</div>\n" ;
122
    $res .= "<br /><div>".INS_LAIUS_INSCRIPTION_2."</div>\n" ;
120
    return $res;
123
    return $res;
121
}
124
}
Line 122... Line 125...
122
 
125
 
123
/** message_erreur () - Renvoie le code HTML d'un message d'erreur
126
/** message_erreur () - Renvoie le code HTML d'un message d'erreur
Line 148... Line 151...
148
    $res .= '<h3 class="titre2_inscription">'.INS_PAS_INSCRIT.'</h3>' ;
151
    $res .= '<h3 class="titre2_inscription">'.INS_PAS_INSCRIT.'</h3>' ;
149
    $GLOBALS['ins_url']->addQueryString('action', 'inscription') ;
152
    $GLOBALS['ins_url']->addQueryString('action', 'inscription') ;
150
    $form = new HTML_QuickForm('inscription', 'post', preg_replace ('/&amp;/', '&', str_replace ('&amp;', '&', $GLOBALS['ins_url']->getURL()))) ;
153
    $form = new HTML_QuickForm('inscription', 'post', preg_replace ('/&amp;/', '&', str_replace ('&amp;', '&', $GLOBALS['ins_url']->getURL()))) ;
151
    $form->addElement('submit', 'Inscription', INS_INSCRIPTION) ;
154
    $form->addElement('submit', 'Inscription', INS_INSCRIPTION) ;
152
    if (INS_FORMULAIRE_STRUCTURE) $form->addElement('submit', 'form_structure', INS_INSCRIPTION_STRUCTURE) ;
155
    if (INS_FORMULAIRE_STRUCTURE) $form->addElement('submit', 'form_structure', INS_INSCRIPTION_STRUCTURE) ;
153
    $res .= "<div>".INS_LAIUS_INSCRIPTION_2."</div>\n" ;
156
    $res .= "<br /><div>".INS_LAIUS_INSCRIPTION_2."</div>\n" ;
154
    $res .= $form->toHTML() ;
157
    $res .= $form->toHTML() ;
155
    return $res;
158
    return $res;
156
}
159
}
Line 157... Line 160...
157
 
160
 
Line 306... Line 309...
306
    if (DB::isError($resultat)) {
309
    if (DB::isError($resultat)) {
307
    	die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
310
    	die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
308
    }
311
    }
Line 309... Line 312...
309
 
312
 
310
    $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
313
    $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
311
    $res = "<br /><h1 class=\"inscription_titre1\">".INS_MESSAGE_BIENVENU ;
-
 
312
    $res .= "</h1><br />\n" ;
314
    $res = '<h1 class="inscription_titre1">'.INS_MESSAGE_BIENVENU.'</h1><br />'."\n" ;
313
    $res .= "<h3 class=\"inscription_titre2\">".INS_FICHE_PERSONNELLE."</h3><br />\n" ;
-
 
314
    $res .= "<div>";
315
    $res .= '<h2 class="inscription_titre2">'.INS_FICHE_PERSONNELLE.'</h2><br />'."\n" ;
315
    if ($ligne[INS_CHAMPS_EST_STRUCTURE] == 1) {
316
    if ($ligne[INS_CHAMPS_EST_STRUCTURE] == 1) {
316
	    $nom = INS_NOM_STRUCTURE ;
317
	    $res .=  '<h3>'.$ligne[INS_CHAMPS_NOM].'</h3><br />'."\n";
317
    }
-
 
318
    else $nom = INS_NOM ;
318
    }
319
    $res .= "<h3>".$nom." : ".$ligne[INS_CHAMPS_NOM]."</h3><br />" ;
319
    else $res .= '<h3>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h3><br />'."\n";
320
    $res .= INS_EMAIL." : ".$ligne[INS_CHAMPS_MAIL]."</div>\n" ;
-
 
321
    if ($ligne[INS_CHAMPS_EST_STRUCTURE] == 0) $res .= "<div>".INS_PRENOM." : ".$ligne[INS_CHAMPS_PRENOM]."</div>\n" ;
-
 
322
    if (INS_UTILISE_WIKINI) {if ($ligne[INS_CHAMPS_NOM_WIKINI] != "") $res .= "<div>".INS_NOM_WIKI." : ".$ligne[INS_CHAMPS_NOM_WIKINI]."</div>\n" ;}
320
    $res .='<label>'.INS_EMAIL.' :</label> '.$ligne[INS_CHAMPS_MAIL].'<br />'."\n" ;
323
    if ($ligne[INS_CHAMPS_ADRESSE_1] != "") $res .= "<div>".INS_ADRESSE_1." : ".$ligne[INS_CHAMPS_ADRESSE_1]."</div>\n" ;
321
    if ($ligne[INS_CHAMPS_ADRESSE_1] != '') $res .= '<label>'.INS_ADRESSE_1.' :</label> '.$ligne[INS_CHAMPS_ADRESSE_1].'<br />'."\n" ;
324
    if ($ligne[INS_CHAMPS_ADRESSE_2] != "") $res .= "<div>".INS_ADRESSE_2." : ".$ligne[INS_CHAMPS_ADRESSE_2]."</div>\n" ;
322
    if ($ligne[INS_CHAMPS_ADRESSE_2] != '') $res .= '<label>'.INS_ADRESSE_2.' :</label> '.$ligne[INS_CHAMPS_ADRESSE_2].'<br />'."\n" ;
325
    if ($ligne[INS_CHAMPS_TELEPHONE] != "") $res .= "<div>".INS_TELEPHONE." : ".$ligne[INS_CHAMPS_TELEPHONE]."</div>\n" ;
323
    if ($ligne[INS_CHAMPS_TELEPHONE] != '') $res .= '<label>'.INS_TELEPHONE.' :</label> '.$ligne[INS_CHAMPS_TELEPHONE].'<br />'."\n" ;
326
    if ($ligne[INS_CHAMPS_FAX] != "") $res .= "<div>".INS_FAX." : ".$ligne[INS_CHAMPS_FAX]."</div>\n" ;
324
    if ($ligne[INS_CHAMPS_FAX] != '') $res .= '<label>'.INS_FAX.' :</label> '.$ligne[INS_CHAMPS_FAX].'<br />'."\n" ;
327
    if ($ligne[INS_CHAMPS_STRUCTURE] != "") $res .= "<div>".INS_STRUCTURE." : ".$ligne[INS_CHAMPS_STRUCTURE]."</div>\n" ;
-
 
328
    
-
 
-
 
325
    if (INS_UTILISE_WIKINI) {if ($ligne[INS_CHAMPS_NOM_WIKINI] != '') $res .= '<label>'.INS_NOM_WIKI.' :</label> '.$ligne[INS_CHAMPS_NOM_WIKINI].'<br />'."\n" ;}
329
    
326
    $res .= '<br />';
330
    return $res ;
327
    return $res ;
Line 331... Line 328...
331
}
328
}
332
 
329
 
333
function bouton($url) {
-
 
334
    $boutons = new HTML_QuickForm('inscription', 'post', $url) ; ;
330
function bouton($url) {
335
    //confirmation() ;
331
	//requete pour savoir s'il s'agit d'une structure ou d'une personne
336
    $requete = 'SELECT '.INS_CHAMPS_EST_STRUCTURE.' FROM '.INS_ANNUAIRE.' '.
332
	$requete = 'SELECT '.INS_CHAMPS_EST_STRUCTURE.' FROM '.INS_ANNUAIRE.' '.
337
                'WHERE '.INS_CHAMPS_ID.'="'.$GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID).'"' ;
333
	'WHERE '.INS_CHAMPS_ID.'="'.$GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID).'"' ;
338
    $resultat = $GLOBALS['ins_db'] -> query($requete) ; 
334
	$resultat = $GLOBALS['ins_db'] -> query($requete) ;
339
    if (DB::isError($resultat)) {
335
	if (DB::isError($resultat)) {
340
    	die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
336
		die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
-
 
337
	}
-
 
338
	$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
-
 
339
	
341
    }
340
	$form_boutons = new HTML_QuickForm('inscription', 'post', $url) ;
342
    $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
341
	
343
    if ($ligne[INS_CHAMPS_EST_STRUCTURE] == 1) {
342
	if ($ligne[INS_CHAMPS_EST_STRUCTURE] == 1) {
344
	    $boutons->addElement('hidden', 'form_structure', 1) ;
343
		$form_boutons->addElement('hidden', 'form_structure', 1) ;
345
    }
344
	}
346
    else {
345
	else {
-
 
346
		$form_boutons->addElement('hidden', 'form_structure', 0) ;
-
 
347
	}
-
 
348
	$squelette =& $form_boutons->defaultRenderer();
-
 
349
	$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
347
	    $boutons->addElement('hidden', 'form_structure', 0) ;
350
	$squelette->setElementTemplate( '{label}'."\n".'{element}'."\n");
348
    }
351
	// on fait un groupe avec les boutons pour les mettres sur la même ligne
349
    $buttons[] = &HTML_QuickForm::createElement('submit', 'modifier', INS_MODIFIER_INSCRIPTION);
352
	$buttons[] = &HTML_QuickForm::createElement('submit', 'modifier', INS_MODIFIER_INSCRIPTION);
350
    $buttons[] = &HTML_QuickForm::createElement('submit', 'supprimer', INS_SUPPRIMER_INSCRIPTION, 
353
	$buttons[] = &HTML_QuickForm::createElement('submit', 'supprimer', INS_SUPPRIMER_INSCRIPTION, 
351
                            array ("onclick" => "javascript:return confirm('".INS_SUPPRIMER_INSCRIPTION." ?');"));
354
                            array ("onclick" => "javascript:return confirm('".INS_SUPPRIMER_INSCRIPTION." ?');"));
352
    $boutons->addGroup($buttons, null, null, '&nbsp;');
355
	$form_boutons->addGroup($buttons, null, null, '&nbsp;'."\n");
Line 353... Line 356...
353
    return $boutons->toHTML() ;
356
    	return $form_boutons->toHTML() ;
354
}
357
}
355
 
358