Merge branch 'm31_MDL-46782' of git://github.com/danmarsden/moodle into MOODLE_31_STABLE
This commit is contained in:
+23
-8
@@ -888,7 +888,7 @@ function scorm_get_all_attempts($scormid, $userid) {
|
||||
* @param stdClass $cm course module object
|
||||
*/
|
||||
function scorm_print_launch ($user, $scorm, $action, $cm) {
|
||||
global $CFG, $DB, $PAGE, $OUTPUT, $COURSE;
|
||||
global $CFG, $DB, $OUTPUT;
|
||||
|
||||
if ($scorm->updatefreq == SCORM_UPDATE_EVERYTIME) {
|
||||
scorm_parse($scorm, false);
|
||||
@@ -931,6 +931,13 @@ function scorm_print_launch ($user, $scorm, $action, $cm) {
|
||||
|
||||
$result = scorm_get_toc($user, $scorm, $cm->id, TOCFULLURL, $orgidentifier);
|
||||
$incomplete = $result->incomplete;
|
||||
// Get latest incomplete sco to launch first.
|
||||
if (!empty($result->sco->id)) {
|
||||
$launchsco = $result->sco->id;
|
||||
} else {
|
||||
// Use launch defined by SCORM package.
|
||||
$launchsco = $scorm->launch;
|
||||
}
|
||||
|
||||
// Do we want the TOC to be displayed?
|
||||
if ($scorm->displaycoursestructure == 1) {
|
||||
@@ -973,7 +980,7 @@ function scorm_print_launch ($user, $scorm, $action, $cm) {
|
||||
}
|
||||
|
||||
echo html_writer::empty_tag('br');
|
||||
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'scoid', 'value' => $scorm->launch));
|
||||
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'scoid', 'value' => $launchsco));
|
||||
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'cm', 'value' => $cm->id));
|
||||
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'currentorg', 'value' => $orgidentifier));
|
||||
echo html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('enter', 'scorm')));
|
||||
@@ -1009,12 +1016,19 @@ function scorm_simple_play($scorm, $user, $context, $cmid) {
|
||||
}
|
||||
if ($scorm->skipview >= SCORM_SKIPVIEW_FIRST) {
|
||||
$sco = current($scoes);
|
||||
$url = new moodle_url('/mod/scorm/player.php', array('a' => $scorm->id,
|
||||
'currentorg' => $orgidentifier,
|
||||
'scoid' => $sco->id));
|
||||
$result = scorm_get_toc($user, $scorm, $cmid, TOCFULLURL, $orgidentifier);
|
||||
$url = new moodle_url('/mod/scorm/player.php', array('a' => $scorm->id, 'currentorg' => $orgidentifier));
|
||||
|
||||
// Set last incomplete sco to launch first.
|
||||
if (!empty($result->sco->id)) {
|
||||
$url->param('scoid', $result->sco->id);
|
||||
} else {
|
||||
$url->param('scoid', $sco->id);
|
||||
}
|
||||
|
||||
if ($scorm->skipview == SCORM_SKIPVIEW_ALWAYS || !scorm_has_tracks($scorm->id, $user->id)) {
|
||||
if (!empty($scorm->forcenewattempt)) {
|
||||
$result = scorm_get_toc($user, $scorm, $cmid, TOCFULLURL, $orgidentifier);
|
||||
|
||||
if ($result->incomplete === false) {
|
||||
$url->param('newattempt', 'on');
|
||||
}
|
||||
@@ -1518,6 +1532,7 @@ function scorm_get_toc_object($user, $scorm, $currentorg='', $scoid='', $mode='n
|
||||
|
||||
if ($sco->isvisible === 'true') {
|
||||
if (!empty($sco->launch)) {
|
||||
// Set first sco to launch if in browse/review mode.
|
||||
if (empty($scoid) && ($mode != 'normal')) {
|
||||
$scoid = $sco->id;
|
||||
}
|
||||
@@ -1538,7 +1553,7 @@ function scorm_get_toc_object($user, $scorm, $currentorg='', $scoid='', $mode='n
|
||||
($usertrack->status == 'incomplete') ||
|
||||
($usertrack->status == 'browsed')) {
|
||||
$incomplete = true;
|
||||
if ($play && empty($scoid)) {
|
||||
if (empty($scoid)) {
|
||||
$scoid = $sco->id;
|
||||
}
|
||||
}
|
||||
@@ -1557,7 +1572,7 @@ function scorm_get_toc_object($user, $scorm, $currentorg='', $scoid='', $mode='n
|
||||
}
|
||||
|
||||
} else {
|
||||
if ($play && empty($scoid)) {
|
||||
if (empty($scoid)) {
|
||||
$scoid = $sco->id;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
@mod @mod_scorm @_file_upload @_switch_iframe
|
||||
Feature: Scorm multi-sco review mode.
|
||||
In order to let students access a scorm package
|
||||
As a teacher
|
||||
I need to add scorm activity to a course
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student1@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 |
|
||||
| student1 | C1 | student |
|
||||
|
||||
@javascript
|
||||
Scenario: Test re-entry and make sure next uncompleted SCO is shown on second entry.
|
||||
When I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I set the following fields to these values:
|
||||
| Enable completion tracking | Yes |
|
||||
And I press "Save and display"
|
||||
And I add a "SCORM package" to section "1"
|
||||
And I set the following fields to these values:
|
||||
| Name | Multi-sco SCORM package |
|
||||
| Description | Description |
|
||||
| Completion tracking | Show activity as complete when conditions are met |
|
||||
| Require all scos to return completion status | 1 |
|
||||
And I set the field "Completed" to "1"
|
||||
And I upload "mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12.zip" file to "Package file" filemanager
|
||||
And I click on "Save and display" "button"
|
||||
And I should see "Multi-sco SCORM package"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I follow "Course 1"
|
||||
And I follow "Multi-sco SCORM package"
|
||||
And I should see "Normal"
|
||||
And I press "Enter"
|
||||
And I switch to "scorm_object" iframe
|
||||
And I should see "Play of the game"
|
||||
And I switch to the main frame
|
||||
And I click on "Par?" "list_item"
|
||||
And I switch to "scorm_object" iframe
|
||||
And I should see "Par"
|
||||
And I switch to the main frame
|
||||
And I follow "Exit activity"
|
||||
And I wait until the page is ready
|
||||
And I follow "Multi-sco SCORM package"
|
||||
And I should see "Normal"
|
||||
And I press "Enter"
|
||||
And I switch to "scorm_object" iframe
|
||||
Then I should see "Scoring"
|
||||
+13
-6
@@ -70,13 +70,20 @@ if (!empty($scorm->popup)) {
|
||||
|
||||
$scoid = 0;
|
||||
$orgidentifier = '';
|
||||
if ($sco = scorm_get_sco($scorm->launch, SCO_ONLY)) {
|
||||
if (($sco->organization == '') && ($sco->launch == '')) {
|
||||
$orgidentifier = $sco->identifier;
|
||||
} else {
|
||||
$orgidentifier = $sco->organization;
|
||||
|
||||
$result = scorm_get_toc($USER, $scorm, $cm->id, TOCFULLURL);
|
||||
// Set last incomplete sco to launch first.
|
||||
if (!empty($result->sco->id)) {
|
||||
$scoid = $result->sco->id;
|
||||
} else {
|
||||
if ($sco = scorm_get_sco($scorm->launch, SCO_ONLY)) {
|
||||
if (($sco->organization == '') && ($sco->launch == '')) {
|
||||
$orgidentifier = $sco->identifier;
|
||||
} else {
|
||||
$orgidentifier = $sco->organization;
|
||||
}
|
||||
$scoid = $sco->id;
|
||||
}
|
||||
$scoid = $sco->id;
|
||||
}
|
||||
|
||||
if (empty($preventskip) && $scorm->skipview >= SCORM_SKIPVIEW_FIRST &&
|
||||
|
||||
Reference in New Issue
Block a user