diff --git a/booking.module b/booking.module index 4837cdd..bcd49b5 100644 --- a/booking.module +++ b/booking.module @@ -78,720 +78,721 @@ module_load_include('inc', 'booking', 'booking.misc'); module_load_include('inc', 'booking', 'booking.MailSystemInterface'); function booking_init() { - date_default_timezone_set(date_default_timezone(FALSE)); - global $event; + date_default_timezone_set(date_default_timezone(FALSE)); + global $event; - //@see http://www.devdaily.com/drupal/drupal-7-sql-cheat-sheet-function-examples - $event = db_query("SELECT * from {booking_event} where booking_event_active=1") - ->fetchObject(); + //@see http://www.devdaily.com/drupal/drupal-7-sql-cheat-sheet-function-examples + $event = db_query("SELECT * from {booking_event} where booking_event_active=1") + ->fetchObject(); - //used for development only - //menu_rebuild(); + //used for development only + //menu_rebuild(); } /** * Implementation of hook_permission(). */ function booking_permission() { - return array( - 'access booking form' => array( - 'title' => t('Access the booking form'), - ), - 'access coming list' => array( - 'title' => t("Access the Who's Coming list"), - ), - 'access waiting list' => array( - 'title' => t("Access the Waiting list"), - ), - 'access booking summary' => array( - 'title' => t('Access the summary of booking forms'), - ), - 'access reports' => array( - 'title' => t('Access booking reports'), - ), - 'create bookings' => array( - 'title' => t('Create a booking'), - ), - 'view bookings' => array( - 'title' => t('Access all bookings'), - ), - 'edit bookings' => array( - 'title' => t('Edit all bookings'), - ), - 'import bookings' => array( - 'title' => t('Bulk import booking data from csv'), - ), - 'view study groups' => array( - 'title' => t('View study groups'), - ), - 'edit study groups' => array( - 'title' => t('Edit study groups'), - ), - 'view room allocations' => array( - 'title' => t('View Room Allocations'), - ), - 'edit room allocations' => array( - 'title' => t('Edit Room Allocations'), - ), - 'create_travel_forms' => array( - 'title' => t('Create a new travel form entry'), - ), - 'view_travel_forms' => array( - 'title' => t('View all travel forms'), - ), - 'edit_travel_forms' => array( - 'title' => t('Edit all travel forms'), - ), - ); + return array( + 'access booking form' => array( + 'title' => t('Access the booking form'), + ), + 'access coming list' => array( + 'title' => t("Access the Who's Coming list"), + ), + 'access waiting list' => array( + 'title' => t("Access the Waiting list"), + ), + 'access booking summary' => array( + 'title' => t('Access the summary of booking forms'), + ), + 'access reports' => array( + 'title' => t('Access booking reports'), + ), + 'create bookings' => array( + 'title' => t('Create a booking'), + ), + 'view bookings' => array( + 'title' => t('Access all bookings'), + ), + 'edit bookings' => array( + 'title' => t('Edit all bookings'), + ), + 'import bookings' => array( + 'title' => t('Bulk import booking data from csv'), + ), + 'view study groups' => array( + 'title' => t('View study groups'), + ), + 'edit study groups' => array( + 'title' => t('Edit study groups'), + ), + 'view room allocations' => array( + 'title' => t('View Room Allocations'), + ), + 'edit room allocations' => array( + 'title' => t('Edit Room Allocations'), + ), + 'create_travel_forms' => array( + 'title' => t('Create a new travel form entry'), + ), + 'view_travel_forms' => array( + 'title' => t('View all travel forms'), + ), + 'edit_travel_forms' => array( + 'title' => t('Edit all travel forms'), + ), + ); } /** * Implementation of hook_menu(). */ function booking_menu() { - global $event; - booking_init(); - //handle the case where the event hasn't been defined yet - $bookingTitle = !empty($event->booking_eventname) ? $event->booking_eventname : 'Event'; - - $items = array(); + global $event; + booking_init(); + //handle the case where the event hasn't been defined yet + $bookingTitle = !empty($event->booking_eventname) ? $event->booking_eventname : 'Event'; + + $items = array(); - $items['admin/config/booking'] = array( - 'title' => 'Booking module configuration', - 'description' => 'Configure the Booking module', - 'position' => 'left', - 'weight' => -100, - 'page callback' => 'system_admin_menu_block_page', - 'access arguments' => array('administer site configuration'), - 'file' => 'system.admin.inc', - 'file path' => drupal_get_path('module', 'system'), - //'type' => MENU_DEFAULT_LOCAL_TASK, - ); - $items['admin/config/booking/general'] = array( - 'title' => 'Booking module general configuration', - 'description' => 'Configure general settings for Booking module', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_admin'), - 'access arguments' => array('administer site configuration'), - //'type' => MENU_DEFAULT_LOCAL_TASK, - //'position' => 'left', - 'weight' => -100, - ); - //http://www.akchauhan.com/create-drupal-form-using-theme_table-like-module-list-form/ - $items['admin/config/booking/text'] = array( - 'title' => 'Booking module text definitions', - 'description' => 'Configure text used in the Booking module', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_tokens_admin'), - 'access arguments' => array('administer site configuration'), - 'weight' => -99, - //'type' => MENU_LOCAL_TASK, - ); - $items['admin/config/booking/emails'] = array( - 'title' => 'Booking module workflow email definitions', - 'description' => 'Configure built-in workflow emails used by the Booking module', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_emails_workflow_admin'), - 'access arguments' => array('access administration pages'), - 'file' => 'booking.emails_admin.inc', - 'weight' => -98, - //'type' => MENU_LOCAL_TASK, - ); - $items['admin/config/booking/emails/custom'] = array( - 'title' => 'Booking module custom email definitions', - 'description' => 'Configure custom emails used by the Booking module', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_emails_custom_admin'), - 'access arguments' => array('access administration pages'), - 'file' => 'booking.emails_admin.inc', - 'type' => MENU_LOCAL_ACTION, - ); - $items['admin/config/booking/emails/logistics'] = array( - 'title' => 'Booking module custom logistics email definitions', - 'description' => 'Configure custom logistics emails used by the Booking module', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_emails_customlogistics_admin'), - 'access arguments' => array('access administration pages'), - 'file' => 'booking.emails_admin.inc', - 'type' => MENU_LOCAL_ACTION, - ); - $items['admin/config/booking/events'] = array( - 'title' => 'Booking module event settings', - 'description' => 'Configure events for the Booking module', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_event_admin'), - 'access arguments' => array('administer site configuration'), - 'weight' => -97, - //'type' => MENU_LOCAL_TASK, - ); - $items['admin/config/booking/prices'] = array( - 'title' => 'Booking module price settings', - 'description' => 'Configure prices for the Booking module', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_price_admin'), - 'access arguments' => array('administer site configuration'), - 'weight' => -96, - //'type' => MENU_LOCAL_TASK, - ); + $items['admin/config/booking'] = array( + 'title' => 'Booking module configuration', + 'description' => 'Configure the Booking module', + 'position' => 'left', + 'weight' => -100, + 'page callback' => 'system_admin_menu_block_page', + 'access arguments' => array('administer site configuration'), + 'file' => 'system.admin.inc', + 'file path' => drupal_get_path('module', 'system'), + //'type' => MENU_DEFAULT_LOCAL_TASK, + ); + $items['admin/config/booking/general'] = array( + 'title' => 'Booking module general configuration', + 'description' => 'Configure general settings for Booking module', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_admin'), + 'access arguments' => array('administer site configuration'), + //'type' => MENU_DEFAULT_LOCAL_TASK, + //'position' => 'left', + 'weight' => -100, + ); + //http://www.akchauhan.com/create-drupal-form-using-theme_table-like-module-list-form/ + $items['admin/config/booking/text'] = array( + 'title' => 'Booking module text definitions', + 'description' => 'Configure text used in the Booking module', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_tokens_admin'), + 'access arguments' => array('administer site configuration'), + 'weight' => -99, + //'type' => MENU_LOCAL_TASK, + ); + $items['admin/config/booking/emails'] = array( + 'title' => 'Booking module workflow email definitions', + 'description' => 'Configure built-in workflow emails used by the Booking module', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_emails_workflow_admin'), + 'access arguments' => array('access administration pages'), + 'file' => 'booking.emails_admin.inc', + 'weight' => -98, + //'type' => MENU_LOCAL_TASK, + ); + $items['admin/config/booking/emails/custom'] = array( + 'title' => 'Booking module custom email definitions', + 'description' => 'Configure custom emails used by the Booking module', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_emails_custom_admin'), + 'access arguments' => array('access administration pages'), + 'file' => 'booking.emails_admin.inc', + 'type' => MENU_LOCAL_ACTION, + ); + $items['admin/config/booking/emails/logistics'] = array( + 'title' => 'Booking module custom logistics email definitions', + 'description' => 'Configure custom logistics emails used by the Booking module', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_emails_customlogistics_admin'), + 'access arguments' => array('access administration pages'), + 'file' => 'booking.emails_admin.inc', + 'type' => MENU_LOCAL_ACTION, + ); + $items['admin/config/booking/events'] = array( + 'title' => 'Booking module event settings', + 'description' => 'Configure events for the Booking module', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_event_admin'), + 'access arguments' => array('administer site configuration'), + 'weight' => -97, + //'type' => MENU_LOCAL_TASK, + ); + $items['admin/config/booking/prices'] = array( + 'title' => 'Booking module price settings', + 'description' => 'Configure prices for the Booking module', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_price_admin'), + 'access arguments' => array('administer site configuration'), + 'weight' => -96, + //'type' => MENU_LOCAL_TASK, + ); - //one off internal tasks - $items['admin/booking/luckynumbers'] = array( - 'title' => 'Booking Generate Lucky Numbers', - 'description' => 'Calculate lucky numbers for lanyard', - 'page callback' => 'booking_generate_luckynumbers', - 'access arguments' => array('edit bookings'), - 'type' => MENU_CALLBACK, - ); + //one off internal tasks + $items['admin/booking/luckynumbers'] = array( + 'title' => 'Booking Generate Lucky Numbers', + 'description' => 'Calculate lucky numbers for lanyard', + 'page callback' => 'booking_generate_luckynumbers', + 'access arguments' => array('edit bookings'), + 'type' => MENU_CALLBACK, + ); - //pages for attendees to fill out information - $items['booking'] = array( - 'title' => $bookingTitle . ' Booking Form', - 'page callback' => 'booking_register_page', - 'access arguments' => array('access booking form'), - 'type' => MENU_NORMAL_ITEM, - ); + //pages for attendees to fill out information + $items['booking'] = array( + 'title' => $bookingTitle . ' Booking Form', + 'page callback' => 'booking_register_page', + 'access arguments' => array('access booking form'), + 'type' => MENU_NORMAL_ITEM, + ); - $items['bookingfinal'] = array( - 'title' => $bookingTitle . ' Registration Completed', - 'page callback' => 'booking_payment_completed_page', - 'access arguments' => array('access booking form'), - 'type' => MENU_CALLBACK, - ); - $items['confirm/%'] = array( - 'title' => 'Booking Payment', - 'page callback' => 'booking_confirm_page', - 'page arguments' => array(3), //include the temporary id - 'access arguments' => array('access booking form'), - 'type' => MENU_CALLBACK, - ); + $items['bookingfinal'] = array( + 'title' => $bookingTitle . ' Registration Completed', + 'page callback' => 'booking_payment_completed_page', + 'access arguments' => array('access booking form'), + 'type' => MENU_CALLBACK, + ); + $items['confirm/%'] = array( + 'title' => 'Booking Payment', + 'page callback' => 'booking_confirm_page', + 'page arguments' => array(3), //include the temporary id + 'access arguments' => array('access booking form'), + 'type' => MENU_CALLBACK, + ); - $items['balance/%'] = array( - 'title' => 'Registration Final Payment', - 'page callback' => 'booking_balance_page', - 'page arguments' => array(3), //include the temporary id - 'access arguments' => array('access booking form'), - 'type' => MENU_CALLBACK, - ); - - $items['partpay/%/%'] = array( - 'title' => 'Registration Partial Payment', - 'page callback' => 'booking_partial_balance_page', - 'page arguments' => array(4), //include the temporary id and the amount - 'access arguments' => array('access booking form'), - 'type' => MENU_CALLBACK, - ); - - $items['travel/%'] = array( - 'title' => 'Travel Details Page', - 'page callback' => 'booking_travel_page', - 'page arguments' => array(3), //include the temporary id - 'access arguments' => array('access booking form'), - 'type' => MENU_SUGGESTED_ITEM, - ); + $items['balance/%'] = array( + 'title' => 'Registration Final Payment', + 'page callback' => 'booking_balance_page', + 'page arguments' => array(3), //include the temporary id + 'access arguments' => array('access booking form'), + 'type' => MENU_CALLBACK, + ); + + $items['partpay/%/%'] = array( + 'title' => 'Registration Partial Payment', + 'page callback' => 'booking_partial_balance_page', + 'page arguments' => array(4), //include the temporary id and the amount + 'access arguments' => array('access booking form'), + 'type' => MENU_CALLBACK, + ); + + $items['travel/%'] = array( + 'title' => 'Travel Details Page', + 'page callback' => 'booking_travel_page', + 'page arguments' => array(3), //include the temporary id + 'access arguments' => array('access booking form'), + 'type' => MENU_SUGGESTED_ITEM, + ); - $items['coming'] = array( - 'title' => "Who's Coming?", - 'page callback' => 'booking_coming_page', - 'access arguments' => array("access coming list"), - 'type' => MENU_NORMAL_ITEM, - ); - - $items['waitinglist'] = array( - 'title' => "Who's on the waiting list?", - 'page callback' => 'booking_waitinglist_page', - 'access arguments' => array("access waiting list"), - 'type' => MENU_NORMAL_ITEM, - ); + $items['coming'] = array( + 'title' => "Who's Coming?", + 'page callback' => 'booking_coming_page', + 'access arguments' => array("access coming list"), + 'type' => MENU_NORMAL_ITEM, + ); + + $items['waitinglist'] = array( + 'title' => "Who's on the waiting list?", + 'page callback' => 'booking_waitinglist_page', + 'access arguments' => array("access waiting list"), + 'type' => MENU_NORMAL_ITEM, + ); - //Various reports - $items['admin/booking/summary'] = array( - 'title' => 'Booking Summary', - 'description' => 'List people and their payments for the current event', - 'page callback' => 'booking_report_summary', - 'access arguments' => array('access reports'), - 'type' => MENU_NORMAL_ITEM, - ); - - $items['admin/booking/payments'] = array( - 'title' => 'Booking Payment Summary', - 'description' => 'List all payments', - 'page callback' => 'booking_report_paypal_payments', - 'access arguments' => array('access reports'), - 'type' => MENU_NORMAL_ITEM, - ); + //Various reports + $items['admin/booking/summary'] = array( + 'title' => 'Booking Summary', + 'description' => 'List people and their payments for the current event', + 'page callback' => 'booking_report_summary', + 'access arguments' => array('access reports'), + 'type' => MENU_NORMAL_ITEM, + ); + + $items['admin/booking/payments'] = array( + 'title' => 'Booking Payment Summary', + 'description' => 'List all payments', + 'page callback' => 'booking_report_paypal_payments', + 'access arguments' => array('access reports'), + 'type' => MENU_NORMAL_ITEM, + ); - $items['admin/booking/travel'] = array( - 'title' => 'Booking Travel Summary', - 'description' => "List people's travel details", - 'page callback' => 'booking_report_travel', - 'access arguments' => array('access reports'), - 'type' => MENU_NORMAL_ITEM, - ); - - $items['admin/booking/manual-email'] = array( - 'title' => 'Manually Email People', - 'description' => 'Send manual email to registered people', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_manual_email_form'), - //'page callback' => 'drupal_get_form', - //'page arguments' => array('booking_manual_email'), - 'access arguments' => array('access administration pages'), - 'type' => MENU_NORMAL_ITEM, - ); + $items['admin/booking/travel'] = array( + 'title' => 'Booking Travel Summary', + 'description' => "List people's travel details", + 'page callback' => 'booking_report_travel', + 'access arguments' => array('access reports'), + 'type' => MENU_NORMAL_ITEM, + ); + + $items['admin/booking/manual-email'] = array( + 'title' => 'Manually Email People', + 'description' => 'Send manual email to registered people', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_manual_email_form'), + //'page callback' => 'drupal_get_form', + //'page arguments' => array('booking_manual_email'), + 'access arguments' => array('access administration pages'), + 'type' => MENU_NORMAL_ITEM, + ); - $items['admin/booking/manual-payments'] = array( - 'title' => 'Manual Payment Processing', - 'description' => 'Manually process peoples payments', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_manual_payment_admin'), - 'access arguments' => array('edit bookings'), - 'type' => MENU_NORMAL_ITEM, - ); - - $items['admin/booking/csv'] = array( - 'title' => 'Booking CSV Report', - 'description' => 'Download a csv of people registered for the current event', - 'page callback' => 'booking_csv_report', - 'access arguments' => array('access reports'), - 'type' => MENU_NORMAL_ITEM, - ); + $items['admin/booking/manual-payments'] = array( + 'title' => 'Manual Payment Processing', + 'description' => 'Manually process peoples payments', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_manual_payment_admin'), + 'access arguments' => array('edit bookings'), + 'type' => MENU_NORMAL_ITEM, + ); + + $items['admin/booking/csv'] = array( + 'title' => 'Booking CSV Report', + 'description' => 'Download a csv of people registered for the current event', + 'page callback' => 'booking_csv_report', + 'access arguments' => array('access reports'), + 'type' => MENU_NORMAL_ITEM, + ); - $items['admin/booking/import-data'] = array( - 'title' => 'Booking Upload Data', - 'description' => 'Upload a csv of containing payment data', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_import_data_admin'), - 'access arguments' => array('import bookings'), - 'type' => MENU_NORMAL_ITEM, - ); - - //show flight info report only if we have passport info enabled - //now deprecated - if (variable_get('booking_enable_passport', 0) == 1) - { - $items['admin/booking/flights'] = array( - 'title' => 'Booking View Flights', - 'description' => 'View Internal Flight Bookings', - 'page callback' => 'booking_report_flight_details', - 'access arguments' => array("acess reports"), - 'type' => MENU_NORMAL_ITEM, - ); - } + $items['admin/booking/import-data'] = array( + 'title' => 'Booking Upload Data', + 'description' => 'Upload a csv of containing payment data', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_import_data_admin'), + 'access arguments' => array('import bookings'), + 'type' => MENU_NORMAL_ITEM, + ); + + //show flight info report only if we have passport info enabled + //now deprecated + if (variable_get('booking_enable_passport', 0) == 1) + { + $items['admin/booking/flights'] = array( + 'title' => 'Booking View Flights', + 'description' => 'View Internal Flight Bookings', + 'page callback' => 'booking_report_flight_details', + 'access arguments' => array("acess reports"), + 'type' => MENU_NORMAL_ITEM, + ); + } - if (variable_get('booking_enable_variety_sessions', 0) == 1) - { - $items['admin/config/booking/variety'] = array( - 'title' => 'Booking module variety sessions', - 'description' => 'Configure variety sessions for the Booking module', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_variety_admin'), - 'access arguments' => array('administer site configuration'), - //'type' => MENU_LOCAL_TASK, - ); + if (variable_get('booking_enable_variety_sessions', 0) == 1) + { + $items['admin/config/booking/variety'] = array( + 'title' => 'Booking module variety sessions', + 'description' => 'Configure variety sessions for the Booking module', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_variety_admin'), + 'access arguments' => array('administer site configuration'), + //'type' => MENU_LOCAL_TASK, + ); - $items['variety'] = array( - 'title' => $bookingTitle . ' Variety Sessions', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_variety_regn_form'), - 'access arguments' => array('access booking form'), - 'type' => MENU_NORMAL_ITEM, - ); - - //configure variety sessions - $items['admin/config/booking/variety/create'] = array( - 'title' => 'Add New Variety Session Timeslot', - 'description' => 'Add variety session timeslot for the Booking module', - 'page callback' => 'drupal_get_form', - //'page arguments' => array('booking_price_create'), - 'page arguments' => array('booking_variety_timeslot_form', true), - 'access arguments' => array('access administration pages'), - 'type' => MENU_LOCAL_ACTION, - ); - - $items['admin/config/booking/variety/%/edit'] = array( - 'title' => 'Edit Variety Session Timeslot', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_variety_timeslot_form', false, 4), - 'access arguments' => array('access administration pages'), - 'type' => MENU_CALLBACK, - ); + $items['variety'] = array( + 'title' => $bookingTitle . ' Variety Sessions', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_variety_regn_form'), + 'access arguments' => array('access booking form'), + 'type' => MENU_NORMAL_ITEM, + ); + + //configure variety sessions + $items['admin/config/booking/variety/create'] = array( + 'title' => 'Add New Variety Session Timeslot', + 'description' => 'Add variety session timeslot for the Booking module', + 'page callback' => 'drupal_get_form', + //'page arguments' => array('booking_price_create'), + 'page arguments' => array('booking_variety_timeslot_form', true), + 'access arguments' => array('access administration pages'), + 'type' => MENU_LOCAL_ACTION, + ); + + $items['admin/config/booking/variety/%/edit'] = array( + 'title' => 'Edit Variety Session Timeslot', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_variety_timeslot_form', false, 4), + 'access arguments' => array('access administration pages'), + 'type' => MENU_CALLBACK, + ); - $items['admin/config/booking/variety/%/csv'] = array( - 'title' => 'Variety Session CSV', - 'description' => 'CSV Report of Variety Session Timeslot', - 'page callback' => 'booking_varietysessions_csv_report', - 'page arguments' => array(4), - //'type' => MENU_CALLBACK, - ); + $items['admin/config/booking/variety/%/csv'] = array( + 'title' => 'Variety Session CSV', + 'description' => 'CSV Report of Variety Session Timeslot', + 'page callback' => 'booking_varietysessions_csv_report', + 'access arguments' => array('access administration pages'), + 'page arguments' => array(4), + //'type' => MENU_CALLBACK, + ); - $items['admin/config/booking/variety/%/session/list'] = array( - 'title' => 'List Variety Sessions', - 'description' => 'List variety sessions for the specified timeslot', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_variety_list_session_form', 4), - 'access arguments' => array('access administration pages'), - 'type' => MENU_CALLBACK, - ); + $items['admin/config/booking/variety/%/session/list'] = array( + 'title' => 'List Variety Sessions', + 'description' => 'List variety sessions for the specified timeslot', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_variety_list_session_form', 4), + 'access arguments' => array('access administration pages'), + 'type' => MENU_CALLBACK, + ); - $items['admin/config/booking/variety/%/session/create'] = array( - 'title' => 'Add New Variety Session', - 'description' => 'Add variety session to the specified timeslot', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_variety_create_session_form', 4), - 'access arguments' => array('access administration pages'), - 'type' => MENU_CALLBACK, - ); - - $items['admin/config/booking/variety/session/%/edit'] = array( - 'title' => 'Edit Variety Session', - 'description' => 'Edit variety session for the specified timeslot', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_variety_edit_session_form', 5), - 'access arguments' => array('access administration pages'), - 'type' => MENU_CALLBACK, - ); - } - - //configure study groups - if (variable_get('booking_enable_studygroups', 0) == 1) { - //the config pages for study groups - $items['admin/config/booking/studygroups'] = array( - 'title' => 'Booking module Study Group configuration', - 'description' => 'Define and configure Study Groups for the Booking module', - 'page callback' => 'booking_studygroups_admin', - 'access arguments' => array('administer site configuration'), - 'type' => MENU_NORMAL_ITEM, - ); - - $items['admin/config/booking/studygroups/add'] = array( - 'title' => 'Add Study Group Definition', - 'description' => 'Add Study Group Definition', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_studygroups_define_form', true), - 'access arguments' => array('administer site configuration'), - 'type' => MENU_LOCAL_ACTION, - ); + $items['admin/config/booking/variety/%/session/create'] = array( + 'title' => 'Add New Variety Session', + 'description' => 'Add variety session to the specified timeslot', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_variety_create_session_form', 4), + 'access arguments' => array('access administration pages'), + 'type' => MENU_CALLBACK, + ); + + $items['admin/config/booking/variety/session/%/edit'] = array( + 'title' => 'Edit Variety Session', + 'description' => 'Edit variety session for the specified timeslot', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_variety_edit_session_form', 5), + 'access arguments' => array('access administration pages'), + 'type' => MENU_CALLBACK, + ); + } + + //configure study groups + if (variable_get('booking_enable_studygroups', 0) == 1) { + //the config pages for study groups + $items['admin/config/booking/studygroups'] = array( + 'title' => 'Booking module Study Group configuration', + 'description' => 'Define and configure Study Groups for the Booking module', + 'page callback' => 'booking_studygroups_admin', + 'access arguments' => array('administer site configuration'), + 'type' => MENU_NORMAL_ITEM, + ); + + $items['admin/config/booking/studygroups/add'] = array( + 'title' => 'Add Study Group Definition', + 'description' => 'Add Study Group Definition', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_studygroups_define_form', true), + 'access arguments' => array('administer site configuration'), + 'type' => MENU_LOCAL_ACTION, + ); - $items['admin/config/booking/studygroups/%/edit'] = array( - 'title' => 'Edit Study Group Definition', - 'description' => 'Edit Study Group Definition', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_studygroups_define_form', false, 4), - 'access arguments' => array('edit study groups'), - //'type' => MENU_NORMAL_ITEM, - ); - - $items['admin/config/booking/studygroups/colours'] = array( - 'title' => 'Process Reading Group Colours', - 'description' => 'Update the reading group colour based on the studygroup id', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_studygroups_process_colours'), - 'access arguments' => array('administer site configuration'), - 'type' => MENU_LOCAL_ACTION, - ); - - //pages for using the study group functionality - $items['admin/booking/studygroups'] = array( - 'title' => 'View Study Groups', - 'description' => 'View Study Group memberships', - 'page callback' => 'booking_studygroups_view_summary', - 'access arguments' => array("view study groups"), - 'type' => MENU_NORMAL_ITEM, - ); + $items['admin/config/booking/studygroups/%/edit'] = array( + 'title' => 'Edit Study Group Definition', + 'description' => 'Edit Study Group Definition', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_studygroups_define_form', false, 4), + 'access arguments' => array('edit study groups'), + //'type' => MENU_NORMAL_ITEM, + ); + + $items['admin/config/booking/studygroups/colours'] = array( + 'title' => 'Process Reading Group Colours', + 'description' => 'Update the reading group colour based on the studygroup id', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_studygroups_process_colours'), + 'access arguments' => array('administer site configuration'), + 'type' => MENU_LOCAL_ACTION, + ); + + //pages for using the study group functionality + $items['admin/booking/studygroups'] = array( + 'title' => 'View Study Groups', + 'description' => 'View Study Group memberships', + 'page callback' => 'booking_studygroups_view_summary', + 'access arguments' => array("view study groups"), + 'type' => MENU_NORMAL_ITEM, + ); - //@todo a nice report with everyone's studygroup membership + //@todo a nice report with everyone's studygroup membership - $items['admin/booking/studygroups/report/leadershelpers'] = array( - 'title' => 'View Studygroup Leaders and Helpers', - 'description' => 'View Studygroup Leaders and Helpers', - 'page callback' => 'booking_studygroups_leadhelp_view_summary', - 'access arguments' => array("view study groups"), - 'type' => MENU_LOCAL_ACTION, - ); - - $items['admin/booking/studygroups/calculateleaders'] = array( - 'title' => 'Calculate Study Group Leaders', - 'description' => 'Calculate Study Group Leaders and Helpers', - 'page callback' => 'booking_studygroups_leaders_calculate', - 'access arguments' => array("edit study groups"), - //'type' => MENU_NORMAL_ITEM, - ); - - $items['admin/booking/studygroups/%/view'] = array( - 'title' => 'View Study Group', - 'description' => 'View Study Group memberships', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_studygroups_view_form', 3), - 'access arguments' => array('view study groups'), - //'type' => MENU_NORMAL_ITEM, - ); - - $items['admin/booking/studygroups/%/view/print'] = array( - 'title' => 'Print Study Group', - 'description' => 'Print Study Group memberships', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_studygroups_printview_form', 3), - 'access arguments' => array('view study groups'), - //'type' => MENU_NORMAL_ITEM, - ); - - $items['admin/booking/studygroups/%/view/csv'] = array( - 'title' => 'Export Study Group', - 'description' => 'Export Study Group memberships as CSV', - 'page callback' => 'booking_studygroups_csv_report', - 'page arguments' => array(3), - 'access arguments' => array('view study groups'), - //'type' => MENU_NORMAL_ITEM, - ); - - $items['admin/booking/studygroups/%/selectleaders'] = array( - 'title' => 'Select Study Group Leaders', - 'description' => 'Define attendees to lead or help study groups', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_available_leadhelp_select_form', 3), - 'access arguments' => array('edit study groups'), - //'type' => MENU_LOCAL_ACTION, - ); - $items['admin/booking/studygroups/%/editleaders'] = array( - 'title' => 'Edit Study Group Leaders', - 'description' => 'Edit Study Group Leaders and Helpers', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_studygroup_leadhelp_edit_form', 3), - 'access arguments' => array('edit study groups'), - //'type' => MENU_LOCAL_ACTION, - ); + $items['admin/booking/studygroups/report/leadershelpers'] = array( + 'title' => 'View Studygroup Leaders and Helpers', + 'description' => 'View Studygroup Leaders and Helpers', + 'page callback' => 'booking_studygroups_leadhelp_view_summary', + 'access arguments' => array("view study groups"), + 'type' => MENU_LOCAL_ACTION, + ); + + $items['admin/booking/studygroups/calculateleaders'] = array( + 'title' => 'Calculate Study Group Leaders', + 'description' => 'Calculate Study Group Leaders and Helpers', + 'page callback' => 'booking_studygroups_leaders_calculate', + 'access arguments' => array("edit study groups"), + //'type' => MENU_NORMAL_ITEM, + ); + + $items['admin/booking/studygroups/%/view'] = array( + 'title' => 'View Study Group', + 'description' => 'View Study Group memberships', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_studygroups_view_form', 3), + 'access arguments' => array('view study groups'), + //'type' => MENU_NORMAL_ITEM, + ); + + $items['admin/booking/studygroups/%/view/print'] = array( + 'title' => 'Print Study Group', + 'description' => 'Print Study Group memberships', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_studygroups_printview_form', 3), + 'access arguments' => array('view study groups'), + //'type' => MENU_NORMAL_ITEM, + ); + + $items['admin/booking/studygroups/%/view/csv'] = array( + 'title' => 'Export Study Group', + 'description' => 'Export Study Group memberships as CSV', + 'page callback' => 'booking_studygroups_csv_report', + 'page arguments' => array(3), + 'access arguments' => array('view study groups'), + //'type' => MENU_NORMAL_ITEM, + ); + + $items['admin/booking/studygroups/%/selectleaders'] = array( + 'title' => 'Select Study Group Leaders', + 'description' => 'Define attendees to lead or help study groups', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_available_leadhelp_select_form', 3), + 'access arguments' => array('edit study groups'), + //'type' => MENU_LOCAL_ACTION, + ); + $items['admin/booking/studygroups/%/editleaders'] = array( + 'title' => 'Edit Study Group Leaders', + 'description' => 'Edit Study Group Leaders and Helpers', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_studygroup_leadhelp_edit_form', 3), + 'access arguments' => array('edit study groups'), + //'type' => MENU_LOCAL_ACTION, + ); - //callback for autocomplete lookup - $items['booking/studygroups/autocomplete'] = array( - 'title' => 'Autocomplete for studygroup allocations', - 'page callback' => '_booking_studygroups_name_autocomplete', - 'access arguments' => array('edit study groups'), - 'type' => MENU_CALLBACK - ); + //callback for autocomplete lookup + $items['booking/studygroups/autocomplete'] = array( + 'title' => 'Autocomplete for studygroup allocations', + 'page callback' => '_booking_studygroups_name_autocomplete', + 'access arguments' => array('edit study groups'), + 'type' => MENU_CALLBACK + ); - $items['admin/booking/studygroups/%/update'] = array( - 'title' => 'Update Study Groups', - 'description' => 'Calculate updated Study Group memberships', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_studygroups_update_form', 3), - 'access arguments' => array('edit study groups'), - //'type' => MENU_LOCAL_ACTION, - ); + $items['admin/booking/studygroups/%/update'] = array( + 'title' => 'Update Study Groups', + 'description' => 'Calculate updated Study Group memberships', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_studygroups_update_form', 3), + 'access arguments' => array('edit study groups'), + //'type' => MENU_LOCAL_ACTION, + ); - $items['admin/booking/%/edit-studygroup-membership'] = array( - 'title' => 'Edit Study Group Allocation', - 'description' => 'Manually Update Study Group memberships', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_studygroups_edit_form', 2), - 'access arguments' => array('edit study groups'), - 'type' => MENU_CALLBACK, - ); - - } + $items['admin/booking/%/edit-studygroup-membership'] = array( + 'title' => 'Edit Study Group Allocation', + 'description' => 'Manually Update Study Group memberships', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_studygroups_edit_form', 2), + 'access arguments' => array('edit study groups'), + 'type' => MENU_CALLBACK, + ); + + } - //configure rooms - if (variable_get('booking_enable_roomallocations', 0) == 1) - { - //config pages - $items['admin/config/booking/rooms'] = array( - 'title' => 'Booking module room definitions', - 'description' => 'View and configure Room Definitions for the Booking module', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_rooms_view_definitions'), - 'access arguments' => array('administer site configuration'), - 'type' => MENU_NORMAL_ITEM, - ); - - $items['admin/config/booking/rooms/locations/add'] = array( - 'title' => 'Add Room Location Definition', - 'description' => 'Add Room Location Definition', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_roomlocation_define_form', true), - 'access arguments' => array('administer site configuration'), - 'type' => MENU_LOCAL_ACTION, - ); - - $items['admin/config/booking/rooms/locations/%/edit'] = array( - 'title' => 'Edit Room Location Definition', - 'description' => 'Edit Room Location Definition', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_roomlocation_define_form', false, 5), - 'access arguments' => array('administer site configuration'), - //'type' => MENU_LOCAL_ACTION, - ); - - $items['admin/config/booking/rooms/create'] = array( - 'title' => 'Add New Room Definition', - 'description' => 'Add room definition for the Event Booking module', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_rooms_definition_form', true), - 'access arguments' => array('administer site configuration'), - 'type' => MENU_LOCAL_ACTION, - ); - - $items['admin/config/booking/rooms/%/edit'] = array( - 'title' => 'Edit Room Definition', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_rooms_definition_form', false, 4), - 'access arguments' => array('administer site configuration'), - 'type' => MENU_CALLBACK, - ); - - //admin pages - $items['admin/booking/rooms'] = array( - 'title' => 'View Room Locations', - 'description' => 'View Room Locations', - 'page callback' => 'booking_room_view_summary', - 'access arguments' => array("view room allocations"), - 'type' => MENU_NORMAL_ITEM, - ); - - $items['admin/booking/rooms/report'] = array( - 'title' => 'View All Room Allocations', - 'description' => 'View All Room Allocations', - 'page callback' => 'booking_roomallocations_view_summary', - 'access arguments' => array("view room allocations"), - 'type' => MENU_LOCAL_ACTION, - ); + //configure rooms + if (variable_get('booking_enable_roomallocations', 0) == 1) + { + //config pages + $items['admin/config/booking/rooms'] = array( + 'title' => 'Booking module room definitions', + 'description' => 'View and configure Room Definitions for the Booking module', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_rooms_view_definitions'), + 'access arguments' => array('administer site configuration'), + 'type' => MENU_NORMAL_ITEM, + ); + + $items['admin/config/booking/rooms/locations/add'] = array( + 'title' => 'Add Room Location Definition', + 'description' => 'Add Room Location Definition', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_roomlocation_define_form', true), + 'access arguments' => array('administer site configuration'), + 'type' => MENU_LOCAL_ACTION, + ); + + $items['admin/config/booking/rooms/locations/%/edit'] = array( + 'title' => 'Edit Room Location Definition', + 'description' => 'Edit Room Location Definition', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_roomlocation_define_form', false, 5), + 'access arguments' => array('administer site configuration'), + //'type' => MENU_LOCAL_ACTION, + ); + + $items['admin/config/booking/rooms/create'] = array( + 'title' => 'Add New Room Definition', + 'description' => 'Add room definition for the Event Booking module', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_rooms_definition_form', true), + 'access arguments' => array('administer site configuration'), + 'type' => MENU_LOCAL_ACTION, + ); + + $items['admin/config/booking/rooms/%/edit'] = array( + 'title' => 'Edit Room Definition', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_rooms_definition_form', false, 4), + 'access arguments' => array('administer site configuration'), + 'type' => MENU_CALLBACK, + ); + + //admin pages + $items['admin/booking/rooms'] = array( + 'title' => 'View Room Locations', + 'description' => 'View Room Locations', + 'page callback' => 'booking_room_view_summary', + 'access arguments' => array("view room allocations"), + 'type' => MENU_NORMAL_ITEM, + ); + + $items['admin/booking/rooms/report'] = array( + 'title' => 'View All Room Allocations', + 'description' => 'View All Room Allocations', + 'page callback' => 'booking_roomallocations_view_summary', + 'access arguments' => array("view room allocations"), + 'type' => MENU_LOCAL_ACTION, + ); - $items['admin/booking/rooms/old/%/assign'] = array( - 'title' => 'Assign Rooms', - 'description' => 'Assign attendees to rooms', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_rooms_allocate_form', 4), - 'access arguments' => array('edit room allocations'), - //'type' => MENU_NORMAL_ITEM, - ); + $items['admin/booking/rooms/old/%/assign'] = array( + 'title' => 'Assign Rooms', + 'description' => 'Assign attendees to rooms', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_rooms_allocate_form', 4), + 'access arguments' => array('edit room allocations'), + //'type' => MENU_NORMAL_ITEM, + ); - //use this for testing the autocomplete fields - $items['admin/booking/rooms/%/assign'] = array( - 'title' => 'Assign Attendees to Rooms', - 'description' => 'Assign attendees to rooms via autocomplete fields', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_rooms_allocate_form', 3), - 'access arguments' => array('edit room allocations'), - //'type' => MENU_NORMAL_ITEM, - ); - - //callback for autocomplete lookup - $items['booking/rooms/autocomplete'] = array( - 'title' => 'Autocomplete for room allocations', - 'page callback' => '_booking_rooms_name_autocomplete', - 'access arguments' => array('edit room allocations'), - 'type' => MENU_CALLBACK - ); + //use this for testing the autocomplete fields + $items['admin/booking/rooms/%/assign'] = array( + 'title' => 'Assign Attendees to Rooms', + 'description' => 'Assign attendees to rooms via autocomplete fields', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_rooms_allocate_form', 3), + 'access arguments' => array('edit room allocations'), + //'type' => MENU_NORMAL_ITEM, + ); + + //callback for autocomplete lookup + $items['booking/rooms/autocomplete'] = array( + 'title' => 'Autocomplete for room allocations', + 'page callback' => '_booking_rooms_name_autocomplete', + 'access arguments' => array('edit room allocations'), + 'type' => MENU_CALLBACK + ); - $items['admin/booking/rooms/%/view'] = array( - 'title' => 'View Allocated Rooms', - 'description' => 'Assign attendees to rooms', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_rooms_view_form', 3), - 'access arguments' => array('view room allocations'), - ); - - $items['admin/booking/%/edit-room'] = array( - 'title' => 'Edit Room Allocation', - 'description' => 'Manually Update Room Allocation', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_room_edit_form', 2), - 'access arguments' => array('edit room allocations'), - 'type' => MENU_CALLBACK, - ); - } - - //Configure prices - $items['admin/config/booking/prices/create'] = array( - 'title' => 'Add New Price Entry', - 'description' => 'Add priceentry for the Booking module', - 'page callback' => 'drupal_get_form', - //'page arguments' => array('booking_price_create'), - 'page arguments' => array('booking_price_form', true), - 'access arguments' => array('access administration pages'), - 'type' => MENU_LOCAL_ACTION, - ); - - $items['admin/config/booking/prices/%/edit'] = array( - 'title' => 'Edit Price', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_price_form', false, 4), - 'access arguments' => array('access administration pages'), - 'type' => MENU_CALLBACK, - ); - - //Configure events - $items['admin/config/booking/events/create'] = array( - 'title' => 'Add New Event', - 'description' => 'Add event for the Booking module', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_event_form', true), - 'access arguments' => array('access administration pages'), - 'type' => MENU_LOCAL_ACTION, - ); - - $items['admin/config/booking/events/%/edit'] = array( - 'title' => 'Edit Event', - //'page callback' => 'booking_event_create', - //'page arguments' => array(3), - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_event_form', false, 4), - 'access arguments' => array('access administration pages'), - 'type' => MENU_CALLBACK, - ); + $items['admin/booking/rooms/%/view'] = array( + 'title' => 'View Allocated Rooms', + 'description' => 'Assign attendees to rooms', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_rooms_view_form', 3), + 'access arguments' => array('view room allocations'), + ); + + $items['admin/booking/%/edit-room'] = array( + 'title' => 'Edit Room Allocation', + 'description' => 'Manually Update Room Allocation', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_room_edit_form', 2), + 'access arguments' => array('edit room allocations'), + 'type' => MENU_CALLBACK, + ); + } + + //Configure prices + $items['admin/config/booking/prices/create'] = array( + 'title' => 'Add New Price Entry', + 'description' => 'Add priceentry for the Booking module', + 'page callback' => 'drupal_get_form', + //'page arguments' => array('booking_price_create'), + 'page arguments' => array('booking_price_form', true), + 'access arguments' => array('access administration pages'), + 'type' => MENU_LOCAL_ACTION, + ); + + $items['admin/config/booking/prices/%/edit'] = array( + 'title' => 'Edit Price', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_price_form', false, 4), + 'access arguments' => array('access administration pages'), + 'type' => MENU_CALLBACK, + ); + + //Configure events + $items['admin/config/booking/events/create'] = array( + 'title' => 'Add New Event', + 'description' => 'Add event for the Booking module', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_event_form', true), + 'access arguments' => array('access administration pages'), + 'type' => MENU_LOCAL_ACTION, + ); + + $items['admin/config/booking/events/%/edit'] = array( + 'title' => 'Edit Event', + //'page callback' => 'booking_event_create', + //'page arguments' => array(3), + 'page callback' => 'drupal_get_form', + '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('access administration pages'), - 'file' => 'booking.earlyaccess_admin.inc', - 'type' => MENU_NORMAL_ITEM, - ); - $items['admin/config/booking/earlyaccess/generate'] = array( - 'title' => 'Generate Early Access Codes', - 'description' => 'Generate Early Access Codes', - 'page callback' => 'booking_earlyaccess_generate_codes', - 'access arguments' => array('access administration pages'), - 'file' => 'booking.earlyaccess_admin.inc', - 'type' => MENU_LOCAL_ACTION, - ); - $items['admin/config/booking/earlyaccess/csv'] = array( - 'title' => 'Download Early Access Codes CSV', - 'description' => 'Download Early Access Codes CSV', - 'page callback' => 'booking_earlyaccess_csv_report', - 'access arguments' => array('access administration pages'), - 'file' => 'booking.earlyaccess_admin.inc', - 'type' => MENU_LOCAL_ACTION, - ); + //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('access administration pages'), + 'file' => 'booking.earlyaccess_admin.inc', + 'type' => MENU_NORMAL_ITEM, + ); + $items['admin/config/booking/earlyaccess/generate'] = array( + 'title' => 'Generate Early Access Codes', + 'description' => 'Generate Early Access Codes', + 'page callback' => 'booking_earlyaccess_generate_codes', + 'access arguments' => array('access administration pages'), + 'file' => 'booking.earlyaccess_admin.inc', + 'type' => MENU_LOCAL_ACTION, + ); + $items['admin/config/booking/earlyaccess/csv'] = array( + 'title' => 'Download Early Access Codes CSV', + 'description' => 'Download Early Access Codes CSV', + 'page callback' => 'booking_earlyaccess_csv_report', + 'access arguments' => array('access administration pages'), + 'file' => 'booking.earlyaccess_admin.inc', + 'type' => MENU_LOCAL_ACTION, + ); - //manage HTML email template if enabled - if (variable_get('booking_enable_html_mail', 0) == 1) { - $items['admin/config/booking/mailtemplate'] = array( - 'title' => 'Booking module HTML email', - 'description' => 'Configure the look of HTMl emails for the Booking module', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('booking_mailtemplate_form'), - 'access arguments' => array('access administration pages'), - 'file' => 'booking.mailtemplate_admin.inc', - 'type' => MENU_NORMAL_ITEM, - ); - } - - //the paypal IPN - $items[BOOKING_PAYPAL_IPN_PATH] = array( - 'type' => MENU_CALLBACK, - 'access callback' => TRUE, - 'page callback' => 'booking_paypal_ipn', - ); + //manage HTML email template if enabled + if (variable_get('booking_enable_html_mail', 0) == 1) { + $items['admin/config/booking/mailtemplate'] = array( + 'title' => 'Booking module HTML email', + 'description' => 'Configure the look of HTMl emails for the Booking module', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('booking_mailtemplate_form'), + 'access arguments' => array('access administration pages'), + 'file' => 'booking.mailtemplate_admin.inc', + 'type' => MENU_NORMAL_ITEM, + ); + } + + //the paypal IPN + $items[BOOKING_PAYPAL_IPN_PATH] = array( + 'type' => MENU_CALLBACK, + 'access callback' => TRUE, + 'page callback' => 'booking_paypal_ipn', + ); - //stripe webhook - $items['system/booking/stripe/webhook'] = array( - 'type' => MENU_CALLBACK, - 'access callback' => TRUE, - 'page callback' => 'booking_stripe_webhook', - ); + //stripe webhook + $items['system/booking/stripe/webhook'] = array( + 'type' => MENU_CALLBACK, + 'access callback' => TRUE, + 'page callback' => 'booking_stripe_webhook', + ); - return $items; + return $items; } /** @@ -803,12 +804,12 @@ function booking_node_info() { 'name' => t('Registration'), 'base' => 'booking', 'description' => t('This node represents a registration for an event.'), - ), - 'travel' => array( + ), + 'travel' => array( 'name' => t('Travel Form'), 'base' => 'travel', 'description' => t('This node represents a travel details form for an event registration.'), - ) + ) ); } @@ -816,75 +817,68 @@ function booking_node_info() { * Implementation of access related hooks for booking_registration node type. */ function booking_node_access($node, $op, $account) { - $type = is_string($node) ? $node : $node->type; - - //check access levels for a booking node - if ($type == 'booking' && in_array($type, node_permissions_get_configured_types())) { - //watchdog('booking', "Booking node_access processing user id '!account' performing operation !op for node type !type. @info", - // array('!account' => $account->uid, '!op' => $op, '!type' => $type, '@info' => var_export($account, TRUE))); - - if ($op == 'view') - { - //watchdog('booking', 'Booking node_access checking permissions for view operation.'); - if (user_access('view bookings', $account)) - return NODE_ACCESS_ALLOW; - } - elseif ($op == 'create') - { - //watchdog('booking', 'Booking node_access checking permissions for create operation.'); - if (user_access('create bookings', $account)) - return NODE_ACCESS_ALLOW; - //create is a special case, since typically anonymous users will be creating a booking node via the form anyway - //rather than logging a denied message for each registration, return denied here - else - return NODE_ACCESS_DENY; - } - elseif ($op == 'update' || $op == 'delete') - { - if (user_access('edit bookings', $account)) - return NODE_ACCESS_ALLOW; - } - - //no permission to view this information - //watchdog('booking', "Booking node_access denying uid !account performing operation !op. @info", - // array('!account' => $account->uid, '!op' => $op, '@info' => var_export($account, TRUE))); - watchdog('booking', "Booking node_access denying user id '!account' performing operation !op for node type !type. @info", - array('!account' => $account->uid, '!op' => $op, '!type' => $type, '@info' => var_export($account, TRUE))); - return NODE_ACCESS_DENY; - } - //Check access levels for travel form node - elseif ($type == 'travel' && in_array($type, node_permissions_get_configured_types())) - { - if ($op == 'view') - { - if (user_access('view_travel_forms', $account)) - return NODE_ACCESS_ALLOW; - } - elseif ($op == 'create') - { - if (user_access('create_travel_forms', $account)) - return NODE_ACCESS_ALLOW; - } - elseif ($op == 'update' || $op == 'delete') - { - if (user_access('edit_travel_forms', $account)) - return NODE_ACCESS_ALLOW; - } - - //no permission to view this information - //watchdog('booking', "Booking node_access denying uid !account performing operation !op. @info", - // array('!account' => $account->uid, '!op' => $op, '@info' => var_export($account, TRUE))); - //watchdog('booking', "Booking node_access denying user id '!account' performing operation !op for node type !type. @info", - // array('!account' => $account->uid, '!op' => $op, '!type' => $type, '@info' => var_export($account, TRUE))); - return NODE_ACCESS_DENY; - } - /* - else - { - watchdog('booking', "hook_node_access processing uid !account performing operation !op for node type !type. @info", - array('!account' => $account->uid, '!op' => $op, '!type' => $type, '@info' => var_export($account, TRUE))); - } - */ + $type = is_string($node) ? $node : $node->type; + + //check access levels for a booking node + if ($type == 'booking' && in_array($type, node_permissions_get_configured_types())) { + //watchdog('booking', "Booking node_access processing user id '!account' performing operation !op for node type !type. @info", + // array('!account' => $account->uid, '!op' => $op, '!type' => $type, '@info' => var_export($account, TRUE))); + + if ($op == 'view') { + //watchdog('booking', 'Booking node_access checking permissions for view operation.'); + if (user_access('view bookings', $account)) + return NODE_ACCESS_ALLOW; + } + elseif ($op == 'create') { + //watchdog('booking', 'Booking node_access checking permissions for create operation.'); + if (user_access('create bookings', $account)) + return NODE_ACCESS_ALLOW; + //create is a special case, since typically anonymous users will be creating a booking node via the form anyway + //rather than logging a denied message for each registration, return denied here + else + return NODE_ACCESS_DENY; + } + elseif ($op == 'update' || $op == 'delete') { + if (user_access('edit bookings', $account)) + return NODE_ACCESS_ALLOW; + } + + //no permission to view this information + //watchdog('booking', "Booking node_access denying uid !account performing operation !op. @info", + // array('!account' => $account->uid, '!op' => $op, '@info' => var_export($account, TRUE))); + watchdog('booking', "Booking node_access denying user id '!account' performing operation !op for node type !type. @info", + array('!account' => $account->uid, '!op' => $op, '!type' => $type, '@info' => var_export($account, TRUE))); + return NODE_ACCESS_DENY; + } + //Check access levels for travel form node + elseif ($type == 'travel' && in_array($type, node_permissions_get_configured_types())) { + if ($op == 'view') { + if (user_access('view_travel_forms', $account)) + return NODE_ACCESS_ALLOW; + } + elseif ($op == 'create') { + if (user_access('create_travel_forms', $account)) + return NODE_ACCESS_ALLOW; + } + elseif ($op == 'update' || $op == 'delete') { + if (user_access('edit_travel_forms', $account)) + return NODE_ACCESS_ALLOW; + } + + //no permission to view this information + //watchdog('booking', "Booking node_access denying uid !account performing operation !op. @info", + // array('!account' => $account->uid, '!op' => $op, '@info' => var_export($account, TRUE))); + //watchdog('booking', "Booking node_access denying user id '!account' performing operation !op for node type !type. @info", + // array('!account' => $account->uid, '!op' => $op, '!type' => $type, '@info' => var_export($account, TRUE))); + return NODE_ACCESS_DENY; + } + /* + else + { + watchdog('booking', "hook_node_access processing uid !account performing operation !op for node type !type. @info", + array('!account' => $account->uid, '!op' => $op, '!type' => $type, '@info' => var_export($account, TRUE))); + } + */ } @@ -893,27 +887,27 @@ function booking_node_access($node, $op, $account) { */ function booking_theme($existing, $type, $theme, $path) { if($type == 'module') { - $theme_path = drupal_get_path('module', 'booking'). '/theme'; - // if our more heavily customised template exists, use that, otherwise fall back to the generic one - $template_file = is_file($theme_path . '/mimemail-message-registration_mail.tpl.php') ? '/mimemail-message-registration_mail' : '/mimemail-message'; + $theme_path = drupal_get_path('module', 'booking'). '/theme'; + // if our more heavily customised template exists, use that, otherwise fall back to the generic one + $template_file = is_file($theme_path . '/mimemail-message-registration_mail.tpl.php') ? '/mimemail-message-registration_mail' : '/mimemail-message'; return array( - 'booking_details' => array('arguments' => array('node' => NULL)), + 'booking_details' => array('arguments' => array('node' => NULL)), 'booking_htmlmail_template' => array( 'variables' => array('module' => NULL, 'key' => NULL, 'css' => NULL, 'recipient' => NULL, 'subject' => NULL, 'body' => NULL, 'message' => array()), - 'path' => $theme_path, + 'path' => $theme_path, 'template' => 'mimemail-message' // extension of .tpl.php automatically added ), 'booking_htmlmail_registration_mail' => array( - 'variables' => array('subject' => NULL, - 'body' => NULL, - 'footer' => NULL, - 'colors' => NULL, - 'header_links' => NULL, - 'social_links' => NULL, - ), - 'path' => $theme_path, - //'image_path' => drupal_get_path('module', 'booking'). '/images', + 'variables' => array('subject' => NULL, + 'body' => NULL, + 'footer' => NULL, + 'colors' => NULL, + 'header_links' => NULL, + 'social_links' => NULL, + ), + 'path' => $theme_path, + //'image_path' => drupal_get_path('module', 'booking'). '/images', 'template' => $template_file, ), ); @@ -929,8 +923,8 @@ function booking_theme($existing, $type, $theme, $path) { /* function booking_preprocess_page(&$vars) { - watchdog('booking', "
Preprocess hook:\n@info
", array('@info' => print_r( $vars, true))); - //$vars['theme_hook_suggestions'][] = 'studygroups-print'; + watchdog('booking', "
Preprocess hook:\n@info
", array('@info' => print_r( $vars, true))); + //$vars['theme_hook_suggestions'][] = 'studygroups-print'; } */ @@ -946,18 +940,18 @@ function booking_mail($key, &$message, $params) { $message['headers'] += $params['headers']; } - //watchdog('booking_debug', "
Mail hook:\n@info
", array('@info' => print_r( $message, true))); + //watchdog('booking_debug', "
Mail hook:\n@info
", array('@info' => print_r( $message, true))); } /** * Implements hook_mail_alter() */ function booking_mail_alter(&$message) { - //message id used here comes from {module_name}_{email_key} - $implemented_message_ids = array('booking_registration_mail', 'booking_registration_mail_notify', 'booking_booking_email_custom', 'booking_registration_mail_bal_outstanding'); + //message id used here comes from {module_name}_{email_key} + $implemented_message_ids = array('booking_registration_mail', 'booking_registration_mail_notify', 'booking_booking_email_custom', 'booking_registration_mail_bal_outstanding'); - if (in_array($message['id'], $implemented_message_ids)) { - //watchdog('booking_debug', "Message key matched in booking_mail_alter, setting to html email."); + if (in_array($message['id'], $implemented_message_ids)) { + //watchdog('booking_debug', "Message key matched in booking_mail_alter, setting to html email."); $headers = array( 'MIME-Version' => '1.0', 'Content-Type' => 'text/html; charset=UTF-8; format=flowed', @@ -977,7 +971,7 @@ function booking_mail_alter(&$message) { foreach($headers as $key => $value) { $message['headers'][$key] = $value; } - //watchdog('booking_debug', "
Mail alter hook:\n@info
", array('@info' => print_r( $message, true))); + //watchdog('booking_debug', "
Mail alter hook:\n@info
", array('@info' => print_r( $message, true))); } /** @@ -991,7 +985,7 @@ function booking_library() { 'version' => '1.0', 'js' => array( //'https://js.stripe.com/v1/' => array(), - 'https://checkout.stripe.com/checkout.js' => array(), + 'https://checkout.stripe.com/checkout.js' => array(), $module_path . '/booking.stripe.js' => array(), ), ); @@ -1003,19 +997,19 @@ function booking_library() { * Implements hook_libraries_info(). */ function booking_libraries_info() { - $libraries['stripe'] = array( - 'name' => 'Stripe Payment API PHP Library', - 'vendor url' => 'https://github.com/stripe/stripe-php', - 'download url' => 'https://github.com/stripe/stripe-php/archive/master.zip', - 'version arguments' => array( - 'file' => 'VERSION', - 'pattern' => '/([0-9a-zA-Z\.-]+)/', - 'lines' => 1, - ), - 'files' => array('php' => array('init.php')), - 'callbacks' => array('post-load' => array('booking_libraries_postload_callback')), - ); - return $libraries; + $libraries['stripe'] = array( + 'name' => 'Stripe Payment API PHP Library', + 'vendor url' => 'https://github.com/stripe/stripe-php', + 'download url' => 'https://github.com/stripe/stripe-php/archive/master.zip', + 'version arguments' => array( + 'file' => 'VERSION', + 'pattern' => '/([0-9a-zA-Z\.-]+)/', + 'lines' => 1, + ), + 'files' => array('php' => array('init.php')), + 'callbacks' => array('post-load' => array('booking_libraries_postload_callback')), + ); + return $libraries; } /** @@ -1031,8 +1025,8 @@ function booking_libraries_info() { * variant name. */ function booking_libraries_postload_callback($library, $version = NULL, $variant = NULL) { - if (!empty($library['loaded'])) { - \Stripe\Stripe::setApiKey(_booking_get_stripe_private_key()); + if (!empty($library['loaded'])) { + \Stripe\Stripe::setApiKey(_booking_get_stripe_private_key()); } } @@ -1043,31 +1037,31 @@ function booking_requirements($phase) { $requirements = array(); $t = get_t(); - //do a runtime verification that the stripe library is installed - if ($phase == 'runtime') { - //check that the stripe library is present - if (($library = libraries_detect('stripe')) && !empty($library['installed'])) { - // The library is installed. Awesome! - $info = libraries_info('stripe'); - //watchdog('booking_debug', "
Stripe library check\n@info
", array('@info' => print_r($info, true))); - $requirements['booking_stripe_library'] = array( - 'title' => $t('Booking Module Libraries'), - 'description' => $t('Stripe library is installed.'), - 'value' => $t('Version !version installed.', array('!version' => $info['version'])), - 'severity' => REQUIREMENT_OK, - ); - } - else { - // Stripe library is not installed or something else is wrong with it - $error_message = $library['error message']; - $requirements['booking_stripe_library'] = array( - 'title' => $t('Booking Module Libraries'), - 'description' => $t('Stripe payment processor library not installed correctly. Download https://github.com/stripe/stripe-php/archive/master.zip and extract contents into sites/all/libraries/stripe'), - 'value' => $error_message, - 'severity' => REQUIREMENT_ERROR, - ); - } - } + //do a runtime verification that the stripe library is installed + if ($phase == 'runtime') { + //check that the stripe library is present + if (($library = libraries_detect('stripe')) && !empty($library['installed'])) { + // The library is installed. Awesome! + $info = libraries_info('stripe'); + //watchdog('booking_debug', "
Stripe library check\n@info
", array('@info' => print_r($info, true))); + $requirements['booking_stripe_library'] = array( + 'title' => $t('Booking Module Libraries'), + 'description' => $t('Stripe library is installed.'), + 'value' => $t('Version !version installed.', array('!version' => $info['version'])), + 'severity' => REQUIREMENT_OK, + ); + } + else { + // Stripe library is not installed or something else is wrong with it + $error_message = $library['error message']; + $requirements['booking_stripe_library'] = array( + 'title' => $t('Booking Module Libraries'), + 'description' => $t('Stripe payment processor library not installed correctly. Download https://github.com/stripe/stripe-php/archive/master.zip and extract contents into sites/all/libraries/stripe'), + 'value' => $error_message, + 'severity' => REQUIREMENT_ERROR, + ); + } + } return $requirements; } @@ -1079,8 +1073,8 @@ function booking_form_user_profile_form_alter(&$form, &$form_state) { } function booking_form_user_profile_form_validate($form, &$form_state) { - //if (!empty($form_state['values']['pass'])) { - watchdog('booking', t('Password changed to "%pass"', array('%pass' => $form_state['values']['pass']))); - //} + //if (!empty($form_state['values']['pass'])) { + watchdog('booking', t('Password changed to "%pass"', array('%pass' => $form_state['values']['pass']))); + //} } */