/** * Create new record for this student in the database. */ public static function createStudent($pidm, $term) { list($address) = $GLOBALS['BannerStudent']->getAddress($pidm, 'MA'); if (count($address) > 0) { $addr1 = $address['r_street_line1']; $addr2 = $address['r_street_line2']; $city = $address['r_city']; $state = $address['r_stat_code']; $zip = $address['r_zip']; } else { // no main address, use blanks $addr1 = ''; $addr2 = ''; $city = ''; $state = ''; $zip = ''; } unset($address); $data = array('pidm' => $pidm, 'term' => $term, 'confirmed' => -1, 'confirmed_cert' => -1, 'name' => $_SESSION['student']['full_name'], 'name_first' => $_SESSION['student']['first_name'], 'name_middle' => $_SESSION['student']['middle_name'], 'name_last' => $_SESSION['student']['last_name'], 'addr1' => $addr1, 'addr1' => $addr1, 'city' => $city, 'state' => $state, 'zip' => $zip); $t = 'academic_excellence'; $sql = PSU::db('myplymouth')->GetInsertSQL($t, $data); $result = PSU::db('myplymouth')->Execute($sql); if ($result === false) { return false; } return AEStudent::getStudentData($pidm, $term); }
/** * initializeSession * * Set up necessary session variables. */ function initializeSession() { if (!isset($_SESSION['errors'])) { $_SESSION['errors'] = array(); } if (!isset($_SESSION['messages'])) { $_SESSION['messages'] = array(); } $_SESSION['student'] = array(); $_SESSION['user_type'] = null; $_SESSION['editing'] = true; // first time through means we're editing $_SESSION['ae_init'] = true; $_SESSION['pidm'] = $GLOBALS['BannerIDM']->getIdentifier($_SESSION['username'], 'username', 'pidm'); if (IDMObject::authZ('permission', 'academic_excellence_admin')) { $_SESSION['user_type'] = 'admin'; } else { $gpa = $GLOBALS['BannerStudent']->getOverallGPA($_SESSION['pidm']); $_SESSION['gpa'] = $gpa['r_gpa']; unset($gpa); if ($_SESSION['username'] == 'ambackstrom') { $_SESSION['gpa'] = 3.5; // DEBUG: always let student through } // they're 'aestudent' only if their gpa qualifies if ($_SESSION['gpa'] < 3.5) { return; } $_SESSION['user_type'] = 'aestudent'; $name = $GLOBALS['BannerStudent']->getName($_SESSION['pidm']); $_SESSION['student']['full_name'] = sprintf('%s %s %s', $name['r_first_name'], $name['r_mi'], $name['r_last_name']); $_SESSION['student']['first_name'] = $name['r_first_name']; $_SESSION['student']['middle_name'] = $name['r_mi']; $_SESSION['student']['last_name'] = $name['r_last_name']; unset($name); $student = AEStudent::getStudentData($_SESSION['pidm'], $GLOBALS['TERM']); $_SESSION['student'] = array_merge($_SESSION['student'], $student); // (confirmed != -1) means that they have already submitted the form in a previous session if ($student['confirmed'] > -1) { $_SESSION['editing'] = false; } } }