Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-30028 - use page pref correctly when pagination or re-ordering

  • Loading branch information...
commit b27917eea4be16b9de4a100bfd3c14038535bc9b 1 parent d0e016f
@danmarsden danmarsden authored
View
6 mod/scorm/report/basic/report.php
@@ -36,6 +36,8 @@ function display($scorm, $cm, $course, $download) {
$contextmodule= get_context_instance(CONTEXT_MODULE, $cm->id);
$action = optional_param('action', '', PARAM_ALPHA);
$attemptids = optional_param_array('attemptid', array(), PARAM_RAW);
+ $attemptsmode = optional_param('attemptsmode', SCORM_REPORT_ATTEMPTS_ALL_STUDENTS, PARAM_INT);
+ $PAGE->set_url(new moodle_url($PAGE->url, array('attemptsmode' => $attemptsmode)));
if ($action == 'delete' && has_capability('mod/scorm:deleteresponses', $contextmodule) && confirm_sesskey()) {
if (scorm_delete_responses($attemptids, $scorm)) { //delete responses.
@@ -49,13 +51,11 @@ function display($scorm, $cm, $course, $download) {
if ($fromform = $mform->get_data()) {
$detailedrep = $fromform->detailedrep;
$pagesize = $fromform->pagesize;
- $attemptsmode = !empty($fromform->attemptsmode) ? $fromform->attemptsmode : SCORM_REPORT_ATTEMPTS_ALL_STUDENTS;
set_user_preference('scorm_report_detailed', $detailedrep);
set_user_preference('scorm_report_pagesize', $pagesize);
} else {
$detailedrep = get_user_preferences('scorm_report_detailed', false);
$pagesize = get_user_preferences('scorm_report_pagesize', 0);
- $attemptsmode = optional_param('attemptsmode', SCORM_REPORT_ATTEMPTS_STUDENTS_WITH, PARAM_INT);
}
if ($pagesize < 1) {
$pagesize = SCORM_REPORT_DEFAULT_PAGE_SIZE;
@@ -520,7 +520,7 @@ function display($scorm, $cm, $course, $download) {
}
}
if (!$download) {
- $mform->set_data(compact('detailedrep', 'pagesize'));
+ $mform->set_data(compact('detailedrep', 'pagesize', 'attemptsmode'));
$mform->display();
}
} else {
View
6 mod/scorm/report/interactions/report.php
@@ -38,6 +38,8 @@ function display($scorm, $cm, $course, $download) {
$contextmodule = get_context_instance(CONTEXT_MODULE, $cm->id);
$action = optional_param('action', '', PARAM_ALPHA);
$attemptids = optional_param_array('attemptid', array(), PARAM_RAW);
+ $attemptsmode = optional_param('attemptsmode', SCORM_REPORT_ATTEMPTS_ALL_STUDENTS, PARAM_INT);
+ $PAGE->set_url(new moodle_url($PAGE->url, array('attemptsmode' => $attemptsmode)));
if ($action == 'delete' && has_capability('mod/scorm:deleteresponses', $contextmodule) && confirm_sesskey()) {
if (scorm_delete_responses($attemptids, $scorm)) { //delete responses.
@@ -53,14 +55,12 @@ function display($scorm, $cm, $course, $download) {
$includeqtext = $fromform->qtext;
$includeresp = $fromform->resp;
$includeright = $fromform->right;
- $attemptsmode = !empty($fromform->attemptsmode) ? $fromform->attemptsmode : SCORM_REPORT_ATTEMPTS_ALL_STUDENTS;
set_user_preference('scorm_report_pagesize', $pagesize);
set_user_preference('scorm_report_interactions_qtext', $includeqtext);
set_user_preference('scorm_report_interactions_resp', $includeresp);
set_user_preference('scorm_report_interactions_right', $includeright);
} else {
$pagesize = get_user_preferences('scorm_report_pagesize', 0);
- $attemptsmode = optional_param('attemptsmode', SCORM_REPORT_ATTEMPTS_STUDENTS_WITH, PARAM_INT);
$includeqtext = get_user_preferences('scorm_report_interactions_qtext', 0);
$includeresp = get_user_preferences('scorm_report_interactions_resp', 1);
$includeright = get_user_preferences('scorm_report_interactions_right', 0);
@@ -582,7 +582,7 @@ function display($scorm, $cm, $course, $download) {
}
}
if (!$download) {
- $mform->set_data(compact('detailedrep', 'pagesize'));
+ $mform->set_data(compact('detailedrep', 'pagesize', 'attemptsmode'));
$mform->display();
}
} else {
Please sign in to comment.
Something went wrong with that request. Please try again.