function handleImportFromSIS() { global $classID, $className, $classes, $configFolderName, $dbConnection; global $session, $department, $courseNo, $sectionNo, $season, $yteststudent_hashed_id; global $command, $commandState, $DEPLOYMENT_NAME; global $allowedCourseCode; // get the command itself $command = Commands::ImportFromSIS; // get the state of the command if (array_key_exists("execute", $_POST)) { $commandState = CommandStates::Execute; } else { if (array_key_exists("previewThenExecute", $_POST)) { $commandState = CommandStates::PreviewThenExecute; } else { $commandState = CommandStates::Preview; } } printOutputPageHeading($commandState); if (array_key_exists('session', $_POST) && array_key_exists('season', $_POST)) { $session = $_POST['session']; $season = $_POST['season']; populateCourseInfoFromPOST(); printCourseInfo($commandState, $className, $configFolderName, $session, $department, $courseNo, $sectionNo, $season); $canQueryFromSIS = true; if (!in_array("EVERY", $allowedCourseCode)) { if (!in_array($department, $allowedCourseCode)) { $canQueryFromSIS = false; } } if (in_array("NONE", $allowedCourseCode)) { $canQueryFromSIS = false; } if ($canQueryFromSIS) { // print "Debug Information: params from interface: $department, $courseNo, $sectionNo<br/><br/>"; updateClassEnrollment($classID, $dbConnection, $command, $commandState); } else { print "<br/><span style=\"color:red;font-weight:bold\">\r\n\t\t\t\tFATAL ERROR! This deployment of OVAL - '" . strtoupper($DEPLOYMENT_NAME) . "' - may not query SIS for the course code '{$department}'.<br/>\r\n\t\t\t\tIf this course code does belong to your department and we missed it during initial setup, please email \r\n\t\t\t\t\t<a href='mailto:arts.helpdesk@ubc.ca'>arts.helpdesk@ubc.ca</a>\r\n\t\t\t\t</span>\r\n\t\t\t\t<br/>"; } } else { print "<br/><span style=\"color:red;font-weight:bold\">\r\n\t\t\t\tFATAL ERROR! SessionYear and Season parameters missing. You have found a bug.<br/>\r\n\t\t\t\tPlease email thomas.dang@ubc.ca with as much info as possible of the context when this error appears.<br/> \r\n\t\t\t\t</span>\r\n\t\t\t\t<br/>"; } printOutputPageFooting($commandState, $className); }
curl_setopt($ch, CURLOPT_POST, 0); $output = curl_exec($ch); // checks to see if the user successfully logged in if (stripos($output, 'login_form') != 0) { print "Sorry, an error has occurred. Please re-enter your login information."; exit; } print "Unavailable!"; // FIX this! Low priority! exit; // course information $output = substring($output, "<div id=\"content\">", "<div id=\"footer\">"); $courseInfo = substring($output, "<table width=100% border=0 cellpadding=1 cellspacing=1>", "<!-- Display ONLY if not EMBA -->"); $courseInfo = substring($courseInfo, "<table>", "</table>"); $fCourseInfo = validateHTML($courseInfo); printCourseInfo($fCourseInfo); // grades information $str = "<!-- Display ONLY if not EMBA -->"; $gradesInfo = substr($output, stripos($output, $str) + strlen($str)); $fGradesInfo = validateHTML(substring($gradesInfo, "<table border=0 cellpadding=1 cellspacing=1>", $str)); $fGradesInfo = substring($fGradesInfo, "<table>", "</table>"); printGradesInfo($fGradesInfo); // detailed information $detailed = substring($gradesInfo, "<table border=0 cellpadding=1 cellspacing=0>", "<p><br>"); $detailed = substring($detailed, "<table>", "</table>"); $fDetailed = validateHTML($detailed); printDetailed($fDetailed); curl_close($ch); function printCourseInfo($xmlString) { $xml = new SimpleXMLELement($xmlString);