Esempio n. 1
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (student()) {
         $menu = Menu::make('StudentSidebarMenu', function ($menu) {
         });
         $menu->add('الرئيسية', ['route' => 'students.profile.index'])->data('order', 1)->prepend('<i class="fa fa-home"></i>');
         $events = SemesterEvent::classroom()->count();
         if ($events) {
             $menu->add(trans(trans('students::profile.classrooms.choose_sessions_classrooms')), ['route' => 'students.profile.classrooms.index'])->prepend('<i class="fa fa-bell animated infinite swing"></i>')->data('order', 1);
         }
         $centers = ExamCenterPeriod::where('start_at', '<', date('Y-m-d H:i:s'))->where('finish_at', '>', date('Y-m-d H:i:s'))->where('semester_id', semester()->id)->count();
         if ($centers) {
             $menu->add(trans(trans('students::profile.exams.choose_exam_center')), ['route' => 'students.profile.centers.index'])->prepend('<i class="fa fa-bell animated infinite swing"></i>')->data('order', 2);
         }
         $menu->add(trans('students::profile.subjects.header'), ['route' => 'students.profile.subjects.index'])->data('order', 10)->prepend('<i class="fa fa-briefcase"></i>');
         $menu->add(trans('students::profile.sessions.header'), ['route' => 'students.profile.sessions.index'])->data('order', 20)->prepend('<i class="fa fa-video-camera"></i>');
         $menu->add(trans('students::profile.tickets.header'), ['route' => 'students.profile.tickets.index'])->data('order', 30)->prepend('<i class="fa fa-comment"></i>');
         $menu->add(trans('orders::order.menu'), ['route' => 'orders.index'])->prepend('<i class="fa fa-pencil-square-o"></i>');
         $menu->add(trans('الأسئلة الشائعة'), ['route' => 'students.faq.index'])->data('order', 40)->prepend('<i class="fa fa-briefcase"></i>');
     }
     return $next($request);
 }
Esempio n. 2
0
 private function checkPeriodsConflict($period_id = 0)
 {
     $periods = ExamCenterPeriod::where('id', '!=', $period_id)->where('semester_id', semester()->id)->whereRaw("'" . request('start_at') . "' < finish_at\n\t\t\t\t\tAND start_at < '" . request('finish_at') . "'")->get();
     return $periods->count();
 }
Esempio n. 3
0
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     //Exam
     Exam::created(function ($exam) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_exam', 'reference_id' => $exam->id]);
     });
     Exam::updated(function ($exam) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_exam', 'reference_id' => $exam->id]);
     });
     Exam::deleted(function ($exam) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_exam', 'reference_id' => $exam->id]);
     });
     //ExamCenter
     ExamCenter::created(function ($center) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_center', 'reference_id' => $center->id]);
     });
     ExamCenter::updated(function ($center) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_center', 'reference_id' => $center->id]);
     });
     ExamCenter::deleted(function ($center) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_center', 'reference_id' => $center->id]);
     });
     //ExamCenterPeriod
     ExamCenterPeriod::created(function ($period) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_period', 'reference_id' => $period->id]);
     });
     ExamCenterPeriod::updated(function ($period) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_period', 'reference_id' => $period->id]);
     });
     ExamCenterPeriod::deleted(function ($period) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_period', 'reference_id' => $period->id]);
     });
     //ExamQuestion
     ExamQuestion::created(function ($question) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_question', 'reference_id' => $question->id]);
     });
     ExamQuestion::updated(function ($question) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_question', 'reference_id' => $question->id]);
     });
     ExamQuestion::deleted(function ($question) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_question', 'reference_id' => $question->id]);
     });
     //ExamRecording
     ExamRecording::created(function ($recording) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_recording', 'reference_id' => $recording->id]);
     });
     ExamRecording::updated(function ($recording) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_recording', 'reference_id' => $recording->id]);
     });
     ExamRecording::deleted(function ($recording) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_recording', 'reference_id' => $recording->id]);
     });
     //ExamResult
     ExamResult::created(function ($result) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_result', 'reference_id' => $result->id]);
     });
     ExamResult::updated(function ($result) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_result', 'reference_id' => $result->id]);
     });
     ExamResult::deleted(function ($result) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_result', 'reference_id' => $result->id]);
     });
     //ExamResultAnswer
     ExamResultAnswer::created(function ($answer) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_answer', 'reference_id' => $answer->id]);
     });
     ExamResultAnswer::updated(function ($answer) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_answer', 'reference_id' => $answer->id]);
     });
     ExamResultAnswer::deleted(function ($answer) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_answer', 'reference_id' => $answer->id]);
     });
     //ExamRules
     ExamRules::created(function ($rule) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_rule', 'reference_id' => $rule->id]);
     });
     ExamRules::updated(function ($rule) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_rule', 'reference_id' => $rule->id]);
     });
     ExamRules::deleted(function ($rule) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_rule', 'reference_id' => $rule->id]);
     });
     //ExamExcuse
     ExamExcuse::created(function ($excuse) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_excuses', 'reference_id' => $excuse->id]);
     });
     ExamExcuse::updated(function ($excuse) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_excuses', 'reference_id' => $excuse->id]);
     });
     ExamExcuse::deleted(function ($excuse) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_excuses', 'reference_id' => $excuse->id]);
     });
 }