public function merit_update($checklist_id_old, $pidm) { $checklist_id_current = TrainingTracker::get_checklist_id($pidm); $sql = "UPDATE person_checklist_items SET checklist_id = ? WHERE (checklist_id = ? AND response = ?) OR (checklist_id = ? AND response = ?)"; $updated = PSU::db('hr')->Execute($sql, array($checklist_id_current, $checklist_id_old, 'merit', $checklist_id_old, 'demerit')); }
$user_type = TrainingTracker::level_translation(TrainingTracker::get_user_level($wpid)); TrainingTracker::checklist_insert($wpid, $user_type); $checklist_id = TrainingTracker::get_checklist_id($wpid); } if ($type == 'star') { $type = 'merit'; } else { $type = 'demerit'; } $updated_by = $app->user->pidm; $item_id = 42; TrainingTracker::merit_insert($item_id, $checklist_id, $type, $comments, $updated_by); $last_insert_id = TrainingTracker::last_insert_id(); $data = array('id' => $last_insert_id); // echoed for ajax to pickup and use. echo json_encode($data); } } }); respond('GET', '/merit', function ($request, $responce, $app) { $staff_collection = new TrainingTracker\StaffCollection(); $staff_collection->load(); $staff = $staff_collection->merit_users(); foreach ($staff as $person) { $merits[$person->wpid]['merits'] = TrainingTracker::merit_get($person->wpid); $merits[$person->wpid]['demerits'] = TrainingTracker::demerit_get($person->wpid); } $app->tpl->assign('merits', $merits); $app->tpl->assign('staff', $staff); $app->tpl->display('merit.tpl'); });
//if you move the mentee back to the mentee category in the team builder, it removes their database entry. TrainingTracker::team_delete($mentee_wpid); } } } }); //view teams respond('GET', '/list/[:wpid]', function ($request, $responce, $app) { if (!$app->is_mentor) { $responce->redirect('../list'); } $wpid = $request->wpid; if (!TrainingTracker::valid_wpid($wpid)) { $responce->redirect('../list'); } $teams = TrainingTracker::get_teams(); if (isset($teams["{$wpid}"])) { $my_team = $teams["{$wpid}"]; unset($my_team['mentor']); foreach ($my_team as &$member) { if (isset($member['name'])) { $current_user_parameter['wpid'] = $member['wpid']; $current_user = new TrainingTracker\Staff($current_user_parameter); $member = $current_user; } } } else { $my_team['mentor']['name'] = 'Loner'; $my_team['mentor']['wpid'] = 'F4ilure'; $my_team['loner']['name'] = 'You have no team =('; $my_team['loner']['wpid'] = 'loner.jpg';
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); } } $app->tpl->assign('staff', $staff); $app->tpl->display('index.tpl'); }); $app_routes = array('staff', 'team'); foreach ($app_routes as $base) { with("/{$base}", $GLOBALS['BASE_DIR'] . "/routes/{$base}.php"); } //end foreach dispatch($_SERVER['PATH_INFO']);