user_info.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php // $Id: $
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Script
  5. * @package chamilo.gradebook
  6. */
  7. /**
  8. * Init
  9. */
  10. $language_file = 'gradebook';
  11. require_once '../inc/global.inc.php';
  12. api_block_anonymous_users();
  13. if (isset($_GET['userid'])) {
  14. $user_id = Security::remove_XSS($_GET['userid']);
  15. $user = UserManager::get_user_info_by_id($user_id);
  16. if (!$user) {
  17. api_not_allowed();
  18. }
  19. } else {
  20. api_not_allowed();
  21. }
  22. require_once 'lib/be.inc.php';
  23. require_once 'lib/gradebook_functions.inc.php';
  24. require_once 'lib/fe/userform.class.php';
  25. block_students();
  26. $form = new UserForm(UserForm :: TYPE_USER_INFO, $user, 'user_info_form', null, api_get_self(
  27. ).'?userid='.$user_id.'&selectcat='.Security::remove_XSS($_GET['selectcat']));
  28. if ($form->validate()) {
  29. header('Location: user_stats.php?selectcat='.Security::remove_XSS($_GET['selectcat']).'&userid='.$user_id);
  30. exit;
  31. }
  32. $interbreadcrumb[] = array(
  33. 'url' => $_SESSION['gradebook_dest'],
  34. 'name' => get_lang(
  35. 'Gradebook'
  36. )
  37. );
  38. Display :: display_header(get_lang('UserInfo'));
  39. //User picture size is calculated from SYSTEM path
  40. $image_syspath = UserManager::get_user_picture_path_by_id($user_id, 'system', false, true);
  41. $image_size = getimagesize($image_syspath['dir'].$image_syspath['file']);
  42. //Web path
  43. $image_path = UserManager::get_user_picture_path_by_id($user_id, 'web', false, true);
  44. $image_file = $image_path['dir'].$image_path['file'];
  45. $img_attributes = 'src="'.$image_file.'?rand='.time().'" '
  46. .'alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" '
  47. .'style="float:left; padding:5px;" ';
  48. if ($image_size[0] > 300) {
  49. //limit display width to 300px
  50. $img_attributes .= 'width="300" ';
  51. }
  52. //@todo need a "makeup"
  53. echo '<img '.$img_attributes.'/>';
  54. $form->display();
  55. Display :: display_footer();