Put languages on special award team titles

Show active in judge info
This commit is contained in:
james 2011-03-30 21:40:50 +00:00
parent c29df673a6
commit 2ac4c799a9
5 changed files with 99 additions and 6 deletions

View File

@ -88,7 +88,7 @@ function getJudgingTeams()
FROM judges_teams_timeslots_projects_link FROM judges_teams_timeslots_projects_link
LEFT JOIN projects ON judges_teams_timeslots_projects_link.projects_id=projects.id LEFT JOIN projects ON judges_teams_timeslots_projects_link.projects_id=projects.id
WHERE judges_teams_timeslots_projects_link.year='{$config['FAIRYEAR']}' AND WHERE judges_teams_timeslots_projects_link.year='{$config['FAIRYEAR']}' AND
judges_teams_id='$r->id' "); judges_teams_id='$r->id' AND language!='' ");
echo mysql_error(); echo mysql_error();
$projectlangs=array(); $projectlangs=array();
while($lr=mysql_fetch_object($lq)) { while($lr=mysql_fetch_object($lq)) {

View File

@ -122,6 +122,7 @@ echo '<div style="text-align:left">';
// is their info complete? // is their info complete?
$completeText = $judgeinfo['complete']=="yes" ? "Yes" : "No"; $completeText = $judgeinfo['complete']=="yes" ? "Yes" : "No";
$activeText = $judgeinfo['active']=="yes" ? "Yes" : "No";
// find out if they've signed up for judging any special awards // find out if they've signed up for judging any special awards
$specialAwardsText = ""; $specialAwardsText = "";
@ -156,6 +157,9 @@ $catPreferenceText .= "</ul>";
<tr><td> <tr><td>
<ul> <ul>
<li><strong><?="Active for {$config['FAIRYEAR']}";?>: </strong>
<?=$activeText;?></li>
<li><strong><?="Complete for {$config['FAIRYEAR']}";?>: </strong> <li><strong><?="Complete for {$config['FAIRYEAR']}";?>: </strong>
<?=$completeText;?></li> <?=$completeText;?></li>

View File

@ -1042,11 +1042,12 @@ if($config['scheduler_enable_sa_scheduling'] == 'yes') {
$required_judges = 0; $required_judges = 0;
while($i = mysql_fetch_object($r)) { while($i = mysql_fetch_object($r)) {
$projects = getProjectsNominatedForSpecialAward($i->id); $projects = getProjectsNominatedForSpecialAward($i->id);
$languages = getLanguagesOfProjectsNominatedForSpecialAward($i->id);
/* Construct an internal team for annealing, and create /* Construct an internal team for annealing, and create
* a DB team too */ * a DB team too */
$sa_jteam[$x]['num'] = next_judges_teams_number(); $sa_jteam[$x]['num'] = next_judges_teams_number();
$sa_jteam[$x]['id'] = judge_team_create($sa_jteam[$x]['num'], $i->name); $sa_jteam[$x]['id'] = judge_team_create($sa_jteam[$x]['num'], $i->name." (".implode(" ",$languages).")");
/* Note, we use $x instead of the ID, because the DB id could be zero. */ /* Note, we use $x instead of the ID, because the DB id could be zero. */
$sa_jteam[$x]['projects'] = $projects; $sa_jteam[$x]['projects'] = $projects;
$sa_jteam[$x]['round'] = NULL; $sa_jteam[$x]['round'] = NULL;

View File

@ -322,6 +322,7 @@ jQuery(document).ready(function(){
echo "<input onclick=\"addbuttonclicked('".$team['num']."')\" type=\"button\" value=\"Add &gt;&gt;\">"; echo "<input onclick=\"addbuttonclicked('".$team['num']."')\" type=\"button\" value=\"Add &gt;&gt;\">";
echo "</td><td>"; echo "</td><td>";
echo "<table width=\"100%\">\n"; echo "<table width=\"100%\">\n";
echo "<tr><th colspan=\"2\" align=\"left\">#".$team['num'].": "; echo "<tr><th colspan=\"2\" align=\"left\">#".$team['num'].": ";
echo $team['name']; echo $team['name'];
@ -336,18 +337,40 @@ jQuery(document).ready(function(){
foreach($team['members'] AS $member) { foreach($team['members'] AS $member) {
$j = &$judgelist[$member['id']]; $j = &$judgelist[$member['id']];
echo "<tr><td>"; echo "<tr><td>";
/*
if($team['num']=="89") {
echo "<pre>";
print_r($team);
print_r($j);
echo "</pre>";
}
*/
$langerr=false; $langerr=false;
$judgeerr=false;
foreach($team['languages'] AS $teamlang) { foreach($team['languages'] AS $teamlang) {
if(!in_array($teamlang,$j['languages'])) { if(is_array($j['languages'])) {
if(!in_array($teamlang,$j['languages'])) {
$langerr=true;
break;
}
} else {
$langerr=true; $langerr=true;
break;
} }
} }
if(!$j['id']) {
$judgeerr=true;
}
echo "<a onclick=\"return confirmClick('Are you sure you want to remove this judge from this team?')\" href=\"judges_teams_members.php?action=del&team_id=".$team['id']."&team_num=".$team['num']."&users_id=".$member['id']."&team_name=".rawurlencode($team['name'])."\"><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 judge from this team?')\" href=\"judges_teams_members.php?action=del&team_id=".$team['id']."&team_num=".$team['num']."&users_id=".$member['id']."&team_name=".rawurlencode($team['name'])."\"><img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
echo "</td><td width=\"100%\">"; echo "</td><td width=\"100%\">";
if($langerr) echo "<span class=\"error\" style=\"width: 100%; display: block;\">"; if($langerr || $judgeerr) echo "<span class=\"error\" style=\"width: 100%; display: block;\">";
if($judgeerr) {
echo "ERROR: this judge is assigned to the team, but they are not an active/complete judge! <br />";
}
if($member['captain']=="yes") { if($member['captain']=="yes") {
echo "<a title=\"Captain - Click to remove captain status\" href=\"judges_teams_members.php?action=removecaptain&team_id=".$team['id']."&judge_id=".$member['id']."\">"; echo "<a title=\"Captain - Click to remove captain status\" href=\"judges_teams_members.php?action=removecaptain&team_id=".$team['id']."&judge_id=".$member['id']."\">";
echo "<img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/bookmark.".$config['icon_extension']."\">"; echo "<img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/bookmark.".$config['icon_extension']."\">";
@ -366,7 +389,7 @@ jQuery(document).ready(function(){
$l = is_array($j['languages']) ? join(' ',$j['languages']) : ''; $l = is_array($j['languages']) ? join(' ',$j['languages']) : '';
echo "</a>&nbsp;<span style=\"font-size: 1.0em;\">($l)</span>\n"; echo "</a>&nbsp;<span style=\"font-size: 1.0em;\">($l)</span>\n";
if($langerr) echo "</span>\n"; if($langerr || $judgeerr) echo "</span>\n";
echo "</td></tr>"; echo "</td></tr>";
} }

View File

@ -63,6 +63,35 @@ function getProjectsEligibleForAward($award_id)
return $projects; return $projects;
} }
function getLanguagesOfProjectsEligibleForAward($award_id)
{
global $config;
$prjq=mysql_query("SELECT DISTINCT(projects.language) AS language
FROM
award_awards,
award_awards_projectcategories,
award_awards_projectdivisions,
projects
WHERE
award_awards.id='$award_id'
AND award_awards.id=award_awards_projectcategories.award_awards_id
AND award_awards.id=award_awards_projectdivisions.award_awards_id
AND projects.projectcategories_id=award_awards_projectcategories.projectcategories_id
AND projects.projectdivisions_id=award_awards_projectdivisions.projectdivisions_id
AND projects.projectnumber is not null
AND projects.year='".$config['FAIRYEAR']."'
ORDER BY
language
");
$languages=array();
while($r=mysql_fetch_object($prjq)) {
if($r->language)
$languages[]=$r->language;
}
return $languages;
}
function getProjectsEligibleOrNominatedForAwards($awards_ids_array) function getProjectsEligibleOrNominatedForAwards($awards_ids_array)
{ {
$projects=array(); $projects=array();
@ -202,6 +231,7 @@ function getProjectsNominatedForSpecialAward($award_id)
$prjq=mysql_query("SELECT $prjq=mysql_query("SELECT
projects.projectnumber, projects.projectnumber,
projects.title, projects.title,
projects.language,
projects.id AS projects_id projects.id AS projects_id
FROM FROM
project_specialawards_link, project_specialawards_link,
@ -220,6 +250,7 @@ function getProjectsNominatedForSpecialAward($award_id)
$projects[$prjr->projectnumber]=array( $projects[$prjr->projectnumber]=array(
"id"=>$prjr->projects_id, "id"=>$prjr->projects_id,
"projectnumber"=>$prjr->projectnumber, "projectnumber"=>$prjr->projectnumber,
"language"=>$prjr->language,
"title"=>$prjr->title "title"=>$prjr->title
); );
} }
@ -233,6 +264,40 @@ function getProjectsNominatedForSpecialAward($award_id)
} }
} }
function getLanguagesOfProjectsNominatedForSpecialAward($award_id)
{
global $config;
//if they dont use special award nominations, then we will instead get all of the projects that
//are eligible for the award, instead of nominated for it.
if($config['specialawardnomination']!="none") {
$prjq=mysql_query("SELECT DISTINCT(projects.language) AS language
FROM
project_specialawards_link,
projects
WHERE
project_specialawards_link.award_awards_id='$award_id'
AND project_specialawards_link.projects_id=projects.id
AND projects.projectnumber is not null
AND projects.year='".$config['FAIRYEAR']."'
ORDER BY language
");
$languages=array();
while($r=mysql_fetch_object($prjq)) {
//dont count "" as a language, if the project doesnt have a language specified too bad they're up shit creek without a paddle
if($r->langauge) {
$languages[]=$r->language;
}
}
return $languages;
}
else {
//return the projects that are eligible for the award instead
return getLanguagesOfProjectsEligibleForAward($award_id);
}
}
function getSpecialAwardsNominatedByRegistrationID($id) function getSpecialAwardsNominatedByRegistrationID($id)
{ {
global $config; global $config;