forked from science-ation/science-ation
more code to add projects to the teams
This commit is contained in:
parent
57ec92392a
commit
e812d1d783
@ -29,45 +29,13 @@
|
|||||||
send_header("Judging Teams Projects");
|
send_header("Judging Teams Projects");
|
||||||
?>
|
?>
|
||||||
<script language="javascript" type="text/javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
function checkall(what)
|
function assign(ts)
|
||||||
{
|
{
|
||||||
for(i=0;i<document.forms.teamstimeslots.elements.length;i++)
|
document.forms.teamsprojects.timeslot.value=ts;
|
||||||
{
|
document.forms.teamsprojects.submit();
|
||||||
if(document.forms.teamstimeslots.elements[i].name==what+"[]")
|
|
||||||
document.forms.teamstimeslots.elements[i].checked=true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
function checknone(what)
|
|
||||||
{
|
|
||||||
for(i=0;i<document.forms.teamstimeslots.elements.length;i++)
|
|
||||||
{
|
|
||||||
if(document.forms.teamstimeslots.elements[i].name==what+"[]")
|
|
||||||
document.forms.teamstimeslots.elements[i].checked=false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
function checkinvert(what)
|
|
||||||
{
|
|
||||||
|
|
||||||
for(i=0;i<document.forms.teamstimeslots.elements.length;i++)
|
|
||||||
{
|
|
||||||
if(document.forms.teamstimeslots.elements[i].name==what+"[]")
|
|
||||||
document.forms.teamstimeslots.elements[i].checked=!document.forms.teamstimeslots.elements[i].checked;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?
|
<?
|
||||||
|
|
||||||
echo "<a href=\"index.php\"><< ".i18n("Back to Administration")."</a>\n";
|
echo "<a href=\"index.php\"><< ".i18n("Back to Administration")."</a>\n";
|
||||||
@ -75,38 +43,43 @@ function checkinvert(what)
|
|||||||
echo "<br />";
|
echo "<br />";
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
|
|
||||||
if($_GET['action']=="delete" && $_GET['delete'])
|
if($_GET['action']) $action=$_GET['action'];
|
||||||
|
else if($_POST['action']) $action=$_POST['action'];
|
||||||
|
|
||||||
|
if($_GET['edit']) $edit=$_GET['edit'];
|
||||||
|
else if($_POST['edit']) $edit=$_POST['edit'];
|
||||||
|
|
||||||
|
|
||||||
|
if($_GET['action']=="delete" && $_GET['delete'] && $_GET['edit'])
|
||||||
{
|
{
|
||||||
mysql_query("DELETE FROM judges_teams_timeslots_link WHERE id='".$_GET['delete']."'");
|
mysql_query("DELETE FROM judges_teams_timeslots_projects_link WHERE id='".$_GET['delete']."'");
|
||||||
echo happy(i18n("Judging team timeslot successfully removed"));
|
echo happy(i18n("Judging team project successfully removed"));
|
||||||
|
$action="edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if($_GET['action']=="empty" && $_GET['empty'])
|
if($_GET['action']=="empty" && $_GET['empty'])
|
||||||
{
|
{
|
||||||
mysql_query("DELETE FROM judges_teams_timeslots_link WHERE judges_teams_id='".$_GET['empty']."'");
|
mysql_query("DELETE FROM judges_teams_timeslots_link WHERE judges_teams_id='".$_GET['empty']."'");
|
||||||
echo happy(i18n("Judging team timeslots successfully removed"));
|
echo happy(i18n("Judging team timeslots successfully removed"));
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if($_POST['action']=="assign")
|
if($_POST['action']=="assign" && $_POST['edit'] && $_POST['timeslot'] && $_POST['project_id'])
|
||||||
{
|
{
|
||||||
//the db handles the uniqueness (to ensure the same timeslot isnt assigned to the same team more than once)
|
mysql_query("INSERT INTO judges_teams_timeslots_projects_link (judges_teams_id,judges_timeslots_id,projects_id,year) VALUES ('".$_POST['edit']."','".$_POST['timeslot']."','".$_POST['project_id']."','".$config['FAIRYEAR']."')");
|
||||||
//so all we'll do here is just mass insert without regards for whats already there.
|
echo happy(i18n("Project assigned to team timeslot"));
|
||||||
foreach($_POST['teams'] AS $tm)
|
|
||||||
{
|
|
||||||
foreach($_POST['timeslots'] AS $ts)
|
|
||||||
{
|
|
||||||
mysql_query("INSERT INTO judges_teams_timeslots_link (judges_teams_id,judges_timeslots_id,year) VALUES ('$tm','$ts','".$config['FAIRYEAR']."')");
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo happy(i18n("%1 Timeslots assigned to %2 teams",array(count($_POST['timeslots']),count($_POST['teams']))));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($_GET['action']=="edit" && $_GET['edit'])
|
if( ($action=="edit" || $action=="assign" ) && $edit)
|
||||||
{
|
{
|
||||||
echo "<form name=\"teamstimeslots\" method=\"post\" action=\"judges_teams_timeslots.php\">";
|
echo "<a href=\"judges_teams_projects.php\">Back to Judging Teams Projects List</a>";
|
||||||
$team=getJudgingTeam($_GET['edit']);
|
echo "<form name=\"teamsprojects\" method=\"post\" action=\"judges_teams_projects.php\">";
|
||||||
|
echo "<input type=\"hidden\" name=\"action\" value=\"assign\">\n";
|
||||||
|
echo "<input type=\"hidden\" name=\"edit\" value=\"$edit\">\n";
|
||||||
|
echo "<input type=\"hidden\" name=\"timeslot\" value=\"\">\n";
|
||||||
|
$team=getJudgingTeam($edit);
|
||||||
|
|
||||||
echo "<b>".$team['name']." (#".$team['num'].")</b><br />";
|
echo "<b>".$team['name']." (#".$team['num'].")</b><br />";
|
||||||
$memberlist=" ";
|
$memberlist=" ";
|
||||||
@ -187,14 +160,17 @@ function checkinvert(what)
|
|||||||
{
|
{
|
||||||
echo "<tr><td>";
|
echo "<tr><td>";
|
||||||
|
|
||||||
|
echo "<nobr>";
|
||||||
if($show_date)
|
if($show_date)
|
||||||
echo "$r->date ";
|
echo "$r->date ";
|
||||||
echo substr($r->starttime,0,-3);
|
echo substr($r->starttime,0,-3);
|
||||||
echo " - ";
|
echo " - ";
|
||||||
echo substr($r->endtime,0,-3);
|
echo substr($r->endtime,0,-3);
|
||||||
|
echo "</nobr>";
|
||||||
echo "</td><td>";
|
echo "</td><td>";
|
||||||
|
|
||||||
$projq=mysql_query("SELECT
|
$projq=mysql_query("SELECT
|
||||||
|
judges_teams_timeslots_projects_link.id AS link_id,
|
||||||
projects.projectnumber,
|
projects.projectnumber,
|
||||||
projects.id,
|
projects.id,
|
||||||
projects.title
|
projects.title
|
||||||
@ -213,9 +189,11 @@ function checkinvert(what)
|
|||||||
echo mysql_Error();
|
echo mysql_Error();
|
||||||
while($proj=mysql_fetch_object($projq))
|
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 "$proj->projectnumber - $proj->title <br />";
|
echo "$proj->projectnumber - $proj->title <br />";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
echo "<input name=\"assignbtn[$r->id]\" type=\"button\" onclick=\"assign('$r->id')\" value=\"Assign\">";
|
||||||
|
|
||||||
echo "</td></tr>";
|
echo "</td></tr>";
|
||||||
}
|
}
|
||||||
@ -257,7 +235,7 @@ function checkinvert(what)
|
|||||||
echo "<td>";
|
echo "<td>";
|
||||||
//get the timeslots that this team has.
|
//get the timeslots that this team has.
|
||||||
$q=mysql_query("SELECT
|
$q=mysql_query("SELECT
|
||||||
judges_teams_timeslots_link.id,
|
judges_timeslots.id,
|
||||||
judges_timeslots.date,
|
judges_timeslots.date,
|
||||||
judges_timeslots.starttime,
|
judges_timeslots.starttime,
|
||||||
judges_timeslots.endtime
|
judges_timeslots.endtime
|
||||||
@ -282,14 +260,37 @@ function checkinvert(what)
|
|||||||
{
|
{
|
||||||
echo "<tr><td>";
|
echo "<tr><td>";
|
||||||
|
|
||||||
|
echo "<nobr>";
|
||||||
if($show_date)
|
if($show_date)
|
||||||
echo "$r->date ";
|
echo "$r->date ";
|
||||||
|
|
||||||
echo substr($r->starttime,0,-3);
|
echo substr($r->starttime,0,-3);
|
||||||
echo " - ";
|
echo " - ";
|
||||||
echo substr($r->endtime,0,-3);
|
echo substr($r->endtime,0,-3);
|
||||||
|
echo "</nobr>";
|
||||||
echo "</td><td>";
|
echo "</td><td>";
|
||||||
|
|
||||||
//FIXME: list the projects :)
|
$projq=mysql_query("SELECT
|
||||||
|
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 "$proj->projectnumber - $proj->title <br />";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
echo "</td></tr>";
|
echo "</td></tr>";
|
||||||
|
Loading…
Reference in New Issue
Block a user