示例#1
0
 public function detailsEtudiantByEtudiant()
 {
     if (Request::ajax()) {
         $data = Request::All();
         $stagiaire = [];
         $etudiant = Etudiant::infos($data['idEtudiant']);
         $stagiaire['etudiant'] = $etudiant;
         $stage = Stage::where('idEtudiant', $etudiant->idEtudiant)->select('sujet', 'idTuteur')->first();
         if (count($stage) == 0) {
             $stage = new Stage();
             $tuteur = new Tuteur();
             $entreprise = new Entreprise();
             $entreprise->nom = "-";
             $tuteur->nomTuteur = "-";
             $tuteur->prenomTuteur = "";
             $stage->sujet = "-";
         } else {
             $tuteur = Tuteur::infos($stage->idTuteur);
             if (count($tuteur) == 0) {
                 $tuteur = new Tuteur();
             }
             $entreprise = Entreprise::where('id', $tuteur->idEntreprise)->select('nom')->first();
         }
         $stagiaire['stage'] = $stage;
         $stagiaire['tuteur'] = $tuteur;
         $stagiaire['entreprise'] = $entreprise;
         return $stagiaire;
     } else {
         return "Error.";
     }
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create($course_url, $stage_url)
 {
     $curso = Course::where('url', $course_url)->first();
     $etapa = Stage::where('url', $stage_url)->where('course_id', $curso->id)->first();
     $tiposItem = ItemType::all()->pluck('name', 'id');
     return view('pages.items.create', ['curso' => $curso, 'etapa' => $etapa, 'tiposItem' => $tiposItem]);
 }
 public function pagination($id)
 {
     $url_actual = "http://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
     $url_actual = explode('?', $url_actual);
     $pag = Stage::where('rb_stages.challenge_id', '=', $id)->join('rb_challenges', 'rb_challenges.id', '=', 'rb_stages.challenge_id')->select('rb_stages.*', 'rb_challenges.name as name_challenge')->orderBy('rb_stages.challenge_id', 'asc')->paginate(env('PAG'));
     $pag->setPath($url_actual[0]);
     return $pag;
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($course_url, $stage_url, $url)
 {
     $curso = Course::where('url', $course_url)->first();
     $etapa = Stage::where('url', $stage_url)->first();
     $item = Item::where('url', $url)->first();
     $tiposItem = ItemType::all()->pluck('name', 'id');
     return view('pages.items.edit', ['curso' => $curso, 'etapa' => $etapa, 'item' => $item, 'tiposItem' => $tiposItem]);
 }
示例#5
0
 public static function infosByEnseignant($idEnseignant)
 {
     $stage = Stage::where('idEnseignant', $idEnseignant)->join('utilisateur', 'utilisateur.id', '=', 'stage.idEtudiant')->select('nom as nomEtudiant', 'prenom as prenomEtudiant', 'stage.idEtudiant as idEtudiant')->get();
     /*
     $demandes = DB::table('demandeAppariement')
                     ->join('stage', 'stage.id', '=', 'demandeAppariement.idStage')
                     ->join('utilisateur', 'utilisateur.id', '=', 'stage.idEtudiant')
                     ->select('demandeAppariement.status', 'utilisateur.nom', 'utilisateur.prenom')
                     ->get();
     */
     return $stage;
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $ageGroupIds = array();
     foreach (AgeGroup::all() as $ageGroup) {
         $ageGroupIds[] = $ageGroup->id;
     }
     $principleIds = array();
     foreach (Principle::all() as $principle) {
         $principleIds[] = $principle->id;
     }
     DB::table('drills')->delete();
     DB::table('drills')->insert([['name' => 'Close Cone Passes', 'slug' => 'close-cone-passes', 'stage_id' => Stage::where('slug', 'warmup')->first()->id, 'age_id' => json_encode($ageGroupIds), 'principle_id' => json_encode($principleIds), 'image' => 'img/drills/100_shooter_keeper_shooting.gif'], ['name' => 'Close Cone Passes 2', 'slug' => 'close-cone-passes', 'stage_id' => Stage::where('slug', 'warmup')->first()->id, 'age_id' => json_encode($ageGroupIds), 'principle_id' => json_encode($principleIds), 'image' => 'img/drills/100_shooter_keeper_shooting.gif'], ['name' => 'Close Cone Passes 3', 'slug' => 'close-cone-passes', 'stage_id' => Stage::where('slug', 'warmup')->first()->id, 'age_id' => json_encode($ageGroupIds), 'principle_id' => json_encode($principleIds), 'image' => 'img/drills/100_shooter_keeper_shooting.gif'], ['name' => 'Short Short Long', 'slug' => 'short-short-long', 'stage_id' => Stage::where('slug', 'small-sided-game')->first()->id, 'age_id' => json_encode($ageGroupIds), 'principle_id' => json_encode($principleIds), 'image' => 'img/drills/100_shooter_keeper_shooting.gif'], ['name' => 'Short Short Long 2', 'slug' => 'short-short-long', 'stage_id' => Stage::where('slug', 'small-sided-game')->first()->id, 'age_id' => json_encode($ageGroupIds), 'principle_id' => json_encode($principleIds), 'image' => 'img/drills/100_shooter_keeper_shooting.gif'], ['name' => 'Shooter Keep Shooting', 'slug' => 'shooter-keep-shooting', 'stage_id' => Stage::where('slug', 'modified-small-sided-game')->first()->id, 'age_id' => json_encode($ageGroupIds), 'principle_id' => json_encode($principleIds), 'image' => 'img/drills/100_shooter_keeper_shooting.gif'], ['name' => 'Short Short Long 2', 'slug' => 'short-short-long', 'stage_id' => Stage::where('slug', 'small-sided-game')->first()->id, 'age_id' => json_encode($ageGroupIds), 'principle_id' => json_encode($principleIds), 'image' => 'img/drills/100_shooter_keeper_shooting.gif'], ['name' => 'Short Short Long 3', 'slug' => 'short-short-long', 'stage_id' => Stage::where('slug', 'small-sided-game')->first()->id, 'age_id' => json_encode($ageGroupIds), 'principle_id' => json_encode($principleIds), 'image' => 'img/drills/100_shooter_keeper_shooting.gif'], ['name' => 'Short Short Long 4', 'slug' => 'short-short-long', 'stage_id' => Stage::where('slug', 'small-sided-game')->first()->id, 'age_id' => json_encode($ageGroupIds), 'principle_id' => json_encode($principleIds), 'image' => 'img/drills/100_shooter_keeper_shooting.gif'], ['name' => 'Small Cones Outside Game', 'slug' => 'small-cones-outside-game', 'stage_id' => Stage::where('slug', 'game')->first()->id, 'age_id' => json_encode($ageGroupIds), 'principle_id' => json_encode($principleIds), 'image' => 'img/drills/100_shooter_keeper_shooting.gif'], ['name' => 'Small Cones Outside Game 2', 'slug' => 'small-cones-outside-game', 'stage_id' => Stage::where('slug', 'game')->first()->id, 'age_id' => json_encode($ageGroupIds), 'principle_id' => json_encode($principleIds), 'image' => 'img/drills/100_shooter_keeper_shooting.gif']]);
     $this->command->info('Drill table seeded!');
 }
 public static function index($id, array $data = ['y' => 0, 'time_start' => 0, 'time_end' => 0])
 {
     $challenge = Challenge::find($id);
     $challenge_name = $challenge->name;
     $cha = Challenge::listGroup();
     $flag = true;
     //        if(!Round::where('challenge_id','=',$id)->first()){
     $stage = Stage::where('challenge_id', '=', $id)->where('back', '=', 0)->where('active', '=', 1)->get()->toArray();
     $team = Team::where('challenge_id', '=', $id)->where('active', '=', 1)->orderBy('id', 'RAND()')->get()->toArray();
     $numStage = count($stage) + $data['y'];
     if ($data['time_start'] == 0 && $data['time_end'] == 0) {
         $date = new DateTime(Settings::ScheTrial());
         $time = 0;
         $pag = false;
         $hora_start = $date->format('H:i:s');
         $hora_end = date('H:i:s', strtotime($date->format('H:i:s') . '+' . $time . ' minute'));
         $date_end = new DateTime($hora_end);
         $time_dos = Settings::durationTrial();
         $hora_start = strtotime('+' . $time_dos . ' minute', strtotime($date_end->format('H:i:s')));
         $hora_start = date('H:i:s', $hora_start);
     } else {
         $date = new DateTime($data['time_start']);
         $time = 0;
         $pag = false;
         $hora_start = $date->format('H:i:s');
         $hora_end = date('H:i:s', strtotime($date->format('H:i:s') . '+' . $time . ' minute'));
         $date_end = new DateTime($hora_end);
         $time_dos = Settings::durationTrial();
         $hora_start = strtotime('+' . $time_dos . ' minute', strtotime($date_end->format('H:i:s')));
         $hora_start = date('H:i:s', $hora_start);
     }
     $p = 0;
     for ($i = $data['y']; $i <= count($team) - 1; $i++) {
         if (!Round::where('team_id', '=', $team[$i]['id'])->first()) {
             Round::create(['team_id' => $team[$i]['id'], 'challenge_id' => $team[$i]['challenge_id'], 'schedule_start' => $hora_end, 'schedule_end' => $hora_start, 'stage_id' => $stage[$p]['id']]);
         }
         if ($i == $numStage - 1) {
             RoundController::index($id, $data = ['y' => $i + 1, 'time_start' => $hora_start, 'time_end' => $hora_end]);
             break;
         }
         $p++;
     }
     //        }
     if (!ENV('DEVELOP')) {
         $pag = RoundController::pagination($id);
         $flag = true;
         return view('round.index', compact('flag', 'pag', 'cha', 'challenge_name', 'id'));
     }
 }
 /**
  * Agrega el ID del stage obteniendolo de la URL
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $stage_id = Stage::where('url', $request->stage_url)->first()->id;
     $items = Item::where('stage_id', $stage_id)->orderBy('position', 'desc')->get();
     //Si el curso no tiene stages
     if ($items->count() <= 0) {
         $request['position'] = 1;
     } else {
         $lastPosition = $items->first()->position;
         $request['position'] = $lastPosition + 1;
     }
     //Agrega ID del curso al request
     $request['stage_id'] = $stage_id;
     return $next($request);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next, $param)
 {
     switch ($param) {
         case "url":
             if (Stage::where('url', $request->url)->count() > 0) {
                 return $next($request);
             }
             break;
         case "id":
             if (Stage::find($request->id)) {
                 return $next($request);
             }
             break;
     }
     return redirect()->route('stages.index', ['course_url' => $request->course_url])->withErrors(['message' => 'Se est&aacute intentando editar una etapa inexistente']);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index($id)
 {
     $team = Team::where('challenge_id', '=', $id)->get();
     $group = Group::where('challenge_id', '=', $id)->get();
     $array = [];
     if (count($team) < 24) {
         $array += ['message' => 'Solo Puedes crear 4 grupos tienes ' . count($group)];
     } else {
         if (count($team) >= 24) {
             $array += ['message' => 'Solo Puedes crear 8 grupos tienes ' . count($group)];
         }
     }
     $datArray = $array;
     $stage = Stage::where('challenge_id', '=', $id)->lists('name', 'id');
     $challenge = Challenge::find($id);
     $name_challenge = $challenge->name;
     $cha = $id;
     $pag = $this->pagination($id);
     return view('groups.index', compact('stage', 'pag', 'cha', 'name_challenge', 'datArray'));
 }
示例#11
0
 public function group($id)
 {
     $faker = Faker::create();
     $counTeam = count(Team::where('challenge_id', '=', $id)->get());
     if ($counTeam < 24) {
         $crea = 4;
     } else {
         if ($counTeam >= 24) {
             $crea = 8;
         }
     }
     $sta = Stage::where('challenge_id', '=', $id)->where('back', '=', 0)->get()->toArray();
     $y = 0;
     for ($i = 1; $i <= $crea; $i++) {
         if ($y == count($sta) - 1) {
             $y = 0;
         }
         Group::create(['name' => 'Grupo ' . $i, 'challenge_id' => $id, 'stage_id' => $sta[$y]['id']]);
         $y++;
     }
 }
 public function getStageList(Request $request)
 {
     $data = $request->all();
     $user = User::where('id', $data['user_id'])->first();
     $Stage = Stage::where('category_id', $data['stage_id'])->get();
     $UserRecord = UserRecord::where('user_id', $user['id'])->get();
     for ($i = 0; $i < count($Stage); $i++) {
         $Stage[$i]['sort'] = $Stage[$i]['id'] % 100;
     }
     if (count($UserRecord) == 0) {
         for ($i = 0; $i < count($Stage); $i++) {
             $Stage[$i]['accuracy'] = 0;
         }
         for ($i = 0; $i < count($Stage); $i++) {
             $Stage[$i]['status'] = 4;
         }
     } else {
         for ($i = 0; $i < count($Stage); $i++) {
             $UserAccuracy = UserRecord::orderBy('stage_score', 'desc')->where('stages_id', $Stage[$i]['id'])->where('user_id', $user['id'])->first();
             if ($UserAccuracy == null) {
                 $Stage[$i]['accuracy'] = 0;
             } else {
                 $Stage[$i]['accuracy'] = $UserAccuracy['accuracy'];
             }
         }
         for ($i = 0; $i < count($Stage); $i++) {
             $UserStatus = UserRecord::orderBy('stage_score', 'desc')->where('stages_id', $Stage[$i]['id'])->where('user_id', $user['id'])->first();
             if ($UserStatus == null) {
                 $Stage[$i]['status'] = 4;
             } else {
                 $Stage[$i]['status'] = $UserStatus['status'];
             }
         }
     }
     // $UserRecord = UserRecord::where('user_id',  2)->get();
     // $StageRecord = $UserRecord->where('stages_id', 102)->first();
     return response()->json(['RetCode' => '1', 'Content' => ['stages' => $Stage]]);
 }
示例#13
0
 /**
  * Fetch visits for specified stage ID
  */
 public function fetch(Stage $stage)
 {
     $response;
     $visits = Visit::where('stage', '=', $stage->id)->get()->keyBy('id')->toArray();
     $rootStageFields = Stage::where('root', true)->first()->inputFields;
     foreach ($visits as $visitID => $visitData) {
         $models = array();
         foreach ($visitData['patients'] as $patientID) {
             $patient = Patient::where('id', $patientID);
             if ($patient->count() > 0) {
                 $models[$patientID] = $patient->first()->toArray();
             }
         }
         $visits[$visitID]['patient_models'] = $models;
     }
     if (count($visits) > 0) {
         $response = ["status" => "success", "message" => "Visits found.", "visits" => $visits];
     } else {
         $response = ["status" => "success", "message" => "No visits are currently at stage " . $stage->name . "."];
     }
     return response()->json($response);
 }
 public function ajaxChangerStatusStage()
 {
     if (Request::ajax()) {
         $data = Request::All();
         $stage = Stage::where('idTuteur', session('uid'))->where('id', $data['id'])->first();
         if ($data['status'] == "0") {
             $stage->tuteurValide = false;
         } else {
             $stage->tuteurValide = true;
         }
         $stage->save();
         return "1";
     } else {
         return "Error.";
     }
 }
示例#15
0
 public function getStage(Request $request)
 {
     $stage = Stage::where('challenge_id', '=', $request->challenge_id)->where('active', '=', '1')->where('active', '=', 1)->where('back', '=', 0)->lists('name', 'id')->toArray();
     return $stage;
 }
 private function traitementSubmitAvis($id, $request)
 {
     $this->validate($request, avisEtudiantRequest::rules());
     // Recupere le stage
     $stage = Stage::where('idEtudiant', session('uid'))->first();
     // Update les infos
     $stage->remunerationStage = $request->remunerationStage;
     $stage->montantRemuneration = $request->montantRemuneration;
     $stage->encadrageInformaticien = $request->encadrageInformaticien;
     $stage->appelInformaticien = $request->appelInformaticien;
     $stage->travailSeul = $request->travailSeul;
     $stage->tailleEquipe = $request->tailleEquipe;
     if ($request->typeMateriel == "PC") {
         $stage->typeMateriel = $request->typeMateriel;
     } else {
         $stage->typeMateriel = $request->typeMaterielAutreDetails;
     }
     $stage->typeSysteme = 0;
     foreach ($request->typeSysteme as $value) {
         //Valeur pour autre
         if ($value == 16) {
             $stage->typeSystemeAutre = $request->autreSysteme;
             $stage->typeSysteme += $value;
         }
         $stage->typeSysteme += $value;
     }
     $stage->langagesStage = $request->langages;
     $stage->objetPrincipal = 0;
     foreach ($request->objetStage as $value) {
         //Valeur pour autre
         if ($value == 64) {
             $stage->objetPrincipalAutre = $request->autreObjet;
         }
         $stage->objetPrincipal += $value;
     }
     $stage->satisactionStage = $request->satisactionStage;
     $stage->pourquoiSatisaction = $request->pourquoiSatisaction;
     $stage->satisactionObjectif = $request->objectifsAtteints;
     $stage->pourquoiObjectif = $request->objectifsAtteintsPourquoi;
     $stage->satisactionCours = $request->satisactionCours;
     $stage->pourquoiCours = $request->pourquoiCours;
     $stage->apportStage = $request->apportStage;
     // dd($stage);
     //Sauvegarde dans la base de données
     $stage->save();
     session()->flash('registred', true);
     return Redirect()->route('ficheEtudiant', ['id' => $id]);
 }
示例#17
0
 /**
  * Return a JSON list of pharmacy data
  *
  * @return \Illuminate\Http\Response
  */
 public function pharmacy(Request $request, $method)
 {
     switch ($method) {
         case "drugs":
             $pharmacy = Stage::where('type', 'pharmacy');
             if ($pharmacy->count() > 0) {
                 return response()->json(["status" => "success", "data" => $pharmacy->first()->fields]);
             } else {
                 return response()->json(["status" => "failure", "message" => "Pharmacy not configured."]);
             }
             break;
         default:
             return response()->json(["status" => "failure", "message" => "Unknown method"]);
             break;
     }
 }
 public function dataToCompteRenduVisite()
 {
     $data = [];
     $stage = Stage::where('idEtudiant', session('idEtudiantFocus'))->first();
     $entreprise = [];
     $contact = [];
     if (count($stage) > 0) {
         $tuteur = Tuteur::where('idUtilisateur', $stage->idTuteur)->first();
         if (count($tuteur) > 0) {
             $entreprise = Entreprise::where('id', $tuteur->idEntreprise)->first();
             if (count($entreprise) > 0) {
                 $contact = Contact::where('idEntreprise', $entreprise->id)->where('type', 1)->first();
             }
         }
     }
     if (count($entreprise) == 0) {
         $entreprise = new Entreprise();
     }
     $data['entreprise'] = $entreprise;
     if (count($stage) == 0) {
         $stage = new Stage();
     }
     $data['stage'] = $stage;
     if (count($contact) == 0) {
         $contact = new Contact();
     }
     $data['contact'] = $contact;
     // dd($entreprise);
     return $data;
 }
示例#19
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     //
     $stage = Stage::where('id', $id);
     // If the stage exists
     if ($stage->count() > 0) {
         // IF this stage isn't the root stage
         $stage = $stage->first();
         if ($stage->root !== true) {
             Schema::dropIfExists($stage->tableName);
             // If the delete succeeds
             if ($stage->delete()) {
                 return redirect()->route('console::flow::index')->with('alert', ['type' => 'success', 'message' => 'Stage deleted.']);
             } else {
                 return redirect()->route('console::flow::index')->with('alert', ['type' => 'failure', 'message' => 'An error occurred during deletion.']);
             }
         } else {
             return redirect()->route('console::flow::index')->with('alert', ['type' => 'failure', 'message' => 'This is the root stage, and cannot be deleted.']);
         }
     } else {
         return redirect()->route('console::flow::index')->with('alert', ['type' => 'failure', 'message' => 'Stage with ID ' . $id . 'does not exist.']);
     }
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($course_url, $url)
 {
     $curso = Course::where('url', $course_url)->first();
     $etapa = Stage::where('url', $url)->first();
     return view('pages.etapas.edit', ['curso' => $curso, 'etapa' => $etapa]);
 }
示例#21
0
文件: Stage.php 项目: gsk148/tasks
 public static function statusCreate()
 {
     $stage = Stage::where('id', '=', 1)->firstOrFail();
     return $stage->stage;
 }
 public function getTime(Request $request)
 {
     $da = $d = CombatRound::where('rb_combat_round.id', '=', $request->combat_id)->first();
     $data_challenge = Challenge::find($da->challenge_id);
     if ($request->flag == 'true') {
         $datos_s = CombatRound::where('rb_combat_round.stage_id', '=', $da->stage_id)->groupBy('group_id')->get()->toArray();
         for ($i = 0; $i <= count($datos_s) - 1; $i++) {
             if ($da->group_id == $datos_s[$i]['group_id']) {
                 if ($i == count($datos_s) - 1) {
                     return ['success' => false, 'datos' => 'Lo sentimos este es el ultimo grupo del escenario solo se puede retrasar tiempo.'];
                 } else {
                     $Stage_back = Stage::where('challenge_id', '=', $request->challenge_id)->where('back', '=', 1)->first();
                     $Group_upda = $datos_s[$i + 1]['group_id'];
                     $combat_update = CombatRound::where('group_id', '=', $Group_upda)->update(['stage_id' => $Stage_back->id]);
                     return ['success' => true, 'datos' => 'Escenario respaldo activo'];
                 }
                 break;
             }
         }
         Log::error($datos_s);
         dd();
     } else {
         $daTwo = $d = CombatRound::where('rb_combat_round.stage_id', '=', $da->stage_id)->where('rb_combat_round.schedule_start', '>=', $da->schedule_start)->join('rb_group_stage as r_g', 'r_g.round_id', '=', 'rb_combat_round.versus_one')->join('rb_group_stage as r_g2', 'r_g2.round_id', '=', 'rb_combat_round.versus_two')->join('rb_rounds as r_b', 'r_b.id', '=', 'r_g.round_id')->join('rb_rounds as r_b2', 'r_b2.id', '=', 'r_g2.round_id')->join('rb_team as r_t', 'r_t.id', '=', 'r_b.team_id')->join('rb_team as r_t2', 'r_t2.id', '=', 'r_b2.team_id')->join('rb_groups as r_gr', 'r_gr.id', '=', 'r_g.group_id')->join('rb_groups as r_gr2', 'r_gr2.id', '=', 'r_g2.group_id')->select('r_g.id as id_rg', 'r_g.group_id as group_id_rg', 'r_g2.id as id_rg2', 'r_g2.group_id as group_id_rg2', 'r_b.team_id as r_b_team_id', 'r_b2.team_id as r_b2_team_id', 'r_gr.name as r_gr_name', 'r_gr2.name as r_gr2_name', 'r_t.name as r_t_name', 'r_t2.name as r_t2_name', 'rb_combat_round.*')->orderBy('schedule_start', 'ASC')->get()->toArray();
         $horaInicio = '00:00:00';
         for ($i = 0; $i <= count($daTwo) - 1; $i++) {
             if ($i == 0) {
                 $duration = $request->time;
                 $horaInicio = $da->schedule_start;
                 $flag = true;
             } else {
                 $duration = $data_challenge->duration;
                 $flag = false;
             }
             $dataTime = $this->incrementTimeTwo(['time_start' => $horaInicio, 'time_durat' => $duration, 'challenge_id' => $da->challenge_id, 'flag' => $flag]);
             $horaInicio = $dataTime['hora_end'];
             $daTwo[$i]['schedule_start'] = $dataTime['hora_star'];
             $daTwo[$i]['schedule_end'] = $dataTime['hora_end'];
         }
         return ['success' => true, 'datos' => $daTwo];
     }
 }