add the ability to show ALL or only UNASSIGNED projects when assigning projects to judging teams timeslots

This commit is contained in:
james 2005-04-21 17:00:49 +00:00
parent 4c1fbba348
commit 3120d31841

View File

@ -49,6 +49,12 @@ function assign(ts)
if($_GET['edit']) $edit=$_GET['edit'];
else if($_POST['edit']) $edit=$_POST['edit'];
if(!$_SESSION['viewstate']['judges_projects_list_show'])
$_SESSION['viewstate']['judges_projects_list_show']='unassigned';
//now update the judges_teams_list_show viewstate
if($_GET['judges_projects_list_show'])
$_SESSION['viewstate']['judges_projects_list_show']=$_GET['judges_projects_list_show'];
if($_GET['action']=="delete" && $_GET['delete'] && $_GET['edit'])
{
@ -96,8 +102,50 @@ function assign(ts)
echo $memberlist;
echo "<br />";
/*
if($_SESSION['viewstate']['judges_teams_list_show']=='all')
{
$querystr="SELECT
judges.id,
judges.firstname,
judges.lastname
FROM
judges,
judges_years
WHERE
judges_years.year='".$config['FAIRYEAR']."' AND
judges.id=judges_years.judges_id AND
judges.complete='yes'
ORDER BY
lastname,
firstname";
}
else
{
$querystr="SELECT
judges.id,
judges.firstname,
judges.lastname,
judges_teams_link.judges_id
FROM
judges
LEFT JOIN judges_teams_link ON judges.id = judges_teams_link.judges_id,
judges_years
WHERE
judges_years.year='".$config['FAIRYEAR']."' AND
judges.id=judges_years.judges_id AND
judges_teams_link.judges_id IS NULL AND
judges.complete='yes'
ORDER BY
lastname,
firstname";
}
$q=mysql_query("SELECT
*/
if($_SESSION['viewstate']['judges_projects_list_show']=='all')
{
$querystr="SELECT
projects.id,
projects.projectnumber,
projects.title,
@ -111,11 +159,49 @@ function assign(ts)
projects.registrations_id=registrations.id AND
projects.year='".$config['FAIRYEAR']."'
ORDER BY
projectnumber
");
echo mysql_error();
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')
{
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>&nbsp;</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))
@ -123,7 +209,10 @@ function assign(ts)
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>";
//get the timeslots that this team has.
@ -189,7 +278,7 @@ function assign(ts)
echo mysql_Error();
while($proj=mysql_fetch_object($projq))
{
echo "<a onclick=\"return confirmClick('Are you sure you want to remove this project from the team?')\" 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 "<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 />";
}