user_info.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php // $Id: $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2008 Dokeos Latinoamerica SAC
  6. Copyright (c) 2006 Dokeos SPRL
  7. Copyright (c) 2006 Ghent University (UGent)
  8. Copyright (c) various contributors
  9. For a full list of contributors, see "credits.txt".
  10. The full license can be read in "license.txt".
  11. This program is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU General Public License
  13. as published by the Free Software Foundation; either version 2
  14. of the License, or (at your option) any later version.
  15. See the GNU General Public License for more details.
  16. Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
  17. Mail: info@dokeos.com
  18. ==============================================================================
  19. */
  20. $language_file = 'gradebook';
  21. //$cidReset = true;
  22. require_once ('../inc/global.inc.php');
  23. require_once (api_get_path(LIBRARY_PATH) . 'fileManage.lib.php');
  24. require_once (api_get_path(LIBRARY_PATH) . 'export.lib.inc.php');
  25. require_once (api_get_path(LIBRARY_PATH) . 'import.lib.php');
  26. require_once (api_get_path(LIBRARY_PATH). 'usermanager.lib.php');
  27. api_block_anonymous_users();
  28. if (isset($_GET['userid'])) {
  29. $user_id = Security::remove_XSS($_GET['userid']);
  30. $user = Usermanager::get_user_info_by_id($user_id);
  31. if (!$user) {
  32. api_not_allowed();
  33. }
  34. } else {
  35. api_not_allowed();
  36. }
  37. require_once ('lib/be.inc.php');
  38. require_once ('lib/gradebook_functions.inc.php');
  39. require_once ('lib/fe/userform.class.php');
  40. block_students();
  41. $form = new UserForm(UserForm :: TYPE_USER_INFO, $user, 'user_info_form', null, api_get_self() . '?userid=' . $user_id . '&selectcat=' . $_GET['selectcat']);
  42. if ($form->validate()) {
  43. header('Location: user_stats.php?selectcat=' . Security::remove_XSS($_GET['selectcat']).'&userid=' .$user_id);
  44. exit;
  45. }
  46. $interbreadcrumb[] = array (
  47. 'url' => $_SESSION['gradebook_dest'],
  48. 'name' => get_lang('Gradebook'
  49. ));
  50. Display :: display_header(get_lang('UserInfo'));
  51. //User picture size is calculated from SYSTEM path
  52. $image_syspath = UserManager::get_user_picture_path_by_id($user_id,'system',false,true);
  53. $image_size = getimagesize($image_syspath['dir'].$image_syspath['file']);
  54. //Web path
  55. $image_path = UserManager::get_user_picture_path_by_id($user_id,'web',false,true);
  56. $image_file = $image_path['dir'].$image_path['file'];
  57. $img_attributes = 'src="'.$image_file.'?rand='.time().'" '
  58. .'alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" '
  59. .'style="float:left; padding:5px;" ';
  60. if ($image_size[0] > 300) {
  61. //limit display width to 300px
  62. $img_attributes .= 'width="300" ';
  63. }
  64. //@todo need a "makeup"
  65. echo '<img '.$img_attributes.'/>';
  66. $form->display();
  67. Display :: display_footer();