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

@@ -424,7 +424,6 @@ function booking_rooms_view_form($node, &$form_state, $location_id) {
array(':id' => $location_id)) array(':id' => $location_id))
->fetchObject(); ->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)); $prefix = t("<h2>Room Allocations for !room</h2>", array('!room' => $location_description->booking_roomlocation_descrip));
//query for room definitions //query for room definitions
@@ -453,18 +452,14 @@ function booking_rooms_view_form($node, &$form_state, $location_id) {
'booking_room_queenbed_p2' => array('data' => t('Queen Bed Person 2')), '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 //load the existing bed mappings for this room
$existing_beds = array(); $existing_beds = array();
for ($i = 1; $i <= 3; $i++) for ($i = 1; $i <= 3; $i++) {
{ foreach ($room_mapping as $mapping) {
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 //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 //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; $existing_beds[$i][] = $mapping->booking_nodeid;
} }
} }
@@ -473,7 +468,7 @@ function booking_rooms_view_form($node, &$form_state, $location_id) {
//create a row that contains just the room location and number //create a row that contains just the room location and number
$rows[] = array( $rows[] = array(
'data' => array( 'data' => array(
$data->booking_room_number, $data->booking_room_number . " &dash; " . $data->booking_room_description,
"", "",
"", "",
"", "",
@@ -484,8 +479,7 @@ function booking_rooms_view_form($node, &$form_state, $location_id) {
); );
//create an additional row for each single bed //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 //retrieve the default value if one exists
$nid = (!empty($existing_beds[1][$i])) ? $existing_beds[1][$i] : 0; $nid = (!empty($existing_beds[1][$i])) ? $existing_beds[1][$i] : 0;
@@ -504,8 +498,7 @@ function booking_rooms_view_form($node, &$form_state, $location_id) {
//create an additional row for each double bed //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 is our counter that increments twice as fast as $i to cater for both beds
$j = 0; $j = 0;
for ($i = 0; $i < $data->booking_room_doublebeds; $i++) for ($i = 0; $i < $data->booking_room_doublebeds; $i++) {
{
$rows[] = array( $rows[] = array(
'data' => array( 'data' => array(
"", "",
@@ -521,8 +514,7 @@ function booking_rooms_view_form($node, &$form_state, $location_id) {
//create an additional row for each queen bed //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 is our counter that increments twice as fast as $i to cater for both beds
$j = 0; $j = 0;
for ($i = 1; $i <= $data->booking_room_queenbeds; $i++) for ($i = 1; $i <= $data->booking_room_queenbeds; $i++) {
{
$rows[] = array( $rows[] = array(
'data' => array( 'data' => array(
"", "",