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

__construct($name = 'topics.json', $anchor = null, $index = null)

No description

static 
adjustArray($entry)

Make non-array into an array and adjust paths

static 
header($buffer = false)

emit the header material

static 
getUrlResources($topic)

No description

static 
makeUrlResource($type, $title, $url)

No description

getTopicByAnchor($anchor)

Get a topic associated with an anchor

render($buffer = false)

No description

isSingle()

Indicate we are in a single topic

renderSingle($buffer = false)

No description

static 
nostyleUrl($title, $url)

No description

renderAll($buffer = false)

No description

getTopicByRlid($resource_link_id)

Get a topic associated with a resource link ID

getLtiByRlid($resource_link_id)

Get an LTI associated with a resource link ID

footer($buffer = false)

No description

getCustomWithInherit($key, $rlid = false)

Check if a setting value is in a resource in a Topic

Details

at line 48
__construct($name = 'topics.json', $anchor = null, $index = null)

Parameters

$name
$anchor
$index

at line 149
static adjustArray($entry)

Make non-array into an array and adjust paths

Parameters

$entry

at line 164
static header($buffer = false)

emit the header material

Parameters

$buffer

at line 330
static getUrlResources($topic)

Parameters

$topic

at line 347
static makeUrlResource($type, $title, $url)

Parameters

$type
$title
$url

at line 373
getTopicByAnchor($anchor)

Get a topic associated with an anchor

Parameters

$anchor

at line 381
render($buffer = false)

Parameters

$buffer

at line 396
isSingle()

Indicate we are in a single topic

at line 404
renderSingle($buffer = false)

Parameters

$buffer

at line 527
static nostyleUrl($title, $url)

Parameters

$title
$url

at line 536
renderAll($buffer = false)

Parameters

$buffer

at line 578
getTopicByRlid($resource_link_id)

Get a topic associated with a resource link ID

Parameters

$resource_link_id

at line 592
getLtiByRlid($resource_link_id)

Get an LTI associated with a resource link ID

Parameters

$resource_link_id

Parameters

$buffer

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);
}

Parameters

$key
$rlid