public function __construct($util, $get = null)
 {
     parent::__construct($util);
     $this->model();
     $model = new Model();
     $data["auth"] = $this->util->estAuthent();
     if (!isset($get["num"])) {
         $data["liste"] = $model->getElevesGroupe($util->getNumGroupe());
         $data["droit"] = $this->util->estProf();
         $model->close();
         $this->setViewMenu();
         $this->view->init('passprof.php', $data);
         $this->setViewBas();
     } else {
         $l = $get["l"];
         if ($get["l"] == "p") {
             $data["tableau"] = $model->getTableauSyntheseNew($get["num"]);
             $data["synth"] = $model->getSynth($get["num"]);
             $model->close();
             $this->view->init('synthese.php', $data);
         } else {
             $data["bilan"] = $model->getBilan($get["num"]);
             $model->close();
             $this->setViewMenu();
             $this->view->init('bilan.php', $data);
             $this->setViewBas();
         }
     }
 }
Example #2
0
 public function __construct($util, $get = null)
 {
     parent::__construct($util);
     $this->model();
     $this->setViewMenu();
     if (isset($get["vers"])) {
         $vers = $get["vers"];
     } else {
         $vers = 1;
     }
     if (isset($get["depuis"])) {
         $depuis = $get["depuis"];
     } else {
         $depuis = 1;
     }
     $model = new Model();
     if (isset($get["enregistrer"])) {
         //on a cliqué un bouton enregistrer
         if (isset($get["li"])) {
             //il y a des situs (inutile ici...)
             $model->validSitu($get["chk"], $this->util->getId(), $get["li"]);
         }
     }
     $data["lessitus"] = $model->getSitus($util->getId(), $util->getNumGroupe(), $vers);
     $data["auth"] = $this->util->estAuthent();
     $data["vers"] = $vers;
     $data["type"] = "V";
     //validations
     $this->view->init('dessitus.php', $data);
     $this->setViewBas();
     $model->close();
 }
Example #3
0
 public function __construct($util, $get = null)
 {
     parent::__construct($util);
     $this->model();
     $model = new Model();
     if (isset($get["mode"])) {
         $mode = $get["mode"];
         $numsitu = $get["numsitu"];
         switch ($mode) {
             case 1:
                 $model->supprSitu($numsitu);
                 break;
             case 2:
                 $model->recupSitu($numsitu);
                 break;
             case 3:
                 $model->destrucSitu($numsitu);
                 break;
         }
     }
     $data["lessitusel"] = $model->getSitusEl($util->getId());
     $model->close();
     $this->setViewMenu();
     $data["auth"] = $this->util->estAuthent();
     $this->view->init('dessitusel.php', $data);
     $this->setViewBas();
 }
Example #4
0
 public function verificarLogin()
 {
     $obj = new loginHelper();
     if ($obj->getDataSession("usuario_login") == null) {
         throw new Exception_Form("Você precisa efetuar o login novamente para continuar.");
     } else {
         $model = new Model();
         $model->open();
         $model->set("sql", "\n\t\t\t\t\tINSERT INTO `systemlog` \n\t\t\t\t\t\t(`method`, `url`, `dados`, `login`, `data`) \n\t\t\t\t\t\tVALUES \n\t\t\t\t\t\t(:method,:url,:dados,:login,now())\n\t\t\t\t");
         $model->set('params', array(":method" => $this->_method, ":url" => $_SERVER['REQUEST_URI'], ":dados" => implode(';', $this->_dados), ":login" => $obj->getDataSession("usuario_login")));
         $model->query();
         $model->close();
     }
 }
 public function __construct($util, $get = null)
 {
     parent::__construct($util);
     $this->model();
     $model = new Model();
     //tableau reglementaire en premiere page
     $data["tableau"] = $model->getTableauSyntheseNew($util->getId());
     //puis une page par situation
     //pas vues dans cette version
     $data["synth"] = $model->getSynth($util->getId());
     $model->close();
     $data["auth"] = $this->util->estAuthent();
     $this->view->init('synthese.php', $data);
 }
 public function __construct($util, $get = null)
 {
     parent::__construct($util);
     $this->model();
     $model = new Model();
     if (isset($get["ep"])) {
         $ep = $get["ep"];
     } else {
         $ep = 1;
     }
     $data["passeport"] = $model->getPasseport($util->getId(), $ep, $util->estLibre());
     $model->close();
     $data["auth"] = $this->util->estAuthent();
     $this->view->init('passeport.php', $data);
 }
Example #7
0
 public function __construct($util, $get = null)
 {
     parent::__construct($util);
     $this->model();
     $model = new Model();
     $this->setViewMenu();
     $mess = '';
     if (isset($get["envoi"])) {
         //bouton envoi
         $nb = 0;
         if (isset($get["groupes"])) {
             $ls = $get["groupes"];
             for ($i = 0; $i < count($ls); $i++) {
                 //pour chaque groupe
                 $res = $model->getMelsElevesGroupe($ls[$i]);
                 for ($j = 0; $j < count($res); $j++) {
                     //pour chaque élève j d'un groupe i
                     $this->envoimel($res[$j]["mel"], $res[$j]["mdp"]);
                     $nb++;
                 }
             }
         }
         if (isset($get["professeurs"])) {
             $ls = $get["professeurs"];
             for ($i = 0; $i < count($ls); $i++) {
                 //pour chaque prof
                 $res = $model->getMelProfesseur($ls[$i]);
                 $this->envoimel($res[0]["mel"], $res[0]["mdp"]);
                 $nb++;
             }
         }
         if (isset($get["etudiants"])) {
             $ls = $get["etudiants"];
             for ($i = 0; $i < count($ls); $i++) {
                 //pour chaque élève
                 $res = $model->getMelEleve($ls[$i]);
                 $this->envoimel($res[0]["mel"], $res[0]["mdp"]);
                 $nb++;
             }
         }
         $mess = $nb . " message(s) envoy&eacute;(s)";
     }
     $data = array("groupes" => $model->getGroupes(), "professeurs" => $model->getProfesseurs(), "etudiants" => $model->getEtudiants(), "messagetexte" => $mess);
     $model->close();
     $data["auth"] = $this->util->estAuthent();
     $this->view->init('passe.php', $data);
     $this->setViewBas();
 }
