Ejemplo n.º 1
0
 function dayPeriod_list()
 {
     $data['owner'] = $this->owner;
     $data['system'] = $this->system;
     if ($this->owner == 1) {
         $subject_owner = Subject::where('nstp', 0)->where(function ($query) {
             $query->where('owner', 1)->orWhere('gessubject', 1);
         })->where('computersubject', 0)->where('nstp', 0)->get();
     } elseif ($this->system->employeeid == Auth::user()->id) {
         $subject_owner = Subject::where('gesubject', 0)->where(function ($query) {
             $query->where('computersubject', 1)->orWhere('nstp', 1);
         })->get();
     } else {
         $subject_owner = Subject::where('nstp', 0)->where('owner', $this->owner)->where('computersubject', 0)->where('gesubject', 0)->get();
     }
     $data['subject'] = $subject_owner;
     if ($this->system->classallocationstatus != 3) {
         $data['val'] = 'class not init';
     } else {
         $s = DB::table('tbl_completion')->where('stage', 4)->where('completedby', Auth::user()->id)->count();
         if ($s > 1) {
             $data['val'] = 'attested';
         } else {
             $data['sub'] = Classallocation::getAlloc($this->owner, $this->system);
         }
     }
     $t = Academicterm::find($this->system->phaseterm);
     $term = DB::table('tbl_term')->where('id', $t->term)->first();
     $data['acam'] = $t->systart . ' - ' . $t->syend . ' Term: ' . $term->shortname;
     return view('dean.add_day_period', $data);
 }
Ejemplo n.º 2
0
 public function Subjects(Request $request)
 {
     $this->validate($request, ['class' => 'required']);
     $class = $request->get('class');
     $subjects = Subject::where('class', '=', $class)->where('trash', '=', false)->get();
     $subjects[0]['token'] = $request->get("_token");
     $subjects->toJSON();
     return $subjects;
 }
 public function analyseStudentPerformance($studentId)
 {
     $student = User::find($studentId);
     $studentTeachingSection = TeachingSection::where('users_id', '=', $studentId)->first();
     //        dd($studentTeachingSection);
     $studentSection = Section::find($studentTeachingSection->sections_id);
     $studentArray = array();
     $studentArray['name'] = $student->name;
     $studentArray['realname'] = $student->realname;
     $studentArray['grade'] = $studentSection->grade;
     $studentArray['order'] = $studentSection->order;
     //        a table show all exminations the student has token
     //        show the different table of different subjects.
     $allTranscripts = Transcript::where('users_id', '=', $studentId)->get();
     //        dd($allTranscripts);
     $studentExaminations = array();
     $i = 0;
     foreach ($allTranscripts as $transcript) {
         /*对该成绩单的学生的每次考试的语文,数学,英语三科的排名*/
         $studentExaminations[$i]['chineseRanking'] = Transcript::getStudentSubjectRanking($transcript, 1);
         $studentExaminations[$i]['mathRanking'] = Transcript::getStudentSubjectRanking($transcript, 2);
         $studentExaminations[$i]['englishRanking'] = Transcript::getStudentSubjectRanking($transcript, 3);
         $examination = Examination::find($transcript->examinations_id);
         $studentExaminations[$i]['examination_name'] = $examination->name;
         $studentExaminations[$i]['examination_semester'] = $examination->semester;
         $studentExaminations[$i]['examination_date'] = $examination->date;
         $studentExaminations[$i]['total'] = $transcript->total;
         $studentExaminations[$i]['rank'] = $transcript->rank;
         $subjects = Subject::where('transcripts_id', '=', $transcript->id)->get();
         foreach ($subjects as $subject) {
             $subjectType = $subject->type;
             if ($subjectType == 1) {
                 $studentExaminations[$i]['chinese'] = $subject->score;
             } elseif ($subjectType == 2) {
                 $studentExaminations[$i]['math'] = $subject->score;
             } elseif ($subjectType == 3) {
                 $studentExaminations[$i]['english'] = $subject->score;
             } elseif ($subjectType == 4) {
                 $studentExaminations[$i]['physics'] = $subject->score;
             } elseif ($subjectType == 5) {
                 $studentExaminations[$i]['biology'] = $subject->score;
             } elseif ($subjectType == 6) {
                 $studentExaminations[$i]['chemistry'] = $subject->score;
             } elseif ($subjectType == 7) {
                 $studentExaminations[$i]['history'] = $subject->score;
             } elseif ($subjectType == 8) {
                 $studentExaminations[$i]['politics'] = $subject->score;
             } else {
                 $studentExaminations[$i]['geography'] = $subject->score;
             }
         }
         $i++;
     }
     //dd($studentExaminations);
     return view('scores.analyseStudentPerformance', compact('studentArray', 'studentExaminations'));
 }
 public function create($id)
 {
     $user = User::find($id);
     if ($user->type == 'student') {
         $subjects = Subject::all();
     } else {
         $subjects = Subject::where('department_id', $user->department_id)->get();
     }
     return view('admin.user.subject.add', compact('id', 'subjects'));
 }
