Merge branch 'MDL-37168-32' of https://github.com/xow/moodle into MOODLE_32_STABLE

This commit is contained in:
David Monllao
2017-03-20 10:16:18 +01:00
5 changed files with 60 additions and 2 deletions
+3 -2
View File
@@ -1379,9 +1379,10 @@ function grade_update_mod_grades($modinstance, $userid=0) {
//new grading supported, force updating of grades
$updateitemfunc($modinstance);
$updategradesfunc($modinstance, $userid);
} else {
} else if (function_exists($updategradesfunc) xor function_exists($updateitemfunc)) {
// Module does not support grading?
debugging("You have declared one of $updateitemfunc and $updategradesfunc but not both. " .
"This will cause broken behaviour.", DEBUG_DEVELOPER);
}
return true;
+19
View File
@@ -102,6 +102,9 @@ function lti_add_instance($lti, $mform) {
$lti->timecreated = time();
$lti->timemodified = $lti->timecreated;
$lti->servicesalt = uniqid('', true);
if (!isset($lti->typeid)) {
$lti->typeid = null;
}
lti_force_type_config_settings($lti, lti_get_type_config_by_instance($lti));
@@ -501,6 +504,22 @@ function lti_grade_item_update($basiclti, $grades = null) {
return grade_update('mod/lti', $basiclti->course, 'mod', 'lti', $basiclti->id, 0, $grades, $params);
}
/**
* Update activity grades
*
* @param stdClass $basiclti The LTI instance
* @param int $userid Specific user only, 0 means all.
* @param bool $nullifnone Not used
*/
function lti_update_grades($basiclti, $userid=0, $nullifnone=true) {
global $CFG;
require_once($CFG->dirroot.'/mod/lti/servicelib.php');
// LTI doesn't have its own grade table so the only thing to do is update the grade item.
if (lti_accepts_grades($basiclti)) {
lti_grade_item_update($basiclti);
}
}
/**
* Delete grade item for given basiclti
*
+1
View File
@@ -26,6 +26,7 @@
defined('MOODLE_INTERNAL') || die;
require_once($CFG->dirroot.'/mod/lti/OAuthBody.php');
require_once($CFG->dirroot.'/mod/lti/locallib.php');
// TODO: Switch to core oauthlib once implemented - MDL-30149.
use moodle\mod\lti as lti;
+34
View File
@@ -0,0 +1,34 @@
@mod @mod_lti
Feature: Rename external tools via inline editing
In order to keep track of my activities
As a teacher
I need to be able to rename the LTI tool and have it's name change in the gradebook
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Terry1 | Teacher1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
@javascript
Scenario: Add a tool and inline edit
When I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add a "External tool" to section "1" and I fill the form with:
| Activity name | Test tool activity 1 |
And I open "Test tool activity 1" actions menu
And I choose "Edit settings" in the open action menu
And I set the field "Tool URL" to local url "/mod/lti/tests/fixtures/ims_cartridge_basic_lti_link.xml"
And I press "Save and return to course"
And I click on "Edit title" "link" in the "li#section-1" "css_element"
And I set the field "New name for activity Test tool activity 1" to "Test tool activity renamed"
And I press key "13" in the field "New name for activity Test tool activity 1"
And I navigate to "Setup > Gradebook setup" in the course gradebook
Then I should not see "Test tool activity 1"
And I should see "Test tool activity renamed"
+3
View File
@@ -61,6 +61,9 @@ class mod_lti_generator extends testing_module_generator {
if (!isset($record->instructorchoiceacceptgrades)) {
$record->instructorchoiceacceptgrades = 1;
}
if (!isset($record->typeid)) {
$record->typeid = null;
}
return parent::create_instance($record, (array)$options);
}
}