Example #1
0
                $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');
});
Example #2
0
<?php

//teams creation page
respond(function ($request, $response, $app) {
});
respond('GET', '/builder', function ($request, $response, $app) {
    if (!$app->is_admin) {
        die('You do not have access to this page.');
    }
    $wpid = $app->user->wpid;
    $staff_collection = new TrainingTracker\StaffCollection();
    $staff_collection->load();
    //getting all the mentors and mentees at the help desk.
    $mentors = $staff_collection->mentors();
    $mentees = $staff_collection->mentees();
    foreach ($mentees as $mentee) {
        $teams = $mentee->team();
    }
    $teams = json_encode($teams);
    // die;
    // TODO: no you.
    $app->tpl->assign('teams', $teams);
    $app->tpl->assign('mentees', $mentees);
    $app->tpl->assign('mentors', $mentors);
    $app->tpl->display('teams.tpl');
    //go go gadget show page
});
respond('GET', '/list', function ($request, $responce, $app) {
    $teams_array = TrainingTracker::get_teams();
    $app->tpl->assign('teams_array', $teams_array);
    $app->tpl->display('viewteams.tpl');
Example #3
0
    $app->is_mentor = $is_mentor;
    // initialize the template
    $app->tpl = new PSUTemplate();
    // assign user to template
    $app->tpl->assign('active_user', $active_user);
    $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