Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plugins bot
moodle-plugins-snapshots
Commits
c7f9bbf6
Commit
c7f9bbf6
authored
Jan 23, 2017
by
Dan Poltawski
Browse files
Merge branch 'master_MDL-46782' of
git://github.com/danmarsden/moodle
parents
c44913b8
4d3fb5b8
Changes
3
Hide whitespace changes
Inline
Side-by-side
mod/scorm/locallib.php
View file @
c7f9bbf6
...
...
@@ -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
)
{
...
...
@@ -976,7 +983,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'
=>
$launch
sco
));
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'
),
...
...
@@ -1013,12 +1020,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'
);
}
...
...
@@ -1522,6 +1536,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
;
}
...
...
@@ -1542,7 +1557,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
;
}
}
...
...
@@ -1561,7 +1576,7 @@ function scorm_get_toc_object($user, $scorm, $currentorg='', $scoid='', $mode='n
}
}
else
{
if
(
$play
&&
empty
(
$scoid
))
{
if
(
empty
(
$scoid
))
{
$scoid
=
$sco
->
id
;
}
...
...
mod/scorm/tests/behat/multisco_reentry.feature
0 → 100644
View file @
c7f9bbf6
@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"
\ No newline at end of file
mod/scorm/view.php
View file @
c7f9bbf6
...
...
@@ -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
&&
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment