| Línea 36... | Línea 36... | 
          
            | 36 | if ($mode !== 'today' and $mode !== 'all') {
 | 36 | if ($mode !== 'today' and $mode !== 'all') {
 | 
          
            | 37 |     $mode = 'today';
 | 37 |     $mode = 'today';
 | 
          
            | 38 | }
 | 38 | }
 | 
          
            | Línea 39... | Línea 39... | 
          
            | 39 |  
 | 39 |  
 | 
          
            | 40 | $user = $DB->get_record('user', array('id' => $userid, 'deleted' => 0), '*', MUST_EXIST);
 | 40 | $user = $DB->get_record('user', array('id' => $userid, 'deleted' => 0), '*', MUST_EXIST);
 | 
          
            | - |   | 41 | $course = $DB->get_record('course', ['id' => $courseid], '*');
 | 
          
            | - |   | 42 | $sitecoursefilter = 0;
 | 
          
            | - |   | 43 | if (!$course) {
 | 
          
            | - |   | 44 |     // Missing courses may have be deleted, so display them in site context.
 | 
          
            | - |   | 45 |     $course = $SITE;
 | 
          
            | - |   | 46 |     $sitecoursefilter = $courseid;
 | 
          
            | Línea 41... | Línea 47... | 
          
            | 41 | $course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
 | 47 | }
 | 
          
            | 42 |  
 | 48 |  
 | 
          
            | Línea 43... | Línea 49... | 
          
            | 43 | $coursecontext   = context_course::instance($course->id);
 | 49 | $coursecontext   = context_course::instance($course->id);
 | 
          
            | 44 | $personalcontext = context_user::instance($user->id);
 | 50 | $personalcontext = context_user::instance($user->id);
 | 
          
            | 45 |  
 | 51 |  
 | 
          
            | Línea 46... | Línea 52... | 
          
            | 46 | if ($courseid == SITEID) {
 | 52 | if ($course->id == SITEID) {
 | 
          
            | 47 |     $PAGE->set_context($personalcontext);
 | 53 |     $PAGE->set_context($personalcontext);
 | 
          
            | Línea 73... | Línea 79... | 
          
            | 73 | }
 | 79 | }
 | 
          
            | Línea 74... | Línea 80... | 
          
            | 74 |  
 | 80 |  
 | 
          
            | Línea 75... | Línea 81... | 
          
            | 75 | $stractivityreport = get_string('activityreport');
 | 81 | $stractivityreport = get_string('activityreport');
 | 
          
            | 76 |  
 | 82 |  
 | 
          
            | 77 | $PAGE->set_pagelayout('report');
 | 83 | $PAGE->set_pagelayout('report');
 | 
          
            | 78 | $PAGE->set_url('/report/log/user.php', array('id' => $user->id, 'course' => $course->id, 'mode' => $mode));
 | 84 | $PAGE->set_url('/report/log/user.php', ['id' => $user->id, 'course' => $courseid, 'mode' => $mode]);
 | 
          
            | 79 | $PAGE->navigation->extend_for_user($user);
 | 85 | $PAGE->navigation->extend_for_user($user);
 | 
          
            | Línea 80... | Línea 86... | 
          
            | 80 | $PAGE->navigation->set_userid_for_parent_checks($user->id); // see MDL-25805 for reasons and for full commit reference for reversal when fixed.
 | 86 | $PAGE->navigation->set_userid_for_parent_checks($user->id); // see MDL-25805 for reasons and for full commit reference for reversal when fixed.
 | 
          
            | 81 | $PAGE->set_title("$course->shortname: $stractivityreport");
 | 87 | $PAGE->set_title("$course->shortname: $stractivityreport");
 | 
          
            | 82 |  
 | 88 |  
 | 
          
            | 83 | // Create the appropriate breadcrumb.
 | 89 | // Create the appropriate breadcrumb.
 | 
          
            | 84 | $navigationnode = array(
 | 90 | $navigationnode = array(
 | 
          
            | 85 |         'url' => new moodle_url('/report/log/user.php', array('id' => $user->id, 'course' => $course->id, 'mode' => $mode))
 | 91 |         'url' => new moodle_url('/report/log/user.php', ['id' => $user->id, 'course' => $courseid, 'mode' => $mode]),
 | 
          
            | 86 |     );
 | 92 |     );
 | 
          
            | 87 | if ($mode === 'today') {
 | 93 | if ($mode === 'today') {
 | 
          
            | 88 |     $navigationnode['name'] = get_string('todaylogs');
 | 94 |     $navigationnode['name'] = get_string('todaylogs');
 | 
          
            | 89 | } else {
 | 95 | } else {
 | 
          
            | Línea 90... | Línea 96... | 
          
            | 90 |     $navigationnode['name'] = get_string('alllogs');
 | 96 |     $navigationnode['name'] = get_string('alllogs');
 | 
          
            | 91 | }
 | 97 | }
 | 
          
            | 92 | $PAGE->add_report_nodes($user->id, $navigationnode);
 | 98 | $PAGE->add_report_nodes($user->id, $navigationnode);
 | 
          
            | 93 |  
 | 99 |  
 | 
          
            | 94 | if ($courseid == SITEID) {
 | 100 | if ($course->id == SITEID) {
 | 
          
            | Línea 101... | Línea 107... | 
          
            | 101 | $event = \report_log\event\user_report_viewed::create(array('context' => $coursecontext, 'relateduserid' => $userid,
 | 107 | $event = \report_log\event\user_report_viewed::create(array('context' => $coursecontext, 'relateduserid' => $userid,
 | 
          
            | 102 |         'other' => array('mode' => $mode)));
 | 108 |         'other' => array('mode' => $mode)));
 | 
          
            | 103 | $event->trigger();
 | 109 | $event->trigger();
 | 
          
            | Línea 104... | Línea 110... | 
          
            | 104 |  
 | 110 |  
 | 
          
            | 105 | echo $OUTPUT->header();
 | 111 | echo $OUTPUT->header();
 | 
          
            | 106 | if ($courseid != SITEID) {
 | 112 | if ($course->id != SITEID) {
 | 
          
            | 107 |     $userheading = array(
 | 113 |     $userheading = array(
 | 
          
            | 108 |             'heading' => fullname($user, has_capability('moodle/site:viewfullnames', $PAGE->context)),
 | 114 |             'heading' => fullname($user, has_capability('moodle/site:viewfullnames', $PAGE->context)),
 | 
          
            | 109 |             'user' => $user,
 | 115 |             'user' => $user,
 | 
          
            | 110 |             'usercontext' => $personalcontext,
 | 116 |             'usercontext' => $personalcontext,
 | 
          
            | Línea 124... | Línea 130... | 
          
            | 124 |     $timefrom = 0;
 | 130 |     $timefrom = 0;
 | 
          
            | 125 | }
 | 131 | }
 | 
          
            | Línea 126... | Línea 132... | 
          
            | 126 |  
 | 132 |  
 | 
          
            | 127 | $output = $PAGE->get_renderer('report_log');
 | 133 | $output = $PAGE->get_renderer('report_log');
 | 
          
            | 128 | $reportlog = new report_log_renderable($logreader, $course, $user->id, 0, '', -1, -1, false, false, true, false, $PAGE->url,
 | 134 | $reportlog = new report_log_renderable($logreader, $course, $user->id, 0, '', -1, -1, false, false, true, false, $PAGE->url,
 | 
          
            | Línea 129... | Línea 135... | 
          
            | 129 |         $timefrom, '', $page, $perpage, 'timecreated DESC');
 | 135 |         $timefrom, '', $page, $perpage, 'timecreated DESC', '' , $sitecoursefilter);
 | 
          
            | 130 |  
 | 136 |  
 | 
          
            | 131 | // Setup table if log reader is enabled.
 | 137 | // Setup table if log reader is enabled.
 | 
          
            | 132 | if (!empty($reportlog->selectedlogreader)) {
 | 138 | if (!empty($reportlog->selectedlogreader)) {
 | 
          
            | Línea 136... | Línea 142... | 
          
            | 136 |  
 | 142 |  
 | 
          
            | Línea 137... | Línea 143... | 
          
            | 137 | echo $output->reader_selector($reportlog);
 | 143 | echo $output->reader_selector($reportlog);
 | 
          
            | 138 |  
 | 144 |  
 | 
          
            | 139 | // Print the graphic chart accordingly to the mode (all, today).
 | 145 | // Print the graphic chart accordingly to the mode (all, today).
 | 
          
            | 140 | echo '<div class="graph">';
 | 146 | echo '<div class="graph">';
 | 
          
            | Línea 141... | Línea 147... | 
          
            | 141 | report_log_print_graph($course, $user, $mode, 0, $logreader);
 | 147 | report_log_print_graph($course, $user, $mode, 0, $logreader, $sitecoursefilter);
 | 
          
            | 142 | echo '</div>';
 | 148 | echo '</div>';
 |