diff --git a/admin/index.php b/admin/index.php index 532ce0d..cb5ce16 100644 --- a/admin/index.php +++ b/admin/index.php @@ -32,6 +32,7 @@ echo "
"; echo "Committee Management
"; echo "Awards Management
"; + echo "School Management
"; echo "Judging Management
"; echo "
"; echo "Enter Winning Projects
"; diff --git a/admin/schools.php b/admin/schools.php new file mode 100644 index 0000000..3250542 --- /dev/null +++ b/admin/schools.php @@ -0,0 +1,162 @@ + + 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']))."', ". + "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']))."', ". + "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']))."', ". + "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']=="edit" || $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($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 ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "
".i18n("School Name")."school)."\" size=\"60\" maxlength=\"128\" />
".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("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\" />
\n"; + echo "
\n"; + + + + } + else + { + + + echo "
"; + echo "Add New School\n"; + echo "
"; + echo ""; + echo ""; + echo " "; + echo " "; + 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"; + + echo " \n"; + echo "\n"; + } + + echo "
SchoolAddressPhoneContactAction
$r->school$r->address, $r->city, $r->postalcode$r->phone$r->sciencehead"; + echo "id\">"; + echo " "; + echo "id\">"; + + + echo "
\n"; + + + } + + send_footer(); + +?>