}); //promote/demote ajax page respond('POST', '/fate', function ($request, $response, $app) { $permission = $request->data['permission']; $wpid = $request->data['wpid']; if ($permission == 'supervisor' || $permission == 'shift_leader' || $permission == 'sta' || $permission == 'trainee') { if (TrainingTracker::valid_wpid($wpid)) { $pidm = PSUPerson::get($wpid)->pidm; $type = TrainingTracker::checklist_type($permission); TrainingTracker::set_user_level($wpid, $permission); if (!TrainingTracker::checklist_exists($pidm, $type, 1)) { TrainingTracker::checklist_close($pidm); TrainingTracker::checklist_insert($pidm, $type); } else { TrainingTracker::checklist_close($pidm); TrainingTracker::checklist_open($pidm, $type); } } } }); //admin page respond('GET', '/fate', function ($request, $response, $app) { if (!$app->is_admin) { die('You do not have access to this page.'); } $staff_collection = new TrainingTracker\StaffCollection(); $staff_collection->load(); $staff = $staff_collection->promotion_users(); foreach ($staff as $person) { $permission = TrainingTracker::get_user_level($person->wpid); $person->permission_slug = $permission;