public function getdatas(Request $request) { $dateline = null; $data = null; $sort = Input::get("sort"); $filters = [Input::get("subject") ? Input::get("subject") : null, Input::get("chapter") ? Input::get("chapter") : null, Input::get("topic") ? Input::get("topic") : null, Input::get("rating") ? Input::get("rating") : null, Input::get("level") ? Input::get("level") : null, Input::get("type") ? Input::get("type") : null]; $activequestions = Question::where('type', '!=', 7)->active()->orderBy("created_at", "DESC"); //filter subject,chapter,topic if ($filters[2]) { $activequestions = $activequestions->where('topic_id', $filters[2]); } else { if ($filters[1]) { $activequestions = $activequestions->where('chapter_id', $filters[1]); } else { if ($filters[0]) { $activequestions = $activequestions->where('subject_id', $filters[0]); } } } //filter RATING if if ($filters[3]) { $activequestions = $activequestions->where('rating', $filters[3]); } //filter LEVEL if if ($filters[4]) { $activequestions = $activequestions->where('level', $filters[4]); } //filter TYPE if if ($filters[5]) { $activequestions = $activequestions->where('type', $filters[5]); } //get the query results $activequestions = $activequestions->get(); // if ($sort == "authorwise") { $data = $this->convertToAuthorwise($activequestions); $dateline = $this->getDateLine($activequestions); } else { if ($sort == "datewise") { $data = $this->convertToDatewise($activequestions); } else { $data = $this->convertToOverall($activequestions); $dateline = $this->getDateLine($activequestions); } } return view('superadmin.analytics')->with('questions', $data)->with('datelines', $dateline)->with('sort', $sort)->with('filters', $filters)->with('qtypes', \App\QuestionType::all())->with('subjects', Subject::all())->with('path', $request->path()); }
public function getconfiguration($id) { $test = Test::find($id); if (count($test) > 0) { $test->ratings; foreach ($test->parts as $key => $part) { $part->subjects; foreach ($part->sections as $key => $section) { $section->questions; } } } $subjects = Subject::orderBy('no', 'asc')->get(); $chapters = Chapter::orderBy('no', 'asc')->get(); $questiontypes = QuestionType::all(); foreach ($chapters as $key => $chapter) { $chapter->module->subject; } return view('superadmin.configuretest')->with('test', $test)->with('subjects', $subjects)->with('chapters', $chapters)->with('questiontypes', $questiontypes); }
public function getquestions(Request $req) { /* For front end question fetch */ $course = $req->get('course'); $subject = $req->get('subject'); $chapter = $req->get('chapter'); $module = $req->get('module'); $topic = $req->get('topic'); $page = $req->get('page') ? $req->get('page') : 1; $type = $req->get('type'); $query = null; if ($topic) { $query = $this->questionsbyTopicName($course, $subject, $chapter, $topic); } else { if ($chapter) { $query = $this->questionsbyChapterName($course, $subject, $chapter); } else { if ($subject) { $query = $this->questionsbySubjectName($course, $subject); } else { $query = $this->questionsbyCourseName($course); } } } if (\Auth::user()) { $query = $query->with("userfavourite", "usersolved", "userdoubt", "typename"); } if ($type) { $query = $query->where('type', \App\QuestionType::where('name', $type)->firstOrFail()->id); } $query = $query->with('paragraphQuestions')->active()->orderBy('updated_at', 'DESC'); // dd("asd"); return $query->paginate(10); }
public function questionbank(Request $req, $question_id = null) { return view('admin.qbanknew')->with('subjects', Subject::all())->with('topics', Topic::all())->with('qtypes', QuestionType::all())->with('chapters', Chapter::all())->with('host', $req->root())->with('question_id', $question_id); }
public function getsubjectsnquestiontypes() { return ["types" => QuestionType::all(), "subjects" => $this->getsubjectsbyCourseName()]; }