forked from science-ation/science-ation
- refactor duplicate code in main, create an ouputStatus function to do the work
- add participants project file - add checks for project completeness - add new status 'empty' for if the section has not been started yet
This commit is contained in:
parent
4e4df1e48d
commit
3a212ae5d5
@ -168,6 +168,7 @@ echo "<h1>".i18n($config['fairname'])."</h1>";
|
|||||||
|
|
||||||
<div id="left">
|
<div id="left">
|
||||||
<ul class="mainnav">
|
<ul class="mainnav">
|
||||||
|
<li><a href="<?=$config['SFIABDIRECTORY']?>/index.php"><?=i18n("Home Page")?></a></li>
|
||||||
<li><a href="<?=$config['SFIABDIRECTORY']?>/register_participants.php"><?=i18n("Participant Registration")?></a></li>
|
<li><a href="<?=$config['SFIABDIRECTORY']?>/register_participants.php"><?=i18n("Participant Registration")?></a></li>
|
||||||
<li><a href="<?=$config['SFIABDIRECTORY']?>/register_judges.php"><?=i18n("Judges Registration")?></a></li>
|
<li><a href="<?=$config['SFIABDIRECTORY']?>/register_judges.php"><?=i18n("Judges Registration")?></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -1,4 +1,32 @@
|
|||||||
<?
|
<?
|
||||||
|
function outputStatus($status)
|
||||||
|
{
|
||||||
|
$ret="";
|
||||||
|
switch($status)
|
||||||
|
{
|
||||||
|
case 'incomplete':
|
||||||
|
$ret.="<div class=\"incomplete\">";
|
||||||
|
$ret.= i18n("Incomplete");
|
||||||
|
$ret.= "</div>";
|
||||||
|
break;
|
||||||
|
case 'complete':
|
||||||
|
$ret.= "<div class=\"complete\">";
|
||||||
|
$ret.= i18n("Complete");
|
||||||
|
$ret.= "</div>";
|
||||||
|
break;
|
||||||
|
case 'empty':
|
||||||
|
$ret.="<div class=\"incomplete\">";
|
||||||
|
$ret.= i18n("Empty");
|
||||||
|
$ret.= "</div>";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$ret.=i18n("Unknown");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
function studentStatus()
|
function studentStatus()
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
@ -6,6 +34,36 @@ function studentStatus()
|
|||||||
|
|
||||||
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
|
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
|
||||||
|
|
||||||
|
//if we dont have the minimum, return incomplete
|
||||||
|
if(mysql_num_rows($q)<$config['minstudentsperproject'])
|
||||||
|
return "incomplete";
|
||||||
|
|
||||||
|
while($r=mysql_fetch_object($q))
|
||||||
|
{
|
||||||
|
foreach ($required_fields AS $req)
|
||||||
|
{
|
||||||
|
if(!$r->$req)
|
||||||
|
{
|
||||||
|
return "incomplete";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//if it made it through without returning incomplete, then we must be complete
|
||||||
|
return "complete";
|
||||||
|
}
|
||||||
|
|
||||||
|
function projectStatus()
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
$required_fields=array("title","projectcategories_id","projectdivisions_id","summary","language");
|
||||||
|
|
||||||
|
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
|
||||||
|
|
||||||
|
//if we dont have a project entry yet, return empty
|
||||||
|
if(!mysql_num_rows($q))
|
||||||
|
return "empty";
|
||||||
|
|
||||||
while($r=mysql_fetch_object($q))
|
while($r=mysql_fetch_object($q))
|
||||||
{
|
{
|
||||||
foreach ($required_fields AS $req)
|
foreach ($required_fields AS $req)
|
||||||
|
@ -48,28 +48,22 @@ echo "<a href=\"register_participants_students.php\">";
|
|||||||
echo i18n("Student Information");
|
echo i18n("Student Information");
|
||||||
echo "</a>";
|
echo "</a>";
|
||||||
echo "</td><td>";
|
echo "</td><td>";
|
||||||
$status=studentStatus();
|
|
||||||
switch($status)
|
|
||||||
{
|
|
||||||
case 'incomplete':
|
|
||||||
echo "<div class=\"incomplete\">";
|
|
||||||
echo i18n("Incomplete");
|
|
||||||
echo "</div>";
|
|
||||||
break;
|
|
||||||
case 'complete':
|
|
||||||
echo "<div class=\"complete\">";
|
|
||||||
echo i18n("Complete");
|
|
||||||
echo "</div>";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//check to see if its complete
|
//check to see if its complete
|
||||||
|
$status=studentStatus();
|
||||||
|
echo outputStatus($status);
|
||||||
echo "</td></tr>";
|
echo "</td></tr>";
|
||||||
|
|
||||||
//project information
|
//project information
|
||||||
echo "<tr><td>".i18n("Project Information")."</td><td>";
|
echo "<tr><td>";
|
||||||
|
echo "<a href=\"register_participants_project.php\">";
|
||||||
|
echo "".i18n("Project Information");
|
||||||
|
echo "</a>";
|
||||||
|
echo "</td><td>";
|
||||||
//check to see if its complete
|
//check to see if its complete
|
||||||
|
$status=projectStatus();
|
||||||
|
echo outputStatus($status);
|
||||||
|
|
||||||
|
|
||||||
echo "</td></tr>";
|
echo "</td></tr>";
|
||||||
|
|
||||||
//safety information
|
//safety information
|
||||||
|
39
register_participants_project.php
Normal file
39
register_participants_project.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?
|
||||||
|
require("common.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;
|
||||||
|
|
||||||
|
}
|
||||||
|
$r=mysql_fetch_object($q);
|
||||||
|
|
||||||
|
send_header("Participant Registration - Project Information");
|
||||||
|
echo "<a href=\"register_participants_main.php\"><< ".i18n("Back to Participant Registration Summary")."</a><br />";
|
||||||
|
echo "<br /><br />";
|
||||||
|
|
||||||
|
|
||||||
|
send_footer();
|
||||||
|
?>
|
Loading…
Reference in New Issue
Block a user