コード例 #1
0
/**
 * teacher-cert/gate-system/*
 */
use PSU\TeacherCert\Student\GateSystem as StudentGateSystem, PSU\Student\Test, PSU\TeacherCert;
respond('/[:gate_system]/?[*]?', function ($request, $response, $app) {
    $gate_system_id = $request->param('gate_system');
    $app->populate(new TeacherCert\GateSystem($gate_system_id));
    $app->breadcrumbs->push(new \PSU\Template\Breadcrumb($app->gate_system->name, $app->resolver($app->gate_system)));
});
respond('/[:gate_system]/?', function ($request, $response, $app) {
    $app->tpl->display('gate-system.tpl');
});
respond('/[:gate_system]/gate/[:gate]/?[*]?', function ($request, $response, $app) {
    $gate_id = $request->param('gate');
    $gate = TeacherCert\Gate::get($gate_id);
    $app->populate('gate', $gate);
    $app->breadcrumbs->push($app->gate->name);
    $app->tpl->display('gate.tpl');
});
respond('POST', '/[:gate_system](/gate/[:gate])?/add-student/?', function ($request, $response, $app) {
    $response->deny_to_readonly();
    $student_id = $request->param('student_id');
    $person = \PSUPerson::get($student_id);
    $redirect = $GLOBALS['BASE_URL'] . '/gate-system/' . $app->gate_system->slug;
    if ($gate) {
        $redirect .= '/gate/' . $gate->slug;
    }
    //end if
    if ($app->gate_system->level_code == 'ug' && !$person->student->ug) {
        $_SESSION['errors'][] = "{$person->formatName('l, f m')} is not an active UG student!";