Place already scheduled events on the schedule table, still doesnt do duration, messing with the stupid arrays now... gotta go

This commit is contained in:
james 2010-06-10 20:35:02 +00:00
parent 4b95aebe8f
commit df3af58ffa

View File

@ -26,7 +26,12 @@
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
if($_GET['date']) {
echo "<h3>".i18n("Schedule for %1",array(format_date($_GET['date'])))."</h3>";
$date=$_GET['date'];
if(!eregi("[0-9]{4}-[0-9]{2}-[0-9]{2}",$date)) {
echo "Invalid date";
exit;
}
echo "<h3>".i18n("Schedule for %1",array(format_date($date)))."</h3>";
$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 "</table>\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 "<div class=\"scheduleevent\" id=\"event_{$r->hour}_{$r->minute}_{$r->locations_id}\">";
print_r($r);
echo "</div>";
$js.="eventdivs[$x]={hour:$r->hour,minute:$r->minute,location:$r->locations_id,duration:$r->duration};\n";
$x++;
}
echo "<script type=\"text/javascript\">\n";
echo $js;
echo "</script>";
}
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();
}
);
}
</script>