add event types
schedule shows event types in different colours add tabs to schedule editor windor for each event type forward port ENUM changes to tableeditor fix bug in emit_minute_selector
This commit is contained in:
parent
f116d9c5fc
commit
e98ec8751b
@ -37,11 +37,12 @@ echo "<br />";
|
||||
$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");
|
||||
|
@ -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 "<div class=\"scheduleevent\" id=\"event_{$r->id}\" onclick=\"editEvent($r->id)\">";
|
||||
echo "<div class=\"scheduleevent scheduleevent_{$r->eventtype}\" id=\"event_{$r->id}\" onclick=\"editEvent($r->id)\">";
|
||||
echo "<div style=\"width: 99%; text-align: right;\"><a href=\"#\" onclick=\"return deleteEvent(event,$r->id)\"><img style=\"border: 0px;\" src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.{$config['icon_extension']}\"></a></div>\n";
|
||||
echo "<span class=\"scheduleevent_title\">";
|
||||
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();
|
||||
});
|
||||
}
|
||||
|
@ -1,15 +1,73 @@
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#schedule_tabs").tabs({
|
||||
show: function(event, ui) {
|
||||
switch(ui.panel.id) {
|
||||
case 'schedule_tab_general':
|
||||
update_tab_general();
|
||||
break;
|
||||
case 'schedule_tab_scienceolympics':
|
||||
update_tab_scienceolympics();
|
||||
break;
|
||||
}
|
||||
},
|
||||
selected: 0
|
||||
});
|
||||
|
||||
event_change();
|
||||
});
|
||||
|
||||
function update_tab_general() {
|
||||
}
|
||||
|
||||
function update_tab_scienceolympics() {
|
||||
}
|
||||
|
||||
function event_change() {
|
||||
var ea=$("#edit_event").val().split(":");
|
||||
//ea[1] is the type
|
||||
switch(ea[1]) {
|
||||
case "general":
|
||||
$("#schedule_tabs").tabs("option","disabled",[1,2,3]);
|
||||
break;
|
||||
case "scienceolympic":
|
||||
$("#schedule_tabs").tabs("option","disabled",[2,3]);
|
||||
break;
|
||||
case "sciencefairjudging":
|
||||
$("#schedule_tabs").tabs("option","disabled",[1,3]);
|
||||
break;
|
||||
case "tour":
|
||||
$("#schedule_tabs").tabs("option","disabled",[1,2]);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
<div id="schedule_tabs">
|
||||
<ul>
|
||||
<li><a href="#schedule_tab_general"><span><?=i18n('General')?></span></a></li>
|
||||
<li><a href="#schedule_tab_scienceolympics"><span><?=i18n('Science Olympics')?></span></a></li>
|
||||
<li><a href="#schedule_tab_sciencefairjudging"><span><?=i18n('Science Fair Judging')?></span></a></li>
|
||||
<li><a href="#schedule_tab_tour"><span><?=i18n('Tour')?></span></a></li>
|
||||
</ul>
|
||||
<div id="schedule_tab_general">
|
||||
|
||||
<?
|
||||
|
||||
|
||||
|
||||
echo "<form method=\"post\" id=\"edit_event_form\">";
|
||||
echo "<input type=\"hidden\" name=\"id\" id=\"edit_schedule_id\">";
|
||||
echo "<table style=\"width: 95%;\">";
|
||||
echo "<tr><td>";
|
||||
echo i18n("Event").": ";
|
||||
echo "</td><td>";
|
||||
echo "<select name=\"event_id\" id=\"edit_event\">";
|
||||
echo "<select name=\"event_id\" id=\"edit_event\" onchange=\"event_change()\">";
|
||||
echo "<option value=\"\">".i18n("Choose")."</option>\n";
|
||||
$q=mysql_query("SELECT * FROM events WHERE conferences_id='{$conference['id']}' ORDER BY name");
|
||||
while($r=mysql_fetch_object($q)) {
|
||||
echo "<option value=\"$r->id\">$r->name</option>\n";
|
||||
echo "<option value=\"$r->id:$r->eventtype\">$r->name</option>\n";
|
||||
}
|
||||
echo "</select>\n";
|
||||
echo "</td><td>";
|
||||
@ -46,5 +104,46 @@ echo "<input id=\"edit_duration\" type=\"text\" name=\"duration\" size=\"4\">";
|
||||
echo "minutes";
|
||||
echo "</td></tr>\n";
|
||||
echo "</table>";
|
||||
|
||||
echo "</form>\n";
|
||||
?>
|
||||
|
||||
</div>
|
||||
<div id="schedule_tab_scienceolympics">
|
||||
<?
|
||||
echo "<table style=\"width: 95%;\">";
|
||||
echo "<tr><td>";
|
||||
echo i18n("Maximum Number of Teams").": ";
|
||||
echo "</td><td>";
|
||||
echo "<input type=\"text\" name=\"somaxteams\" id=\"edit_somaxteams\" size=\"4\">";
|
||||
echo "</td></tr>";
|
||||
echo "</table>";
|
||||
|
||||
echo "<table style=\"width: 95%;\">";
|
||||
echo "<tr>";
|
||||
echo "<td>";
|
||||
echo i18n("Grades Recommended").": ";
|
||||
echo "</td><td>";
|
||||
echo i18n("Grades Required").": ";
|
||||
echo "</td></tr>";
|
||||
echo "<tr><td>";
|
||||
//FIXME fix grades from config
|
||||
for($x=7;$x<=12;$x++) {
|
||||
echo "<input type=\"checkbox\" name=\"recommendedgrades[]\"> Grade $x <br />\n";
|
||||
}
|
||||
echo "</td><td>";
|
||||
//FIXME fix grades from config
|
||||
for($x=7;$x<=12;$x++) {
|
||||
echo "<input type=\"checkbox\" name=\"recommendedgrades[]\"> Grade $x <br />\n";
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
echo "</table>";
|
||||
|
||||
|
||||
?>
|
||||
</div>
|
||||
<div id="schedule_tab_sciencefairjudging">
|
||||
</div>
|
||||
<div id="schedule_tab_tour">
|
||||
</div>
|
||||
|
||||
|
@ -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 "<select name=\"$name\">\n";
|
||||
echo "<select name=\"$name\" $extra>\n";
|
||||
echo "<option value=\"\">MM</option>\n";
|
||||
|
||||
for($x=0;$x<count($mins);$x++)
|
||||
|
@ -1 +1 @@
|
||||
179
|
||||
181
|
||||
|
3
db/db.update.181.sql
Normal file
3
db/db.update.181.sql
Normal file
@ -0,0 +1,3 @@
|
||||
ALTER TABLE `schedule` ADD `somaxteams` INT NOT NULL;
|
||||
ALTER TABLE `events` ADD `eventtype` ENUM( 'general', 'scienceolympic', 'sciencefairjudging', 'tour' ) NOT NULL AFTER `id`;
|
||||
|
@ -427,9 +427,17 @@ class TableEditor
|
||||
$inputtype="select";
|
||||
$enums=substr(ereg_replace("'","",$r->Type),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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user