forked from science-ation/science-ation
Update the judges timeslot editor to have a new field for 'allow divisional'. This specifies whether the automatic judges scheduler can use this timeslot to scheduler the divisional awards judging.
Add a new feature to the timeslot editor to add multiple timeslots at once, by specifying the start time, duration, and break time.
This commit is contained in:
parent
19b24cca36
commit
7b5d56ce60
@ -63,6 +63,8 @@
|
||||
echo error(i18n("End Time is required"));
|
||||
}
|
||||
|
||||
$allowdivisional=$_POST['allowdivisional'];
|
||||
if(!$allowdivisional) $allowdivisional="no";
|
||||
|
||||
if(!$err)
|
||||
{
|
||||
@ -73,12 +75,53 @@
|
||||
}
|
||||
if($_POST['action']=="edit")
|
||||
{
|
||||
mysql_query("UPDATE judges_timeslots SET `date`='$date', starttime='$starttime', endtime='$endtime' WHERE id='".$_POST['edit']."'");
|
||||
mysql_query("UPDATE judges_timeslots SET `date`='$date', starttime='$starttime', endtime='$endtime', allowdivisional='$allowdivisional' WHERE id='".$_POST['edit']."'");
|
||||
echo mysql_error();
|
||||
echo happy(i18n("Timeslot successfully saved"));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if($_POST['action']=="addmultiple")
|
||||
{
|
||||
if($_POST['addnum'] && $_POST['date_day'] && $_POST['date_month'] && $_POST['date_year'] && $_POST['starttime_hour'] && $_POST['starttime_minute'] && $_POST['duration'] && $_POST['break'])
|
||||
{
|
||||
$date=$_POST['date_year']."-".$_POST['date_month']."-".$_POST['date_day'];
|
||||
$hr=$_POST['starttime_hour'];
|
||||
$min=$_POST['starttime_minute'];
|
||||
$dur=$_POST['duration'];
|
||||
$brk=$_POST['break'];
|
||||
$tt=$dur+$brk;
|
||||
|
||||
if($_POST['allowdivisional']=="yes") $ad="yes"; else $ad="no";
|
||||
|
||||
for($x=0;$x<$_POST['addnum'];$x++)
|
||||
{
|
||||
$q=mysql_query("SELECT DATE_ADD('$date $hr:$min:00', INTERVAL $dur MINUTE) AS endtime,
|
||||
DATE_ADD('$date $hr:$min:00', INTERVAL $tt MINUTE) AS startnext
|
||||
");
|
||||
echo mysql_error();
|
||||
$r=mysql_fetch_object($q);
|
||||
list($ed,$et)=split(" ",$r->endtime);
|
||||
list($nd,$nt)=split(" ",$r->startnext);
|
||||
|
||||
mysql_query("INSERT INTO judges_timeslots (date,starttime,endtime,allowdivisional,year) VALUES (
|
||||
'$date',
|
||||
'$hr:$min:00',
|
||||
'$et',
|
||||
'$ad',
|
||||
'".$config['FAIRYEAR']."')");
|
||||
echo mysql_Error();
|
||||
$date=$nd;
|
||||
list($s_h,$s_m,$s_s)=split(":",$nt);
|
||||
list($e_h,$e_m,$e_s)=split(":",$et);
|
||||
echo happy(i18n("Adding timeslot: %1",array($date." ".$hr.":".$min." - ".$e_h.":".$e_m)));
|
||||
$hr=$s_h;
|
||||
$min=$s_m;
|
||||
}
|
||||
}
|
||||
else
|
||||
echo error(i18n("All fields are required to add multiple timeslots"));
|
||||
}
|
||||
|
||||
//FIXME: only delete if the timeslot is not in use!!!
|
||||
if($_GET['action']=="delete" && $_GET['delete'])
|
||||
@ -89,7 +132,75 @@
|
||||
|
||||
}
|
||||
|
||||
if($_GET['action']=="add" || $_GET['action']=="edit")
|
||||
if($_GET['action']=="addmultiple")
|
||||
{
|
||||
|
||||
echo "<h3>Add Multiple New Judging Timeslots</h3>";
|
||||
echo "<a href=\"judges_timeslots.php\"><< ".i18n("Back to Judging Timeslots")."</a>\n";
|
||||
$q=mysql_query("SELECT * FROM judges_timeslots WHERE year='".$config['FAIRYEAR']."' ORDER BY date DESC LIMIT 1");
|
||||
if(mysql_num_rows($q))
|
||||
{
|
||||
$r=mysql_fetch_object($q);
|
||||
$date=$r->date;
|
||||
}
|
||||
else
|
||||
{
|
||||
$date=$config['dates']['fairdate'];
|
||||
}
|
||||
|
||||
|
||||
echo "<form method=\"post\" action=\"judges_timeslots.php\">";
|
||||
echo "<input type=\"hidden\" name=\"action\" value=\"addmultiple\">\n";
|
||||
echo "<table border=0>";
|
||||
echo "<tr><td>";
|
||||
echo i18n("Add");
|
||||
echo "</td><td width=\"50\">";
|
||||
echo "<input type=\"text\" name=\"addnum\" size=\"4\">";
|
||||
echo "</td><td>";
|
||||
echo i18n("new timeslots");
|
||||
echo "</td></tr><tr><td>";
|
||||
echo i18n("On date");
|
||||
echo "</td><td colspan=\"2\">";
|
||||
emit_date_selector("date",$date);
|
||||
echo "</td></tr><tr><td>";
|
||||
echo i18n("Starting timeslots at");
|
||||
echo "</td><td colspan=\"2\">";
|
||||
emit_time_selector("starttime");
|
||||
echo "</td></tr>";
|
||||
echo "<tr><td>";
|
||||
echo i18n("With a duration of");
|
||||
echo "</td><td>";
|
||||
echo "<input type=\"text\" name=\"duration\" size=\"4\">";
|
||||
echo "</td><td>";
|
||||
echo i18n("minutes");
|
||||
echo "</td></tr>";
|
||||
echo "<tr><td>";
|
||||
echo i18n("And a break of");
|
||||
echo "</td><td>";
|
||||
echo "<input type=\"text\" name=\"break\" size=\"4\">";
|
||||
echo "</td><td>";
|
||||
echo i18n("minutes");
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr><td align=\"center\">";
|
||||
if($allowdivisional=="yes") $ch="checked=\"checked\""; else $ch="";
|
||||
echo "<input $ch type=\"checkbox\" name=\"allowdivisional\" value=\"yes\">";
|
||||
echo "</td><td colspan=\"2\">";
|
||||
echo i18n("Allow this timeslot to be used by the automatic judges scheduler for divisional awards");
|
||||
echo "</td></tr>";
|
||||
|
||||
|
||||
|
||||
echo "<tr><td colspan=\"3\">";
|
||||
echo "<input type=\"submit\" value=\"".i18n("Add these timeslots")."\">";
|
||||
echo "</td></tr>";
|
||||
echo "</table>";
|
||||
|
||||
echo "</form>";
|
||||
$showlist=false;
|
||||
|
||||
}
|
||||
else if($_GET['action']=="add" || $_GET['action']=="edit")
|
||||
{
|
||||
echo "<form method=\"post\" action=\"judges_timeslots.php\">";
|
||||
|
||||
@ -99,18 +210,20 @@
|
||||
{
|
||||
echo "<h3>Add New Judging Timeslot</h3>";
|
||||
$buttontext=i18n("Add Timeslot");
|
||||
//get a default date, either the date from a different timeslot, or the date of the fair, whichever.
|
||||
$q=mysql_query("SELECT * FROM judges_timeslots WHERE year='".$config['FAIRYEAR']."' ORDER BY date DESC LIMIT 1");
|
||||
if(mysql_num_rows($q))
|
||||
{
|
||||
$r=mysql_fetch_object($q);
|
||||
$date=$r->date;
|
||||
$starttime="";
|
||||
$endtime="";
|
||||
}
|
||||
else
|
||||
{
|
||||
$date=$config['dates']['fairdate'];
|
||||
}
|
||||
$starttime="";
|
||||
$endtime="";
|
||||
$allowdivisional="yes";
|
||||
|
||||
}
|
||||
else if($_GET['action']=="edit")
|
||||
@ -124,22 +237,30 @@
|
||||
$date=$r->date;
|
||||
$starttime=$r->starttime;
|
||||
$endtime=$r->endtime;
|
||||
$allowdivisional=$r->allowdivisional;
|
||||
}
|
||||
|
||||
|
||||
echo "<table>";
|
||||
echo "<tr><td>Date:</td><td>";
|
||||
echo "<tr><td>".i18n("Date").":</td><td>";
|
||||
emit_date_selector("date",$date);
|
||||
|
||||
echo "</td></tr>";
|
||||
echo "<tr><td>Start Time:</td><td>";
|
||||
echo "<tr><td>".i18n("Start Time").":</td><td>";
|
||||
emit_time_selector("starttime",$starttime);
|
||||
|
||||
echo "</td></tr>";
|
||||
echo "<tr><td>End Time:</td><td>";
|
||||
echo "<tr><td>".i18n("End Time").":</td><td>";
|
||||
emit_time_selector("endtime",$endtime);
|
||||
|
||||
echo "</td></tr>";
|
||||
echo "<tr><td align=\"center\">";
|
||||
if($allowdivisional=="yes") $ch="checked=\"checked\""; else $ch="";
|
||||
echo "<input $ch type=\"checkbox\" name=\"allowdivisional\" value=\"yes\">";
|
||||
echo "</td><td>";
|
||||
echo i18n("Allow this timeslot to be used by the automatic judges scheduler for divisional awards");
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "</table>";
|
||||
|
||||
echo "<input type=\"submit\" value=\"$buttontext\" />";
|
||||
@ -151,11 +272,13 @@
|
||||
{
|
||||
|
||||
echo "<A href=\"judges_timeslots.php?action=add\">".i18n("Add new judging timeslot")."</a><br />";
|
||||
echo "<A href=\"judges_timeslots.php?action=addmultiple\">".i18n("Add multiple new judging timeslots")."</a><br />";
|
||||
echo "<table class=\"summarytable\">";
|
||||
echo "<tr>";
|
||||
echo "<th>".i18n("Date")."</th>";
|
||||
echo "<th>".i18n("Start Time")."</th>";
|
||||
echo "<th>".i18n("End Time")."</th>";
|
||||
echo "<th>".i18n("Div OK?")."</th>";
|
||||
echo "<th>".i18n("Actions")."</th>";
|
||||
echo "</tr>";
|
||||
|
||||
@ -167,6 +290,7 @@
|
||||
echo "<td>$r->date</td>";
|
||||
echo "<td align=\"center\">".substr($r->starttime,0,-3)."</td>";
|
||||
echo "<td align=\"center\">".substr($r->endtime,0,-3)."</td>";
|
||||
echo "<td align=\"center\">$r->allowdivisional</td>";
|
||||
|
||||
|
||||
echo " <td align=\"center\">";
|
||||
|
@ -1,3 +1,4 @@
|
||||
INSERT INTO `config` ( `var` , `val` , `description` , `year` ) VALUES ( 'participant_project_summary_wordmax', '100', 'The maximum number of words acceptable in the project summary', '-1');
|
||||
INSERT INTO `config` ( `var` , `val` , `description` , `year` ) VALUES ( 'participant_project_summary_wordmax', '100', 'The maximum number of words acceptable in the project summary', '2006');
|
||||
ALTER TABLE `projects` ADD `summarycountok` TINYINT( 1 ) DEFAULT '1' NOT NULL AFTER `summary` ;
|
||||
ALTER TABLE `judges_timeslots` ADD `allowdivisional` ENUM( 'no', 'yes' ) DEFAULT 'no' NOT NULL AFTER `endtime` ;
|
||||
|
Loading…
Reference in New Issue
Block a user