Ejemplo n.º 5
0
 public function deleteSubject($id)
 {
     $subject = Subject::where('id', '=', $id)->where('trash', '=', true)->delete();
     $partitions = Partition::where('subject_id', '=', $id)->where('trash', '=', true)->delete();
     $questions = Question::where('subject_id', '=', $id)->where('trash', '=', true);
     foreach ($questions->get() as $value) {
         $answers = Answer::where('question_id', '=', $value->id)->where('trash', '=', true)->delete();
     }
     $questions->delete();
     return back();
 }
Ejemplo n.º 6
0
 public function showAllSubjectBysemester($course_code, $semester)
 {
     $validator = Validator::make(array('code' => $course_code, '$semester' => $semester), array('code' => array('regex:/(?i)^[a-z]+/'), 'semester' => array('regex:/[0-9]+/')));
     if ($validator->fails()) {
         return response()->json(['error' => true, 'message' => $validator->messages()]);
     }
     $subject = Subject::where('course_code', 'like', $course_code)->where('semester', $semester)->get();
     if ($subject->isEmpty()) {
         return response()->json(['error' => true, 'description' => 'no code is found']);
     }
     return response()->json(['error' => false, 'couse_code' => $course_code, 'sub_topic' => $subject->toArray()]);
 }
Ejemplo n.º 7
0
 public function index()
 {
     $subjects = collect(Subject::where('trash', '=', false)->get()->toArray())->groupBy('name')->count();
     $partitions = Partition::where('trash', '=', false)->count();
     $invites = Invite::count();
     $questions = Question::where('trash', '=', false)->count();
     $users = User::count();
     $trash = '';
     $testrooms = '';
     if (\Entrust::hasRole('admin')) {
         $trash = Question::where('trash', '=', true)->count() + Subject::where('trash', '=', true)->count() + Partition::where('trash', '=', true)->count() + TestRoom::where('teacher_id', '=', \Auth::user()->id)->where('trash', '=', true)->count();
     } elseif (\Entrust::hasRole('teacher')) {
         $testrooms = TestRoom::where('teacher_id', '=', \Auth::user()->id)->count();
     }
     return view('admin.welcome', ['subjects' => $subjects, 'partitions' => $partitions, 'invites' => $invites, 'questions' => $questions, 'users' => $users, 'trash' => $trash, 'testrooms' => $testrooms]);
 }
 public static function getStudentSubjectRanking($currenttranscript, $subjectType)
 {
     $rank = 1;
     //        第一步: 找到该场考试
     $examId = $currenttranscript->examinations_id;
     //        第二步: 找到和当前用户是属于一个班级的其他同学
     $section = TeachingSection::where('users_id', '=', $currenttranscript->users_id)->first();
     $sectionId = $section->sections_id;
     //        dd($sectionId);
     $allStudentsIdsSameSection = User::getStudentBySection($sectionId);
     //        第三步: 找到同班同学的所有成绩单
     $allTranscriptsSameExamSameSection = DB::table('transcripts')->where('examinations_id', '=', $examId)->whereIn('users_id', $allStudentsIdsSameSection)->get();
     //        本身的指定某科
     $currentSubject = Subject::where('type', '=', $subjectType)->where('transcripts_id', '=', $currenttranscript->id)->first();
     foreach ($allTranscriptsSameExamSameSection as $transcript) {
         //            找到该成绩单上指定课程分数,并比较
         $subject = Subject::where('type', '=', $subjectType)->where('transcripts_id', '=', $transcript->id)->first();
         if ($subject->score > $currentSubject->score) {
             $rank++;
         }
     }
     return $rank;
 }
