mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
MDL-44902: Several additions to External Tool (LTI)
* LTI service related changes: ** Fixing exceptions in OAuth library. ** Added new launch option, Existing window: replaces entire page with the LTI object. ** The LTI tool ID used to perform the launch is now sent with the LTI launch parameters. This is sent back to Moodle on subsequent requests. ** Added $CFG->mod_lti_forcessl to force SSL on all LTI launches. ** Added new LTI launch parameter: tool_consumer_instance_name. Default value is site full name, but can be customized with $CFG->mod_lti_institution_name. ** The LTI grade service endpoints now set the affected user to the session. This was required for event listeners. ** Fix the grade deletion service. Was deleting the grade item instead of just the grade. ** Send error response when LTI instance does not accept grades and grades are being sent. ** Added a method for writing incoming LTI requests to disk for debugging. Disabled by default. * Changes for ltisource plugins: ** Can now to plug into backup/restore. ** Can now have settings.php files. ** Can now hook into the LTI launch and edit parameters. * Several grade changes: ** Added standard_grading_coursemodule_elements to LTI instance edit form. This means LTI instances can be configured with a grade. ** No longer assumes that grade is out of 100. ** Replaced modl/lti:grade capability with mod/lti:view. * JS on mod/lti/view.php for resizing the content object has been converted to YUI3. * Fixed misspellings in language file. * Added hooks for log post and view actions. * Bug fix for lti_get_url_thumbprint() when the URL is missing a schema.
This commit is contained in:
parent
f500ff4e52
commit
8fa50fdd34
23 changed files with 759 additions and 74 deletions
|
@ -95,17 +95,20 @@ function lti_add_instance($lti, $mform) {
|
|||
$lti->timemodified = $lti->timecreated;
|
||||
$lti->servicesalt = uniqid('', true);
|
||||
|
||||
lti_force_type_config_settings($lti, lti_get_type_config_by_instance($lti));
|
||||
|
||||
if (empty($lti->typeid) && isset($lti->urlmatchedtypeid)) {
|
||||
$lti->typeid = $lti->urlmatchedtypeid;
|
||||
}
|
||||
|
||||
if (!isset($lti->grade)) {
|
||||
$lti->grade = 100; // TODO: Why is this harcoded here and default @ DB
|
||||
if (!isset($lti->instructorchoiceacceptgrades) || $lti->instructorchoiceacceptgrades != LTI_SETTING_ALWAYS) {
|
||||
// The instance does not accept grades back from the provider, so set to "No grade" value 0.
|
||||
$lti->grade = 0;
|
||||
}
|
||||
|
||||
$lti->id = $DB->insert_record('lti', $lti);
|
||||
|
||||
if ($lti->instructorchoiceacceptgrades == LTI_SETTING_ALWAYS) {
|
||||
if (isset($lti->instructorchoiceacceptgrades) && $lti->instructorchoiceacceptgrades == LTI_SETTING_ALWAYS) {
|
||||
if (!isset($lti->cmidnumber)) {
|
||||
$lti->cmidnumber = '';
|
||||
}
|
||||
|
@ -139,13 +142,15 @@ function lti_update_instance($lti, $mform) {
|
|||
$lti->showdescriptionlaunch = 0;
|
||||
}
|
||||
|
||||
if (!isset($lti->grade)) {
|
||||
$lti->grade = $DB->get_field('lti', 'grade', array('id' => $lti->id));
|
||||
}
|
||||
lti_force_type_config_settings($lti, lti_get_type_config_by_instance($lti));
|
||||
|
||||
if ($lti->instructorchoiceacceptgrades == LTI_SETTING_ALWAYS) {
|
||||
if (isset($lti->instructorchoiceacceptgrades) && $lti->instructorchoiceacceptgrades == LTI_SETTING_ALWAYS) {
|
||||
lti_grade_item_update($lti);
|
||||
} else {
|
||||
// Instance is no longer accepting grades from Provider, set grade to "No grade" value 0.
|
||||
$lti->grade = 0;
|
||||
$lti->instructorchoiceacceptgrades = 0;
|
||||
|
||||
lti_grade_item_delete($lti);
|
||||
}
|
||||
|
||||
|
@ -468,7 +473,7 @@ function lti_grade_item_delete($basiclti) {
|
|||
function lti_extend_settings_navigation($settings, $parentnode) {
|
||||
global $PAGE;
|
||||
|
||||
if (has_capability('mod/lti:grade', context_module::instance($PAGE->cm->id))) {
|
||||
if (has_capability('mod/lti:manage', context_module::instance($PAGE->cm->id))) {
|
||||
$keys = $parentnode->get_children_key_list();
|
||||
|
||||
$node = navigation_node::create('Submissions',
|
||||
|
@ -478,3 +483,21 @@ function lti_extend_settings_navigation($settings, $parentnode) {
|
|||
$parentnode->add_node($node, $keys[1]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log post actions
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function lti_get_post_actions() {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Log view actions
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function lti_get_view_actions() {
|
||||
return array('view all', 'view');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue