foreach ($staff as $person) { $permission = TrainingTracker::get_user_level($person->wpid); $person->permission_slug = $permission; $person->permission = TrainingTracker::level_translation($permission); } $app->tpl->assign('staff', $staff); $app->tpl->display('admin.tpl'); }); //statistics/checklist page respond('GET', '/statistics/[:wpid]', function ($request, $responce, $app) { $wpid = $request->wpid; if (!TrainingTracker::valid_wpid($wpid)) { $responce->redirect('../../'); } $current_user_parameter['wpid'] = $wpid; $current_user = new TrainingTracker\Staff($current_user_parameter); $current_user_level = TrainingTracker::get_user_level($current_user->wpid); $active_user_level = TrainingTracker::get_user_level($app->user->wpid); $checklist_id = TrainingTracker::get_checklist_id($current_user->person()->pidm); if (strlen($checklist_id) > 2) { //get the data for which check boxes are checked $checklist_checked = TrainingTracker::checklist_checked($checklist_id); // TODO: Y U NO USE FOREACH( $something as &$item ) by reference? // yes $tooltip = array(); foreach ($checklist_checked as &$checked) { $item_id = $checked['item_id']; $tooltip[$item_id]['item_id'] = $item_id; $tooltip[$item_id]['updated_by'] = PSUPerson::get($checked['updated_by'])->formatname('f l'); $tooltip[$item_id]['updated_time'] = $checked["activity_date"]; $checked = $checked['item_id'];
$app->tpl->assign('user', $app->user); $app->tpl->assign('base_url', $GLOBALS['BASE_URL']); $app->tpl->assign('has_team', $has_team); $app->tpl->assign('wpid', $wpid); $app->tpl->assign('is_admin', $is_admin); $app->tpl->assign('is_mentor', $is_mentor); }); // the person select page respond('/?', function ($request, $response, $app) { if ($app->is_mentor) { $staff_collection = new TrainingTracker\StaffCollection(); $staff_collection->load(); $staff = $staff_collection->staff(); } else { $current_user_parameter["wpid"] = $app->user->wpid; $person = new TrainingTracker\Staff($current_user_parameter); $person->privileges = TrainingTracker::get_user_level($person->wpid); $staff[0] = $person; } foreach ($staff as $person) { $pidm = $person->person()->pidm; $person->merit = TrainingTracker::merit_get($pidm); $person->demerit = TrainingTracker::demerit_get($pidm); $type = TrainingTracker::checklist_type($person->privileges); if (!TrainingTracker::checklist_exists($pidm, $type, 0)) { //get tybe based off of a persons privileges $type = TrainingTracker::checklist_type($person->privileges); //insert new checklist (pidm, type) TrainingTracker::checklist_insert($pidm, $type); } }