Ejemplo n.º 9
0
 private function dept_subjkeszit($file)
 {
     $orak = Excel::selectSheetsByIndex(5)->load($file, function ($reader) {
     })->get(array('osztaly', 'tanar', 'tantargy'))->toArray();
     try {
         foreach ($orak as $ora) {
             if ($ora['osztaly'] != null) {
                 $osztaly = $ora['osztaly'];
             }
             if ($ora['tanar'] != null) {
                 $tanarnev = $ora['tanar'];
                 $tantargy = $ora['tantargy'];
                 if (strpos($osztaly, 'III') !== false) {
                     $grade = 3;
                 } else {
                     if (strpos($osztaly, 'II') !== false) {
                         $grade = 2;
                     } else {
                         if (strpos($osztaly, 'I') !== false) {
                             $grade = 1;
                         } else {
                             if (strpos($osztaly, 'IV') !== false) {
                                 $grade = 4;
                             } else {
                                 if (strpos($osztaly, 'Mesterképzo') !== false) {
                                     var_dump($osztaly);
                                     die;
                                     $grade = 10;
                                 } else {
                                     dd("bad format" . $osztaly);
                                 }
                             }
                         }
                     }
                 }
                 if (strpos($tantargy, 'gyak.') !== false) {
                     $type = 3;
                 } else {
                     if (strpos($tantargy, 'e.a.') !== false) {
                         $type = 2;
                     } else {
                         if (strpos($tantargy, 'szem.') !== false) {
                             $type = 1;
                         } else {
                             $type = 0;
                         }
                     }
                 }
                 $study_id = Studies::where('study_name', '=', $osztaly)->first();
                 if ($study_id == "") {
                     dd($osztaly . "study id");
                 }
                 $study_id = $study_id->study_id;
                 $subject_id = Subject::where('subject_shortname', '=', $tantargy)->first();
                 if ($subject_id == "") {
                     dd($tantargy . "subject id");
                 }
                 $subject_id = $subject_id->subject_id;
                 $tanarnev = str_replace(", Dr.", "", $tanarnev);
                 if (strpos($tanarnev, '/') !== false) {
                     $tanarnev = str_replace("/ ", "/", $tanarnev);
                     $array = explode("/", $tanarnev);
                     foreach ($array as $tanarnev) {
                         $tanarid = User::where('name', '=', $tanarnev)->first();
                         if ($tanarid == "") {
                             dd($tanarnev . "tanarnev");
                         }
                         $tanarid = $tanarid->id;
                         $mentes = array('study_id' => $study_id, 'subject_id' => $subject_id, 'semester' => '1', 'grade' => $grade, 'type' => $type, 'user_id' => $tanarid, 'active' => '1');
                         Dept_subj::firstOrCreate($mentes);
                     }
                 }
                 $tanarid = User::where('name', '=', $tanarnev)->first();
                 if ($tanarid == "") {
                     dd($tanarnev . "tanarnev");
                 }
                 $tanarid = $tanarid->id;
                 $mentes = array('study_id' => $study_id, 'subject_id' => $subject_id, 'semester' => '1', 'grade' => $grade, 'type' => $type, 'user_id' => $tanarid, 'active' => '1');
                 Dept_subj::firstOrCreate($mentes);
             }
         }
     } catch (\Exception $e) {
         $message = "Import file is not valid! Please check";
         return view('import.error', compact('message'));
     }
 }
