Beispiel #1
0
                $level = TrainingTracker::level_translation($current_user_level);
                $pay = TrainingTracker::pay_translation($current_user_level);
                TrainingTracker::mail($pay, $level, $people);
            }
        }
    }
    $responce->redirect('/webapp/training-tracker/');
});
//promote/demote ajax page
respond('POST', '/fate', function ($request, $response, $app) {
    $permission = $request->data['permission'];
    $wpid = $request->data['wpid'];
    if ($permission == 'supervisor' || $permission == 'shift_leader' || $permission == 'sta' || $permission == 'trainee') {
        if (TrainingTracker::valid_wpid($wpid)) {
            $pidm = PSUPerson::get($wpid)->pidm;
            $type = TrainingTracker::checklist_type($permission);
            TrainingTracker::set_user_level($wpid, $permission);
            if (!TrainingTracker::checklist_exists($pidm, $type, 1)) {
                TrainingTracker::checklist_close($pidm);
                TrainingTracker::checklist_insert($pidm, $type);
            } else {
                TrainingTracker::checklist_close($pidm);
                TrainingTracker::checklist_open($pidm, $type);
            }
        }
    }
});
//admin page
respond('GET', '/fate', function ($request, $response, $app) {
    if (!$app->is_admin) {
        die('You do not have access to this page.');
 public function checklist_builder($user_level, $wpid)
 {
     $type = TrainingTracker::checklist_type($user_level);
     $sql = "SELECT items.* \n\t\t\t\t\t\t  FROM checklist_items items \n\t\t\t\t\t\t  JOIN checklist_item_categories categories \n\t\t\t\t\t\t    ON items.category_id = categories.id \n\t\t\t\t\t\t WHERE categories.type=?";
     $checklist_builder['items'] = PSU::db('hr')->GetAll($sql, array($type));
     $checklist_id = TrainingTracker::get_checklist_id($wpid);
     $sql = "SELECT * FROM person_checklist_items WHERE checklist_id=? AND response=?";
     $checklist_checked = PSU::db('hr')->GetAll($sql, array($checklist_id, "complete"));
     $items = array();
     foreach ($checklist_checked as $checked) {
         if ($checked['response'] == "complete") {
             $item_id = $checked['item_id'];
             $items["{$item_id}"] = $item_id;
         }
     }
     foreach ($checklist_builder['items'] as &$item) {
         $id = $item['id'];
         if (isset($items["{$id}"])) {
             $item['checked'] = true;
         } else {
             $item['checked'] = false;
         }
     }
     $sql = "SELECT * FROM checklist_item_categories WHERE type=?";
     $checklist_builder['sub_cat'] = PSU::db('hr')->GetAll($sql, array($type));
     $sql = "SELECT * FROM checklist WHERE type=?";
     $checklist_builder['category'] = PSU::db('hr')->GetAll($sql, array($type));
     return $checklist_builder;
 }
Beispiel #3
0
    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']);