| 8 |
* Implementation of hook_views_data(). |
* Implementation of hook_views_data(). |
| 9 |
*/ |
*/ |
| 10 |
function publicbookings_views_data() { |
function publicbookings_views_data() { |
| 11 |
$data['publicbookings_client']['table']['group'] = t('Booking client'); |
$data['publicbookings_clients']['table']['group'] = t('Booking client'); |
| 12 |
|
|
| 13 |
$data['publicbookings_client']['table']['base'] = array( |
$data['publicbookings_clients']['table']['base'] = array( |
| 14 |
'field' => 'client_id', |
'field' => 'client_id', |
| 15 |
'title' => t('Booking client'), |
'title' => t('Booking client'), |
| 16 |
'help' => t("Booking requests made on the public request pages have client information."), |
'help' => t("Booking requests made on the public request pages have client information."), |
| 17 |
); |
); |
| 18 |
|
|
| 19 |
$data['publicbookings_client']['table']['join'] = array( |
$data['publicbookings_clients']['table']['join'] = array( |
| 20 |
'bookings_records' => array( |
'bookings_records' => array( |
| 21 |
'left_field' => 'record_id', |
'left_field' => 'record_id', |
| 22 |
'field' => 'record_id', |
'field' => 'record_id', |
| 27 |
), |
), |
| 28 |
); |
); |
| 29 |
|
|
| 30 |
$data['publicbookings_client']['first_name'] = array( |
$data['publicbookings_clients']['first_name'] = array( |
| 31 |
'title' => t('First name'), |
'title' => t('First name'), |
| 32 |
'help' => t('The first name of the client.'), |
'help' => t('The first name of the client.'), |
| 33 |
'field' => array( |
'field' => array( |
| 45 |
), |
), |
| 46 |
); |
); |
| 47 |
|
|
| 48 |
$data['publicbookings_client']['last_name'] = array( |
$data['publicbookings_clients']['last_name'] = array( |
| 49 |
'title' => t('Last name'), |
'title' => t('Last name'), |
| 50 |
'help' => t('The last name of the client.'), |
'help' => t('The last name of the client.'), |
| 51 |
'field' => array( |
'field' => array( |
| 63 |
), |
), |
| 64 |
); |
); |
| 65 |
|
|
| 66 |
$data['publicbookings_client']['phone'] = array( |
$data['publicbookings_clients']['phone'] = array( |
| 67 |
'title' => t('Phone'), |
'title' => t('Phone'), |
| 68 |
'help' => t('The phone number of the client.'), |
'help' => t('The phone number of the client.'), |
| 69 |
'field' => array( |
'field' => array( |
| 72 |
), |
), |
| 73 |
); |
); |
| 74 |
|
|
| 75 |
$data['publicbookings_client']['email'] = array( |
$data['publicbookings_clients']['email'] = array( |
| 76 |
'title' => t('Email'), |
'title' => t('Email'), |
| 77 |
'help' => t('The email address of the client.'), |
'help' => t('The email address of the client.'), |
| 78 |
'field' => array( |
'field' => array( |
| 81 |
), |
), |
| 82 |
); |
); |
| 83 |
|
|
| 84 |
$data['publicbookings_client']['comments'] = array( |
$data['publicbookings_clients']['comments'] = array( |
| 85 |
'title' => t('Comments'), |
'title' => t('Comments'), |
| 86 |
'help' => t('Comments by the client.'), |
'help' => t('Comments by the client.'), |
| 87 |
'field' => array( |
'field' => array( |
| 90 |
), |
), |
| 91 |
); |
); |
| 92 |
|
|
| 93 |
$data['publicbookings_client']['uid'] = array( |
$data['publicbookings_clients']['uid'] = array( |
| 94 |
'title' => t('User'), |
'title' => t('User'), |
| 95 |
'help' => t('If the client was logged in, this is the user ID.'), |
'help' => t('If the client was logged in, this is the user ID.'), |
| 96 |
'relationship' => array( |
'relationship' => array( |
| 101 |
), |
), |
| 102 |
); |
); |
| 103 |
|
|
| 104 |
$data['publicbookings_client']['created'] = array( |
$data['publicbookings_clients']['created'] = array( |
| 105 |
'title' => t('Created date'), |
'title' => t('Created date'), |
| 106 |
'help' => t('Created date.'), |
'help' => t('Created date.'), |
| 107 |
'field' => array( |
'field' => array( |
| 116 |
), |
), |
| 117 |
); |
); |
| 118 |
|
|
| 119 |
$data['publicbookings_client']['changed'] = array( |
$data['publicbookings_clients']['changed'] = array( |
| 120 |
'title' => t('Modified date'), |
'title' => t('Modified date'), |
| 121 |
'help' => t('Last modified.'), |
'help' => t('Last modified.'), |
| 122 |
'field' => array( |
'field' => array( |
| 240 |
return $data; |
return $data; |
| 241 |
} |
} |
| 242 |
|
|
|
class views_handler_field_publicbookings_record_link extends views_handler_field { |
|
|
function construct() { |
|
|
parent::construct(); |
|
|
$this->additional_fields['record_id'] = 'record_id'; |
|
|
} |
|
|
|
|
|
function query() { // what is this? |
|
|
$this->ensure_my_table(); |
|
|
$this->add_additional_fields(); |
|
|
} |
|
|
|
|
|
function render($values) { |
|
|
parent::render($values); |
|
|
} |
|
|
} |
|
|
|
|
|
class views_handler_field_publicbookings_booking_link_edit extends views_handler_field_publicbookings_record_link { |
|
|
function render($values) { |
|
|
parent::render($values); |
|
|
$record_id = $values->{$this->aliases['record_id']}; |
|
|
return l(t('edit'), "admin/content/publicbookings/booking/$record_id/edit"); |
|
|
} |
|
|
} |
|
|
|
|
|
class views_handler_field_publicbookings_booking_link_delete extends views_handler_field_publicbookings_record_link { |
|
|
function render($values) { |
|
|
parent::render($values); |
|
|
$record_id = $values->{$this->aliases['record_id']}; |
|
|
return l(t('delete'), "admin/content/publicbookings/booking/$record_id/delete"); |
|
|
} |
|
|
} |
|
|
|
|
|
class views_handler_field_publicbookings_availability_link_edit extends views_handler_field_publicbookings_record_link { |
|
|
function render($values) { |
|
|
parent::render($values); |
|
|
$record_id = $values->{$this->aliases['record_id']}; |
|
|
return l(t('edit'), "admin/content/publicbookings/availability/$record_id/edit"); |
|
|
} |
|
|
} |
|
|
|
|
|
class views_handler_field_publicbookings_availability_link_delete extends views_handler_field_publicbookings_record_link { |
|
|
function render($values) { |
|
|
parent::render($values); |
|
|
$record_id = $values->{$this->aliases['record_id']}; |
|
|
return l(t('delete'), "admin/content/publicbookings/availability/$record_id/delete"); |
|
|
} |
|
|
} |
|
|
|
|
|
class views_handler_field_publicbookings_resource_link extends views_handler_field { |
|
|
function construct() { |
|
|
parent::construct(); |
|
|
$this->additional_fields['resource_id'] = 'resource_id'; |
|
|
} |
|
|
|
|
|
function query() { // what is this? |
|
|
$this->ensure_my_table(); |
|
|
$this->add_additional_fields(); |
|
|
} |
|
|
|
|
|
function render($values) { |
|
|
parent::render($values); |
|
|
} |
|
|
} |
|
|
|
|
|
class views_handler_field_publicbookings_resource_link_edit extends views_handler_field_publicbookings_resource_link { |
|
|
function render($values) { |
|
|
parent::render($values); |
|
|
$resource_id = $values->{$this->aliases['resource_id']}; |
|
|
return l(t('edit'), "admin/content/publicbookings/resource/$resource_id/edit"); |
|
|
} |
|
|
} |
|
|
|
|
|
class views_handler_field_publicbookings_resource_link_delete extends views_handler_field_publicbookings_resource_link { |
|
|
function render($values) { |
|
|
parent::render($values); |
|
|
$resource_id = $values->{$this->aliases['resource_id']}; |
|
|
return l(t('delete'), "admin/content/publicbookings/resource/$resource_id/delete"); |
|
|
} |
|
|
} |
|
|
class views_handler_field_publicbookings_resource_link_availability extends views_handler_field_publicbookings_resource_link { |
|
|
function render($values) { |
|
|
parent::render($values); |
|
|
$resource_id = $values->{$this->aliases['resource_id']}; |
|
|
return l(t('availability'), "admin/content/publicbookings/resource/$resource_id/availability/list"); |
|
|
} |
|
|
} |
|