//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 (!($cached_results = $memcache->get('is_admin'))) { $staff_collection = new TrainingTracker\StaffCollection(); $staff_collection->load(); $valid_users = $staff_collection->valid_users(); $is_valid = false; $is_mentor = false; $is_admin = false; foreach ($valid_users as $user) { if ($app->user->wpid == $user->wpid) { $is_valid = true; } } if (!$is_valid) { die('You do not have access to this app.'); } $teams_data = TrainingTracker::get_teams(); $has_team = false; $wpid = $app->user->wpid; if (isset($teams_data["{$wpid}"])) { $has_team = true; } $admins = $staff_collection->admins(); $mentors = $staff_collection->mentors(); foreach ($admins as $admin) { if ($app->user->wpid == $admin->wpid) { $is_admin = true; $is_mentor = true; } } if (!$is_mentor) { foreach ($mentors as $mentor) {