From 4ee617eb529e9a790ce9d025d39a6781efecd7fb Mon Sep 17 00:00:00 2001 From: james Date: Sun, 15 Oct 2006 17:11:56 +0000 Subject: [PATCH] Add more school information to the schools database (school lanaguage, school level, principal and school email addresS) --- admin/schools.php | 19 +++++++++++++++++++ admin/schoolsimport.php | 8 ++++++-- db/db.update.26.sql | 4 ++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 db/db.update.26.sql diff --git a/admin/schools.php b/admin/schools.php index cbae550d..bc39b794 100644 --- a/admin/schools.php +++ b/admin/schools.php @@ -43,6 +43,9 @@ $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']))."', ". @@ -50,6 +53,8 @@ "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']))."', ". @@ -101,6 +106,18 @@ echo "\n"; echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -111,6 +128,8 @@ echo "\n"; echo "\n"; echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo ""; echo "\n"; diff --git a/admin/schoolsimport.php b/admin/schoolsimport.php index 4e2eb3fc..cac301b4 100644 --- a/admin/schoolsimport.php +++ b/admin/schoolsimport.php @@ -51,7 +51,7 @@ $loaded=0; foreach($CSVP->data AS $row) { - mysql_query("INSERT INTO schools (school,board,district,phone,fax,address,city,province_code,postalcode,sciencehead,scienceheademail,scienceheadphone,accesscode,registration_password,projectlimit,projectlimitper,year) VALUES ( + mysql_query("INSERT INTO schools (school,schoollang,schoollevel,board,district,phone,fax,address,city,province_code,postalcode,principal,schoolemail,sciencehead,scienceheademail,scienceheadphone,accesscode,registration_password,projectlimit,projectlimitper,year) VALUES ( '".mysql_escape_string(stripslashes($row[0]))."', '".mysql_escape_string(stripslashes($row[1]))."', '".mysql_escape_string(stripslashes($row[2]))."', @@ -68,6 +68,10 @@ '".mysql_escape_string(stripslashes($row[13]))."', '".mysql_escape_string(stripslashes($row[14]))."', '".mysql_escape_string(stripslashes($row[15]))."', + '".mysql_escape_string(stripslashes($row[16]))."', + '".mysql_escape_string(stripslashes($row[17]))."', + '".mysql_escape_string(stripslashes($row[18]))."', + '".mysql_escape_string(stripslashes($row[19]))."', '".$config['FAIRYEAR']."')"); if(!mysql_Error()) $loaded++; @@ -96,7 +100,7 @@ echo i18n("Choose the CSV file containing the school information. The COLUMNS of the file must contain the following information, in this exact order, separated by comma's (,) with fields optionally enclosed by quotes (\"):"); echo "
"; echo "
"; - echo i18n("School Name, Board, District, Phone, Fax, Address, City, Province, Postal Code, Science Head, Science Head Email, Science Head Phone, Access Code, Registration Password, Project Limit, Project Limit Per(total or agecategory)"); + echo i18n("School Name, School Lang, School Level, Board, District, Phone, Fax, Address, City, Province, Postal Code, Principal, School Email, Science Head, Science Head Email, Science Head Phone, Access Code, Registration Password, Project Limit, Project Limit Per(total or agecategory)"); echo "
"; echo "
"; diff --git a/db/db.update.26.sql b/db/db.update.26.sql new file mode 100644 index 00000000..4f95f998 --- /dev/null +++ b/db/db.update.26.sql @@ -0,0 +1,4 @@ +ALTER TABLE `schools` ADD `principal` VARCHAR( 64 ) NOT NULL AFTER `postalcode` ; +ALTER TABLE `schools` ADD `schoolemail` VARCHAR( 128 ) NOT NULL AFTER `principal` ; +ALTER TABLE `schools` ADD `schoollang` VARCHAR( 2 ) NOT NULL AFTER `school` ; +ALTER TABLE `schools` ADD `schoollevel` VARCHAR( 32 ) NOT NULL AFTER `schoollang` ;
".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("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\" />