public function team_delete($mentee)
 {
     $memcache = new \PSUMemcache('training-tracker_teams');
     $memcache->delete("teams");
     $memcache->delete("teams-all-{$mentee}");
     $memcache->delete("teams-{$mentee}");
     $sql = "DELETE FROM teams WHERE mentee = ?";
     $result3 = PSU::db('hr')->Execute($sql, array($mentee));
 }
Esempio n. 2
0
if (file_exists($GLOBALS['BASE_DIR'] . '/debug.php')) {
    include $GLOBALS['BASE_DIR'] . '/debug.php';
}
includes_psu_register('TrainingTracker', $GLOBALS['BASE_DIR'] . '/includes');
require_once 'klein/klein.php';
require_once $GLOBALS['BASE_DIR'] . '/includes/TrainingTrackerAPI.class.php';
IDMObject::authN();
/**
 * Routing provided by klein.php (https://github.com/chriso/klein.php)
 * Make some objects available elsewhere.
 */
//Catch all
respond(function ($request, $response, $app) {
    // get the logged in user
    $app->user = PSUPerson::get($_SESSION['wp_id']);
    $memcache = new \PSUMemcache('training-tracker_teams');
    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.');
        }