Example #8
0
 public function __construct($util, $get = null)
 {
     parent::__construct($util);
     $this->model();
     $this->setViewMenu();
     if (isset($get["depuis"])) {
         $depuis = $get["depuis"];
     } else {
         $depuis = 1;
     }
     $model = new Model();
     $data["bilan"] = $model->getBilan($this->util->getId());
     $data["auth"] = $this->util->estAuthent();
     $this->view->init('bilan.php', $data);
     $this->setViewBas();
     $model->close();
 }
Example #9
0
 public function __construct($util, $get = null)
 {
     parent::__construct($util);
     $this->model();
     $this->setViewMenu();
     if (isset($get["depuis"])) {
         $depuis = $get["depuis"];
     } else {
         $depuis = 1;
     }
     if (isset($get["t"])) {
         $t = $get["t"];
     } else {
         $t = "";
     }
     if (isset($get["iddoc"])) {
         $iddoc = $get["iddoc"];
     } else {
         $iddoc = 0;
     }
     if (isset($get["e"])) {
         $e = $get["e"];
     } else {
         $e = "t";
     }
     //fichier titre pas supprimé par defaut
     $model = new Model();
     if (!is_null($get["sauve"])) {
         //enregistre
         $iddoc = $model->sauveDoc($e, $iddoc, $get["titre"], $get["el"], $this->util->getNom(), $this->util->getId(), $t);
     }
     if ($iddoc != 0) {
         //relit
         $data["doc"] = $model->getUnDoc($e, $iddoc, $this->util->getId(), $t);
     }
     $data["auth"] = $this->util->estAuthent();
     $data["iddoc"] = $iddoc;
     $data["t"] = $t;
     $data["e"] = $e;
     $this->view->init('saisiecpt.php', $data);
     $this->setViewBas();
     $model->close();
 }
Example #10
0
 public function __construct($util, $get = null)
 {
     parent::__construct($util);
     $this->model();
     $model = new Model();
     $data["auth"] = $this->util->estAuthent();
     if (isset($get["num"])) {
         $num = $get["num"];
         $data["nom"] = $get["nom"];
         $data["eleves"] = $model->getElevesGroupe($num);
         $data["profs"] = $model->getProfsGroupe($num);
     } else {
         $data["groupes"] = $model->getGroupes();
     }
     $this->setViewMenu();
     $this->view->init('suivigr.php', $data);
     $model->close();
     $this->setViewBas();
 }
Example #11
0
 public function __construct($util, $get = null)
 {
     parent::__construct($util);
     $this->model();
     $this->setViewMenu();
     if (!isset($get["vers"])) {
         $vers = 1;
     } else {
         $vers = $get["vers"];
     }
     if (!isset($get["depuis"])) {
         $depuis = 1;
     } else {
         $depuis = $get["depuis"];
     }
     $model = new Model();
     if (isset($get["num"])) {
         $num = $get["num"];
     } else {
         $num = null;
     }
     if (isset($get["ty"])) {
         $ty = $get["ty"];
     } else {
         $ty = 0;
     }
     //rest par défaut
     if (!is_null($num)) {
         if ($ty == 1) {
             //on supprime
             $model->suppPersonne($vers, $num);
         } else {
             //restaure
             $model->restPersonne($vers, $num);
         }
     }
     $data["suppr"] = $model->getSuppr($vers);
     $data["vers"] = $vers;
     $data["auth"] = $this->util->estAuthent();
     $model->close();
     $this->view->init('suppr.php', $data);
     $this->setViewBas();
 }
Example #12
0
 public function __construct($util, $get = null)
 {
     parent::__construct($util);
     $this->model();
     $model = new Model();
     $data["auth"] = $this->util->estAuthent();
     if (isset($get["num"])) {
         $this->model();
         $nt = $get["num"];
         $model = new Model();
         $liste = $model->getMDPGroupe($nt);
         $repfic = 'dirrw/csv/';
         $nf = 'mp' . substr('000' . $nt, -3, 3);
         $nomfic = $repfic . $nf . ".csv";
         $fic = fopen($nomfic, "w");
         $li = "Date sauvegarde;" . date("Y-m-d") . "\r\n";
         fputs($fic, $li);
         $li = "numero;nom;prenom;mel;motPasse\r\n";
         fputs($fic, $li);
         foreach ($liste as $ligne) {
             $li = '';
             foreach ($ligne as $cle => $val) {
                 if ($li == '') {
                     $li = $val;
                 } else {
                     $li = $li . ';' . $val;
                 }
             }
             $li .= "\r\n";
             fputs($fic, $li);
         }
         fclose($fic);
         $data["fic"] = $nf . ".csv";
     } else {
         $data["groupes"] = $model->getGroupes();
     }
     $this->setViewMenu();
     $this->view->init('mpasse.php', $data);
     $model->close();
     $this->setViewBas();
 }
