public function JobSessionsAct($user_id) { if (UserMod::where('id', $user_id)->where('role', '=', 'PHD Student')->exists() and AddRequest::where('user_id', $user_id)->where('status', '=', 'Accepted')->exists()) { $usr = UserMod::where('role', '=', 'PHD Student')->find($user_id); $requests = AddRequest::where('user_id', $user_id)->where('status', '=', 'Accepted')->with('activity')->with('sessions')->get(); return View::make("Phd-panel-job-act")->with('user', $usr)->with('requests', $requests); } else { Session::flash('failed', "Something went wrong, please try again!"); return back()->withInput(); } }
public function SupervisionEditConfirmStudentReq(Request $requests, $user_id, $student_id, $request_id) { $reason = Input::get('reason'); $new_comment = Input::get('supervisor_comment'); $new_confirmation = Input::get('supervisor_confirmation'); $old_comment = AddRequest::where('id', $request_id)->where('user_id', $student_id)->pluck('supervisor_comment'); if ($reason === '' and $new_comment === '' and $new_confirmation === 'Confirmed') { Session::flash('failed', "Nothing was changed, please check that you're actually updating something"); return back()->withInput(); } elseif ($reason != '' and $new_comment === '' and $new_confirmation === 'Confirmed') { Session::flash('failed', "You're trying to provide reason where you have not make any changes, Please make sure you're actually changing something to be able to provide reason"); return back()->withInput(); } elseif ($new_comment != '' and $reason === '') { if (UserMod::where('id', $user_id)->where('role', '=', 'Lecturer')->exists() and PhDStudent::where('supervisor_id', $user_id)->where('user_id', $student_id)->exists() and AddRequest::where('id', $request_id)->where('user_id', $student_id)->where('supervisor_confirmation', '=', 'Confirmed')->exists()) { $data = array('supervisor_comment' => '[Changed] - New Comment: ' . $requests->input('supervisor_comment'), 'supervisor_confirmation' => $requests->input('supervisor_confirmation')); $ch = AddRequest::where('id', $request_id)->where('user_id', $student_id)->update($data); if ($ch > 0) { Session::flash('success', "Your confirmation was successfully processed!"); return back()->withInput(); } else { Session::flash('failed', "Failed!"); return back()->withInput(); } } else { Session::flash('failed', "Something went wrong, please try again!"); return back()->withInput(); } } elseif ($new_comment === '' and $reason != '') { if (UserMod::where('id', $user_id)->where('role', '=', 'Lecturer')->exists() and PhDStudent::where('supervisor_id', $user_id)->where('user_id', $student_id)->exists() and AddRequest::where('id', $request_id)->where('user_id', $student_id)->where('supervisor_confirmation', '=', 'Confirmed')->exists()) { $data = array('supervisor_comment' => '[Changed] Reason: ' . $requests->input('reason') . ' - No New Comment Given' . $requests->{$old_comment}, 'supervisor_confirmation' => $requests->input('supervisor_confirmation')); $ch = AddRequest::where('id', $request_id)->where('user_id', $student_id)->update($data); if ($ch > 0) { Session::flash('success', "Your confirmation was successfully processed!"); return back()->withInput(); } else { Session::flash('failed', "Failed!"); return back()->withInput(); } } else { Session::flash('failed', "Something went wrong, please try again!"); return back()->withInput(); } } elseif ($new_comment === '' and $reason === '' and $new_confirmation != 'Confirmed') { if (UserMod::where('id', $user_id)->where('role', '=', 'Lecturer')->exists() and PhDStudent::where('supervisor_id', $user_id)->where('user_id', $student_id)->exists() and AddRequest::where('id', $request_id)->where('user_id', $student_id)->where('supervisor_confirmation', '=', 'Confirmed')->exists()) { $data = array('supervisor_comment' => '[Changed] Reason: NOT GIVEN - No New Comment Given', 'supervisor_confirmation' => $requests->input('supervisor_confirmation')); $ch = AddRequest::where('id', $request_id)->where('user_id', $student_id)->update($data); if ($ch > 0) { Session::flash('success', "Your confirmation was successfully processed!"); return back()->withInput(); } else { Session::flash('failed', "Failed!"); return back()->withInput(); } } else { Session::flash('failed', "Something went wrong, please try again!"); return back()->withInput(); } } else { if (UserMod::where('id', $user_id)->where('role', '=', 'Lecturer')->exists() and PhDStudent::where('supervisor_id', $user_id)->where('user_id', $student_id)->exists() and AddRequest::where('id', $request_id)->where('user_id', $student_id)->where('supervisor_confirmation', '=', 'Confirmed')->exists()) { $data = array('supervisor_comment' => '[Changed] Reason: ' . $requests->input('reason') . ' - New Comment: ' . $requests->input('supervisor_comment'), 'supervisor_confirmation' => $requests->input('supervisor_confirmation')); $ch = AddRequest::where('id', $request_id)->where('user_id', $student_id)->update($data); if ($ch > 0) { Session::flash('success', "Your confirmation was successfully processed!"); return back()->withInput(); } else { Session::flash('failed', "Failed!"); return back()->withInput(); } } else { Session::flash('failed', "Something went wrong, please try again!"); return back()->withInput(); } } }
public function deleteSession($user_id, $id) { if (UserMod::where('id', $user_id)->where('role', '=', 'Administrator')->exists()) { $session = ActSession::where('id', $id); $session->delete(); Session::flash('session_deleted', "Session was successfully deleted"); return redirect('Admin/Activities/Sessions'); } else { Session::flash('failed', "Something went wrong, please try again!"); return back()->withInput(); } }