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 destroy($id)
 {
     $section = Section::find($id);
     // have something associated?
     // we have to validate these relationships in a future
     /*if ($units->count() > 0)
           return back()->with('error', 'No es posible eliminar un periodo asociado a unidades.');
       */
     $section->delete();
     return back();
 }
Beispiel #3
0
 public static function drop($uid, $sid)
 {
     $enrollment = Enrollment::where('student_id', '=', $uid)->where('section_id', '=', $sid);
     if ($enrollment->count() <= 0) {
         return "Enrollment does not exist.";
     }
     $enrollment->delete();
     $section = Section::find($sid);
     $section->filled = $section->filled - 1;
     $section->save();
     return true;
 }
 public static function getUserSchoolByUser($user)
 {
     //      $profile= ;
     //       $classId = DB::table('teachingclasses')->where('users_id', $user->id)->value('classes_id');
     //        $schoolId = DB::table('classes')->where('classes_id', $classId)->value('schools_id');
     //        $schoolName = DB::table('schools')->where('id', $schoolId)->value('name');
     $sectionId = User::find($user->id)->teachingSection()->first()->value('sections_id');
     $section = Section::getSectionByUser($user);
     $school = Section::find($sectionId)->school();
     $section = Section::find($sectionId);
     //        $profile = [];
     return $school;
 }
 public function enroll()
 {
     $section_id = Request::input('id');
     $user = Auth::user();
     $enrollment_count = Enrollment::where('student_id', '=', $user->id)->count();
     if ($enrollment_count > 3) {
         return json_encode(array("status" => "error", "message" => "You have already enrolled in maximum courses. Please contact the advisor"));
     }
     $section = Section::find($section_id);
     if ($section->filled >= $section->capacity) {
         return json_encode(array("status" => "error", "message" => "The section your requested is full. Please pick a diffrent section"));
     }
     $k = Enrollment::enroll($user->id, $section_id);
     file_put_contents("enroll_drop.log", date("F j, Y, g:i a") . " " . $user->student_id . "(" . $user->name . ") enrolled in Section Id: " . $section_id . "\n", FILE_APPEND);
     return json_encode(array("status" => "success", "message" => "Enrollment Successfull"));
 }
 public function students(Request $request)
 {
     $section_id = $request->section;
     $subject_id = $request->subject;
     $students = Section::find($section_id)->students;
     foreach ($students as $i => $student) {
         $studentSubjects = $student->user->studentSubjects;
         $found = false;
         if (count($studentSubjects)) {
             foreach ($studentSubjects as $subject) {
                 if ($subject->subject_id == $subject_id) {
                     $found = true;
                 }
             }
         }
         $student['valid'] = $found;
     }
     return $students->where('valid', true);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $section = Section::find(Crypt::decrypt($id));
     if (count($section) == 0) {
         return response()->json(['success' => false, 'message' => 'Invalid id!']);
     }
     $student = Student::where('section_id', Crypt::decrypt($id))->first();
     if (count($student) > 0) {
         $sections = Section::all();
         return response()->json(['success' => false, 'message' => 'Cannot delete section. A student is enrolled in this section', 'content' => view('partials.section-table', compact('sections'))->render()]);
     }
     if (!$section->delete()) {
         return response()->json(['success' => false, 'message' => 'Failed to delete record!']);
     }
     $sections = Section::all();
     return response()->json(['success' => true, 'message' => 'Delete record successful!', 'content' => view('partials.section-table', compact('sections'))->render()]);
 }
 public function editSection($id)
 {
     $section = Section::find($id);
     return view('admin.editSection', compact('section'));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     //
     $section = Section::find($id);
     return view('sections/edit', compact('section'));
 }
