Room allocation report
This commit is contained in:
@@ -132,7 +132,7 @@ function _booking_room_bedtype_lookup($input = NULL)
|
|||||||
if ($input != NULL)
|
if ($input != NULL)
|
||||||
return $bed[$input];
|
return $bed[$input];
|
||||||
else
|
else
|
||||||
return $role;
|
return $bed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -401,6 +401,14 @@ function booking_menu() {
|
|||||||
'type' => MENU_NORMAL_ITEM,
|
'type' => MENU_NORMAL_ITEM,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$items['admin/booking/rooms/report'] = array(
|
||||||
|
'title' => 'View All Room Allocations',
|
||||||
|
'description' => 'View All Room Allocations',
|
||||||
|
'page callback' => 'booking_roomallocations_view_summary',
|
||||||
|
'access arguments' => array("view room allocations"),
|
||||||
|
'type' => MENU_LOCAL_ACTION,
|
||||||
|
);
|
||||||
|
|
||||||
$items['admin/booking/rooms/%/assign'] = array(
|
$items['admin/booking/rooms/%/assign'] = array(
|
||||||
'title' => 'Assign Rooms',
|
'title' => 'Assign Rooms',
|
||||||
'description' => 'Assign attendees to rooms',
|
'description' => 'Assign attendees to rooms',
|
||||||
|
@@ -40,6 +40,70 @@ function booking_room_view_summary() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function for viewing a printable format of who belongs to which study group
|
||||||
|
*/
|
||||||
|
function booking_roomallocations_view_summary() {
|
||||||
|
global $event;
|
||||||
|
|
||||||
|
$rows = array();
|
||||||
|
|
||||||
|
$header = array(
|
||||||
|
'booking_firstname' => array('data' => t('First Name'), 'field' => 'p.booking_firstname'),
|
||||||
|
'booking_lastname' => array('data' => t('Last Name'), 'field' => 'p.booking_lastname', 'sort' => 'asc'),
|
||||||
|
'booking_gender' => array('data' => t('Gender'), 'field' => 'p.booking_gender'),
|
||||||
|
'booking_age' => array('data' => t('Age'), 'field' => 'p.booking_dob'),
|
||||||
|
'booking_roomlocation' => array('data' => t('Room Location'), 'field' => 'r.booking_room_location_id'),
|
||||||
|
'booking_room_num' => array('data' => t('Room Number'), 'field' => 'r.booking_room_number'),
|
||||||
|
'booking_room_bedtype' => array('data' => t('Bed Type'), 'field' => 'm.booking_room_bedtype')
|
||||||
|
);
|
||||||
|
|
||||||
|
$query = db_select('booking_person', 'p');
|
||||||
|
$query->leftJoin('booking_room_mapping', 'm', 'm.booking_nodeid = p.nid');
|
||||||
|
$query->leftJoin('booking_room_definition', 'r', 'r.rid = m.booking_roomid');
|
||||||
|
$db_and = db_and();
|
||||||
|
$db_and->condition('p.booking_event_id', $event->eid, '=');
|
||||||
|
$db_and->condition('p.booking_status', 1, '=');
|
||||||
|
$query->condition($db_and);
|
||||||
|
$query->fields('p')->fields('m')->fields('r');
|
||||||
|
$table_sort = $query->extend('TableSort')->orderbyHeader($header);
|
||||||
|
$result = $table_sort->execute();
|
||||||
|
|
||||||
|
foreach($result as $data)
|
||||||
|
{
|
||||||
|
$rows[] = array (
|
||||||
|
'data' => array(
|
||||||
|
$data->booking_firstname,
|
||||||
|
$data->booking_lastname,
|
||||||
|
$data->booking_gender == 'M' ? 'Male' : 'Female',
|
||||||
|
_booking_get_age_years($data->booking_dob),
|
||||||
|
_booking_room_location_lookup($data->booking_room_location_id),
|
||||||
|
$data->booking_room_number,
|
||||||
|
_booking_room_bedtype_lookup($data->booking_room_bedtype),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$prefix = t("<h2>Room Allocations</h2>");
|
||||||
|
|
||||||
|
$result = array (
|
||||||
|
'first_para' => array (
|
||||||
|
'#type' => 'markup',
|
||||||
|
'#markup' => $prefix,
|
||||||
|
),
|
||||||
|
'table' => array (
|
||||||
|
'#theme' => 'table',
|
||||||
|
'#header' => $header,
|
||||||
|
'#rows' => $rows,
|
||||||
|
'#attributes' => array('id' => 'sort-table'),
|
||||||
|
//'#sticky' => FALSE,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to define the form for configuring room definitions and also display existing room definitions
|
* Function to define the form for configuring room definitions and also display existing room definitions
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user