Ejemplo n.º 1
0
 public static function isChef($id)
 {
     $filiere = Filiere::where('enseignant_id', '=', $id);
     if ($filiere->count() == 1) {
         return $filiere;
     }
     return null;
 }
Ejemplo n.º 2
0
 public static function nbreEtudiantByFiliere($id)
 {
     $filiere = Filiere::find($id);
     $i = 0;
     if ($filiere != null) {
         $promos = $filiere->promos;
         if (count($promos) > 0) {
             foreach ($promos as $promo) {
                 if (count($promo->etudiants) > 0) {
                     $i = $i + count($promo->etudiants);
                 }
             }
         }
     }
     return $i;
 }
Ejemplo n.º 3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $filiere = Filiere::find($id);
     $filiere->delete();
     return redirect('/app/filieres');
 }
Ejemplo n.º 4
0
 public function moduleShowChef($id)
 {
     $filiere = Session::get('user')->filieres[0];
     $promotions = $filiere->promos;
     $etudiants_count = Filiere::nbreEtudiantByFiliere($filiere->id);
     $enseignants_count = Enseignant::count();
     $promos_count = count($promotions);
     $absences_count = 0;
     if ($promos_count > 0) {
         foreach ($promotions as $promotion) {
             $absences_count = $absences_count + Filiere::nbreAbsencesByPromo($promotion->id);
         }
     }
     $module = Module::find($id);
     $matieres = $module->matieres;
     $horaires = null;
     $i = 0;
     if (count($matieres) > 0) {
         foreach ($matieres as $matiere) {
             $horaires[$i] = $matiere->horaires;
             $i++;
         }
     }
     $absences = null;
     $j = 0;
     if (count($horaires) > 0) {
         foreach ($horaires as $horaire) {
             if (count($horaire) > 0) {
                 foreach ($horaire as $value) {
                     $absences[$j] = $value->absences;
                     $j++;
                 }
             }
         }
     }
     $students = null;
     $k = 0;
     if (count($absences) > 0) {
         foreach ($absences as $absence) {
             foreach ($absence as $key) {
                 $students[$k] = $key->etudiant;
                 $k++;
             }
         }
     }
     return View('app/etudiants_absences', ['etudiants_count' => $etudiants_count, 'enseignants_count' => $enseignants_count, 'absences_count' => $absences_count, 'promos_count' => $promos_count, 'filiere' => $filiere, 'promotions' => $promotions, 'module' => $module, 'students' => $students, 'statistics' => null]);
 }