Ejemplo n.º 10
0
 /**
  * Display a subjecting of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $subjects = Subject::where('user_id', Auth::id())->get();
     return view('subjects.index')->with('subjects', $subjects);
 }
Ejemplo n.º 11
0
 public function subjectsForUser(User $user)
 {
     return Subject::where('subjects.user_id', $user->id)->orderBy('created_at', 'asc')->get();
 }
 public function getStudentsAllInfoEachSection($examinations_id, $sections_id)
 {
     //        get all students in the section
     $studentsIds = User::getStudentBySection($sections_id);
     //
     //        //get all above students transcripts in the examinations.
     //        $transcripts = DB::table('transcripts')->where('examination_id', '=', $examinations_id)
     //            ->whereIn('users_id', '=', $studentsId)->get();
     //        DB::table('transcripts')
     //            ->join('users', 'transcripts.users_id', '=', 'users.id')
     //            ->join('examinations', 'transcripts.examinations_id', '=', 'examinations.id')
     //            ->get();
     //        $students = DB::table('users')->whereIn('id', '=', $studentsIds)->get();
     $section = Section::find($sections_id);
     $examination = Examination::find($examinations_id);
     $examinationArray = array();
     $examinationArray['name'] = $examination->name;
     if ($examination->semester == 1) {
         $examinationArray['semester'] = '第一学期';
     } elseif ($examination->semester == 2) {
         $examinationArray['semester'] = '第二学期';
     } elseif ($examination->semester == 3) {
         $examinationArray['semester'] = '小学期';
     } else {
         $examinationArray['semester'] = '其他';
     }
     if ($examination->type == 1) {
         $examinationArray['type'] = '期末考试';
     } elseif ($examination->type == 2) {
         $examinationArray['type'] = '期中考试';
     } elseif ($examination->type == 3) {
         $examinationArray['type'] = '月考';
     } else {
         $examinationArray['type'] = '普通考试';
     }
     $examinationArray['date'] = $examination->date;
     $arrayStudentScores = array();
     $i = 0;
     //        这个班级的最大总分
     $maxTotalScore = Transcript::getMaxTotalScores($studentsIds);
     //        dd($maxTotalScore);
     foreach ($studentsIds as $studentsId) {
         $student = User::findOrFail($studentsId);
         $arrayStudentScores[$i]['student_id'] = $student->id;
         $arrayStudentScores[$i]['student_name'] = $student->realname;
         $arrayStudentScores[$i]['student_realName'] = $student->realname;
         $transcript = Transcript::where('users_id', '=', $student->id)->where('examinations_id', '=', $examinations_id)->first();
         //            dd($transcript);
         $arrayStudentScores[$i]['total'] = $transcript->total;
         $subjects = Subject::where('transcripts_id', '=', $transcript->id)->get();
         foreach ($subjects as $subject) {
             $subjectType = $subject->type;
             if ($subjectType == 1) {
                 $arrayStudentScores[$i]['chinese'] = $subject->score;
             } elseif ($subjectType == 2) {
                 $arrayStudentScores[$i]['math'] = $subject->score;
             } elseif ($subjectType == 3) {
                 $arrayStudentScores[$i]['english'] = $subject->score;
             } elseif ($subjectType == 4) {
                 $arrayStudentScores[$i]['physics'] = $subject->score;
             } elseif ($subjectType == 5) {
                 $arrayStudentScores[$i]['biology'] = $subject->score;
             } elseif ($subjectType == 6) {
                 $arrayStudentScores[$i]['chemistry'] = $subject->score;
             } elseif ($subjectType == 7) {
                 $arrayStudentScores[$i]['history'] = $subject->score;
             } elseif ($subjectType == 8) {
                 $arrayStudentScores[$i]['politics'] = $subject->score;
             } else {
                 $arrayStudentScores[$i]['geography'] = $subject->score;
             }
         }
         //            得到与最高分的分差
         $arrayStudentScores[$i]['pointDifference'] = $maxTotalScore - $transcript->total;
         $transcript = Transcript::where('users_id', '=', $studentsId)->where('examinations_id', '=', $examinations_id)->first();
         $arrayStudentScores[$i]['ranking'] = $transcript->rank;
         $i++;
     }
     //        dd($arrayStudentScores);
     //        使用ranking进行排序
     /*
      * 下面是对该班成绩的分析*/
     //        该班级的该次考试的总和各科平均分
     $examAverages = array();
     $examAverages['totalAve'] = 0;
     $examAverages['chineseAve'] = 0;
     $examAverages['mathAve'] = 0;
     $examAverages['englishAve'] = 0;
     $examAverages['physicsAve'] = 0;
     $examAverages['biologyAve'] = 0;
     $examAverages['chemistryAve'] = 0;
     $examAverages['historyAve'] = 0;
     $examAverages['politicsAve'] = 0;
     $examAverages['geographyAve'] = 0;
     $count = 0;
     //        该次考试各科成绩中第一名,最后一名,平均分,中位数分析比较
     $bestStudent = $arrayStudentScores[0];
     $worstStudent = $arrayStudentScores[0];
     $middleStudent = $arrayStudentScores[0];
     $length = sizeof($arrayStudentScores);
     $halfLength = round($length / 2);
     //        dd($halfLength);
     foreach ($arrayStudentScores as $studentExamScores) {
         $examAverages['totalAve'] += $studentExamScores['total'];
         $examAverages['chineseAve'] += $studentExamScores['chinese'];
         $examAverages['mathAve'] += $studentExamScores['math'];
         $examAverages['englishAve'] += $studentExamScores['english'];
         $examAverages['physicsAve'] += $studentExamScores['physics'];
         $examAverages['biologyAve'] += $studentExamScores['biology'];
         $examAverages['chemistryAve'] += $studentExamScores['chemistry'];
         $examAverages['historyAve'] += $studentExamScores['history'];
         $examAverages['politicsAve'] += $studentExamScores['politics'];
         $examAverages['geographyAve'] += $studentExamScores['geography'];
         $count++;
         //the best performance student
         if ($studentExamScores['ranking'] < $bestStudent['ranking']) {
             $bestStudent = $studentExamScores;
         }
         //        the worst performance student
         if ($studentExamScores['ranking'] > $worstStudent['ranking']) {
             $worstStudent = $studentExamScores;
         }
         if ($studentExamScores['ranking'] == $halfLength) {
             $middleStudent = $studentExamScores;
         }
     }
     $examAverages['totalAve'] /= $count;
     $examAverages['chineseAve'] /= $count;
     $examAverages['mathAve'] /= $count;
     $examAverages['englishAve'] /= $count;
     $examAverages['physicsAve'] /= $count;
     $examAverages['biologyAve'] /= $count;
     $examAverages['chemistryAve'] /= $count;
     $examAverages['historyAve'] /= $count;
     $examAverages['politicsAve'] /= $count;
     $examAverages['geographyAve'] /= $count;
     //        end该班级的该次考试的总和各科平均分
     //        该次考试各科成绩中第一名,最后一名,平均分,中位数分析比较
     //       the best student
     //        the worst student
     //        the middle student
     //        end该次考试各科成绩中第一名,最后一名,平均分,中位数分析比较
     return view('scores.analyseSectionPerformance', compact('examinationArray', 'arrayStudentScores', 'section', 'examAverages', 'bestStudent', 'worstStudent', 'middleStudent'));
 }
 public function index()
 {
     $subjects = Subject::where('department_id', Auth::user()->department_id)->lists('id');
     $grades = Grade::where('approved_status', 0)->whereIn('subject_id', $subjects)->get();
     return view('programhead.index', compact('grades'));
 }
