/**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $assignments = App\Assignment::all();
     return view('assignments.index', compact('assignments'));
 }
Пример #2
0
 /**
  * Display a list of all assignments.
  *
  * @return Response
  */
 public function all_assignments()
 {
     $data = array('assignments' => Assignment::all(), 'tutor_assignments' => Auth::user()->tutor_assignments, 'professor_assignments' => Auth::user()->professor_assignments);
     return view('assignments', $data);
 }
Пример #3
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $assignments = Assignment::all();
     return view('assignment/index', ['assignments' => $assignments]);
 }
Пример #4
0
 /**
  * Save request info as new report in database.
  * and send an email of the report
  *
  * @param  Request  $request
  * @return Response
  */
 public function add_report(Request $request)
 {
     $user = Auth::user();
     if (!$user->hasRole('admin') && !$user->hasRole('tutor')) {
         return view('access_denied');
     }
     $errors = array();
     if ($request->assignment == 0) {
         $errors['assignment'] = 'The assignment field is required.';
     }
     // TODO: Add additional error checks.
     if (!empty($errors)) {
         $assignments = [];
         if ($user->hasRole('admin')) {
             $assignments = Assignment::all();
         } else {
             if ($user->hasRole('tutor')) {
                 $assignments = $user->tutor_assignments;
             }
         }
         $data = array('errors' => $errors, 'old' => $request, 'assignments' => $assignments);
         return view('report_add', $data);
     }
     $report = new Report();
     $report->assignment_id = $request->assignment;
     $report->session_date = $request->session_date;
     $report->session_start = DateTime::createFromFormat('Y-m-d g:ia', $request->session_date . ' ' . $request->session_start);
     $report->session_end = DateTime::createFromFormat('Y-m-d g:ia', $request->session_date . ' ' . $request->session_end);
     $report->topic = $request->topic;
     $report->response = $request->response;
     $report->plans = $request->plans;
     $report->student_plans = $request->student_plans;
     $report->comments = $request->comments;
     $report->save();
     // send an email to the corresponding professor whenever a tutor submits a report
     /*
     Mail::send('emails.report_add_email', ['user' => $user, 'report' => $report], function ($message) use ($user, $report){
         $message->from('*****@*****.**', 'Calvin Tutoring Reports');
         $message->to($report->assignment->professor->email)->subject($report->assignment->course->department . '-' . $report->assignment->course->number . ' report submitted');
     });
     */
     session()->put('success', 'New Report has been added.');
     return redirect('report/' . $report->id);
 }
 /**
  * Loads assignments view
  * @return \Illuminate\View\View
  */
 public function assignments()
 {
     $assignments = Assignment::all();
     return view('pages.assignments', compact('assignments'));
 }