Lessons
class Lessons
Properties
$lessons | All the lessons | ||
$module | The individual module | ||
$anchor | |||
$position | |||
$resource_links | Index by resource_link |
Methods
get a setting for the lesson
emit the header material
No description
Make non-array into an array and adjust paths
Indicate we are in a single lesson
Get a module associated with an anchor
Get an LTI or Discussion associated with a resource link ID
Get a module associated with a resource link ID
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Check if a setting value is in a resource in a Lesson
Details
at line 40
getSetting($key, $default = false)
get a setting for the lesson
at line 50
header($buffer = false)
emit the header material
at line 107
__construct($name = 'lessons.json', $anchor = null, $index = null)
at line 247
static
adjustArray($entry)
Make non-array into an array and adjust paths
at line 262
isSingle()
Indicate we are in a single lesson
at line 269
getModuleByAnchor($anchor)
Get a module associated with an anchor
at line 280
getLtiByRlid($resource_link_id)
Get an LTI or Discussion associated with a resource link ID
at line 306
getModuleByRlid($resource_link_id)
Get a module associated with a resource link ID
at line 326
render($buffer = false)
at line 334
static
absolute_url_ref($url)
at line 343
static
expandLink($url)
at line 360
static
nostyleUrl($title, $url)
at line 373
static
nostyleLink($title, $url)
at line 387
renderSingle($buffer = false)
at line 747
renderAll($buffer = false)
at line 785
renderAssignments($allgrades, $alldates, $buffer = false)
at line 845
static
makeUrlResource($type, $title, $url)
at line 882
static
getUrlResources($module)
at line 914
renderBadges($allgrades, $buffer = false)
at line 1047
renderDiscussions($buffer = false)
at line 1133
footer($buffer = false)
at line 1243
getCustomWithInherit($key, $rlid = false)
Check if a setting value is in a resource in a Lesson
This solves the problems that (a) most LMS systems do not handle custom well for Common Cartridge Imports and (b) some systems do not handle custom at all when links are installed via ContentItem. Canvas has this problem for sure and others might as well.
The solution is to add the resource link from the Lesson as a GET parameter on the launchurl URL to be a fallback:
https://../mod/zap/?inherit=assn03
Say the tool has custom key of "exercise" that it wants a default for when the tool has not yet been configured. First we check if the LMS sent us a custom parameter and use it if present.
If not, load up the LTI launch for the resource link id (assn03) in the above example and see if there is a custom parameter set in that launch and assume it was passed to us.
Sample call:
$assn = Settings::linkGet('exercise');
if ( ! $assn || ! isset($assignments[$assn]) ) {
$rlid = isset($_GET['inherit']) ? $_GET['inherit'] : false;
if ( $rlid && isset($CFG->lessons) ) {
$l = new Lessons($CFG->lessons);
$assn = $l->getCustomWithInherit($rlid, 'exercise');
} else {
$assn = LTIX::ltiCustomGet('exercise');
}
Settings::linkSet('exercise', $assn);
}