ajout du support des champs photo, naiss et public + diverses petites ameliorations (check des attributs sur le formulaire publique)
This commit is contained in:
parent
2d0c6cd7b7
commit
5c677eb9e2
@ -39,6 +39,9 @@ class Adherent
|
||||
var $statut;
|
||||
var $login;
|
||||
var $pass;
|
||||
var $naiss;
|
||||
var $photo;
|
||||
var $public;
|
||||
|
||||
var $errorstr;
|
||||
/*
|
||||
@ -50,6 +53,8 @@ class Adherent
|
||||
$this->db = $DB ;
|
||||
$this->id = $id;
|
||||
$this->statut = -1;
|
||||
// l'adherent n'est pas public par defaut
|
||||
$this->public = 0;
|
||||
}
|
||||
/*
|
||||
*
|
||||
@ -215,6 +220,9 @@ class Adherent
|
||||
$sql .= ",email='".$this->email."'";
|
||||
$sql .= ",login='".$this->login."'";
|
||||
$sql .= ",pass='".$this->pass."'";
|
||||
$sql .= ",naiss='".$this->naiss."'";
|
||||
$sql .= ",photo='".$this->photo."'";
|
||||
$sql .= ",public='".$this->public."'";
|
||||
$sql .= ",statut=".$this->statut;
|
||||
$sql .= ",fk_adherent_type=".$this->typeid;
|
||||
$sql .= ",morphy='".$this->morphy."'";
|
||||
@ -275,7 +283,7 @@ class Adherent
|
||||
*/
|
||||
Function fetch($rowid)
|
||||
{
|
||||
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, d.statut, d.adresse, d.cp, d.ville, d.pays, d.note, d.email, d.login, d.pass, d.fk_adherent_type, d.morphy, t.libelle as type";
|
||||
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, d.statut, d.public, d.adresse, d.cp, d.ville, d.pays, d.note, d.email, d.login, d.pass, d.naiss, d.photo, d.fk_adherent_type, d.morphy, t.libelle as type";
|
||||
$sql .= ",".$this->db->pdate("d.datefin")." as datefin";
|
||||
$sql .= " FROM llx_adherent as d, llx_adherent_type as t";
|
||||
$sql .= " WHERE d.rowid = $rowid AND d.fk_adherent_type = t.rowid";
|
||||
@ -291,6 +299,7 @@ class Adherent
|
||||
$this->typeid = $obj->fk_adherent_type;
|
||||
$this->type = $obj->type;
|
||||
$this->statut = $obj->statut;
|
||||
$this->public = $obj->public;
|
||||
$this->date = $obj->datedon;
|
||||
$this->prenom = stripslashes($obj->prenom);
|
||||
$this->nom = stripslashes($obj->nom);
|
||||
@ -301,6 +310,8 @@ class Adherent
|
||||
$this->email = stripslashes($obj->email);
|
||||
$this->login = stripslashes($obj->login);
|
||||
$this->pass = stripslashes($obj->pass);
|
||||
$this->naiss = stripslashes($obj->naiss);
|
||||
$this->photo = stripslashes($obj->photo);
|
||||
$this->pays = stripslashes($obj->pays);
|
||||
$this->datefin = $obj->datefin;
|
||||
$this->commentaire = stripslashes($obj->note);
|
||||
|
||||
@ -48,6 +48,8 @@ if ($action == 'update')
|
||||
$adh->email = $HTTP_POST_VARS["email"];
|
||||
$adh->login = $HTTP_POST_VARS["login"];
|
||||
$adh->pass = $HTTP_POST_VARS["pass"];
|
||||
$adh->naiss = $HTTP_POST_VARS["naiss"];
|
||||
$adh->photo = $HTTP_POST_VARS["photo"];
|
||||
$adh->date = mktime(12, 0 , 0, $remonth, $reday, $reyear);
|
||||
$adh->note = $HTTP_POST_VARS["note"];
|
||||
$adh->pays = $HTTP_POST_VARS["pays"];
|
||||
@ -104,7 +106,7 @@ if ($rowid)
|
||||
print '<td valign="top" width="50%">Commentaires</td></tr>';
|
||||
|
||||
print '<tr><td>Personne</td><td class="valeur">'.$adh->morphy.' </td>';
|
||||
print '<td rowspan="10" valign="top" width="50%">';
|
||||
print '<td rowspan="15" valign="top" width="50%">';
|
||||
print nl2br($adh->commentaire).' </td></tr>';
|
||||
|
||||
print '<tr><td width="15%">Prénom</td><td class="valeur" width="35%">'.$adh->prenom.' </td></tr>';
|
||||
@ -118,6 +120,8 @@ if ($rowid)
|
||||
print '<tr><td>Email</td><td class="valeur">'.$adh->email.' </td></tr>';
|
||||
print '<tr><td>Login</td><td class="valeur">'.$adh->login.' </td></tr>';
|
||||
print '<tr><td>Password</td><td class="valeur">'.$adh->pass.' </td></tr>';
|
||||
print '<tr><td>Date de naissance<BR>Format AAAA-MM-JJ</td><td class="valeur">'.$adh->naiss.' </td></tr>';
|
||||
print '<tr><td>URL Photo</td><td class="valeur">'.$adh->photo.' </td></tr>';
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
@ -146,7 +150,7 @@ if ($rowid)
|
||||
$htmls->select_array("morphy", $morphys, $adh->morphy);
|
||||
print "</td>";
|
||||
|
||||
print '<td rowspan="13" valign="top">';
|
||||
print '<td rowspan="15" valign="top">';
|
||||
print '<textarea name="comment" wrap="soft" cols="40" rows="15">'.$adh->commentaire.'</textarea></td></tr>';
|
||||
|
||||
print '<tr><td width="15%">Prénom</td><td width="35%"><input type="text" name="prenom" size="40" value="'.$adh->prenom.'"></td></tr>';
|
||||
@ -162,6 +166,8 @@ if ($rowid)
|
||||
print '<tr><td>Email</td><td><input type="text" name="email" size="40" value="'.$adh->email.'"></td></tr>';
|
||||
print '<tr><td>Login</td><td><input type="text" name="login" size="40" value="'.$adh->login.'"></td></tr>';
|
||||
print '<tr><td>Password</td><td><input type="text" name="pass" size="40" value="'.$adh->pass.'"></td></tr>';
|
||||
print '<tr><td>Date de naissance<BR>Format AAAA-MM-JJ</td><td><input type="text" name="naiss" size="40" value="'.$adh->naiss.'"></td></tr>';
|
||||
print '<tr><td>URL photo</td><td><input type="text" name="photo" size="40" value="'.$adh->photo.'"></td></tr>';
|
||||
print '<tr><td colspan="2" align="center">';
|
||||
print '<input type="submit" name="bouton" value="Enregistrer"> ';
|
||||
print '<input type="submit" value="Annuler">';
|
||||
|
||||
@ -55,6 +55,8 @@ if ($HTTP_POST_VARS["action"] == 'add')
|
||||
$adh->email = $email;
|
||||
$adh->login = $login;
|
||||
$adh->pass = $pass;
|
||||
$adh->naiss = $naiss;
|
||||
$adh->photo = $photo;
|
||||
$adh->note = $note;
|
||||
$adh->pays = $pays;
|
||||
$adh->typeid = $type;
|
||||
@ -137,7 +139,7 @@ if ($action == 'create') {
|
||||
$htmls->select_array("morphy", $morphys);
|
||||
print "</td>\n";
|
||||
|
||||
print '<td valign="top" rowspan="11"><textarea name="comment" wrap="soft" cols="40" rows="25"></textarea></td></tr>';
|
||||
print '<td valign="top" rowspan="13"><textarea name="comment" wrap="soft" cols="40" rows="25"></textarea></td></tr>';
|
||||
|
||||
print '<tr><td>Prénom</td><td><input type="text" name="prenom" size="40"></td></tr>';
|
||||
|
||||
@ -154,6 +156,8 @@ if ($action == 'create') {
|
||||
print '<tr><td>Email</td><td><input type="text" name="email" size="40"></td></tr>';
|
||||
print '<tr><td>Login</td><td><input type="text" name="login" size="40"></td></tr>';
|
||||
print '<tr><td>Password</td><td><input type="text" name="pass" size="40"></td></tr>';
|
||||
print '<tr><td>Date de Naissance<BR>Format AAAA-MM-JJ</td><td><input type="text" name="naiss" size="10"></td></tr>';
|
||||
print '<tr><td>Url photo</td><td><input type="text" name="photo" size="40"></td></tr>';
|
||||
|
||||
print "<tr><td>Date de cotisation</td><td>\n";
|
||||
print_date_select();
|
||||
@ -274,7 +278,7 @@ if ($rowid > 0)
|
||||
|
||||
print '<tr><td>Personne</td><td class="valeur">'.$adh->morphy.' </td>';
|
||||
|
||||
print '<td rowspan="11" valign="top" width="50%">';
|
||||
print '<td rowspan="13" valign="top" width="50%">';
|
||||
print nl2br($adh->commentaire).' </td></tr>';
|
||||
|
||||
print '<tr><td width="15%">Prénom</td><td class="valeur" width="35%">'.$adh->prenom.' </td></tr>';
|
||||
@ -289,6 +293,8 @@ if ($rowid > 0)
|
||||
print '<tr><td>Email</td><td class="valeur">'.$adh->email.' </td></tr>';
|
||||
print '<tr><td>Login</td><td class="valeur">'.$adh->login.' </td></tr>';
|
||||
print '<tr><td>Pass</td><td class="valeur">'.$adh->pass.' </td></tr>';
|
||||
print '<tr><td>Date de Naissance</td><td class="valeur">'.$adh->naiss.' </td></tr>';
|
||||
print '<tr><td>URL Photo</td><td class="valeur">'.$adh->photo.' </td></tr>';
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ require("../../paiement.class.php");
|
||||
$db = new Db();
|
||||
$errmsg='';
|
||||
$num=0;
|
||||
$error=0;
|
||||
|
||||
if ($HTTP_POST_VARS["action"] == 'add')
|
||||
{
|
||||
@ -38,11 +39,38 @@ if ($HTTP_POST_VARS["action"] == 'add')
|
||||
if ($result) {
|
||||
$num = $db->num_rows();
|
||||
}
|
||||
|
||||
if (isset($email) && $email != '' && ereg('@',$email) && !$num){
|
||||
if (!isset($nom) || !isset($prenom) || $prenom=='' || $nom==''){
|
||||
$error+=1;
|
||||
$errmsg .="Nom et Prenom obligatoires<BR>\n";
|
||||
}
|
||||
if (!isset($email) || $email == '' || !ereg('@',$email)){
|
||||
$error+=1;
|
||||
$errmsg .="Adresse Email invalide<BR>\n";
|
||||
}
|
||||
if ($num !=0){
|
||||
$error+=1;
|
||||
$errmsg .="Login deja utilise. Veuillez en changer<BR>\n";
|
||||
}
|
||||
if (!isset($pass1) || !isset($pass2) || $pass1 == '' || $pass2 == '' || $pass1!=$pass2){
|
||||
$error+=1;
|
||||
$errmsg .="Password invalide<BR>\n";
|
||||
}
|
||||
if (isset($naiss) && $nais !=''){
|
||||
if (!ereg("^\d\d\d\d\-\d\d\-\d\d",$naiss)){
|
||||
$error+=1;
|
||||
$errmsg .="Date de naissance invalide (Format AAAA-MM-JJ)<BR>\n";
|
||||
}
|
||||
}
|
||||
if (isset($public)){
|
||||
$public=1;
|
||||
}else{
|
||||
$public=0;
|
||||
}
|
||||
if (!$error){
|
||||
// email a peu pres correct et le login n'existe pas
|
||||
$adh = new Adherent($db);
|
||||
$adh->statut = -1;
|
||||
$adh->public = $public;
|
||||
$adh->prenom = $prenom;
|
||||
$adh->nom = $nom;
|
||||
$adh->societe = $societe;
|
||||
@ -51,7 +79,9 @@ if ($HTTP_POST_VARS["action"] == 'add')
|
||||
$adh->ville = $ville;
|
||||
$adh->email = $email;
|
||||
$adh->login = $login;
|
||||
$adh->pass = $pass;
|
||||
$adh->pass = $pass1;
|
||||
$adh->naiss = $naiss;
|
||||
$adh->photo = $photo;
|
||||
$adh->note = $note;
|
||||
$adh->pays = $pays;
|
||||
$adh->typeid = $type;
|
||||
@ -69,13 +99,6 @@ if ($HTTP_POST_VARS["action"] == 'add')
|
||||
mail($email,"Votre adhesion sur http://$SERVER_NAME/",$mesg);
|
||||
Header("Location: new.php?action=added");
|
||||
}
|
||||
}else{
|
||||
if ($num !=0){
|
||||
$errmsg .="Login deja utilise. Veuillez en changer<BR>\n";
|
||||
}
|
||||
if (!isset($email) || $email == '' || !ereg('@',$email)){
|
||||
$errmsg .="Adresse Email invalide<BR>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,14 +113,25 @@ llxHeader();
|
||||
|
||||
|
||||
if (isset($action) && $action== 'added'){
|
||||
print "<FONT COLOR=\"blue\">Nouvel Adhérent ajouté. En attente de validation</FONT><BR>\n";
|
||||
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
|
||||
print "<tr><td><FONT COLOR=\"blue\">Nouvel Adhérent ajouté. En attente de validation</FONT></td></tr>\n";
|
||||
print '</table>';
|
||||
}
|
||||
if ($errmsg != ''){
|
||||
print "<FONT COLOR=\"red\">$errmsg</FONT>\n";
|
||||
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
|
||||
|
||||
print '<th>Erreur dans le formulaire</th>';
|
||||
print "<tr><td class=\"delete\"><b>$errmsg</b></td></tr>\n";
|
||||
// print "<FONT COLOR=\"red\">$errmsg</FONT>\n";
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
print_titre("Nouvel adhérent");
|
||||
print "Les login et password vous serviront a editer vos coordonnees ulterieurement<BR>\n";
|
||||
print '<ul>';
|
||||
print '<li> Les champs Commencant par un <FONT COLOR="red">*</FONT> sont obligatoire';
|
||||
print '<li> Les champs Commencant par un <FONT COLOR="blue">*</FONT> seront affiche sur la liste publique des membres. Si vous ne souhaite pas cela <b>DECOCHEZ</b> la case public ci dessous';
|
||||
print "<li> Les login et password vous serviront a editer vos coordonnees ulterieurement<BR>\n";
|
||||
print "</ul><BR>\n";
|
||||
print "<form action=\"$PHP_SELF\" method=\"post\">\n";
|
||||
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
|
||||
|
||||
@ -119,19 +153,22 @@ print "<tr><td>Personne</td><td>\n";
|
||||
$htmls->select_array("morphy", $morphys);
|
||||
print "</td>\n";
|
||||
|
||||
print '<td valign="top" rowspan="11"><textarea name="comment" wrap="soft" cols="40" rows="25">'.$comment.'</textarea></td></tr>';
|
||||
print '<td valign="top" rowspan="14"><textarea name="comment" wrap="soft" cols="40" rows="25">'.$comment.'</textarea></td></tr>';
|
||||
|
||||
print '<tr><td>Prénom</td><td><input type="text" name="prenom" size="40" value="'.$prenom.'"></td></tr>';
|
||||
print '<tr><td><FONT COLOR="red">*</FONT> <FONT COLOR="blue">*</FONT> Prénom</td><td><input type="text" name="prenom" size="40" value="'.$prenom.'"></td></tr>';
|
||||
|
||||
print '<tr><td>Nom</td><td><input type="text" name="nom" size="40" value="'.$nom.'"></td></tr>';
|
||||
print '<tr><td><FONT COLOR="red">*</FONT> <FONT COLOR="blue">*</FONT> Nom</td><td><input type="text" name="nom" size="40" value="'.$nom.'"></td></tr>';
|
||||
print '<tr><td>Societe</td><td><input type="text" name="societe" size="40" value="'.$societe.'"></td></tr>';
|
||||
print '<tr><td>Adresse</td><td>';
|
||||
print '<textarea name="adresse" wrap="soft" cols="40" rows="3">'.$adresse.'</textarea></td></tr>';
|
||||
print '<tr><td>CP Ville</td><td><input type="text" name="cp" size="8" value="'.$cp.'"> <input type="text" name="ville" size="40" value="'.$ville.'"></td></tr>';
|
||||
print '<tr><td>Pays</td><td><input type="text" name="pays" size="40" value="'.$pays.'"></td></tr>';
|
||||
print '<tr><td>Email</td><td><input type="text" name="email" size="40" value="'.$email.'"></td></tr>';
|
||||
print '<tr><td>Login</td><td><input type="text" name="login" size="40" value="'.$login.'"></td></tr>';
|
||||
print '<tr><td>Password</td><td><input type="text" name="pass" size="40" value="'.$pass.'"></td></tr>';
|
||||
print '<tr><td><FONT COLOR="red">*</FONT> <FONT COLOR="blue">*</FONT> Email</td><td><input type="text" name="email" size="40" value="'.$email.'"></td></tr>';
|
||||
print '<tr><td><FONT COLOR="red">*</FONT> Login</td><td><input type="text" name="login" size="40" value="'.$login.'"></td></tr>';
|
||||
print '<tr><td><FONT COLOR="red">*</FONT> Password (a entrer 2 fois)</td><td><input type="password" name="pass1" size="40"><BR><input type="password" name="pass2" size="40"></td></tr>';
|
||||
print '<tr><td>Date de naissance<BR>Format AAAA-MM-JJ</td><td><input type="text" name="naiss" size="40" value="'.$naiss.'"></td></tr>';
|
||||
print '<tr><td><FONT COLOR="blue">*</FONT> URL Photo</td><td><input type="text" name="photo" size="40" value="'.$photo.'"></td></tr>';
|
||||
print '<tr><td>Profil public ?</td><td><input type="checkbox" name="public" checked></td></tr>';
|
||||
|
||||
print '<tr><td colspan="2" align="center"><input type="submit" value="Enregistrer"></td></tr>';
|
||||
print "</form>\n";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user