query( "Select * from schools order by Institution" ); $ar = array(); while($row = mysql_fetch_object($Result)) { $c = new School(); $c->buildFromRow($row); $ar[] = $c; } return $ar; } function getSchool($id) { $c = new School(); $c->buildFromID($id); return $c; } function getDegrees($id) { $db = new db(); $d = array(); $Result = $db->query( "Select s.LevelOfAward, e.SOCTitle from schools_cip s, careers_edulevel e where s.id = '$id' and s.Cip = e.chipid" ); while($row = mysql_fetch_object($Result)) { $d[] = $row->LevelOfAward." in ".$row->SOCTitle; } return $d; } function getRange($var) { $db = new db(); $rtn = array(); $sql = ""; switch( $var ) { case "InState": $sql = "Select max(UnderIn) as max, min(UnderIn) as min from schools_charges"; break; case "OutState": $sql = "Select max(UnderOut) as max, min(UnderOut) as min from schools_charges"; break; case "RoomBoard": $sql = "Select max(RoomBoard) as max, min(RoomBoard) as min from schools_charges"; break; case "FullTime": $sql = "Select max(UnderFull) as max, min(UnderFull) as min from schools_enrollments"; break; case "PartTime": $sql = "Select max(UnderPart) as max, min(UnderPart) as min from schools_enrollments"; break; case "FTF": $sql = "Select max(Total) as max, min(Total) as min from schools_RFTF"; break; case "TotalSize": $sql = "Select max(UnderFull+UnderPart+ProFull+ProPart+GradFull+GradPart) as max, min(UnderFull+UnderPart+ProFull+ProPart+GradFull+GradPart) as min from schools_enrollments"; break; case "Administrative": $sql = "Select max(Admin) as max, min(Admin) as min from schools_staff"; break; case "Faculty": $sql = "Select max(Faculty) as max, min(Faculty) as min from schools_staff"; break; } if($sql == "") return; $Result = $db->query($sql); if( $var == "TrainingLevel" ) { while($row = mysql_fetch_object($Result)) { $rtn[] = $row->EdLevel; } } else { if($row = mysql_fetch_object($Result)) { $rtn[] = $row->min; $rtn[] = $row->max; } } return $rtn; } function getSchoolForCareer($c) { $c = substr($c, 0, strpos($c, '.')); $sql = "SELECT DISTINCT schools_cip.id FROM schools_cip, careers_edulevel WHERE cip = chipid and careers_edulevel.id = '$c'"; $db = new db(); $rtn = array(); $Result = $db->query($sql); while($row = mysql_fetch_object($Result)) { $rtn[] = $row->id; } return $rtn; } } // $c = new test_schools(); // $schools = $c->getSchools(); // // Your Google Maps API key // $key = "ABQIAAAAP99m7zNOiIwbXcX93d08fBSM9dkJPoo4Q18ePeszHskSzLs0khSMnwMedcg2ZkIf6_Qflbi4hXgs1w"; // $db = new db(); // foreach( $schools as $s) // { // if( $s->latitude == 0) // { // $address = $s->Address1 . " ". // $s->Address2 . " ". // $s->City. " ". // $s->State. " ". // $s->Zip; // $address = urlencode($address); // // Desired address // $address = "http://maps.google.com/maps/geo?q=$address&output=xml&key=$key"; // // Retrieve the URL contents // $page = file_get_contents($address); // // Parse the returned XML file // $xml = new SimpleXMLElement($page); // list($longitude, $latitude, $altitude) = explode(",", // $xml->Response->Placemark->Point->coordinates); // $sql = "Update schools set latitude = $latitude, longitude = $longitude where id = $s->id"; // echo $sql; // $Result = $db->query($sql); // } // } ?>