Example #13
0
 public function __construct($util, $get = null)
 {
     parent::__construct($util);
     $this->model();
     $mel = $this->ha($get["login"]);
     $mdp = $this->ha($get["mdp"]);
     //$groupe=$this->ha($get["groupe"]);
     $data = null;
     if ($this->ctrlmel($mel)) {
         $model = new Model();
         //if ($mel!="" && $mdp!="" && $groupe!=""){ //3 champs remplis
         if ($mel != "" && $mdp != "") {
             //2 champs remplis
             $crypte = new Crypte();
             if ($crypte->getCrypte()) {
                 $mdp = md5($mdp);
             }
             //if ($tb=$model->getAuthent($mel,$mdp,$groupe)){
             if ($tb = $model->getAuthent($mel, $mdp)) {
                 $this->util->init($tb[0]["num"], $tb[0]["nom"], $tb[0]["prenom"], $tb[0]["niveau"], $tb[0]["groupes"]);
                 $_SESSION['ctrl'] = $this->util;
             }
         }
         $model->close();
     }
     $this->setViewMenu();
     $suff = "";
     if ($this->util->estEtudiant()) {
         $suff = "e";
     }
     if ($this->util->estProf() || $this->util->estLecteur()) {
         $suff = "p";
     }
     if ($this->util->estAdmin()) {
         $suff = "a";
     }
     $this->view->init('corpsaccueil' . $suff . '.php', $data);
     $this->setViewBas();
 }
Example #14
0
 public function __construct($util, $get = null)
 {
     parent::__construct($util);
     $this->model();
     $this->setViewMenu();
     if (isset($get["depuis"])) {
         $depuis = $get["depuis"];
     } else {
         $depuis = 1;
     }
     $model = new Model();
     if (isset($get["t"])) {
         $t = $get["t"];
         if (isset($get["a"])) {
             $a = $get["a"];
             switch ($a) {
                 case "s":
                     //suppression
                     $model->supprimerDoc($get["iddoc"], $t, $this->util->getId());
                     break;
                 case "r":
                     //restaure
                     $model->restaurerDoc($get["iddoc"], $t, $this->util->getId());
                     break;
                 case "d":
                     //detruire
                     $model->detruireDoc($get["iddoc"], $t, $this->util->getId());
                     break;
             }
         }
     }
     $data["liste"] = $model->getLesDoc($this->util->getId());
     $data["auth"] = $this->util->estAuthent();
     //$data["t"]=$t;
     $this->view->init('voircpt.php', $data);
     $this->setViewBas();
     $model->close();
 }
Example #15
0
 public function __construct($util, $get = null)
 {
     parent::__construct($util);
     $this->model();
     $model = new Model();
     $data["auth"] = $this->util->estAuthent();
     if (isset($get["num"])) {
         $num = $get["num"];
         $data["nom"] = $get["nom"];
         $data["eleves"] = $model->getElevesGroupe($num);
         //$data["profs"]=$model->getProfsGroupe($num);
     } else {
         if (isset($get["etud"])) {
             foreach ($get["etud"] as $unetud) {
                 $model->suppPersonne(2, $unetud);
             }
         }
         $data["groupes"] = $model->getGroupes();
     }
     $model->close();
     $this->setViewMenu();
     $this->view->init('finetude.php', $data);
     $this->setViewBas();
 }
