| Línea 306... |
Línea 306... |
| 306 |
* @param stdClass|null $question
|
306 |
* @param stdClass|null $question
|
| 307 |
* @param qformat_gift $format
|
307 |
* @param qformat_gift $format
|
| 308 |
* @param string|null $extra (optional, default=null)
|
308 |
* @param string|null $extra (optional, default=null)
|
| 309 |
* @return stdClass|bool Question instance
|
309 |
* @return stdClass|bool Question instance
|
| 310 |
*/
|
310 |
*/
|
| 311 |
public function import_from_gift(array $lines, ?stdClass $question, qformat_gift $format, string $extra = null): bool|stdClass {
|
311 |
public function import_from_gift(array $lines, ?stdClass $question, qformat_gift $format, ?string $extra = null): bool|stdClass {
|
| 312 |
global $CFG;
|
312 |
global $CFG;
|
| 313 |
require_once($CFG->dirroot.'/question/type/ordering/question.php');
|
313 |
require_once($CFG->dirroot.'/question/type/ordering/question.php');
|
| Línea 314... |
Línea 314... |
| 314 |
|
314 |
|
| 315 |
// Extract question info from GIFT file $lines.
|
315 |
// Extract question info from GIFT file $lines.
|
| Línea 460... |
Línea 460... |
| 460 |
* @param stdClass $question
|
460 |
* @param stdClass $question
|
| 461 |
* @return array(layouttype, selecttype, selectcount, gradingtype, $showgrading, $numberingstyle)
|
461 |
* @return array(layouttype, selecttype, selectcount, gradingtype, $showgrading, $numberingstyle)
|
| 462 |
*/
|
462 |
*/
|
| 463 |
public function extract_options_for_export(stdClass $question): array {
|
463 |
public function extract_options_for_export(stdClass $question): array {
|
| Línea 464... |
Línea 464... |
| 464 |
|
464 |
|
| 465 |
$layouttype = match ($question->options->layouttype) {
|
465 |
$layouttype = match (intval($question->options->layouttype)) {
|
| 466 |
qtype_ordering_question::LAYOUT_VERTICAL => 'VERTICAL',
|
466 |
qtype_ordering_question::LAYOUT_VERTICAL => 'VERTICAL',
|
| 467 |
qtype_ordering_question::LAYOUT_HORIZONTAL => 'HORIZONTAL',
|
467 |
qtype_ordering_question::LAYOUT_HORIZONTAL => 'HORIZONTAL',
|
| 468 |
default => '', // Shouldn't happen !!
|
468 |
default => '', // Shouldn't happen !!
|
| Línea 469... |
Línea 469... |
| 469 |
};
|
469 |
};
|
| 470 |
|
470 |
|
| 471 |
$selecttype = match ($question->options->selecttype) {
|
471 |
$selecttype = match (intval($question->options->selecttype)) {
|
| 472 |
qtype_ordering_question::SELECT_ALL => 'ALL',
|
472 |
qtype_ordering_question::SELECT_ALL => 'ALL',
|
| 473 |
qtype_ordering_question::SELECT_RANDOM => 'RANDOM',
|
473 |
qtype_ordering_question::SELECT_RANDOM => 'RANDOM',
|
| 474 |
qtype_ordering_question::SELECT_CONTIGUOUS => 'CONTIGUOUS',
|
474 |
qtype_ordering_question::SELECT_CONTIGUOUS => 'CONTIGUOUS',
|
| Línea 475... |
Línea 475... |
| 475 |
default => '', // Shouldn't happen !!
|
475 |
default => '', // Shouldn't happen !!
|
| 476 |
};
|
476 |
};
|
| 477 |
|
477 |
|
| 478 |
$gradingtype = match ($question->options->gradingtype) {
|
478 |
$gradingtype = match (intval($question->options->gradingtype)) {
|
| 479 |
qtype_ordering_question::GRADING_ALL_OR_NOTHING => 'ALL_OR_NOTHING',
|
479 |
qtype_ordering_question::GRADING_ALL_OR_NOTHING => 'ALL_OR_NOTHING',
|
| 480 |
qtype_ordering_question::GRADING_ABSOLUTE_POSITION => 'ABSOLUTE_POSITION',
|
480 |
qtype_ordering_question::GRADING_ABSOLUTE_POSITION => 'ABSOLUTE_POSITION',
|
| Línea 486... |
Línea 486... |
| 486 |
qtype_ordering_question::GRADING_LONGEST_CONTIGUOUS_SUBSET => 'LONGEST_CONTIGUOUS_SUBSET',
|
486 |
qtype_ordering_question::GRADING_LONGEST_CONTIGUOUS_SUBSET => 'LONGEST_CONTIGUOUS_SUBSET',
|
| 487 |
qtype_ordering_question::GRADING_RELATIVE_TO_CORRECT => 'RELATIVE_TO_CORRECT',
|
487 |
qtype_ordering_question::GRADING_RELATIVE_TO_CORRECT => 'RELATIVE_TO_CORRECT',
|
| 488 |
default => '', // Shouldn't happen !!
|
488 |
default => '', // Shouldn't happen !!
|
| 489 |
};
|
489 |
};
|
| Línea 490... |
Línea 490... |
| 490 |
|
490 |
|
| 491 |
$showgrading = match ($question->options->showgrading) {
|
491 |
$showgrading = match (intval($question->options->showgrading)) {
|
| 492 |
0 => 'HIDE',
|
492 |
0 => 'HIDE',
|
| 493 |
1 => 'SHOW',
|
493 |
1 => 'SHOW',
|
| 494 |
default => '', // Shouldn't happen !!
|
494 |
default => '', // Shouldn't happen !!
|
| Línea 512... |
Línea 512... |
| 512 |
* @param stdClass $question
|
512 |
* @param stdClass $question
|
| 513 |
* @param qformat_gift $format
|
513 |
* @param qformat_gift $format
|
| 514 |
* @param string|null $extra (optional, default=null)
|
514 |
* @param string|null $extra (optional, default=null)
|
| 515 |
* @return string GIFT representation of question
|
515 |
* @return string GIFT representation of question
|
| 516 |
*/
|
516 |
*/
|
| 517 |
public function export_to_gift(stdClass $question, qformat_gift $format, string $extra = null): string {
|
517 |
public function export_to_gift(stdClass $question, qformat_gift $format, ?string $extra = null): string {
|
| 518 |
global $CFG;
|
518 |
global $CFG;
|
| 519 |
require_once($CFG->dirroot.'/question/type/ordering/question.php');
|
519 |
require_once($CFG->dirroot.'/question/type/ordering/question.php');
|
| Línea 520... |
Línea 520... |
| 520 |
|
520 |
|