function ScheduleEventGet($EventID) { $schedList = array(); global $EventSchedulesTable; $result = $db->query("select RoomID,\n StartTime\n from {$EventSchedulesTable}\n where EventID = {$EventID}\n order by RoomID, StartTime\n ") or die("Unable to get schedule information for event: " . sqlError()); while ($row = $result->fetch(PDO::FETCH_ASSOC)) { $schedList[TimeToStr($row['StartTime'])] = getRoomName(isset($row['RoomID']) ? $row['RoomID'] : "No Room"); } return $schedList; }
print "<br>Add Bummer!<br>"; } if (ScheduleEventAdd($EventID, "61450", 5)) { print "<br>Add Success!<br>"; } else { print "<br>Add Bummer!<br>"; } if (ScheduleEventAdd($EventID, $StartTime, 4)) { print "<br>Add Success!<br>"; } else { print "<br>Add Bummer!<br>"; } $eventSchedule = ScheduleEventGet(100); print "<table border=1>"; foreach ($eventSchedule as $RoomName => $StartTime) { print "<tr><td>{$RoomName}</td><td>" . TimeToStr($StartTime) . "</td></tr>"; } print "</table>"; print "<br><br>"; $EventID = 100; $StartTime = 61430; $RoomID = 2; if (ScheduleEventDel($EventID, $StartTime, $RoomID)) { print "<br>Del Success!<br>"; } else { print "<br>Del Bummer!<br>"; } //$church_list = ChurchesRegistered(); //print("<table border=1>"); //foreach ($church_list as $ChurchID=>$ChurchName) // print("<tr><td>$ChurchID</td><td>$ChurchName</td></tr>");
// First get a list of all scheduled events //-------------------------------------------------------------------- $results = $db->query("select e.EventID,\n e.EventName,\n (e.MaxWebSlots * e.MaxRooms) MaxWebSlots,\n CASE e.ConvEvent\n WHEN 'C' THEN 'Convention'\n WHEN 'P' THEN 'Pre-Convention'\n ELSE 'Other'\n END\n ConvEvent,\n CASE e.TeamEvent\n WHEN 'Y' THEN 'Team'\n WHEN 'N' THEN 'Individual'\n ELSE 'Other'\n END\n EventType,\n s.StartTime,\n s.SchedID,\n r.RoomName\n from {$EventsTable} e,\n {$EventScheduleTable} s,\n {$RoomsTable} r\n where e.EventID = s.EventID\n and e.EventAttended = 'Y'\n and s.RoomID = r.RoomID\n order by s.StartTime,\n e.EventName,\n r.RoomName") or die("Unable to get scheduled event list:" . sqlError()); $first = 1; ?> <table border="1" width="100%"> <?php //-------------------------------------------------------------------- // No loop through the events reporting on the details //-------------------------------------------------------------------- while ($row = $results->fetch(PDO::FETCH_ASSOC)) { $EventID = $row['EventID']; $EventName = $row['EventName']; $ConvEvent = $row['ConvEvent']; $EventType = $row['EventType']; $EventTime = TimeToStr($row['StartTime']); $SchedID = $row['SchedID']; $MaxWebSlots = $row['MaxWebSlots']; $RoomName = $row['RoomName']; if ($EventType == 'Team') { $sql = "SELECT count(*) as count\n FROM {$RegistrationTable} r,\n {$EventsTable} e\n WHERE r.SchedID = {$SchedID}\n AND r.EventID = {$EventID}\n AND r.EventID = e.EventID\n AND e.TeamEvent = 'Y'\n "; } else { $sql = "SELECT count(*) as count\n FROM {$RegistrationTable} r,\n {$EventsTable} e\n WHERE r.SchedID = {$SchedID}\n AND r.EventID = {$EventID}\n AND r.EventID = e.EventID\n AND e.TeamEvent = 'N'\n "; } $cntResult = $db->query($sql) or die("Unable to get Registration count for event:" . sqlError()); $cntRow = $cntResult->fetch(PDO::FETCH_ASSOC); $numEvents = $cntRow['count']; if ($prevTime != $EventTime) { ?> <tr> <td bgcolor="#C0C0C0" colspan=4><b><?php
function PrintRoster($ChurchID, $ChurchName) { global $EventScheduleTable; global $EventsTable; global $JudgeAssignmentsTable; global $RoomsTable; global $JudgesTable; global $allTimes; global $allRooms; global $pageBreak; global $db; $result = $db->query("select count(distinct a.JudgeID,\n j.FirstName,\n j.LastName) count\n from {$JudgeAssignmentsTable} a,\n {$JudgesTable} j\n where a.JudgeID = j.JudgeID\n and a.ChurchID = {$ChurchID}\n ") or die("Unable to obtain Judge List:" . sqlError()); $row = $result->fetch(PDO::FETCH_ASSOC); $numRows = $row['count']; ?> <h1 align="center" <?php print $pageBreak; $pageBreak = "style=\"page-break-before:always;\""; ?> ="<?php print $pageBreak; $pageBreak = "style=\"page-break-before:always;\""; ?> "> <?php print $ChurchName; ?> </h1> <hr /> <?php if ($numRows > 0) { $result = $db->query("select distinct\n a.JudgeID,\n j.FirstName,\n j.LastName\n from {$JudgeAssignmentsTable} a,\n {$JudgesTable} j\n where a.JudgeID = j.JudgeID\n and a.ChurchID = {$ChurchID}\n order by j.LastName\n ") or die("Unable to obtain Judge List:" . sqlError()); ?> <table border="1" width="100%"> <tr> </tr> <?php while ($row = $result->fetch(PDO::FETCH_ASSOC)) { $FirstName = $row['FirstName']; $LastName = $row['LastName']; $JudgeID = $row['JudgeID']; ?> <tr> <td width="10%" bgcolor="#CCCCCC" colspan="4"><?php print "{$LastName}, {$FirstName}"; ?> </td> </tr> <?php $details = $db->query("SELECT r.RoomName,\n s.StartTime,\n e.EventName\n FROM {$JudgeAssignmentsTable} a,\n {$RoomsTable} r,\n {$EventScheduleTable} s,\n {$EventsTable} e\n Where a.JudgeID = {$JudgeID}\n and a.RoomID = r.RoomID\n and s.SchedID = a.SchedID\n and s.RoomID = a.RoomID\n and e.EventID = s.EventID\n order by s.StartTime\n ") or die("Unable to obtain Judging Details:" . sqlError()); while ($judgeDtails = $details->fetch(PDO::FETCH_ASSOC)) { $RoomName = $judgeDtails['RoomName']; $SchedTime = TimeToStr($judgeDtails['StartTime']); $EventName = $judgeDtails['EventName']; ?> <tr> <td width="10%"> </td> <td><?php print $SchedTime; ?> </td> <td><?php print $RoomName; ?> </td> <td><?php print $EventName; ?> </td> </tr> <?php } } ?> </table> <?php } else { ?> <p align="center"><i>No Judges Assigned</i></p> <?php } }
>Not Selected</option> <?php if ($selected > 0) { $cntResult = $db->query("select SchedID\n from {$RegistrationTable}\n where ChurchID = {$ChurchID}\n and ParticipantID = {$ParticipantID}\n and EventID = {$EventID}\n ") or die("Unable to get schedule ID:" . sqlError()); $cntRow = $cntResult->fetch(PDO::FETCH_ASSOC); $SchedID = $cntRow['SchedID']; } else { $SchedID = ""; } $sql = "select distinct\n s.SchedID,\n s.StartTime,\n (e.MaxWebSlots * e.MaxRooms) MaxWebSlots,\n IF (RoomName REGEXP '-[a-z]\$',\n SUBSTR(RoomName,1,LENGTH(RoomName)-2),\n RoomName)\n as RoomName\n from {$EventScheduleTable} s,\n {$EventsTable} e,\n {$RoomsTable} r\n where s.EventID = {$EventID}\n and e.EventID = s.EventID\n and s.RoomID = r.RoomID\n order by StartTime\n "; //print "<pre>$sql</$pre>"; $SchedResult = $db->query($sql) or die("Unable to Get available scheduled slots for event:" . sqlError()); while ($SchedRow = $SchedResult->fetch(PDO::FETCH_ASSOC)) { if ($SchedRow['MaxWebSlots'] - slotsFilledInRoom($SchedRow['RoomName'], $SchedRow['StartTime']) > 0 or $selected > 0 and $SchedID == $SchedRow['SchedID']) { $sel = ($selected > 0 and $SchedID == $SchedRow['SchedID']) ? "selected" : ""; print "<option value=\"" . $SchedRow['SchedID'] . "\" {$sel}>" . TimeToStr($SchedRow['StartTime']) . "</option>\n"; } } ?> </select> <?php } } else { $cntResult = $db->query("select count(*) count\n from {$RegistrationTable}\n where EventID = {$EventID}\n ") or die("Unable to get event registration count:" . sqlError()); $cntRow = $cntResult->fetch(PDO::FETCH_ASSOC); $regCount = $cntRow['count']; if ($selected == 0 and $regCount >= $MaxWebSlots) { print "<center>Full</center>"; } else { print "<center><input type=\"checkbox\" name=\"s{$EventID}\" value=\"ON\""; print $selected > 0 ? " checked" : "";
// Get the RoomID of the room where the person already has an assignment $AssignedRoomID = $row['RoomID']; // Get the displayable text of the room where the person already has an assignment $conflict = $db->query("select RoomName\n from {$RoomsTable}\n where RoomID = {$AssignedRoomID}\n ") or die("Unable to get existing room name:" . sqlError()); $row = $conflict->fetch(PDO::FETCH_ASSOC); $AssignedRoomName = $row['RoomName']; // Get the Name of the Judge $conflict = $db->query("select FirstName,\n LastName\n from {$JudgesTable}\n where JudgeID = {$JudgeID}\n ") or die("Unable to get Judge Name:" . sqlError()); $row = $conflict->fetch(PDO::FETCH_ASSOC); $AssignedJudgeName = $row['FirstName'] . " " . $row['LastName']; $AssignedJudgeFirstName = $row['FirstName']; // Get the displayable text for the room and scheduled for the conflicted assignment $conflict = $db->query("select r.RoomName,\n s.StartTime\n from {$RoomsTable} r,\n {$EventScheduleTable} s\n where r.RoomID = {$RoomID}\n and s.SchedID = {$SchedID}\n and r.RoomID = s.RoomID\n ") or die("Unable to get conflicted info:" . sqlError()); $row = $conflict->fetch(PDO::FETCH_ASSOC); $NewRoomName = $row['RoomName']; $NewSchedTime = TimeToStr($row['StartTime']); // Build the status message $StatusMessage .= "Assignement deleted: " . $AssignedJudgeName . " was not added to schedule at: " . $NewSchedTime . "<br> in room: " . $NewRoomName . " because {$AssignedJudgeFirstName} is already assigned in room: " . $AssignedRoomName . "<br><br>"; } } } } } //======================================================================== // Load the current judge assignments //======================================================================== $Assignments = $db->query("select JudgeID ,\n JudgeNumber ,\n SchedID ,\n RoomID ,\n ChurchID\n from {$JudgeAssignmentsTable}\n ") or die("Unable to load current assignments:" . sqlError()); while ($row = $Assignments->fetch(PDO::FETCH_ASSOC)) { $keyValue = "judge_" . $row['RoomID'] . "_" . $row['SchedID'] . "_" . $row['JudgeNumber']; $assigned[$keyValue] = $row['JudgeID'] . "|" . $row['ChurchID']; }
$StartTime = $cntRow['StartTime']; $EndTime = $cntRow['EndTime']; $SchedID = $cntRow['SchedID']; ?> <tr> <td width="50"> </td> <td width="75" align="center"><a href="<?php print $_SERVER['PHP_SELF'] . "?DelEventID={$EventID}&StartTime={$StartTime}&RoomID={$RoomID}"; ?> ">Delete</a></td> <td width="75" align="center"><a href="<?php print $_SERVER['PHP_SELF'] . "?MoveEventID={$EventID}&SchedID={$SchedID}&StartTime={$StartTime}&RoomID={$RoomID}"; ?> ">Move</a></td> <td width="350"><?php print TimeToStr($StartTime) . " to " . TimeToStr($EndTime); ?> </td> <td><?php print $RoomName; ?> </td> </tr> <?php } } } } ?> </table>