Skip to content

Commit 6d42a5e

Browse files
caswelltomclaude
andcommitted
v1.9.2: Add English Lock setting for ELL courses
Per course toggle that forces SOLA to always respond in English, regardless of the student's language preference. Ideal for English language learning courses where students should practice reading and writing in English. - course_settings.php: new English Lock card with toggle - sse.php: overrides lang param to 'en' when lock is active Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1e5024d commit 6d42a5e

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

course_settings.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@
8888
$ragcourse = optional_param('rag_course_enabled', 0, PARAM_INT);
8989
set_config('rag_enabled_course_' . $courseid, $ragcourse, 'local_ai_course_assistant');
9090

91+
// English lock — force English responses for ELL courses.
92+
$englishlock = optional_param('english_lock', 0, PARAM_INT);
93+
set_config('english_lock_course_' . $courseid, $englishlock, 'local_ai_course_assistant');
94+
9195
// Starter overrides — per-course enable/disable for each starter.
9296
$starteroverrides = [];
9397
$allstarters = \local_ai_course_assistant\starter_manager::get_global_starters();
@@ -109,6 +113,9 @@
109113
$ragcourseraw = get_config('local_ai_course_assistant', 'rag_enabled_course_' . $courseid);
110114
$ragcourseenabled = ($ragcourseraw === false) || (bool)$ragcourseraw;
111115

116+
// English lock setting.
117+
$englishlockenabled = (bool)get_config('local_ai_course_assistant', 'english_lock_course_' . $courseid);
118+
112119
// Build provider options.
113120
$providers = [
114121
'' => get_string('coursesettings:using_global', 'local_ai_course_assistant') .
@@ -305,6 +312,33 @@ class="btn btn-sm btn-outline-secondary" target="_blank">
305312
</div>
306313
<?php } ?>
307314

315+
<div class="card mb-3">
316+
<div class="card-header">
317+
<h5 class="mb-0">English Lock (ELL Courses)</h5>
318+
</div>
319+
<div class="card-body">
320+
<p class="text-muted">Force SOLA to always respond in English for this course, regardless of the student's language preference. Ideal for English language learning courses where students should practice reading and writing in English.</p>
321+
<div class="form-group row">
322+
<label class="col-sm-3 col-form-label" for="english_lock">
323+
English Lock
324+
</label>
325+
<div class="col-sm-9">
326+
<div class="custom-control custom-switch">
327+
<input type="checkbox" class="custom-control-input" id="english_lock"
328+
name="english_lock" value="1"
329+
<?php if ($englishlockenabled) { echo 'checked'; } ?>>
330+
<label class="custom-control-label" for="english_lock">
331+
Always respond in English
332+
</label>
333+
</div>
334+
<small class="form-text text-muted">
335+
When enabled, SOLA will respond in English even if the student writes in another language. The student's language preference in their settings panel will be overridden.
336+
</small>
337+
</div>
338+
</div>
339+
</div>
340+
</div>
341+
308342
<?php
309343
// Starter overrides section.
310344
$allstarters = \local_ai_course_assistant\starter_manager::get_global_starters();

sse.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@
5858
$firstgen = optional_param('firstgen', 0, PARAM_BOOL); // First-generation student mode.
5959
$completion = optional_param('completion', 0, PARAM_INT); // Course completion percentage (0-100).
6060

61+
// English lock: force English for ELL courses regardless of student language preference.
62+
$englishlock = get_config('local_ai_course_assistant', 'english_lock_course_' . $courseid);
63+
if ($englishlock) {
64+
$lang = 'en';
65+
}
66+
6167
// Validate context and capability.
6268
$context = context_course::instance($courseid);
6369
require_capability('local/ai_course_assistant:use', $context);

version.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
defined('MOODLE_INTERNAL') || die();
2626

2727
$plugin->component = 'local_ai_course_assistant';
28-
$plugin->version = 2026030931;
28+
$plugin->version = 2026030932;
2929
$plugin->requires = 2024100700; // Moodle 4.5+.
3030
$plugin->maturity = MATURITY_STABLE;
31-
$plugin->release = '1.9.1';
31+
$plugin->release = '1.9.2';

0 commit comments

Comments
 (0)