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"); }