Topics
class Topics
Properties
$topics | All the topics | ||
$course | The course object | ||
$topic | The individual topic | ||
$anchor | |||
$topicposition | |||
$warpwire_baseurl | |||
$resource_links | Index by resource_link |
Methods
No description
Make non-array into an array and adjust paths
emit the header material
No description
No description
Get a topic associated with an anchor
No description
Indicate we are in a single topic
No description
No description
No description
Get a topic associated with a resource link ID
Get an LTI associated with a resource link ID
No description
Check if a setting value is in a resource in a Topic
Details
at line 48
__construct($name = 'topics.json', $anchor = null, $index = null)
at line 149
static
adjustArray($entry)
Make non-array into an array and adjust paths
at line 164
static
header($buffer = false)
emit the header material
at line 330
static
getUrlResources($topic)
at line 347
static
makeUrlResource($type, $title, $url)
at line 373
getTopicByAnchor($anchor)
Get a topic associated with an anchor
at line 381
render($buffer = false)
at line 396
isSingle()
Indicate we are in a single topic
at line 404
renderSingle($buffer = false)
at line 527
static
nostyleUrl($title, $url)
at line 536
renderAll($buffer = false)
at line 578
getTopicByRlid($resource_link_id)
Get a topic associated with a resource link ID
at line 592
getLtiByRlid($resource_link_id)
Get an LTI associated with a resource link ID
at line 603
footer($buffer = false)
at line 651
getCustomWithInherit($key, $rlid = false)
Check if a setting value is in a resource in a Topic
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 Topic 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->topics) ) {
$l = new Topics($CFG->topics);
$assn = $l->getCustomWithInherit($rlid, 'exercise');
} else {
$assn = LTIX::ltiCustomGet('exercise');
}
Settings::linkSet('exercise', $assn);
}