diff --git a/classes/output/renderer.php b/classes/output/renderer.php new file mode 100644 index 0000000..77f43aa --- /dev/null +++ b/classes/output/renderer.php @@ -0,0 +1,45 @@ +"; + return $script; + } + + public function render_modals() { + if (self::$modals_rendered) { + return ''; + } + + self::$modals_rendered = true; + + $modalHTML = ' + + + '; + return $modalHTML; + } +} \ No newline at end of file diff --git a/lib.php b/lib.php index da71247..5ac58af 100644 --- a/lib.php +++ b/lib.php @@ -45,16 +45,18 @@ function exp360_delete_instance($id) function mod_exp360_cm_info_dynamic(cm_info $cm) { - global $PAGE, $DB; + global $PAGE; if ($cm->modname !== 'exp360') { return; } - $script = ""; + $renderer = $PAGE->get_renderer('mod_exp360'); + $modals = $renderer->render_modals(); + $script = $renderer->render_activity($cm->id); $cm->set_no_view_link(); - $cm->set_content($script); + $cm->set_content($script . $modals); } /**