Created
November 2, 2019 13:29
-
-
Save nadavkav/52452bce41317fa5d924ff66d643447d to your computer and use it in GitHub Desktop.
Log Moodle user page load statistics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('AJAX_SCRIPT', true); | |
require(__DIR__ . '/config.php'); | |
$contextid = required_param('contextid', PARAM_INT); | |
$preftiming = optional_param('preftiming', '', PARAM_RAW); | |
// Security. | |
list($context, $course, $cm) = get_context_info_array($contextid); | |
require_login($course->id, false, $cm); | |
//require_capability('moodle/role:review', $context); | |
require_sesskey(); | |
$preftimings = json_decode($preftiming); | |
//echo json_encode($preftiming['domContentLoadedEventEnd']); | |
//var_dump($preftimings); | |
$eventdata = array(); | |
$eventdata['context'] = $context; | |
$eventdata['other']['preftimings'] = $preftimings; | |
$eventdata['courseid'] = $course->id; | |
$eventdata['userid'] = $USER->id; | |
//$eventdata['action'] = 'preftiming'; | |
$event = \core\event\course_viewed::create($eventdata)->trigger(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment