user_stats.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. // $Id: gradebook_view_result.php 479 2007-04-12 11:50:58Z stijn $
  3. /*
  4. ==============================================================================
  5. Dokeos - elearning and course management software
  6. Copyright (c) 2006 Dokeos S.A.
  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, 44 rue des palais, B-1030 Brussels, Belgium
  17. Mail: info@dokeos.com
  18. ==============================================================================
  19. */
  20. $language_file= 'gradebook';
  21. $cidReset= true;
  22. include_once ('../inc/global.inc.php');
  23. include_once ('lib/be.inc.php');
  24. include_once ('lib/gradebook_functions.inc.php');
  25. include_once ('lib/fe/userform.class.php');
  26. include_once ('lib/user_data_generator.class.php');
  27. include_once ('lib/fe/usertable.class.php');
  28. include_once ('lib/fe/displaygradebook.php');
  29. include_once ('lib/scoredisplay.class.php');
  30. include_once (api_get_path(LIBRARY_PATH).'ezpdf/class.ezpdf.php');
  31. api_block_anonymous_users();
  32. block_students();
  33. $interbreadcrumb[]= array (
  34. 'url' => 'gradebook.php',
  35. 'name' => get_lang('Gradebook'
  36. ));
  37. $category= Category :: load(0);
  38. $allevals= $category[0]->get_evaluations($_GET['userid'], true);
  39. $alllinks= $category[0]->get_links($_GET['userid'], true);
  40. if ($_GET['selectcat'] != null)
  41. $addparams= array (
  42. 'userid' => $_GET['userid'],
  43. 'selectcat' => $_GET['selectcat']
  44. );
  45. else
  46. $addparams= array (
  47. 'userid' => $_GET['userid'],
  48. 'selecteval' => $_GET['selecteval']
  49. );
  50. $user_table= new UserTable($_GET['userid'], $allevals, $alllinks, $addparams);
  51. if (isset ($_GET['exportpdf']))
  52. {
  53. $pdf= new Cezpdf();
  54. $pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Helvetica.afm');
  55. $pdf->ezSetMargins(30, 30, 50, 30);
  56. $pdf->ezSetY(800);
  57. $datagen= new UserDataGenerator($_GET['userid'], $allevals,$alllinks);
  58. $data_array= $datagen->get_data(UserDataGenerator :: UDG_SORT_NAME, 0, null, true);
  59. $newarray= array ();
  60. $displayscore= Scoredisplay :: instance();
  61. $newitem= array ();
  62. foreach ($data_array as $data)
  63. {
  64. $newarray[] = array_slice($data, 1);
  65. }
  66. $pdf->ezSetY(810);
  67. $userinfo = get_user_info_from_id($_GET['userid']);
  68. $pdf->ezText(get_lang('Results').' : '.$userinfo['lastname']. ' '. $userinfo['firstname'].' ('. date('j/n/Y g:i') .')',12,array('justification'=>'center'));
  69. $pdf->line(50,790,550,790);
  70. $pdf->line(50,40,550,40);
  71. $pdf->ezSetY(750);
  72. if ($displayscore->is_custom())
  73. $header_names= array (
  74. get_lang('Evaluation'
  75. ), get_lang('Course'), get_lang('Category'), get_lang('EvaluationAverage'),get_lang('Result'),get_lang('Display'));
  76. else
  77. $header_names= array (
  78. get_lang('Evaluation'
  79. ), get_lang('Course'), get_lang('Category'), get_lang('EvaluationAverage'),get_lang('Result'));
  80. $pdf->ezTable($newarray, $header_names, '', array (
  81. 'showHeadings' => 1,
  82. 'shaded' => 1,
  83. 'showLines' => 1,
  84. 'rowGap' => 3,
  85. 'width' => 500
  86. ));
  87. $pdf->ezStream();
  88. exit;
  89. }
  90. if (isset ($_GET['selectcat']))
  91. {
  92. $interbreadcrumb[]= array (
  93. 'url' => 'gradebook_flatview.php?selecteval=' . $_GET['selectcat'],
  94. 'name' => get_lang('FlatView'
  95. ));
  96. $backto= '<a href=gradebook_flatview.php?selectcat=' . $_GET['selectcat'] . '><img src=../img/lp_leftarrow.gif alt=' . get_lang('BackToOverview') . ' align=absmiddle/> ' . get_lang('BackToOverview') . '</a>&nbsp&nbsp';
  97. }
  98. if (isset ($_GET['selecteval']))
  99. {
  100. $interbreadcrumb[]= array (
  101. 'url' => 'gradebook_view_result.php?selecteval=' . $_GET['selecteval'],
  102. 'name' => get_lang('ViewResult'
  103. ));
  104. $backto= '<a href=gradebook_view_result.php?selecteval=' . $_GET['selecteval'] . '><img src=../img/lp_leftarrow.gif alt=' . get_lang('BackToEvaluation') . ' align=absmiddle/> ' . get_lang('BackToEvaluation') . '</a>&nbsp&nbsp';
  105. }
  106. $backto .= '<a href="' . api_get_self() . '?exportpdf=&userid='.$_GET['userid'].'&selectcat=' . $category[0]->get_id() . '" target="_blank"><img src=../img/calendar_up.gif alt=' . get_lang('ExportPDF') . '/> ' . get_lang('ExportPDF') . '</a>';
  107. Display :: display_header(get_lang('ResultsPerUser'));
  108. DisplayGradebook :: display_header_user($_GET['userid']);
  109. echo $backto;
  110. $user_table->display();
  111. Display :: display_footer();
  112. ?>