add judges info popup box, also new common functions send_popup_header and send_popup_footer

This commit is contained in:
james 2005-03-30 18:02:45 +00:00
parent 0545126b9d
commit 05a9ae0bf6
3 changed files with 277 additions and 3 deletions

210
admin/judges_info.php Normal file
View File

@ -0,0 +1,210 @@
<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
Copyright (C) 2005 James Grant <james@lightbox.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation, version 2.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
?>
<?
//this file is meant to be used as a popup from the judging teams page to view the judge info
//it needs the judge ID passed into it.
//thus, we do not need the normal header and footer
require("../common.inc.php");
auth_required('admin');
if($_GET['id'])
{
$q=mysql_query("SELECT
judges.*,
projectcategories.category AS catpref_name,
projectdivisions.division AS divpref_name
FROM
judges
LEFT JOIN projectcategories ON judges.catpref=projectcategories.id
LEFT JOIN projectdivisions ON judges.divpref=projectdivisions.id
WHERE
judges.id='".$_GET['id']."'");
echo mysql_error();
$judgeinfo=mysql_fetch_object($q);
send_popup_header(i18n("Judge Information - %1 %2",array($judgeinfo->firstname,$judgeinfo->lastname)));
echo "<h4>".i18n("Personal Info")."</h4>";
echo "<table>\n";
echo "<tr>\n";
echo " <td>".i18n("First Name")."</td><td>$judgeinfo->firstname</td>\n";
echo " <td>".i18n("Last Name")."</td><td>$judgeinfo->lastname</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td>".i18n("Email Address")."</td><td>$judgeinfo->email</td>\n";
echo " <td>".i18n("City")."</td><td>$judgeinfo->city</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td>".i18n("Address 1")."</td><td>$judgeinfo->address</td>\n";
echo " <td>".i18n("Province")."</td><td>$judgeinfo->province";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td>".i18n("Address 2")."</td><td>$judgeinfo->address2</td>\n";
echo " <td>".i18n("Phone (Home)")."</td><td>$judgeinfo->phonehome</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td>".i18n("Postal Code")."</td><td>$judgeinfo->postalcode</td>\n";
echo " <td>".i18n("Phone (Work)")."</td><td>$judgeinfo->phonework&nbsp;ext $judgeinfo->phoneworkext</td>\n";
echo "</tr>";
echo "<tr>\n";
echo " <td>".i18n("Organization")."</td><td>$judgeinfo->organization</td>\n";
echo " <td>".i18n("Phone (Cell)")."</td><td>$judgeinfo->phonecell</td>\n";
echo "</tr>";
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
echo "<tr>\n";
echo " <td colspan=\"2\">".i18n("Age category preference")."</td><td colspan=\"2\">";
echo "$judgeinfo->catpref_name";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan=\"2\">".i18n("Division preference")."</td><td colspan=\"2\">";
echo "$judgeinfo->divpref_name";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan=\"2\">".i18n("Highest post-secondary degree")."</td>";
echo " <td colspan=\"2\">$judgeinfo->highest_psd</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan=\"2\">".i18n("Other professional qualifications")."</td>";
echo " <td colspan=\"2\">$judgeinfo->professional_quals</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan=\"2\">".i18n("Languages")."</td>";
echo " <td colspan=\"2\">";
$q=mysql_query("SELECT languages_lang FROM judges_languages WHERE judges_id='$judgeinfo->id'");
while($r=mysql_fetch_object($q))
{
echo $r->languages_lang;
echo "<br />";
}
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan=\"2\">".i18n("Judging experience at school/local level")."</td>\n";
echo " <td colspan=\"2\">$judgeinfo->years_school ".i18n("years")."</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan=\"2\">".i18n("Judging experience at regional level")."</td>\n";
echo " <td colspan=\"2\">$judgeinfo->years_regional ".i18n("years")."</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan=\"2\">".i18n("Judging experience at national level")."</td>\n";
echo " <td colspan=\"2\">$judgeinfo->years_national ".i18n("years")."</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan=\"2\">".i18n("Willing to act as a division chair?")."</td>\n";
echo " <td colspan=\"2\">$judgeinfo->willing_chair";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan=\"2\">".i18n("Attending lunch?")."</td>\n";
echo " <td colspan=\"2\">$judgeinfo->attending_lunch";
echo "</tr>\n";
echo "</table>";
echo "<br />";
echo "<hr />";
echo "<br />";
echo "<h4>Areas of Expertise</h4>";
echo "<table>";
//grab the list of divisions, because the last fields of the table will be the sub-divisions
$q=mysql_query("SELECT * FROM projectdivisions ORDER BY id AND year='".$config['FAIRYEAR']."'");
$divs=array();
while($r=mysql_fetch_object($q))
{
$divs[]=$r->id;
$divnames[$r->id]=$r->division;
}
$subdivq=mysql_query("SELECT judges_expertise.*, projectsubdivisions.subdivision, projectsubdivisions.projectdivisions_id AS parent_id FROM judges_expertise
LEFT JOIN projectsubdivisions ON judges_expertise.projectsubdivisions_id=projectsubdivisions.id
WHERE judges_id='$judgeinfo->id' AND judges_expertise.year='".$config['FAIRYEAR']."' ORDER BY projectdivisions_id, projectsubdivisions_id");
$judge_divs=array();
$judge_subdivs=array();
$divdata=array();
while($subdivr=mysql_fetch_object($subdivq))
{
if($subdivr->projectdivisions_id)
{
$judge_divs[$subdivr->projectdivisions_id]=$subdivr->val;
}
else
$judge_subdivs[$subdivr->parent_id][]=$subdivr->subdivision;
}
foreach($divs as $div)
{
echo "<tr><td>".i18n($divnames[$div])."</td>";
echo " <td>".$judge_divs[$div]."/5</td>";
echo "<td>";
if(count($judge_subdivs[$div]))
{
$divdata=implode(",",$judge_subdivs[$div]);
echo "($divdata)";
}
else
echo "&nbsp;";
echo "</td>";
echo "</tr>";
}
echo "</table>";
}
else
{
send_popup_header("Judge Information");
echo error(i18n("No Judge ID passed to Judges Info"));
}
send_popup_footer();
?>

View File

@ -50,6 +50,36 @@ function saveteamnamesbuttonclicked()
document.forms.judges.submit();
}
function openjudgeinfo(id)
{
if(id)
currentid=id;
else
currentid=document.forms.judges["judgelist[]"].options[document.forms.judges["judgelist[]"].selectedIndex].value;
window.open("judges_info.php?id="+currentid,"JudgeInfo","location=no,menubar=no,directories=no,toolbar=no,width=600,height=400");
return false;
}
function switchjudgeinfo()
{
if(document.forms.judges["judgelist[]"].selectedIndex != -1)
{
currentname=document.forms.judges["judgelist[]"].options[document.forms.judges["judgelist[]"].selectedIndex].text;
currentid=document.forms.judges["judgelist[]"].options[document.forms.judges["judgelist[]"].selectedIndex].value;
document.forms.judges.judgeinfobutton.disabled=false;
document.forms.judges.judgeinfobutton.value="<? echo i18n("Judge Info");?>: "+currentname;
}
else
{
document.forms.judges.judgeinfobutton.disabled=true;
document.forms.judges.judgeinfobutton.value="<? echo i18n("Judge Info")?>";
}
}
</script>
<?
@ -125,8 +155,11 @@ function saveteamnamesbuttonclicked()
echo "<input type=\"hidden\" name=\"judges_id\">";
echo "<table>";
echo "<tr>";
echo "<th>".i18n("Judges List")."</th>";
echo "<th>Judge Teams</th>";
echo "<th>".i18n("Judges List");
echo "<br />";
echo "<input disabled=\"true\" name=\"judgeinfobutton\" id=\"judgeinfobutton\" onclick=\"openjudgeinfo()\" type=\"button\" value=\"".i18n("Judge Info")."\">";
echo "</th>";
echo "<th>".i18n("Judge Teams")."</th>";
echo "</tr>";
echo "<tr><td valign=\"top\">";
@ -172,7 +205,7 @@ function saveteamnamesbuttonclicked()
$q=mysql_query($querystr);
echo mysql_error();
echo "<select name=\"judgelist[]\" multiple=\"multiple\" style=\"width: 250px; height: 600px;\">";
echo "<select name=\"judgelist[]\" onchange=\"switchjudgeinfo()\" multiple=\"multiple\" style=\"width: 250px; height: 600px;\">";
while($r=mysql_fetch_object($q))
{
@ -259,7 +292,9 @@ function saveteamnamesbuttonclicked()
echo "<tr><td>";
echo "<input onclick=\"delbuttonclicked('".$team['id']."','".$team['num']."','".htmlspecialchars($team['name'])."','".$member['id']."')\" type=\"button\" value=\"&lt;&lt\">";
echo "</td><td>";
echo "<a href=\"\" onclick=\"return openjudgeinfo(".$member['id'].");\">";
echo $member['firstname']." ".$member['lastname'];
echo "</a>";
echo "</td></tr>";
}

View File

@ -353,6 +353,35 @@ function send_footer()
<?
}
function send_popup_header($title="")
{
global $HEADER_SENT;
global $config;
//do this so we can use send_header() a little more loosly and not worry about it being sent more than once.
if($HEADER_SENT) return;
else $HEADER_SENT=true;
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head><title><?=i18n($title)?></title>
<link rel="stylesheet" href="<?=$config['SFIABDIRECTORY']?>/sfiab.css" type="text/css" />
</head>
<body>
<?
echo "<h3>$title</h3>";
}
function send_popup_footer()
{
?>
</body>
</html>
<?
}
function emit_month_selector($name,$selected="")
{