introduce new config parameters: minstudentsperproject and maxstudentsperproject

make students page use these values
This commit is contained in:
james 2004-12-03 00:11:09 +00:00
parent 0111d59bdf
commit 68ff4380e1

View File

@ -42,40 +42,40 @@ echo mysql_error();
//although... this can never really happen, since the above queries only allow the page to view if the student
//is found in the students table... soo... well, lets leave it here as a fallback anyways, just incase
mysql_query("INSERT INTO students (registrations_id,email,year) VALUES ('".$_SESSION['registration_id']."','".mysql_escape_string($_SESSION['email'])."','".$config['FAIRYEAR']."')");
}
else if(mysql_num_rows($q)==1)
{
$numstudents1="checked=\"checked\"";
$numstudents2="";
}
else if(mysql_num_rows($q)==2)
{
$numstudents1="";
$numstudents2="checked=\"checked\"";
//if we just inserted it, then we will obviously find 1
$numfound=1;
}
else
{
//this should never happen
//we cant have more than two on a project
echo error(i18n("More than two students associated with this registration"));
//FIXME: eventually provide a solution to fix this if it ever happens.. like say....
// "click here" to remove all students and start again.. or something
$numfound=mysql_num_rows($q);
}
echo "<form name=\"numstudentsform\" method=\"post\" action=\"register_participants_students.php\">";
echo "<input $numstudents1 type=\"radio\" name=\"numstudents\" value=\"1\"> ".i18n("I worked on the project by myself")."<br />";
echo "<input $numstudents2 type=\"radio\" name=\"numstudents\" value=\"2\"> ".i18n("I worked on the project with a partner")."<br />";
echo "<form name=\"numstudentsform\" method=\"get\" action=\"register_participants_students.php\">";
echo i18n("Number of students that worked on the project: ");
echo "<select name=\"numstudents\" onchange=\"document.forms.numstudentsform.submit()\">\n";
for($x=$config['minstudentsperproject'];$x<=$config['maxstudentsperproject'];$x++)
{
if($_GET['numstudents']==$x) $selected="selected=\"selected\""; else $selected="";
echo "<option $selected value=\"$x\">$x</option>\n";
}
echo "</select>";
echo "</form>";
if($_GET['numstudents'])
$numtoshow=$_GET['numstudents'];
else
$numtoshow=$numfound;
for($x=1;$x<=2;$x++)
for($x=1;$x<=$numtoshow;$x++)
{
$studentinfo=mysql_fetch_object($q);
echo "<div id=\"student$x\">\n";
echo "<h3>Student Details</h3>";
echo "</div>\n\n";
echo "<h3>".i18n("Student %1 Details",array($x))."</h3>";
echo "<table>";
echo "<tr><td>".i18n("Name").": </td><td><input type=\"text\" name=\"name$x\" value=\"$studentinfo->name\"></td></tr>";
echo "</table>";
echo "<br />";
echo "<br />";
}
send_footer();