store variety session details as json
This commit is contained in:
@@ -380,26 +380,25 @@ function booking_varietysessions_csv_report($timeslot_id) {
|
|||||||
//verify that $group_id is a number
|
//verify that $group_id is a number
|
||||||
if (! preg_match('/^[0-9]+$/', $timeslot_id)) {
|
if (! preg_match('/^[0-9]+$/', $timeslot_id)) {
|
||||||
drupal_set_message("Error: Invalid variety session timeslot ID '" . $group_id . "' supplied.", 'error', FALSE);
|
drupal_set_message("Error: Invalid variety session timeslot ID '" . $group_id . "' supplied.", 'error', FALSE);
|
||||||
drupal_goto('admin/booking/studygroups');
|
drupal_goto('admin/config/booking/variety');
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO - UPDATE FROM HERE ON!
|
// TODO - UPDATE FROM HERE ON!
|
||||||
|
|
||||||
//retrieve the name of the study group for the specified ID
|
//retrieve the name of the study group for the specified ID
|
||||||
$group = db_query("SELECT * FROM {booking_studygroup_list} WHERE booking_eventid = :eid and sid = :sid",
|
$variety_session_timeslot = db_query("SELECT * FROM {booking_variety_timeslots} WHERE booking_eventid = :eid and tid = :tid",
|
||||||
array(':eid' => $event->eid, ':sid' => $group_id))
|
array(':eid' => $event->eid, ':tid' => $timeslot_id))
|
||||||
->fetchObject();
|
->fetchObject();
|
||||||
|
|
||||||
if (! $group)
|
if (! $variety_session_timeslot) {
|
||||||
{
|
drupal_set_message("Error: Could not find matching variety session timeslot. Unable to view session membership.", 'error', FALSE);
|
||||||
drupal_set_message("Error: Could not find matching study group ID. Unable to view group membership.", 'error', FALSE);
|
drupal_goto('admin/config/booking/variety');
|
||||||
drupal_goto('admin/booking/studygroups');
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
//set options for the CSV file
|
//set options for the CSV file
|
||||||
$name = 'bookings-studygroup-' . $group->booking_studygroup_descrip . '-' . format_date(time(), 'custom', 'Y-m-d-His');
|
$name = 'bookings-variety-sessions-' . format_date(time(), 'custom', 'Y-m-d-His');
|
||||||
$filename = file_directory_temp() . '/' . $name;
|
$filename = file_directory_temp() . '/' . $name;
|
||||||
$csv = '';
|
$csv = '';
|
||||||
$delimiter = ',';
|
$delimiter = ',';
|
||||||
|
@@ -198,8 +198,6 @@ function booking_variety_regn_form_submit($form, &$form_state) {
|
|||||||
watchdog('booking_debug', 'booking_variety_regn_form_submit: <pre>@info</pre>', array('@info' => print_r( $form_state, true)));
|
watchdog('booking_debug', 'booking_variety_regn_form_submit: <pre>@info</pre>', array('@info' => print_r( $form_state, true)));
|
||||||
$booking_variety_ids = array();
|
$booking_variety_ids = array();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//get a list of timeslot IDs from matching form values
|
//get a list of timeslot IDs from matching form values
|
||||||
$variety_timeslot_ids = preg_filter('/^select-variety-(\d+)/', '$1', array_keys( $values ));
|
$variety_timeslot_ids = preg_filter('/^select-variety-(\d+)/', '$1', array_keys( $values ));
|
||||||
|
|
||||||
@@ -224,13 +222,13 @@ function booking_variety_regn_form_submit($form, &$form_state) {
|
|||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
//store the selected variety sessions in an array of IDs
|
//store the selected variety sessions in an array of IDs
|
||||||
$booking_variety_ids[] = $selected_session_id;
|
$booking_variety_ids[$id] = $selected_session_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
//perform the insert to the booking_variety_regn table
|
//perform the insert to the booking_variety_regn table
|
||||||
db_insert('booking_variety_regn')
|
db_insert('booking_variety_regn')
|
||||||
->fields(array(
|
->fields(array(
|
||||||
'booking_variety_ids' => implode(",", $booking_variety_ids),
|
'booking_variety_ids' => drupal_json_encode($booking_variety_ids),
|
||||||
'booking_person_nid' => $values['booking_nid'],
|
'booking_person_nid' => $values['booking_nid'],
|
||||||
))
|
))
|
||||||
->execute();
|
->execute();
|
||||||
|
Reference in New Issue
Block a user