implement earlyaccess code summary
This commit is contained in:
@@ -5,41 +5,64 @@
|
|||||||
* Admin pages for managing early access codes
|
* Admin pages for managing early access codes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @todo - list all early access codes for the current event, whether they're available, and who used them if not
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to summarise information about early access codes
|
* Function to summarise information about early access codes
|
||||||
*/
|
*/
|
||||||
function booking_earlyaccess_admin() {
|
function booking_earlyaccess_admin() {
|
||||||
|
|
||||||
// @todo - list all early access codes for the current event, whether they're available, and who used them if not
|
|
||||||
|
|
||||||
global $event;
|
global $event;
|
||||||
$output = "";
|
$output = "";
|
||||||
$header = array('Study Group', 'Session Count', 'Reading Group?', 'Edit Definition');
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
$attributes = array('style' => 'max-width:60%');
|
$attributes = array('style' => 'max-width:60%', 'id' => 'sort-table');
|
||||||
//$attributes = array();
|
$prefix = t("<h2>Early Access Codes</h2>");
|
||||||
|
|
||||||
//get study groups
|
|
||||||
$query = db_select('booking_studygroup_list', 's')
|
|
||||||
->fields('s')
|
|
||||||
->condition('s.booking_eventid', $event->eid, '=');
|
|
||||||
$result = $query->execute();
|
|
||||||
|
|
||||||
foreach ($result as $group) {
|
|
||||||
$rows[] = array(
|
|
||||||
$group->booking_studygroup_descrip,
|
|
||||||
$group->booking_num_group_sessions,
|
|
||||||
$group->booking_is_readinggroup == 'Y' ? 'Yes' : 'No',
|
|
||||||
l(t('Edit Group Definition', array('!id' => $group->sid)), t('admin/config/booking/studygroups/!id/edit', array('!id' => $group->sid))),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//output everything
|
$header = array(
|
||||||
$output .= t("<h3>!event Study Groups</h3>", array('!event' => $event->booking_eventname));
|
'booking_regn_earlyaccess_code' => array('data' => t('Code'), 'field' => 'c.booking_regn_earlyaccess_code', 'sort' => 'asc'),
|
||||||
$output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => $attributes));
|
'booking_regn_earlyaccess_code_avail' => array('data' => t('Available?'), 'field' => 'c.booking_regn_earlyaccess_code_avail'),
|
||||||
|
'booking_firstname' => array('data' => t('First Name'), 'field' => 'p.booking_firstname'),
|
||||||
|
'booking_lastname' => array('data' => t('Last Name'), 'field' => 'p.booking_lastname'),
|
||||||
|
);
|
||||||
|
|
||||||
return $output;
|
//get a list of all the early access codes for this event
|
||||||
|
$codelist_query = db_select('booking_regn_earlyaccess_codes', 'c');
|
||||||
|
$codelist_query->leftJoin('booking_person', 'p', 'c.cid = p.booking_earlyaccess_code_id');
|
||||||
|
$codelist_query->condition('c.booking_eventid', $event->eid, '=')
|
||||||
|
->fields('c')
|
||||||
|
->fields('p')
|
||||||
|
->orderBy('cid');
|
||||||
|
$result = $codelist_query->execute();
|
||||||
|
|
||||||
|
//add results to array
|
||||||
|
foreach($result as $data) {
|
||||||
|
$rows[] = array(
|
||||||
|
'data' => array(
|
||||||
|
$data->booking_regn_earlyaccess_code,
|
||||||
|
$data->booking_regn_earlyaccess_code_avail == 'Y' ? 'Yes' : 'No',
|
||||||
|
$data->booking_firstname,
|
||||||
|
$data->booking_lastname,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//theme output
|
||||||
|
$output = array (
|
||||||
|
'first_para' => array (
|
||||||
|
'#type' => 'markup',
|
||||||
|
'#markup' => $prefix,
|
||||||
|
),
|
||||||
|
'table' => array (
|
||||||
|
'#theme' => 'table',
|
||||||
|
'#header' => $header,
|
||||||
|
'#rows' => $rows,
|
||||||
|
'#attributes' => $attributes,
|
||||||
|
//'#sticky' => FALSE,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
//return markup array
|
||||||
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user