2015-12-19 23:31:08 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Edit a user's driving license information.
|
2016-11-17 14:35:04 +01:00
|
|
|
*
|
2017-01-03 03:22:48 +01:00
|
|
|
* @param array $user_source The user
|
|
|
|
* @param bool $wants_to_drive true, if the user wants to drive
|
|
|
|
* @param array $user_driver_license The user driver license
|
2016-11-17 14:35:04 +01:00
|
|
|
* @return string
|
2015-12-19 23:31:08 +01:00
|
|
|
*/
|
2017-01-02 03:57:23 +01:00
|
|
|
function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver_license)
|
|
|
|
{
|
2017-01-03 14:12:17 +01:00
|
|
|
return page_with_title(sprintf(_('Edit %s driving license information'), User_Nick_render($user_source)), [
|
2017-01-02 15:43:36 +01:00
|
|
|
buttons([
|
2017-01-03 14:12:17 +01:00
|
|
|
button(user_link($user_source), _('Back to profile'), 'back')
|
2017-01-02 15:43:36 +01:00
|
|
|
]),
|
|
|
|
msg(),
|
|
|
|
form([
|
2017-01-03 14:12:17 +01:00
|
|
|
form_info(_('Privacy'), _('Your driving license information is only visible for supporters and admins.')),
|
2017-07-17 23:43:47 +02:00
|
|
|
form_checkbox('wants_to_drive', _('I am willing to drive a car for the event'), $wants_to_drive),
|
2017-01-02 15:43:36 +01:00
|
|
|
div('panel panel-default', [
|
|
|
|
div('panel-body', [
|
|
|
|
form_checkbox(
|
|
|
|
'has_car',
|
2017-07-17 23:43:47 +02:00
|
|
|
_('I have my own car with me and am willing to use it for the event (You\'ll get reimbursed for fuel)'),
|
2017-01-02 15:43:36 +01:00
|
|
|
$user_driver_license['has_car']
|
|
|
|
),
|
2017-01-03 14:12:17 +01:00
|
|
|
heading(_('Driver license'), 3),
|
|
|
|
form_checkbox('has_license_car', _('Car'), $user_driver_license['has_license_car']),
|
2017-01-02 15:43:36 +01:00
|
|
|
form_checkbox(
|
|
|
|
'has_license_3_5t_transporter',
|
2017-01-03 14:12:17 +01:00
|
|
|
_('Transporter 3,5t'),
|
2017-01-02 15:43:36 +01:00
|
|
|
$user_driver_license['has_license_3_5t_transporter']
|
|
|
|
),
|
|
|
|
form_checkbox(
|
|
|
|
'has_license_7_5t_truck',
|
2017-01-03 14:12:17 +01:00
|
|
|
_('Truck 7,5t'),
|
2017-01-02 15:43:36 +01:00
|
|
|
$user_driver_license['has_license_7_5t_truck']
|
|
|
|
),
|
|
|
|
form_checkbox(
|
|
|
|
'has_license_12_5t_truck',
|
2017-01-03 14:12:17 +01:00
|
|
|
_('Truck 12,5t'),
|
2017-01-02 15:43:36 +01:00
|
|
|
$user_driver_license['has_license_12_5t_truck']
|
|
|
|
),
|
2017-01-03 14:12:17 +01:00
|
|
|
form_checkbox('has_license_forklift', _('Forklift'), $user_driver_license['has_license_forklift'])
|
2017-01-02 15:43:36 +01:00
|
|
|
])
|
|
|
|
], 'driving_license'),
|
2017-01-03 14:12:17 +01:00
|
|
|
form_submit('submit', _('Save'))
|
2017-01-02 15:43:36 +01:00
|
|
|
]),
|
|
|
|
'<script type="text/javascript">
|
2015-12-19 23:31:08 +01:00
|
|
|
$(function() {
|
2017-01-03 03:22:48 +01:00
|
|
|
var checkbox = $("#wants_to_drive");
|
|
|
|
if(checkbox.is(":checked"))
|
2015-12-19 23:31:08 +01:00
|
|
|
$("#driving_license").show();
|
|
|
|
else
|
|
|
|
$("#driving_license").hide();
|
2017-01-22 01:02:52 +01:00
|
|
|
|
2017-01-03 03:22:48 +01:00
|
|
|
checkbox.click(
|
|
|
|
function() {
|
2015-12-19 23:31:08 +01:00
|
|
|
if($("#wants_to_drive").is(":checked"))
|
|
|
|
$("#driving_license").show();
|
|
|
|
else
|
|
|
|
$("#driving_license").hide();
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
2017-01-02 03:57:23 +01:00
|
|
|
</script>'
|
2017-01-02 15:43:36 +01:00
|
|
|
]);
|
2015-12-19 23:31:08 +01:00
|
|
|
}
|