Adding travel form
This commit is contained in:
@@ -103,7 +103,16 @@ function booking_permission() {
|
||||
),
|
||||
'edit study groups' => array(
|
||||
'title' => t('Edit study groups'),
|
||||
),
|
||||
),
|
||||
'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'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -188,6 +197,7 @@ function booking_menu() {
|
||||
//'type' => MENU_LOCAL_TASK,
|
||||
);
|
||||
|
||||
//pages for attendees to fill out information
|
||||
$items['booking'] = array(
|
||||
'title' => $bookingTitle . ' Booking Form',
|
||||
'page callback' => 'booking_register_page',
|
||||
@@ -201,7 +211,6 @@ function booking_menu() {
|
||||
'access arguments' => array('access booking form'),
|
||||
'type' => MENU_CALLBACK,
|
||||
);
|
||||
|
||||
|
||||
$items['balance/%'] = array(
|
||||
'title' => 'Registration Final Payment',
|
||||
@@ -210,6 +219,15 @@ function booking_menu() {
|
||||
'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['variety'] = array(
|
||||
'title' => $bookingTitle . ' Variety Sessions',
|
||||
'page callback' => 'drupal_get_form',
|
||||
@@ -424,8 +442,13 @@ function booking_node_info() {
|
||||
'booking' => array(
|
||||
'name' => t('Registration'),
|
||||
'base' => 'booking',
|
||||
'description' => t('This node represents a booking into an event.'),
|
||||
)
|
||||
'description' => t('This node represents a registration for an event.'),
|
||||
),
|
||||
'travel' => array(
|
||||
'name' => t('Travel Form'),
|
||||
'base' => 'travel',
|
||||
'description' => t('This node represents a travel details form for an event registration.'),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -435,7 +458,8 @@ function booking_node_info() {
|
||||
*/
|
||||
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)));
|
||||
@@ -469,6 +493,32 @@ function booking_node_access($node, $op, $account) {
|
||||
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
|
||||
{
|
||||
@@ -505,6 +555,12 @@ function booking_theme() {
|
||||
function booking_mail($key, &$message, $params) {
|
||||
$message['subject'] = $params['subject'];
|
||||
$message['body'][] = $params['body'];
|
||||
|
||||
//reference https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_mail/7
|
||||
if (isset($params['headers']) && is_array($params['headers'])) {
|
||||
$message['headers'] += $params['headers'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user