| 1 |
<?php |
<?php |
| 2 |
// $Id: publicbookings.module,v 1.7 2008/08/18 19:20:11 carson Exp $ |
// $Id: publicbookings.module,v 1.8 2008/08/18 19:57:34 carson Exp $ |
| 3 |
/** |
/** |
| 4 |
* @file |
* @file |
| 5 |
* Login-free booking of resources, with a management backend. |
* Login-free booking of resources, with a management backend. |
| 377 |
case 'request_confirm': |
case 'request_confirm': |
| 378 |
$subject = t('Confirm your booking request'); |
$subject = t('Confirm your booking request'); |
| 379 |
$body = t('Please visit the link below to confirm your booking request:') . "\n\n"; |
$body = t('Please visit the link below to confirm your booking request:') . "\n\n"; |
| 380 |
$body .= base_path()."/publicbookings/request/confirm/%passphrase\n\n"; |
$body .= 'http://' . $_SERVER['SERVER_NAME'] . base_path() . "publicbookings/request/confirm/%passphrase\n\n"; |
| 381 |
$body .= t('Your passphrase is %passphrase.'); |
$body .= t('Your passphrase is %passphrase.'); |
| 382 |
$body .= t('You can use this passphrase to return to your booking request and make changes if necessary.') . "\n\n"; |
$body .= t('You can use this passphrase to return to your booking request and make changes if necessary.') . "\n\n"; |
| 383 |
break; |
break; |
| 402 |
break; |
break; |
| 403 |
} |
} |
| 404 |
$body .= t('The details of your booking request follow.'); |
$body .= t('The details of your booking request follow.'); |
| 405 |
$body .= "\n\n" . t("Booking name: %name") . "\n"; |
$body .= "\n" . t("Booking name: %name") . "\n"; |
| 406 |
$body .= "\n\n" . t("Start: %start") . "\n"; |
$body .= "\n" . t('Resource: %resource_name') . "\n"; |
| 407 |
$body .= "\n\n" . t("End: %end") . "\n"; |
$body .= "\n" . t("Start: %start") . "\n"; |
| 408 |
|
$body .= "\n" . t("End: %end") . "\n"; |
| 409 |
|
|
| 410 |
$vars = array(); |
$vars = array(); |
| 411 |
foreach($params as $k=>$v) { |
foreach($params as $k=>$v) { |
| 444 |
drupal_write_record('publicbookings_clients', &$values, $update); |
drupal_write_record('publicbookings_clients', &$values, $update); |
| 445 |
$values = (array) $values; |
$values = (array) $values; |
| 446 |
|
|
| 447 |
|
// the emails require the resource name, so load the resource |
| 448 |
|
$res = bookingsapi_resource_load($values['resource_id']); |
| 449 |
|
$values['resource_name'] = $res['name']; |
| 450 |
|
|
| 451 |
switch($record_save) { |
switch($record_save) { |
| 452 |
case SAVED_NEW: |
case SAVED_NEW: |
| 453 |
_publicbookings_send_mail('request_confirm', $values['email'], $values); |
_publicbookings_send_mail('request_confirm', $values['email'], $values); |
| 490 |
} |
} |
| 491 |
return $pass; |
return $pass; |
| 492 |
} |
} |
| 493 |
|
|
| 494 |
|
/** |
| 495 |
|
* Implementation of hook_views_api(). |
| 496 |
|
*/ |
| 497 |
|
function publicbookings_views_api() { |
| 498 |
|
return array( |
| 499 |
|
'api' => '2.0', |
| 500 |
|
); |
| 501 |
|
} |
| 502 |
|
|
| 503 |
|
/** |
| 504 |
|
* Implementation of hook_views_handlers(). |
| 505 |
|
*/ |
| 506 |
|
function publicbookings_views_handlers() { |
| 507 |
|
return array( |
| 508 |
|
'info' => array( |
| 509 |
|
'path' => drupal_get_path('module', 'publicbookings') . '/handlers', |
| 510 |
|
), |
| 511 |
|
'handlers' => array( |
| 512 |
|
'views_handler_field_publicbookings_record_link' => array( |
| 513 |
|
'parent' => 'views_handler_field', |
| 514 |
|
'file' => 'views_handler_field.inc', |
| 515 |
|
), |
| 516 |
|
'views_handler_field_publicbookings_resource_link' => array( |
| 517 |
|
'parent' => 'views_handler_field', |
| 518 |
|
'file' => 'views_handler_field.inc', |
| 519 |
|
), |
| 520 |
|
'views_handler_field_publicbookings_booking_link_edit' => array( |
| 521 |
|
'parent' => 'views_handler_field', |
| 522 |
|
'file' => 'views_handler_field.inc', |
| 523 |
|
), |
| 524 |
|
'views_handler_field_publicbookings_availability_link_edit' => array( |
| 525 |
|
'parent' => 'views_handler_field', |
| 526 |
|
'file' => 'views_handler_field.inc', |
| 527 |
|
), |
| 528 |
|
'views_handler_field_publicbookings_resource_link_edit' => array( |
| 529 |
|
'parent' => 'views_handler_field', |
| 530 |
|
'file' => 'views_handler_field.inc', |
| 531 |
|
), |
| 532 |
|
), |
| 533 |
|
); |
| 534 |
|
} |