Example #16
0
 public function __construct($util, $get = null)
 {
     parent::__construct($util);
     $this->model();
     $model = new Model();
     $this->setViewMenu();
     if (isset($get["vers"])) {
         $vers = $get["vers"];
     } else {
         $vers = 1;
     }
     if (isset($get["depuis"])) {
         $depuis = $get["depuis"];
     } else {
         $depuis = 1;
     }
     if (isset($get["numsitu"])) {
         $numsitu = $get["numsitu"];
     } else {
         $numsitu = 0;
     }
     if (isset($get["commenter"])) {
         $commenter = $get["commenter"];
     } else {
         $commenter = "N";
     }
     if (isset($get["modif"])) {
         $modif = $get["modif"];
     } else {
         $modif = "n";
     }
     //debut enregistrements
     if (isset($get["enregistrer"]) || $modif == "o") {
         //cliqué bouton enregistrer ou changement onglet
         switch ($depuis) {
             case 1:
                 //écran description
                 if ($this->util->estEtudiant()) {
                     $lc = $this->ha($get["libcourt"]);
                     $de = $this->ha($get["description"]);
                     $pa = $this->ha($get["lieu"]);
                     $lo = $this->ha($get["localisation"]);
                     $so = $this->ha($get["source"]);
                     $ca = $this->ha($get["cadre"]);
                     $dd = $this->dteusa($this->ha($get["datedebut"]));
                     $df = $this->dteusa($this->ha($get["datefin"]));
                     if ($this->nbJ($dd, $df) < 0) {
                         $df = $dd;
                     }
                     $ty = $this->ha($get["typedecrit"]);
                     $te = $this->ha($get["techno"]);
                     $ac = $this->ha($get["acteur"]);
                     $sg = $this->ha($get["situoblig"]);
                     $to = array();
                     if ($sg == "O" && isset($get["typologie"])) {
                         $to = $get["typologie"];
                     }
                     $av = $this->ha($get["avisperso"]);
                     $ideleve = $this->util->getId();
                     if ($numsitu == 0) {
                         //enregistrer données
                         $numsitu = $model->setDescription($lc, $de, $pa, $lo, $so, $ca, $to, $dd, $df, $ty, $te, $ac, $av, $ideleve);
                     } else {
                         //modifier les données
                         $model->updateDescription($numsitu, $lc, $de, $pa, $lo, $so, $ca, $to, $dd, $df, $ty, $te, $ac, $av);
                     }
                 }
                 break;
             case 2:
                 //écran caractérisation
                 if ($this->util->estEtudiant()) {
                     $activchoisies = $get["lesactivschoisies"];
                     $model->gereActivChoisie($numsitu, $activchoisies);
                 }
                 break;
             case 3:
                 //saisie reformulation
                 if ($this->util->estEtudiant()) {
                     $lescom = $get["comm"];
                     $idact = $get["idact"];
                     for ($i = 0; $i < count($lescom); $i++) {
                         $model->enregReformul($numsitu, $this->ha($lescom[$i]), $idact[$i]);
                     }
                 }
                 break;
             case 4:
                 // productions
                 if ($this->util->estEtudiant()) {
                     $de = $get["designation"];
                     // tableau de désignations
                     $ad = $get["adresse"];
                     // tableau des adresses
                     $codeP = $get["codeP"];
                     //tableau des codes productions
                     if (isset($get["chksup"])) {
                         $chksup = $get["chksup"];
                     } else {
                         $chksup = null;
                     }
                     //les tableaux ont la même taille, sauf chksup
                     $nb = count($de);
                     for ($i = 0; $i < $nb - 1; $i++) {
                         $model->updateProduction($numsitu, $codeP[$i], $this->ha($de[$i]), $this->ha($ad[$i]));
                     }
                     if ($de[$nb - 1] != "") {
                         $model->ajouteProduction($numsitu, $this->ha($de[$nb - 1]), $this->ha($ad[$i]));
                     }
                     for ($i = 0; $i < count($chksup); $i++) {
                         $model->supprProduction($numsitu, $chksup[$i]);
                     }
                 }
                 break;
             case 5:
                 //commentaires prof(s)
                 if ($commenter == "P" && $this->util->estProf()) {
                     if ($numsitu > 0) {
                         $txt = $this->ha($get["commnew"]);
                         if ($txt != '') {
                             $model->setCommentaire($numsitu, $txt, $this->util->getId());
                         }
                         if (isset($get["chksup"])) {
                             $model->supprCommentaire($get["chksup"]);
                         }
                         if (isset($get["comm"])) {
                             $model->majCommentaire($get["commref"], $get["comm"]);
                         }
                     }
                 }
                 break;
         }
     }
     //fin gestion du bouton enregistrer
     //pr�paration donn�es ihm � afficher
     switch ($vers) {
         case 1:
             //donn�es situation
             $data = array("typesitu" => $model->getTypeSitu(), "localisation" => $model->getLocalisation(), "source" => $model->getSource(), "cadre" => $model->getCadre(), "type" => $model->getType(), "typologie" => $model->getTypologie());
             if ($numsitu != 0) {
                 $data["lasitu"] = $model->getSitu1($numsitu);
             }
             break;
         case 2:
             //s�lection activit�s
             $data = array("typeactiv" => $model->getActivites(), "lescomp" => $model->getCompetences());
             if ($numsitu != 0) {
                 $data["lasitu"] = $model->getSitu3($numsitu);
                 $data["lesactiv"] = $model->getSitu2($numsitu);
             }
             break;
         case 3:
             //ecran reformulation activit�(s) par �l�ve
             if ($numsitu != 0) {
                 $data["lasitu"] = $model->getSitu3($numsitu);
             }
             $data["lesactiv"] = $model->getSitu4($numsitu);
             break;
         case 4:
             //saisie productions
             $data = array();
             if ($numsitu != 0) {
                 $data["lasitu"] = $model->getSitu3($numsitu);
                 $data["lesprod"] = $model->getProd($numsitu);
             }
             break;
         case 5:
             //saisie ou affichage commentaires profs
             $data = array();
             if ($numsitu != 0) {
                 $data["lasitu"] = $model->getSitu3($numsitu);
                 $data["lescomm"] = $model->getCommentaire($numsitu);
                 $data["idprof"] = $this->util->getId();
             }
             break;
     }
     //fin pr�parations sp�cifiques
     //pour toutes les ihm :
     $data["etudiant"] = $model->getAuteurSitu($numsitu);
     $model->close();
     $data["numsitu"] = $numsitu;
     $data["commenter"] = $commenter;
     $data["auth"] = $this->util->estAuthent();
     //appel page sp�cifique avec $data
     $this->view->init('saisie' . $vers . '.php', $data);
     $this->setViewBas();
 }
