summaryrefslogtreecommitdiff
path: root/includes/view
diff options
context:
space:
mode:
authorPhilip Häusler <msquare@notrademark.de>2015-12-19 23:31:08 +0100
committerPhilip Häusler <msquare@notrademark.de>2015-12-19 23:31:08 +0100
commitfacc32f13331498999ee07d467ea4ef420ebf190 (patch)
tree340fcacdcb4993200dbbc83bfa1b7380aaef12c9 /includes/view
parentdc4eb98cafccbba7b2877691d8c3322cac87828b (diff)
#198 add basic driver license information
Diffstat (limited to 'includes/view')
-rw-r--r--includes/view/UserDriverLicenses_view.php56
-rw-r--r--includes/view/User_view.php1
2 files changed, 57 insertions, 0 deletions
diff --git a/includes/view/UserDriverLicenses_view.php b/includes/view/UserDriverLicenses_view.php
new file mode 100644
index 00000000..041c8734
--- /dev/null
+++ b/includes/view/UserDriverLicenses_view.php
@@ -0,0 +1,56 @@
+<?php
+
+/**
+ * Edit a user's driving license information.
+ * @param User $user_source
+ * @param bool $wants_to_drive
+ * @param bool $has_car
+ * @param bool $has_license_car
+ * @param bool $has_license_3_5t_transporter
+ * @param bool $has_license_7_5t_truck
+ * @param bool $has_license_12_5t_truck
+ * @param bool $has_license_forklift
+ */
+function UserDriverLicense_edit_view($user_source, $wants_to_drive, $has_car, $has_license_car, $has_license_3_5t_transporter, $has_license_7_5t_truck, $has_license_12_5t_truck, $has_license_forklift) {
+ return page_with_title(sprintf(_("Edit %s driving license information"), User_Nick_render($user_source)), [
+ buttons([
+ button(user_link($user_source), _("Back to profile"), 'back')
+ ]),
+ msg(),
+ form([
+ form_info(_("Privacy"), _("Your driving license information is only visible for coordinators and admins.")),
+ form_checkbox('wants_to_drive', _("I am willing to operate cars for the PL"), $wants_to_drive),
+ div('panel panel-default', [
+ div('panel-body', [
+ form_checkbox('has_car', _("I have my own car with me and am willing to use it for the PL (You'll get reimbursed for fuel)"), $has_car),
+ heading(_("Driver license"), 3),
+ form_checkbox('has_license_car', _("Car"), $has_license_car),
+ form_checkbox('has_license_3_5t_transporter', _("Transporter 3,5t"), $has_license_3_5t_transporter),
+ form_checkbox('has_license_7_5t_truck', _("Truck 7,5t"), $has_license_7_5t_truck),
+ form_checkbox('has_license_12_5t_truck', _("Truck 12,5t"), $has_license_12_5t_truck),
+ form_checkbox('has_license_forklift', _("Forklift"), $has_license_forklift)
+ ])
+ ], 'driving_license'),
+ form_submit('submit', _("Save"))
+ ]) ,
+ '<script type="text/javascript">
+ $(function() {
+ if($("#wants_to_drive").is(":checked"))
+ $("#driving_license").show();
+ else
+ $("#driving_license").hide();
+
+ $("#wants_to_drive").click(
+ function(e) {
+ if($("#wants_to_drive").is(":checked"))
+ $("#driving_license").show();
+ else
+ $("#driving_license").hide();
+ }
+ );
+ });
+ </script>'
+ ]);
+}
+
+?> \ No newline at end of file
diff --git a/includes/view/User_view.php b/includes/view/User_view.php
index 3ab5f816..90e849a6 100644
--- a/includes/view/User_view.php
+++ b/includes/view/User_view.php
@@ -205,6 +205,7 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel
div('col-md-12', array(
buttons(array(
$admin_user_privilege ? button(page_link_to('admin_user') . '&id=' . $user_source['UID'], glyph("edit") . _("edit")) : '',
+ $admin_user_privilege ? button(user_driver_license_edit_link($user_source), glyph("road") . _("driving license")) : '',
($admin_user_privilege && ! $user_source['Gekommen']) ? button(page_link_to('admin_arrive') . '&arrived=' . $user_source['UID'], _("arrived")) : '',
$admin_user_privilege ? button(page_link_to('users') . '&action=edit_vouchers&user_id=' . $user_source['UID'], glyph('cutlery') . _('Edit vouchers')) : '',
$its_me ? button(page_link_to('user_settings'), glyph('list-alt') . _("Settings")) : '',