add room descriptions to view room allocations page
This commit is contained in:
@@ -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
|
||||||
@@ -444,7 +443,7 @@ function booking_rooms_view_form($node, &$form_state, $location_id) {
|
|||||||
array(':eid' => $event->eid))->fetchAllAssoc('nid');
|
array(':eid' => $event->eid))->fetchAllAssoc('nid');
|
||||||
|
|
||||||
//define the header
|
//define the header
|
||||||
$header = array (
|
$header = array(
|
||||||
'booking_room_number' => array('data' => t('Room Number')),
|
'booking_room_number' => array('data' => t('Room Number')),
|
||||||
'booking_room_singlebed' => array('data' => t('Single Bed')),
|
'booking_room_singlebed' => array('data' => t('Single Bed')),
|
||||||
'booking_room_doublebed_p1' => array('data' => t('Double Bed Person 1')),
|
'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')),
|
'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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//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 . " ‐ " . $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
|
//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;
|
||||||
|
|
||||||
$rows[] = array (
|
$rows[] = array(
|
||||||
'data' => array(
|
'data' => array(
|
||||||
"",
|
"",
|
||||||
_booking_rooms_view_formatperson($attendees, $nid),
|
_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
|
//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,9 +514,8 @@ 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(
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
@@ -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)));
|
//watchdog('booking', "<pre>Room assignment report rows:\n@info</pre>", array('@info' => print_r( $rows, true)));
|
||||||
|
|
||||||
$result = array (
|
$result = array(
|
||||||
'#attached' => array (
|
'#attached' => array(
|
||||||
'css' => array(drupal_get_path('module', 'booking') . '/booking.css')
|
'css' => array(drupal_get_path('module', 'booking') . '/booking.css')
|
||||||
),
|
),
|
||||||
'first_para' => array (
|
'first_para' => array(
|
||||||
'#type' => 'markup',
|
'#type' => 'markup',
|
||||||
'#markup' => $prefix,
|
'#markup' => $prefix,
|
||||||
),
|
),
|
||||||
'table' => array (
|
'table' => array(
|
||||||
'#theme' => 'table',
|
'#theme' => 'table',
|
||||||
'#header' => $header,
|
'#header' => $header,
|
||||||
'#rows' => $rows,
|
'#rows' => $rows,
|
||||||
|
Reference in New Issue
Block a user