| Línea 23... |
Línea 23... |
| 23 |
*/
|
23 |
*/
|
| Línea 24... |
Línea 24... |
| 24 |
|
24 |
|
| Línea 25... |
Línea 25... |
| 25 |
namespace mod_quiz\output;
|
25 |
namespace mod_quiz\output;
|
| 26 |
|
- |
|
| 27 |
use core_question\local\bank\question_version_status;
|
26 |
|
| 28 |
use mod_quiz\question\bank\qbank_helper;
|
27 |
use core_question\local\bank\question_version_status;
|
| 29 |
use \mod_quiz\structure;
|
28 |
use \mod_quiz\structure;
|
| - |
|
29 |
use \html_writer;
|
| 30 |
use \html_writer;
|
30 |
use qbank_previewquestion\question_preview_options;
|
| Línea 31... |
Línea 31... |
| 31 |
use qbank_previewquestion\question_preview_options;
|
31 |
use question_bank;
|
| 32 |
use renderable;
|
32 |
use renderable;
|
| 33 |
|
33 |
|
| Línea 51... |
Línea 51... |
| 51 |
* @param \core_question\local\bank\question_edit_contexts $contexts the relevant question bank contexts.
|
51 |
* @param \core_question\local\bank\question_edit_contexts $contexts the relevant question bank contexts.
|
| 52 |
* @param \moodle_url $pageurl the canonical URL of this page.
|
52 |
* @param \moodle_url $pageurl the canonical URL of this page.
|
| 53 |
* @param array $pagevars the variables from {@link question_edit_setup()}.
|
53 |
* @param array $pagevars the variables from {@link question_edit_setup()}.
|
| 54 |
* @return string HTML to output.
|
54 |
* @return string HTML to output.
|
| 55 |
*/
|
55 |
*/
|
| - |
|
56 |
public function edit_page(
|
| 56 |
public function edit_page(\mod_quiz\quiz_settings $quizobj, structure $structure,
|
57 |
\mod_quiz\quiz_settings $quizobj,
|
| - |
|
58 |
structure $structure,
|
| 57 |
\core_question\local\bank\question_edit_contexts $contexts, \moodle_url $pageurl, array $pagevars) {
|
59 |
\core_question\local\bank\question_edit_contexts $contexts,
|
| - |
|
60 |
\moodle_url $pageurl,
|
| - |
|
61 |
array $pagevars,
|
| - |
|
62 |
) {
|
| - |
|
63 |
|
| 58 |
$output = '';
|
64 |
$output = '';
|
| Línea 59... |
Línea 65... |
| 59 |
|
65 |
|
| 60 |
// Page title.
|
66 |
// Page title.
|
| Línea 110... |
Línea 116... |
| 110 |
|
116 |
|
| 111 |
// Include the contents of any other popups required.
|
117 |
// Include the contents of any other popups required.
|
| 112 |
if ($structure->can_be_edited()) {
|
118 |
if ($structure->can_be_edited()) {
|
| 113 |
$thiscontext = $contexts->lowest();
|
119 |
$thiscontext = $contexts->lowest();
|
| 114 |
$this->page->requires->js_call_amd('mod_quiz/modal_quiz_question_bank', 'init', [
|
120 |
$this->page->requires->js_call_amd('mod_quiz/modal_quiz_question_bank', 'init', [
|
| - |
|
121 |
$thiscontext->id,
|
| - |
|
122 |
$quizobj->get_cm()->id,
|
| 115 |
$thiscontext->id
|
123 |
$quizobj->get_cm()->id,
|
| Línea 116... |
Línea 124... |
| 116 |
]);
|
124 |
]);
|
| 117 |
|
125 |
|
| - |
|
126 |
$this->page->requires->js_call_amd('mod_quiz/modal_add_random_question', 'init', [
|
| 118 |
$this->page->requires->js_call_amd('mod_quiz/modal_add_random_question', 'init', [
|
127 |
$thiscontext->id,
|
| 119 |
$thiscontext->id,
|
128 |
$quizobj->get_cm()->id,
|
| 120 |
$pagevars['cat'],
|
129 |
$pagevars['cat'],
|
| 121 |
$pageurl->out_as_local_url(true),
|
130 |
$pageurl->out_as_local_url(true),
|
| 122 |
$pageurl->param('cmid'),
|
131 |
$pageurl->param('cmid'),
|
| Línea 188... |
Línea 197... |
| 188 |
$output .= html_writer::tag('label', get_string('maximumgrade') . ' ',
|
197 |
$output .= html_writer::tag('label', get_string('maximumgrade') . ' ',
|
| 189 |
['for' => 'inputmaxgrade', 'class' => 'd-inline-block w-auto mb-0']);
|
198 |
['for' => 'inputmaxgrade', 'class' => 'd-inline-block w-auto mb-0']);
|
| 190 |
$output .= html_writer::empty_tag('input', ['type' => 'text', 'id' => 'inputmaxgrade',
|
199 |
$output .= html_writer::empty_tag('input', ['type' => 'text', 'id' => 'inputmaxgrade',
|
| 191 |
'name' => 'maxgrade', 'size' => ($structure->get_decimal_places_for_grades() + 2),
|
200 |
'name' => 'maxgrade', 'size' => ($structure->get_decimal_places_for_grades() + 2),
|
| 192 |
'value' => $structure->formatted_quiz_grade(),
|
201 |
'value' => $structure->formatted_quiz_grade(),
|
| 193 |
'class' => 'form-control d-inline-block align-middle w-auto ml-1']);
|
202 |
'class' => 'form-control d-inline-block align-middle w-auto ms-1']);
|
| 194 |
$output .= html_writer::empty_tag('input', ['type' => 'submit', 'class' => 'btn btn-secondary ml-1 d-inline-block w-auto ',
|
203 |
$output .= html_writer::empty_tag('input', ['type' => 'submit', 'class' => 'btn btn-secondary ms-1 d-inline-block w-auto ',
|
| 195 |
'name' => 'savechanges', 'value' => get_string('save', 'quiz')]);
|
204 |
'name' => 'savechanges', 'value' => get_string('save', 'quiz')]);
|
| 196 |
$output .= html_writer::end_tag('fieldset');
|
205 |
$output .= html_writer::end_tag('fieldset');
|
| 197 |
$output .= html_writer::end_tag('form');
|
206 |
$output .= html_writer::end_tag('form');
|
| 198 |
$output .= html_writer::end_tag('div');
|
207 |
$output .= html_writer::end_tag('div');
|
| 199 |
return $output;
|
208 |
return $output;
|
| Línea 212... |
Línea 221... |
| 212 |
$buttonoptions = [
|
221 |
$buttonoptions = [
|
| 213 |
'type' => 'submit',
|
222 |
'type' => 'submit',
|
| 214 |
'name' => 'repaginate',
|
223 |
'name' => 'repaginate',
|
| 215 |
'id' => 'repaginatecommand',
|
224 |
'id' => 'repaginatecommand',
|
| 216 |
'value' => get_string('repaginatecommand', 'quiz'),
|
225 |
'value' => get_string('repaginatecommand', 'quiz'),
|
| 217 |
'class' => 'btn btn-secondary mr-1',
|
226 |
'class' => 'btn btn-secondary me-1',
|
| 218 |
'data-header' => $header,
|
227 |
'data-header' => $header,
|
| 219 |
'data-form' => $form,
|
228 |
'data-form' => $form,
|
| 220 |
];
|
229 |
];
|
| 221 |
if (!$structure->can_be_repaginated()) {
|
230 |
if (!$structure->can_be_repaginated()) {
|
| 222 |
$buttonoptions['disabled'] = 'disabled';
|
231 |
$buttonoptions['disabled'] = 'disabled';
|
| Línea 325... |
Línea 334... |
| 325 |
|
334 |
|
| 326 |
$hiddenurl = clone($pageurl);
|
335 |
$hiddenurl = clone($pageurl);
|
| Línea 327... |
Línea 336... |
| 327 |
$hiddenurl->param('sesskey', sesskey());
|
336 |
$hiddenurl->param('sesskey', sesskey());
|
| 328 |
|
337 |
|
| Línea 329... |
Línea 338... |
| 329 |
$select = html_writer::select($perpage, 'questionsperpage',
|
338 |
$select = html_writer::select($perpage, 'questionsperpage',
|
| 330 |
$structure->get_questions_per_page(), false, ['class' => 'custom-select']);
|
339 |
$structure->get_questions_per_page(), false, ['class' => 'form-select']);
|
| 331 |
|
340 |
|
| 332 |
$buttonattributes = [
|
341 |
$buttonattributes = [
|
| 333 |
'type' => 'submit',
|
342 |
'type' => 'submit',
|
| 334 |
'name' => 'repaginate',
|
343 |
'name' => 'repaginate',
|
| Línea 335... |
Línea 344... |
| 335 |
'value' => get_string('go'),
|
344 |
'value' => get_string('go'),
|
| 336 |
'class' => 'btn btn-secondary ml-1'
|
345 |
'class' => 'btn btn-secondary ms-1'
|
| 337 |
];
|
346 |
];
|
| Línea 400... |
Línea 409... |
| 400 |
|
409 |
|
| 401 |
if ($section->heading) {
|
410 |
if ($section->heading) {
|
| 402 |
$sectionheadingtext = format_string($section->heading);
|
411 |
$sectionheadingtext = format_string($section->heading);
|
| 403 |
$sectionheading = html_writer::span($sectionheadingtext, 'instancesection');
|
412 |
$sectionheading = html_writer::span($sectionheadingtext, 'instancesection');
|
| 404 |
} else {
|
413 |
} else {
|
| 405 |
// Use a sr-only default section heading, so we don't end up with an empty section heading.
|
414 |
// Use a visually-hidden default section heading, so we don't end up with an empty section heading.
|
| 406 |
$sectionheadingtext = get_string('sectionnoname', 'quiz');
|
415 |
$sectionheadingtext = get_string('sectionnoname', 'quiz');
|
| 407 |
$sectionheading = html_writer::span($sectionheadingtext, 'instancesection sr-only');
|
416 |
$sectionheading = html_writer::span($sectionheadingtext, 'instancesection visually-hidden');
|
| Línea 408... |
Línea 417... |
| 408 |
}
|
417 |
}
|
| 409 |
|
418 |
|
| 410 |
$output .= html_writer::start_tag('li', ['id' => 'section-'.$section->id,
|
419 |
$output .= html_writer::start_tag('li', ['id' => 'section-'.$section->id,
|
| Línea 519... |
Línea 528... |
| 519 |
|
528 |
|
| 520 |
$output = '';
|
529 |
$output = '';
|
| 521 |
foreach ($structure->get_slots_in_section($section->id) as $slot) {
|
530 |
foreach ($structure->get_slots_in_section($section->id) as $slot) {
|
| 522 |
$output .= $this->question_row($structure, $slot, $contexts, $pagevars, $pageurl);
|
531 |
$output .= $this->question_row($structure, $slot, $contexts, $pagevars, $pageurl);
|
| - |
|
532 |
}
|
| - |
|
533 |
|
| 523 |
}
|
534 |
$this->page->requires->js_call_amd('mod_quiz/question_slot', 'init');
|
| 524 |
return html_writer::tag('ul', $output, ['class' => 'section img-text']);
|
535 |
return html_writer::tag('ul', $output, ['class' => 'section img-text']);
|
| Línea 525... |
Línea 536... |
| 525 |
}
|
536 |
}
|
| 526 |
|
537 |
|
| Línea 741... |
Línea 752... |
| 741 |
* @param int $slot the first slot on the page we are outputting.
|
752 |
* @param int $slot the first slot on the page we are outputting.
|
| 742 |
* @param \moodle_url $pageurl the canonical URL of this page.
|
753 |
* @param \moodle_url $pageurl the canonical URL of this page.
|
| 743 |
* @return string HTML to output.
|
754 |
* @return string HTML to output.
|
| 744 |
*/
|
755 |
*/
|
| 745 |
public function question(structure $structure, int $slot, \moodle_url $pageurl) {
|
756 |
public function question(structure $structure, int $slot, \moodle_url $pageurl) {
|
| - |
|
757 |
global $DB;
|
| - |
|
758 |
|
| 746 |
// Get the data required by the question_slot template.
|
759 |
// Get the data required by the question_slot template.
|
| 747 |
$slotid = $structure->get_slot_id_for_slot($slot);
|
760 |
$slotid = $structure->get_slot_id_for_slot($slot);
|
| - |
|
761 |
$question = $structure->get_question_in_slot($slot);
|
| - |
|
762 |
$bank = $structure->get_source_bank($slot);
|
| - |
|
763 |
|
| - |
|
764 |
if ($bank?->issharedbank && question_has_capability_on($question, 'view')) {
|
| - |
|
765 |
$bankurl = (new \moodle_url('/question/edit.php',
|
| - |
|
766 |
[
|
| - |
|
767 |
'cmid' => $bank->cminfo->id,
|
| - |
|
768 |
'cat' => "{$question->category},{$question->contextid}",
|
| - |
|
769 |
]
|
| - |
|
770 |
))->out(false);
|
| - |
|
771 |
} else {
|
| - |
|
772 |
$bankurl = '';
|
| - |
|
773 |
}
|
| Línea 748... |
Línea 774... |
| 748 |
|
774 |
|
| 749 |
$output = '';
|
775 |
$output = '';
|
| Línea 750... |
Línea 776... |
| 750 |
$output .= html_writer::start_tag('div');
|
776 |
$output .= html_writer::start_tag('div');
|
| Línea 768... |
Línea 794... |
| 768 |
'questionname' => $this->get_question_name_for_slot($structure, $slot, $pageurl),
|
794 |
'questionname' => $this->get_question_name_for_slot($structure, $slot, $pageurl),
|
| 769 |
'questionicons' => $this->get_action_icon($structure, $slot, $pageurl),
|
795 |
'questionicons' => $this->get_action_icon($structure, $slot, $pageurl),
|
| 770 |
'questiondependencyicon' => ($structure->can_be_edited() ? $this->question_dependency_icon($structure, $slot) : ''),
|
796 |
'questiondependencyicon' => ($structure->can_be_edited() ? $this->question_dependency_icon($structure, $slot) : ''),
|
| 771 |
'versionselection' => false,
|
797 |
'versionselection' => false,
|
| 772 |
'draftversion' => $structure->get_question_in_slot($slot)->status == question_version_status::QUESTION_STATUS_DRAFT,
|
798 |
'draftversion' => $structure->get_question_in_slot($slot)->status == question_version_status::QUESTION_STATUS_DRAFT,
|
| - |
|
799 |
'bankname' => $bank?->cminfo->get_formatted_name(),
|
| - |
|
800 |
'issharedbank' => $bank?->issharedbank,
|
| - |
|
801 |
'bankurl' => $bankurl,
|
| 773 |
];
|
802 |
];
|
| Línea 774... |
Línea 803... |
| 774 |
|
803 |
|
| 775 |
$data['versionoptions'] = [];
|
804 |
$data['versionoptions'] = [];
|
| 776 |
if ($structure->get_slot_by_number($slot)->qtype !== 'random') {
|
805 |
if ($structure->get_slot_by_number($slot)->qtype !== 'random') {
|
| 777 |
$data['versionselection'] = true;
|
806 |
$data['versionselection'] = true;
|
| 778 |
$data['versionoption'] = $structure->get_version_choices_for_slot($slot);
|
- |
|
| 779 |
$this->page->requires->js_call_amd('mod_quiz/question_slot', 'init', [$slotid]);
|
807 |
$data['versionoption'] = $structure->get_version_choices_for_slot($slot);
|
| Línea 780... |
Línea 808... |
| 780 |
}
|
808 |
}
|
| 781 |
|
809 |
|
| Línea 800... |
Línea 828... |
| 800 |
[
|
828 |
[
|
| 801 |
'id' => 'selectquestion-' . $slot,
|
829 |
'id' => 'selectquestion-' . $slot,
|
| 802 |
'name' => 'selectquestion[]',
|
830 |
'name' => 'selectquestion[]',
|
| 803 |
'classes' => 'select-multiple-checkbox',
|
831 |
'classes' => 'select-multiple-checkbox',
|
| 804 |
'label' => get_string('selectquestionslot', 'quiz', $questionslot),
|
832 |
'label' => get_string('selectquestionslot', 'quiz', $questionslot),
|
| 805 |
'labelclasses' => 'sr-only',
|
833 |
'labelclasses' => 'visually-hidden',
|
| 806 |
]);
|
834 |
]);
|
| Línea 807... |
Línea 835... |
| 807 |
|
835 |
|
| 808 |
return $this->render($checkbox);
|
836 |
return $this->render($checkbox);
|
| Línea 838... |
Línea 866... |
| 838 |
public function get_action_icon(structure $structure, int $slot, \moodle_url $pageurl): string {
|
866 |
public function get_action_icon(structure $structure, int $slot, \moodle_url $pageurl): string {
|
| 839 |
// Action icons.
|
867 |
// Action icons.
|
| 840 |
$qtype = $structure->get_question_type_for_slot($slot);
|
868 |
$qtype = $structure->get_question_type_for_slot($slot);
|
| 841 |
$slotinfo = $structure->get_slot_by_number($slot);
|
869 |
$slotinfo = $structure->get_slot_by_number($slot);
|
| 842 |
$questionicons = '';
|
870 |
$questionicons = '';
|
| 843 |
if ($qtype !== 'random') {
|
871 |
if ($qtype !== 'random' && question_bank::is_qtype_usable($qtype)) {
|
| 844 |
$questionicons .= $this->question_preview_icon($structure->get_quiz(),
|
872 |
$questionicons .= $this->question_preview_icon($structure->get_quiz(),
|
| 845 |
$structure->get_question_in_slot($slot),
|
873 |
$structure->get_question_in_slot($slot),
|
| 846 |
null, null, $slotinfo->requestedversion ?: question_preview_options::ALWAYS_LATEST);
|
874 |
null, null, $slotinfo->requestedversion ?: question_preview_options::ALWAYS_LATEST);
|
| 847 |
}
|
875 |
}
|
| 848 |
if ($structure->can_be_edited() && $structure->has_use_capability($slot)) {
|
876 |
if ($structure->can_be_edited() && $structure->has_use_capability($slot)) {
|
| Línea 894... |
Línea 922... |
| 894 |
* @param int $restartversion version to use when restarting the preview
|
922 |
* @param int $restartversion version to use when restarting the preview
|
| 895 |
* @return string HTML to output.
|
923 |
* @return string HTML to output.
|
| 896 |
*/
|
924 |
*/
|
| 897 |
public function question_preview_icon($quiz, $questiondata, $label = null, $variant = null, $restartversion = null) {
|
925 |
public function question_preview_icon($quiz, $questiondata, $label = null, $variant = null, $restartversion = null) {
|
| 898 |
$question = clone($questiondata);
|
926 |
$question = clone($questiondata);
|
| - |
|
927 |
|
| - |
|
928 |
if (!question_bank::is_qtype_usable($question->qtype)) {
|
| - |
|
929 |
return '';
|
| - |
|
930 |
}
|
| - |
|
931 |
|
| 899 |
if (isset($question->questionid)) {
|
932 |
if (isset($question->questionid)) {
|
| Línea 900... |
Línea 933... |
| 900 |
|
933 |
|
| 901 |
$question->id = $question->questionid;
|
934 |
$question->id = $question->questionid;
|
| Línea 1028... |
Línea 1061... |
| 1028 |
'returnurl' => $pageurl->out_as_local_url(),
|
1061 |
'returnurl' => $pageurl->out_as_local_url(),
|
| 1029 |
'cmid' => $structure->get_cmid(), 'id' => $question->questionid]);
|
1062 |
'cmid' => $structure->get_cmid(), 'id' => $question->questionid]);
|
| Línea 1030... |
Línea 1063... |
| 1030 |
|
1063 |
|
| Línea 1031... |
Línea 1064... |
| 1031 |
$instancename = quiz_question_tostring($question);
|
1064 |
$instancename = quiz_question_tostring($question);
|
| 1032 |
|
1065 |
|
| Línea 1033... |
Línea 1066... |
| 1033 |
$qtype = \question_bank::get_qtype($question->qtype, false);
|
1066 |
$qtype = question_bank::get_qtype($question->qtype, false);
|
| 1034 |
$namestr = $qtype->local_name();
|
1067 |
$namestr = $qtype->local_name();
|
| Línea 1035... |
Línea 1068... |
| 1035 |
|
1068 |
|
| Línea 1036... |
Línea 1069... |
| 1036 |
$icon = $this->pix_icon('icon', $namestr, $qtype->plugin_name(), ['title' => $namestr,
|
1069 |
$icon = $this->pix_icon('icon', $namestr, $qtype->plugin_name(), ['title' => $namestr,
|
| 1037 |
'class' => 'activityicon', 'alt' => $namestr]);
|
1070 |
'class' => 'activityicon', 'alt' => $namestr]);
|
| Línea -... |
Línea 1071... |
| - |
|
1071 |
|
| - |
|
1072 |
$editicon = $this->pix_icon('t/edit', '', 'moodle', ['title' => '']);
|
| - |
|
1073 |
|
| 1038 |
|
1074 |
// Need plain question name without html tags for link title.
|
| - |
|
1075 |
$title = shorten_text(format_string($question->name), 100);
|
| - |
|
1076 |
|
| - |
|
1077 |
// If the question is invalid, don't show the link as it won't work.
|
| - |
|
1078 |
if (!question_bank::is_qtype_usable($question->qtype)) {
|
| - |
|
1079 |
$output .= html_writer::span($title);
|
| - |
|
1080 |
$output .= html_writer::span(
|
| - |
|
1081 |
get_string('invalidquestiontype', 'question', $question->originalqtype),
|
| 1039 |
$editicon = $this->pix_icon('t/edit', '', 'moodle', ['title' => '']);
|
1082 |
'badge bg-danger text-white ms-3'
|
| - |
|
1083 |
);
|
| 1040 |
|
1084 |
} else {
|
| - |
|
1085 |
$canedit = question_has_capability_on($question->questionid, 'edit');
|
| - |
|
1086 |
$instancename = $canedit ? $editicon . $instancename : $instancename;
|
| - |
|
1087 |
// Display the link, if the user has permission to edit. Otherwise, just display the name and icon.
|
| 1041 |
// Need plain question name without html tags for link title.
|
1088 |
$questionname = $icon . html_writer::tag('span', $instancename, ['class' => 'instancename']);
|
| - |
|
1089 |
if ($canedit) {
|
| - |
|
1090 |
$output .= html_writer::link(
|
| - |
|
1091 |
$editurl,
|
| - |
|
1092 |
$questionname,
|
| - |
|
1093 |
[
|
| - |
|
1094 |
'title' => get_string('editquestion', 'quiz') . ' ' . $title,
|
| Línea 1042... |
Línea 1095... |
| 1042 |
$title = shorten_text(format_string($question->name), 100);
|
1095 |
],
|
| 1043 |
|
1096 |
);
|
| Línea 1044... |
Línea 1097... |
| 1044 |
// Display the link itself.
|
1097 |
} else {
|
| Línea 1059... |
Línea 1112... |
| 1059 |
* @return string HTML to output.
|
1112 |
* @return string HTML to output.
|
| 1060 |
*/
|
1113 |
*/
|
| 1061 |
public function random_question(structure $structure, $slotnumber, $pageurl) {
|
1114 |
public function random_question(structure $structure, $slotnumber, $pageurl) {
|
| 1062 |
$question = $structure->get_question_in_slot($slotnumber);
|
1115 |
$question = $structure->get_question_in_slot($slotnumber);
|
| 1063 |
$slot = $structure->get_slot_by_number($slotnumber);
|
1116 |
$slot = $structure->get_slot_by_number($slotnumber);
|
| 1064 |
$editurl = new \moodle_url('/mod/quiz/editrandom.php',
|
- |
|
| 1065 |
['returnurl' => $pageurl->out_as_local_url(), 'slotid' => $slot->id]);
|
- |
|
| Línea 1066... |
Línea 1117... |
| 1066 |
|
1117 |
|
| 1067 |
$temp = clone($question);
|
1118 |
$temp = clone($question);
|
| 1068 |
$temp->questiontext = '';
|
1119 |
$temp->questiontext = '';
|
| 1069 |
$temp->name = qbank_helper::describe_random_question($slot);
|
1120 |
$temp->name = $structure->describe_random_slot($slot->id);
|
| - |
|
1121 |
$instancename = quiz_question_tostring($temp);
|
| - |
|
1122 |
if (strpos($instancename, structure::MISSING_QUESTION_CATEGORY_PLACEHOLDER) !== false) {
|
| - |
|
1123 |
$label = html_writer::span(
|
| - |
|
1124 |
get_string('missingcategory', 'mod_quiz'),
|
| - |
|
1125 |
'badge bg-danger text-white h-50'
|
| - |
|
1126 |
);
|
| - |
|
1127 |
$instancename = str_replace(structure::MISSING_QUESTION_CATEGORY_PLACEHOLDER, $label, $instancename);
|
| Línea 1070... |
Línea 1128... |
| 1070 |
$instancename = quiz_question_tostring($temp);
|
1128 |
}
|
| 1071 |
|
1129 |
|
| 1072 |
$configuretitle = get_string('configurerandomquestion', 'quiz');
|
1130 |
$configuretitle = get_string('configurerandomquestion', 'quiz');
|
| 1073 |
$qtype = \question_bank::get_qtype($question->qtype, false);
|
1131 |
$qtype = question_bank::get_qtype($question->qtype, false);
|
| Línea 1074... |
Línea 1132... |
| 1074 |
$namestr = $qtype->local_name();
|
1132 |
$namestr = $qtype->local_name();
|
| 1075 |
$icon = $this->pix_icon('icon', $namestr, $qtype->plugin_name(), ['class' => 'icon activityicon']);
|
1133 |
$icon = $this->pix_icon('icon', $namestr, $qtype->plugin_name(), ['class' => 'icon activityicon']);
|
| 1076 |
|
1134 |
|
| 1077 |
$editicon = $this->pix_icon('t/edit', $configuretitle, 'moodle', ['title' => '']);
|
1135 |
$editicon = $this->pix_icon('t/edit', $configuretitle, 'moodle', ['title' => '']);
|
| 1078 |
$qbankurlparams = [
|
1136 |
$qbankurlparams = [
|
| Línea 1079... |
Línea -... |
| 1079 |
'cmid' => $structure->get_cmid(),
|
- |
|
| 1080 |
'cat' => $slot->category . ',' . $slot->contextid,
|
- |
|
| 1081 |
];
|
- |
|
| 1082 |
|
- |
|
| 1083 |
$slottags = [];
|
- |
|
| 1084 |
if (isset($slot->randomtags)) {
|
- |
|
| 1085 |
$slottags = $slot->randomtags;
|
- |
|
| 1086 |
}
|
- |
|
| 1087 |
foreach ($slottags as $index => $slottag) {
|
- |
|
| 1088 |
$slottag = explode(',', $slottag);
|
1137 |
'cmid' => $structure->get_source_bank($slotnumber)->cminfo->id,
|
| 1089 |
$qbankurlparams["qtagids[{$index}]"] = $slottag[0];
|
1138 |
'filter' => json_encode($slot->filtercondition['filter']),
|
| 1090 |
}
|
1139 |
];
|
| 1091 |
|
1140 |
|
| 1092 |
// If this is a random question, display a link to show the questions
|
1141 |
// If this is a random question, display a link to show the questions
|
| Línea -... |
Línea 1142... |
| - |
|
1142 |
// selected from in the question bank.
|
| - |
|
1143 |
$qbankurl = new \moodle_url('/question/edit.php', $qbankurlparams);
|
| - |
|
1144 |
$qbanklink = ' ' . \html_writer::link($qbankurl,
|
| - |
|
1145 |
get_string('seequestions', 'quiz'), ['class' => 'mod_quiz_random_qbank_link']);
|
| 1093 |
// selected from in the question bank.
|
1146 |
|
| - |
|
1147 |
$editlink = html_writer::link(
|
| - |
|
1148 |
$pageurl->out(),
|
| - |
|
1149 |
$icon . $editicon,
|
| - |
|
1150 |
[
|
| - |
|
1151 |
'title' => $configuretitle,
|
| 1094 |
$qbankurl = new \moodle_url('/question/edit.php', $qbankurlparams);
|
1152 |
'data-action' => 'editrandomquestion',
|
| 1095 |
$qbanklink = ' ' . \html_writer::link($qbankurl,
|
1153 |
'data-slotid' => $slot->id,
|
| Línea 1096... |
Línea 1154... |
| 1096 |
get_string('seequestions', 'quiz'), ['class' => 'mod_quiz_random_qbank_link']);
|
1154 |
'data-header' => get_string('randomediting', 'mod_quiz'),
|
| 1097 |
|
1155 |
],
|
| 1098 |
return html_writer::link($editurl, $icon . $editicon, ['title' => $configuretitle]) .
|
1156 |
);
|
| Línea 1261... |
Línea 1319... |
| 1261 |
'questiondependencyfree',
|
1319 |
'questiondependencyfree',
|
| 1262 |
'questiondependencyremove',
|
1320 |
'questiondependencyremove',
|
| 1263 |
'questiondependsonprevious',
|
1321 |
'questiondependsonprevious',
|
| 1264 |
], 'quiz');
|
1322 |
], 'quiz');
|
| Línea 1265... |
Línea 1323... |
| 1265 |
|
1323 |
|
| 1266 |
foreach (\question_bank::get_all_qtypes() as $qtype => $notused) {
|
1324 |
foreach (question_bank::get_all_qtypes() as $qtype => $notused) {
|
| 1267 |
$this->page->requires->string_for_js('pluginname', 'qtype_' . $qtype);
|
1325 |
$this->page->requires->string_for_js('pluginname', 'qtype_' . $qtype);
|
| Línea 1268... |
Línea 1326... |
| 1268 |
}
|
1326 |
}
|
| 1269 |
|
1327 |
|