start work on admin page for early access codes

This commit is contained in:
2017-06-29 12:10:19 +10:00
parent 0c975086e5
commit e90d02f46e
4 changed files with 56 additions and 4 deletions

View File

@@ -0,0 +1,41 @@
<?php
/**
* @file
* Admin pages for managing early access codes
*/
/**
* Function to summarise information about early access codes
*/
function booking_earlyaccess_admin() {
global $event;
$output = "";
$header = array('Study Group', 'Session Count', 'Reading Group?', 'Edit Definition');
$rows = array();
$attributes = array('style' => 'max-width:60%');
//$attributes = array();
//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
$output .= t("<h3>!event Study Groups</h3>", array('!event' => $event->booking_eventname));
$output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => $attributes));
return $output;
}

View File

@@ -707,7 +707,17 @@ function booking_menu() {
'page arguments' => array('booking_event_form', false, 4),
'access arguments' => array('access administration pages'),
'type' => MENU_CALLBACK,
);
);
//manage early access codes
$items['admin/config/booking/earlyaccess'] = array(
'title' => 'Booking module Early Access Codes',
'description' => 'Define and configure Early Access Codes for the Booking module',
'page callback' => 'booking_earlyaccess_admin',
'access arguments' => array('administer site configuration'),
'file' => 'booking.earlyaccess_admin.inc',
'type' => MENU_NORMAL_ITEM,
);
//the paypal IPN
$items[BOOKING_PAYPAL_IPN_PATH] = array(

View File

@@ -113,9 +113,9 @@ function booking_form($node, &$form_state, $inserting = FALSE, $early_access_all
);
$form['early-access']['booking_earlyaccess_explanation'] = array(
'#type' => 'container',
'#children' => t("If you have been given an early-access code for registration, please enter it below." .
"Without this code, your registration will not be accepted. " .
"<br /><strong>NOTE: each early-access code can only be used once, so don't pass it along to your friends!</strong>"),
'#children' => t("<p>If you have been given an early-access code for registration, please enter it below. " .
"Without this code, your registration will not be accepted.</p>" .
"<p><strong>NOTE: each early-access code can only be used once, so don't pass it along to your friends!</strong></p>"),
);
$form['early-access']['booking_regn_earlyaccess_code'] = array(
'#type' => 'textfield',

View File

@@ -718,6 +718,7 @@ function booking_csv_report() {
$nullToMysqlNull = true;
$delimiter_esc = preg_quote($delimiter, '/');
$enclosure_esc = preg_quote($enclosure, '/');
$readinggroup_id = "";
//$readinggroup = "session" . variable_get('booking_readinggroup_id','7');