diff --git a/booking.reports.inc b/booking.reports.inc
index 7ac8caf..b7daff0 100644
--- a/booking.reports.inc
+++ b/booking.reports.inc
@@ -381,7 +381,7 @@ function booking_coming_page() {
global $event;
$output = "";
$table = "";
- $attributes = array('style' => 'max-width:60%');
+ $attributes = array('style' => 'width:50%; margin-left:25%; margin-right:25%;');
$booking_limit = variable_get('booking_regn_limit','350');
$rows = array();
diff --git a/booking.rooms_admin.inc b/booking.rooms_admin.inc
index 4396f38..dcd832c 100644
--- a/booking.rooms_admin.inc
+++ b/booking.rooms_admin.inc
@@ -114,7 +114,7 @@ function booking_roomlocation_define_form($node, &$form_state, $create, $editid
$form['Update'] = array
(
'#type' => 'submit',
- '#value' => t('Updat'),
+ '#value' => t('Update'),
);
$form['Delete'] = array
(
@@ -221,22 +221,32 @@ function booking_roomlocation_define_form_submit($form, &$form_state) {
*/
function booking_rooms_view_definitions() {
global $event;
- $rows = array();
- $prefix = "
Room Definitions
";
+ $location_rows = array();
+ $definition_rows = array();
+ $attributes = array('style' => 'max-width:60%');
+ $location_prefix = "Room Locations
";
+ $definition_prefix = "Room Definitions
";
- $query = db_select('booking_room_definition', 'r');
- $query->join('booking_room_locations', 'l', 'l.lid = r.booking_room_location_id');
- $query->condition('l.booking_roomlocation_active', 'Y', '=')
+ //get a list of all the room locations
+ $locations_query = db_select('booking_room_locations', 'l')
+ ->fields('l');
+ $location_result = $locations_query->execute();
+
+ //get a list of all the room definitions at those locations
+ $definition_query = db_select('booking_room_definition', 'r');
+ $definition_query->join('booking_room_locations', 'l', 'l.lid = r.booking_room_location_id');
+ $definition_query->condition('l.booking_roomlocation_active', 'Y', '=')
->fields('r')
->fields('l');
+ $definition_result = $definition_query->execute();
- $result = $query->execute();
+ $location_header = array (
+ 'booking_roomlocation_descrip' => t('Location Description'),
+ 'booking_roomlocation_active' => t('Location Active?'),
+ 'booking_location_edit' => t('Edit Location'),
+ );
- //query for room definitions
- //$result = db_query("SELECT * from {booking_room_definition}");
-
-
- $header = array (
+ $definition_header = array (
'booking_room_location_description' => t('Room Location'),
'booking_room_number' => t('Room Number'),
'booking_room_singlebeds' => t('Number Single Beds'),
@@ -245,10 +255,19 @@ function booking_rooms_view_definitions() {
'booking_room_ensuite' => t('Ensuite?'),
'booking_room_edit' => t('Edit Room'),
);
-
- foreach($result as $data)
+
+ foreach($location_result as $data)
{
- $rows[] = array (
+ $location_rows[] = array (
+ $data->booking_roomlocation_descrip,
+ $data->booking_roomlocation_active == 'Y' ? 'Yes' : 'No',
+ l(t('Edit'), t('admin/config/booking/rooms/locations/!id/edit', array('!id' => $data->lid))),
+ );
+ }
+
+ foreach($definition_result as $data)
+ {
+ $definition_rows[] = array (
//_booking_room_location_lookup($data->booking_room_location_id),
$data->booking_roomlocation_descrip,
$data->booking_room_number,
@@ -258,31 +277,31 @@ function booking_rooms_view_definitions() {
$data->booking_room_ensuite == 'Y' ? 'Yes' : 'No',
l(t('Edit'), t('admin/config/booking/rooms/!id/edit', array('!id' => $data->rid))),
);
- /*
- $options[$data->rid] = array
- (
- 'booking_room_location_description' => _booking_room_location_lookup($data->booking_room_location_id),
- 'booking_room_number' => $data->booking_room_number,
- 'booking_room_singlebeds' => $data->booking_room_singlebeds,
- 'booking_room_doublebeds' => $data->booking_room_doublebeds,
- 'booking_room_queenbeds' => $data->booking_room_queenbeds,
- 'booking_room_ensuite' => $data->booking_room_ensuite == 'Y' ? 'Yes' : 'No',
- );
- */
}
$result = array (
- 'first_para' => array (
+ 'locations_heading' => array (
'#type' => 'markup',
- '#markup' => $prefix,
+ '#markup' => $location_prefix,
),
- 'table' => array (
+ 'table_locations' => array (
'#theme' => 'table',
- '#header' => $header,
- '#rows' => $rows,
+ '#header' => $location_header,
+ '#rows' => $location_rows,
+ '#empty' => t('No room location definitions found.'),
+ '#attributes' => $attributes,
+ ),
+ 'definitions_heading' => array (
+ '#type' => 'markup',
+ '#markup' => $definition_prefix,
+ ),
+ 'table_definitions' => array (
+ '#theme' => 'table',
+ '#header' => $definition_header,
+ '#rows' => $definition_rows,
'#empty' => t('No room definitions found.'),
//'#attributes' => array('id' => 'sort-table'),
- )
+ ),
);
return $result;