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: inscription.class.php,v 1.21 2007-06-01 13:45:46 alexandre_tb Exp $ |
// CVS : $Id: inscription.class.php,v 1.22 2007-06-25 09:59:03 alexandre_tb Exp $ |
/** |
* Inscription |
* |
31,7 → 31,7 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org> |
//Autres auteurs : |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.21 $ $Date: 2007-06-01 13:45:46 $ |
*@version $Revision: 1.22 $ $Date: 2007-06-25 09:59:03 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
163,58 → 163,8 |
//Traduction de champs requis |
$this->setRequiredNote(INS_CHAMPS_REQUIS) ; |
$this->setJsWarnings(INS_ERREUR_SAISIE,INS_VEUILLEZ_CORRIGER); |
|
$debut = '<h2>'.INS_AJOUT_MEMBRE.'</h2>'."\n"; |
$this->addElement('html', $debut); |
|
$this->addElement('text', 'email', INS_EMAIL) ; |
$this->addRule('email', INS_EMAIL_REQUIS, 'required','', 'client') ; |
$this->addRule('email', INS_MAIL_INCORRECT, 'email', '', 'client') ; |
$this->addElement('password', 'mot_de_passe', INS_MOT_DE_PASSE, array('size' => '10')) ; |
$this->addElement('password', 'mot_de_passe_repete', INS_REPETE_MOT_DE_PASSE, array('size' => '10')) ; |
$this->addRule('mot_de_passe', INS_MOT_DE_PASSE_REQUIS, 'required', '', 'client') ; |
$this->addRule('mot_de_passe_repete', INS_MOT_DE_PASSE_REQUIS, 'required', '', 'client') ; |
$this->addRule(array ('mot_de_passe', 'mot_de_passe_repete'), INS_MOTS_DE_PASSE_DIFFERENTS, 'compare', '', 'client') ; |
$this->addElement('text', 'nom', INS_NOM) ; |
$this->addRule('nom', INS_NOM_REQUIS, 'required', '', 'client') ; |
$this->addElement('text', 'prenom', INS_PRENOM) ; |
$this->addRule('prenom', INS_PRENOM_REQUIS, 'required', '', 'client') ; |
$this->addElement('text', 'adresse_1', INS_ADRESSE_1, array('id' => 'adresse_1')) ; |
$this->addElement('text', 'adresse_2', INS_ADRESSE_2, array('id' => 'adresse_2')) ; |
$this->addElement('text', 'cp', INS_CODE_POSTAL, array('id' => 'cp')) ; |
$this->addRule('cp', INS_CODE_POSTAL_REQUIS, 'required', '', 'client') ; |
$this->addElement('text', 'ville', INS_VILLE, array('id' => 'ville')) ; |
// L'element pays est construit a partir du tableau liste_pays |
$liste_pays = new ListeDePays($GLOBALS['ins_db']) ; |
$this->addElement('select', 'pays', INS_PAYS, $liste_pays->getListePays(INS_LANGUE_DEFAUT), array('id' => 'pays')) ; |
$this->addElement('text', 'telephone', INS_TELEPHONE, array('size' => '12')) ; |
$this->addElement('text', 'fax', INS_FAX, array('size' => '12')) ; |
$this->addElement('text', 'site', INS_SITE_INTERNET) ; |
$this->addElement('file', 'image', INS_LOGO_OU_IMAGE) ; |
$this->setMaxFileSize(150000); //logo de 15ko maximum |
if (INS_CHAMPS_LETTRE != '') $this->addElement('checkbox', 'lettre',INS_LETTRE, '<br />') ; |
$this->addElement('checkbox', 'visible',INS_VISIBLE, '<br />') ; |
|
$this->addElement('hidden', 'est_structure', 0) ; |
$defauts=array ('lettre'=>1,'pays'=>'FR'); |
if (isset ($GLOBALS['ins_config']['ic_google_key']) && $GLOBALS['ins_config']['ic_google_key'] != '') { |
$this->addElement('button', 'chercher_sur_carte', 'Vérifier mon adresse avec la carte', array("onclick" => "showAddress();")); |
$this->addElement('text', 'latitude', 'Latitude', array('id' => 'latitude', 'size' => 6, 'readonly' => 'readonly')); |
$this->addElement('text', 'longitude', 'longitude', array('id' => 'longitude', 'size' => 6, 'readonly' => 'readonly')); |
$this->addElement('html', '<tr><td colspan="2" ><div id="map" style="width: 600px; height: 450px"></div></td></tr>'); |
} |
$this->setDefaults($defauts); |
// on fait un groupe avec les boutons pour les mettres sur la meme ligne |
$boutons[] = &HTML_QuickForm::createElement('button', 'annuler', INS_ANNULER, array ("onclick" => "javascript:document.location.href='".$url."'", |
'id' => 'annuler', 'class' => 'bouton')); |
$boutons[] = &HTML_QuickForm::createElement('submit', 'valider', INS_VALIDER, array ('id' => 'valider', 'class' =>'bouton')); |
$this->addGroup($boutons, 'groupe_bouton', '', "\n"); |
|
if (isset ($GLOBALS['ins_config']['ic_google_key']) && $GLOBALS['ins_config']['ic_google_key'] != '') { |
GEN_stockerFichierScript('googleMapScript', $GLOBALS['ins_config']['ic_google_key']); |
|
|
$script = ' |
|
$script = ' |
// Variables globales |
var map = null; |
var geocoder = null; |
264,12 → 214,12 |
} |
}; |
function showAddress() { |
var adress_1 = document.getElementById("adresse_1").value ; |
var adress_2 = document.getElementById("adresse_2").value ; |
var ville = document.getElementById("ville").value ; |
var cp = document.getElementById("cp").value ; |
var selectIndex = document.getElementById("pays").selectedIndex; |
var pays = document.getElementById("pays").options[selectIndex].text ; |
var adress_1 = document.getElementById("a_adresse1").value ; |
var adress_2 = document.getElementById("a_adresse2").value ; |
var ville = document.getElementById("a_ville").value ; |
var cp = document.getElementById("a_code_postal").value ; |
var selectIndex = document.getElementById("a_ce_pays").selectedIndex; |
var pays = document.getElementById("a_ce_pays").options[selectIndex].text ; |
|
var address = adress_1 + \' \' + adress_2 + \' \' + \' \' + cp + \' \' + ville + \' \' +pays ; |
if (geocoder) { |
305,8 → 255,110 |
lon.value = coordMarker.lng(); |
} |
'; |
GEN_stockerCodeScript($script); |
|
// Mise en place du systeme de template du bazar |
include_once GEN_CHEMIN_API.'/formulaire/formulaire.fonct.inc.php'; |
$tableau= formulaire_valeurs_template_champs($GLOBALS['ins_config']['ic_inscription_template']); |
|
if (isset ($_REQUEST['action']) && $_REQUEST['action']=='modifier') { |
//Ajout des valeurs par defaut |
$requete_defaut = 'select * from annuaire where a_id='.$GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID); |
$resultat_defaut = $GLOBALS['ins_db']->query($requete_defaut); |
$valeurs_par_defaut = $resultat_defaut->fetchRow(DB_FETCHMODE_ASSOC); |
|
for ($i=0; $i<count($tableau); $i++) { |
if ( $tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox' ) { |
if (is_int ($tableau[$i]['nom_bdd'])) $def=$tableau[$i]['type'].$tableau[$i]['nom_bdd']; |
else $def = $tableau[$i]['nom_bdd']; |
} |
elseif ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' || |
$tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin' || |
$tableau[$i]['type']=='champs_mail') { |
$def=$tableau[$i]['nom_bdd']; |
} elseif ($tableau[$i]['type']=='carte_google') { |
$def = 'carte_google'; |
$valeurs_par_defaut[$def] = array ('latitude' => $valeurs_par_defaut[$tableau[$i]['limite1']], |
'longitude' => $valeurs_par_defaut[$tableau[$i]['limite2']]); |
GEN_stockerCodeScript($script); |
} |
$tableau[$i]['type']($this, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'], |
$tableau[$i]['limite2'], $valeurs_par_defaut[$def], $tableau[$i]['table_source'], |
$tableau[$i]['obligatoire']) ; |
} |
} |
else { |
for ($i=0; $i<count($tableau); $i++) { |
if ($tableau[$i]['type'] == 'carte_google') { |
GEN_stockerCodeScript($script); |
} |
$tableau[$i]['type']($this, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'], |
$tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], $tableau[$i]['obligatoire']) ; |
} |
} |
|
$debut = inscription::getTemplate(INS_TEMPLATE_TITRE_FORMULAIRE, $GLOBALS['ins_config']['ic_id_inscription'])."\n"; |
$this->addElement('html', $debut); |
/* |
$this->addElement('text', 'email', INS_EMAIL) ; |
$this->addRule('email', INS_EMAIL_REQUIS, 'required','', 'client') ; |
$this->addRule('email', INS_MAIL_INCORRECT, 'email', '', 'client') ; |
/* |
$this->addElement('password', 'mot_de_passe', INS_MOT_DE_PASSE, array('size' => '10')) ; |
$this->addElement('password', 'mot_de_passe_repete', INS_REPETE_MOT_DE_PASSE, array('size' => '10')) ; |
$this->addRule('mot_de_passe', INS_MOT_DE_PASSE_REQUIS, 'required', '', 'client') ; |
$this->addRule('mot_de_passe_repete', INS_MOT_DE_PASSE_REQUIS, 'required', '', 'client') ; |
$this->addRule(array ('mot_de_passe', 'mot_de_passe_repete'), INS_MOTS_DE_PASSE_DIFFERENTS, 'compare', '', 'client') ; |
|
$this->addElement('text', 'nom', INS_NOM) ; |
$this->addRule('nom', INS_NOM_REQUIS, 'required', '', 'client') ; |
$this->addElement('text', 'prenom', INS_PRENOM) ; |
$this->addRule('prenom', INS_PRENOM_REQUIS, 'required', '', 'client') ; |
if ($GLOBALS['ins_config']['ic_utilise_nom_wiki'] && ! $GLOBALS['ins_config']['ic_genere_nom_wiki']) { |
$this->addElement('text', 'nomwiki', INS_NOM_WIKI, array('id' => 'nom_wiki')) ; |
} |
$this->addElement('text', 'adresse_1', INS_ADRESSE_1, array('id' => 'adresse_1')) ; |
$this->addElement('text', 'adresse_2', INS_ADRESSE_2, array('id' => 'adresse_2')) ; |
$this->addElement('text', 'cp', INS_CODE_POSTAL, array('id' => 'cp')) ; |
$this->addRule('cp', INS_CODE_POSTAL_REQUIS, 'required', '', 'client') ; |
$this->addElement('text', 'ville', INS_VILLE, array('id' => 'ville')) ; |
// L'element pays est construit a partir du tableau liste_pays |
$liste_pays = new ListeDePays($GLOBALS['ins_db']) ; |
$this->addElement('select', 'pays', INS_PAYS, $liste_pays->getListePays(INS_LANGUE_DEFAUT), array('id' => 'pays')) ; |
*/ |
//$this->addElement('text', 'telephone', INS_TELEPHONE, array('size' => '12')) ; |
//$this->addElement('text', 'fax', INS_FAX, array('size' => '12')) ; |
//$this->addElement('text', 'site', INS_SITE_INTERNET) ; |
/* |
$this->addElement('file', 'image', INS_LOGO_OU_IMAGE) ; |
$this->setMaxFileSize(150000); //logo de 15ko maximum |
*/ |
//if (INS_CHAMPS_LETTRE != '') $this->addElement('checkbox', 'lettre',INS_LETTRE, '<br />') ; |
//$this->addElement('checkbox', 'visible',INS_VISIBLE, '<br />') ; |
/* |
$this->addElement('hidden', 'est_structure', 0) ; |
$defauts=array ('lettre'=>1,'pays'=>'FR'); |
if (isset ($GLOBALS['ins_config']['ic_google_key']) && $GLOBALS['ins_config']['ic_google_key'] != '') { |
$this->addElement('button', 'chercher_sur_carte', 'Vérifier mon adresse avec la carte', array("onclick" => "showAddress();")); |
$this->addElement('html', '<tr><td colspan="2" ><div id="map" style="width: 600px; height: 450px"></div></td></tr>'); |
$this->addElement('text', 'latitude', 'Latitude', array('id' => 'latitude', 'size' => 6, 'readonly' => 'readonly')); |
$this->addElement('text', 'longitude', 'longitude', array('id' => 'longitude', 'size' => 6, 'readonly' => 'readonly')); |
|
} |
*/ |
//$this->setDefaults($defauts); |
// on fait un groupe avec les boutons pour les mettres sur la meme ligne |
$boutons[] = &HTML_QuickForm::createElement('button', 'annuler', INS_ANNULER, array ("onclick" => "javascript:document.location.href='".$url."'", |
'id' => 'annuler', 'class' => 'bouton')); |
$boutons[] = &HTML_QuickForm::createElement('submit', 'valider', INS_VALIDER, array ('id' => 'valider', 'class' =>'bouton')); |
$this->addGroup($boutons, 'groupe_bouton', '', "\n"); |
|
if (isset ($GLOBALS['ins_config']['ic_google_key']) && $GLOBALS['ins_config']['ic_google_key'] != '') { |
GEN_stockerFichierScript('googleMapScript', $GLOBALS['ins_config']['ic_google_key']); |
|
|
|
|
} |
} // end of member function construitFormulaire |
|
/** Modifie le formulaire pour l'adapter au cas des structures |
317,22 → 369,59 |
*/ |
function formulaireStructure() |
{ |
/* |
$this->removeElement('nom', false) ; |
$this->removeElement('prenom') ; |
$this->removeElement('email', false) ; |
$this->removeElement('telephone', false) ; |
$nom_structure = & HTML_QuickForm::createElement('text', 'nom', INS_NOM_STRUCTURE) ; |
$this->insertElementBefore($nom_structure, 'mot_de_passe') ; |
|
$mail = & HTML_QuickForm::createElement('text', 'email', INS_MAIL_STRUCTURE) ; |
$this->insertElementBefore($mail, 'mot_de_passe') ; |
$nom_structure = & HTML_QuickForm::createElement('text', 'nom', INS_NOM_STRUCTURE) ; |
$this->insertElementBefore($nom_structure, 'email') ; |
|
$this->addRule('nom', INS_NOM_REQUIS, 'required', '', 'client') ; |
/* |
$sigle_structure = & HTML_QuickForm::createElement('text', 'sigle_structure', INS_SIGLE_DE_LA_STRUCTURE) ; |
$this->insertElementBefore($sigle_structure, 'email') ; |
$this->addRule('sigle_structure', INS_SIGLE_REQUIS, 'required', '', 'client') ; |
$num_agrement = & HTML_QuickForm::createElement('text', 'num_agrement', INS_NUM_AGREMENT) ; |
$this->insertElementBefore($num_agrement, 'email') ; |
*/ |
// not required |
//$this->addRule('sigle_structure', INS_SIGLE_REQUIS, 'required', '', 'client') ; |
|
// what's this ? |
//$num_agrement = & HTML_QuickForm::createElement('text', 'num_agrement', INS_NUM_AGREMENT) ; |
//$this->insertElementBefore($num_agrement, 'email') ; |
/* |
$telephone = & HTML_QuickForm::createElement('text', 'telephone', INS_TELEPHONE_STRUCTURE) ; |
$this->insertElementBefore($telephone, 'lettre') ; |
$fax = & HTML_QuickForm::createElement('text', 'fax', INS_FAX_STRUCTURE) ; |
$this->insertElementBefore($fax, 'lettre') ; |
|
$this->removeElement('site', false) ; |
$site_structure = & HTML_QuickForm::createElement('text', 'site', INS_SITE_STRUCTURE) ; |
$this->insertElementBefore($site_structure, 'lettre') ; |
|
// bloc contact |
$coord = & HTML_QuickForm::createElement('html', '<tr><td colspan="2"><strong>'.INS_COORD_CONTACT.'</strong></td></tr>') ; |
$nom = & HTML_QuickForm::createElement('text', 'nom_contact', INS_NOM_CONTACT) ; |
$prenom = & HTML_QuickForm::createElement('text', 'prenom_contact', INS_PRENOM_CONTACT) ; |
$poste = & HTML_QuickForm::createElement('text', 'poste_contact', INS_POSTE_CONTACT) ; |
$tel = & HTML_QuickForm::createElement('text', 'tel_contact', INS_TEL_CONTACT) ; |
$this->insertElementBefore($coord, 'lettre') ; |
$this->insertElementBefore($nom, 'lettre') ; |
$this->insertElementBefore($prenom, 'lettre') ; |
$this->insertElementBefore($poste, 'lettre') ; |
$this->insertElementBefore($tel, 'lettre') ; |
*/ |
$separateur = & HTML_QuickForm::createElement('html', '<tr><td colspan="2"><hr /></td></tr>') ; |
$this->insertElementBefore($separateur, 'lettre') ; |
|
//$fax = & HTML_QuickForm::createElement('text', 'fax', INS_FAX) ; |
//$image = & HTML_QuickForm::createElement('file', 'image', INS_LOGO_OU_IMAGE) ; |
|
//$this->insertElementBefore($image, 'lettre') ; |
//$this->setMaxFileSize(150000); //logo de 150 ko maximum |
|
$this->removeElement('est_structure', false) ; |
$this->addElement('hidden', 'est_structure', 1) ; |
$this->addElement('hidden', 'form_structure', 1) ; |