\n";
+ echo '';
+ send_footer();
+}
+
+?>
diff --git a/schoolaccess.php b/schoolaccess.php
index f22c92a..9af4859 100644
--- a/schoolaccess.php
+++ b/schoolaccess.php
@@ -2,6 +2,10 @@
require_once('common.inc.php');
require_once('user.inc.php');
+$parts = explode('/', $_SERVER['PHP_SELF']);
+define("_THISFILE", $parts[count($parts) - 1]);
+
+
if($_POST['schoolid'] && $_POST['accesscode'])
{
$q=mysql_query("SELECT * FROM schools WHERE id='".$_POST['schoolid']."' AND accesscode='".$_POST['accesscode']."' AND year='".$config['FAIRYEAR']."'");
@@ -22,8 +26,6 @@ if($_GET['action']=="logout")
unset($_SESSION['schoolaccesscode']);
$happymsg=i18n("You have been logged out from the school access page");
}
-send_header("School Access");
-
if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
@@ -33,7 +35,6 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
$school=mysql_fetch_object($q);
if($school) {
if($_POST['action']=="save") {
-
/* Get info about science head */
$sciencehead_update = '';
list($first, $last) = split(' ', $_POST['sciencehead'], 2);
@@ -77,15 +78,15 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
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"));
+ 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);
+ //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);
}
/*
@@ -111,8 +112,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
$sh = array();
$sh_email = ($sh['email'] != '' && $sh['email'][0] != '*') ? $sh['email'] : '';
- if($_POST['action']=="feedback")
- {
+ if($_POST['action'] == "feedback"){
$body="";
$body.=date("r")."\n";
$body.=$_SERVER['REMOTE_ADDR']." (".$_SERVER['REMOTE_HOST'].")\n";
@@ -127,75 +127,54 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
echo happy(i18n("Your feedback has been sent"));
}
- echo "
$school->school
";
- echo "
".i18n("School Information")."
";
- echo i18n("Please make sure your school contact information is correct, make any necessary changes:");
- echo "";
- echo " ";
+ switch($_GET['action']){
+ case "givefeedback":
+ draw_feedback();
+ break;
+ case "schoolinfo":
+ draw_schoolInfo();
+ break;
+ case "participantreg":
+ draw_participantReg();
+ break;
+ default:
+ draw_dashboard();
- 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 " ";
+ break;
}
- 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 " ";
- }
-
- echo " ";
- echo "
".i18n("School Feedback / Questions")."
";
-
- 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 "";
- }
- else
- echo error(i18n("Feedback is disabled until a science teacher email address is entered above"));
- }
- else {
+ }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);
@@ -245,7 +224,85 @@ else {
}
+function draw_feedback(){
+ global $sh_email;
-send_footer();
+ $title = i18n("School Feedback / Questions");
+ send_header($title, array("School Access" => _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 "";
+ }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 " ";
+}
+
+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 " ";
+ }
+}
-?>
diff --git a/super/conferences.php b/super/conferences.php
index 3802362..4a0f5c9 100644
--- a/super/conferences.php
+++ b/super/conferences.php
@@ -34,7 +34,7 @@
?>