Esempio n. 1
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;
 }
Esempio n. 2
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);
 }
Esempio n. 3
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 index($id)
 {
     $grade = Grade::find($id);
     if ($grade == null) {
         return redirect('/');
     }
     $sections = $grade->sections;
     return view('configuracion.secciones')->with(compact(['grade', 'sections']));
 }
 public function approveGrades(Request $request)
 {
     foreach ($request->g_id as $id) {
         $grade = Grade::find($id);
         $grade->approved_status = 1;
         $grade->save();
     }
     return Redirect::to('/programhead/approve')->with('status', count($request->g_id) . ' items approved.');
 }
 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']));
 }
Esempio n. 8
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!');
     }
 }
Esempio n. 9
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'));
 }
Esempio n. 10
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 sections($id)
 {
     $grade = Grade::find($id);
     $sections = $grade->sections;
     return $sections;
 }
Esempio n. 12
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $validation = Validator::make($request->all(), Grade::rules($id));
     // Check if it fails //
     if ($validation->fails()) {
         return redirect()->back()->withInput()->with('errors', $validation->errors());
     }
     // Process valid data & go to success page //
     $grade = Grade::find($id);
     // replace old data with new data from the submitted form //
     // save grade data into database //
     $grade->name = $request->input('name');
     $grade->description = $request->input('description');
     $grade->save();
     Alert::success($request->input('name') . ' Saved!')->persistent("Close");
     return redirect('grade/list')->with('message', 'You just updated an cateogry!');
 }
Esempio n. 13
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     // Start Check Authorization
     $invalid_auth = 1;
     $authRole = Auth::user()->UserRoles->role;
     if ($authRole == 1 or $authRole == 3) {
         $invalid_auth = 0;
     }
     if ($invalid_auth == 1) {
         Alert::error('Anda tidak memilik akses ini')->persistent('close');
         return redirect('dashboard');
     }
     // End Check Authorization
     $validation = Validator::make($request->all(), Grade::rules($id));
     // Check if it fails //
     if ($validation->fails()) {
         return redirect()->back()->withInput()->with('errors', $validation->errors());
     }
     // Process valid data & go to success page //
     $grade = Grade::find($id);
     // replace old data with new data from the submitted form //
     // save grade data into database //
     $grade->name = $request->input('name');
     $grade->description = $request->input('description');
     $grade->save();
     Alert::success($request->input('name') . ' Saved!')->persistent("Close");
     return redirect('grade/list')->with('message', 'You just updated an cateogry!');
 }
Esempio n. 14
0
 public function assign_subjects(Requests\AssignSubjectsRequest $request)
 {
     $class = Grade::find($request->class_id);
     $assigned = $class->subjects()->attach($request->subject_id);
     if ($assigned) {
         return \Redirect::route('classes')->with('message', 'Class Assigned subjects successfuly Updated!')->with('id', $id);
     } else {
         return \Redirect::route('assign_subjects', $request->class_id)->with('error-message', 'Failed to Assign class the subjects, Do it again!');
     }
 }