Copyright (C) 2005 James Grant This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ?> << ".i18n("Back to Administration")."\n"; if($_POST['save']=="edit" || $_POST['save']=="add") { if($_POST['save']=="add") { $q=mysql_query("INSERT INTO schools (year) VALUES ('".$config['FAIRYEAR']."')"); $id=mysql_insert_id(); } else $id=$_POST['id']; $exec="UPDATE schools SET ". "school='".mysql_escape_string(stripslashes($_POST['school']))."', ". "schoollang='".mysql_escape_string(stripslashes($_POST['schoollang']))."', ". "schoollevel='".mysql_escape_string(stripslashes($_POST['schoollevel']))."', ". "school='".mysql_escape_string(stripslashes($_POST['school']))."', ". "board='".mysql_escape_string(stripslashes($_POST['board']))."', ". "district='".mysql_escape_string(stripslashes($_POST['district']))."', ". "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']))."', ". "principal='".mysql_escape_string(stripslashes($_POST['principal']))."', ". "schoolemail='".mysql_escape_string(stripslashes($_POST['schoolemail']))."', ". "phone='".mysql_escape_string(stripslashes($_POST['phone']))."', ". "fax='".mysql_escape_string(stripslashes($_POST['fax']))."', ". "sciencehead='".mysql_escape_string(stripslashes($_POST['sciencehead']))."', ". "scienceheadphone='".mysql_escape_string(stripslashes($_POST['scienceheadphone']))."', ". "scienceheademail='".mysql_escape_string(stripslashes($_POST['scienceheademail']))."', ". "registration_password='".mysql_escape_string(stripslashes($_POST['registration_password']))."', ". "projectlimit='".mysql_escape_string(stripslashes($_POST['projectlimit']))."', ". "projectlimitper='".mysql_escape_string(stripslashes($_POST['projectlimitper']))."', ". "accesscode='".mysql_escape_string(stripslashes($_POST['accesscode']))."' ". "WHERE id='$id'"; mysql_query($exec); echo mysql_error(); if($_POST['save']=="add") echo happy("School successfully added"); else echo happy("Successfully saved changes to school"); } if($_GET['action']=="delete" && $_GET['delete']) { mysql_query("DELETE FROM schools WHERE id='".$_GET['delete']."'"); echo happy("School successfully deleted"); } if($_GET['action']=="clearaccesscodes") { mysql_query("UPDATE schools SET accesscode=NULL WHERE year='{$config['FAIRYEAR']}'"); echo happy("Access Codes successfully cleared from all schools"); } if($_GET['action']=="makeaccesscodes") { $q=mysql_query("SELECT id FROM schools WHERE year='{$config['FAIRYEAR']}' AND (accesscode IS NULL OR accesscode='')"); while($r=mysql_fetch_object($q)) { $ac=generatePassword(5); mysql_query("UPDATE schools SET accesscode='$ac' WHERE id='$r->id' AND year='{$config['FAIRYEAR']}'"); } echo happy("Access Codes successfully set for schools that didn't have one"); } if($_GET['action']=="edit" || $_GET['action']=="add") { echo "<< ".i18n("Back to Schools")."\n"; if($_GET['action']=="edit") { echo "

".i18n("Edit School")."

\n"; $buttontext="Save School"; $q=mysql_query("SELECT * FROM schools WHERE id='".$_GET['edit']."'"); $r=mysql_fetch_object($q); } else if($_GET['action']=="add") { echo "

".i18n("Add New School")."

\n"; $buttontext="Add School"; } $buttontext=i18n($buttontext); echo "
\n"; echo "\n"; if($_GET['action']=="edit") echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo ""; echo "\n"; echo "\n"; echo "\n"; if($config['participant_registration_type']=="schoolpassword") { echo ""; echo "\n"; } echo ""; if($config['participant_registration_type']=="invite") { echo ""; echo "\n"; } else { echo ""; } echo ""; echo "\n"; echo "
".i18n("School Name")."school)."\" size=\"60\" maxlength=\"64\" />
".i18n("School Language").""; echo ""; echo "
".i18n("School Level")."schoollevel)."\" size=\"32\" maxlength=\"32\" />
".i18n("School Board")."board)."\" size=\"60\" maxlength=\"64\" />
".i18n("School District")."district)."\" size=\"60\" maxlength=\"64\" />
".i18n("Address")."address)."\" size=\"60\" maxlength=\"64\" />
".i18n("City")."city)."\" size=\"32\" maxlength=\"32\" />
".i18n("Province").""; emit_province_selector("province_code",$r->province_code); echo "
".i18n("Postal Code")."postalcode\" size=\"8\" maxlength=\"7\" />
".i18n("Phone")."phone)."\" size=\"16\" maxlength=\"16\" />
".i18n("Fax")."fax)."\" size=\"16\" maxlength=\"16\" />
".i18n("Principal")."principal)."\" size=\"60\" maxlength=\"64\" />
".i18n("School Email")."schoolemail)."\" size=\"60\" maxlength=\"128\" />
".i18n("Access Code")."accesscode)."\" size=\"32\" maxlength=\"32\" />

".i18n("Science head/teacher or science fair contact at school")."
".i18n("Name")."sciencehead)."\" size=\"60\" maxlength=\"64\" />
".i18n("Phone")."scienceheadphone)."\" size=\"16\" maxlength=\"16\" />
".i18n("Email")."scienceheademail)."\" size=\"60\" maxlength=\"128\" />

".i18n("Participant Registration Password")."
".i18n("Password")."registration_password)."\" size=\"32\" maxlength=\"32\" />

".i18n("Participant Registration Limits")."
".i18n("Set to 0 to have no registration limit")."
".i18n("Maximum of")." "; echo "projectlimit)."\" size=\"4\" maxlength=\"4\" />"; echo " "; echo i18n("projects"); echo " "; echo ""; echo "
".i18n("Participant registration limits are currently disabled. In order to use participant registration limits for schools, the participant registration type must be set to 'invite' in Configuration / Configuration Variables")."
 
\n"; echo "
\n"; } else { echo "
"; echo "Add New School\n"; echo "
"; echo "Import Schools from CSV\n"; echo "
"; echo "Create Access Code for any school without one\n"; echo "
"; echo "Remove Access Codes from all schools\n"; echo "
"; echo ""; echo ""; echo " "; echo " "; echo " "; echo " "; if($config['participant_registration_type']=="schoolpassword") echo " "; echo " "; echo " "; echo "\n"; $q=mysql_query("SELECT * FROM schools WHERE year='".$config['FAIRYEAR']."' ORDER BY school"); while($r=mysql_fetch_object($q)) { echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; if($config['participant_registration_type']=="schoolpassword") echo " \n"; echo " \n"; echo " \n"; echo "\n"; } echo "
SchoolAddressPhoneContactReg PassAccess CodeAction
$r->school$r->address, $r->city, $r->postalcode$r->phone$r->sciencehead$r->registration_password$r->accesscode"; echo "id\">"; echo " "; echo "id\">"; echo "
\n"; } send_footer(); ?>