diff --git a/format.php b/format.php index 57f3b04..bb8b2d4 100644 --- a/format.php +++ b/format.php @@ -68,11 +68,19 @@ // Include course format js module. $PAGE->requires->js('/course/format/designer/format.js'); + if ($ispopupactivities && !$PAGE->user_is_editing()) { - // Include popups. - $PAGE->requires->js_call_amd('format_popups/popups', 'init', array( - $context->id, $course->id, $displaysection - )); + if (get_config('format_designer', 'enabledeftresponse')) { + $socket = new \format_popups\socket($context); + $token = $socket->get_token(); + $PAGE->requires->js_call_amd('format_popups/deft', 'init', array( + $context->id, $course->id, $displaysection, $token, get_config('block_deft', 'throttle') + )); + } else { + $PAGE->requires->js_call_amd('format_popups/popups', 'init', array( + $context->id, $course->id, $displaysection + )); + } } format_designer_editsetting_style($PAGE); diff --git a/lang/en/format_designer.php b/lang/en/format_designer.php index 89adf24..2caec45 100644 --- a/lang/en/format_designer.php +++ b/lang/en/format_designer.php @@ -289,8 +289,11 @@ $string['makeherovisible'] = "Make hero activity and keep section 0 visible"; $string['strprerequisites'] = "Prerequisites"; $string['courseprerequisites'] = "Course prerequisites"; +$string['deftsettings'] = 'Deft response settings'; $string['displaycourseprerequisites'] = "Display course prerequisites"; $string['displaycourseprerequisites_help'] = "Define where to display the prerequisites courses"; +$string['enabledeftresponse'] = 'Enable Deft response'; +$string['enabledeftresponse_help'] = 'The Deft response block allows updating content users are viewing remotely when changes happen on a Moodle server. If that plugin is installed and activated and this is enabled, this format will update the course page when activities are modified. Find more information at {$a}.'; $string['abovecoursecontents'] = "Above course contents"; $string['onseparatetab'] = "On separate tab"; $string['prerequisitesautostudents'] = "Automatically enrol students"; diff --git a/settings.php b/settings.php index 99c40b6..1a901fa 100644 --- a/settings.php +++ b/settings.php @@ -61,6 +61,18 @@ ) ); + $settings->add(new admin_setting_heading( + 'format_designer/deftsettings', + new lang_string('deftsettings', 'format_designer'), + '' + )); + $link = 'deftly.us'; + $settings->add(new admin_setting_configcheckbox( 'format_designer/enabledeftresponse', + new lang_string('enabledeftresponse', 'format_designer'), + new lang_string('enabledeftresponse_help', 'format_designer', $link), + 0 + )); + // Hero activity. $name = 'format_designer_hero'; $heading = get_string('heroactivity', 'format_designer');