Copyright (C) 2005 James Grant Copyright (C) 2009 David Grant 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. */ ?> prepare("SELECT date,starttime,endtime,name FROM judges_timeslots WHERE round_id='0' AND year='{$config['FAIRYEAR']}' ORDER BY starttime,type"); $q2->execute(); $x = 0; while($r = $q->fetch(PDO::FETCH_OBJ)) { $found = false; foreach($times as $xx => $t) { if($t['date'] == $r->date && $t['starttime'] == $r->starttime && $t['endtime'] == $r->endtime) { $times[$xx]['name'] .= ", {$r->name}"; $found = true; break; } } if(!$found) { $times[$x] = array( 'date' => $r->date, 'starttime' => $r->starttime, 'endtime' => $r->endtime, 'name' => $r->name); $x++; } } switch($_GET['action']) { case 'save': $stmt = $pdo->prepare("DELETE FROM judges_availability WHERE users_id='{$u['id']}'"); $stmt->execute(); if(is_array($_POST['time']) ) { foreach($_POST['time'] as $x) { if(trim($times[$x]['starttime']) == '') continue; $stmt = $pdo->prepare("INSERT INTO judges_availability (users_id, `date`,`start`,`end`) VALUES ('{$u['id']}', '{$times[$x]['date']}', '{$times[$x]['starttime']}','{$times[$x]['endtime']}')"); $stmt->execute(); } } happy_("Time Availability preferences successfully saved"); exit; } if($_SESSION['embed'] == true) { display_messages(); echo "

".i18n('Time Availability')."

"; echo "
"; } else { //send the header send_header('Time Availability', array('Judge Registration' => 'judge_main.php') ); } ?>

prepare("SELECT * FROM judges_availability WHERE users_id=\"{$u['id']}\" ORDER BY `start`"); $q->execute(); $sel = array(); while($r=$q->fetch(PDO::FETCH_OBJ)) { foreach($times as $x=>$t) { if($r->start == $t['starttime'] && $r->end == $t['endtime'] && $r->date == $t['date']) { $sel[$x] = true; } } } if(count($times) > 1) { echo i18n("Please Note, you will be scheduled to judge in ALL (not just one) judging timeslots you select."); echo '

'; } foreach($times as $x=>$t) { $ch = $sel[$x] == true ? 'checked="checked"' : ''; echo ""; echo ""; echo ""; } ?>
"; echo ""; $st = substr($t['starttime'], 0, 5); $end = substr($t['endtime'], 0, 5); echo "{$times[$x]['date']} $st - $end

{$t['name']}



" />