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 "
\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 "
\n";
?>
+
+
+
+
+echo "
";
+
+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 "