Added sorting header to booking summary
This commit is contained in:
@@ -248,6 +248,13 @@ function booking_update_7206() {
|
|||||||
db_add_field( 'booking_studygroup_mapping', 'booking_session_id', $spec);
|
db_add_field( 'booking_studygroup_mapping', 'booking_session_id', $spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add field to support welfare required flag
|
||||||
|
*/
|
||||||
|
function booking_update_7207() {
|
||||||
|
$spec = array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE);
|
||||||
|
db_add_field( 'booking_person', 'booking_welfare_required', $spec);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of hook_install().
|
* Implementation of hook_install().
|
||||||
@@ -354,6 +361,7 @@ function booking_schema() {
|
|||||||
'booking_tempid' => array('type' => 'varchar', 'length' => '40', 'not null' => FALSE),
|
'booking_tempid' => array('type' => 'varchar', 'length' => '40', 'not null' => FALSE),
|
||||||
'booking_timestamp' => array('type' => 'int', 'not null' => TRUE, 'disp-width' => '11'),
|
'booking_timestamp' => array('type' => 'int', 'not null' => TRUE, 'disp-width' => '11'),
|
||||||
'booking_status' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE),
|
'booking_status' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE),
|
||||||
|
'booking_welfare_required' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE),
|
||||||
'booking_barcode' => array('type' => 'varchar', 'length' => '8', 'not null' => FALSE),
|
'booking_barcode' => array('type' => 'varchar', 'length' => '8', 'not null' => FALSE),
|
||||||
'booking_firstname' => array('type' => 'varchar', 'length' => '50', 'not null' => TRUE),
|
'booking_firstname' => array('type' => 'varchar', 'length' => '50', 'not null' => TRUE),
|
||||||
'booking_lastname' => array('type' => 'varchar', 'length' => '50', 'not null' => TRUE),
|
'booking_lastname' => array('type' => 'varchar', 'length' => '50', 'not null' => TRUE),
|
||||||
|
@@ -23,7 +23,17 @@ function booking_report_summary() {
|
|||||||
$person_count = 0;
|
$person_count = 0;
|
||||||
|
|
||||||
$stats_attributes = array('style' => 'max-width:30%');
|
$stats_attributes = array('style' => 'max-width:30%');
|
||||||
$header = array('Id', 'Name', 'Email', 'Payment To Date', 'Total Payment Required');
|
|
||||||
|
//define sorting information with the header
|
||||||
|
//as per http://www.drup-all.com/blog/table-sort-pagination-drupal-7
|
||||||
|
$header = array(
|
||||||
|
array('data' => t('Id'), 'field' => 'nid', 'sort' => 'asc'),
|
||||||
|
array('data' => t('Name'), 'field' => 'booking_lastname', 'sort' => 'asc'),
|
||||||
|
array('data' => t('Email'), 'field' => 'booking_email', 'sort' => 'asc'),
|
||||||
|
array('data' => t('Payment To Date'), 'field' => 'booking_amount_paid', 'sort' => 'asc'),
|
||||||
|
array('data' => t('Total Payment Required'), 'field' => 'booking_total_pay_reqd', 'sort' => 'asc'),
|
||||||
|
);
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
$state_header = array('State', 'Count');
|
$state_header = array('State', 'Count');
|
||||||
$state_rows = array();
|
$state_rows = array();
|
||||||
@@ -93,8 +103,13 @@ function booking_report_summary() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//more detailed summary
|
//more detailed summary
|
||||||
$result = db_query("SELECT * FROM {booking_person} p WHERE p.booking_event_id = :eid",
|
//allow user-selectable sorting of columns as per http://www.drup-all.com/blog/table-sort-pagination-drupal-7
|
||||||
array(':eid' => $event->eid));
|
$query = db_select('booking_person', 'p')
|
||||||
|
->fields('p')
|
||||||
|
->condition('p.booking_event_id', $event->eid, '=');
|
||||||
|
$table_sort = $query->extend('TableSort')->orderbyHeader($header);
|
||||||
|
$result = $table_sort->execute();
|
||||||
|
|
||||||
foreach ($result as $person) {
|
foreach ($result as $person) {
|
||||||
$rows[] = array(
|
$rows[] = array(
|
||||||
l(t('!id', array('!id' => $person->nid)), t('node/!id', array('!id' => $person->nid))),
|
l(t('!id', array('!id' => $person->nid)), t('node/!id', array('!id' => $person->nid))),
|
||||||
@@ -130,7 +145,7 @@ function booking_report_summary() {
|
|||||||
$output .= t("<h3>Bookings by ecclesia</h3>");
|
$output .= t("<h3>Bookings by ecclesia</h3>");
|
||||||
$output .= theme('table', array('header' => $ecclesia_heaeder, 'rows' => $ecclesia_rows, 'attributes' => $stats_attributes));
|
$output .= theme('table', array('header' => $ecclesia_heaeder, 'rows' => $ecclesia_rows, 'attributes' => $stats_attributes));
|
||||||
$output .= t("<h3>Summary of attendees for !event.</h3>", array('!event' => $event->booking_eventname));
|
$output .= t("<h3>Summary of attendees for !event.</h3>", array('!event' => $event->booking_eventname));
|
||||||
$output .= theme('table', array('header' => $header, 'rows' => $rows));
|
$output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'sort-table')));
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user