/**
  * Set registration process active / in-active
  *
  * @param $user
  * @return mixed
  */
 public function toggleRegistrationProcess($user)
 {
     if ($user === 'staff') {
         if ($this->isRegistrationActive('staff')) {
             unlink(storage_path() . '/app/activeForStaff');
             // Clear the tables
             Grade::truncate();
             ElectiveCount::truncate();
             TeacherRequest::truncate();
             AllocatedElective::truncate();
             AdminStaffRequest::truncate();
             HostelStaffRequest::truncate();
             CurrentStudentState::truncate();
             LibraryStaffRequest::truncate();
             ChiefWardenStaffRequest::truncate();
             Teacher::where('semNo', '>', '0')->update(['semNo' => null]);
         } else {
             touch(storage_path() . '/app/activeForStaff');
         }
     } else {
         if ($user === 'students') {
             if ($this->isRegistrationActive('student')) {
                 unlink(storage_path() . '/app/activeForStudents');
             } else {
                 touch(storage_path() . '/app/activeForStudents');
             }
         }
     }
     return redirect()->back();
 }
Example #2
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function studentDropDown()
 {
     $gra_id = Input::get('gra_id');
     $studentdropdown = Grade::find($gra_id)->students->toArray();
     $jsonStudents = json_encode($studentdropdown);
     return $jsonStudents;
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     \App\Grade::create(array('school_id' => 1, 'grade' => '1年'));
     \App\Grade::create(array('school_id' => 1, 'grade' => '2年'));
     \App\Grade::create(array('school_id' => 1, 'grade' => '3年'));
     \App\Grade::create(array('school_id' => 1, 'grade' => '4年'));
 }
Example #4
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function dashboardDropDown()
 {
     $gra_id = Input::get('gra_id');
     $subjectdropdown = Grade::find($gra_id)->subjects->toArray();
     $jsonSubjects = json_encode($subjectdropdown);
     return $jsonSubjects;
 }
 public function deleteStudentGrades()
 {
     $user = User::find(Input::get('user_id'));
     $grade = Grade::find(Input::get('grade_id'));
     $grade->delete();
     return Redirect::action('TeacherController@getStudentGrades', $user->id)->with('message', 'You have successfully deleted the user\'s grade!');
 }
 public function create()
 {
     $school_year = SchoolYear::orderBy('id', 'desc')->first();
     $grades = Grade::all();
     $sections = $grades->first()->sections;
     return view('matriculas.matricular')->with(compact(['school_year', 'grades', 'sections']));
 }
Example #7
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create($subject_id, $class_id)
 {
     $exams = \App\Exam::all();
     $subject = \App\Subject::find($subject_id);
     $class = \App\Grade::find($class_id);
     return view('reports.create')->with('title', 'SMS|REPORT')->with('class', $class)->with('subject', $subject)->with('exams', $exams);
 }
Example #8
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     $wards = Ward::all();
     $grades = Grade::all();
     view()->share('wards', $wards);
     view()->share('grades', $grades);
 }
Example #9
0
 /**
  * Check if a quiz has stored grades
  *
  * @return boolean
  */
 public function noGrades()
 {
     if (Grade::where('quiz_id', '=', $this->id)->get()->count() == 0) {
         return TRUE;
     } else {
         return FALSE;
     }
 }
 /**
  * 获取学生成绩数组
  */
 public function getGradeDatas()
 {
     $grades = Grade::select('user_id', 'id', 'math', 'english', 'c', 'sport', 'think', 'soft')->get()->toArray();
     foreach ($grades as $key => $value) {
         $grades[$key]['id'] = User::findOrFail($value['user_id'])->name;
     }
     return $grades;
 }