Ejemplo n.º 14
0
 public function search(Request $request)
 {
     $search = $request->input('subject_search');
     $subjects = Subject::where('subject_name', 'like', "%{$search}%")->orderBy('created_at', 'desc')->get();
     return view('admin.subject.subject_search', compact('subjects', 'search'));
 }
Ejemplo n.º 15
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $question = Question::find($id);
     $subjects = Subject::where('class', '=', $question->class)->get();
     $partitions = Partition::where('class', '=', $question->class)->get();
     $answers = Answer::where('question_id', '=', $id)->get();
     return view('admin.question.edit', ['question' => $question, 'subjects' => $subjects, 'partitions' => $partitions, 'answers' => $answers]);
 }
Ejemplo n.º 16
0
 public function postAddRoutine()
 {
     //Moin
     //Exam Schedule get Function for admin
     $iid = User::where('uid', '=', Auth::user()->uid)->pluck('institute_id');
     //$exam=Input::get('exam');
     //$exam_name = Exam::where('institute_code', '=', Auth::user()->institute_id)->where('exam_id', '=', $exam)->pluck('exam_name');
     $class = Input::get('class');
     $class_name = ClassAdd::where('institute_code', '=', Auth::user()->institute_id)->where('class_id', '=', $class)->pluck('class_name');
     $sub_name = Input::get('subject');
     $sub_id = Subject::where('subject_name', '=', $sub_name)->pluck('id');
     $section_name = Input::get('section');
     $teacher = Input::get('teacher');
     $teacher_name = Teacher::where('institute_code', '=', Auth::user()->institute_id)->where('teacher_id', '=', $teacher)->pluck('name');
     $section_id = Section::where('institute_code', '=', Auth::user()->institute_id)->where('section_name', '=', $section_name)->pluck('section_id');
     //return $iid.'/'.$class.'/'.$class_name.'/'.'ok'.$sub_id.'ok'.'/'.$sub_name.'/'.$section_id.'/'.$section_name;
     $su = new ClassRoutine();
     $su->institute_code = $iid;
     //$su->exam_name=$exam_name;
     $su->class_id = $class;
     $su->class_name = $class_name;
     $su->section_id = $section_id;
     $su->section_name = $section_name;
     $su->subject_id = $sub_id;
     $su->subject_name = $sub_name;
     $su->day = Input::get('day');
     $su->start_timeday = Input::get('timepickerform');
     $su->end_time = Input::get('timepickerto');
     $su->room_no = Input::get('room');
     $su->teacher_id = Input::get('teacher');
     $su->teacher_name = $teacher_name;
     $su->save();
     //return $su;
     Session::flash('data', 'Data successfully Added !');
     return Redirect::to('admin/add/routine');
 }
