Event scheduling start - shows times and locations and lets you click about in the table

This commit is contained in:
james 2010-06-10 19:40:50 +00:00
parent ba20d1b974
commit 6a24618359
3 changed files with 175 additions and 1 deletions

View File

@ -49,7 +49,6 @@ $editor->setPrimaryKey("id");
$editor->setRecordType("Location");
$editor->setDefaultSortField("name");
$editor->execute();
send_footer();

126
admin/schedule.php Normal file
View File

@ -0,0 +1,126 @@
<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
Copyright (C) 2005 James Grant <james@lightbox.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation, version 2.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
?>
<?
require("../common.inc.php");
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>";
$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;
}
if(!count($locations)) {
echo error(i18n("There are no locations defined. Please set up your locations first"));
echo "<a href=\"locations.php\">".i18n("Location Editor")."</a>\n";
exit;
}
echo "<table class=\"schedule\">\n";
echo "<tr>";
echo "<th style=\"width: 50px;\">&nbsp;</th>";
foreach($locations AS $id=>$name) {
echo " <th>$name</th>\n";
}
$starthour="7";
$endhour="22";
$increment=15;
for($h=$starthour;$h<$endhour;$h++) {
for($m=0;$m<60;$m+=$increment) {
echo "<tr>";
echo " <td class=\"scheduletime\">";
if($m==0) {
echo format_time("$h:$m");
}
echo "</td>";
foreach($locations AS $id=>$name) {
echo "<td id=\"{$h}_{$m}_{$id}\" onclick=\"clickTableCell(this)\">";
/*
if($h==8&&$m==0&&$id==3) {
$height=4;
$pxheight=$height*25;
echo "<div class=\"scheduleevent\" style=\"height: {$pxheight}px;\">";
echo "</div>";
}
*/
echo "</td>";
}
echo "</tr>";
}
}
echo "</table>\n";
}
else {
send_header("Schedule Management",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php'),
"events_scheduling" );
echo "<br />";
?>
<script type="text/javascript">
$(document).ready(function() {
$(".date").datepicker({ dateFormat: 'yy-mm-dd' });
changeDate();
});
function changeDate() {
$("#schedulediv").load("schedule.php?date="+$("#date").val());
}
function clickTableCell(t) {
var p=$("#"+t.id).offset();
// alert('You clicked in empty cell : '+t.id+' at top:'+position.top+' left:'+position.left);
$("#scheduleeventeditor").css(p);
// $("#scheduleeventeditor").width(150);
// $("#scheduleeventeditor").height(100);
$("#scheduleeventeditor").show();
}
</script>
<?
if(!$editdate) {
list($editdate,$bla)=explode(" ",$config['dates']['fairdate']);
}
?>
<form method="post">
<?
echo i18n("Schedule date");
?>
<input id="date" class="date" type="text" name="date" value="<?=$editdate?>" size="15" onchange="changeDate()">
</form>
<hr />
<div id="schedulediv">
</div>
<div id="scheduleeventeditor">
</div>
<?
send_footer();
}
?>

View File

@ -493,3 +493,52 @@ ul.conferencenav li a:hover {
}
.schedule {
border: 2px solid black;
border-collapse: collapse;
margin-left: 20px;
}
.schedule th {
background-color: #1B86B7;
color: white;
font-weight: bold;
width: 150px;
text-align: center;
border: 1px solid black;
}
.schedule td {
border: 1px solid #CCCCCC;
height: 25px;
overflow: auto;
}
.scheduletime {
font-size: 0.8em;
font-weight: bold;
}
.schedule td:hover {
background-color: #25BEFF;
}
.scheduleevent {
border: 1px solid red;
background: orange;
width: 150px;
margin:0;
}
#scheduleeventeditor {
position: absolute;
top: 100px;
left: 100px;
display: none;
background-color: orange;
border: 2px solid grey;
width: 148px;
height: 95px;
z-index: 1000;
}