From 319c5d67209bec2b94222a3c435bba16d46428c8 Mon Sep 17 00:00:00 2001 From: james Date: Wed, 6 Dec 2006 17:58:40 +0000 Subject: [PATCH] Add option to turn off the Mentor section for participant registration Add two new projectnumber options: c=category shortform, d=division shortform, eg (JLS01 = Junior, Life Science, Project #01) Add shortform field for age category Fix bug in config editor where it was updating values for ALL years, instead of just the current year! Bump version number to development version --- admin/registration_receivedforms.php | 24 ++++++++++++++++++++++-- config/categories.php | 7 ++++++- config_editor.inc.php | 2 +- db/db.code.version.txt | 2 +- db/db.update.32.sql | 3 +++ register_participants_main.php | 28 ++++++++++++++++++---------- version.txt | 2 +- 7 files changed, 52 insertions(+), 16 deletions(-) create mode 100644 db/db.update.32.sql diff --git a/admin/registration_receivedforms.php b/admin/registration_receivedforms.php index 33d5c81..6077995 100644 --- a/admin/registration_receivedforms.php +++ b/admin/registration_receivedforms.php @@ -54,7 +54,10 @@ $showformatbottom=true; $statusstudent=studentStatus($reg_id); $statusemergencycontact=emergencycontactStatus($reg_id); $statusproject=projectStatus($reg_id); - $statusmentor=mentorStatus($reg_id); + if($config['participant_mentor']=="yes") + $statusmentor=mentorStatus($reg_id); + else + $statusmentor="complete"; $statussafety=safetyStatus($reg_id); if( @@ -199,13 +202,30 @@ echo mysql_Error(); $q=mysql_query("SELECT id FROM registrations WHERE num='".$_POST['registration_number']."'"); $r=mysql_fetch_object($q); $reg_id=$r->id; - $q=mysql_query("SELECT projects.projectcategories_id, projects.projectdivisions_id FROM projects WHERE registrations_id='$reg_id'"); + $q=mysql_query("SELECT projects.projectcategories_id, + projects.projectdivisions_id, + projectcategories.category_shortform, + projectdivisions.division_shortform + FROM + projects, + projectcategories, + projectdivisions + WHERE + registrations_id='$reg_id' + AND projects.projectdivisions_id=projectdivisions.id + AND projects.projectcategories_id=projectcategories.id + AND projectcategories.year='{$config['FAIRYEAR']}' + AND projectdivisions.year='{$config['FAIRYEAR']}' + "); + echo mysql_error(); $r=mysql_fetch_object($q); $projectnumber=$config['project_num_format']; //first replace the division and category $projectnumber=str_replace('D',$r->projectdivisions_id,$projectnumber); $projectnumber=str_replace('C',$r->projectcategories_id,$projectnumber); + $projectnumber=str_replace('d',$r->division_shortform,$projectnumber); + $projectnumber=str_replace('c',$r->category_shortform,$projectnumber); //now change the N to a % so we can use it as a wildcard $querynum=str_replace('N','%',$projectnumber); diff --git a/config/categories.php b/config/categories.php index 70fd291..b93a9bd 100644 --- a/config/categories.php +++ b/config/categories.php @@ -44,6 +44,7 @@ mysql_query("UPDATE projectcategories SET ". "id='".$_POST['id']."', ". "category='".mysql_escape_string(stripslashes($_POST['category']))."', ". + "category_shortform='".mysql_escape_string(stripslashes($_POST['category_shortform']))."', ". "mingrade='".$_POST['mingrade']."', ". "maxgrade='".$_POST['maxgrade']."' ". "WHERE id='".$_POST['saveid']."'"); @@ -68,9 +69,10 @@ } else { - mysql_query("INSERT INTO projectcategories (id,category,mingrade,maxgrade,year) VALUES ( ". + mysql_query("INSERT INTO projectcategories (id,category,category_shortform,mingrade,maxgrade,year) VALUES ( ". "'".$_POST['id']."', ". "'".mysql_escape_string(stripslashes($_POST['category']))."', ". + "'".mysql_escape_string(stripslashes($_POST['category_shortform']))."', ". "'".$_POST['mingrade']."', ". "'".$_POST['maxgrade']."', ". "'".$config['FAIRYEAR']."')"); @@ -103,6 +105,7 @@ echo ""; echo "".i18n("Category ID")."\n"; echo "".i18n("Category Name")."\n"; + echo "".i18n("Shortform")."\n"; echo "".i18n("Minimum Grade")."\n"; echo "".i18n("Maximum Grade")."\n"; echo "".i18n("Actions")."\n"; @@ -125,6 +128,7 @@ echo ""; echo " id\">"; echo " category\">"; + echo " category_shortform\">"; echo " mingrade\">"; echo " maxgrade\">"; echo " "; @@ -138,6 +142,7 @@ echo ""; echo " $r->id"; echo " ".i18n($r->category).""; + echo " ".i18n($r->category_shortform).""; echo " $r->mingrade"; echo " $r->maxgrade"; echo " "; diff --git a/config_editor.inc.php b/config_editor.inc.php index 86cd947..44ece74 100644 --- a/config_editor.inc.php +++ b/config_editor.inc.php @@ -94,7 +94,7 @@ function config_editor($category, $year, $array_name, $self) foreach($varkeys as $k) { $val = mysql_escape_string(stripslashes($var[$k])); $v = mysql_escape_string(stripslashes($k)); - mysql_query("UPDATE config SET val=\"$val\" WHERE var=\"$v\""); + mysql_query("UPDATE config SET val=\"$val\" WHERE var=\"$v\" AND `year`='$year'"); print mysql_error(); // echo "Saving {$v} = $val
"; } diff --git a/db/db.code.version.txt b/db/db.code.version.txt index e85087a..f5c8955 100644 --- a/db/db.code.version.txt +++ b/db/db.code.version.txt @@ -1 +1 @@ -31 +32 diff --git a/db/db.update.32.sql b/db/db.update.32.sql new file mode 100644 index 0000000..35dd0cf --- /dev/null +++ b/db/db.update.32.sql @@ -0,0 +1,3 @@ +INSERT INTO `config` (category,ord,var,val,description,year) VALUES ('Participant Registration','1050','participant_mentor','yes','Ask for mentorship information (yes/no)',-1); +ALTER TABLE `projectcategories` ADD `category_shortform` VARCHAR( 3 ) NOT NULL AFTER `category` ; +UPDATE `config` SET `description` = 'C=Category ID, c=Category Shortform, D=Division ID, d=Division Shortform, N=2 digit Number' WHERE `var` = 'project_num_format'; diff --git a/register_participants_main.php b/register_participants_main.php index 8e9055e..b6c7628 100644 --- a/register_participants_main.php +++ b/register_participants_main.php @@ -135,16 +135,24 @@ echo ""; - //mentor information - echo ""; + if($config['participant_mentor']=="yes") + { + //mentor information + echo ""; + } + else + { + //if mentorship isnt required, then assume its complete so the checks below will still work properly + $statusmentor="complete"; + } //safety information echo "
"; echo outputStatus($statusproject); echo "
"; - echo ""; - echo i18n("Mentor Information"); - echo ""; - echo ""; - //check to see if its complete - $statusmentor=mentorStatus(); - echo outputStatus($statusmentor); - echo "
"; + echo ""; + echo i18n("Mentor Information"); + echo ""; + echo ""; + //check to see if its complete + $statusmentor=mentorStatus(); + echo outputStatus($statusmentor); + echo "
"; diff --git a/version.txt b/version.txt index e9307ca..50ffc5a 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -2.0.2 +2.0.3