Línea 28... |
Línea 28... |
28 |
*
|
28 |
*
|
29 |
* @param object $question
|
29 |
* @param object $question
|
30 |
* @return string
|
30 |
* @return string
|
31 |
*/
|
31 |
*/
|
32 |
function qbank_viewcreator_edit_form_display($question): string {
|
32 |
function qbank_viewcreator_edit_form_display($question): string {
|
33 |
global $DB, $PAGE;
|
33 |
global $DB, $PAGE, $OUTPUT;
|
- |
|
34 |
$question = question_bank::load_question($question->id);
|
- |
|
35 |
|
34 |
$versiondata = [];
|
36 |
$versiondata = [];
|
35 |
$questionversion = $DB->get_record('question_versions', ['questionid' => $question->id])->version;
|
37 |
$versioninfo = new \core_question\output\question_version_info($question, true);
|
36 |
$versiondata['versionnumber'] = $questionversion;
|
38 |
$versiondata['versionnumber'] = $versioninfo->export_for_template($OUTPUT)['versioninfo'];
|
- |
|
39 |
|
- |
|
40 |
// Currently the history only display the question versions for just only default category.
|
- |
|
41 |
// To display question in the other category.
|
- |
|
42 |
// So we need to add filter param so that we can display the question in different category.
|
- |
|
43 |
$filterparam = json_encode([
|
- |
|
44 |
'category' => [
|
- |
|
45 |
'jointype' => 1,
|
- |
|
46 |
'values' => [$question->category],
|
- |
|
47 |
'filteroptions' => ['includesubcategories' => false],
|
- |
|
48 |
],
|
- |
|
49 |
]);
|
- |
|
50 |
// We need a return url param so that click close button on history page should redirect back to edit question page.
|
- |
|
51 |
// Set params filter to returnurl so that when we use the move feature It will not cause any error.
|
- |
|
52 |
$returnurl = $PAGE->url;
|
- |
|
53 |
$returnurl->param('filter', $filterparam);
|
- |
|
54 |
$versiondata['historyurl'] = new moodle_url('/question/bank/history/history.php', [
|
- |
|
55 |
'entryid' => $question->questionbankentryid,
|
- |
|
56 |
'returnurl' => $returnurl,
|
- |
|
57 |
'courseid' => $PAGE->course->id,
|
- |
|
58 |
'filter' => $filterparam,
|
- |
|
59 |
'cmid' => $PAGE->url->param('cmid'),
|
- |
|
60 |
]);
|
- |
|
61 |
|
37 |
if (!empty($question->createdby)) {
|
62 |
if (!empty($question->createdby)) {
|
38 |
$a = new stdClass();
|
63 |
$a = new stdClass();
|
39 |
$a->time = userdate($question->timecreated);
|
64 |
$a->time = userdate($question->timecreated);
|
40 |
$a->user = fullname($DB->get_record('user', ['id' => $question->createdby]));
|
65 |
$a->user = fullname($DB->get_record('user', ['id' => $question->createdby]));
|
41 |
$versiondata['createdby'] = get_string('created', 'question') . ' ' .
|
66 |
$versiondata['createdby'] = get_string('created', 'question') . ' ' .
|