forked from science-ation/science-ation
125 lines
2.8 KiB
PHP
125 lines
2.8 KiB
PHP
<?
|
|
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()
|
|
{
|
|
global $config;
|
|
$required_fields=array("firstname","lastname","address","city","postalcode","phone","email","grade","dateofbirth","schools_id","tshirt");
|
|
|
|
$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","req_table","req_electricity");
|
|
|
|
$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))
|
|
{
|
|
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 mentorStatus()
|
|
{
|
|
global $config;
|
|
$required_fields=array("firstname","lastname","phone","email","organization","description");
|
|
|
|
|
|
//first check the registrations table to see if 'nummentors' is set, or if its null
|
|
$q=mysql_query("SELECT nummentors FROM registrations WHERE id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
|
|
$r=mysql_fetch_object($q);
|
|
if($r->nummentors==null)
|
|
return "incomplete";
|
|
|
|
$q=mysql_query("SELECT * FROM mentors WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
|
|
|
|
//if we dont have the minimum, return incomplete
|
|
if(mysql_num_rows($q)<$config['minmentorserproject'])
|
|
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 safetyStatus()
|
|
{
|
|
return "incomplete";
|
|
|
|
}
|
|
|
|
|
|
?>
|