/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $data['title'] = 'Subjects'; $data['subjects_menu'] = 1; $data['subjects'] = Subject::all(); return view('settings.subjects.index', $data); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Contracts\View\Factory */ public function edit($id) { $paper = Paper::findOrFail($id); $subjects = Subject::all(); $questions = $paper->questions; return view('paper.edit', compact('paper', 'subjects', 'questions')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $departments = Department::all(); $subjects = Subject::all(); $department_subject = DepartmentSubject::find($id); return view('admin.department_subject.department_subject_edit', compact('departments', 'subjects', 'department_subject')); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(Request $request) { $subjects = Subject::all(); if ($request->ajax()) { return $subjects->toArray(); } return view('admin.subjects.index', ['subjects' => $subjects]); }
/** * 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); }
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')); }
/** * Run the database seeds. * * @return void */ public function run() { $users = \App\User::all(); $users_count = count($users) - 1; $subjects = \App\Subject::all(); $subjects_count = count($subjects) - 1; $data = []; for ($i = 0; $i < 100; $i++) { $data[] = ['description' => '', 'subject_id' => $subjects[rand(0, $subjects_count)]->id, 'user_id' => $users[rand(0, $users_count)]->id, 'date_time' => '2015-' . rand(1, 12) . '-' . rand(1, 28) . ' ' . rand(8, 20) . ':' . rand(0, 1) * 3 . '0', 'duration' => (double) rand(1, 6) / 2]; } DB::table('exam_schedules')->insert($data); }
/** * Run the database seeds. * * @return void */ public function run() { $weekdays = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']; $users = \App\User::all(); $users_count = count($users) - 1; $subjects = \App\Subject::all(); $subjects_count = count($subjects) - 1; $data = []; for ($i = 0; $i < 100; $i++) { $data[] = ['weekday' => $weekdays[rand(0, 6)], 'subject_id' => $subjects[rand(0, $subjects_count)]->id, 'user_id' => $users[rand(0, $users_count)]->id, 'time' => rand(8, 20) . ':00']; } DB::table('schedules')->insert($data); }
/** * Run the database seeds. * * @return void */ public function run() { $faker = Factory::create('fr_FR'); $subjectsCount = Subject::all()->count(); for ($qcms = 0; $qcms < 100; $qcms++) { $qcm = Qcm::create(['user_id' => 1, 'subject_id' => rand(1, $subjectsCount - 1), 'name' => $faker->sentence(6), 'description' => $faker->sentence(40)]); for ($questions = 0; $questions < rand(5, 10); $questions++) { $question = Question::create(['qcm_id' => $qcm->id, 'question' => $faker->sentence(20)]); for ($answers = 0; $answers < rand(2, 4); $answers++) { Answer::create(['question_id' => $question->id, 'answer' => $faker->sentence(10), 'isValid' => $answers == 0]); } } } }
public function seedClassSubject() { $drafts = Draft::all(); foreach ($drafts as $index => $draft) { $maMH = $draft->maMH; $maLMH = $draft->maLMH; $classSubjects = ClassSubject::all()->where('maLMH', $maLMH); $subject = Subject::all()->where('maMH', $maMH)->first(); $subject_id = $subject->id; if ($classSubjects->count() == 0) { $c = ClassSubject::create(['maLMH' => $maLMH, 'subject' => $subject_id]); var_dump($c->maLMH); } } }
public function index(Request $request) { return view('subject.index', ['subjects' => Subject::all()]); }
/** * Show the form for creating a new resource. * * @return \Illuminate\View\View */ public function create(Subject $subject) { $subjects = $subject->all(); return view('paper.create', compact('subjects')); }
/** * Display a listing of Subjects available as of now * * @param \App\Subject $subject Model Class * * @return \Illuminate\View\View */ public function index(\App\Subject $subject) { $subjects = $subject->all(); return view('admin.subject.index', compact('subjects')); }
private function tantargyak($file) { $tantcount = Subject::all()->count(); //insert tantargyak //tantargyak $tantargyak = Excel::selectSheetsByIndex(3)->load($file, function ($reader) { })->get(array('tantargy', 'rovidites'))->toArray(); try { foreach ($tantargyak as $tant) { if ($tant['tantargy'] != "") { $ment = Subject::firstOrCreate(array('subject_name' => $tant['tantargy'], 'subject_shortname' => $tant['rovidites'])); } } $tantcount = Subject::all()->count() - $tantcount; return $tantcount; } catch (\Exception $e) { $message = "Import file is not valid! Please check"; return view('import.error', compact('message')); } }
public function editTimetable(Timetable $timetable, Request $request) { if ($request->session()->has('email')) { $subjects = Subject::all(); return view('admin.timetable_edit', compact('timetable', 'subjects')); } else { return Redirect::action('AdminController@getAdminLogin'); } }
public function get_subjects($id) { $class = Grade::find($id); $subjects = Subject::all(); return view('classes.assign_subjects')->with('title', 'SMS|Assign Subjects to class')->with('class', $class)->with('subjects', $subjects); }
public function editStudentGradesForm(Grade $grade) { $subjects = Subject::all(); return view('teacher.editStudentGradesForm', compact('grade', 'subjects')); }
| */ //[OK] Route::get('/', function () { return view('landing'); }); //Dashboard [OK] Route::get('/dashboard', function (Request $request) { if (Auth::check()) { switch (Auth::user()->type) { case 'student': return view('user.students.dashboard'); case 'lecturer': return view('user.professors.dashboard'); case 'chair': return view('user.chairs.dashboard', ['subjects' => Subject::all()]); default: return redirect('/'); } } else { return redirect('/'); } }); /* Student Route */ Route::get('/instructions/{scorecardID}', function ($scorecardID) { session(['scorecardID' => $scorecardID]); return view('scorecard._instructions'); }); Route::post('/quiz_agree', 'ScoreCardController@take_quiz'); /* Student Lecture */ /* Student Chair */
public function getGroup(Request $request) { onlyAllowPostRequest($request); $id_user = intval($request->input('id')); $base = $request->input('base'); /** * Dữ liệu trả về */ $response = new stdClass(); $users = User::all()->where('id', $id_user); if ($users->count() == 0) { // $response->error = true; $response->error_msg = 'Không tồn tại người dùng này!'; return response()->json($response); } $user = $users->first(); $arrGroup = []; if ($base == 'class_xes') { $id_class = $user->class; $classX = ClassX::all()->where('id', $id_class)->first(); $class_x = new stdClass(); $class_x->id = $classX->id; $class_x->base = $base; $class_x->name = $classX->name; $class_x->soSV = ClassX::getCountStudentByClassId($id_class); $class_x->teacher = User::getInfoById($classX->teacher); $arrGroup = [$class_x]; } if ($base == 'classSubject') { /** * Giáo viên */ if ($user->type == 'teacher') { $u_x_id = $user->id; $classSubXS = SubClassSubject::all()->where('teacher', intval($u_x_id))->where('nhom', 0); if ($classSubXS->count() == 0) { $response->error = true; $response->error_msg = 'Đã có vấn đề xảy ra! Bạn vui long quay lại sau.'; return response()->json($response); } $arrGroup = []; foreach ($classSubXS as $k => $cls) { $sub_id = $cls->id; $subClassSubject = SubClassSubject::all()->where('id', intval($sub_id))->first(); $teacher_id = $subClassSubject->teacher; $lmh_id = $subClassSubject->classSubject; $classSubject = ClassSubject::all()->where('id', intval($lmh_id))->first(); $maLMH = $classSubject->maLMH; $subject_id = $classSubject->subject; $subject = Subject::all()->where('id', intval($subject_id))->first(); $cl = new stdClass(); $cl->base = 'classSubject'; $cl->id = $classSubject->id; $cl->maLMH = $maLMH; $cl->name = $subject->name; $cl->soSV = $subClassSubject->soSV; $cl->teacher = User::getInfoById($teacher_id); $arrGroup[] = $cl; } } else { $timeTables = TimeTable::all()->where('user', $user->id); if ($timeTables->count() == 0) { $response->error = true; $response->error_msg = 'Tài khoản chưa có lớp môn học nào!'; return response()->json($response); } foreach ($timeTables as $tt) { $sub_id = $tt->subClass; $subClassSubject = SubClassSubject::all()->where('id', intval($sub_id))->first(); $teacher_id = $subClassSubject->teacher; $lmh_id = $subClassSubject->classSubject; $classSubject = ClassSubject::all()->where('id', intval($lmh_id))->first(); $maLMH = $classSubject->maLMH; $subject_id = $classSubject->subject; $subject = Subject::all()->where('id', intval($subject_id))->first(); $cl = new stdClass(); $cl->base = 'classSubject'; $cl->id = $classSubject->id; $cl->maLMH = $maLMH; $cl->name = $subject->name; $cl->soSV = $subClassSubject->soSV; $cl->teacher = User::getInfoById($teacher_id); if ($subClassSubject->nhom == 0) { $arrGroup[] = $cl; } } } } $filter = []; $filter[0] = $arrGroup[0]; $j = 0; for ($i = 1; $i < count($arrGroup); $i++) { if ($filter[$j]->maLMH != $arrGroup[$i]->maLMH) { $j++; $filter[$j] = $arrGroup[$i]; } } $arrGroup = $filter; $response->error = false; $response->group = $arrGroup; return response()->json($response); }
public function subjectRegistration() { $subjects = Subject::all(); $departments = Department::lists('name', 'id'); return view('admin.subject.register', compact('subjects', 'departments')); }
public function getTimetable(Request $request) { $user_id = $request->input('id'); /** * Dữ liệu trả về */ $response = new stdClass(); $user = User::getInfoById($user_id); if ($user == null) { $response->error = true; $response->error_msg = 'Đã có vấn đề xảy ra! Bạn vui long quay lại sau.'; return response()->json($response); } /** * Giáo viên */ if ($user->type == 'teacher') { $u_x_id = $user->id; $classSubXS = SubClassSubject::all()->where('teacher', intval($u_x_id))->where('nhom', 0); if ($classSubXS->count() == 0) { $response->error = true; $response->error_msg = 'Đã có vấn đề xảy ra! Bạn vui long quay lại sau.'; return response()->json($response); } $arr_items = []; foreach ($classSubXS as $i => $s) { $s_id = $s->id; $subClassSubject = SubClassSubject::all()->where('id', intval($s_id))->first(); $class_id = $subClassSubject->classSubject; $classSubject = ClassSubject::all()->where('id', intval($class_id))->first(); $subject_id = $classSubject->subject; $subject = Subject::all()->where('id', intval($subject_id))->first(); $item_s = new stdClass(); $item_s->maMH = $subject->maMH; $item_s->maLMH = $classSubject->maLMH; $item_s->name = $subject->name; $item_s->soTin = $subject->soTin; $item_s->viTri = $subClassSubject->viTri; $item_s->soTiet = $subClassSubject->soTiet; $item_s->soSV = $subClassSubject->soSV; $item_s->nhom = $subClassSubject->nhom; $item_s->address = $subClassSubject->address; $item_s->teacher = User::getInfoById($subClassSubject->teacher); $arr_items[] = $item_s; } } else { $timetable = TimeTable::all()->where('user', intval($user_id)); if ($timetable->count() == 0) { $response->error = true; $response->error_msg = 'Bạn chưa đồng bộ thời khóa biểu!'; return response()->json($response); } $arr_items = []; foreach ($timetable as $i => $s) { $s_id = $s->subClass; $subClassSubject = SubClassSubject::all()->where('id', intval($s_id))->first(); $class_id = $subClassSubject->classSubject; $classSubject = ClassSubject::all()->where('id', intval($class_id))->first(); $subject_id = $classSubject->subject; $subject = Subject::all()->where('id', intval($subject_id))->first(); $item_s = new stdClass(); $item_s->maMH = $subject->maMH; $item_s->maLMH = $classSubject->maLMH; $item_s->name = $subject->name; $item_s->soTin = $subject->soTin; $item_s->viTri = $subClassSubject->viTri; $item_s->soTiet = $subClassSubject->soTiet; $item_s->soSV = $subClassSubject->soSV; $item_s->nhom = $subClassSubject->nhom; $item_s->address = $subClassSubject->address; $item_s->teacher = User::getInfoById($subClassSubject->teacher); $arr_items[] = $item_s; } } $filter = []; $filter[0] = $arr_items[0]; $j = 0; for ($i = 1; $i < count($arr_items); $i++) { if ($filter[$j]->maLMH != $arr_items[$i]->maLMH || $filter[$j]->nhom != $arr_items[$i]->nhom) { $j++; $filter[$j] = $arr_items[$i]; } } $response->error = false; $response->timetable = $filter; return response()->json($response); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $subjects = Subject::all(); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $subjects = Subject::all(); return view('subjects.index', compact('subjects')); }