Skip to content

Commit

Permalink
Merge branch 'master_MDL-28542'
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Aug 2, 2011
2 parents 44506b8 + 4201a74 commit c03b42f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
15 changes: 9 additions & 6 deletions mod/scorm/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,10 @@ function scorm_course_format_display($user, $course) {
if (! $cm = get_coursemodule_from_instance('scorm', $scorm->id, $course->id)) {
print_error('invalidcoursemodule');
}
$contextmodule = get_context_instance(CONTEXT_MODULE, $cm->id);
if ((has_capability('mod/scorm:skipview', $contextmodule))) {
scorm_simple_play($scorm, $user, $contextmodule);
}
$colspan = '';
$headertext = '<table width="100%"><tr><td class="title">'.get_string('name').': <b>'.format_string($scorm->name).'</b>';
if (has_capability('moodle/course:manageactivities', $context)) {
Expand Down Expand Up @@ -832,12 +836,11 @@ function scorm_simple_play($scorm, $user, $context) {
}
if ($scorm->skipview >= 1) {
$sco = current($scoes);
if (scorm_get_tracks($sco->id, $user->id) === false) {
header('Location: player.php?a='.$scorm->id.'&scoid='.$sco->id.'&currentorg='.$orgidentifier);
$result = true;
} else if ($scorm->skipview == 2) {
header('Location: player.php?a='.$scorm->id.'&scoid='.$sco->id.'&currentorg='.$orgidentifier);
$result = true;
$url = new moodle_url('/mod/scorm/player.php', array('a' => $scorm->id,
'currentorg'=>$orgidentifier,
'scoid'=>$sco->id));
if ($scorm->skipview == 2 || scorm_get_tracks($sco->id, $user->id) === false) {
redirect($url);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions mod/scorm/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@

add_to_log($course->id, 'scorm', 'pre-view', 'view.php?id='.$cm->id, "$scorm->id", $cm->id);

if ((has_capability('mod/scorm:skipview', $contextmodule)) && scorm_simple_play($scorm, $USER, $contextmodule)) {
exit;
if ((has_capability('mod/scorm:skipview', $contextmodule))) {
scorm_simple_play($scorm, $USER, $contextmodule);
}

//
Expand Down

0 comments on commit c03b42f

Please sign in to comment.