user_edit.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @package chamilo.admin
  5. */
  6. $cidReset = true;
  7. require_once '../inc/global.inc.php';
  8. $this_section = SECTION_PLATFORM_ADMIN;
  9. api_protect_admin_script(true);
  10. $user_id = isset($_GET['user_id']) ? intval($_GET['user_id']) : intval($_POST['user_id']);
  11. api_protect_super_admin($user_id, null, true);
  12. $is_platform_admin = api_is_platform_admin() ? 1 : 0;
  13. $userInfo = api_get_user_info($user_id);
  14. $htmlHeadXtra[] = '
  15. <script>
  16. var is_platform_id = "'.$is_platform_admin.'";
  17. function enable_expiration_date() {
  18. document.user_edit.radio_expiration_date[0].checked=false;
  19. document.user_edit.radio_expiration_date[1].checked=true;
  20. }
  21. function password_switch_radio_button(){
  22. var input_elements = document.getElementsByTagName("input");
  23. for (var i = 0; i < input_elements.length; i++) {
  24. if(input_elements.item(i).name == "reset_password" && input_elements.item(i).value == "2") {
  25. input_elements.item(i).checked = true;
  26. }
  27. }
  28. }
  29. function display_drh_list(){
  30. var $radios = $("input:radio[name=platform_admin]");
  31. if (document.getElementById("status_select").value=='.COURSEMANAGER.') {
  32. if (is_platform_id == 1)
  33. document.getElementById("id_platform_admin").style.display="block";
  34. } else if (document.getElementById("status_select").value=='.STUDENT.') {
  35. if (is_platform_id == 1)
  36. document.getElementById("id_platform_admin").style.display="none";
  37. $radios.filter("[value=0]").attr("checked", true);
  38. } else {
  39. if (is_platform_id == 1)
  40. document.getElementById("id_platform_admin").style.display="none";
  41. $radios.filter("[value=0]").attr("checked", true);
  42. }
  43. }
  44. function show_image(image,width,height) {
  45. width = parseInt(width) + 20;
  46. height = parseInt(height) + 20;
  47. window_x = window.open(image,\'windowX\',\'width=\'+ width + \', height=\'+ height + \' , resizable=0\');
  48. }
  49. function confirmation(name) {
  50. if (confirm("'.get_lang('AreYouSureToDeleteJS', '').' " + name + " ?")) {
  51. document.forms["profile"].submit();
  52. } else {
  53. return false;
  54. }
  55. }
  56. </script>';
  57. $userGeolocalization = api_get_setting('enable_profile_user_address_geolocalization') == 'true';
  58. $htmlHeadXtra[] = '<link href="'. api_get_path(WEB_PATH) .'web/assets/cropper/dist/cropper.min.css" rel="stylesheet">';
  59. $htmlHeadXtra[] = '<script src="'. api_get_path(WEB_PATH) .'web/assets/cropper/dist/cropper.min.js"></script>';
  60. $htmlHeadXtra[] = '<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?sensor=true" ></script>';
  61. $libpath = api_get_path(LIBRARY_PATH);
  62. $noPHP_SELF = true;
  63. $tool_name = get_lang('ModifyUserInfo');
  64. $interbreadcrumb[] = array('url' => 'index.php', "name" => get_lang('PlatformAdmin'));
  65. $interbreadcrumb[] = array('url' => "user_list.php", "name" => get_lang('UserList'));
  66. $table_user = Database::get_main_table(TABLE_MAIN_USER);
  67. $table_admin = Database::get_main_table(TABLE_MAIN_ADMIN);
  68. $sql = "SELECT u.*, a.user_id AS is_admin FROM $table_user u
  69. LEFT JOIN $table_admin a ON a.user_id = u.id
  70. WHERE u.id = '".$user_id."'";
  71. $res = Database::query($sql);
  72. if (Database::num_rows($res) != 1) {
  73. header('Location: user_list.php');
  74. exit;
  75. }
  76. $user_data = Database::fetch_array($res, 'ASSOC');
  77. $user_data['platform_admin'] = is_null($user_data['is_admin']) ? 0 : 1;
  78. $user_data['send_mail'] = 0;
  79. $user_data['old_password'] = $user_data['password'];
  80. //Convert the registration date of the user
  81. $user_data['registration_date'] = api_get_local_time($user_data['registration_date']);
  82. unset($user_data['password']);
  83. if ($userGeolocalization) {
  84. $htmlHeadXtra[] = '<script>
  85. $(document).ready(function() {
  86. var address = "' . $user_data['address'] . '";
  87. initializeGeo(address, false);
  88. $("#geolocalization").on("click", function() {
  89. var address = $("#address").val();
  90. initializeGeo(address, false);
  91. return false;
  92. });
  93. $("#myLocation").on("click", function() {
  94. myLocation();
  95. return false;
  96. });
  97. $("#address").keypress(function (event) {
  98. if (event.which == 13) {
  99. $("#geolocalization").click();
  100. return false;
  101. }
  102. });
  103. });
  104. function myLocation() {
  105. if (navigator.geolocation) {
  106. var geoPosition = function(position) {
  107. var lat = position.coords.latitude;
  108. var lng = position.coords.longitude;
  109. var latLng = new google.maps.LatLng(lat, lng);
  110. initializeGeo(false, latLng)
  111. };
  112. var geoError = function(error) {
  113. alert("Geocode ' . get_lang('Error') . ': " + error);
  114. };
  115. var geoOptions = {
  116. enableHighAccuracy: true
  117. };
  118. navigator.geolocation.getCurrentPosition(geoPosition, geoError, geoOptions);
  119. }
  120. }
  121. function initializeGeo(address, latLng) {
  122. var geocoder = new google.maps.Geocoder();
  123. var latlng = new google.maps.LatLng(-34.397, 150.644);
  124. var myOptions = {
  125. zoom: 15,
  126. center: latlng,
  127. mapTypeControl: true,
  128. mapTypeControlOptions: {
  129. style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
  130. },
  131. navigationControl: true,
  132. mapTypeId: google.maps.MapTypeId.ROADMAP
  133. };
  134. map = new google.maps.Map(document.getElementById("map"), myOptions);
  135. var parameter = address ? { "address": address } : latLng ? { "latLng": latLng } : false;
  136. if (geocoder && parameter) {
  137. geocoder.geocode(parameter, function(results, status) {
  138. if (status == google.maps.GeocoderStatus.OK) {
  139. if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
  140. map.setCenter(results[0].geometry.location);
  141. if (!address) {
  142. $("#address").val(results[0].formatted_address);
  143. }
  144. var infowindow = new google.maps.InfoWindow({
  145. content: "<b>" + $("#address").val() + "</b>",
  146. size: new google.maps.Size(150, 50)
  147. });
  148. var marker = new google.maps.Marker({
  149. position: results[0].geometry.location,
  150. map: map,
  151. title: $("#address").val()
  152. });
  153. google.maps.event.addListener(marker, "click", function() {
  154. infowindow.open(map, marker);
  155. });
  156. } else {
  157. alert("' . get_lang("NotFound") . '");
  158. }
  159. } else {
  160. alert("Geocode ' . get_lang('Error') . ': " + status);
  161. }
  162. });
  163. }
  164. }
  165. </script>';
  166. }
  167. // Create the form
  168. $form = new FormValidator(
  169. 'user_edit',
  170. 'post',
  171. api_get_self().'?user_id='.$user_id,
  172. ''
  173. );
  174. $form->addElement('header', $tool_name);
  175. $form->addElement('hidden', 'user_id', $user_id);
  176. if (api_is_western_name_order()) {
  177. // Firstname
  178. $form->addElement('text', 'firstname', get_lang('FirstName'));
  179. $form->applyFilter('firstname', 'html_filter');
  180. $form->applyFilter('firstname', 'trim');
  181. $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
  182. // Lastname
  183. $form->addElement('text', 'lastname', get_lang('LastName'));
  184. $form->applyFilter('lastname', 'html_filter');
  185. $form->applyFilter('lastname', 'trim');
  186. $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
  187. } else {
  188. // Lastname
  189. $form->addElement('text', 'lastname', get_lang('LastName'));
  190. $form->applyFilter('lastname', 'html_filter');
  191. $form->applyFilter('lastname', 'trim');
  192. $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
  193. // Firstname
  194. $form->addElement('text', 'firstname', get_lang('FirstName'));
  195. $form->applyFilter('firstname', 'html_filter');
  196. $form->applyFilter('firstname', 'trim');
  197. $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
  198. }
  199. // Official code
  200. $form->addElement('text', 'official_code', get_lang('OfficialCode'), array('size' => '40'));
  201. $form->applyFilter('official_code', 'html_filter');
  202. $form->applyFilter('official_code', 'trim');
  203. // Email
  204. $form->addElement('text', 'email', get_lang('Email'));
  205. $form->addRule('email', get_lang('EmailWrong'), 'email');
  206. if (api_get_setting('registration', 'email') == 'true') {
  207. $form->addRule('email', get_lang('EmailWrong'), 'required');
  208. }
  209. if (api_get_setting('login_is_email') == 'true') {
  210. $form->addRule('email', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
  211. $form->addRule('email', get_lang('UserTaken'), 'username_available', $user_data['username']);
  212. }
  213. // OpenID
  214. if (api_get_setting('openid_authentication') == 'true') {
  215. $form->addElement('text', 'openid', get_lang('OpenIDURL'));
  216. }
  217. // Phone
  218. $form->addElement('text', 'phone', get_lang('PhoneNumber'));
  219. if ($userGeolocalization) {
  220. // Geolocation
  221. $form->addElement('text', 'address', get_lang('AddressField'), ['id' => 'address']);
  222. $form->addHtml('
  223. <div class="form-group">
  224. <label for="geolocalization" class="col-sm-2 control-label"></label>
  225. <div class="col-sm-8">
  226. <button class="null btn btn-default " id="geolocalization" name="geolocalization" type="submit"><em class="fa fa-map-marker"></em> '.get_lang('Geolocalization').'</button>
  227. <button class="null btn btn-default " id="myLocation" name="myLocation" type="submit"><em class="fa fa-crosshairs"></em> '.get_lang('MyLocation').'</button>
  228. </div>
  229. </div>
  230. ');
  231. $form->addHtml('
  232. <div class="form-group">
  233. <label for="map" class="col-sm-2 control-label">
  234. '.get_lang('Map').'
  235. </label>
  236. <div class="col-sm-8">
  237. <div name="map" id="map" style="width:100%; height:300px;">
  238. </div>
  239. </div>
  240. </div>
  241. ');
  242. }
  243. // Picture
  244. $form->addFile(
  245. 'picture',
  246. get_lang('AddImage'),
  247. array('id' => 'picture', 'class' => 'picture-form', 'crop_image' => true, 'crop_ratio' => '1 / 1')
  248. );
  249. $allowed_picture_types = api_get_supported_image_extensions(false);
  250. $form->addRule(
  251. 'picture',
  252. get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')',
  253. 'filetype',
  254. $allowed_picture_types
  255. );
  256. if (strlen($user_data['picture_uri']) > 0) {
  257. $form->addElement('checkbox', 'delete_picture', '', get_lang('DelImage'));
  258. }
  259. // Username
  260. if (api_get_setting('login_is_email') != 'true') {
  261. $form->addElement('text', 'username', get_lang('LoginName'), array('maxlength' => USERNAME_MAX_LENGTH));
  262. $form->addRule('username', get_lang('ThisFieldIsRequired'), 'required');
  263. $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
  264. $form->addRule('username', get_lang('OnlyLettersAndNumbersAllowed'), 'username');
  265. $form->addRule('username', get_lang('UserTaken'), 'username_available', $user_data['username']);
  266. }
  267. if (isset($extAuthSource) && !empty($extAuthSource) && count($extAuthSource) > 0) {
  268. $form->addLabel(
  269. get_lang('ExternalAuthentication'),
  270. $userInfo['auth_source']
  271. );
  272. }
  273. // Password
  274. $form->addElement('radio', 'reset_password', get_lang('Password'), get_lang('DontResetPassword'), 0);
  275. $nb_ext_auth_source_added = 0;
  276. if (isset($extAuthSource) && !empty($extAuthSource) && count($extAuthSource) > 0) {
  277. $auth_sources = array();
  278. foreach ($extAuthSource as $key => $info) {
  279. // @todo : make uniform external authentication configuration (ex : cas and external_login ldap)
  280. // Special case for CAS. CAS is activated from Chamilo > Administration > Configuration > CAS
  281. // extAuthSource always on for CAS even if not activated
  282. // same action for file user_add.php
  283. if (($key == CAS_AUTH_SOURCE && api_get_setting('cas_activate') === 'true') || ($key != CAS_AUTH_SOURCE)) {
  284. $auth_sources[$key] = $key;
  285. $nb_ext_auth_source_added++;
  286. }
  287. }
  288. if ($nb_ext_auth_source_added > 0) {
  289. // @todo check the radio button for external authentification and select the external authentication in the menu
  290. $group[] = $form->createElement('radio', 'reset_password', null, get_lang('ExternalAuthentication').' ', 3);
  291. $group[] = $form->createElement('select', 'auth_source', null, $auth_sources);
  292. $group[] = $form->createElement('static', '', '', '<br />');
  293. $form->addGroup($group, 'password', null, null, false);
  294. }
  295. }
  296. $form->addElement('radio', 'reset_password', null, get_lang('AutoGeneratePassword'), 1);
  297. $group = array();
  298. $group[] =$form->createElement('radio', 'reset_password', null, get_lang('EnterPassword'), 2);
  299. $group[] = $form->createElement(
  300. 'password',
  301. 'password',
  302. null,
  303. array('onkeydown' => 'javascript: password_switch_radio_button();')
  304. );
  305. $form->addGroup($group, 'password', null, null, false);
  306. // Status
  307. $status = array();
  308. $status[COURSEMANAGER] = get_lang('Teacher');
  309. $status[STUDENT] = get_lang('Learner');
  310. $status[DRH] = get_lang('Drh');
  311. $status[SESSIONADMIN] = get_lang('SessionsAdmin');
  312. $status[STUDENT_BOSS] = get_lang('RoleStudentBoss');
  313. $status[INVITEE] = get_lang('Invitee');
  314. $form->addElement(
  315. 'select',
  316. 'status',
  317. get_lang('Profile'),
  318. $status,
  319. array(
  320. 'id' => 'status_select',
  321. 'onchange' => 'javascript: display_drh_list();'
  322. )
  323. );
  324. $display = isset($user_data['status']) && ($user_data['status'] == STUDENT || (isset($_POST['status']) && $_POST['status'] == STUDENT)) ? 'block' : 'none';
  325. // Platform admin
  326. if (api_is_platform_admin()) {
  327. $group = array();
  328. $group[] =$form->createElement('radio', 'platform_admin', null, get_lang('Yes'), 1);
  329. $group[] =$form->createElement('radio', 'platform_admin', null, get_lang('No'), 0);
  330. $user_data['status'] == 1 ? $display = 'block':$display = 'none';
  331. $form->addElement('html', '<div id="id_platform_admin" style="display:'.$display.'">');
  332. $form->addGroup($group, 'admin', get_lang('PlatformAdmin'), null, false);
  333. $form->addElement('html', '</div>');
  334. }
  335. //Language
  336. $form->addElement('select_language', 'language', get_lang('Language'));
  337. // Send email
  338. $group = array();
  339. $group[] = $form->createElement('radio', 'send_mail', null, get_lang('Yes'), 1);
  340. $group[] = $form->createElement('radio', 'send_mail', null, get_lang('No'), 0);
  341. $form->addGroup($group, 'mail', get_lang('SendMailToNewUser'), null, false);
  342. // Registration User and Date
  343. $creatorInfo = api_get_user_info($user_data['creator_id']);
  344. $date = sprintf(get_lang('CreatedByXYOnZ'), 'user_information.php?user_id='.$user_data['creator_id'], $creatorInfo['username'], $user_data['registration_date']);
  345. $form->addElement('label', get_lang('RegistrationDate'), $date);
  346. if (!$user_data['platform_admin']) {
  347. // Expiration Date
  348. $form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0);
  349. $group = array ();
  350. $group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('Enabled'), 1);
  351. $group[] = $form->createElement('DateTimePicker', 'expiration_date', null, array('onchange' => 'javascript: enable_expiration_date();'));
  352. $form->addGroup($group, 'max_member_group', null, null, false);
  353. // Active account or inactive account
  354. $form->addElement('radio', 'active', get_lang('ActiveAccount'), get_lang('Active'), 1);
  355. $form->addElement('radio', 'active', '', get_lang('Inactive'), 0);
  356. }
  357. $studentBossList = UserManager::getStudentBossList($user_data['user_id']);
  358. $conditions = ['status' => STUDENT_BOSS];
  359. $studentBoss = UserManager::get_user_list($conditions);
  360. $studentBossToSelect = [];
  361. if ($studentBoss) {
  362. foreach ($studentBoss as $bossId => $userData) {
  363. $bossInfo = api_get_user_info($userData['user_id']);
  364. $studentBossToSelect[$bossInfo['user_id']] = $bossInfo['complete_name_with_username'];
  365. }
  366. }
  367. if ($studentBossList) {
  368. $studentBossList = array_column($studentBossList, 'boss_id');
  369. }
  370. $user_data['student_boss'] = array_values($studentBossList);
  371. $form->addElement('advmultiselect', 'student_boss', get_lang('StudentBoss'), $studentBossToSelect);
  372. // EXTRA FIELDS
  373. $extraField = new ExtraField('user');
  374. $returnParams = $extraField->addElements($form, $user_data['user_id']);
  375. $jquery_ready_content = $returnParams['jquery_ready_content'];
  376. // the $jquery_ready_content variable collects all functions that will be load in the $(document).ready javascript function
  377. $htmlHeadXtra[] ='<script>
  378. $(document).ready(function(){
  379. '.$jquery_ready_content.'
  380. });
  381. </script>';
  382. // Submit button
  383. $form->addButtonSave(get_lang('Save'));
  384. // Set default values
  385. $user_data['reset_password'] = 0;
  386. $expiration_date = $user_data['expiration_date'];
  387. if (empty($expiration_date)) {
  388. $user_data['radio_expiration_date'] = 0;
  389. $user_data['expiration_date'] = api_get_local_time();
  390. } else {
  391. $user_data['radio_expiration_date'] = 1;
  392. $user_data['expiration_date'] = api_get_local_time($expiration_date);
  393. }
  394. $form->setDefaults($user_data);
  395. $error_drh = false;
  396. // Validate form
  397. if ($form->validate()) {
  398. $user = $form->getSubmitValues(1);
  399. $reset_password = intval($user['reset_password']);
  400. if ($reset_password == 2 && empty($user['password'])) {
  401. Display::addFlash(Display::return_message(get_lang('PasswordIsTooShort')));
  402. header('Location: '.api_get_self().'?user_id='.$user_id);
  403. exit();
  404. }
  405. $is_user_subscribed_in_course = CourseManager::is_user_subscribed_in_course($user['user_id']);
  406. if ($user['status'] == DRH && $is_user_subscribed_in_course) {
  407. $error_drh = true;
  408. } else {
  409. $picture_element = $form->getElement('picture');
  410. $picture = $picture_element->getValue();
  411. $picture_uri = $user_data['picture_uri'];
  412. if (isset($user['delete_picture']) && $user['delete_picture']) {
  413. $picture_uri = UserManager::delete_user_picture($user_id);
  414. } elseif (!empty($picture['name'])) {
  415. $picture_uri = UserManager::update_user_picture(
  416. $user_id,
  417. $_FILES['picture']['name'],
  418. $_FILES['picture']['tmp_name'],
  419. $user['picture_crop_result']
  420. );
  421. }
  422. $lastname = $user['lastname'];
  423. $firstname = $user['firstname'];
  424. $password = $user['password'];
  425. $auth_source = isset($user['auth_source']) ? $user['auth_source'] : $userInfo['auth_source'];
  426. $official_code = $user['official_code'];
  427. $email = $user['email'];
  428. $phone = $user['phone'];
  429. $username = isset($user['username']) ? $user['username'] : $userInfo['username'];
  430. $status = intval($user['status']);
  431. $platform_admin = intval($user['platform_admin']);
  432. $send_mail = intval($user['send_mail']);
  433. $reset_password = intval($user['reset_password']);
  434. $hr_dept_id = isset($user['hr_dept_id']) ? intval($user['hr_dept_id']) : null;
  435. $language = $user['language'];
  436. if ($user['radio_expiration_date'] == '1' && !$user_data['platform_admin']) {
  437. $expiration_date = $user['expiration_date'];
  438. } else {
  439. $expiration_date = null;
  440. }
  441. $active = $user_data['platform_admin'] ? 1 : intval($user['active']);
  442. //If the user is set to admin the status will be overwrite by COURSEMANAGER = 1
  443. if ($platform_admin == 1) {
  444. $status = COURSEMANAGER;
  445. }
  446. if (api_get_setting('login_is_email') == 'true') {
  447. $username = $email;
  448. }
  449. UserManager::update_user(
  450. $user_id,
  451. $firstname,
  452. $lastname,
  453. $username,
  454. $password,
  455. $auth_source,
  456. $email,
  457. $status,
  458. $official_code,
  459. $phone,
  460. $picture_uri,
  461. $expiration_date,
  462. $active,
  463. null,
  464. $hr_dept_id,
  465. null,
  466. $language,
  467. null,
  468. $send_mail,
  469. $reset_password,
  470. $user['address']
  471. );
  472. if (isset($user['student_boss'])) {
  473. UserManager::subscribeUserToBossList($user_id, $user['student_boss']);
  474. }
  475. if (api_get_setting('openid_authentication') == 'true' && !empty($user['openid'])) {
  476. $up = UserManager::update_openid($user_id, $user['openid']);
  477. }
  478. $currentUserId = api_get_user_id();
  479. $userObj = api_get_user_entity($user_id);
  480. UserManager::add_user_as_admin($userObj);
  481. if ($user_id != $currentUserId) {
  482. if ($platform_admin == 1) {
  483. $userObj = api_get_user_entity($user_id);
  484. UserManager::add_user_as_admin($userObj);
  485. } else {
  486. UserManager::remove_user_admin($user_id);
  487. }
  488. }
  489. $extraFieldValue = new ExtraFieldValue('user');
  490. $extraFieldValue->saveFieldValues($user);
  491. $tok = Security::get_token();
  492. Display::addFlash(Display::return_message(get_lang('UserUpdated')));
  493. header('Location: user_list.php?sec_token='.$tok);
  494. exit();
  495. }
  496. }
  497. if ($error_drh) {
  498. Display::addFlash(Display::return_message(get_lang('StatusCanNotBeChangedToHumanResourcesManager'), 'error'));
  499. }
  500. $content = null;
  501. $bigImage = UserManager::getUserPicture($user_id, USER_IMAGE_SIZE_BIG);
  502. $normalImage = UserManager::getUserPicture($user_id, USER_IMAGE_SIZE_ORIGINAL);
  503. $content .= '<div class="row">';
  504. $content .= '<div class="col-md-10">';
  505. // Display form
  506. $content .= $form->returnForm();
  507. $content .= '</div>';
  508. $content .= '<div class="col-md-2">';
  509. $content .= '<a class="thumbnail expand-image" href="'.$bigImage.'" /><img src="'.$normalImage.'"></a>';
  510. $content .= '</div>';
  511. $tpl = new Template($tool_name);
  512. $tpl->assign('content', $content);
  513. $tpl->display_one_col_template();