diff options
author | Philip Häusler <msquare@notrademark.de> | 2015-12-20 11:36:12 +0100 |
---|---|---|
committer | Philip Häusler <msquare@notrademark.de> | 2015-12-20 11:36:12 +0100 |
commit | 0ac05d251c0df5fa09a27b7686acc5690b436f31 (patch) | |
tree | 12e39fff0fd2c62a624a8c6ee51af4664d557ade /includes/controller/user_driver_licenses_controller.php | |
parent | 2cb44fe51752bece6413d3a4745cfba79df21884 (diff) |
#198 fixed: driving license feature completed - integrated into angeltypes
Diffstat (limited to 'includes/controller/user_driver_licenses_controller.php')
-rw-r--r-- | includes/controller/user_driver_licenses_controller.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/includes/controller/user_driver_licenses_controller.php b/includes/controller/user_driver_licenses_controller.php index b18a78b6..ec094220 100644 --- a/includes/controller/user_driver_licenses_controller.php +++ b/includes/controller/user_driver_licenses_controller.php @@ -1,6 +1,32 @@ <?php /** + * Generates a hint, if user joined angeltypes that require a driving license and the user has no driver license information provided. + */ +function user_driver_license_required_hint() { + global $user; + + $angeltypes = User_angeltypes($user); + if ($angeltypes === false) + engelsystem_error("Unable to load user angeltypes."); + $user_driver_license = UserDriverLicense($user['UID']); + if ($user_driver_license === false) + engelsystem_error("Unable to load user driver license."); + + $driving_license_information_required = false; + foreach ($angeltypes as $angeltype) + if ($angeltype['requires_driver_license']) { + $driving_license_information_required = true; + break; + } + + if ($driving_license_information_required && $user_driver_license == null) + return info(sprintf(_("You joined an angeltype which requires a driving license. Please edit your driving license information here: %s."), '<a href="' . user_driver_license_edit_link() . '">' . _("driving license information") . '</a>'), true); + + return ''; +} + +/** * Route user driver licenses actions. */ function user_driver_licenses_controller() { |