예제 #1
0
}
$stradministration = get_string('administration');
$strreports = get_string('reports');
// Before we close session, make sure we have editing information in session.
$adminediting = optional_param('adminedit', -1, PARAM_BOOL);
if ($PAGE->user_allowed_editing() && $adminediting != -1) {
    $USER->editing = $adminediting;
}
if (empty($course) || $course->id == $SITE->id) {
    admin_externalpage_setup('reportlog', '', null, '', array('pagelayout' => 'report'));
    $PAGE->set_title($SITE->shortname . ': ' . $strlogs);
} else {
    $PAGE->set_title($course->shortname . ': ' . $strlogs);
    $PAGE->set_heading($course->fullname);
}
$reportlog = new report_log_renderable($logreader, $course, $user, $modid, $modaction, $group, $edulevel, $showcourses, $showusers, $chooselog, true, $url, $date, $logformat, $page, $perpage, 'timecreated DESC');
$readers = $reportlog->get_readers();
$output = $PAGE->get_renderer('report_log');
if (empty($readers)) {
    echo $output->header();
    echo $output->heading(get_string('nologreaderenabled', 'report_log'));
} else {
    if (!empty($chooselog)) {
        // Delay creation of table, till called by user with filter.
        $reportlog->setup_table();
        if (empty($logformat)) {
            echo $output->header();
            $userinfo = get_string('allparticipants');
            $dateinfo = get_string('alldays');
            if ($user) {
                $u = $DB->get_record('user', array('id' => $user, 'deleted' => 0), '*', MUST_EXIST);
예제 #2
0
파일: user.php 프로젝트: evltuma/moodle
// Trigger a user logs viewed event.
$event = \report_log\event\user_report_viewed::create(array('context' => $coursecontext, 'relateduserid' => $userid, 'other' => array('mode' => $mode)));
$event->trigger();
echo $OUTPUT->header();
if ($courseid != SITEID) {
    $userheading = array('user' => $user, 'usercontext' => $personalcontext);
    echo $OUTPUT->context_header($userheading, 2);
}
// Time to filter records from.
if ($mode === 'today') {
    $timefrom = usergetmidnight(time());
} else {
    $timefrom = 0;
}
$output = $PAGE->get_renderer('report_log');
$reportlog = new report_log_renderable($logreader, $course, $user->id, 0, '', -1, -1, false, false, true, false, $PAGE->url, $timefrom, '', $page, $perpage, 'timecreated DESC');
// Setup table if log reader is enabled.
if (!empty($reportlog->selectedlogreader)) {
    $reportlog->setup_table();
    $reportlog->tablelog->is_downloadable(false);
}
echo $output->reader_selector($reportlog);
if ($mode === 'all') {
    $reportlog->selecteddate = 0;
}
// Print the graphic chart accordingly to the mode (all, today).
echo '<div class="graph">';
report_log_print_graph($course, $user, $mode, 0, $logreader);
echo '</div>';
echo $output->render($reportlog);
echo $OUTPUT->footer();
예제 #3
0
 /**
  * This function is used to generate and display selector form
  *
  * @param report_log_renderable $reportlog log report.
  */
 public function report_selector_form(report_log_renderable $reportlog)
 {
     echo html_writer::start_tag('form', array('class' => 'logselecform', 'action' => $reportlog->url, 'method' => 'get'));
     echo html_writer::start_div();
     echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'chooselog', 'value' => '1'));
     echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'showusers', 'value' => $reportlog->showusers));
     echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'showcourses', 'value' => $reportlog->showcourses));
     $selectedcourseid = empty($reportlog->course) ? 0 : $reportlog->course->id;
     // Add course selector.
     $courses = $reportlog->get_course_list();
     if (!empty($courses)) {
         if ($reportlog->showcourses) {
             echo html_writer::label(get_string('selectacourse'), 'menuid', false, array('class' => 'accesshide'));
             echo html_writer::select($courses, "id", $selectedcourseid, null);
         } else {
             $courseoption[$selectedcourseid] = $courses[$selectedcourseid];
             unset($courses);
             echo html_writer::label(get_string('selectacourse'), 'menuid', false, array('class' => 'accesshide'));
             echo html_writer::select($courseoption, "id", $selectedcourseid, null);
             // Check if user is admin and this came because of limitation on number of courses to show in dropdown.
             $sitecontext = context_system::instance();
             if (has_capability('report/log:view', $sitecontext)) {
                 $a = new stdClass();
                 $a->url = new moodle_url('/report/log/index.php', array('chooselog' => 0, 'group' => $reportlog->get_selected_group(), 'user' => $reportlog->userid, 'id' => $selectedcourseid, 'date' => $reportlog->date, 'modid' => $reportlog->modid, 'showcourses' => 1, 'showusers' => $reportlog->showusers));
                 print_string('logtoomanycourses', 'moodle', $a);
             }
         }
     }
     // Add group selector.
     $groups = $reportlog->get_group_list();
     if (!empty($groups)) {
         echo html_writer::label(get_string('selectagroup'), 'menugroup', false, array('class' => 'accesshide'));
         echo html_writer::select($groups, "group", $reportlog->groupid, get_string("allgroups"));
     }
     // Add user selector.
     $users = $reportlog->get_user_list();
     if (!empty($users)) {
         if ($reportlog->showusers) {
             echo html_writer::label(get_string('selctauser'), 'menuuser', false, array('class' => 'accesshide'));
             echo html_writer::select($users, "user", $reportlog->userid, get_string("allparticipants"));
         } else {
             $users = array();
             if (!empty($reportlog->userid)) {
                 $users[$reportlog->userid] = $reportlog->get_selected_user_fullname();
             } else {
                 $users[0] = get_string('allparticipants');
             }
             echo html_writer::label(get_string('selctauser'), 'menuuser', false, array('class' => 'accesshide'));
             echo html_writer::select($users, "user", $reportlog->userid, false);
             $a = new stdClass();
             $a->url = new moodle_url('/report/log/index.php', array('chooselog' => 0, 'group' => $reportlog->get_selected_group(), 'user' => $reportlog->userid, 'id' => $selectedcourseid, 'date' => $reportlog->date, 'modid' => $reportlog->modid, 'showcourses' => 1, 'showusers' => $reportlog->showusers, 'showcourses' => $reportlog->showcourses));
             print_string('logtoomanyusers', 'moodle', $a);
         }
     }
     // Add date selector.
     $dates = $reportlog->get_date_options();
     echo html_writer::label(get_string('date'), 'menudate', false, array('class' => 'accesshide'));
     echo html_writer::select($dates, "date", $reportlog->date, get_string("alldays"));
     // Add activity selector.
     $activities = $reportlog->get_activities_list();
     echo html_writer::label(get_string('activities'), 'menumodid', false, array('class' => 'accesshide'));
     echo html_writer::select($activities, "modid", $reportlog->modid, get_string("allactivities"));
     // Add actions selector.
     echo html_writer::label(get_string('actions'), 'menumodaction', false, array('class' => 'accesshide'));
     echo html_writer::select($reportlog->get_actions(), 'modaction', $reportlog->action, get_string("allactions"));
     // Add edulevel.
     $edulevel = $reportlog->get_edulevel_options();
     echo html_writer::label(get_string('edulevel'), 'menuedulevel', false, array('class' => 'accesshide'));
     echo html_writer::select($edulevel, 'edulevel', $reportlog->edulevel, false);
     // Add reader option.
     // If there is some reader available then only show submit button.
     $readers = $reportlog->get_readers(true);
     if (!empty($readers)) {
         if (count($readers) == 1) {
             $attributes = array('type' => 'hidden', 'name' => 'logreader', 'value' => key($readers));
             echo html_writer::empty_tag('input', $attributes);
         } else {
             echo html_writer::label(get_string('selectlogreader', 'report_log'), 'menureader', false, array('class' => 'accesshide'));
             echo html_writer::select($readers, 'logreader', $reportlog->selectedlogreader, false);
         }
         echo html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('gettheselogs')));
     }
     echo html_writer::end_div();
     echo html_writer::end_tag('form');
 }