Skip to content

Commit

Permalink
Merge pull request #19 from bdecentgmbh/deft-support
Browse files Browse the repository at this point in the history
Implement deft support
  • Loading branch information
stefanscholz authored Oct 6, 2023
2 parents c780931 + 2bc4982 commit 57c1949
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
16 changes: 12 additions & 4 deletions format.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
3 changes: 3 additions & 0 deletions lang/en/format_designer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
12 changes: 12 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@
)
);

$settings->add(new admin_setting_heading(
'format_designer/deftsettings',
new lang_string('deftsettings', 'format_designer'),
''
));
$link = '<a href="https://deftly.us" target="_blank">deftly.us</a>';
$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');
Expand Down

0 comments on commit 57c1949

Please sign in to comment.