From 4898060d2f1629e22a0f7d94f982ddab2499c6fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Loguercio?= Date: Tue, 28 Jun 2016 16:37:22 -0500 Subject: [PATCH] Added Geolocalization plugin to user_edit.php --- main/admin/user_edit.php | 135 ++++++++++++++++++++++++++++++- main/inc/lib/usermanager.lib.php | 4 +- 2 files changed, 134 insertions(+), 5 deletions(-) diff --git a/main/admin/user_edit.php b/main/admin/user_edit.php index 72d3bc4b8a..337316e09f 100755 --- a/main/admin/user_edit.php +++ b/main/admin/user_edit.php @@ -68,16 +68,16 @@ function confirmation(name) { } '; +$userGeolocalization = api_get_setting('enable_profile_user_address_geolocalization') == 'true'; + $htmlHeadXtra[] = ''; $htmlHeadXtra[] = ''; +$htmlHeadXtra[] = ''; $htmlHeadXtra[] = ''; +} + // Create the form $form = new FormValidator( 'user_edit', @@ -205,6 +305,32 @@ if (api_get_setting('openid_authentication') == 'true') { // Phone $form->addElement('text', 'phone', get_lang('PhoneNumber')); +if ($userGeolocalization) { + // Geolocation + $form->addElement('text', 'address', get_lang('AddressField'), ['id' => 'address']); + $form->addHtml(' +
+ +
+ + +
+
+ '); + + $form->addHtml(' +
+ +
+
+
+
+
+ '); +} + // Picture $form->addElement('file', 'picture', get_lang('AddPicture'), array('id' => 'picture', 'class' => 'picture-form')); $allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif'); @@ -477,7 +603,8 @@ if ($form->validate()) { $language, null, $send_mail, - $reset_password + $reset_password, + $user['address'] ); if (isset($user['student_boss'])) { diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php index cc855189e8..ce2cc91987 100755 --- a/main/inc/lib/usermanager.lib.php +++ b/main/inc/lib/usermanager.lib.php @@ -864,7 +864,8 @@ class UserManager $language = 'english', $encrypt_method = '', $send_email = false, - $reset_password = 0 + $reset_password = 0, + $address ) { $hook = HookUpdateUser::create(); if (!empty($hook)) { @@ -937,6 +938,7 @@ class UserManager ->setEmail($email) ->setOfficialCode($official_code) ->setPhone($phone) + ->setAddress($address) ->setPictureUri($picture_uri) ->setExpirationDate($expiration_date) ->setActive($active)