Beispiel #1
0
    $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'];
        }
        $last_modified_info = TrainingTracker::last_modified($checklist_id);
        $last_modified = $last_modified_info['time'];
        $modified_by = $last_modified_info['modified_by'];
    }
    //the title is the title name in the box.