forked from science-ation/science-ation
get teams project assignments ready to handle only displalying projects that are eligible for the awards that are assigned to that team
This commit is contained in:
parent
7af110337a
commit
1476031aea
@ -34,6 +34,18 @@ function assign(ts)
|
||||
document.forms.teamsprojects.timeslot.value=ts;
|
||||
document.forms.teamsprojects.submit();
|
||||
}
|
||||
|
||||
function eligibleclick()
|
||||
{
|
||||
if(document.forms.teamsprojects.showeligible.checked)
|
||||
{
|
||||
window.location.href="judges_teams_projects.php?action=edit&edit="+document.forms.teamsprojects.edit.value+"&judges_projects_list_eligible=true";
|
||||
}
|
||||
else
|
||||
{
|
||||
window.location.href="judges_teams_projects.php?action=edit&edit="+document.forms.teamsprojects.edit.value+"&judges_projects_list_eligible=false";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<?
|
||||
@ -55,6 +67,12 @@ if(!$_SESSION['viewstate']['judges_projects_list_show'])
|
||||
if($_GET['judges_projects_list_show'])
|
||||
$_SESSION['viewstate']['judges_projects_list_show']=$_GET['judges_projects_list_show'];
|
||||
|
||||
if(!$_SESSION['viewstate']['judges_projects_list_eligible'])
|
||||
$_SESSION['viewstate']['judges_projects_list_eligible']='true';
|
||||
//now update the judges_teams_list_show viewstate
|
||||
if($_GET['judges_projects_list_eligible'])
|
||||
$_SESSION['viewstate']['judges_projects_list_eligible']=$_GET['judges_projects_list_eligible'];
|
||||
|
||||
|
||||
if($_GET['action']=="delete" && $_GET['delete'] && $_GET['edit'])
|
||||
{
|
||||
@ -87,91 +105,43 @@ if( ($action=="edit" || $action=="assign" ) && $edit)
|
||||
$team=getJudgingTeam($edit);
|
||||
|
||||
echo "<b>".$team['name']." (#".$team['num'].")</b><br />";
|
||||
$memberlist=" ";
|
||||
foreach($team['members'] AS $member)
|
||||
if(count($team['members']))
|
||||
{
|
||||
if($member['captain']=="yes")
|
||||
$memberlist.="<i>";
|
||||
$memberlist.=$member['firstname']." ".$member['lastname'];
|
||||
if($member['captain']=="yes")
|
||||
$memberlist.="</i>";
|
||||
$memberlist.=", ";
|
||||
$memberlist=" ";
|
||||
foreach($team['members'] AS $member)
|
||||
{
|
||||
if($member['captain']=="yes")
|
||||
$memberlist.="<i>";
|
||||
$memberlist.=$member['firstname']." ".$member['lastname'];
|
||||
if($member['captain']=="yes")
|
||||
$memberlist.="</i>";
|
||||
$memberlist.=", ";
|
||||
}
|
||||
echo "<b>".i18n("Judging Team Members").": </b>";
|
||||
$memberlist=substr($memberlist,0,-2);
|
||||
echo "<br />";
|
||||
}
|
||||
$memberlist=substr($memberlist,0,-2);
|
||||
else
|
||||
$memberlist=error(i18n("Team has no members assigned to it. <a href=\"judges_teams_members.php\">Assign Judges Here</a>"));
|
||||
echo $memberlist;
|
||||
echo "<br />";
|
||||
|
||||
if($_SESSION['viewstate']['judges_projects_list_show']=='all')
|
||||
{
|
||||
$querystr="SELECT
|
||||
projects.id,
|
||||
projects.projectnumber,
|
||||
projects.title,
|
||||
registrations.status
|
||||
FROM
|
||||
projects,
|
||||
registrations
|
||||
WHERE
|
||||
projectnumber is not null AND
|
||||
registrations.status='complete' AND
|
||||
projects.registrations_id=registrations.id AND
|
||||
projects.year='".$config['FAIRYEAR']."'
|
||||
ORDER BY
|
||||
projectnumber";
|
||||
}
|
||||
else
|
||||
{
|
||||
$querystr="SELECT
|
||||
projects.id,
|
||||
projects.projectnumber,
|
||||
projects.title,
|
||||
registrations.status
|
||||
FROM
|
||||
projects
|
||||
LEFT JOIN judges_teams_timeslots_projects_link ON projects.id = judges_teams_timeslots_projects_link.projects_id,
|
||||
registrations
|
||||
WHERE
|
||||
projectnumber is not null AND
|
||||
registrations.status='complete' AND
|
||||
projects.registrations_id=registrations.id AND
|
||||
judges_teams_timeslots_projects_link.projects_id IS NULL AND
|
||||
projects.year='".$config['FAIRYEAR']."'
|
||||
ORDER BY
|
||||
projectnumber";
|
||||
}
|
||||
$q=mysql_query($querystr);
|
||||
echo mysql_error();
|
||||
$numprojects=mysql_num_rows($q);
|
||||
|
||||
echo "<br />";
|
||||
echo "<table>";
|
||||
echo "<tr>";
|
||||
if($_SESSION['viewstate']['judges_projects_list_show']=='all')
|
||||
|
||||
if(count($team['awards']))
|
||||
{
|
||||
echo "<td align=left><a href=\"judges_teams_projects.php?action=$action&edit=$edit&judges_projects_list_show=unassigned\">".i18n("show unassigned")."</a></td>";
|
||||
echo "<td align=right><b>".i18n("show all")."</b></td>";
|
||||
$awardlist=" ";
|
||||
foreach($team['awards'] AS $award)
|
||||
{
|
||||
$awardlist.=$award['name'];
|
||||
$awardlist.=", ";
|
||||
}
|
||||
echo "<b>".i18n("Judging Team Awards").": </b>";
|
||||
$awardlist=substr($awardlist,0,-2);
|
||||
echo "<br />";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<td align=left><b>".i18n("show unassigned")."</b></td>";
|
||||
echo "<td align=right><a href=\"judges_teams_projects.php?action=$action&edit=$edit&judges_projects_list_show=all\">".i18n("show all")."</a></td>";
|
||||
|
||||
}
|
||||
echo "<td> </td>";
|
||||
echo "</tr>";
|
||||
echo "<tr><td colspan=2>";
|
||||
echo "<select name=\"project_id\">";
|
||||
echo "<option value=\"\">Choose Project to Assign to Timeslot</option>\n";
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
echo "<option value=\"$r->id\">$r->projectnumber - $r->title</option>\n";
|
||||
}
|
||||
echo "</select>";
|
||||
echo "</td><td>";
|
||||
echo "$numprojects projects listed";
|
||||
echo "</td></tr>";
|
||||
echo "</table>";
|
||||
|
||||
$awardlist=error(i18n("Team has no awards assigned to it. <a href=\"judges_teams.php\">Assign Awards Here</a>"));
|
||||
echo $awardlist;
|
||||
|
||||
//get the timeslots that this team has.
|
||||
$q=mysql_query("SELECT
|
||||
@ -193,59 +163,146 @@ if( ($action=="edit" || $action=="assign" ) && $edit)
|
||||
|
||||
|
||||
$numslots=mysql_num_rows($q);
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
|
||||
echo "<table class=\"summarytable\">";
|
||||
echo "<tr>";
|
||||
echo "<th>Timeslot</th>";
|
||||
echo "<th>Project</th>";
|
||||
echo "</tr>";
|
||||
|
||||
|
||||
while($r=mysql_fetch_object($q))
|
||||
if($numslots)
|
||||
{
|
||||
echo "<tr><td>";
|
||||
|
||||
echo "<nobr>";
|
||||
if($show_date)
|
||||
echo "$r->date ";
|
||||
echo substr($r->starttime,0,-3);
|
||||
echo " - ";
|
||||
echo substr($r->endtime,0,-3);
|
||||
echo "</nobr>";
|
||||
echo "</td><td>";
|
||||
|
||||
$projq=mysql_query("SELECT
|
||||
judges_teams_timeslots_projects_link.id AS link_id,
|
||||
projects.projectnumber,
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
if($_SESSION['viewstate']['judges_projects_list_eligible']=='true')
|
||||
$ch="checked=\"checked\"";
|
||||
else
|
||||
$ch="";
|
||||
|
||||
echo "<input $ch onclick=\"eligibleclick()\" type=\"checkbox\" name=\"showeligible\"> Show only projects eligible for awards assigned to this team";
|
||||
echo "<table>";
|
||||
echo "</tr>";
|
||||
|
||||
echo "<tr>";
|
||||
if($_SESSION['viewstate']['judges_projects_list_show']=='all')
|
||||
{
|
||||
echo "<td align=left><a href=\"judges_teams_projects.php?action=$action&edit=$edit&judges_projects_list_show=unassigned\">".i18n("show unassigned")."</a></td>";
|
||||
echo "<td align=right><b>".i18n("show all")."</b></td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<td align=left><b>".i18n("show unassigned")."</b></td>";
|
||||
echo "<td align=right><a href=\"judges_teams_projects.php?action=$action&edit=$edit&judges_projects_list_show=all\">".i18n("show all")."</a></td>";
|
||||
}
|
||||
echo "<td> </td>";
|
||||
echo "</tr>";
|
||||
echo "<tr><td colspan=2>";
|
||||
|
||||
if($_SESSION['viewstate']['judges_projects_list_show']=='all')
|
||||
{
|
||||
$querystr="SELECT
|
||||
projects.id,
|
||||
projects.title
|
||||
projects.projectnumber,
|
||||
projects.title,
|
||||
registrations.status
|
||||
FROM
|
||||
projects,
|
||||
judges_teams_timeslots_projects_link
|
||||
registrations
|
||||
WHERE
|
||||
judges_teams_timeslots_projects_link.judges_timeslots_id='$r->id' AND
|
||||
judges_teams_timeslots_projects_link.judges_teams_id='".$team['id']."' AND
|
||||
judges_teams_timeslots_projects_link.projects_id=projects.id AND
|
||||
judges_teams_timeslots_projects_link.year='".$config['FAIRYEAR']."'
|
||||
projectnumber is not null AND
|
||||
registrations.status='complete' AND
|
||||
projects.registrations_id=registrations.id AND
|
||||
projects.year='".$config['FAIRYEAR']."'
|
||||
ORDER BY
|
||||
projectnumber
|
||||
");
|
||||
|
||||
echo mysql_Error();
|
||||
while($proj=mysql_fetch_object($projq))
|
||||
{
|
||||
echo "<a onclick=\"return confirmClick('Are you sure you want to remove this project from this team timeslot?')\" href=\"judges_teams_projects.php?action=delete&delete=".$proj->link_id."&edit=".$team['id']."\"><img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
|
||||
echo "$proj->projectnumber - $proj->title <br />";
|
||||
|
||||
projectnumber";
|
||||
}
|
||||
echo "<input name=\"assignbtn[$r->id]\" type=\"button\" onclick=\"assign('$r->id')\" value=\"Assign\">";
|
||||
else if($_SESSION['viewstate']['judges_projects_list_show']=='unassigned')
|
||||
{
|
||||
$querystr="SELECT
|
||||
projects.id,
|
||||
projects.projectnumber,
|
||||
projects.title,
|
||||
registrations.status
|
||||
FROM
|
||||
projects
|
||||
LEFT JOIN judges_teams_timeslots_projects_link ON projects.id = judges_teams_timeslots_projects_link.projects_id,
|
||||
registrations
|
||||
WHERE
|
||||
projectnumber is not null AND
|
||||
registrations.status='complete' AND
|
||||
projects.registrations_id=registrations.id AND
|
||||
judges_teams_timeslots_projects_link.projects_id IS NULL AND
|
||||
projects.year='".$config['FAIRYEAR']."'
|
||||
ORDER BY
|
||||
projectnumber";
|
||||
}
|
||||
$pq=mysql_query($querystr);
|
||||
echo mysql_error();
|
||||
$numprojects=mysql_num_rows($pq);
|
||||
|
||||
echo "<select name=\"project_id\">";
|
||||
echo "<option value=\"\">Choose Project to Assign to Timeslot</option>\n";
|
||||
while($pr=mysql_fetch_object($pq))
|
||||
{
|
||||
echo "<option value=\"$pr->id\">$pr->projectnumber - $pr->title</option>\n";
|
||||
}
|
||||
echo "</select>";
|
||||
echo "</td><td>";
|
||||
echo "$numprojects projects listed";
|
||||
echo "</td></tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
echo "</table>";
|
||||
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
|
||||
echo "<table class=\"summarytable\">";
|
||||
echo "<tr>";
|
||||
echo "<th>Timeslot</th>";
|
||||
echo "<th>Project</th>";
|
||||
echo "</tr>";
|
||||
|
||||
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
echo "<tr><td>";
|
||||
|
||||
echo "<nobr>";
|
||||
if($show_date)
|
||||
echo "$r->date ";
|
||||
echo substr($r->starttime,0,-3);
|
||||
echo " - ";
|
||||
echo substr($r->endtime,0,-3);
|
||||
echo "</nobr>";
|
||||
echo "</td><td>";
|
||||
|
||||
$projq=mysql_query("SELECT
|
||||
judges_teams_timeslots_projects_link.id AS link_id,
|
||||
projects.projectnumber,
|
||||
projects.id,
|
||||
projects.title
|
||||
FROM
|
||||
projects,
|
||||
judges_teams_timeslots_projects_link
|
||||
WHERE
|
||||
judges_teams_timeslots_projects_link.judges_timeslots_id='$r->id' AND
|
||||
judges_teams_timeslots_projects_link.judges_teams_id='".$team['id']."' AND
|
||||
judges_teams_timeslots_projects_link.projects_id=projects.id AND
|
||||
judges_teams_timeslots_projects_link.year='".$config['FAIRYEAR']."'
|
||||
ORDER BY
|
||||
projectnumber
|
||||
");
|
||||
|
||||
echo mysql_Error();
|
||||
while($proj=mysql_fetch_object($projq))
|
||||
{
|
||||
echo "<a onclick=\"return confirmClick('Are you sure you want to remove this project from this team timeslot?')\" href=\"judges_teams_projects.php?action=delete&delete=".$proj->link_id."&edit=".$team['id']."\"><img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
|
||||
echo "$proj->projectnumber - $proj->title <br />";
|
||||
|
||||
}
|
||||
echo "<input name=\"assignbtn[$r->id]\" type=\"button\" onclick=\"assign('$r->id')\" value=\"Assign\">";
|
||||
|
||||
echo "</td></tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo error(i18n("Team has no timeslots assigned to it. <a href=\"judges_teams_timeslots.php\">Assign Timeslots Here</a>"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user