\n" ); //$building = "ABB"; }else { $building = $_REQUEST['building']; } $date = date("F j, Y" ); echo << Safety Sheets: $building

Doorway Safety Sheets
for $building

END; echo "Back to Main Page\n"; // read in link information from departmental directories $rootpath = "/1/upload/Safety/dept/"; //echo "$rootpath
\n"; // debug $links = ""; // init if ( ($safetydir = opendir( $rootpath )) !== false ) { while( $infodirs = readdir($safetydir) ) { if( !preg_match( "/\./", $infodirs) ) { if( ($deptdir = opendir( $rootpath . $infodirs )) !== false ) { while( $infofiles = readdir($deptdir)) { if( preg_match( "/\.info$/", $infofiles ) && !preg_match( "/[\._]bak/", $infofiles ) ) // && !preg_match( "/[\._]bak/", $infofiles ) { //echo "$infofiles
\n"; // debug $location = preg_split( "/\./", $infofiles); $thisbldgroom = preg_split("/_/", $location[0]); if( $thisbldgroom[0] == $building ) { $links .= "{$thisbldgroom[1]}&$infodirs--"; //echo "link: {$thisbldgroom[1]}&$infodirs
\n"; // debug } } } } closedir($deptdir); } } closedir($safetydir); }else { echo "Can't find safety directories.
\n"; } //echo "
$links

\n"; // debug # department information next... # $departmenthtml constructed above # from current department $floors = array("Basement", "First Floor", "Second Floor", "Third Floor", "Fourth Floor"); $floornum = array("B", "1", "2", "3", "4"); /* # Now print constructed form contained in $_ # Print the header print "Content-type: text/html\n\n"; print "$_"; &printheader; */ # write body of html print "\n\n"; # start of outer html list of buildings echo "\n"; # end of row and table echo "\n
\n

" . $building . "

\n\n"; # step through floors for ($count=0; $count<5; $count++ ) # start of innner html list { echo "
" . $floors[$count] . "\n\t
    \n"; //chop($links{$bldgs}); $rooms = preg_split( "/--/", $links); sort($rooms); # cycle through all rooms for this building foreach( $rooms as $sortedrooms ) # floor is indicated by first character of room { $thisfloor = strtoupper(substr($sortedrooms, 0, 1)); if($thisfloor == $floornum[$count]) # is it on this floor { $locationdept = preg_split("/&/", $sortedrooms ); $sortlocation = strtoupper($building . '_' . $locationdept[0]); $dept = ucwords(preg_replace( "/_/", " ", $dept)); $room = strtoupper($locationdept[0]); # construct link filename $pdflinkname = "http://sirius.physics.mcmaster.ca/php4_scripts/safety/SafetySheet1.php4?location=$sortlocation"; $reviselinkname = "http://www.physics.mcmaster.ca/safety/genform.php4?getbuilding=$building&getroom=$room"; $decoderoom = preg_replace( "/\%SLASH\%/", "/", $room ); $href = "$decoderoom-revise, pdf"; $href .= "" . ': ' . $dept; echo "\t
  • " . $href . "
  • \n"; } } # end of room list for this floor echo "\t
\n"; } # end of floor list for this building echo "
\n"; echo "Back to Main Page\n"; ?>