Beispiel #10
0
 public function getSection($sectionId)
 {
     $result = Section::find($sectionId);
     return response()->json(['result' => $result]);
 }
 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 importStudentOwnSections(Request $request)
 {
     $studentSectionId = $request->input('addStudentSections');
     $user = Auth::user();
     //        在teachingSection表中查找是否已经有这个学生,如果有就把原来信息改写,如果没有就插入一条记录
     $studentTeachingSection = TeachingSection::getTeachingsectionByStudent($user);
     if ($studentTeachingSection === null) {
         //means it doesn't exist in teachingSection table.
         //we need to update it.
         $newStudentTeachingSection = new TeachingSection();
         $newStudentTeachingSection->users_id = $user->id;
         $newStudentTeachingSection->sections_id = $studentSectionId;
         $section = Section::find($studentSectionId);
         $section->total += 1;
         $section->save();
         $newStudentTeachingSection->save();
     } else {
         //it already exists in teachingSection, we just update the latest section.
         $studentTeachingSection->sections_id = $studentSectionId;
         $studentTeachingSection->save();
     }
     flash()->overlay('同学你好,已经成功修改了你的学习班级信息', '成功');
     return redirect('/dashboard');
 }
 public function edit(Request $request, $id)
 {
     $this->validate($request, ['name' => 'required']);
     Section::find($id)->update($request->all());
     return \Redirect()->back()->with(['flash_message' => 'Section Successfully Edited']);
 }
 public function recordAllSectionEachTest($sectionId, $newExaminationId)
 {
     $teachingSections = TeachingSection::where('sections_id', '=', $sectionId)->get();
     $studentsIdsIncludingTeachers = DB::table('teaching_sections')->where('sections_id', '=', $sectionId)->lists('users_id');
     $students = DB::table('users')->where('role', '=', '1')->whereIn('id', $studentsIdsIncludingTeachers)->get();
     $studentsIds = DB::table('users')->where('role', '=', '1')->whereIn('id', $studentsIdsIncludingTeachers)->lists('id');
     //        dd($students);
     //        dd($sectionId);
     //        dd($newExaminationId);
     //generating a transcript table for each student in this examination.
     foreach ($students as $student) {
         $newTranscript = new Transcript();
         $newTranscript->examinations_id = $newExaminationId;
         $newTranscript->users_id = $student->id;
         $newTranscript->save();
     }
     //        $students = DB::table('users')->where('role', '=', '1')->whereIn('id', $studentsIds)->paginate(10);
     $wholeSectionTranscripts = DB::table('transcripts')->where('examinations_id', '=', $newExaminationId)->whereIn('users_id', $studentsIds)->paginate(10);
     $section = Section::find($sectionId);
     return view('scores.logStudentsTestResult', compact('section', 'wholeSectionTranscripts'));
 }
Beispiel #15
0
 public function filterPosts(Request $request)
 {
     $query = $request->city_id ? 'city_id = ' . (int) $request->city_id . ' AND ' : NULL;
     $query .= $request->image == 'on' ? 'image IS NOT NULL AND ' : NULL;
     $query .= $request->from ? 'price >= ' . (int) $request->from . ' AND ' : 'price >= 0 AND ';
     $query .= $request->to ? 'price <= ' . (int) $request->to : 'price <= 9999999999';
     if ($request->text) {
         $text = trim(strip_tags($request->text));
         $query .= " AND (title LIKE '%{$text}%' or description LIKE '%{$text}%')";
     }
     $section = Section::all();
     $profiles = Profile::take(5)->get();
     if ($request->category_id) {
         $section = Section::find($request->category_id);
         $posts = Post::where('status', 1)->where('category_id', $request->category_id)->whereRaw($query)->orderBy('id', 'DESC')->paginate(10);
         $posts->appends(['category_id' => (int) $request->category_id, 'city_id' => (int) $request->city_id, 'text' => $request->text, 'image' => $request->image == 'on' ? 'on' : NULL, 'from' => (int) $request->from, 'to' => (int) $request->to, 'tag_id' => $request->tags_id]);
     } else {
         $posts = Post::where('status', 1)->whereRaw($query)->orderBy('id', 'DESC')->paginate(10);
         $posts->appends(['city_id' => (int) $request->city_id, 'text' => $request->text, 'image' => $request->image == 'on' ? 'on' : NULL, 'from' => (int) $request->from, 'to' => (int) $request->to, 'tag_id' => $request->tags_id]);
     }
     $selected_tags = [];
     if (isset($request->tags_id)) {
         $selected_tags = $request->tags_id;
         foreach ($posts as $post_key => $post) {
             $hasTag = false;
             foreach ($selected_tags as $tag_id) {
                 if ($post->hasTag($tag_id)) {
                     $hasTag = true;
                 }
             }
             if (!$hasTag) {
                 unset($posts[$post_key]);
             }
         }
     }
     $category = Category::findOrFail($request->category_id);
     $category_tags = $category->tags()->get();
     $favorites = ProfileController::getFavorites($request);
     $favorites = $favorites ? $favorites : [];
     return view('board.posts', compact('category', 'category_tags', 'selected_tags', 'section', 'sections', 'profiles', 'posts', 'favorites'));
 }
