Progress variety session form
This commit is contained in:
@@ -345,11 +345,11 @@ function booking_menu() {
|
|||||||
'type' => MENU_CALLBACK,
|
'type' => MENU_CALLBACK,
|
||||||
);
|
);
|
||||||
|
|
||||||
$items['admin/config/booking/variety/%/session/edit'] = array(
|
$items['admin/config/booking/variety/session/%/edit'] = array(
|
||||||
'title' => 'Edit Variety Session',
|
'title' => 'Edit Variety Session',
|
||||||
'description' => 'Edit variety session for the specified timeslot',
|
'description' => 'Edit variety session for the specified timeslot',
|
||||||
'page callback' => 'drupal_get_form',
|
'page callback' => 'drupal_get_form',
|
||||||
'page arguments' => array('booking_variety_edit_session_form', 4),
|
'page arguments' => array('booking_variety_edit_session_form', 5),
|
||||||
'access arguments' => array('access administration pages'),
|
'access arguments' => array('access administration pages'),
|
||||||
'type' => MENU_CALLBACK,
|
'type' => MENU_CALLBACK,
|
||||||
);
|
);
|
||||||
|
@@ -51,24 +51,8 @@ function booking_variety_admin()
|
|||||||
'#multiple' => false,
|
'#multiple' => false,
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
|
||||||
$form['submit_active'] = array
|
|
||||||
(
|
|
||||||
'#type' => 'submit',
|
|
||||||
'#value' => t('Set Active'),
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
//watchdog('booking', 'Setting button form: @info', array ('@info' => var_export($form, TRUE)));
|
|
||||||
|
|
||||||
return array (
|
return array (
|
||||||
/*
|
'form' => $form,
|
||||||
'first_para' => array (
|
|
||||||
'#type' => 'markup',
|
|
||||||
'#markup' => $prefix,
|
|
||||||
//'#theme' => 'system_settings_form',
|
|
||||||
),
|
|
||||||
*/
|
|
||||||
'form' => $form,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,7 +214,7 @@ function booking_variety_timeslot_form_submit($form, &$form_state) {
|
|||||||
$form_state['redirect'] = array('admin/config/booking/variety');
|
$form_state['redirect'] = array('admin/config/booking/variety');
|
||||||
}
|
}
|
||||||
|
|
||||||
function booking_variety_create_session_form($node, &$form_state, $editid = 0)
|
function booking_variety_create_session_form($node, &$form_state, $timeslot_id = 0)
|
||||||
{
|
{
|
||||||
global $event;
|
global $event;
|
||||||
$form = array ();
|
$form = array ();
|
||||||
@@ -238,22 +222,24 @@ function booking_variety_create_session_form($node, &$form_state, $editid = 0)
|
|||||||
$data = $node;
|
$data = $node;
|
||||||
|
|
||||||
//verify that $editid is a number
|
//verify that $editid is a number
|
||||||
if (! preg_match('/^[0-9]+$/', $editid)) {
|
if (! preg_match('/^[0-9]+$/', $timeslot_id)) {
|
||||||
drupal_set_message("Error: Invalid variety ID supplied. Unable to update variety session information.", 'error', FALSE);
|
drupal_set_message("Error: Invalid variety ID supplied. Unable to update variety session information.", 'error', FALSE);
|
||||||
drupal_goto('admin/config/booking/variety');
|
drupal_goto('admin/config/booking/variety');
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
$data = db_select ('booking_variety_times', 'v')
|
$data = db_select ('booking_variety_times', 'v')
|
||||||
->condition('v.tid', $editid, '=')
|
->condition('v.tid', $editid, '=')
|
||||||
->fields('v')
|
->fields('v')
|
||||||
->execute()
|
->execute()
|
||||||
->fetchObject();
|
->fetchObject();
|
||||||
|
*/
|
||||||
|
|
||||||
//add this to the form in a hidden field so we can update the right event
|
//add this to the form in a hidden field so we can update the right event
|
||||||
$form['tid'] = array (
|
$form['tid'] = array (
|
||||||
'#type' => 'hidden',
|
'#type' => 'hidden',
|
||||||
'#value' => $editid,
|
'#value' => $timeslot_id,
|
||||||
);
|
);
|
||||||
|
|
||||||
$form['booking_variety_descrip'] = array (
|
$form['booking_variety_descrip'] = array (
|
||||||
@@ -312,3 +298,65 @@ function booking_variety_create_session_form_submit($form, &$form_state) {
|
|||||||
|
|
||||||
$form_state['redirect'] = array('admin/config/booking/variety');
|
$form_state['redirect'] = array('admin/config/booking/variety');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function booking_variety_list_session_form($node, &$form_state, $timeslot_id = 0)
|
||||||
|
{
|
||||||
|
global $event;
|
||||||
|
$form = array ();
|
||||||
|
$options = array ();
|
||||||
|
$data = $node;
|
||||||
|
|
||||||
|
//verify that $editid is a number
|
||||||
|
if (! preg_match('/^[0-9]+$/', $timeslot_id)) {
|
||||||
|
drupal_set_message("Error: Invalid variety ID supplied. Unable to select variety session information.", 'error', FALSE);
|
||||||
|
drupal_goto('admin/config/booking/variety');
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = db_select ('booking_variety_options', 'v');
|
||||||
|
$query->join('booking_variety_times', 't', 'v.booking_variety_timeslot_id = t.tid');
|
||||||
|
$query->condition('v.booking_variety_timeslot_id', $timeslot_id, '=')
|
||||||
|
->fields('v')
|
||||||
|
->fields('t', array('booking_variety_time_descrip'));
|
||||||
|
$result = $query->execute();
|
||||||
|
|
||||||
|
//watchdog('booking', 'Variety session query: @info', array ('@info' => (string)$query));
|
||||||
|
|
||||||
|
$header = array (
|
||||||
|
'variety_timeslot' => t('Variety Timeslot'),
|
||||||
|
'booking_variety_descrip' => t('Variety Session Description'),
|
||||||
|
'booking_variety_status' => t('Status'),
|
||||||
|
'booking_variety_maxsize' => t('Maximum Capacity'),
|
||||||
|
'booking_variety_regncount' => t('Current Registration Count'),
|
||||||
|
'variety_edit' => t('Edit Session')
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach($result as $data)
|
||||||
|
{
|
||||||
|
$options[$data->vid] = array
|
||||||
|
(
|
||||||
|
'variety_timeslot' => $data->booking_variety_time_descrip,
|
||||||
|
'booking_variety_descrip' => $data->booking_variety_descrip,
|
||||||
|
'booking_variety_status' => $data->booking_variety_status == 1 ? 1 : 0,
|
||||||
|
'booking_variety_maxsize' => $data->booking_variety_maxsize,
|
||||||
|
'booking_variety_regncount' => $data->booking_variety_regncount,
|
||||||
|
'variety_edit' => l('Edit Session', t('admin/config/booking/variety/session/!vid/edit', array('!vid' => $data->vid))),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$form['table'] = array (
|
||||||
|
'#type' => 'tableselect',
|
||||||
|
'#header' => $header,
|
||||||
|
'#options' => $options,
|
||||||
|
'#multiple' => false,
|
||||||
|
);
|
||||||
|
|
||||||
|
return array (
|
||||||
|
'form' => $form,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function booking_variety_edit_session_form()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user