Merge branch 'MDL-83831-405' of https://github.com/NashTechOpenUniversity/moodle into MOODLE_405_STABLE

This commit is contained in:
Huong Nguyen 2025-01-14 09:01:09 +07:00
commit 948aeee28c
No known key found for this signature in database
GPG Key ID: 40D88AB693A3E72A
3 changed files with 35 additions and 1 deletions

View File

@ -36,7 +36,15 @@ list($thispageurl, $contexts, $cmid, $cm, $module, $pagevars) =
question_edit_setup('questions', '/question/bank/history/history.php');
$pagevars['entryid'] = $entryid;
$pagevars['returnurl'] = $returnurl;
$url = new moodle_url($thispageurl, ['entryid' => $entryid, 'returnurl' => $returnurl]);
$url = new moodle_url(
$thispageurl,
[
'entryid' => $entryid,
'returnurl' => $returnurl,
'view' => '\qbank_history\question_history_view',
'extraparams' => json_encode(['entryid' => $entryid, 'returnurl' => $returnurl]),
],
);
$PAGE->set_url($url);
// Additional param to differentiate with other question bank view.

View File

@ -86,3 +86,23 @@ Feature: Use the qbank plugin manager page for question history
And I click on "Continue" "button"
And I should see "Question bank"
And I should not see "First question"
Scenario: Resetting the columns in the question history view will return it to its default setting.
Given the following "user preferences" exist:
| user | preference | value |
| admin | qbank_columnsortorder_hiddencols | qbank_usage\question_last_used_column-question_last_used_column |
And the following "questions" exist:
| questioncategory | qtype | name | questiontext |
| Test questions | truefalse | Second question | Answer the second question |
When I am on the "Test quiz" "mod_quiz > question bank" page logged in as "admin"
And "Last used" "qbank_columnsortorder > column header" should not exist
Then I should see "First question"
And I should see "Second question"
And I choose "History" action for "First question" in the question bank
And "First question" "table_row" should exist
And "Second question" "table_row" should not exist
And "Last used" "qbank_columnsortorder > column header" should not exist
And I follow "Reset columns"
And "Last used" "qbank_columnsortorder > column header" should exist
And "First question" "table_row" should exist
And "Second question" "table_row" should not exist

View File

@ -69,6 +69,12 @@ function core_question_output_fragment_question_data(array $args): string {
if (!empty($args['lastchanged'])) {
$thispageurl->param('lastchanged', clean_param($args['lastchanged'], PARAM_INT));
}
if (!empty($args['view'])) {
$thispageurl->param('view', clean_param($args['view'], PARAM_NOTAGS));
}
if (!empty($args['extraparams'])) {
$thispageurl->param('extraparams', clean_param($args['extraparams'], PARAM_RAW));
}
// This is highly suspicious, but it is the same approach taken in /question/edit.php. See MDL-79281.
$thispageurl->param('deleteall', 1);
$questionbank = new $viewclass($contexts, $thispageurl, $course, $cm, $pagevars, $extraparams);