Example #17
0
 public function __construct($util, $get = null)
 {
     parent::__construct($util);
     $this->model();
     $texte = null;
     if (isset($get["num"])) {
         $num = $get["num"];
     } else {
         $num = null;
     }
     $rech = false;
     // si null, vient de menua (menu admin)
     $model = new Model();
     $crypte = new Crypte();
     if (!is_null($num)) {
         //origine=clic un bouton enregistrer ou supprimer
         if (isset($get["envoi"])) {
             $enregistrer = $get["envoi"];
         } else {
             $enregistrer = null;
         }
         if (!is_null($enregistrer)) {
             //on a cliqué un bouton envoi
             switch ($num) {
                 case 1:
                     //vient de la page groupe
                     $nombouton = $get["envoi"];
                     if ($nombouton == "Enregistrer") {
                         if ($get["nom"] != '' && $get['an'] != '') {
                             if (preg_match("/^[0-9]{2}/", $get["an"])) {
                                 $nom = $this->ha($get["nom"]);
                                 $an = $this->ha($get["an"]);
                                 $parcours = $get["parcours"];
                                 if (!isset($get["numgroupe"])) {
                                     //création groupe
                                     if ($model->setGroupe($nom, $an, $parcours)) {
                                         $texte = 'Groupe cr&eacute;&eacute;';
                                     } else {
                                         $texte = 'Ce groupe existe d&eacute;j&agrave;';
                                     }
                                 } else {
                                     //modif groupe
                                     $numgroupe = $get["numgroupe"];
                                     $rep = $model->modifGroupe($numgroupe, $nom, $an, $parcours);
                                     $texte = 'Groupe modifi&eacute;';
                                 }
                             }
                         }
                     }
                     if ($nombouton == "Supprimer") {
                         if (isset($get["numgroupe"])) {
                             $numgroupe = $get["numgroupe"];
                             if ($numgroupe != 0) {
                                 $model->delGroupe($numgroupe);
                                 $texte = 'Groupe supprim&eacute;';
                             }
                         }
                     }
                     break;
                 case 2:
                     //vient bouton enregistrement prof
                     $nombouton = $get["envoi"];
                     if ($nombouton == "Enregistrer") {
                         $nom = $this->ha($get["nom"]);
                         $mel = $this->ha($get["mel"]);
                         if ($nom != '' && $mel != '' && $this->ctrlmel($mel)) {
                             $prenom = $this->ha($get["prenom"]);
                             $niveau = $get["niveau"];
                             if (isset($get["chk"])) {
                                 $chk = $get["chk"];
                             } else {
                                 $chk = array();
                             }
                             if (!isset($get["numprof"])) {
                                 //création
                                 $res = $model->setProf($nom, $prenom, $mel, $niveau, $crypte->getSmtp(), $crypte->getCrypte());
                                 if ($res) {
                                     $numprof = $model->getId();
                                     $model->affecteGroupe($numprof, $chk);
                                 }
                             } else {
                                 //maj
                                 $numprof = $get["numprof"];
                                 if (isset($get["chmdp"])) {
                                     $mdp = $this->ha($get["mdp"]);
                                 } else {
                                     $mdp = null;
                                 }
                                 $res = $model->modifProf($numprof, $nom, $prenom, $mel, $niveau, $mdp, $crypte->getSmtp(), $crypte->getCrypte());
                                 if ($res) {
                                     $model->modifAffecteGroupe($numprof, $chk);
                                 }
                             }
                             if ($res) {
                                 $texte = 'donn&eacute;es enregistr&eacute;es';
                             } else {
                                 $texte = 'pas d\'enregistrement (doublon)';
                             }
                         } else {
                             $texte = 'donn&eacute;es incorrectes';
                         }
                     }
                     if ($nombouton == "Supprimer") {
                         $numprof = $get["numprof"];
                         if (!is_null($numprof)) {
                             if ($numprof != 0) {
                                 $model->suppProf($numprof);
                                 $texte = 'Professeur supprim&eacute;';
                             }
                         }
                     }
                     break;
                 case 3:
                     //vient bouton enregistrement étudiant
                     $nombouton = $get["envoi"];
                     if ($nombouton == "Enregistrer") {
                         $nom = $this->ha($get["nom"]);
                         $prenom = $this->ha($get["prenom"]);
                         $mel = $this->ha($get["mel"]);
                         if ($nom != '' && $mel != '' && $this->ctrlmel($mel)) {
                             $groupe = $get["groupe"];
                             if ($groupe == 0) {
                                 $groupe = 'null';
                             }
                             if (!isset($get["numetud"])) {
                                 $res = $model->setEtudiant($nom, $prenom, $mel, $groupe, $crypte->getSmtp(), $crypte->getCrypte());
                             } else {
                                 $numetud = $get["numetud"];
                                 if (isset($get["chmdp"])) {
                                     $mdp = $this->ha($get["mdp"]);
                                 } else {
                                     $mdp = null;
                                 }
                                 $res = $model->modifEtudiant($numetud, $nom, $prenom, $mel, $groupe, $mdp, $crypte->getSmtp(), $crypte->getCrypte());
                             }
                             if ($res) {
                                 $texte = 'donn&eacute;es enregistr&eacute;es';
                             } else {
                                 $texte = 'pas d\'enregistrement (doublon)';
                             }
                         } else {
                             $texte = 'donn&eacute;es incorrectes';
                         }
                     }
                     if ($nombouton == "Supprimer") {
                         $numetud = $get["numetud"];
                         if (!is_null($numetud)) {
                             if ($numetud != 0) {
                                 $model->suppEtud($numetud);
                                 $texte = '&Eacute;tudiant supprim&eacute;';
                             }
                         }
                     }
                     break;
                 case 4:
                     //on vient page recherche objet
                     $rech = true;
                     $nombouton = $get["envoi"];
                     if ($nombouton == "Rechercher") {
                         $codeobj = $get["groupes"];
                         if ($codeobj > 0) {
                             $num = 1;
                         } else {
                             $codeobj = $get["professeurs"];
                             if ($codeobj > 0) {
                                 $num = 2;
                             } else {
                                 $codeobj = $get["etudiants"];
                                 $num = 3;
                             }
                         }
                     }
                     break;
                 case 5:
                     //on vient page téléversement fichier élève
                     $repfic = 'dirrw/upload/';
                     $groupe = $get["groupes"];
                     if ($groupe == 0) {
                         $texte = "choisir le groupe d'affectation";
                     } else {
                         $texte = "";
                         if (empty($_FILES['fichier']['name'])) {
                             $texte = "aucun fichier s&eacute;lectionn&eacute;";
                         } else {
                             $tmp = $_FILES['fichier']['tmp_name'];
                             if (!is_uploaded_file($tmp)) {
                                 $texte = "fichier non trouv&eacute;";
                             } else {
                                 $nf = $_FILES['fichier']['name'];
                                 if ($nf != "noms.csv") {
                                     $texte = "ce nom de fichier ne convient pas";
                                 } else {
                                     if (!move_uploaded_file($tmp, $repfic . $nf)) {
                                         $texte = "impossible de copier le fichier";
                                     } else {
                                         $texte = "le fichier a &eacute;t&eacute; t&eacute;l&eacute;vers&eacute;";
                                         //$nb=$this->enregData($groupe);
                                         //on lit le fichier de noms, on les enregistre dans la BD
                                         // puis on efface le fichier
                                         //on compte le nombre d'erreurs d'enregistrement
                                         $flu = fopen("dirrw/upload/noms.csv", "r");
                                         $nb = 0;
                                         //nb erreurs
                                         while ($ligne = fgetcsv($flu, 140, ";")) {
                                             $nom = $ligne[0];
                                             $prenom = $ligne[1];
                                             $mel = $ligne[2];
                                             //tester vraisemblances : à faire pour plus tard...
                                             if (!$model->setEtudiant($nom, $prenom, $mel, $groupe, $crypte->getSmtp(), $crypte->getCrypte())) {
                                                 $nb++;
                                             }
                                         }
                                         fclose($flu);
                                         //supprimer fichier
                                         unlink("dirrw/upload/noms.csv");
                                         if ($nb == 0) {
                                             $texte .= " et les donn&eacute;es mises &agrave; jour";
                                         } else {
                                             $texte .= " mais son contenu n'est pas correct (" . $nb . " probl&egrave;me(s))";
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     break;
             }
         }
     } else {
         $num = 1;
     }
     $this->setViewMenu();
     switch ($num) {
         case 1:
             if ($rech) {
                 $data = array("groupe" => $model->getGroupe($codeobj));
             } else {
                 $data = array("groupes" => $model->getGroupes());
             }
             break;
         case 2:
             if ($rech) {
                 $data = array("professeur" => $model->getProfesseur($codeobj), "groupes" => $model->getGroupesProf($codeobj));
             } else {
                 $data = array("groupes" => $model->getGroupes());
             }
             break;
         case 3:
             if ($rech) {
                 $data = array("etudiant" => $model->getEtudiant($codeobj), "groupes" => $model->getGroupes());
             } else {
                 $data = array("groupes" => $model->getGroupes());
             }
             break;
         case 4:
             $data = array("groupes" => $model->getGroupes(), "professeurs" => $model->getProfesseurs(), "etudiants" => $model->getEtudiants());
             break;
         case 5:
             $data = array("groupes" => $model->getGroupes());
     }
     $data["lng"] = $model->getLng();
     $model->close();
     $data["param"] = $num;
     $data["messagetexte"] = $texte;
     $data["auth"] = $this->util->estAuthent();
     $this->view->init('groupe' . $num . '.php', $data);
     $this->setViewBas();
 }
Example #18
0
 function enregDataEtudXML($repfic, $nf)
 {
     $ok = '';
     $this->model();
     $model = new Model();
     if ($ch = implode("", file($repfic . $nf))) {
         $data = 'sauvegarde';
         $tb1 = preg_split("/<\\/?" . $data . ".*>/", $ch);
         $dataSv = array("ref", "datesv");
         foreach ($dataSv as $balise) {
             $tb2 = preg_split("/<\\/?" . $balise . ">/", $tb1[1]);
             $res[] = $tb2[1];
         }
         $ref = $res[0];
         $datesv = $res[1];
         if (substr($nf, 4, 13) == $ref) {
             $data = 'etudiant';
             $tb1 = preg_split("/<\\/?" . $data . ".*>/", $ch);
             $ch = $tb1[1];
             $res = null;
             $dataEleve = array("nom", "prenom", "mel");
             foreach ($dataEleve as $balise) {
                 $tb2 = preg_split("/<\\/?" . $balise . ">/", $ch);
                 $res[] = $tb2[1];
             }
             $ch = $tb2[2];
             //$nom=$res[0];
             //$prenom=$res[1];
             $mel = $res[2];
             $resmel = $model->existeMelEtudiant($mel);
             $num = $resmel[0]["num"];
             if (!is_null($num)) {
                 $model->supprSituEtudiantTout($num);
                 $chSit = "situation";
                 $tb4 = preg_split("/<\\/?" . $chSit . ".*>/", $ch);
                 for ($i = 1; $i < count($tb4) - 1; $i += 2) {
                     //itération sur situation
                     $res = null;
                     $dataSit = array("ref", "codeType", "codeLocalisation", "codeSource", "codeCadre", "libcourt", "descriptif", "contexte", "datedebut", "datefin", "environnement", "moyen", "avisperso");
                     foreach ($dataSit as $balise) {
                         $tb2 = preg_split("/<\\/?" . $balise . ">/", $tb4[$i]);
                         $res[] = $tb2[1];
                     }
                     $ref = $model->creeSituation($res, $num);
                     $chPro = "avisprof";
                     $tb5 = preg_split("/<\\/?" . $chPro . ".*>/", $tb4[$i]);
                     for ($j = 1; $j < count($tb5) - 1; $j += 2) {
                         $res = null;
                         $dataPro = array("commentaire", "datecommentaire", "numprof", "nomprof", "melprof");
                         foreach ($dataPro as $balise) {
                             $tb2 = preg_split("/<\\/?" . $balise . ">/", $tb5[$j]);
                             $res[] = $tb2[1];
                         }
                         $model->creeCommentaire($res, $ref);
                     }
                     $chPro = "activitecitee";
                     $tb5 = preg_split("/<\\/?" . $chPro . ".*>/", $tb4[$i]);
                     for ($j = 1; $j < count($tb5) - 1; $j += 2) {
                         $res = null;
                         $dataPro = array("idActivite", "commentaireactivite");
                         foreach ($dataPro as $balise) {
                             $tb2 = preg_split("/<\\/?" . $balise . ">/", $tb5[$j]);
                             $res[] = $tb2[1];
                         }
                         $model->creeActivitecitee($res, $ref);
                     }
                     $chPro = "production";
                     $tb5 = preg_split("/<\\/?" . $chPro . ".*>/", $tb4[$i]);
                     for ($j = 1; $j < count($tb5) - 1; $j += 2) {
                         $res = null;
                         $dataPro = array("designation", "adresse");
                         foreach ($dataPro as $balise) {
                             $tb2 = preg_split("/<\\/?" . $balise . ">/", $tb5[$j]);
                             $res[] = $tb2[1];
                         }
                         $model->creeProduction($res, $ref);
                     }
                     $chPro = "typologie";
                     $tb5 = preg_split("/<\\/?" . $chPro . ".*>/", $tb4[$i]);
                     for ($j = 1; $j < count($tb5) - 1; $j += 2) {
                         $res = null;
                         $dataPro = array("codeTypologie");
                         foreach ($dataPro as $balise) {
                             $tb2 = preg_split("/<\\/?" . $balise . ">/", $tb5[$j]);
                             $res[] = $tb2[1];
                         }
                         $model->creeTypologie($res, $ref);
                     }
                 }
             } else {
                 $ok = "mel &eacute;tudiant inconnu";
             }
         } else {
             $ok = 'mauvaise r&eacute;f&eacute;rence de fichier';
         }
     } else {
         $ok = "erreur fichier serveur";
     }
     $model->close();
     return $ok;
 }
Example #19
0
<?php

include_once 'cadastro_controller.php';
include_once 'cadastro_model.php';
include_once 'cadastro_view.php';
$model = new Model();
$controller = new Controller($model);
$view = new View($controller, $model);
if (isset($_GET['action'])) {
    $controller->{$_GET['action']}($_POST);
}
echo $view->cadastro();
$model->close();
Example #20
0
 public function __construct($util, $get = null)
 {
     parent::__construct($util);
     $this->model();
     $model = new Model();
     $texte = null;
     if (isset($get["num"])) {
         //vient de l'ihm
         $num = $get["num"];
         $enregistrer = $get["envoi"];
         if (!is_null($enregistrer)) {
             //on a cliqué un bouton enregistrer
             $ret = false;
             $crypte = new Crypte();
             if ($num == 1) {
                 //prof ou lecteur
                 //if (isset($get["auto"])) $a='O'; else $a='N';
                 $nom = $this->ha($get["nom"]);
                 $prenom = $this->ha($get["prenom"]);
                 $mel = $this->ha($get["mel"]);
                 if (isset($get["chmdp"])) {
                     $mdp = $this->ha($get["mdp"]);
                 } else {
                     $mdp = null;
                 }
                 if ($this->ctrlmel($mel)) {
                     $ret = $model->majProf($get["numpers"], $nom, $prenom, $mel, $mdp, $crypte->getCrypte(), $crypte->getSmtp());
                 }
             } else {
                 if ($num == 3) {
                     //étudiant
                     $nom = $this->ha($get["nom"]);
                     $prenom = $this->ha($get["prenom"]);
                     $mel = $this->ha($get["mel"]);
                     $numexam = $this->ha($get["numexam"]);
                     if (isset($get["chmdp"])) {
                         $mdp = $this->ha($get["mdp"]);
                     } else {
                         $mdp = null;
                     }
                     if ($this->ctrlmel($mel)) {
                         $ret = $model->majEleve($get["numpers"], $nom, $prenom, $mel, $mdp, $crypte->getCrypte(), $crypte->getSmtp(), $numexam);
                     }
                 }
             }
             if ($ret) {
                 $texte = "Donn&eacute;es enregistr&eacute;es";
             } else {
                 $texte = "Donn&eacute;es incorrectes";
             }
         }
     }
     if ($this->util->estProf() || $this->util->estLecteur()) {
         //prof ou lecteur
         $data["data"] = $model->getProfesseurModif($util->getId());
         $data["num"] = 1;
     } else {
         if ($this->util->estEtudiant()) {
             //etudiant
             $data["data"] = $model->getEleveModif($util->getId());
             $data["num"] = 3;
         }
     }
     $data["lngmdp"] = $model->getLng();
     $model->close();
     $data["messagetexte"] = $texte;
     $data["auth"] = $this->util->estAuthent();
     $this->setViewMenu();
     $this->view->init('modif.php', $data);
     $this->setViewBas();
 }
Example #21
0
 public function __construct($util, $get = null)
 {
     parent::__construct($util);
     $this->model();
     $model = new Model();
     $nbsauve = 3;
     //nombre max de sauvegardes par étudiant
     $dec = 0;
     //valeur indentation
     $decsup = 2;
     //incrément d'indentation
     $nt = $this->util->getId();
     $nf = substr('0000' . $nt, -4, 4);
     $refsauve = uniqid();
     $repfic = 'dirrw/xml/';
     $extene = '.xml';
     // ne conserve que nbsauve fichiers
     $dir = opendir($repfic);
     $fics = array();
     $nbfics = 0;
     while ($fic = readdir($dir)) {
         if (substr($fic, 0, 4) == $nf) {
             $fics[] = $fic;
             $nbfics++;
         }
     }
     if ($nbfics >= $nbsauve) {
         //il y a trop de fichiers on en supprime nbsauve-1
         rsort($fics);
         for ($i = $nbsauve - 1; $i < $nbfics; $i++) {
             //normalement un seul à effacer
             unlink($repfic . $fics[$i]);
         }
     }
     closedir($dir);
     //sauvegarde, on en ajoute 1 dans le répertoire
     $nomfice = $repfic . $nf . $refsauve . "G" . $extene;
     $fic = fopen($nomfice, "w");
     $entete = '<?xml version="1.0" encoding="ISO-8859-1"  standalone="yes" ?' . ">\r\n";
     fputs($fic, $entete);
     fputs($fic, $this->lgx($dec, "suivicomp", "", "", 1));
     $dec += $decsup;
     fputs($fic, $this->lgx($dec, "sauvegarde", "ref", $refsauve, 2));
     $dec += $decsup;
     fputs($fic, $this->lgx($dec, "ref", "", $refsauve, 3));
     fputs($fic, $this->lgx($dec, "datesv", "", date("Y-m-d"), 3));
     $dec -= $decsup;
     fputs($fic, $this->lgx($dec, "sauvegarde", "", "", 4));
     $ligne = $model->getEtudiant($nt);
     fputs($fic, $this->lgx($dec, "etudiant", "numero", $nt, 2));
     $dec += $decsup;
     fputs($fic, $this->lgx($dec, "nom", "", $ligne[0]["nom"], 3));
     fputs($fic, $this->lgx($dec, "prenom", "", $ligne[0]["prenom"], 3));
     fputs($fic, $this->lgx($dec, "mel", "", $ligne[0]["mel"], 3));
     $tbs = $model->getSituationsXML($nt);
     //chaque situation
     foreach ($tbs as $situ) {
         $ns = $situ["ref"];
         fputs($fic, $this->lgx($dec, "situation", "ref", $ns, 2));
         $dec += $decsup;
         //chaque donnée d'une situ
         foreach ($situ as $cle => $val) {
             fputs($fic, $this->lgx($dec, $cle, "", $val, 3));
         }
         //les commentaires
         $com = $model->getCommentaireSauve($ns);
         if (count($com > 0)) {
             foreach ($com as $valid) {
                 fputs($fic, $this->lgx($dec, "avisprof", "", "", 1));
                 $dec += $decsup;
                 //chaque donnée d'un comm
                 foreach ($valid as $cle => $val) {
                     fputs($fic, $this->lgx($dec, $cle, "", $val, 3));
                 }
                 $dec -= $decsup;
                 fputs($fic, $this->lgx($dec, "avisprof", "", "", 4));
             }
         }
         //les activites citées
         $tbp = $model->getActiviteCitee($ns);
         //chaque activite citee
         foreach ($tbp as $act) {
             $numact = $act["idActivite"];
             fputs($fic, $this->lgx($dec, "activitecitee", "numero", $numact, 2));
             $dec += $decsup;
             //chaque donnée d'une activite citee
             foreach ($act as $cle => $val) {
                 fputs($fic, $this->lgx($dec, $cle, "", $val, 3));
             }
             $dec -= $decsup;
             fputs($fic, $this->lgx($dec, "activitecitee", "", "", 4));
         }
         //les productions
         $tbp = $model->getProduction($ns);
         //chaque production
         foreach ($tbp as $prod) {
             $nc = $prod["numero"];
             fputs($fic, $this->lgx($dec, "production", "numero", $nc, 2));
             $dec += $decsup;
             //chaque donnée d'une production
             foreach ($prod as $cle => $val) {
                 fputs($fic, $this->lgx($dec, $cle, "", $val, 3));
             }
             $dec -= $decsup;
             fputs($fic, $this->lgx($dec, "production", "", "", 4));
         }
         //les typologies (types situation obligatoires)
         $tbp = $model->getTypologies($ns);
         //chaque typologie
         foreach ($tbp as $typo) {
             //$nc=$prod["numero"];
             fputs($fic, $this->lgx($dec, "typologie", "", "", 1));
             $dec += $decsup;
             //chaque donnée d'une typologie
             foreach ($typo as $cle => $val) {
                 fputs($fic, $this->lgx($dec, $cle, "", $val, 3));
             }
             $dec -= $decsup;
             fputs($fic, $this->lgx($dec, "typologie", "", "", 4));
         }
         $dec -= $decsup;
         fputs($fic, $this->lgx($dec, "situation", "", "", 4));
     }
     //fin chaque situation
     $dec -= $decsup;
     fputs($fic, $this->lgx($dec, "etudiant", "", "", 4));
     $dec -= $decsup;
     fputs($fic, $this->lgx($dec, "suivicomp", "", "", 4));
     fclose($fic);
     $model->close();
     $this->setViewMenu();
     $data["fic"] = $nf . $refsauve . "G" . $extene;
     $data["auth"] = $this->util->estAuthent();
     $this->view->init('sauvee.php', $data);
     $this->setViewBas();
 }