diff --git a/lib.php b/lib.php index 9884454..8237aff 100644 --- a/lib.php +++ b/lib.php @@ -64,25 +64,8 @@ function mod_exp360_cm_info_dynamic(cm_info $cm) */ function mod_exp360_event_observer($event) { - global $PAGE, $DB; - - // Get the course ID from the event. - $courseid = $event->courseid; - - // Check if the course contains any instances of the exp360 activity. - $sql = "SELECT COUNT(*) - FROM {course_modules} cm - JOIN {modules} m ON cm.module = m.id - JOIN {exp360} e ON cm.instance = e.id - WHERE cm.course = :courseid - AND m.name = 'exp360'"; - $params = ['courseid' => $courseid]; - $count = $DB->count_records_sql($sql, $params); - - // If the course contains at least one instance of exp360, inject the JavaScript. - if ($count > 0) { - $PAGE->requires->js('/mod/exp360/global.js'); - } + global $PAGE; + $PAGE->requires->js('/mod/exp360/global.js'); } /**