error_reporting(E_ALL); $args = array('term' => '', 'input_file' => '', 'output_file' => ''); $switches = array(); check_args($argc, $argv, $args, $switches); $term = $args['term']; // Get an instance of SOAP $soap = new PhpSOAP(); // Open input and output files //$students = fopen($args['input_file'], 'r'); $csvout = fopen($args['output_file'], 'w'); fputcsv($csvout, array('Banner ID', 'Honors?'), ','); // pull list of Banner IDs from input file into an array $bannerIds = file($args['input_file']); foreach ($bannerIds as $id) { $banId = trim($id); $student = null; try { $username = $soap->getUsername($banId); $student = $soap->getStudentInfo($username, $term); } catch (Exception $e) { echo "Missing student: {$banId}!!!!!\n"; continue; } if ($student->honors == 1) { $honors = "yes"; } else { $honors = "no"; } fputcsv($csvout, array($banId, $honors), ','); } fclose($csvout);
require_once '../db_config.php.inc'; $args = array('output_file' => '', 'term' => ''); $switches = array(); check_args($argc, $argv, $args, $switches); $soap = new PhpSOAP(); $csvout = fopen($args['output_file'], 'w'); # Header line $line = array('User Name', 'Banner Id', 'Residence Hall', 'Room Number', 'Assignment Term', 'Application Term', 'Class'); fputcsv($csvout, $line, ','); $db = pg_connect("host={$host} dbname={$database} user={$dbuser} password={$dbpasswd}"); $sql = "SELECT asu_username, hall_name, room_number, hms_assignment.term FROM hms_assignment JOIN hms_bed ON hms_assignment.bed_id = hms_bed.id JOIN hms_room ON hms_bed.room_id = hms_room.id JOIN hms_floor ON hms_room.floor_id = hms_floor.id JOIN hms_residence_hall ON hms_floor.residence_hall_id = hms_residence_hall.id WHERE hms_assignment.term = {$args['term']} ORDER BY banner_building_code"; $result = pg_query($sql); while ($row = pg_fetch_assoc($result)) { echo "Getting soap date for: {$row['asu_username']}\n"; try { $student = $soap->getStudentInfo($row['asu_username'], $row['term']); $class = $student->projected_class; if (empty($class) || is_null($class)) { $class = 'unknown'; } $applicationTerm = $student->application_term; if (empty($applicationTerm) || is_null($applicationTerm)) { $applicationTerm = 'unknown'; } if ($student->honors == '1') { $line = array($row['asu_username'], $student->banner_id, $row['hall_name'], $row['room_number'], $row['term'], $applicationTerm, $class); fputcsv($csvout, $line, ','); } } catch (Exception $e) { echo "Unknown student!!!!!!!\n"; echo "{$e}\n";
#!/usr/bin/php <?php /* * Gets a list of all the new freshmen housing applications that are withdrawn, then double checks the student type of all those students. * This double-checks that we don't accidentally withrawn an application for a student who's not really withdrawn. */ require_once 'SOAP.php'; require_once 'cliCommon.php'; require_once '../db_config.php.inc'; $args = array('term' => ''); $switches = array(); check_args($argc, $argv, $args, $switches); $soap = new PhpSOAP(); $db = pg_connect("host={$host} dbname={$database} user={$dbuser} password={$dbpasswd}"); $sql = "select username from hms_new_application where term = {$args['term']} and (withdrawn = 1 OR student_type = 'W') and application_type = 'fall'"; $result = pg_query($sql); while ($row = pg_fetch_assoc($result)) { echo "Checking {$row['username']}: "; try { $soapResult = $soap->getStudentInfo($row['username'], $args['term']); if ($soapResult->student_type != 'W') { echo "Application withdrawn but student type is not W!!!!!!!!!!!1\n"; } else { echo "\n"; } } catch (Exception $e) { echo "Unknown student. Ahh!!!\n"; } }