$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!"; $response->redirect($redirect, 400); } elseif ($app->gate_system->level_code == 'gr' && !$person->student->gr) { $_SESSION['errors'][] = "{$person->formatName('l, f m')} is not an active GR student!"; $response->redirect($redirect, 400); } //end if $student = new TeacherCert\Student($person->pidm); $in_system = false; if (!$student->gate_systems($app->gate_system)) { $data = array('the_id' => 9999, 'pidm' => $person->pidm, 'gate_system_id' => $app->gate_system->id, 'approve_date' => time()); $system = new TeacherCert\Student\GateSystem($data); if ($system->save()) { $_SESSION['successes'][] = "{$person->formatName('l, f m')} has been added to the {$app->gate_system->name} Gate System!"; } else { $_SESSION['errors'][] = "{$person->formatName('l, f m')} could not be added to the {$app->gate_system->name} Gate System. Please contact ITS."; } //end else } else { $_SESSION['errors'][] = "{$person->formatName('l, f m')} is already a member of the {$app->gate_system->name} Gate System."; } //end else $response->redirect($redirect);
public function create($row) { $user = TeacherCert\Student::get($row); return $user; }