Beispiel #16
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $section = Section::find($id);
     if (Storage::exists('img/section/' . $section->image)) {
         Storage::delete('img/section/' . $section->image);
     }
     $section->delete();
     return redirect('/admin/section')->with('status', 'Рубрика удалена!');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $section = Section::find($id);
     $section->delete();
     return redirect('/admin/section')->with('status', 'Раздел удален!');
 }
 public static function getSectionByteachingSections($teachingSections)
 {
     $sections = Section::find($teachingSections->sections_id);
     //        $sections = Section::where('id', '=', $teachingSections->sections_id);
     return $sections;
 }
 public function show($id)
 {
     $section = Section::find($id);
     return view('admin.section.show', compact('section'));
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     //
     $v = Validator::make(Request::all(), ['name' => 'required|max:50']);
     if ($v->fails()) {
         return redirect()->back()->withErrors($v->errors())->withInput();
     } else {
         $id = Request::get('id');
         $section = Section::find($id);
         $section->name = Request::get('name');
         $section->desc = Request::get('desc');
         $section->save();
         return redirect('sections');
     }
 }
 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'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($cid, $sid)
 {
     echo $cid . " " . $sid;
     $section = Section::find($sid);
     $section->delete();
     Session::flash('message', 'Successfully deleted section');
     return redirect()->back();
 }
Beispiel #23
0
 public function filterPosts(Request $request)
 {
     $query = $request->city_id ? 'city_id = ' . (int) $request->city_id . ' AND ' : NULL;
     $query .= $request->image == 'on' ? 'image IS NOT NULL AND ' : NULL;
     $query .= $request->from ? 'price >= ' . (int) $request->from . ' AND ' : 'price >= 0 AND ';
     $query .= $request->to ? 'price <= ' . (int) $request->to : 'price <= 9999999';
     if ($request->text) {
         $text = trim(strip_tags($request->text));
         $query .= " AND (title LIKE '%{$text}%' or description LIKE '%{$text}%')";
     }
     $sections = Section::all();
     $profiles = Profile::take(5)->get();
     if ($request->section_id) {
         $section = Section::find($request->section_id);
         $posts = Post::where('status', 1)->where('section_id', $request->section_id)->whereRaw($query)->orderBy('id', 'DESC')->paginate(10);
         $posts->appends(['section_id' => (int) $request->section_id, 'city_id' => (int) $request->city_id, 'text' => $request->text, 'image' => $request->image == 'on' ? 'on' : NULL, 'from' => (int) $request->from, 'to' => (int) $request->to]);
     } else {
         $posts = Post::where('status', 1)->whereRaw($query)->orderBy('id', 'DESC')->paginate(10);
         $posts->appends(['city_id' => (int) $request->city_id, 'text' => $request->text, 'image' => $request->image == 'on' ? 'on' : NULL, 'from' => (int) $request->from, 'to' => (int) $request->to]);
     }
     return view('board.found_posts', compact('section', 'sections', 'profiles', 'posts'));
 }