index.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. // This script is part of the Sloodle project
  3. /*
  4. * This script is intended to be shown on the surface of the scoreboard.
  5. *
  6. */
  7. /**
  8. * @package sloodle
  9. * @copyright Copyright (c) 2011 various contributors (see below)
  10. * @license http://www.gnu.org/licenses/gpl-3.0.html GNU GPL v3
  11. *
  12. * @contributor Edmund Edgar
  13. * @contributor Paul Preibisch
  14. *
  15. */
  16. /** Grab the Sloodle/Moodle configuration. */
  17. require_once('../../../init.php');
  18. /** Include the Sloodle PHP API. */
  19. /** Sloodle core library functionality */
  20. require_once(SLOODLE_DIRROOT.'/lib.php');
  21. require_once(SLOODLE_DIRROOT.'/lib/db.php');
  22. /** General Sloodle functions. */
  23. require_once(SLOODLE_LIBROOT.'/general.php');
  24. /** Sloodle course data. */
  25. require_once(SLOODLE_LIBROOT.'/course.php');
  26. require_once(SLOODLE_LIBROOT.'/io.php');
  27. require_once(SLOODLE_LIBROOT.'/object_configs.php');
  28. require_once(SLOODLE_LIBROOT.'/active_object.php');
  29. require_once(SLOODLE_LIBROOT.'/currency.php');
  30. require_once('scoreboard_active_object.inc.php');
  31. $object_uuid = required_param('sloodleobjuuid', PARAM_RAW);
  32. $sao = SloodleScoreboardActiveObject::ForUUID( $object_uuid );
  33. //$is_admin = $is_logged_in && has_capability('moodle/course:manageactivities', $sao->context);
  34. $is_admin = ( isset($_REQUEST['mode']) && ($_REQUEST['mode'] == 'admin') );
  35. if ($is_admin) {
  36. require_login($sao->course->id);
  37. $is_logged_in = true;
  38. }
  39. if ($is_admin) {
  40. require_capability('moodle/course:manageactivities', $sao->context);
  41. }
  42. if (!$currencyid = $sao->currencyid) {
  43. print_error(('Currency ID missing'));
  44. }
  45. $currency = SloodleCurrency::ForID( $currencyid );
  46. $student_scores = $sao->get_student_scores($include_scoreless_users = $is_admin);
  47. $full = false;
  48. /*
  49. header('Cache-control: public');
  50. header('Cache-Control: max-age=86400');
  51. header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 60 * 60 * 24) . ' GMT');
  52. header('Pragma: public');
  53. */
  54. if ($is_admin) {
  55. include('index.template.admin.php');
  56. }
  57. else{
  58. include('index.template.php');
  59. }
  60. print_html_top('', $is_logged_in);
  61. //print_toolbar( $baseurl, $is_logged_in ) ;
  62. // print_site_placeholder( $sitesURL );
  63. // print_round_list( $roundrecs );
  64. //krumo($student_scores);
  65. //krumo($score);
  66. print_score_list( 'scoreboard:allstudents', $student_scores, $object_uuid, $currency, $sao->roundid, $is_admin?5:$sao->refreshtime, $sao->objecttitle, $is_logged_in, $is_admin);
  67. print_html_bottom();
  68. ?>