Topics
in package
Table of Contents
Properties
- $anchor : mixed
- $course : mixed
- The course object
- $resource_links : mixed
- Index by resource_link
- $toolHome : mixed
- Mounted topics path (e.g. /topics or /courses/2/topics).
- $topic : mixed
- The individual topic
- $topicposition : mixed
- $topics : mixed
- All the topics
- $warpwire_baseurl : mixed
Methods
- __construct() : mixed
- adjustArray() : mixed
- Make non-array into an array and adjust paths
- classroomUrl() : mixed
- footer() : mixed
- getCustomWithInherit() : mixed
- Check if a setting value is in a resource in a Topic
- getLtiByRlid() : mixed
- Get an LTI associated with a resource link ID
- getTopicByAnchor() : mixed
- Get a topic associated with an anchor
- getTopicByRlid() : mixed
- Get a topic associated with a resource link ID
- getUrlResources() : mixed
- header() : mixed
- emit the header material
- isSingle() : mixed
- Indicate we are in a single topic
- makeUrlResource() : mixed
- render() : mixed
- renderAll() : mixed
- renderSingle() : mixed
- topicsHome() : mixed
- topicsLaunchPath() : mixed
Properties
$anchor
public
mixed
$anchor
$course
The course object
public
mixed
$course
$resource_links
Index by resource_link
public
mixed
$resource_links
$toolHome
Mounted topics path (e.g. /topics or /courses/2/topics).
public
mixed
$toolHome
= ''
$topic
The individual topic
public
mixed
$topic
$topicposition
public
mixed
$topicposition
$topics
All the topics
public
mixed
$topics
$warpwire_baseurl
public
mixed
$warpwire_baseurl
= false
Methods
__construct()
public
__construct([mixed $name = 'topics.json' ][, mixed $anchor = null ][, mixed $index = null ]) : mixed
Parameters
- $name : mixed = 'topics.json'
- $anchor : mixed = null
- $index : mixed = null
adjustArray()
Make non-array into an array and adjust paths
public
static adjustArray(mixed &$entry) : mixed
Parameters
- $entry : mixed
classroomUrl()
public
static classroomUrl(mixed $title, mixed $url) : mixed
Parameters
- $title : mixed
- $url : mixed
footer()
public
footer([mixed $buffer = false ]) : mixed
Parameters
- $buffer : mixed = false
getCustomWithInherit()
Check if a setting value is in a resource in a Topic
public
getCustomWithInherit(mixed $key[, mixed $rlid = false ]) : mixed
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 : mixed
- $rlid : mixed = false
getLtiByRlid()
Get an LTI associated with a resource link ID
public
getLtiByRlid(mixed $resource_link_id) : mixed
Parameters
- $resource_link_id : mixed
getTopicByAnchor()
Get a topic associated with an anchor
public
getTopicByAnchor(mixed $anchor) : mixed
Parameters
- $anchor : mixed
getTopicByRlid()
Get a topic associated with a resource link ID
public
getTopicByRlid(mixed $resource_link_id) : mixed
Parameters
- $resource_link_id : mixed
getUrlResources()
public
static getUrlResources(mixed $topic) : mixed
Parameters
- $topic : mixed
header()
emit the header material
public
static header([mixed $buffer = false ]) : mixed
Parameters
- $buffer : mixed = false
isSingle()
Indicate we are in a single topic
public
isSingle() : mixed
makeUrlResource()
public
static makeUrlResource(mixed $type, mixed $title, mixed $url) : mixed
Parameters
- $type : mixed
- $title : mixed
- $url : mixed
render()
public
render([mixed $buffer = false ]) : mixed
Parameters
- $buffer : mixed = false
renderAll()
public
renderAll([mixed $buffer = false ]) : mixed
Parameters
- $buffer : mixed = false
renderSingle()
public
renderSingle([mixed $buffer = false ]) : mixed
Parameters
- $buffer : mixed = false
topicsHome()
private
topicsHome() : mixed
topicsLaunchPath()
private
topicsLaunchPath(mixed $resource_link_id) : mixed
Parameters
- $resource_link_id : mixed