add room descriptions to view room allocations page

This commit is contained in:
2016-06-27 11:48:33 +10:00
parent 63226d93f0
commit b3b4fef4d2

View File

@@ -421,10 +421,9 @@ function booking_rooms_view_form($node, &$form_state, $location_id) {
}
$location_description = db_query("SELECT booking_roomlocation_descrip FROM {booking_room_locations} where lid = :id",
array(':id' => $location_id))
->fetchObject();
array(':id' => $location_id))
->fetchObject();
//$prefix = t("<h2>Room Allocations for !room</h2>", array('!room' => _booking_room_location_lookup($location_id)));
$prefix = t("<h2>Room Allocations for !room</h2>", array('!room' => $location_description->booking_roomlocation_descrip));
//query for room definitions
@@ -444,7 +443,7 @@ function booking_rooms_view_form($node, &$form_state, $location_id) {
array(':eid' => $event->eid))->fetchAllAssoc('nid');
//define the header
$header = array (
$header = array(
'booking_room_number' => array('data' => t('Room Number')),
'booking_room_singlebed' => array('data' => t('Single Bed')),
'booking_room_doublebed_p1' => array('data' => t('Double Bed Person 1')),
@@ -453,27 +452,23 @@ function booking_rooms_view_form($node, &$form_state, $location_id) {
'booking_room_queenbed_p2' => array('data' => t('Queen Bed Person 2')),
);
foreach ($room_query as $data)
{
foreach ($room_query as $data) {
//load the existing bed mappings for this room
$existing_beds = array();
for ($i = 1; $i <= 3; $i++)
{
foreach ($room_mapping as $mapping)
{
for ($i = 1; $i <= 3; $i++) {
foreach ($room_mapping as $mapping) {
//check that the room id in the mapping table matches the room that we're currently adding to the table
//and also the bed type matches the first dimension in the array
if ($mapping->booking_roomid == $data->rid && $mapping->booking_room_bedtype == $i)
{
if ($mapping->booking_roomid == $data->rid && $mapping->booking_room_bedtype == $i) {
$existing_beds[$i][] = $mapping->booking_nodeid;
}
}
}
//create a row that contains just the room location and number
$rows[] = array (
$rows[] = array(
'data' => array(
$data->booking_room_number,
$data->booking_room_number . " &dash; " . $data->booking_room_description,
"",
"",
"",
@@ -484,12 +479,11 @@ function booking_rooms_view_form($node, &$form_state, $location_id) {
);
//create an additional row for each single bed
for ($i = 0; $i < $data->booking_room_singlebeds; $i++)
{
for ($i = 0; $i < $data->booking_room_singlebeds; $i++) {
//retrieve the default value if one exists
$nid = (!empty($existing_beds[1][$i])) ? $existing_beds[1][$i] : 0;
$rows[] = array (
$rows[] = array(
'data' => array(
"",
_booking_rooms_view_formatperson($attendees, $nid),
@@ -504,9 +498,8 @@ function booking_rooms_view_form($node, &$form_state, $location_id) {
//create an additional row for each double bed
//$j is our counter that increments twice as fast as $i to cater for both beds
$j = 0;
for ($i = 0; $i < $data->booking_room_doublebeds; $i++)
{
$rows[] = array (
for ($i = 0; $i < $data->booking_room_doublebeds; $i++) {
$rows[] = array(
'data' => array(
"",
"",
@@ -521,9 +514,8 @@ function booking_rooms_view_form($node, &$form_state, $location_id) {
//create an additional row for each queen bed
//$j is our counter that increments twice as fast as $i to cater for both beds
$j = 0;
for ($i = 1; $i <= $data->booking_room_queenbeds; $i++)
{
$rows[] = array (
for ($i = 1; $i <= $data->booking_room_queenbeds; $i++) {
$rows[] = array(
'data' => array(
"",
"",
@@ -539,15 +531,15 @@ function booking_rooms_view_form($node, &$form_state, $location_id) {
//watchdog('booking', "<pre>Room assignment report rows:\n@info</pre>", array('@info' => print_r( $rows, true)));
$result = array (
'#attached' => array (
$result = array(
'#attached' => array(
'css' => array(drupal_get_path('module', 'booking') . '/booking.css')
),
'first_para' => array (
'first_para' => array(
'#type' => 'markup',
'#markup' => $prefix,
),
'table' => array (
'table' => array(
'#theme' => 'table',
'#header' => $header,
'#rows' => $rows,