Example #1
0
 public function index()
 {
     parent::view("shared/header");
     parent::view("intern/menu");
     //Si l'usager à envoyer une évaluation, l'enregistrer
     if (isset($_POST['id'])) {
         parent::model("ratings");
         $rating = new ratings();
         $rating->RatingProject($_SESSION['ID'], $_POST['id'], $_POST['rating']);
     }
     parent::model("projects");
     $model = new projects();
     //Obtenir le projet assigné.
     $data['project'] = $model->ShowProjectByIntern($_SESSION['ID']);
     //Sinon obtenir tous les projets.
     if ($data['project'] == null) {
         $data['projects'] = $model->ShowProjectByStatus(1);
         parent::model("business");
         $model = new business();
         parent::model("ratings");
         $rating = new ratings();
         if ($data['projects'] != null) {
             foreach ($data['projects'] as $project) {
                 //Obtenir les informations de l'entreprise.
                 $data['cie'][$project->businessID] = $model->ShowCieByID($project->businessID);
                 //Obtenir le rating.
                 $data['ratings'][$project->ID] = $rating->FindRateByID($_SESSION['ID'], $project->ID);
             }
         }
         parent::view("intern/list", $data);
     } else {
         parent::model("business");
         $model = new business();
         //Obtenir les informations de l'entreprise.
         $data['cie'][$data['project']->ID] = $model->ShowCieByID($data['project']->businessID);
         parent::view("intern/index", $data);
     }
     parent::view("shared/footer");
 }
 public function assign()
 {
     parent::model("ratings");
     $ratings = new ratings();
     //Obtenir toutes les évaluations.
     $ratings = $ratings->ShowAllRatings();
     parent::model("projects");
     $projects = new projects();
     //Obtenir tous les projets autorisés.
     $data["projects"] = $projects->ShowProjectByStatus(true);
     if (isset($ratings) && isset($data["projects"])) {
         foreach ($ratings as $rating) {
             $data['ratings'][$rating['projectID']][$rating['internID']] = $rating['score'];
         }
         if (isset($_POST['setAssign'])) {
             $data['alert'] = "alert-success";
             $data['message'] = "Le jumelage a bien été fait.";
         }
     }
     parent::model("accounts");
     $interns = new accounts();
     //Obtenir tous les stagiaires.
     $data["interns"] = $interns->ShowUsersByRank(2);
     parent::view("shared/header");
     parent::view("advisor/menu");
     parent::view("advisor/assign", $data);
     parent::view("shared/footer");
 }