public function show_verify_assignment() { PHPWS_Core::initModClass('hms', 'HMS_Term.php'); PHPWS_Core::initModClass('hms', 'HMS_SOAP.php'); PHPWS_Core::initModClass('hms', 'HMS_Assignment.php'); PHPWS_Core::initModClass('hms', 'HMS_Learning_Community.php'); PHPWS_Core::initModClass('hms', 'HMS_RLC_Assignment.php'); PHPWS_Core::initModClass('hms', 'HMS_Movein_Time.php'); $tpl = array(); $assignment = HMS_Assignment::get_assignment($_SESSION['asu_username'], $_SESSION['application_term']); if ($assignment === NULL || $assignment == FALSE) { $tpl['NO_ASSIGNMENT'] = "You do not currently have a housing assignment."; } else { $tpl['ASSIGNMENT'] = $assignment->where_am_i() . '<br />'; # Determine the student's type and figure out their movein time $type = HMS_SOAP::get_student_type($_SESSION['asu_username'], $_SESSION['application_term']); if ($type == TYPE_CONTINUING) { $movein_time_id = $assignment->get_rt_movein_time_id(); } elseif ($type == TYPE_TRANFER) { $movein_time_id = $assignment->get_t_movein_time_id(); } else { $movein_time_id = $assignment->get_f_movein_time_id(); } if ($movein_time_id == NULL) { $tpl['MOVE_IN_TIME'] = 'To be determined<br />'; } else { $movein_times = HMS_Movein_Time::get_movein_times_array($_SESSION['application_term']); $tpl['MOVE_IN_TIME'] = $movein_times[$movein_time_id]; } } //get the assignees to the room that the bed that the assignment is in $assignees = !is_null($assignment) ? $assignment->get_parent()->get_parent()->get_assignees() : NULL; $roommates = array(); if (!is_null($assignees)) { foreach ($assignees as $roommate) { if ($roommate->asu_username != $_SESSION['asu_username']) { $roommates[] = $roommate->asu_username; } } } if (empty($roommates)) { $tpl['roommate'][]['ROOMMATE'] = 'You do not have a roommate.'; } else { foreach ($roommates as $roommate) { $tpl['roommate'][]['ROOMMATE'] = '' . HMS_SOAP::get_name($roommate) . ' (<a href="mailto:' . $roommate . '@appstate.edu">' . $roommate . '@appstate.edu</a>)'; } } $rlc_assignment = HMS_RLC_Assignment::check_for_assignment($_SESSION['asu_username'], $_SESSION['application_term']); if ($rlc_assignment == NULL || $rlc_assignment === FALSE) { $tpl['RLC'] = "You have not been accepted to an RLC."; } else { $rlc_list = HMS_Learning_Community::getRlcList(); $tpl['RLC'] = 'You have been assigned to the ' . $rlc_list[$rlc_assignment['rlc_id']]; } $tpl['MENU_LINK'] = PHPWS_Text::secureLink('Back to Main Menu', 'hms', array('type' => 'student', 'op' => 'show_main_menu')); return PHPWS_Template::process($tpl, 'hms', 'student/verify_assignment.tpl'); }
/** * Exports the completed RLC assignments. */ public function rlc_assignment_export() { if (!Current_User::allow('hms', 'view_rlc_applications')) { $tpl = array(); return PHPWS_Template::process($tpl, 'hms', 'admin/permission_denied.tpl'); } $db = new PHPWS_DB('hms_learning_communities'); $db->addColumn('community_name'); $db->addWhere('id', $_REQUEST['rlc_list']); $title = $db->select('one'); $filename = $title . '-assignments-' . date('Ymd') . ".csv"; // setup the title and headings $buffer = $title . "\n"; $buffer .= '"last_name","first_name","middle_name","gender","email"' . "\n"; // get the list of assignments $db = new PHPWS_DB('hms_learning_community_assignment'); $db->addColumn('user_id'); $db->addWhere('hms_learning_community_assignment.rlc_id', $_REQUEST['rlc_list']); # select assignments only for the given RLC $users = $db->select(); foreach ($users as $user) { $sinfo = HMS_SOAP::get_student_info($user['user_id']); $buffer .= '"' . $sinfo->last_name . '",'; $buffer .= '"' . $sinfo->first_name . '",'; $buffer .= '"' . $sinfo->middle_name . '",'; $buffer .= '"' . $sinfo->gender . '",'; $buffer .= '"' . $user['user_id'] . '@appstate.edu' . '"' . "\n"; } //Download file if (ob_get_contents()) { print 'Some data has already been output, can\'t send file'; } if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { header('Content-Type: application/force-download'); } else { header('Content-Type: application/octet-stream'); } if (headers_sent()) { print 'Some data has already been output to browser, can\'t send file'; } header('Content-Length: ' . strlen($buffer)); header('Content-disposition: attachment; filename="' . $filename . '"'); echo $buffer; die; }
# Connect to the database pg_connect("") or die("Could not connect to database... " . pg_last_error($db) . "\n"); # Foreach username, lookup their application and try to report it to banner foreach ($usernames as $username) { echo "Looking up application for: {$username}..."; $result = pg_query("SELECT * from hms_application WHERE hms_student_id ILIKE '{$username}' AND term=" . CURR_TERM); if (!$result) { echo "\nAn error occured looking up appliction for {$username}: " . pg_last_error($db) . "\n"; exit; } if (sizeof($result) > 1) { echo "Multiple applications returned, skipping.\n"; continue; } if (sizeof($result) <= 0) { echo "No application found, skipping.\n"; continue; } # Get the application from the database $row = pg_fetch_assoc($result); # Actually try to report it to Banner $plan_meal = HMS_SOAP::get_plan_meal_codes($username, 'BLAH_DORM', $row['meal_option']); $banner_result = HMS_SOAP::report_application_received($username, CURR_TERM, $plan_meal['plan'], $plan_meal['meal']); if ($banner_result !== 0) { print_r($banner_result); echo "Banner error: {$banner_result}\n"; } else { echo "Reported.\n"; } } pg_close($db);