sciencehead_uid > 0) $sh = user_load_by_uid($school->sciencehead_uid); else if($em != '') { $sh = user_create('teacher', $em); $sciencehead_update = "sciencehead_uid='{$sh['uid']}',"; } else $sh = false; /* If we have a record, either delete it or update it */ if(is_array($sh)) { if($em == '') { user_purge($sh, 'teacher'); $sciencehead_update = 'sciencehead_uid=NULL,'; } else { $sh['firstname'] = $first; $sh['lastname'] = $last; $sh['phonework'] = $_POST['scienceheadphone']; $sh['email'] = $em; $sh['username'] = $em; user_save($sh); } } mysql_query("UPDATE schools SET school='".mysql_escape_string(stripslashes($_POST['school']))."', address='".mysql_escape_string(stripslashes($_POST['address']))."', city='".mysql_escape_string(stripslashes($_POST['city']))."', province_code='".mysql_escape_string(stripslashes($_POST['province_code']))."', postalcode='".mysql_escape_string(stripslashes($_POST['postalcode']))."', phone='".mysql_escape_string(stripslashes($_POST['phone']))."', $sciencehead_update fax='".mysql_escape_string(stripslashes($_POST['fax']))."' WHERE id='$school->id'"); 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")); //and reselect it $q=mysql_query("SELECT * FROM schools WHERE id='".$_SESSION['schoolid']."' AND accesscode='".$_SESSION['schoolaccesscode']."' AND year='".$config['FAIRYEAR']."'"); echo mysql_error(); $school=mysql_fetch_object($q); } /* if($_POST['action']=="numbers") { mysql_query("UPDATE schools SET junior='".$_POST['junior']."', intermediate='".$_POST['intermediate']."', senior='".$_POST['senior']."' WHERE id='$school->id'"); echo mysql_error(); $q=mysql_query("SELECT * FROM schools WHERE id='".$_SESSION['schoolid']."' AND accesscode='".$_SESSION['schoolaccesscode']."'"); echo "Participation Information Successfully Updated
\n"; $school=mysql_fetch_object($q); } */ if($school->sciencehead_uid > 0) $sh = user_load_by_uid($school->sciencehead_uid); else $sh = array(); $sh_email = ($sh['email'] != '' && $sh['email'][0] != '*') ? $sh['email'] : ''; if($_POST['action'] == "feedback"){ $body=""; $body.=date("r")."\n"; $body.=$_SERVER['REMOTE_ADDR']." (".$_SERVER['REMOTE_HOST'].")\n"; $body.="School ID: $school->id\n"; $body.="School Name: $school->school\n"; if($sh['name']) $body.="Science Teacher: {$sh['name']}\n"; if($sh['phonework']) $body.="Science Teacher Phone: {$sh['phonework']}\n"; if($sh_email) $body.="Science Teacher Email: $sh_email\n"; $body.="\nFeedback:\n".stripslashes($_POST['feedbacktext'])."\n"; $returnEmailAddress = $sh_email; mail($config['fairmanageremail'],"School Feedback",$body,"From: ". $returnEmailAddress."\nReply-To: ".$returnEmailAddress."\nReturn-Path: ".$returnEmailAddress); echo happy(i18n("Your feedback has been sent")); } switch($_GET['action']){ case "givefeedback": draw_feedback(); break; case "schoolinfo": draw_schoolInfo(); break; case "participantreg": draw_participantReg(); break; default: draw_dashboard(); break; } }else{ echo error(i18n("Invalid School ID or Access Code")); } } else { draw_login(); } send_footer(); // FIXME - this needs to be beautified function draw_dashboard(){ send_header("School Access"); global $config; global $conference; echo "\n"; } function draw_login(){ send_header("School Access"); global $errormsg, $happymsg, $config; if($errormsg) echo "$errormsg"; if($happymsg) echo happy($happymsg); echo "
\n"; echo output_page_text("schoolaccess"); if($config['participant_registration_type']=="open" || $config['participant_registration_type']=="openorinvite") { echo "

\n"; echo i18n("Note: Schools do not need to login in order to have students register from their school. Students can register by going to the Participant Registration Page. The only benefit of logging in is to update your school contact information or submit feedback.:"); echo "
"; echo "   ",i18n("Participant Registration")."
"; } echo "
"; echo i18n("Please login below by selecting your school and entering your school Access Code that you received in your package"); ?>

:
:
">


_THISFILE)); echo i18n("We are always welcome to any feedback (both positive and constructive criticism!), or any questions you may have. Please use the following form to communicate with the science fair committee!"); if($sh_email != '') { echo "
"; echo ""; echo "

"; echo ""; echo "
"; }else{ echo error(i18n("Feedback is disabled until a science teacher email address is entered above")); } } function draw_schoolInfo(){ global $school, $sh, $sh_email, $config; $title = i18n("School Information"); send_header($title, array("School Access" => _THISFILE)); echo "

$school->school

"; echo i18n("Please make sure your school contact information is correct, make any necessary changes:"); echo "
"; echo ""; echo ""; echo ""; // echo ""; echo ""; echo ""; echo "\n"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
".i18n("School Name")."school\" type=text name=school size=40>
Registration Passwordregistration_password\" type=text name=\"registration_password\" size=\"20\">
".i18n("Address")."address\" type=text name=address size=40>
".i18n("City")."city\" type=text name=city size=30>
".i18n($config['provincestate']).""; emit_province_selector("province_code",$school->province_code); echo "
".i18n($config['postalzip'])."postalcode\" type=text name=postalcode size=10>
".i18n("Phone Number")."phone\" type=text name=phone size=30>
".i18n("Fax Number")."fax\" type=text name=fax size=30>
".i18n("Science Teacher")."
".i18n("Science Teacher Email")."
".i18n("Science Teacher Phone")."
(".i18n("If different than above").")
"; echo ""; echo "
"; echo "
"; } function draw_participantReg(){ global $school, $config; $title = i18n("Participant Registration"); send_header($title, array("School Access" => _THISFILE)); if($config['participant_registration_type']=="schoolpassword") { echo "

".i18n("Participant Registration Password")."

"; echo i18n("In order for your school's students to register for the fair, they will need to know your specific school registration password"); echo "
"; echo "
"; echo i18n("Registration Password: %1",array($school->registration_password)); echo "
"; echo "
"; } else if($config['participant_registration_type']=="invite" || $config['participant_registration_type']=="openorinvite" ) { echo "

".i18n("Participant Registration Invitations")."

"; if($config['participant_registration_type']=="invite") echo i18n("In order for your school's students to register for the fair, you must first invite them via email. Use the 'Participant Registration Invitations' link below to invite your students to the fair"); else if($config['participant_registration_type']=="openorinvite" ) echo i18n("In order for your school's students to register for the fair, you can invite them via email using the 'Participant Registration Invitations' link below, or they can register on their own by accessing the 'Participant Registration' link in the menu."); echo "
"; echo "
"; echo "   ".i18n("Participant Registration Invitations").""; echo "
"; } }