Example #11
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $learners = \App\Student::all();
     $staff = Staff::all();
     $subjects = \App\Subject::all();
     $streams = \App\Stream::all();
     $classes = \App\Grade::all();
     return view('admin.index')->with('title', 'SMS|Dashboard')->with('learners', $learners)->with('staff', $staff)->with('subjects', $subjects)->with('streams', $streams)->with('classes', $classes);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('users')->delete();
     User::create(['id' => 1210311232, 'name' => '李锐', 'password' => Hash::make('1210311232')]);
     User::create(['id' => 1210311233, 'name' => '陈曦', 'password' => Hash::make('1210311233')]);
     User::create(['id' => 1234567890, 'name' => '管理员', 'password' => Hash::make('root'), 'is_admin' => 1]);
     Grade::create(['user_id' => 1210311232, 'math' => 99, 'english' => 80, 'c' => 96, 'sport' => 95, 'think' => 99, 'soft' => 98]);
     Grade::create(['user_id' => 1210311233]);
 }
 public function index($id)
 {
     $grade = Grade::find($id);
     if ($grade == null) {
         return redirect('/');
     }
     $sections = $grade->sections;
     return view('configuracion.secciones')->with(compact(['grade', 'sections']));
 }
Example #14
0
 /**
  * @param $id
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function destroy($id)
 {
     $grade = Grade::findOrFail($id);
     if ($grade->subject->group->user->id != Auth::id()) {
         return redirect('groups');
     }
     $grade->delete();
     return redirect('groups');
 }
Example #15
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $studentData = Student::findOrFail($id);
     $studentAdd = $studentData->addresses->flatten()->toArray();
     $studentGradeId = $studentData->grades->lists('id')->flatten()->toArray();
     foreach ($studentGradeId as $key => $values) {
         $gradeId = $values;
     }
     $studentGrades = Grade::find($gradeId);
     $examlists = $studentGrades->exams->flatten()->toArray();
     return view('student.show', compact('studentData', 'examlists', 'studentAdd'));
 }
 public function index($handbook_id, $grade_id)
 {
     $handbook = CourseHandbook::find($handbook_id);
     // Get all courses and grades to fill the selects
     $courses = Course::all();
     $grades = Grade::all();
     // Select the grade and its courses associated in the current handbook
     $current_grade = Grade::find($grade_id);
     $current_courses = CourseGrade::where('course_handbook_id', $handbook_id)->where('grade_id', $grade_id)->get(['course_id']);
     $current_courses = $this->convertToCourseCollection($current_courses);
     return view('configuracion.asignar-cursos')->with(compact(['handbook', 'courses', 'grades', 'current_courses', 'current_grade']));
 }
Example #17
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CreateStreamRequest $request)
 {
     $stream = $this->stream->create(array('name' => $request->name));
     $class = Grade::find($request->id);
     $stream = $class->streams()->save($stream);
     //update foreign keys
     if ($stream) {
         return \Redirect::route('classes')->with('message', 'Stream successfuly registered!');
     } else {
         return \Redirect::route('create_stream')->with('error-message', 'Failed to Add Stream!');
     }
 }
Example #18
0
 public function store(CreateLearnerRequest $request)
 {
     //$created=$this->learner->create($request->all());
     //picking the class id for the class selected
     $class_id = \DB::table('classes')->select('id')->where('name', $request->class)->pluck('id');
     $student = $this->learner->create(array('firstname' => $request->firstname, 'lastname' => $request->lastname, 'middlename' => $request->middle_name, 'current_class' => $request->class, 'gender' => $request->gender, 'study_mode' => $request->study_mode, 'bursary' => $request->bursary, 'dob' => $request->dob, 'date_joined' => $request->date_admitted));
     $class = Grade::find($class_id);
     $student = $class->students()->save($student);
     if ($student) {
         return \Redirect::route('learners')->with('message', 'Learner successfuly registered!');
     } else {
         return \Redirect::route('create_learner')->with('error-message', 'Failed to register :Learner!');
     }
 }
 public function upload_grade(Request $request)
 {
     $this->validate($request, Grade::rules());
     $grade = Grade::where('user_id', $request->user_id)->first();
     $grade->math = $request->math;
     $grade->english = $request->english;
     $grade->c = $request->c;
     $grade->sport = $request->sport;
     $grade->think = $request->think;
     $grade->soft = $request->soft;
     $grade->save();
     session()->flash('message', '成绩提交成功');
     return Redirect::back();
 }
Example #20
0
 /**
  * Responds to requests to GET /grades
  */
 public function getGrades()
 {
     // show all grades is teacher only user grades if notw
     if (Auth::user()->teacher) {
         $grades = Grade::orderBy('user_id', 'desc')->with('user', 'quiz')->get();
     } else {
         $grades = Grade::with('user', 'quiz')->where('user_id', Auth::user()->id)->get();
     }
     // redirect if no grades are found
     if ($grades->count() == 0) {
         \Session::flash('flash_message', 'There are no grades to display.');
         return redirect('/');
     }
     return view('grades.index')->with('grades', $grades);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Grade::create(['name' => 'Pre-kinder', 'description' => 'Para niños de 2 y 3 años.']);
     Grade::create(['name' => 'Kinder', 'description' => 'Para niños de 4 y 5 años.']);
     Grade::create(['name' => 'Primer grado']);
     Grade::create(['name' => 'Segundo grado']);
     Grade::create(['name' => 'Tercer grado']);
     Grade::create(['name' => 'Cuarto grado']);
     Grade::create(['name' => 'Quinto grado']);
     Grade::create(['name' => 'Sexto grado']);
     Grade::create(['name' => 'Primer año']);
     Grade::create(['name' => 'Segundo año']);
     Grade::create(['name' => 'Tercer año']);
     Grade::create(['name' => 'Cuarto año']);
     Grade::create(['name' => 'Quinto año']);
 }
 public function storeGrades(Request $request)
 {
     // return $request->all();
     foreach (json_decode($request->grades) as $i => $g) {
         $grade = Grade::firstOrNew(['user_id' => $g->user_id, 'subject_id' => $request->subject]);
         $grade->school_year = $request->school_year;
         $grade->q1 = $g->q1;
         $grade->q2 = $g->q2;
         $grade->q3 = $g->q3;
         $grade->q4 = $g->q4;
         $grade->average = $g->ave;
         $grade->teacher_id = Auth::user()->id;
         $grade->approved_status = 0;
         $grade->save();
     }
     return Redirect::to('/teacher/grade/input')->with('status', 'Records saved successfully. ');
 }
