Add a new date 'judge schedule available' to specify when judge assignments and schedules become available to judges. When the chief judge is playing with the scheduler he doesnt want to have judges thinkign they are assigned to their final teams/projects/timeslots, so only make them available to judges after this date has passed.

The default (as always) maintains old behaviour, so if this date is not explicitly set, it'll always show the schedule
This commit is contained in:
james 2010-04-06 14:29:50 +00:00
parent 015b04a81a
commit 8d6d653567
5 changed files with 63 additions and 20 deletions

View File

@ -31,6 +31,11 @@
,"important_dates"
);
$q=mysql_query("SELECT * FROM dates WHERE year='-1'");
while($r=mysql_fetch_object($q)) {
$defaultdates[$r->name]=$r;
}
?>
<script type="text/javascript">
$(document).ready(function() {
@ -68,6 +73,7 @@ $dates = array('fairdate' => array() ,
'postwinners' => array(),
'judgeregopen' => array(),
'judgeregclose' => array(),
'judgescheduleavailable' => array(),
'specawardregopen' => array(),
'specawardregclose' => array());
@ -87,7 +93,6 @@ $dates = array('fairdate' => array() ,
}
}
function chkafter($d1, $d2)
{
global $dates;
@ -115,7 +120,20 @@ chkafter('specawardregopen','specawardregclose');
chkafter('fairdate','postwinners');
/* And print the table with all the info in the correct order */
foreach($dates as $d) {
foreach($dates as $dn=>$d) {
if(!$d['id']) {
$def=$defaultdates[$dn];
//hmm if we dont have a record for this date this year, INSERT the sql from the default
mysql_query("INSERT INTO dates (date,name,description,year) VALUES (
'".mysql_real_escape_string($def->date)."',
'".mysql_real_escape_string($dn)."',
'".mysql_real_escape_string($def->description)."',
'".$config['FAIRYEAR']."'
)");
$d['id']=mysql_insert_id();
$d['description']=$def->description;
$d['date']=$def->date;
}
$e = '';
if($error_ids[$d['id']]) {
$e = "<span style=\"color: red;\">*</span> ".$error_ids[$d['id']]."</font>";

View File

@ -1 +1 @@
170
171

1
db/db.update.171.sql Normal file
View File

@ -0,0 +1 @@
INSERT INTO `dates` (`id`, `date`, `name`, `description`, `year`) VALUES (NULL, '0000-00-00 00:00:00', 'judgescheduleavailable', 'Judge assignments and schedule are available to judges', '-1');

View File

@ -47,17 +47,29 @@
}
echo "<br />";
/* Check for any judging team assignment this year for this judge,
* if there is one, print the judge scheule link in an obvious place,
* it's less obvious below */
$q = mysql_query("SELECT id FROM judges_teams_link WHERE
users_id='{$u['id']}' AND year='{$config['FAIRYEAR']}'");
if(mysql_num_rows($q) > 0) {
echo '<span style="font-size: 1.2em; font-weight: bold;">';
echo i18n("You have been assigned to a judging team. %1Click here%2 to view the judging schedule",
array("<a href=\"judge_schedule.php\">","</a>"));
echo '</span>';
echo '<br/><br/>';
$scheduleok=false;
if($config['dates']['judgescheduleavailable'] && $config['dates']['judgescheduleavailable']!="0000-00-00 00:00:00") {
$q=mysql_query("SELECT (NOW()>'".$config['dates']['judgescheduleavailable']."') AS test");
$r=mysql_fetch_object($q);
$scheduleok=$r->test;
}
else {
$scheduleok=true;
}
if($scheduleok) {
/* Check for any judging team assignment this year for this judge,
* if there is one, print the judge scheule link in an obvious place,
* it's less obvious below */
$q = mysql_query("SELECT id FROM judges_teams_link WHERE
users_id='{$u['id']}' AND year='{$config['FAIRYEAR']}'");
if(mysql_num_rows($q) > 0) {
echo '<span style="font-size: 1.2em; font-weight: bold;">';
echo i18n("You have been assigned to a judging team. %1Click here%2 to view the judging schedule",
array("<a href=\"judge_schedule.php\">","</a>"));
echo '</span>';
echo '<br/><br/>';
}
}

View File

@ -52,6 +52,24 @@ $u = user_load($eid);
"judge_schedule"
);
$scheduleok=false;
if($config['dates']['judgescheduleavailable'] && $config['dates']['judgescheduleavailable']!="0000-00-00 00:00:00") {
$q=mysql_query("SELECT (NOW()>'".$config['dates']['judgescheduleavailable']."') AS test");
$r=mysql_fetch_object($q);
$scheduleok=$r->test;
}
else {
$scheduleok=true;
}
if(!$scheduleok) {
echo i18n("Your judging assignments and schedule will be available on %1",array(format_datetime($config['dates']['judgescheduleavailable'])));
send_footer();
if($_SESSION['embed'] != true) send_footer();
exit;
}
/* Find all judging teams this judge is on */
$q = mysql_query("SELECT * FROM judges_teams_link
@ -149,11 +167,5 @@ if(count($teams) == 0) {
//echo "<pre>";
//print_R($teams);
send_footer();
?>
<?
if($_SESSION['embed'] != true) send_footer();
?>