1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
/*LES INSCRIPTIONS EN ETAPES*/
public function _etape1(){
//debut du code de processSave()
if(!_root::getRequest()->isPost() ){ //si ce n'est pas une requete POST on ne soumet pas
$tMessage= null;
}
$oPluginXsrf=new plugin_xsrf();
if(!$oPluginXsrf->checkToken( _root::getParam('token') ) ){ //on verifie que le token est valide
$tMessage= array('token'=>$oPluginXsrf->getMessage() );
}
$oCandidats=new row_candidats;
//Je donne des valeurs par défaut aux dates
if($oCandidats->date_inscription==null){
$oCandidats->date_inscription = date("Y-m-d");
}
$oCandidats->date_mise_ajour = date("Y-m-d");
if(!isset($_POST['jour'])){
$_POST['jour'] = 1;
}
$oCandidats->date_naiss = $_POST['annee'].'-'.$_POST['mois'].'-'.$_POST['jour'].'';
//On verifie la conformité des 2 mots de passe
if(_root::getParam('mot_de_passe')!=_root::getParam('conf_mot_de_passe')){
$tMessage = array('conf_mot_de_passe'=>'Les deux mots de passe doivent être identiques');
}
//on nourri l'objet avec les valeurs du formulaire
$tColumn=array('email','mot_de_passe','nom','prenom','lieu_naiss','sexe','telephone','situation_matri','nb_enfant','cv_fichier_num','pays_id','domaine_id');
foreach($tColumn as $sColumn){
$oCandidats->$sColumn=_root::getParam($sColumn,null) ;
}
if($oCandidats->isValid()){
$_SESSION['oCandidat']=$oCandidats; //on enregistre l'objet temporairement en session
//une fois enregistre on redirige (vers la page etape2)
_root::redirect('inscriptions::etape2');
}else{
$tMessage = $oCandidats->getListError();
}
//FIN DU CODE DE processSave()
$oCandidats=new row_candidats;
$oView=new _view('inscriptions::etape1');
$oView->oCandidats=$oCandidats;
$oView->tMessage=$tMessage;
$oView->tJoinmodel_pays=model_pays::getInstance()->getSelect(); $oView->tJoinmodel_domaines=model_domaines::getInstance()->getSelect();
$oPluginXsrf=new plugin_xsrf();
$oView->token=$oPluginXsrf->getToken();
$this->oLayout->add('main',$oView);
$this->oLayout->title="e-tmg-Inscription candidat";
}
//fin de l'étape 1 |
Partager