forked from science-ation/science-ation
Add a division selector popup that asks questions to determine what division they should be in.
It also updates the original form based on the outcome (but needs the FIXME addressed evnetually)
This commit is contained in:
parent
740994032b
commit
a3588869e8
@ -123,7 +123,7 @@ else if($newstatus=="complete")
|
||||
|
||||
|
||||
|
||||
echo "<form method=\"post\" action=\"register_participants_project.php\">\n";
|
||||
echo "<form name=\"projectform\" method=\"post\" action=\"register_participants_project.php\">\n";
|
||||
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
|
||||
echo "<input type=\"hidden\" name=\"id\" value=\"$projectinfo->id\">\n";
|
||||
echo "<table>\n";
|
||||
@ -143,6 +143,22 @@ else if($newstatus=="complete")
|
||||
|
||||
}
|
||||
echo "</select>";
|
||||
if($config['usedivisionselector']=="yes")
|
||||
{
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
|
||||
function openDivSelWindow()
|
||||
{
|
||||
divselwin=window.open('register_participants_project_divisionselector.php','divsel','width=500,height=220,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no')
|
||||
if(divselwin.opener==null) divselwin.opener=self;
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
<?
|
||||
|
||||
echo " <a href=\"#\" onClick=\"openDivSelWindow(); return false;\">".i18n("Division Selector")."</a>";
|
||||
}
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr><td>".i18n("Language").": </td><td>";
|
||||
|
97
register_participants_project_divisionselector.php
Normal file
97
register_participants_project_divisionselector.php
Normal file
@ -0,0 +1,97 @@
|
||||
<?
|
||||
require("common.inc.php");
|
||||
include "register_participants.inc.php";
|
||||
|
||||
//authenticate based on email address and registration number from the SESSION
|
||||
if(!$_SESSION['email'])
|
||||
{
|
||||
header("Location: register_participants.php");
|
||||
exit;
|
||||
}
|
||||
if(!$_SESSION['registration_number'])
|
||||
{
|
||||
header("Location: register_participants.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$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']."' ".
|
||||
"AND students.registrations_id=registrations.id ".
|
||||
"AND registrations.year=".$config['FAIRYEAR']." ".
|
||||
"AND students.year=".$config['FAIRYEAR']);
|
||||
echo mysql_error();
|
||||
|
||||
if(mysql_num_rows($q)==0)
|
||||
{
|
||||
header("Location: register_participants.php");
|
||||
exit;
|
||||
|
||||
}
|
||||
$authinfo=mysql_fetch_object($q);
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
|
||||
<head><title><?=i18n("Division Selector")?></title>
|
||||
<link rel="stylesheet" href="<?=$config['SFIABDIRECTORY']?>/sfiab.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<?
|
||||
echo "<div id=\"emptypopup\">";
|
||||
|
||||
if($_GET['division'])
|
||||
{
|
||||
//FIXME: this only works when the division form uses ID's in order or their index AND the ID's are sequential starting from 1
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
opener.document.forms.projectform.projectdivisions_id.selectedIndex=<?=$_GET['division']?>
|
||||
</script>
|
||||
<?
|
||||
$q=mysql_query("SELECT * FROM projectdivisions WHERE id='".$_GET['division']."'");
|
||||
$r=mysql_fetch_object($q);
|
||||
echo "<h2>".i18n($r->division)."</h2>\n";
|
||||
echo "<a href=\"".$_SERVER['PHP_SELF']."\">Restart Division Selector</a>";
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
echo "<a href=\"javascript: window.close();\">Close window</a>\n";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!$_GET['id'])
|
||||
$id=1;
|
||||
else
|
||||
$id=$_GET['id'];
|
||||
$q=mysql_query("SELECT * FROM projectdivisionsselector WHERE id='$id'");
|
||||
$r=mysql_fetch_object($q);
|
||||
echo i18n($r->question);
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
echo "<table align=\"center\">";
|
||||
echo "<tr><td>";
|
||||
echo "<form method=\"get\" action=\"".$_SERVER['PHP_SELF']."\">\n";
|
||||
if($r->no_type=="question")
|
||||
echo "<input type=\"hidden\" name=\"id\" value=\"$r->no\">\n";
|
||||
if($r->no_type=="division")
|
||||
echo "<input type=\"hidden\" name=\"division\" value=\"$r->no\">\n";
|
||||
echo "<input style=\"width: 100px;\" type=\"submit\" value=\"No\">";
|
||||
echo "</form>\n";
|
||||
echo "</td><td width=\"50\">";
|
||||
echo " </td><td>";
|
||||
echo "<form method=\"get\" action=\"".$_SERVER['PHP_SELF']."\">\n";
|
||||
if($r->yes_type=="question")
|
||||
echo "<input type=\"hidden\" name=\"id\" value=\"$r->yes\">\n";
|
||||
if($r->yes_type=="division")
|
||||
echo "<input type=\"hidden\" name=\"division\" value=\"$r->yes\">\n";
|
||||
echo "<input style=\"width: 100px;\" type=\"submit\" value=\"Yes\">";
|
||||
echo "</form>\n";
|
||||
echo "</td></tr></table>";
|
||||
|
||||
}
|
||||
echo "</div>";
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user