Add emit month/day/year functions to common

Make students page show the number of forms for the number of students
This commit is contained in:
james 2004-12-03 04:28:18 +00:00
parent 68ff4380e1
commit e091cb2e51
5 changed files with 120 additions and 5 deletions

View File

@ -217,4 +217,60 @@ function send_footer()
}
function emit_month_selector($name,$selected="")
{
echo "<select name=\"$name\">\n";
$months=array("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
echo "<option value=\"\">".i18n("Month")."</option>\n";
for($x=1;$x<=12;$x++)
{
if($x==$selected)
$s="selected=\"selected\"";
else
$s="";
echo "<option $s value=\"$x\">".$months[$x]."</option>\n";
}
echo "</select>\n";
}
function emit_day_selector($name,$selected="")
{
echo "<select name=\"$name\">\n";
echo "<option value=\"\">".i18n("Day")."</option>\n";
for($x=1;$x<=31;$x++)
echo "<option value=\"".($x<10?"0":"")."$x\" ".($selected==$x?"selected=\"selected\"":"").">$x</option>\n";
echo "</select>\n";
}
function emit_year_selector($name,$selected="",$min=0,$max=0)
{
$curyear=date("Y");
echo "<select name=\"$name\">\n";
echo "<option value=\"\">".i18n("Year")."</option>\n";
if($min&&$max)
{
for($x=$min;$x<=$max;$x++)
echo "<option value=\"$x\" ".($selected==$x?"selected=\"selected\"":"").">$x</option>\n";
}
else
{
//if we arent given a min and max, lets show current year + 5
for($x=$curyear;$x<$curyear+5;$x++)
echo "<option value=\"$x\" ".($selected==$x?"selected=\"selected\"":"").">$x</option>\n";
}
echo "</select>\n";
}
?>

View File

@ -2,7 +2,7 @@
function studentStatus()
{
global $config;
$required_fields=array("name","address","city","postalcode","phone","email","grade","age");
$required_fields=array("firstname","lastname","address","city","postalcode","phone","email","grade","age");
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");

View File

@ -27,7 +27,7 @@
else if($_POST['action']=="continue")
{
$q=mysql_query("SELECT registrations.id AS regid, registrations.num AS regnum, students.id AS studentid, students.name FROM registrations,students ".
$q=mysql_query("SELECT registrations.id AS regid, registrations.num AS regnum, students.id AS studentid, students.firstname FROM registrations,students ".
"WHERE students.email='".$_SESSION['email']."' ".
"AND registrations.num='".$_POST['regnum']."' ".
"AND students.registrations_id=registrations.id ".

View File

@ -14,7 +14,7 @@
exit;
}
$q=mysql_query("SELECT registrations.id AS regid, students.id AS studentid, students.name FROM registrations,students ".
$q=mysql_query("SELECT registrations.id AS regid, students.id AS studentid, students.firstname FROM registrations,students ".
"WHERE students.email='".$_SESSION['email']."' ".
"AND registrations.num='".$_SESSION['registration_number']."' ".
"AND registrations.id='".$_SESSION['registration_id']."' ".
@ -33,7 +33,7 @@ echo mysql_error();
$r=mysql_fetch_object($q);
send_header("Participant Registration - Summary");
echo i18n("Hello <b>%1</b>",array($r->name));
echo i18n("Hello <b>%1</b>",array($r->firstname));
echo "<br />";
echo "<br />";
echo i18n("Please use the checklist below to complete your registration. Click on an item in the table to edit that information. When you have entered all information, the <b>Status</b> field will change to <b>Complete</b>");

View File

@ -13,7 +13,7 @@
exit;
}
$q=mysql_query("SELECT registrations.id AS regid, students.id AS studentid, students.name FROM registrations,students ".
$q=mysql_query("SELECT registrations.id AS regid, students.id AS studentid, students.firstname FROM registrations,students ".
"WHERE students.email='".$_SESSION['email']."' ".
"AND registrations.num='".$_SESSION['registration_number']."' ".
"AND registrations.id='".$_SESSION['registration_id']."' ".
@ -72,7 +72,66 @@ echo mysql_error();
$studentinfo=mysql_fetch_object($q);
echo "<h3>".i18n("Student %1 Details",array($x))."</h3>";
echo "<table>";
echo "<tr>\n";
echo " <td>".i18n("First Name")."</td><td><input type=\"text\" name=\"firstname$x\" value=\"$studentinfo->firstname\"></td>\n";
echo " <td>".i18n("Last Name")."</td><td><input type=\"text\" name=\"lastname$x\" value=\"$studentinfo->lastname\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td>".i18n("Address")."</td><td><input type=\"text\" name=\"address$x\" value=\"$studentinfo->address\"></td>\n";
echo " <td>".i18n("City")."</td><td><input type=\"text\" name=\"city$x\" value=\"$studentinfo->city\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td>".i18n("Postal Code")."</td><td><input type=\"text\" name=\"postalcode$x\" value=\"$studentinfo->postalcode\"></td>\n";
echo " <td>".i18n("Phone")."</td><td><input type=\"text\" name=\"phone\" value=\"$studentinfo->phone\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td>".i18n("Date of Birth")."</td><td>\n";
list($year,$month,$day)=split("-",$studentinfo->dateofbirth);
echo "<table><tr><td>";
emit_day_selector("day$x",$day);
echo "</td><td>\n";
emit_month_selector("month$x",$month);
echo "</td><td>\n";
emit_year_selector("year$x",$year,date("Y")-19,date("Y")-10);
echo "</td></tr></table>\n";
echo " </td>\n";
echo " <td>".i18n("Grade")."</td><td>\n";
echo "<select name=\"grade$x\">\n";
echo "<option value=\"\">".i18n("Choose Grade")."</option>\n";
for($gr=$config['mingrade'];$gr<=$config['maxgrade'];$gr++)
{
echo "<option value=\"$gr\">$gr</option>\n";
}
echo "</select>\n";
echo " </td>";
echo "</tr>";
/*
</td>
</tr>
<tr>
<td align=right><? echo i18n("tshirtsize"); ?></td>
<td><select name=tshirt1>
<option value="small"><? echo i18n("small"); ?></option>
<option value="medium"><? echo i18n("medium"); ?></option>
<option value="large"><? echo i18n("large"); ?></option>
<option value="xlarge"><? echo i18n("xlarge"); ?></option>
</select>
</td>
<td align=right><? echo i18n("emailaddress"); ?></td>
<td><input type=text name=emailaddress1></td>
</tr>
</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 />";