Ejemplo n.º 17
0
 public function getSubjectByCatalog($catalog)
 {
     $subject = Subject::where('catalog_no', Base32::decode($catalog))->get()->first();
     return $subject;
 }
Ejemplo n.º 18
0
 public function getSubject()
 {
     $subject = Subject::where('status', 'Active')->get();
     return Response::json($subject, 200, array(), JSON_PRETTY_PRINT);
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $newclass = NewClass::findOrFail($id)->toArray();
     $subjects = Subject::where('is_publish', 1)->orderBy('priority')->get()->toArray();
     return ['newclass' => $newclass, 'subjects' => $subjects];
 }
Ejemplo n.º 20
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $partition = Partition::find($id);
     $subjects = Subject::where('class', '=', $partition->class)->get();
     return view('admin.partition.edit', ['partition' => $partition, 'subjects' => $subjects]);
 }
Ejemplo n.º 21
0
 public function deleteSubject($sid)
 {
     $iid = User::where('uid', '=', Auth::user()->uid)->pluck('institute_id');
     $infoDelete = Subject::where('institute_code', '=', $iid)->where('subject_code', '=', $sid)->delete();
     Session::flash('data', 'Subject deleted successfully !');
     return Redirect::to('admin/add/subject');
 }
Ejemplo n.º 22
0
 public function getstudentsSubjects()
 {
     //student view subject saif
     $stdInof = Students::where('institute_code', '=', Auth::user()->institute_id)->where('st_id', '=', Auth::user()->uid)->first();
     $clsId = $stdInof->class;
     $subject = Subject::where('class_id', '=', $clsId)->get();
     return View('student.viewsubjects')->with('allsubinfo', $subject);
 }