Example #23
0
 /**
  * Responds to request to GET /status/{id}
  */
 public function getStatus($id)
 {
     $quiz = Quiz::find($id);
     if ($quiz->ready) {
         if (Grade::where('quiz_id', '=', $quiz->id)->get()->count() != 0) {
             \Session::flash('flash_message', 'Quiz has stored grades!');
         }
         $quiz->ready = FALSE;
     } else {
         // check quiz for warnings
         $warnings = $quiz->warnings();
         if ($warnings->count() == 0) {
             $quiz->ready = TRUE;
         } else {
             return view('edit.quiz')->with('quiz', $quiz)->with('warnings', $warnings);
         }
     }
     $quiz->save();
     return redirect('/edit/' . $quiz->id);
 }
Example #24
0
 public function run()
 {
     //Empty the Grade table
     //        DB::table('Grade')->delete();
     Grade::truncate();
     Grade::create(['id' => '1', 'name' => "7 Kyu", 'order' => 1]);
     Grade::create(['id' => '2', 'name' => "6 Kyu", 'order' => 2]);
     Grade::create(['id' => '3', 'name' => "5 Kyu", 'order' => 3]);
     Grade::create(['id' => '4', 'name' => "4 Kyu", 'order' => 4]);
     Grade::create(['id' => '5', 'name' => "3 Kyu", 'order' => 5]);
     Grade::create(['id' => '6', 'name' => "2 Kyu", 'order' => 6]);
     Grade::create(['id' => '7', 'name' => "1 Kyu", 'order' => 7]);
     Grade::create(['id' => '8', 'name' => "1 Dan", 'order' => 8]);
     Grade::create(['id' => '9', 'name' => "2 Dan", 'order' => 9]);
     Grade::create(['id' => '10', 'name' => "3 Dan", 'order' => 10]);
     Grade::create(['id' => '11', 'name' => "4 Dan", 'order' => 11]);
     Grade::create(['id' => '12', 'name' => "5 Dan", 'order' => 12]);
     Grade::create(['id' => '13', 'name' => "6 Dan", 'order' => 13]);
     Grade::create(['id' => '14', 'name' => "7 Dan", 'order' => 14]);
     Grade::create(['id' => '15', 'name' => "8 Dan", 'order' => 15]);
 }
