From 50522346704c4256920427be7ae85f5168380893 Mon Sep 17 00:00:00 2001 From: dave Date: Fri, 26 Mar 2010 06:03:31 +0000 Subject: [PATCH] Check for special award timeslots if the scheduler is configured to schedule special award judges --- admin/judges_schedulerconfig.php | 10 ++++++++++ admin/judges_schedulerconfig_check.inc.php | 17 +++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/admin/judges_schedulerconfig.php b/admin/judges_schedulerconfig.php index 3a6c44a..b8c4131 100644 --- a/admin/judges_schedulerconfig.php +++ b/admin/judges_schedulerconfig.php @@ -70,6 +70,16 @@ if($config['judge_scheduler_percent']=="-1") $ok = 0; } + if($config['scheduler_enable_sa_scheduling'] == 'yes') { + $timeslots = judges_scheduler_check_timeslots_sa(); + if($timeslots > 0) { + echo happy(i18n("There are %1 timeslot(s) defined for special awards judging, good", array($timeslots))); + } else { + echo error(i18n("There are no timeslots defined for special awards judging (but the scheduler is configured to do special awards judigng)")); + $ok = 0; + } + } + echo ""; echo "

Awards

- ".i18n("Awards Manager").""; echo "
"; diff --git a/admin/judges_schedulerconfig_check.inc.php b/admin/judges_schedulerconfig_check.inc.php index c8c482c..0dc8742 100644 --- a/admin/judges_schedulerconfig_check.inc.php +++ b/admin/judges_schedulerconfig_check.inc.php @@ -16,6 +16,23 @@ function judges_scheduler_check_timeslots() return 0; } +function judges_scheduler_check_timeslots_sa() +{ + global $config; + $rows = 0; + + $q=mysql_query("SELECT * FROM judges_timeslots WHERE ". + " year='".$config['FAIRYEAR']."'". + " AND `type`='special'" ); + if(mysql_num_rows($q)) { + while(( $round=mysql_fetch_object($q))) { + $rq=mysql_query("SELECT * FROM judges_timeslots WHERE round_id='$round->id' AND type='timeslot'"); + $rows += mysql_num_rows($rq); + } + } + return $rows; +} + function judges_scheduler_check_awards() { global $config;