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" ,"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"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
@ -68,6 +73,7 @@ $dates = array('fairdate' => array() ,
'postwinners' => array(), 'postwinners' => array(),
'judgeregopen' => array(), 'judgeregopen' => array(),
'judgeregclose' => array(), 'judgeregclose' => array(),
'judgescheduleavailable' => array(),
'specawardregopen' => array(), 'specawardregopen' => array(),
'specawardregclose' => array()); 'specawardregclose' => array());
@ -87,7 +93,6 @@ $dates = array('fairdate' => array() ,
} }
} }
function chkafter($d1, $d2) function chkafter($d1, $d2)
{ {
global $dates; global $dates;
@ -115,7 +120,20 @@ chkafter('specawardregopen','specawardregclose');
chkafter('fairdate','postwinners'); chkafter('fairdate','postwinners');
/* And print the table with all the info in the correct order */ /* 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 = ''; $e = '';
if($error_ids[$d['id']]) { if($error_ids[$d['id']]) {
$e = "<span style=\"color: red;\">*</span> ".$error_ids[$d['id']]."</font>"; $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,6 +47,17 @@
} }
echo "<br />"; echo "<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, /* Check for any judging team assignment this year for this judge,
* if there is one, print the judge scheule link in an obvious place, * if there is one, print the judge scheule link in an obvious place,
* it's less obvious below */ * it's less obvious below */
@ -59,6 +70,7 @@
echo '</span>'; echo '</span>';
echo '<br/><br/>'; echo '<br/><br/>';
} }
}

View File

@ -52,6 +52,24 @@ $u = user_load($eid);
"judge_schedule" "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 */ /* Find all judging teams this judge is on */
$q = mysql_query("SELECT * FROM judges_teams_link $q = mysql_query("SELECT * FROM judges_teams_link
@ -149,11 +167,5 @@ if(count($teams) == 0) {
//echo "<pre>"; //echo "<pre>";
//print_R($teams); //print_R($teams);
send_footer();
?>
<?
if($_SESSION['embed'] != true) send_footer(); if($_SESSION['embed'] != true) send_footer();
?> ?>