/**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $matieres = Matiere::all();
     $profs = Enseignant::activeEnseignants();
     $promos = Promo::activePromos();
     $modules = Module::all();
     return View('app/gestion_matieres', ['matieres' => $matieres, 'profs' => $profs, 'promos' => $promos, 'modules' => $modules]);
 }
Example #2
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $options = array();
     $series = DB::table('series')->orderBy('id')->distinct()->get();
     $profils = DB::table('users')->join('user_info', 'users.id', '=', 'user_info.iduser_info');
     if (Input::has('search')) {
         $search = explode(",", Input::get('search'));
         $ids = DB::table('user_tags');
         $i = 0;
         foreach ($search as $s) {
             if ($s != '') {
                 $liste_ids_forS = Tag::where('info_tags', '=', $s)->lists('id');
                 $ids->whereIn('id', $liste_ids_forS);
             }
         }
         $ids = $ids->select('id')->distinct();
         Debugbar::info($ids->lists('id'));
         $profils = $profils->whereIn('users.id', $ids->lists('id'));
         Debugbar::info('il y a ' . $profils->count('users.id') . ' profil(s) retourné(s) par la requête');
     }
     if (Input::has('serie')) {
         $profils = $profils->whereIn('info_promo_type', explode(' ', Input::get('serie')));
     }
     if (Input::has('annee')) {
         $profils = $profils->whereIn('info_promo', explode(' ', Input::get('annee')));
         if (empty(Input::except('annee'))) {
             $img = Promo::whereIn('year', explode(' ', Input::get('annee')))->get()->first();
             // reste à récupérer l’image correspondant à la promo :)
             $options['promo_image'] = Input::get('annee');
         }
     }
     /* Données essentielles à la page de recherche normale */
     // on s’occupe des profils dans le retour de page, afin de remplir la condition avant de paginer
     $options['series'] = $series;
     /* Ajout des données accessoires */
     if (isset($img) && $img) {
         $options['promo_image'] = $img;
     }
     /* Sélecteur principal de vues */
     if ($profils->get()) {
         $profils = $profils->paginate(15);
         // on get(), mais avec de la pagination :)
         $options['profils'] = $profils->appends(Input::except('page'));
         // le append permet d’avoir une pagination correcte (sans perdre le fil :)
         return view('search.search', $options);
     } else {
         return view('search.empty');
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $promo = Promo::find($id);
     $promo->state = 1;
     $promo->save();
     return redirect('/app/promos');
 }
Example #4
0
 public function show($id)
 {
     return view('welcome', ['promo' => Promo::findOrFail($id)]);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $promotions = Promo::all();
     $etu = Etudiant::find($id);
     return View('app/create_etudiant', ['stu' => $etu, 'promotions' => $promotions]);
 }
Example #6
0
 public function gestion_etudiants()
 {
     $students = Etudiant::all();
     $promotions = Promo::all();
     $administrators = Admin::all();
     return View('app/gestion_etudiants', array('students' => $students, 'promotions' => $promotions, 'administrators' => $administrators));
 }
Example #7
0
 public static function activePromos()
 {
     $liste = Promo::where('state', '=', 0)->get();
     return $liste;
 }