forked from EvokeNet/moodle-local_evokegame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.php
45 lines (30 loc) · 1.12 KB
/
profile.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* Prints local_evokegame scoreboard.
*
* @package mod_evokeportfolio
* @copyright 2021 World Bank Group <https://worldbank.org>
* @author Willian Mano <[email protected]>
*/
require(__DIR__.'/../../config.php');
// Course module id.
$id = required_param('id', PARAM_INT);
$userid = optional_param('userid', null, PARAM_INT);
$course = $DB->get_record('course', ['id' => $id], '*', MUST_EXIST);
$urlparams = ['id' => $course->id];
$context = context_course::instance($course->id);
$user = $USER;
if (!empty($userid)) {
$urlparams['userid'] = $userid;
$user = $DB->get_record('user', ['id' => $userid], '*', MUST_EXIST);
}
require_course_login($course, true);
$PAGE->set_url('/local/evokegame/profile.php', $urlparams);
$PAGE->set_title(format_string($course->fullname));
$PAGE->set_heading(format_string($course->fullname));
$PAGE->set_context($context);
echo $OUTPUT->header();
$renderer = $PAGE->get_renderer('local_evokegame');
$contentrenderable = new \local_evokegame\output\profile($context, $course, $user);
echo $renderer->render($contentrenderable);
echo $OUTPUT->footer();