@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | protected function setupListOperation() |
36 | 36 | { |
37 | 37 | CRUD::setColumns([ |
38 | - [ // skill type |
|
38 | + [// skill type |
|
39 | 39 | 'label' => 'Type', // Table column heading |
40 | 40 | 'type' => 'select', |
41 | 41 | 'name' => 'skill_type', // the method that defines the relationship in your Model |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | 'type' => 'text', |
49 | 49 | 'name' => 'name', |
50 | 50 | ], |
51 | - [ // skill level |
|
51 | + [// skill level |
|
52 | 52 | 'label' => 'Level', // Table column heading |
53 | 53 | 'type' => 'select', |
54 | 54 | 'name' => 'level', // the method that defines the relationship in your Model |
@@ -60,23 +60,23 @@ discard block |
||
60 | 60 | |
61 | 61 | CRUD::enableBulkActions(); |
62 | 62 | |
63 | - CRUD::addFilter([ // select2 filter |
|
63 | + CRUD::addFilter([// select2 filter |
|
64 | 64 | 'name' => 'level_id', |
65 | 65 | 'type' => 'select2', |
66 | 66 | 'label'=> 'Level', |
67 | - ], function () { |
|
67 | + ], function() { |
|
68 | 68 | return Level::all()->pluck('name', 'id')->toArray(); |
69 | - }, function ($value) { // if the filter is active |
|
69 | + }, function($value) { // if the filter is active |
|
70 | 70 | CRUD::addClause('where', 'level_id', $value); |
71 | 71 | }); |
72 | 72 | |
73 | - CRUD::addFilter([ // select2 filter |
|
73 | + CRUD::addFilter([// select2 filter |
|
74 | 74 | 'name' => 'skill_type_id', |
75 | 75 | 'type' => 'select2', |
76 | 76 | 'label'=> 'Type', |
77 | - ], function () { |
|
77 | + ], function() { |
|
78 | 78 | return SkillType::all()->pluck('name', 'id')->toArray(); |
79 | - }, function ($value) { // if the filter is active |
|
79 | + }, function($value) { // if the filter is active |
|
80 | 80 | CRUD::addClause('where', 'skill_type_id', $value); |
81 | 81 | }); |
82 | 82 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | { |
86 | 86 | CRUD::setValidation(StoreRequest::class); |
87 | 87 | CRUD::addFields([ |
88 | - [ // skill type |
|
88 | + [// skill type |
|
89 | 89 | 'label' => 'Type', // Table column heading |
90 | 90 | 'type' => 'select', |
91 | 91 | 'name' => 'skill_type_id', // the db column for the foreign key |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | 'type' => 'text', |
99 | 99 | 'name' => 'name', |
100 | 100 | ], |
101 | - [ // skill level |
|
101 | + [// skill level |
|
102 | 102 | 'label' => 'Level', // Table column heading |
103 | 103 | 'type' => 'select', |
104 | 104 | 'name' => 'level_id', // the db column for the foreign key |
@@ -86,52 +86,52 @@ |
||
86 | 86 | |
87 | 87 | ]); |
88 | 88 | |
89 | - CRUD::addFilter([ // select2 filter |
|
89 | + CRUD::addFilter([// select2 filter |
|
90 | 90 | 'name' => 'rhythm_id', |
91 | 91 | 'type' => 'select2', |
92 | 92 | 'label'=> __('Rhythm'), |
93 | - ], function () { |
|
93 | + ], function() { |
|
94 | 94 | return Rhythm::all()->pluck('name', 'id')->toArray(); |
95 | - }, function ($value) { // if the filter is active |
|
95 | + }, function($value) { // if the filter is active |
|
96 | 96 | CRUD::addClause('where', 'rhythm_id', $value); |
97 | 97 | }, |
98 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
98 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
99 | 99 | }); |
100 | 100 | |
101 | - CRUD::addFilter([ // select2 filter |
|
101 | + CRUD::addFilter([// select2 filter |
|
102 | 102 | 'name' => 'teacher_id', |
103 | 103 | 'type' => 'select2', |
104 | 104 | 'label'=> __('Teacher'), |
105 | - ], function () { |
|
105 | + ], function() { |
|
106 | 106 | return Teacher::all()->pluck('name', 'id')->toArray(); |
107 | - }, function ($value) { // if the filter is active |
|
107 | + }, function($value) { // if the filter is active |
|
108 | 108 | CRUD::addClause('where', 'teacher_id', $value); |
109 | 109 | }, |
110 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
110 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
111 | 111 | }); |
112 | 112 | |
113 | - CRUD::addFilter([ // select2 filter |
|
113 | + CRUD::addFilter([// select2 filter |
|
114 | 114 | 'name' => 'level_id', |
115 | 115 | 'type' => 'select2', |
116 | 116 | 'label'=> __('Level'), |
117 | - ], function () { |
|
117 | + ], function() { |
|
118 | 118 | return Level::all()->pluck('name', 'id')->toArray(); |
119 | - }, function ($value) { // if the filter is active |
|
119 | + }, function($value) { // if the filter is active |
|
120 | 120 | CRUD::addClause('where', 'level_id', $value); |
121 | 121 | }, |
122 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
122 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
123 | 123 | }); |
124 | 124 | |
125 | - CRUD::addFilter([ // select2 filter |
|
125 | + CRUD::addFilter([// select2 filter |
|
126 | 126 | 'name' => 'period_id', |
127 | 127 | 'type' => 'select2', |
128 | 128 | 'label'=> __('Period'), |
129 | - ], function () { |
|
129 | + ], function() { |
|
130 | 130 | return Period::all()->sortByDesc('id')->pluck('name', 'id')->toArray(); |
131 | - }, function ($value) { // if the filter is active |
|
131 | + }, function($value) { // if the filter is active |
|
132 | 132 | CRUD::addClause('where', 'period_id', $value); |
133 | 133 | }, |
134 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
134 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
135 | 135 | $period = Period::get_default_period()->id; |
136 | 136 | CRUD::addClause('where', 'period_id', $period); |
137 | 137 | $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | }, function ($value) { // if the filter is active |
182 | 182 | CRUD::addClause('where', 'rhythm_id', $value); |
183 | 183 | }, |
184 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
185 | - }); |
|
184 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
185 | + }); |
|
186 | 186 | |
187 | 187 | CRUD::addFilter([ // select2 filter |
188 | 188 | 'name' => 'teacher_id', |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | }, function ($value) { // if the filter is active |
194 | 194 | CRUD::addClause('where', 'teacher_id', $value); |
195 | 195 | }, |
196 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
197 | - }); |
|
196 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
197 | + }); |
|
198 | 198 | |
199 | 199 | CRUD::addFilter([ // select2 filter |
200 | 200 | 'name' => 'level_id', |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | }, function ($value) { // if the filter is active |
206 | 206 | CRUD::addClause('where', 'level_id', $value); |
207 | 207 | }, |
208 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
209 | - }); |
|
208 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
209 | + }); |
|
210 | 210 | |
211 | 211 | CRUD::addFilter([ // select2 filter |
212 | 212 | 'name' => 'period_id', |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | }, function ($value) { // if the filter is active |
218 | 218 | CRUD::addClause('where', 'period_id', $value); |
219 | 219 | }, |
220 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
221 | - $period = Period::get_default_period()->id; |
|
222 | - CRUD::addClause('where', 'period_id', $period); |
|
223 | - $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active |
|
224 | - }); |
|
220 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
221 | + $period = Period::get_default_period()->id; |
|
222 | + CRUD::addClause('where', 'period_id', $period); |
|
223 | + $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active |
|
224 | + }); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | protected function setupCreateOperation() |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | public function teacher(Request $request) |
50 | 50 | { |
51 | - if (! backpack_user()->isTeacher()) { |
|
51 | + if (!backpack_user()->isTeacher()) { |
|
52 | 52 | abort(403); |
53 | 53 | } |
54 | 54 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | public function student() |
69 | 69 | { |
70 | - if (! backpack_user()->isStudent()) { |
|
70 | + if (!backpack_user()->isStudent()) { |
|
71 | 71 | abort(403); |
72 | 72 | } |
73 | 73 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $currentPeriod = Period::get_default_period(); |
86 | 86 | $enrollmentsPeriod = Period::get_enrollments_period(); |
87 | 87 | |
88 | - if (! backpack_user()->hasRole(['admin', 'secretary'])) { |
|
88 | + if (!backpack_user()->hasRole(['admin', 'secretary'])) { |
|
89 | 89 | abort(403); |
90 | 90 | } |
91 | 91 | |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | |
97 | 97 | $teachers = Teacher::with('user')->get()->toArray(); |
98 | 98 | |
99 | - $teachers = array_map(function ($teacher) { |
|
99 | + $teachers = array_map(function($teacher) { |
|
100 | 100 | return [ |
101 | 101 | 'id' => $teacher['id'], |
102 | 102 | 'title' => $teacher['user']['firstname'], |
103 | 103 | ]; |
104 | 104 | }, $teachers); |
105 | 105 | |
106 | - $events = array_map(function ($event) { |
|
106 | + $events = array_map(function($event) { |
|
107 | 107 | return [ |
108 | 108 | 'title' => $event['name'], |
109 | 109 | 'resourceId' => $event['teacher_id'], |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | 'currentPeriod' => $currentPeriod, |
122 | 122 | 'enrollmentsPeriod' => $enrollmentsPeriod, |
123 | 123 | 'total_enrollment_count' => $currentPeriod->internal_enrollments_count, |
124 | - 'pending_attendance' => $currentPeriod->courses_with_pending_attendance, // optimize |
|
124 | + 'pending_attendance' => $currentPeriod->courses_with_pending_attendance, // optimize |
|
125 | 125 | 'unassigned_events' => (new Event())->unassigned_teacher->count(), |
126 | 126 | 'upcoming_leaves' => Leave::upcoming_leaves(), |
127 | 127 | 'resources' => $teachers, |
@@ -29,12 +29,12 @@ |
||
29 | 29 | */ |
30 | 30 | protected function schedule(Schedule $schedule) |
31 | 31 | { |
32 | - $schedule->call(function () { |
|
32 | + $schedule->call(function() { |
|
33 | 33 | Log::info('Sending attendance reminders'); |
34 | 34 | (new Attendance())->remindPendingAttendance(); |
35 | 35 | })->dailyAt('08:15'); |
36 | 36 | |
37 | - $schedule->call(function () { |
|
37 | + $schedule->call(function() { |
|
38 | 38 | Log::info('Checking default periods'); |
39 | 39 | |
40 | 40 | // when we finish the current period; remove the manual override to automatically fallbackto the next one |
@@ -18,7 +18,7 @@ |
||
18 | 18 | parent::boot(); |
19 | 19 | |
20 | 20 | // before adding an event, we check that the teacher is available |
21 | - static::saving(function ($event) { |
|
21 | + static::saving(function($event) { |
|
22 | 22 | $teacher = Teacher::find($event->teacher_id); |
23 | 23 | // if the teacher is on leave on the day of the event |
24 | 24 | if (($event->teacher_id !== null) && $teacher->leaves->contains('date', Carbon::parse($event->start)->toDateString())) { |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | parent::boot(); |
28 | 28 | |
29 | 29 | // when creating a new enrollment, also add past attendance |
30 | - static::created(function (self $enrollment) { |
|
30 | + static::created(function(self $enrollment) { |
|
31 | 31 | $events = $enrollment->course->events->where('start', '<', (new Carbon())->toDateString()); |
32 | 32 | foreach ($events as $event) { |
33 | 33 | $event->attendance()->create([ |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | public function scopeWithoutChildren($query) |
59 | 59 | { |
60 | 60 | return $query |
61 | - ->where(function ($query) { |
|
61 | + ->where(function($query) { |
|
62 | 62 | $query->whereDoesntHave('childrenEnrollments') |
63 | 63 | ->where('parent_id', null); |
64 | 64 | }) |
65 | - ->orWhere(function ($query) { |
|
65 | + ->orWhere(function($query) { |
|
66 | 66 | $query->where('parent_id', null); |
67 | 67 | }) |
68 | 68 | ->get(); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | public function scopePeriod(Builder $query, $period) |
86 | 86 | { |
87 | - return $query->whereHas('course', function ($q) use ($period) { |
|
87 | + return $query->whereHas('course', function($q) use ($period) { |
|
88 | 88 | $q->where('period_id', $period); |
89 | 89 | }); |
90 | 90 | } |
@@ -293,13 +293,13 @@ discard block |
||
293 | 293 | |
294 | 294 | // delete attendance records related to the enrollment |
295 | 295 | $attendances = $this->course->attendance->where('student_id', $this->student->id); |
296 | - Attendance::destroy($attendances->map(function ($item, $key) { |
|
296 | + Attendance::destroy($attendances->map(function($item, $key) { |
|
297 | 297 | return $item->id; |
298 | 298 | })); |
299 | 299 | |
300 | 300 | foreach ($this->course->children as $child) { |
301 | 301 | $attendances = $child->attendance->where('student_id', $this->student->id); |
302 | - Attendance::destroy($attendances->map(function ($item, $key) { |
|
302 | + Attendance::destroy($attendances->map(function($item, $key) { |
|
303 | 303 | return $item->id; |
304 | 304 | })); |
305 | 305 | } |
@@ -52,7 +52,7 @@ |
||
52 | 52 | |
53 | 53 | $grade_type = GradeType::findOrFail($request->input('grade_type_id')); |
54 | 54 | |
55 | - if (! $course->grade_types->contains($grade_type->id)) { |
|
55 | + if (!$course->grade_types->contains($grade_type->id)) { |
|
56 | 56 | $course->grade_types()->attach($grade_type->id); |
57 | 57 | } |
58 | 58 |
@@ -10,8 +10,8 @@ |
||
10 | 10 | public function __invoke(Builder $query, $value, string $property) |
11 | 11 | { |
12 | 12 | $value = collect($value)->toArray(); |
13 | - $query->where(function (Builder $query) use ($value) { |
|
14 | - $query->whereIn('level_id', $value)->orWhereHas('children', function (Builder $query) use ($value) { |
|
13 | + $query->where(function(Builder $query) use ($value) { |
|
14 | + $query->whereIn('level_id', $value)->orWhereHas('children', function(Builder $query) use ($value) { |
|
15 | 15 | $query->whereIn('level_id', $value); |
16 | 16 | }); |
17 | 17 | }); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * a user is allowed to edit the course grades if they are the teacher for this course, |
30 | 30 | * or if they have explicit permission to do so |
31 | 31 | */ |
32 | - Gate::define('edit-course-grades', function ($user, $course) { |
|
32 | + Gate::define('edit-course-grades', function($user, $course) { |
|
33 | 33 | return $user->isTeacher() && $user->teacher_id == $course->teacher_id || $user->can('evaluation.edit'); |
34 | 34 | }); |
35 | 35 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * a user is allowed to view the course attendance sheet if they are the teacher for this course, |
38 | 38 | * or if they have explicit permission to view all course attendance sheets |
39 | 39 | */ |
40 | - Gate::define('view-course-attendance', function ($user, $course) { |
|
40 | + Gate::define('view-course-attendance', function($user, $course) { |
|
41 | 41 | return $user->isTeacher() && $user->teacher_id == $course->teacher_id || $user->can('attendance.view'); |
42 | 42 | }); |
43 | 43 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * if they are the teacher for this course, |
47 | 47 | * or if they have explicit permission to view all event attendance sheets |
48 | 48 | */ |
49 | - Gate::define('view-event-attendance', function ($user, $event) { |
|
49 | + Gate::define('view-event-attendance', function($user, $event) { |
|
50 | 50 | return ($event->teacher_id == $user->teacher_id) || ($event->course->teacher_id == $user->teacher_id) || $user->can('attendance.view'); |
51 | 51 | }); |
52 | 52 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * if they are the teacher for the course, |
56 | 56 | * or if they have explicit permission to edit any attendance sheets |
57 | 57 | */ |
58 | - Gate::define('edit-attendance', function ($user, $event) { |
|
58 | + Gate::define('edit-attendance', function($user, $event) { |
|
59 | 59 | return ($event->teacher_id == $user->teacher_id) || ($event->course->teacher_id == $user->teacher_id) || $user->can('attendance.edit'); |
60 | 60 | }); |
61 | 61 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * teachers are allowed to view their own calendar, |
64 | 64 | * and users with explicit permission can view all calendars |
65 | 65 | */ |
66 | - Gate::define('view-teacher-calendar', function ($user, $teacher) { |
|
66 | + Gate::define('view-teacher-calendar', function($user, $teacher) { |
|
67 | 67 | return ($user->isTeacher() && $user->teacher_id == $teacher->id) || $user->can('calendars.view'); |
68 | 68 | }); |
69 | 69 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * teachers are allowed to view their own courses, |
72 | 72 | * and users with explicit permission can view all courses |
73 | 73 | */ |
74 | - Gate::define('view-course', function ($user, $course) { |
|
74 | + Gate::define('view-course', function($user, $course) { |
|
75 | 75 | return ($user->isTeacher() && $user->teacher_id == $course->teacher_id) || $user->can('courses.view'); |
76 | 76 | }); |
77 | 77 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * if they are a teacher |
81 | 81 | * of if they have explicit permission to view any result |
82 | 82 | */ |
83 | - Gate::define('view-enrollment', function ($user, $enrollment) { |
|
83 | + Gate::define('view-enrollment', function($user, $enrollment) { |
|
84 | 84 | return ($user->isStudent() && $user->student_id == $enrollment->student_id) || $user->isTeacher() || $user->can('evaluation.view'); |
85 | 85 | }); |
86 | 86 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * if the user is the teacher of the course |
89 | 89 | * of if they have explicit permission to enroll students |
90 | 90 | */ |
91 | - Gate::define('enroll-in-course', function ($user, $course) { |
|
91 | + Gate::define('enroll-in-course', function($user, $course) { |
|
92 | 92 | return $course->teacher_id == $user->teacher_id || $user->can('enrollments.edit'); |
93 | 93 | }); |
94 | 94 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * if the user is a teacher |
97 | 97 | * of if they have explicit permission to enroll students |
98 | 98 | */ |
99 | - Gate::define('enroll-students', function ($user) { |
|
99 | + Gate::define('enroll-students', function($user) { |
|
100 | 100 | return $user->isTeacher() || $user->can('enrollments.edit'); |
101 | 101 | }); |
102 | 102 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * teachers are allowed to view their own hours, |
105 | 105 | * and users with explicit permission can view all hours |
106 | 106 | */ |
107 | - Gate::define('view-teacher-hours', function ($user, $teacher) { |
|
107 | + Gate::define('view-teacher-hours', function($user, $teacher) { |
|
108 | 108 | return ($user->isTeacher() && $user->teacher_id == $teacher->id) || $user->can('hr.view'); |
109 | 109 | }); |
110 | 110 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * teachers are allowed to edit results for their own students |
113 | 113 | * as well as users with explicit permission to edit any result |
114 | 114 | */ |
115 | - Gate::define('edit-result', function ($user, $enrollment) { |
|
115 | + Gate::define('edit-result', function($user, $enrollment) { |
|
116 | 116 | return ($user->isTeacher() && $user->teacher_id == $enrollment->course->teacher_id) || $user->can('evaluation.edit'); |
117 | 117 | }); |
118 | 118 | } |