Ejemplo n.º 23
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $data = Subject::where('trash', '=', false)->get();
     return view('admin.subject.index', ['subjects' => $data]);
 }
Ejemplo n.º 24
0
 public function chooseSubject(Request $request)
 {
     $subjects = Subject::where('class', '=', $request->get('class'))->get();
     return view('test.choose', ['subjects' => $subjects, 'selectedClass' => $request->get('class')]);
 }
 public function index($code)
 {
     $subject = Subject::where('subject_code', '=', $code)->first();
     return view('subjects.index')->with('subject', $subject);
 }
 public function studentRegister()
 {
     $this->setMetadata('Đăng ký tìm gia sư');
     $districts = District::where('is_publish', 1)->get();
     $subjects = Subject::where('is_publish', 1)->orderBy('priority')->get();
     $teachTimes = TeachTime::where('is_publish', 1)->orderBy('priority')->get();
     return view('frontend.sites.studentRegister', ['districts' => $districts, 'subjects' => $subjects, 'teachTimes' => $teachTimes]);
 }
 public function forecastStudentFuturePerformance($studentId)
 {
     $student = User::find($studentId);
     //        这部分工作和CheckStudentController的中 analyseStudentPerformance 方法是一样, code取自该方法
     $studentTeachingSection = TeachingSection::where('users_id', '=', $studentId)->first();
     //        dd($studentTeachingSection);
     $studentSection = Section::find($studentTeachingSection->sections_id);
     $studentArray = array();
     $studentArray['name'] = $student->name;
     $studentArray['realname'] = $student->realname;
     $studentArray['grade'] = $studentSection->grade;
     $studentArray['order'] = $studentSection->order;
     $allTranscripts = Transcript::where('users_id', '=', $studentId)->get();
     //      该学生的全部考试考试的所有各种平均分
     $studentAllPreExamsAve = array();
     $studentAllPreExamsAve['totalAve'] = 0;
     $studentAllPreExamsAve['rankingAve'] = 0;
     $studentAllPreExamsAve['chineseAve'] = 0;
     $studentAllPreExamsAve['mathAve'] = 0;
     $studentAllPreExamsAve['englishAve'] = 0;
     $studentAllPreExamsAve['physicsAve'] = 0;
     $studentAllPreExamsAve['biologyAve'] = 0;
     $studentAllPreExamsAve['chemistryAve'] = 0;
     $studentAllPreExamsAve['historyAve'] = 0;
     $studentAllPreExamsAve['geographyAve'] = 0;
     $studentAllPreExamsAve['politicsAve'] = 0;
     $count = 0;
     $previousTotalAndRankingArray = [];
     foreach ($allTranscripts as $transcript) {
         $examination = Examination::find($transcript->examinations_id);
         $tampTotalAndRankingArray = [floatval($transcript->total), floatval($transcript->rank), 1];
         $previousTotalAndRankingArray[$count] = $tampTotalAndRankingArray;
         /*            $previousTotalAndRankingArray[$count]['total'] = $transcript->total;
                     $previousTotalAndRankingArray[$count]['rank'] = $transcript->rank;
                     $previousTotalAndRankingArray[$count]['ballSize'] = 10;*/
         $studentAllPreExamsAve['totalAve'] += $transcript->total;
         $studentAllPreExamsAve['rankingAve'] += $transcript->rank;
         $subjects = Subject::where('transcripts_id', '=', $transcript->id)->get();
         foreach ($subjects as $subject) {
             $subjectType = $subject->type;
             if ($subjectType == 1) {
                 $studentAllPreExamsAve['chineseAve'] += $subject->score;
             } elseif ($subjectType == 2) {
                 $studentAllPreExamsAve['mathAve'] += $subject->score;
             } elseif ($subjectType == 3) {
                 $studentAllPreExamsAve['englishAve'] += $subject->score;
             } elseif ($subjectType == 4) {
                 $studentAllPreExamsAve['physicsAve'] += $subject->score;
             } elseif ($subjectType == 5) {
                 $studentAllPreExamsAve['biologyAve'] += $subject->score;
             } elseif ($subjectType == 6) {
                 $studentAllPreExamsAve['chemistryAve'] += $subject->score;
             } elseif ($subjectType == 7) {
                 $studentAllPreExamsAve['historyAve'] += $subject->score;
             } elseif ($subjectType == 8) {
                 $studentAllPreExamsAve['politicsAve'] += $subject->score;
             } else {
                 $studentAllPreExamsAve['geographyAve'] += $subject->score;
             }
         }
         $count++;
     }
     $studentAllPreExamsAve['totalAve'] /= $count;
     $studentAllPreExamsAve['rankingAve'] = round($studentAllPreExamsAve['rankingAve'] / $count);
     $studentAllPreExamsAve['chineseAve'] /= $count;
     $studentAllPreExamsAve['mathAve'] /= $count;
     $studentAllPreExamsAve['englishAve'] /= $count;
     $studentAllPreExamsAve['physicsAve'] /= $count;
     $studentAllPreExamsAve['biologyAve'] /= $count;
     $studentAllPreExamsAve['chemistryAve'] /= $count;
     $studentAllPreExamsAve['historyAve'] /= $count;
     $studentAllPreExamsAve['politicsAve'] /= $count;
     $studentAllPreExamsAve['geographyAve'] /= $count;
     $studentAllPreExamsAveData = [$studentAllPreExamsAve['chineseAve'], $studentAllPreExamsAve['mathAve'], $studentAllPreExamsAve['englishAve'], $studentAllPreExamsAve['physicsAve'], $studentAllPreExamsAve['biologyAve'], $studentAllPreExamsAve['chemistryAve'], $studentAllPreExamsAve['historyAve'], $studentAllPreExamsAve['politicsAve'], $studentAllPreExamsAve['geographyAve']];
     //        end该学生的全部考试考试的所有各种平均分
     //        对下次考试的预测
     $forecastNextExam = array();
     //        调用测试算法,对下次考试预测
     $forecastNextExam['total'] = 862;
     $forecastNextExam['ranking'] = 1;
     $forecastNextExam['chinese'] = 108;
     $forecastNextExam['math'] = 117;
     $forecastNextExam['english'] = 77;
     $forecastNextExam['physics'] = 74;
     $forecastNextExam['biology'] = 80;
     $forecastNextExam['chemistry'] = 78;
     $forecastNextExam['history'] = 71;
     $forecastNextExam['politics'] = 82;
     $forecastNextExam['geography'] = 78;
     $forecastNextExamData = [$forecastNextExam['chinese'], $forecastNextExam['math'], $forecastNextExam['english'], $forecastNextExam['physics'], $forecastNextExam['biology'], $forecastNextExam['chemistry'], $forecastNextExam['history'], $forecastNextExam['politics'], $forecastNextExam['geography']];
     //        dd($studentArray);
     //        dd($studentAllPreExamsAve);
     //        dd($forecastNextExam);
     //        对之前所有考试的总分和排名, 平均排名和 未来排名
     $averageTotalAndRankingArray = [[$studentAllPreExamsAve['totalAve'], $studentAllPreExamsAve['rankingAve'], 1]];
     $forecastTotalAndRankingArray = [[$forecastNextExam['total'], $forecastNextExam['ranking'], 1]];
     //        dd($previousTotalAndRankingArray);
     //        dd($averageTotalAndRankingArray);
     //        dd($forecastTotalAndRankingArray);
     return view('forecast.forecastStudentsFuturePerformance', compact('studentArray', 'studentAllPreExamsAveData', 'forecastNextExamData', 'previousTotalAndRankingArray', 'averageTotalAndRankingArray', 'forecastTotalAndRankingArray'));
 }