2010-06-15 16:57:50 +00:00
< ? php
require_once ( 'common.inc.php' );
require_once ( 'user.inc.php' );
2010-10-14 19:42:20 +00:00
user_auth_required ( " teacher " );
$schoolid = user_field_required ( " schools_id " , " user_edit.php?tab=school " );
2010-06-15 16:57:50 +00:00
2010-10-14 19:42:20 +00:00
send_header ( " School Details " );
if ( $_POST [ 'action' ] == " save " ) {
// load the school info so we know which one we're saving
$q = mysql_query ( " SELECT * FROM schools WHERE id=' $schoolid ' " );
2010-06-15 16:57:50 +00:00
$school = mysql_fetch_object ( $q );
2010-10-14 19:42:20 +00:00
mysql_query ( " UPDATE schools SET
school = '".mysql_real_escape_string($_POST[' school '])."' ,
address = '".mysql_real_escape_string($_POST[' address '])."' ,
city = '".mysql_real_escape_string($_POST[' city '])."' ,
province_code = '".mysql_real_escape_string($_POST[' province_code '])."' ,
postalcode = '".mysql_real_escape_string($_POST[' postalcode '])."' ,
phone = '".mysql_real_escape_string($_POST[' phone '])."' ,
fax = '".mysql_real_escape_string($_POST[' fax '])."'
WHERE id = '$school->id' " );
2010-06-15 16:57:50 +00:00
2010-10-14 19:42:20 +00:00
echo mysql_error ();
if ( mysql_error ())
echo error ( i18n ( " An Error occured trying to save the school information " ));
else
echo happy ( i18n ( " School information successfully updated " ));
2010-06-15 16:57:50 +00:00
}
// load the school info
2010-10-14 19:42:20 +00:00
$q = mysql_query ( " SELECT * FROM schools WHERE id=' $schoolid ' " );
2010-06-15 16:57:50 +00:00
$school = mysql_fetch_object ( $q );
draw_page ();
send_footer ();
function draw_page (){
global $config , $school , $sh_email , $sh_email , $sh ;
2011-03-02 05:25:31 +00:00
echo i18n ( " Please note, as a teacher you are editing the MASTER RECORD for %1. If you have switched schools you should switch your school under your account profile. Only edit the information below if the details for the school have changed. " , array ( $school -> school ));
echo " <br /> " ;
echo " <br /> " ;
echo " <h2> $school->school </h2> " ;
2010-06-15 16:57:50 +00:00
2010-10-14 19:42:20 +00:00
echo " <form method= \" post \" action= \" schoolinfo.php \" > " ;
echo " <input type= \" hidden \" name= \" action \" value= \" save \" > " ;
2010-06-15 16:57:50 +00:00
echo " <table border=0 cellspacing=0 cellpadding=3> " ;
2010-10-14 19:42:20 +00:00
echo " <tr><td> " . i18n ( " School Name " ) . " </td><td><input value= \" $school->school\ " type = \ " text \" name= \" school \" size= \" 40 \" ></td></tr> " ;
2010-06-15 16:57:50 +00:00
// echo "<tr><td>Registration Password</td><td><input value=\"$school->registration_password\" type=text name=\"registration_password\" size=\"20\"></td></tr>";
echo " <tr><td> " . i18n ( " Address " ) . " </td><td><input value= \" $school->address\ " type = text name = address size = 40 ></ td ></ tr > " ;
echo " <tr><td> " . i18n ( " City " ) . " </td><td><input value= \" $school->city\ " type = text name = city size = 30 ></ td ></ tr > " ;
echo " <tr><td> " . i18n ( $config [ 'provincestate' ]) . " </td><td> " ;
emit_province_selector ( " province_code " , $school -> province_code );
echo " </td></tr> \n " ;
echo " <tr><td> " . i18n ( $config [ 'postalzip' ]) . " </td><td><input value= \" $school->postalcode\ " type = text name = postalcode size = 10 ></ td ></ tr > " ;
echo " <tr><td> " . i18n ( " Phone Number " ) . " </td><td><input value= \" $school->phone\ " type = text name = phone size = 30 ></ td ></ tr > " ;
echo " <tr><td> " . i18n ( " Fax Number " ) . " </td><td><input value= \" $school->fax\ " type = text name = fax size = 30 ></ td ></ tr > " ;
2010-10-14 19:42:20 +00:00
/*
2010-06-15 16:57:50 +00:00
echo " <tr><td> " . i18n ( " Science Teacher " ) . " </td><td><input value= \" { $sh [ 'name' ] } \" type=text name=sciencehead size=40></td></tr> " ;
echo " <tr><td> " . i18n ( " Science Teacher Email " ) . " </td><td><input value= \" $sh_email\ " type = text name = scienceheademail size = 40 ></ td ></ tr > " ;
echo " <tr><td> " . i18n ( " Science Teacher Phone " ) . " <br><font size=1>( " . i18n ( " If different than above " ) . " )</font></td><td><input value= \" { $sh [ 'phonework' ] } \" type=text name=scienceheadphone size=30></td></tr> " ;
2010-10-14 19:42:20 +00:00
*/
2010-06-15 16:57:50 +00:00
echo " </table> " ;
echo " <input type=submit value= \" " . i18n ( " Save Changes " ) . " \" > " ;
echo " </form> " ;
echo " <br> " ;
}
?>