Example #25
0
 public function getclassforcreche()
 {
     if (\Request::ajax()) {
         $grade_id = \Input::get('grade_id');
         $grade = Grade::where('id', $grade_id)->first();
         foreach ($grade->classrooms as $cr) {
             echo '<option value="' . $cr->id . '">' . $cr->nom_classe . '</option>';
         }
     }
 }
Example #26
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $grade = Grade::create(['grade' => ucwords($request->grade), 'grade_section' => ucwords($request->grade_section), 'school_id' => $request->school_id, 'student_id' => $request->student_id]);
     return redirect('admin/createclass')->withInput();
 }
 public function sections($id)
 {
     $grade = Grade::find($id);
     $sections = $grade->sections;
     return $sections;
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(schoolYearsRequest $request)
 {
     $tableau = explode('-', $request->ann_scol);
     $year1 = $tableau[0];
     $year2 = $tableau[1];
     $yearNow = Carbon::now()->year;
     $year_prec = Carbon::now()->year - 1;
     $year_next = Carbon::now()->year + 1;
     if ($year1 > $yearNow && $year2 > $year_next) {
         return redirect()->back()->withErrors("Désolé vous ne pouvez pas ajouter cette année scolaire en ce moment !");
     }
     $ann_scol = $request->ann_scol;
     $trim_semis = $request->TrimSemis;
     $champ1start = Carbon::parse($request->champ1start);
     $champ1end = Carbon::parse($request->champ1end);
     $champ2start = Carbon::parse($request->champ2start);
     $champ2end = Carbon::parse($request->champ2end);
     if (!is_null($request->champ3start) && !is_null($request->champ3end)) {
         $champ3start = Carbon::parse($request->champ3start);
         $champ3end = Carbon::parse($request->champ3end);
     }
     // vérifier l'enchainement semistrielle
     if ($trim_semis == 'Semis') {
         if ($champ1start < $champ1end && $champ1end < $champ2start && $champ2start < $champ2end && $champ1start->diffInMonths($champ2end) >= 8 && $champ1start->year == $year1 && $champ2end->year == $year2) {
         } else {
             return redirect()->back()->withErrors("l'enchainement des dates est incorrect\n                    ou durée totale est moins de 8 mois\n                    ou Correspondance avec l'année scolaire est incorrecte ");
         }
     }
     // vérifier l'enchainement trimistrielle
     if ($trim_semis == 'Trim') {
         if ($champ1start < $champ1end && $champ1end < $champ2start && $champ2start < $champ2end && $champ2end < $champ3start && $champ3start < $champ3end && $champ1start->diffInMonths($champ3end) >= 8 && $champ1start->year == $year1 && $champ3end->year == $year2) {
         } else {
             return redirect()->back()->withErrors("l'enchainement des dates est\n                    incorrect ou durée totale est moins de 8 mois ou\n                     Correspondance avec l'année scolaire est incorrecte");
         }
     }
     // early inscription for Next Year
     if (Carbon::now()->month >= 1 && $year1 == $yearNow && $year2 == $year_next && $champ1start->month == 9 || $champ1start->month == 10) {
         // si trouvé une mise à jour
         $sc_year = SchoolYear::where('user_id', \Auth::user()->id)->where('ann_scol', $ann_scol)->first();
         if ($sc_year) {
             $sc_year->startch1 = $champ1start;
             $sc_year->endch1 = $champ1end;
             $sc_year->startch2 = $champ2start;
             $sc_year->endch2 = $champ2end;
             if ($trim_semis == 'Trim') {
                 $sc_year->startch3 = $champ3start;
                 $sc_year->endch3 = $champ3end;
             } else {
                 $sc_year->startch3 = null;
                 $sc_year->endch3 = null;
             }
             $sc_year->type = $trim_semis;
             $sc_year->current = 0;
             $sc_year->save();
         } else {
             // créer l'année scolaire pour l'année prochaine
             $sc = new SchoolYear();
             $sc->ann_scol = $ann_scol;
             $sc->type = $trim_semis;
             $sc->startch1 = $champ1start;
             $sc->endch1 = $champ1end;
             $sc->startch2 = $champ2start;
             $sc->endch2 = $champ2end;
             $sc->current = 0;
             if ($trim_semis == 'Trim') {
                 $sc->startch3 = $champ3start;
                 $sc->endch3 = $champ3end;
             }
             $sc->user_id = \Auth::user()->id;
             $sc->save();
             Grade::AddGradesAndLevels(\Auth::user()->id, $sc->id);
         }
     }
     if ($year1 == $year_prec && $year2 == $yearNow && Carbon::now()->month <= 6) {
         $sc_year = SchoolYear::where('user_id', \Auth::user()->id)->where('ann_scol', $ann_scol)->first();
         if ($sc_year) {
             $sc_year->startch1 = $champ1start;
             $sc_year->endch1 = $champ1end;
             $sc_year->startch2 = $champ2start;
             $sc_year->endch2 = $champ2end;
             if ($trim_semis == 'Trim') {
                 $sc_year->startch3 = $champ3start;
                 $sc_year->endch3 = $champ3end;
             } else {
                 $sc_year->startch3 = null;
                 $sc_year->endch3 = null;
             }
             $sc_year->type = $trim_semis;
             $sc_year->save();
         } else {
             $sc = new SchoolYear();
             $sc->ann_scol = $ann_scol;
             $sc->type = $trim_semis;
             $sc->startch1 = $champ1start;
             $sc->endch1 = $champ1end;
             $sc->startch2 = $champ2start;
             $sc->endch2 = $champ2end;
             $sc->current = 1;
             if ($trim_semis == 'Trim') {
                 $sc->startch3 = $champ3start;
                 $sc->endch3 = $champ3end;
             }
             $sc->user_id = \Auth::user()->id;
             $sc->save();
             if ($sc->id) {
                 Grade::AddGradesAndLevels(\Auth::user()->id, $sc->id);
             }
             /* if ($sc->id) {
                    $forCurrentYear = SchoolYear::where('user_id', \Auth::user()->id)
                        ->get();
                    foreach ($forCurrentYear as $ok) {
                        $yes = SchoolYear::where('user_id', \Auth::user()->id)
                            ->where('id', '!=', $sc->id)->first();
                        if ($yes) {
                            $yes->current = 0;
                            $yes->save();
                        }
                    }
                }*/
         }
     }
     return redirect()->back()->with('success', 'Bien Enregistrés');
 }
 /**
  * Delete a student registration request
  *
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function deleteRequest(Request $request)
 {
     $rollNo = $request['rollNo'];
     // Delete the request from all associated tables
     AllocatedElective::where('rollNo', $rollNo)->delete();
     Grade::where('rollNo', $rollNo)->delete();
     HostelStaffRequest::destroy($rollNo);
     TeacherRequest::destroy($rollNo);
     AdminStaffRequest::destroy($rollNo);
     LibraryStaffRequest::destroy($rollNo);
     ChiefWardenStaffRequest::destroy($rollNo);
     // If the student has been verified, then decrement his/her semester
     if (CurrentStudentState::find($rollNo)->approved == true) {
         $student = Student::find($rollNo);
         $student->semNo = $student->semNo - 1;
         $student->save();
     }
     CurrentStudentState::destroy($rollNo);
     return redirect('/teachers/semesterRegistration/studentRequests/all');
 }
Example #30
0
 /**
  * Show the form for editing the specified resource.
  *
  * @return Response
  */
 public function edit(User $user)
 {
     $grades = Grade::lists('name', 'id');
     $countries = Countries::lists('name', 'id');
     return view('users.edit', compact('user', 'countries', 'grades'));
 }