| Línea 17... |
Línea 17... |
| 17 |
defined('MOODLE_INTERNAL') || die();
|
17 |
defined('MOODLE_INTERNAL') || die();
|
| Línea 18... |
Línea 18... |
| 18 |
|
18 |
|
| 19 |
|
19 |
|
| 20 |
// Quiz.
|
20 |
// Quiz.
|
| - |
|
21 |
require_once($CFG->dirroot . "/mod/quiz/renderer.php");
|
| 21 |
require_once($CFG->dirroot . "/mod/quiz/renderer.php");
|
22 |
class theme_universe_mod_quiz_renderer extends mod_quiz\output\renderer
|
| 22 |
class theme_universe_mod_quiz_renderer extends mod_quiz\output\renderer {
|
23 |
{
|
| 23 |
/**
|
24 |
/**
|
| 24 |
* Outputs a box.
|
25 |
* Outputs a box.
|
| 25 |
*
|
26 |
*
|
| 26 |
* @param string $contents The contents of the box
|
27 |
* @param string $contents The contents of the box
|
| 27 |
* @param string $classes A space-separated list of CSS classes
|
28 |
* @param string $classes A space-separated list of CSS classes
|
| 28 |
* @param string $id An optional ID
|
29 |
* @param string $id An optional ID
|
| 29 |
* @param array $attributes An array of other attributes to give the box.
|
30 |
* @param array $attributes An array of other attributes to give the box.
|
| 30 |
* @return string the HTML to output.
|
31 |
* @return string the HTML to output.
|
| - |
|
32 |
*/
|
| 31 |
*/
|
33 |
public function space_box($contents, $classes = 'generalbox', $id = null, $attributes = array())
|
| 32 |
public function space_box($contents, $classes = 'generalbox', $id = null, $attributes = array()) {
|
34 |
{
|
| Línea 33... |
Línea 35... |
| 33 |
return $this->space_box_start($classes, $id, $attributes) . $contents . $this->space_box_end();
|
35 |
return $this->space_box_start($classes, $id, $attributes) . $contents . $this->space_box_end();
|
| 34 |
}
|
36 |
}
|
| Línea 39... |
Línea 41... |
| 39 |
* @param string $classes A space-separated list of CSS classes
|
41 |
* @param string $classes A space-separated list of CSS classes
|
| 40 |
* @param string $id An optional ID
|
42 |
* @param string $id An optional ID
|
| 41 |
* @param array $attributes An array of other attributes to give the box.
|
43 |
* @param array $attributes An array of other attributes to give the box.
|
| 42 |
* @return string the HTML to output.
|
44 |
* @return string the HTML to output.
|
| 43 |
*/
|
45 |
*/
|
| 44 |
public function space_box_start($classes = 'generalbox', $id = null, $attributes = array()) {
|
46 |
public function space_box_start($classes = 'generalbox', $id = null, $attributes = array())
|
| - |
|
47 |
{
|
| 45 |
$this->opencontainers->push('box', html_writer::end_tag('div'));
|
48 |
$this->opencontainers->push('box', html_writer::end_tag('div'));
|
| 46 |
$attributes['id'] = $id;
|
49 |
$attributes['id'] = $id;
|
| 47 |
$attributes['class'] = 'box ' . renderer_base::prepare_classes($classes);
|
50 |
$attributes['class'] = 'box ' . renderer_base::prepare_classes($classes);
|
| 48 |
return html_writer::start_tag('div', $attributes);
|
51 |
return html_writer::start_tag('div', $attributes);
|
| 49 |
}
|
52 |
}
|
| Línea 51... |
Línea 54... |
| 51 |
/**
|
54 |
/**
|
| 52 |
* Outputs the closing section of a box.
|
55 |
* Outputs the closing section of a box.
|
| 53 |
*
|
56 |
*
|
| 54 |
* @return string the HTML to output.
|
57 |
* @return string the HTML to output.
|
| 55 |
*/
|
58 |
*/
|
| 56 |
public function space_box_end() {
|
59 |
public function space_box_end()
|
| - |
|
60 |
{
|
| 57 |
return $this->opencontainers->pop('box');
|
61 |
return $this->opencontainers->pop('box');
|
| 58 |
}
|
62 |
}
|
| Línea 59... |
Línea 63... |
| 59 |
|
63 |
|
| 60 |
/**
|
64 |
/**
|
| Línea 65... |
Línea 69... |
| 65 |
* @param context $context the quiz context.
|
69 |
* @param context $context the quiz context.
|
| 66 |
* @param array $messages any access messages that should be described.
|
70 |
* @param array $messages any access messages that should be described.
|
| 67 |
* @param bool $quizhasquestions does quiz has questions added.
|
71 |
* @param bool $quizhasquestions does quiz has questions added.
|
| 68 |
* @return string HTML to output.
|
72 |
* @return string HTML to output.
|
| 69 |
*/
|
73 |
*/
|
| 70 |
public function view_information($quiz, $cm, $context, $messages, bool $quizhasquestions = false) {
|
74 |
public function view_information($quiz, $cm, $context, $messages, bool $quizhasquestions = false)
|
| - |
|
75 |
{
|
| 71 |
$output = '';
|
76 |
$output = '';
|
| Línea 72... |
Línea 77... |
| 72 |
|
77 |
|
| 73 |
// Output any access messages.
|
78 |
// Output any access messages.
|
| 74 |
if ($messages) {
|
79 |
if ($messages) {
|
| Línea 106... |
Línea 111... |
| 106 |
*
|
111 |
*
|
| 107 |
* @param array $quiz Array contining quiz data
|
112 |
* @param array $quiz Array contining quiz data
|
| 108 |
* @param int $context The page context ID
|
113 |
* @param int $context The page context ID
|
| 109 |
* @param mod_quiz_view_object $viewobj
|
114 |
* @param mod_quiz_view_object $viewobj
|
| 110 |
*/
|
115 |
*/
|
| 111 |
public function view_table($quiz, $context, $viewobj) {
|
116 |
public function view_table($quiz, $context, $viewobj)
|
| - |
|
117 |
{
|
| 112 |
if (!$viewobj->attempts) {
|
118 |
if (!$viewobj->attempts) {
|
| 113 |
return '';
|
119 |
return '';
|
| 114 |
}
|
120 |
}
|
| Línea 115... |
Línea 121... |
| 115 |
|
121 |
|
| Línea 241... |
Línea 247... |
| 241 |
* @param stdClass $cm the course_module settings row from the database.
|
247 |
* @param stdClass $cm the course_module settings row from the database.
|
| 242 |
* @param context_module $context the quiz context.
|
248 |
* @param context_module $context the quiz context.
|
| 243 |
* @param mod_quiz_view_object $viewobj
|
249 |
* @param mod_quiz_view_object $viewobj
|
| 244 |
* @return string HTML to display
|
250 |
* @return string HTML to display
|
| 245 |
*/
|
251 |
*/
|
| 246 |
public function view_page($course, $quiz, $cm, $context, $viewobj) {
|
252 |
public function view_page($course, $quiz, $cm, $context, $viewobj)
|
| - |
|
253 |
{
|
| 247 |
$output = '';
|
254 |
$output = '';
|
| Línea 248... |
Línea -... |
| 248 |
|
- |
|
| - |
|
255 |
|
| 249 |
$output .= $this->view_page_tertiary_nav($viewobj);
|
256 |
|
| 250 |
$output .= $this->view_information($quiz, $cm, $context, $viewobj->infomessages);
|
257 |
$output .= $this->view_information($quiz, $cm, $context, $viewobj->infomessages);
|
| 251 |
$output .= $this->view_table($quiz, $context, $viewobj);
|
258 |
$output .= $this->view_table($quiz, $context, $viewobj);
|
| 252 |
$output .= $this->view_result_info($quiz, $context, $cm, $viewobj);
|
259 |
$output .= $this->view_result_info($quiz, $context, $cm, $viewobj);
|
| 253 |
$output .= $this->box($this->view_page_buttons($viewobj), 'rui-quizattempt');
|
260 |
$output .= $this->box($this->view_page_buttons($viewobj), 'rui-quizattempt');
|
| Línea 258... |
Línea 265... |
| 258 |
* Outputs the table containing data from summary data array
|
265 |
* Outputs the table containing data from summary data array
|
| 259 |
*
|
266 |
*
|
| 260 |
* @param array $summarydata contains row data for table
|
267 |
* @param array $summarydata contains row data for table
|
| 261 |
* @param int $page contains the current page number
|
268 |
* @param int $page contains the current page number
|
| 262 |
*/
|
269 |
*/
|
| 263 |
public function review_summary_table($summarydata, $page) {
|
270 |
public function review_summary_table($summarydata, $page)
|
| - |
|
271 |
{
|
| 264 |
$summarydata = $this->filter_review_summary_table($summarydata, $page);
|
272 |
$summarydata = $this->filter_review_summary_table($summarydata, $page);
|
| 265 |
if (empty($summarydata)) {
|
273 |
if (empty($summarydata)) {
|
| 266 |
return '';
|
274 |
return '';
|
| 267 |
}
|
275 |
}
|
| Línea 315... |
Línea 323... |
| 315 |
* Generates the table of summarydata
|
323 |
* Generates the table of summarydata
|
| 316 |
*
|
324 |
*
|
| 317 |
* @param quiz_attempt $attemptobj
|
325 |
* @param quiz_attempt $attemptobj
|
| 318 |
* @param mod_quiz_display_options $displayoptions
|
326 |
* @param mod_quiz_display_options $displayoptions
|
| 319 |
*/
|
327 |
*/
|
| 320 |
public function summary_table($attemptobj, $displayoptions) {
|
328 |
public function summary_table($attemptobj, $displayoptions)
|
| - |
|
329 |
{
|
| 321 |
// Prepare the summary table header.
|
330 |
// Prepare the summary table header.
|
| 322 |
$table = new html_table();
|
331 |
$table = new html_table();
|
| 323 |
$table->attributes['class'] = 'generaltable quizsummaryofattempt';
|
332 |
$table->attributes['class'] = 'generaltable quizsummaryofattempt';
|
| 324 |
$table->head = array(get_string('question', 'quiz'), get_string('status', 'quiz'));
|
333 |
$table->head = array(get_string('question', 'quiz'), get_string('status', 'quiz'));
|
| 325 |
$table->align = array('left', 'left');
|
334 |
$table->align = array('left', 'left');
|
| Línea 419... |
Línea 428... |
| 419 |
return $output;
|
428 |
return $output;
|
| 420 |
}
|
429 |
}
|
| 421 |
}
|
430 |
}
|
| Línea 422... |
Línea 431... |
| 422 |
|
431 |
|
| 423 |
require_once($CFG->dirroot . "/question/engine/renderer.php");
|
432 |
require_once($CFG->dirroot . "/question/engine/renderer.php");
|
| - |
|
433 |
class theme_universe_core_question_renderer extends core_question_renderer
|
| 424 |
class theme_universe_core_question_renderer extends core_question_renderer {
|
434 |
{
|
| 425 |
/**
|
435 |
/**
|
| 426 |
* Generate the information bit of the question display that contains the
|
436 |
* Generate the information bit of the question display that contains the
|
| 427 |
* metadata like the question number, current state, and mark.
|
437 |
* metadata like the question number, current state, and mark.
|
| 428 |
* @param question_attempt $qa the question attempt to display.
|
438 |
* @param question_attempt $qa the question attempt to display.
|
| Línea 442... |
Línea 452... |
| 442 |
question_display_options $options,
|
452 |
question_display_options $options,
|
| 443 |
$number
|
453 |
$number
|
| 444 |
) {
|
454 |
) {
|
| 445 |
$output = '';
|
455 |
$output = '';
|
| 446 |
$output .= '<div class="d-flex align-items-center flex-wrap mb-sm-2 mb-md-0">' .
|
456 |
$output .= '<div class="d-flex align-items-center flex-wrap mb-sm-2 mb-md-0">' .
|
| - |
|
457 |
$this->view_page_tertiary_nav($viewobj) .
|
| 447 |
$this->number($number) .
|
458 |
$this->number($number) .
|
| 448 |
'<div class="d-inline-flex align-items-center flex-wrap">' .
|
459 |
'<div class="d-inline-flex align-items-center flex-wrap">' .
|
| 449 |
$this->status($qa, $behaviouroutput, $options) .
|
460 |
$this->status($qa, $behaviouroutput, $options) .
|
| 450 |
$this->mark_summary($qa, $behaviouroutput, $options) .
|
461 |
$this->mark_summary($qa, $behaviouroutput, $options) .
|
| 451 |
'</div></div>';
|
462 |
'</div></div>';
|
| Línea 460... |
Línea 471... |
| 460 |
* Generate the display of the question number.
|
471 |
* Generate the display of the question number.
|
| 461 |
* @param string|null $number The question number to display. 'i' is a special
|
472 |
* @param string|null $number The question number to display. 'i' is a special
|
| 462 |
* value that gets displayed as Information. Null means no number is displayed.
|
473 |
* value that gets displayed as Information. Null means no number is displayed.
|
| 463 |
* @return HTML fragment.
|
474 |
* @return HTML fragment.
|
| 464 |
*/
|
475 |
*/
|
| 465 |
protected function number($number) {
|
476 |
protected function number($number)
|
| - |
|
477 |
{
|
| 466 |
if (trim($number) === '') {
|
478 |
if (trim($number) === '') {
|
| 467 |
return '';
|
479 |
return '';
|
| 468 |
}
|
480 |
}
|
| 469 |
$numbertext = '';
|
481 |
$numbertext = '';
|
| 470 |
if (trim($number) === 'i') {
|
482 |
if (trim($number) === 'i') {
|
| Línea 505... |
Línea 517... |
| 505 |
* Render the question flag, assuming $flagsoption allows it.
|
517 |
* Render the question flag, assuming $flagsoption allows it.
|
| 506 |
*
|
518 |
*
|
| 507 |
* @param question_attempt $qa the question attempt to display.
|
519 |
* @param question_attempt $qa the question attempt to display.
|
| 508 |
* @param int $flagsoption the option that says whether flags should be displayed.
|
520 |
* @param int $flagsoption the option that says whether flags should be displayed.
|
| 509 |
*/
|
521 |
*/
|
| 510 |
protected function question_flag(question_attempt $qa, $flagsoption) {
|
522 |
protected function question_flag(question_attempt $qa, $flagsoption)
|
| - |
|
523 |
{
|
| 511 |
global $CFG;
|
524 |
global $CFG;
|
| Línea 512... |
Línea 525... |
| 512 |
|
525 |
|
| Línea 513... |
Línea 526... |
| 513 |
$divattributes = array('class' => 'questionflag mx-1 d-none');
|
526 |
$divattributes = array('class' => 'questionflag mx-1 d-none');
|
| Línea 560... |
Línea 573... |
| 560 |
|
573 |
|
| 561 |
return html_writer::nonempty_tag('div', $flagcontent, $divattributes);
|
574 |
return html_writer::nonempty_tag('div', $flagcontent, $divattributes);
|
| Línea 562... |
Línea 575... |
| 562 |
}
|
575 |
}
|
| - |
|
576 |
|
| 563 |
|
577 |
|
| Línea 564... |
Línea 578... |
| 564 |
|
578 |
protected function edit_question_link(question_attempt $qa, question_display_options $options)
|
| 565 |
protected function edit_question_link(question_attempt $qa, question_display_options $options) {
|
579 |
{
|
| 566 |
global $CFG;
|
580 |
global $CFG;
|
| Línea 591... |
Línea 605... |
| 591 |
stroke-width="2"
|
605 |
stroke-width="2"
|
| 592 |
d="M19.25 19.25H13.75">
|
606 |
d="M19.25 19.25H13.75">
|
| 593 |
</path>
|
607 |
</path>
|
| 594 |
</svg>';
|
608 |
</svg>';
|
| Línea 595... |
Línea 609... |
| 595 |
|
609 |
|
| - |
|
610 |
return html_writer::link(
|
| - |
|
611 |
$editurl,
|
| 596 |
return html_writer::link($editurl, $icon,
|
612 |
$icon,
|
| - |
|
613 |
array('class' => 'btn btn-icon btn-secondary editquestion line-height-1 ml-sm-2')
|
| 597 |
array('class' => 'btn btn-icon btn-secondary editquestion line-height-1 ml-sm-2'));
|
614 |
);
|
| 598 |
}
|
615 |
}
|
| 599 |
}
|
- |
|