Block Allocations\n";
print "Block Allocations are a way to have a set of machines preloaded with a particular environment at specified times and made available to a specific group of users. This is very useful for classroom use and for workshops. They can be made available on a repeating schedule such as when a course meets each week. Block Allocations only allocate machines for the group of users - they do not create the actual, end user reservations for the machines. All users still must log in to the VCL web site and make their own reservations DURING the period a block allocation is active.
\n";
print "You are currently a member of the following Block Allocations. \n";
print "Click an item to view its current status. \n";
foreach($blocks as $id => $name) {
$cont = addContinuationsEntry('viewBlockStatus', array('id' => $id));
print "";
print "$name \n";
}
}
////////////////////////////////////////////////////////////////////////////////
///
/// \fn blockAllocationForm()
///
/// \brief prints a page for submitting a new block allocation, editing an
/// existing block allocation, or requesting a new block allocation
///
////////////////////////////////////////////////////////////////////////////////
function blockAllocationForm() {
global $user, $days, $mode;
$blockid = getContinuationVar('blockid', '');
$data = getBlockAllocationData($blockid);
if($mode == 'newBlockAllocation') {
$brname = '';
$imageid = '';
print "
\n";
print "Complete the following form to request a new block allocation. Your request \n";
print "will need to be approved by a VCL admin before it is created.
\n";
print " and periods(.) and can be from 3 to 80 characters long\" ";
print "regExp=\"^([-a-zA-Z0-9\. \(\)]){3,80}$\" style=\"width: 300px\" ";
print "postCreate=\"dijit.byId('brname').focus();\">\n";
print "
\n"; # confirm dialog
# tooltips
print <<
This is the number of environments that
will be loaded for the Block Allocation.
User in this user group will be able to make reservations
for the computers set aside for this block allocation.
If you do not see an applicable user group listed, please
select "(group not listed)" and describe the group you need
in the Additional Comments section at the bottom of
the page. If this is for a class, make sure to list the course
and section number.
Users in this user group can modify this
block allocation. Select None to keep
anyone else from being able to modify it.
For repeating block allocations, there are three ways you can enter the dates and times:
Repeating Weekly - Use this if the block allocation needs to occur every week.
You can make it repeat on a single day each week or on multiple days. The time(s)
that it occurs will be the same on all days. You can list as many times as needed.
Repeating Monthly - Use this if the block allocation needs to occur on a certain
day of the month (i.e. 2nd Tuesday each month). You can list as many times as
needed for that day of the month.
List of Dates/Times - Use this to specify any other cases, including single
events. You can specify as many date/time combinations as needed.
This is the first date the block allocation will be used.
This is the last date the block allocation will be used.
Select the checkbox for each of the days you
would like the block allocation to occur. For
example, check Monday, Wednesday, and Friday
for a class that meets on those days.
Here you specify the start and end times of the
block allocation. The times will occur on each
of the selected days. You might specify more than
one start/end combination if you had multiple
sections that met on the same day.
This is the first date the block allocation will be used.
This is the last date the block allocation will be used.
Here you specify the start and end times of the
block allocation. You might specify more than
one start/end combination if you had multiple
sections that met on the same day.
Specify individual dates and times during
which the block allocation will occur.
Enter any additional information about this block allocation.
< and > are not allowed.
If you selected "(group not listed)" as the User group, make sure
to clearly describe the requirements of a new user group that
will be created for this block allocation.
END;
}
////////////////////////////////////////////////////////////////////////////////
///
/// \fn AJblockAllocationSubmit()
///
/// \brief ajax function to process the form displayed by blockAllocationForm
///
////////////////////////////////////////////////////////////////////////////////
function AJblockAllocationSubmit() {
global $user, $blockNotifyUsers;
$data = processBlockAllocationInput();
if($data['err'])
return;
$method = getContinuationVar('method');
if($method == 'new') {
$managementnodes = getManagementNodes('future');
if(empty($managementnodes)) {
print "alert('Error encountered while trying to create block allocation:\\n";
print "no active management nodes were found. Please try\\n";
print "creating the block allocation at a later time.');";
$data = array('extragroups' => getContinuationVar('extragroups'),
'method' => $method);
if($method == 'edit')
$data['blockid'] = getContinuationVar('blockid');
$cont = addContinuationsEntry('AJblockAllocationSubmit', $data, SECINWEEK, 1, 0);
print "dojo.byId('submitcont').value = '$cont';";
return;
}
$mnid = array_rand($managementnodes);
$escname = mysql_real_escape_string($data['name']);
$query = "INSERT INTO blockRequest "
. "(name, "
. "imageid, "
. "numMachines, "
. "groupid, "
. "repeating, "
. "ownerid, "
. "admingroupid, "
. "managementnodeid, "
. "expireTime, "
. "status) "
. "VALUES "
. "('$escname', "
. "{$data['imageid']}, "
. "{$data['seats']}, "
. "{$data['groupid']}, "
. "'{$data['type']}', "
. "{$data['ownerid']}, "
. "{$data['admingroupid']}, "
. "$mnid, "
. "'{$data['expiretime']}', "
. "'accepted')";
doQuery($query, 101);
$blockreqid = dbLastInsertID();
}
elseif($method == 'edit') {
$blockreqid = getContinuationVar('blockid');
# FIXME need to handle creation of a block time that we're currently in the
# middle of if there wasn't already one we're in the middle of
# get blockTime entry for this allocation if we're in the middle of one
$checkCurBlockTime = 0;
$query = "SELECT id, "
. "start, "
. "end "
. "FROM blockTimes "
. "WHERE start <= NOW() AND "
. "end > NOW() AND "
. "blockRequestid = $blockreqid";
$qh = doQuery($query, 101);
if($row = mysql_fetch_assoc($qh)) {
$checkCurBlockTime = 1;
$curBlockTime = $row;
}
# delete entries from blockTimes that start later than now
$query = "DELETE FROM blockTimes "
. "WHERE blockRequestid = $blockreqid AND "
. "start > NOW() AND "
. "skip = 0";
doQuery($query, 101);
# delete entries from blockWebDate and blockWebTime
$query = "DELETE FROM blockWebDate WHERE blockRequestid = $blockreqid";
doQuery($query, 101);
$query = "DELETE FROM blockWebTime WHERE blockRequestid = $blockreqid";
doQuery($query, 101);
$escname = mysql_real_escape_string($data['name']);
$query = "UPDATE blockRequest "
. "SET name = '$escname', "
. "imageid = {$data['imageid']}, "
. "numMachines = {$data['seats']}, "
. "groupid = {$data['groupid']}, "
. "ownerid = {$data['ownerid']}, "
. "admingroupid = {$data['admingroupid']}, "
. "repeating = '{$data['type']}', "
. "expireTime = '{$data['expiretime']}' "
. "WHERE id = $blockreqid";
doQuery($query, 101);
}
elseif($method == 'request') {
# send email notifying about a new block allocation request
$message = "A new block allocation request has been submitted by ";
if(! empty($user['firstname']) && ! empty($user['lastname']) && ! empty($user['email']))
$message .= "{$user['firstname']} {$user['lastname']} ({$user['email']}). ";
elseif(! empty($user['email']))
$message .= "{$user['email']}. ";
else
$message .= "{$user['unityid']}. ";
$message .= "Please visit the following URL to accept or reject it:\n\n"
. BASEURL . SCRIPT . "?mode=blockAllocations\n\n"
. "(This is an automated message sent by VCL.)\n";
$mailParams = "-f" . ENVELOPESENDER;
mail($blockNotifyUsers, "VCL Block Allocation Request ({$user['unityid']})", $message, '', $mailParams);
$esccomments = mysql_real_escape_string($data['comments']);
$query = "INSERT INTO blockRequest "
. "(name, "
. "imageid, "
. "numMachines, "
. "groupid, "
. "repeating, "
. "ownerid, "
. "admingroupid, "
. "expireTime, "
. "status, "
. "comments) "
. "VALUES "
. "('(awaiting approval)', "
. "{$data['imageid']}, "
. "{$data['seats']}, "
. "{$data['groupid']}, "
. "'{$data['type']}', "
. "{$user['id']}, "
. "0, "
. "'{$data['expiretime']}', "
. "'requested', "
. "'$esccomments')";
doQuery($query, 101);
$blockreqid = dbLastInsertID();
}
if($data['type'] == 'weekly') {
$query = "INSERT INTO blockWebDate "
. "(blockRequestid, "
. "start, "
. "end, "
. "days) "
. "VALUES "
. "($blockreqid, "
. "'{$data['startdate']}', "
. "'{$data['enddate']}', "
. "{$data['daymask']})";
doQuery($query, 101);
$today = mktime(0, 0, 0);
if($method == 'edit' && $data['startts'] < $today)
createWeeklyBlockTimes($blockreqid, $today, $data['endts'], $data['daymask'], $data['times']);
elseif($method == 'new' || $method == 'edit')
createWeeklyBlockTimes($blockreqid, $data['startts'], $data['endts'], $data['daymask'], $data['times']);
}
elseif($data['type'] == 'monthly') {
$query = "INSERT INTO blockWebDate "
. "(blockRequestid, "
. "start, "
. "end, "
. "days, "
. "weeknum) "
. "VALUES "
. "($blockreqid, "
. "'{$data['startdate']}', "
. "'{$data['enddate']}', "
. "{$data['day']}, "
. "{$data['weeknum']})";
doQuery($query, 101);
$today = mktime(0, 0, 0);
if($method == 'edit' && $data['startts'] < $today)
createMonthlyBlockTimes($blockreqid, $today, $data['endts'], $data['day'], $data['weeknum'], $data['times']);
elseif($method == 'new' || $method == 'edit')
createMonthlyBlockTimes($blockreqid, $data['startts'], $data['endts'], $data['day'], $data['weeknum'], $data['times']);
}
if($data['type'] == 'weekly' || $data['type'] == 'monthly') {
$vals = array();
$i = 0;
foreach($data['times'] as $time) {
$tmp = explode('|', $time);
$start = explode(':', $tmp[0]);
$startmin = $start[1];
list($starth, $startm) = hour24to12($start[0]);
$end = explode(':', $tmp[1]);
$endmin = $end[1];
list($endh, $endm) = hour24to12($end[0]);
$vals[] = "($blockreqid, "
. "'$starth', "
. "'$startmin', "
. "'$startm', "
. "'$endh', "
. "'$endmin', "
. "'$endm', "
. "$i)";
$i++;
}
$allvals = implode(',', $vals);
$query = "INSERT INTO blockWebTime "
. "(blockRequestid, "
. "starthour, "
. "startminute, "
. "startmeridian, "
. "endhour, "
. "endminute, "
. "endmeridian, "
. "`order`) "
. "VALUES $allvals";
doQuery($query, 101);
}
if($data['type'] == 'list')
createListBlockData($blockreqid, $data['slots'], $method);
if($method == 'edit' && $checkCurBlockTime) {
$query = "SELECT id, "
. "start, "
. "end "
. "FROM blockTimes "
. "WHERE start <= NOW() AND "
. "end > NOW() AND "
. "blockRequestid = $blockreqid AND "
. "id != {$curBlockTime['id']}";
$qh = doQuery($query, 101);
if($row = mysql_fetch_assoc($qh)) {
if($curBlockTime['end'] != $row['end']) {
# update old end time
$query = "UPDATE blockTimes "
. "SET end = '{$row['end']}' "
. "WHERE id = {$curBlockTime['id']}";
doQuery($query, 101);
}
# delete $row entry
doQuery("DELETE FROM blockTimes WHERE id = {$row['id']}", 101);
}
else {
# the blockTime we were in the middle of was not recreated, so
# delete the old one
doQuery("DELETE FROM blockTimes WHERE id = {$curBlockTime['id']}", 101);
}
}
if($method == 'request') {
print "clearHideConfirmForm();";
$txt = "
Request New Block Allocation
";
$txt .= "Your request for a Block Allocation has been submitted for "
. "approval. ";
if(! empty($user['email'])) {
$txt .= "You should be notified within a few business days "
. "of its acceptance or rejection.";
}
else {
$txt .= "
Note: You do not have an "
. "email address registered with VCL. Therefore, you will "
. "not receive automatic notification when this block "
. "allocation is accepted or rejected.";
}
print "dojo.byId('content').innerHTML = '$txt';";
print "scroll(0, 0);";
return;
}
print "window.location.href = '" . BASEURL . SCRIPT . "?mode=blockAllocations';";
}
////////////////////////////////////////////////////////////////////////////////
///
/// \fn createWeeklyBlockTimes($blockid, $startts, $endts, $daymask, $times)
///
/// \param $blockid - id of block allocation
/// \param $startts - unix timestamp for starting time
/// \param $endts - unix timestamp for ending time
/// \param $daymask - bitmask int of selected days
/// \param $times - array of times in HH:MM|HH:MM (start|end) format
///
/// \brief creates entries in the blockTimes table for a weekly repeating block
/// allocation
///
////////////////////////////////////////////////////////////////////////////////
function createWeeklyBlockTimes($blockid, $startts, $endts, $daymask, $times) {
$vals = array();
$startts += 3600; # This is a simple way to deal with DST; without it. We end
# up starting at midnight. When we go through the day DST
# ends, += SECINDAY only gets us to 11pm instead of the
# next day. Adding an hour to start with starts us at 1am
# and += SECINDAY gets us to midnight the next day.
$endts += 7200; # Conversely, we pass $endts too soon when DST starts; so
# we add 2 hours to it to make sure we don't pass it.
for($day = $startts; $day <= $endts; $day += SECINDAY) {
if(! ((1 << date('w', $day)) & $daymask))
continue;
foreach($times as $time) {
$tmp = explode('|', $time);
$start = date("Y-m-d", $day) . " {$tmp[0]}:00";
$end = date("Y-m-d", $day) . " {$tmp[1]}:00";
$vals[] = "($blockid, "
. "'$start', "
. "'$end')";
}
}
$allvals = implode(',', $vals);
$query = "INSERT INTO blockTimes "
. "(blockRequestid, "
. "start, "
. "end) "
. "VALUES $allvals";
doQuery($query, 101);
deleteBlockSkipDuplicates($blockid);
}
////////////////////////////////////////////////////////////////////////////////
///
/// \fn createMonthlyBlockTimes($blockid, $startts, $endts, $day, $weeknum,
/// $times)
///
/// \param $blockid - id of block allocation
/// \param $startts - unix timestamp for starting time
/// \param $endts - unix timestamp for ending time
/// \param $dayweek - day of the week (1 to 7)
/// \param $weeknum - week of the month (1 to 5)
/// \param $times - array of times in HH:MM|HH:MM (start|end) format
///
/// \brief creates entries in the blockTimes table for a monthly repeating block
/// allocation
///
////////////////////////////////////////////////////////////////////////////////
function createMonthlyBlockTimes($blockid, $startts, $endts, $dayweek, $weeknum,
$times) {
$vals = array();
$startts += 3600; # This is a simple way to deal with DST; without it. We end
# up starting at midnight. When we go through the day DST
# ends, += SECINDAY only gets us to 11pm instead of the
# next day. Adding an hour to start with starts us at 1am
# and += SECINDAY gets us to midnight the next day.
$endts += 7200; # Conversely, we pass $endts too soon when DST starts; so
# we add 2 hours to it to make sure we don't pass it.
for($day = $startts; $day <= $endts; $day += SECINDAY) {
if((date('w', $day) + 1) != $dayweek)
continue;
$dayofmon = date('j', $day);
if(($weeknum == 1 && ($dayofmon < 8)) ||
($weeknum == 2 && (7 < $dayofmon) && ($dayofmon < 15)) ||
($weeknum == 3 && (14 < $dayofmon) && ($dayofmon < 22)) ||
($weeknum == 4 && (21 < $dayofmon) && ($dayofmon < 29)) ||
($weeknum == 5 && (28 < $dayofmon) && ($dayofmon < 32))) {
$thedate = date("Y-m-d", $day);
foreach($times as $time) {
$tmp = explode('|', $time);
$start = "$thedate {$tmp[0]}:00";
$end = "$thedate {$tmp[1]}:00";
$vals[] = "($blockid, "
. "'$start', "
. "'$end')";
}
}
}
$allvals = implode(',', $vals);
$query = "INSERT INTO blockTimes "
. "(blockRequestid, "
. "start, "
. "end) "
. "VALUES $allvals";
doQuery($query, 101);
deleteBlockSkipDuplicates($blockid);
}
////////////////////////////////////////////////////////////////////////////////
///
/// \fn createListBlockData($blockid, $slots, $method)
///
/// \param $blockid - id of block allocation
/// \param $slots - array of date/time slots in 'YYYY-MM-DD|HH:MM|HH:MM' format
/// (date|start|end)
/// \param $method - new, edit, or accept
///
/// \brief creates entries in the blockTimes table for a list type block
/// allocation
///
////////////////////////////////////////////////////////////////////////////////
function createListBlockData($blockid, $slots, $method) {
$dvals = array();
$tvals = array();
if($method == 'new' || $method == 'edit')
$btvals = array();
$i = 0;
foreach($slots as $slot) {
$tmp = explode('|', $slot);
$date = $tmp[0];
if($method == 'new' || $method == 'edit' || $method == 'accept') {
$sdatets = strtotime("$date {$tmp[1]}:00");
$sdatedt = unixToDatetime($sdatets);
$edatets = strtotime("$date {$tmp[2]}:00");
$edatedt = unixToDatetime($edatets);
$btvals[] = "($blockid, "
. "'$sdatedt', "
. "'$edatedt')";
}
if($method != 'accept') {
$start = explode(':', $tmp[1]);
$startmin = $start[1];
list($starth, $startm) = hour24to12($start[0]);
$end = explode(':', $tmp[2]);
$endmin = $end[1];
list($endh, $endm) = hour24to12($end[0]);
$dvals[] = "($blockid, "
. "'$date', "
. "'$date', "
. "$i)";
$tvals[] = "($blockid, "
. "'$starth', "
. "'$startmin', "
. "'$startm', "
. "'$endh', "
. "'$endmin', "
. "'$endm', "
. "$i)";
$i++;
}
}
if($method != 'accept') {
$alldvals = implode(',', $dvals);
$query = "INSERT INTO blockWebDate "
. "(blockRequestid, "
. "start, "
. "end, "
. "days) "
. "VALUES $alldvals";
doQuery($query, 101);
$alltvals = implode(',', $tvals);
$query = "INSERT INTO blockWebTime "
. "(blockRequestid, "
. "starthour, "
. "startminute, "
. "startmeridian, "
. "endhour, "
. "endminute, "
. "endmeridian, "
. "`order`) "
. "VALUES $alltvals";
doQuery($query, 101);
}
if($method == 'new' || $method == 'edit' || $method == 'accept') {
$allbtvals = implode(',', $btvals);
$query = "INSERT INTO blockTimes "
. "(blockRequestid, "
. "start, "
. "end) "
. "VALUES $allbtvals";
doQuery($query, 101);
deleteBlockSkipDuplicates($blockid);
}
}
////////////////////////////////////////////////////////////////////////////////
///
/// \fn deleteBlockSkipDuplicates($blockid)
///
/// \param $blockid - id of a block allocation
///
/// \brief deletes any block times without skip set for which there is a
/// matching block time with skip set; deletes any with skip set where there is
/// not a matching time without skip set
///
////////////////////////////////////////////////////////////////////////////////
function deleteBlockSkipDuplicates($blockid) {
$query = "SELECT id, "
. "start, "
. "end, "
. "skip "
. "FROM blockTimes "
. "WHERE blockRequestid = $blockid";
$qh = doQuery($query, 101);
$skips = array();
$noskips = array();
while($row = mysql_fetch_assoc($qh)) {
$key = "{$row['start']}:{$row['end']}";
if($row['skip'])
$skips[$key] = $row['id'];
else
$noskips[$key] = $row['id'];
}
$deleteids = array();
foreach($skips as $key => $id) {
if(array_key_exists($key, $noskips))
$deleteids[] = $noskips[$key];
else
$deleteids[] = $id;
}
if(empty($deleteids))
return;
$inids = implode(',', $deleteids);
$query = "DELETE FROM blockTimes "
. "WHERE id IN ($inids)";
doQuery($query, 101);
}
////////////////////////////////////////////////////////////////////////////////
///
/// \fn getCurrentBlockHTML($listonly)
///
/// \param $listonly (optional, default=0) - 0 to return everything, 1 to only
/// return the table of block allocations (i.e. don't include the delete dialog)
///
/// \return HTML to display current block allocations
///
/// \brief generates the HTML to display a list of the current block allocations
/// and a dojo dialog for deleting them
///
////////////////////////////////////////////////////////////////////////////////
function getCurrentBlockHTML($listonly=0) {
global $user, $days;
$groups = getUserEditGroups($user['id']);
$groupids = implode(',', array_keys($groups));
$query = "SELECT b.id, "
. "b.name AS blockname, "
. "b.ownerid, "
. "CONCAT(u.unityid, '@', ua.name) AS owner, "
. "b.imageid, "
. "i.prettyname AS image, "
. "b.numMachines AS machinecnt, "
. "b.groupid as usergroupid, "
. "CONCAT(g.name, '@', a.name) AS `group`, "
. "b.admingroupid as admingroupid, "
. "CONCAT(ga.name, '@', aa.name) AS `admingroup`, "
. "b.repeating AS available "
. "FROM image i, "
. "blockRequest b "
. "LEFT JOIN usergroup g ON (b.groupid = g.id) "
. "LEFT JOIN affiliation a ON (g.affiliationid = a.id) "
. "LEFT JOIN usergroup ga ON (b.admingroupid = ga.id) "
. "LEFT JOIN affiliation aa ON (ga.affiliationid = aa.id) "
. "LEFT JOIN user u ON (b.ownerid = u.id) "
. "LEFT JOIN affiliation ua ON (u.affiliationid = ua.id) "
. "WHERE (b.ownerid = {$user['id']} ";
if(! empty($groupids))
$query .= "OR b.admingroupid IN ($groupids) ";
$query .= ") AND b.imageid = i.id AND "
. "b.status = 'accepted' "
. "ORDER BY b.name";
$allblockids = array();
$qh = doQuery($query, 101);
while($row = mysql_fetch_assoc($qh)) {
if($row['group'] == '') {
$query3 = "SELECT name FROM usergroup WHERE id = {$row['usergroupid']}";
$qh3 = doQuery($query3, 101);
if($row3 = mysql_fetch_assoc($qh3))
$row['group'] = $row3['name'];
}
$allblockids[] = $row['id'];
$blocks[$row['id']] = $row;
$query2 = "SELECT DATE_FORMAT(start, '%c/%e/%y %l:%i %p') AS start1, "
. "UNIX_TIMESTAMP(start) AS unixstart, "
. "UNIX_TIMESTAMP(end) AS unixend "
. "FROM blockTimes "
. "WHERE blockRequestid = {$row['id']} AND "
. "end > NOW() AND "
. "skip = 0 "
. "ORDER BY start "
. "LIMIT 1";
$qh2 = doQuery($query2, 101);
if($row2 = mysql_fetch_assoc($qh2)) {
$blocks[$row['id']]['nextstart'] = $row2['start1'];
if(time() > ($row2['unixstart'] - 1800) &&
time() < $row2['unixend'])
$blocks[$row['id']]['nextstartactive'] = 1;
else
$blocks[$row['id']]['nextstartactive'] = 0;
}
else {
$blocks[$row['id']]['nextstart'] = "none found";
$blocks[$row['id']]['nextstartactive'] = 0;
}
}
if(empty($blocks)) {
return "There are currently no block allocations. \n";
}
foreach($blocks as $id => $request) {
if($request['available'] == 'weekly') {
$query = "SELECT DATE_FORMAT(start, '%m/%d/%y') AS swdate, "
. "DATE_FORMAT(end, '%m/%d/%y')AS ewdate, "
. "days "
. "FROM blockWebDate "
. "WHERE blockRequestid = $id";
$qh = doQuery($query, 101);
if(! $row = mysql_fetch_assoc($qh))
abort(101);
$blocks[$id] = array_merge($request, $row);
$wdays = array();
for($i = 0; $i < 7; $i++) {
if($row['days'] & (1 << $i))
array_push($wdays, $days[$i]);
}
unset($blocks[$id]['days']);
$blocks[$id]['wdays'] = $wdays;
$query = "SELECT starthour, "
. "startminute, "
. "startmeridian, "
. "endhour, "
. "endminute, "
. "endmeridian, "
. "`order` "
. "FROM blockWebTime "
. "WHERE blockRequestid = {$request['id']} "
. "ORDER BY startmeridian, starthour, startminute";
$qh = doQuery($query, 101);
while($row = mysql_fetch_assoc($qh)) {
$blocks[$id]['swhour'][$row['order']] = $row['starthour'];
$blocks[$id]['swminute'][$row['order']] = $row['startminute'];
$blocks[$id]['swmeridian'][$row['order']] = $row['startmeridian'];
$blocks[$id]['ewhour'][$row['order']] = $row['endhour'];
$blocks[$id]['ewminute'][$row['order']] = $row['endminute'];
$blocks[$id]['ewmeridian'][$row['order']] = $row['endmeridian'];
}
}
elseif($request['available'] == 'monthly') {
$query = "SELECT DATE_FORMAT(start, '%m/%d/%y') AS smdate, "
. "DATE_FORMAT(end, '%m/%d/%y')AS emdate, "
. "days AS day, "
. "weeknum "
. "FROM blockWebDate "
. "WHERE blockRequestid = $id";
$qh = doQuery($query, 101);
if(! $row = mysql_fetch_assoc($qh))
abort(101);
$blocks[$id] = array_merge($request, $row);
$query = "SELECT starthour, "
. "startminute, "
. "startmeridian, "
. "endhour, "
. "endminute, "
. "endmeridian, "
. "`order` "
. "FROM blockWebTime "
. "WHERE blockRequestid = {$request['id']} "
. "ORDER BY startmeridian, starthour, startminute";
$qh = doQuery($query, 101);
while($row = mysql_fetch_assoc($qh)) {
$blocks[$id]['smhour'][$row['order']] = $row['starthour'];
$blocks[$id]['smminute'][$row['order']] = $row['startminute'];
$blocks[$id]['smmeridian'][$row['order']] = $row['startmeridian'];
$blocks[$id]['emhour'][$row['order']] = $row['endhour'];
$blocks[$id]['emminute'][$row['order']] = $row['endminute'];
$blocks[$id]['emmeridian'][$row['order']] = $row['endmeridian'];
}
}
elseif($request['available'] == 'list') {
$query = "SELECT DATE_FORMAT(start, '%m/%d/%y') AS date, "
. "days AS `order` "
. "FROM blockWebDate "
. "WHERE blockRequestid = $id "
. "ORDER BY start";
$qh = doQuery($query, 101);
while($row = mysql_fetch_assoc($qh)) {
if($row['date'] == '00/00/00')
$blocks[$id]['date'][$row['order']] = '';
else
$blocks[$id]['date'][$row['order']] = $row['date'];
}
$query = "SELECT starthour, "
. "startminute, "
. "startmeridian, "
. "endhour, "
. "endminute, "
. "endmeridian, "
. "`order` "
. "FROM blockWebTime "
. "WHERE blockRequestid = {$request['id']}";
$qh = doQuery($query, 101);
while($row = mysql_fetch_assoc($qh)) {
$blocks[$id]['slhour'][$row['order']] = $row['starthour'];
$blocks[$id]['slminute'][$row['order']] = $row['startminute'];
$blocks[$id]['slmeridian'][$row['order']] = $row['startmeridian'];
$blocks[$id]['elhour'][$row['order']] = $row['endhour'];
$blocks[$id]['elminute'][$row['order']] = $row['endminute'];
$blocks[$id]['elmeridian'][$row['order']] = $row['endmeridian'];
}
}
}
$rt = '';
$rt .= "
\n";
$rt .= "The following text will be emailed to : \n";
$rt .= "\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "Note: The requesting user does not have an email address registered \n";
$rt .= "with VCL. Therefore, the user cannot be notified automatically.\n";
$rt .= "
\n";
$rt .= "Please review the following information, add a reason for rejecting \n";
$rt .= "the block allocation, and click Reject Block Allocation.
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
Environment:
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
User Group:
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
Seats:
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
Repeating:
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "The following text will be emailed to : \n";
$rt .= "
\n";
$rt .= "
\n";
$rt .= "The requesting user does not have an email address registered with VCL. Therefore, \n";
$rt .= "the user cannot be notified automatically. However, for archival purposes, fill in a \n";
$rt .= "reason for rejecting the request:\n";
$rt .= "