level_1 = 'create';
$request2 = new stdClass();
$request2->level_1 = 'add';
foreach($user as $k=>$v)
switch($k){
case 'identifiant': $request1->identifiant = $v; break;
case 'prenom' : $request1->prenom = $v; break;
case 'nom' : $request1->nom = $v; break;
case 'mail' : $request1->mail = $v; break;
case 'mdp' : $request1->mdp = $v; break;
case 'droits' : $request1->droits = $v; break;
}
user_switch_level_1($request1, $answer1);
echo $request1->identifiant;
if( $answer1->request == 'success' ){
/* AJOUT A UN GROUPE */
$rang = ''.(rand(1,4));
$request2->etudiant = $request1->identifiant; // utilisateur.identifiant
$request2->groupe ='S'.$rang.chr(rand(65,70)); // groupe entre S1A - S4F
$request2->semestre = $rang; // semestre.rang
$request2->annee = '2015'; // semestre.annee
groups_switch_level_1($request2, $answer2);
if( $answer2->request == 'success' )
echo '['.$request2->groupe.']
';
else
echo '[ERROR_2: '.$answer2->request.']
';
}else
echo ' [ERROR_1: '.$answer1->request.']
';
}
// user_switch_level_1($request, $answer);
// echo var_dump( $answer );
// echo '
It works !';
/*** AJOUT D'UN UTILISATEUR À UN GROUPE ***/
//
// $request = new stdClass();
// $answer = new stdClass();
// $request->level_1 = 'add';
// $request->utilisateur = 'fvg1856a'; // utilisateur.username
// $request->groupe = 'A'; // groupe.nom
// groups_switch_level_1($request, $answer);
// echo var_dump( $answer );
// echo "
It works !";
?>