diff --git a/admin/events.php b/admin/events.php index 9184a49..35ba642 100644 --- a/admin/events.php +++ b/admin/events.php @@ -37,11 +37,12 @@ echo "
"; $editor = new TableEditor('events', array( "name" => "Event Name", - "summary" => "Summary", - "description_link" => "Link to Description" + "eventtype" => "Type", + "suggested_grades" => "Suggested Grades", ), array( "name" => "Event Name", + "eventtype" => "Type", "summary" => "Summary", "description_link" => "Link to Description", "suggested_grades" => "Suggested Grades", @@ -52,7 +53,13 @@ $editor = new TableEditor('events', "conferences_id" => $conference['id'] ) ); +$eventtypes=array( array('key'=>"general", 'val'=>"General"), + array('key'=>"scienceolympic", 'val'=>"Science Olympics Event"), + array('key'=>"sciencefairjudging", 'val'=>"Science Fair Judging"), + array('key'=>"tour", 'val'=>"Tour") + ); +$editor->setFieldOptions("eventtype",$eventtypes); $editor->setPrimaryKey("id"); $editor->setRecordType("Event"); $editor->setDefaultSortField("name"); diff --git a/admin/schedule.php b/admin/schedule.php index 17711be..0cf5293 100644 --- a/admin/schedule.php +++ b/admin/schedule.php @@ -86,10 +86,10 @@ //now make all our DIV's for the events that are scheduled in the database $x=0; //they will be moved by javascript after the fact - $q=mysql_query("SELECT schedule.*, events.name FROM schedule JOIN events ON schedule.events_id=events.id WHERE schedule.conferences_id='{$conference['id']}' AND date='{$date}'"); + $q=mysql_query("SELECT schedule.*, events.name, events.eventtype FROM schedule JOIN events ON schedule.events_id=events.id WHERE schedule.conferences_id='{$conference['id']}' AND date='{$date}'"); echo mysql_error(); while($r=mysql_fetch_object($q)) { - echo "
id}\" onclick=\"editEvent($r->id)\">"; + echo "
eventtype}\" id=\"event_{$r->id}\" onclick=\"editEvent($r->id)\">"; echo "
id)\">
\n"; echo ""; echo $r->name; @@ -111,8 +111,10 @@ } else if($_GET['action']=="loadevent") { $id=intval($_GET['id']); - $q=mysql_query("SELECT * FROM schedule WHERE id='$id' AND conferences_id='{$conference['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)) { + $r['idtype']=$r['events_id'].":".$r['eventtype']; echo json_encode($r); } else @@ -125,15 +127,21 @@ mysql_query("INSERT INTO schedule (conferences_id) VALUES ('{$conference['id']}')"); $id=mysql_insert_id(); } - mysql_query("UPDATE schedule SET - date='".mysql_real_escape_string($_POST['date'])."', - hour='".mysql_real_escape_string($_POST['hour'])."', - minute='".mysql_real_escape_string($_POST['minute'])."', - duration='".mysql_real_escape_string($_POST['duration'])."', - events_id='".mysql_real_escape_string($_POST['event_id'])."', - locations_id='".mysql_real_escape_string($_POST['location_id'])."' - WHERE id='$id' AND conferences_id='{$conference['id']}'"); - echo mysql_error(); + list($event_id,$event_type)=explode(":",$_POST['event_id']); + if($event_id>0) { + mysql_query("UPDATE schedule SET + date='".mysql_real_escape_string($_POST['date'])."', + hour='".mysql_real_escape_string($_POST['hour'])."', + minute='".mysql_real_escape_string($_POST['minute'])."', + duration='".mysql_real_escape_string($_POST['duration'])."', + events_id='$event_id', + locations_id='".mysql_real_escape_string($_POST['location_id'])."' + WHERE id='$id' AND conferences_id='{$conference['id']}'"); + echo mysql_error(); + happy_("Event successfully saved"); + } else { + error_("Error saving event - You must select an event"); + } exit; } else if($_GET['action']=="deleteevent") { @@ -219,19 +227,24 @@ $("#event_editor_dialog").dialog('option','title','Edit Event'); $.getJSON("schedule.php?action=loadevent&id="+id,function(json) { + //general tab $("#edit_schedule_id").val(json.id); $("#edit_date").val(json.date); $("#edit_hour").val(json.hour); $("#edit_minute").val(json.minute); $("#edit_duration").val(json.duration); $("#edit_location").val(json.locations_id); - $("#edit_event").val(json.events_id); + $("#edit_event").val(json.idtype); + + //science olympics tab + $("#edit_somaxteams").val(json.somaxteams); + $("#schedule_tabs").tabs('select',0); + event_change(); }); } else { $("#event_editor_dialog").dialog('option','title','Create Event'); var a=cell.split("_"); - $("#edit_schedule_id").val(0); $("#edit_date").val($("#date").val()); $("#edit_hour").val(a[0]); @@ -250,7 +263,7 @@ function saveEvent() { var o=$("#edit_event_form").serializeArray(); //alert(o); - $.post("schedule.php?action=saveevent",o,function() { + $("#debug").load("schedule.php?action=saveevent",o,function() { changeDate(); }); } @@ -258,7 +271,7 @@ event.stopPropagation(); if(confirmClick('Are you sure you want to delete this event from the schedule?')) { - $.post('schedule.php?action=deleteevent',{id:id},function() { + $("#debug").load('schedule.php?action=deleteevent',{id:id},function() { changeDate(); }); } diff --git a/admin/schedule_edit_dialog.php b/admin/schedule_edit_dialog.php index 41f4aaa..2cf669a 100644 --- a/admin/schedule_edit_dialog.php +++ b/admin/schedule_edit_dialog.php @@ -1,15 +1,73 @@ + +
+
    +
  • +
  • +
  • +
  • +
+
+ "; echo ""; echo ""; echo "\n"; echo "
"; echo i18n("Event").": "; echo ""; -echo ""; echo "\n"; $q=mysql_query("SELECT * FROM events WHERE conferences_id='{$conference['id']}' ORDER BY name"); while($r=mysql_fetch_object($q)) { - echo "\n"; + echo "\n"; } echo "\n"; echo ""; @@ -46,5 +104,46 @@ echo ""; echo "minutes"; echo "
"; + echo "\n"; ?> + +
+
+"; +echo ""; +echo i18n("Maximum Number of Teams").": "; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo "\n"; +echo "
"; +echo i18n("Grades Recommended").": "; +echo ""; +echo i18n("Grades Required").": "; +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 "
"; + + +?> +
+
+
+
+
+ diff --git a/common.inc.php b/common.inc.php index 9f65739..8f8671c 100644 --- a/common.inc.php +++ b/common.inc.php @@ -878,7 +878,7 @@ function emit_minute_selector($name,$selected="",$extra="",$interval=5) $mins[]=$x; } // $mins=array("00","05","10","15","20","25","30","35","40","45","50","55"); - echo "\n"; echo "\n"; for($x=0;$xType),5,-1); $toks=split(",",$enums); - foreach($toks as $tok) - { - $this->fieldOptions[$f][]=$tok; + foreach($toks as $tok) { + $keyfound=false; + if(count($this->fieldOptions[$f])) { + foreach($this->fieldOptions[$f] AS $o) { + if($o['key']==$tok) + $keyfound=true; + } + } + + if(!$keyfound) + $this->fieldOptions[$f][]=$tok; } break; } diff --git a/theme/default/sfiab.css b/theme/default/sfiab.css index 7a49c34..e7fb342 100644 --- a/theme/default/sfiab.css +++ b/theme/default/sfiab.css @@ -543,3 +543,16 @@ ul.conferencenav li a:hover { font-size: 1.2em; } +.scheduleevent_general { + background: #FFC552; +} +.scheduleevent_scienceolympic { + background: #8FB4FF; +} +.scheduleevent_sciencefairjudging { + background: #FFCCF6; +} +.scheduleevent_tour { + background: #CCFFD5; +} +