user_info.php 2.0 KB

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