forked from science-ation/science-ation
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
This commit is contained in:
parent
c951c58984
commit
319c5d6720
@ -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);
|
||||
|
@ -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 "<tr>";
|
||||
echo "<th>".i18n("Category ID")."</th>\n";
|
||||
echo "<th>".i18n("Category Name")."</th>\n";
|
||||
echo "<th>".i18n("Shortform")."</th>\n";
|
||||
echo "<th>".i18n("Minimum Grade")."</th>\n";
|
||||
echo "<th>".i18n("Maximum Grade")."</th>\n";
|
||||
echo "<th>".i18n("Actions")."</th>\n";
|
||||
@ -125,6 +128,7 @@
|
||||
echo "<tr>";
|
||||
echo " <td><input type=\"text\" size=\"3\" name=\"id\" value=\"$categoryr->id\"></td>";
|
||||
echo " <td><input type=\"text\" size=\"20\" name=\"category\" value=\"$categoryr->category\"></td>";
|
||||
echo " <td><input type=\"text\" size=\"5\" name=\"category_shortform\" value=\"$categoryr->category_shortform\"></td>";
|
||||
echo " <td><input type=\"text\" size=\"3\" name=\"mingrade\" value=\"$categoryr->mingrade\"></td>";
|
||||
echo " <td><input type=\"text\" size=\"3\" name=\"maxgrade\" value=\"$categoryr->maxgrade\"></td>";
|
||||
echo " <td><input type=\"submit\" value=\"".i18n($buttontext)."\"></td>";
|
||||
@ -138,6 +142,7 @@
|
||||
echo "<tr>";
|
||||
echo " <td align=\"center\">$r->id</td>";
|
||||
echo " <td>".i18n($r->category)."</td>";
|
||||
echo " <td>".i18n($r->category_shortform)."</td>";
|
||||
echo " <td align=\"center\">$r->mingrade</td>";
|
||||
echo " <td align=\"center\">$r->maxgrade</td>";
|
||||
echo " <td align=\"center\">";
|
||||
|
@ -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<br>";
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
31
|
||||
32
|
||||
|
3
db/db.update.32.sql
Normal file
3
db/db.update.32.sql
Normal file
@ -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';
|
@ -135,16 +135,24 @@ echo "<table><tr><td>";
|
||||
echo outputStatus($statusproject);
|
||||
echo "</td></tr>";
|
||||
|
||||
//mentor information
|
||||
echo "<tr><td>";
|
||||
echo "<a href=\"register_participants_mentor.php\">";
|
||||
echo i18n("Mentor Information");
|
||||
echo "</a>";
|
||||
echo "</td><td>";
|
||||
//check to see if its complete
|
||||
$statusmentor=mentorStatus();
|
||||
echo outputStatus($statusmentor);
|
||||
echo "</td></tr>";
|
||||
if($config['participant_mentor']=="yes")
|
||||
{
|
||||
//mentor information
|
||||
echo "<tr><td>";
|
||||
echo "<a href=\"register_participants_mentor.php\">";
|
||||
echo i18n("Mentor Information");
|
||||
echo "</a>";
|
||||
echo "</td><td>";
|
||||
//check to see if its complete
|
||||
$statusmentor=mentorStatus();
|
||||
echo outputStatus($statusmentor);
|
||||
echo "</td></tr>";
|
||||
}
|
||||
else
|
||||
{
|
||||
//if mentorship isnt required, then assume its complete so the checks below will still work properly
|
||||
$statusmentor="complete";
|
||||
}
|
||||
|
||||
//safety information
|
||||
echo "<tr><td>";
|
||||
|
@ -1 +1 @@
|
||||
2.0.2
|
||||
2.0.3
|
||||
|
Loading…
Reference in New Issue
Block a user