diff --git a/admin/schedule.php b/admin/schedule.php index 9d796e2..f3936e1 100644 --- a/admin/schedule.php +++ b/admin/schedule.php @@ -26,7 +26,12 @@ require_once("../user.inc.php"); user_auth_required('committee', 'admin'); if($_GET['date']) { - echo "

".i18n("Schedule for %1",array(format_date($_GET['date'])))."

"; + $date=$_GET['date']; + if(!eregi("[0-9]{4}-[0-9]{2}-[0-9]{2}",$date)) { + echo "Invalid date"; + exit; + } + echo "

".i18n("Schedule for %1",array(format_date($date)))."

"; $q=mysql_query("SELECT * FROM locations WHERE conferences_id='{$conference['id']}' ORDER BY name"); while($r=mysql_fetch_object($q)) { $locations[$r->id]=$r->name; @@ -70,6 +75,23 @@ } } echo "\n"; + + $js="var eventdivs=new Array();\n"; + + //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 * FROM schedule WHERE conferences_id='{$conference['id']}' AND date='{$date}'"); + while($r=mysql_fetch_object($q)) { + echo "
hour}_{$r->minute}_{$r->locations_id}\">"; + print_r($r); + echo "
"; + $js.="eventdivs[$x]={hour:$r->hour,minute:$r->minute,location:$r->locations_id,duration:$r->duration};\n"; + $x++; + } + echo ""; } else { @@ -86,7 +108,9 @@ }); function changeDate() { - $("#schedulediv").load("schedule.php?date="+$("#date").val()); + $("#schedulediv").load("schedule.php?date="+$("#date").val(),null,function() { + placeEvents(); + }); } function clickTableCell(t) { @@ -98,7 +122,17 @@ $("#scheduleeventeditor").show(); + } + function placeEvents() { + $('.scheduleevent').each(function(idx,item) { + var tablecellid=item.id.substr(6); + + var p=$("#"+tablecellid).offset(); + $("#"+item.id).css(p); + $("#"+item.id).show(); + } + ); }