Example #1
0
 function attributeNote($id_Station, $id_Etudiant, array $inputs, $id_Enseignant)
 {
     $id_Examen = Station::whereIdStation($id_Station)->first()->id_Examen;
     $id_Session = Examen::whereIdExamen($id_Examen)->first()->id_Session;
     $id_Note_Examen = $this->createNoteExamen($id_Examen, $id_Session, $id_Etudiant);
     $arrayStatus = $this->createNoteStation($id_Note_Examen, $id_Station, $id_Enseignant);
     $id_Banque = Station::whereIdStation($id_Station)->first()->id_Banque;
     $items = Item::whereIdBanque($id_Banque)->get();
     if (count($items) != count($inputs)) {
         return response()->json(['status' => 0], 200);
     } else {
         if ($arrayStatus['status'] == 1) {
             $id_Note_Station = $arrayStatus['id_Note_Station'];
             $i = 0;
             foreach ($items as $item) {
                 $this->createItemNote($item->id_Item, $id_Note_Station, $inputs[$i]);
                 $i++;
             }
             return 1;
         } else {
             return 2;
             //Note Station existe
         }
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($sessionId = null, $examenId = null, $stationId = null)
 {
     if (is_null($stationId)) {
         // display the hole examen in Specific Session
         $stations = $this->gestSession->getStations($examenId);
         return view('stationView')->with('stations', $stations)->with('sessionId', $sessionId)->with('examenId', $examenId);
     } else {
         // display specific session
         $station = $this->gestSession->getStation($stationId);
         $contexte = $this->gestSession->getContexte($station->id_Contexte);
         $critere = $this->gestSession->getCritere($station->id_Critere);
         $domaine = $this->gestSession->getDomaine($station->id_Domaine);
         $systeme = $this->gestSession->getSysteme($station->id_Systeme);
         $items = Item::whereIdBanque($station->id_Banque)->join('Competence', 'Item.id_Competence', '=', 'Competence.id_Competence')->OrderBy('id_Item', 'asc')->get();
         return view('stationDetailView')->with('station', $station)->with('sessionId', $sessionId)->with('examenId', $examenId)->with('stationId', $stationId)->with('contexte', $contexte)->with('critere', $critere)->with('domaine', $domaine)->with('systeme', $systeme)->with('items', $items);
     }
 }