diff --git a/admin/events.php b/admin/events.php index 51f7f3f..59013f7 100644 --- a/admin/events.php +++ b/admin/events.php @@ -48,7 +48,10 @@ $editor = new TableEditor('events', "website" => "Link to Description", "suggested_grades" => "Suggested Grades", "min_judges" => "Minimum Number of Judges", - "max_judges" => "Maximum Number of Judges" + "max_judges" => "Maximum Number of Judges", + "default_max_teams" => "Maximum Number of Teams", + "default_min_team_size" => "Minimum Team Size", + "default_max_team_size" => "Maximum Team Size" ), array( "conferences_id" => $conference['id'] diff --git a/admin/schedule.php b/admin/schedule.php index 7c8bf3d..7067ad0 100644 --- a/admin/schedule.php +++ b/admin/schedule.php @@ -113,6 +113,12 @@ $js.="eventdivs[$r->id]={hour:$r->hour,minute:$r->minute,location:$r->locations_id,duration:$r->duration};\n"; $x++; } + $js.="\n\nvar eventdefaults=new Array();\n"; + $q=mysql_query("SELECT events.* FROM events WHERE conferences_id='{$conference['id']}'"); + while($r=mysql_fetch_array($q)) { + $js.="eventdefaults[{$r['id']}]=".json_encode($r)."\n"; + } + echo ""; @@ -121,8 +127,25 @@ $id=intval($_GET['id']); $q=mysql_query("SELECT schedule.*, events.name, events.eventtype FROM schedule, events WHERE schedule.id='$id' AND schedule.conferences_id='{$conference['id']}' AND schedule.events_id=events.id"); echo mysql_error(); - if($r=mysql_fetch_array($q)) { + if($r=mysql_fetch_assoc($q)) { $r['idtype']=$r['events_id'].":".$r['eventtype']; + $teams=array(); + $teamq=mysql_query("SELECT so_teams.id, + so_teams.name AS teamname, + schools.school AS schoolname + FROM + so_teams + JOIN schedule_registrations ON so_teams.id=schedule_registrations.so_teams_id + JOIN schools ON so_teams.schools_id=schools.id + WHERE + schedule_registrations.conferences_id='{$conference['id']}' + AND so_teams.conferences_id='{$conference['id']}' + AND schedule_registrations.schedule_id='$id'"); + echo mysql_error(); + while($teamr=mysql_fetch_assoc($teamq)) { + $teams[]=$teamr; + } + $r['teams']=$teams; echo json_encode($r); } else @@ -145,7 +168,9 @@ duration='".mysql_real_escape_string($_POST['duration'])."', events_id='$event_id', locations_id='".mysql_real_escape_string($_POST['location_id'])."', - somaxteams='".mysql_real_escape_string($_POST['somaxteams'])."' + somaxteams='".mysql_real_escape_string($_POST['somaxteams'])."', + sominteamsize='".mysql_real_escape_string($_POST['sominteamsize'])."', + somaxteamsize='".mysql_real_escape_string($_POST['somaxteamsize'])."' WHERE id='$id' AND conferences_id='{$conference['id']}'"); echo mysql_error(); happy_("Event successfully saved"); @@ -243,6 +268,9 @@ $("#event_editor_dialog").dialog('option','title','Edit Event'); $.getJSON("schedule.php?action=loadevent&id="+id,function(json) { + $("#edit_event").val(json.idtype); + event_change(); + //general tab $("#edit_schedule_id").val(json.id); $("#edit_title").val(json.title); @@ -251,17 +279,34 @@ $("#edit_minute").val(json.minute); $("#edit_duration").val(json.duration); $("#edit_location").val(json.locations_id); - $("#edit_event").val(json.idtype); - //science olympics tab - $("#edit_somaxteams").val(json.somaxteams); + //we do this here to set the tabs properly, becuase it also sets the defaults, then we'll override the defaults wth + //teh real values below + + if(json.eventtype=="scienceolympic") { + //science olympics tab + $("#edit_somaxteams").val(json.somaxteams); + $("#edit_sominteamsize").val(json.sominteamsize); + $("#edit_somaxteamsize").val(json.somaxteamsize); + + var s='
=i18n("Team Name")?> | =i18n("School Name")?> | '+t.teamname+' | '+t.schoolname+' | '; + } + s+='
---|
"; -echo i18n("Grades Recommended").": "; echo " | "; -echo i18n("Grades Required").": "; +echo "FIXME: show list of registered judges to choose from"; echo " |
";
-//FIXME fix grades from config
-for($x=7;$x<=12;$x++) {
- echo " Grade $x \n"; -} -echo " | ";
-//FIXME fix grades from config
-for($x=7;$x<=12;$x++) {
- echo " Grade $x \n"; -} -echo " |
"; -echo i18n("Judges").": "; -echo " | "; -echo "show list of registered judges to choose from"; -echo " |