Skip to content

Commit

Permalink
MDL-67028 mod_lti: Support CourseSection.timeFrame custom parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-hutchinson-mcgraw-hill committed Oct 5, 2020
1 parent 5486b03 commit 9980578
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion mod/lti/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2010,6 +2010,18 @@ function lti_calculate_custom_parameter($value) {
return implode(",", groups_get_user_groups($COURSE->id, $USER->id)[0]);
case 'Context.id.history':
return implode(",", get_course_history($COURSE));
case 'CourseSection.timeFrame.begin':
if (empty($COURSE->startdate)) {
return "";
}
$dt = new DateTime("@$COURSE->startdate", new DateTimeZone('UTC'));
return $dt->format(DateTime::ATOM);
case 'CourseSection.timeFrame.end':
if (empty($COURSE->enddate)) {
return "";
}
$dt = new DateTime("@$COURSE->enddate", new DateTimeZone('UTC'));
return $dt->format(DateTime::ATOM);
}
return null;
}
Expand Down Expand Up @@ -3669,7 +3681,8 @@ function lti_get_capabilities() {
'CourseSection.label' => 'context_label',
'CourseSection.sourcedId' => 'lis_course_section_sourcedid',
'CourseSection.longDescription' => '$COURSE->summary',
'CourseSection.timeFrame.begin' => '$COURSE->startdate',
'CourseSection.timeFrame.begin' => null,
'CourseSection.timeFrame.end' => null,
'ResourceLink.id' => 'resource_link_id',
'ResourceLink.title' => 'resource_link_title',
'ResourceLink.description' => 'resource_link_description',
Expand Down

0 comments on commit 9980578

Please sign in to comment.