Skip to content

Commit df6127a

Browse files
Internal: Split multiple classes from scorm_classes.php into separate files - refs #1179 (#6375)
1 parent 643de8c commit df6127a

File tree

2 files changed

+45
-42
lines changed

2 files changed

+45
-42
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
/* For licensing terms, see /license.txt */
4+
5+
/**
6+
* This class handles the SCORM export of free-answer questions.
7+
*/
8+
class ScormAnswerFree extends Answer
9+
{
10+
/**
11+
* Export the text with missing words.
12+
*
13+
* As a side effect, it stores two lists in the class :
14+
* the missing words and their respective weightings.
15+
*/
16+
public function export()
17+
{
18+
$js = '';
19+
$identifier = 'question_'.$this->questionJSId.'_free';
20+
// currently the free answers cannot be displayed, so ignore the textarea
21+
$html = '<tr><td colspan="2">';
22+
$type = $this->getQuestionType();
23+
24+
if (ORAL_EXPRESSION == $type) {
25+
$html = '<tr><td colspan="2">'.get_lang('This learning object or activity is not SCORM compliant. That\'s why it is not exportable.').'</td></tr>';
26+
27+
return [$js, $html];
28+
}
29+
30+
$html .= '<textarea minlength="20" name="'.$identifier.'" id="'.$identifier.'" ></textarea>';
31+
$html .= '</td></tr>';
32+
$js .= 'questions_answers['.$this->questionJSId.'] = new Array();';
33+
$js .= 'questions_answers_correct['.$this->questionJSId.'] = "";';
34+
$js .= 'questions_types['.$this->questionJSId.'] = \'free\';';
35+
$jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = "0";';
36+
$js .= $jstmpw;
37+
38+
return [$js, $html];
39+
}
40+
}

public/main/exercise/export/scorm/scorm_classes.php renamed to public/main/exercise/export/scorm/ScormAnswerHotspot.php

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,6 @@
22

33
/* For licensing terms, see /license.txt */
44

5-
/**
6-
* This class handles the SCORM export of free-answer questions.
7-
*/
8-
class ScormAnswerFree extends Answer
9-
{
10-
/**
11-
* Export the text with missing words.
12-
*
13-
* As a side effect, it stores two lists in the class :
14-
* the missing words and their respective weightings.
15-
*/
16-
public function export()
17-
{
18-
$js = '';
19-
$identifier = 'question_'.$this->questionJSId.'_free';
20-
// currently the free answers cannot be displayed, so ignore the textarea
21-
$html = '<tr><td colspan="2">';
22-
$type = $this->getQuestionType();
23-
24-
if (ORAL_EXPRESSION == $type) {
25-
$html = '<tr><td colspan="2">'.get_lang('This learning object or activity is not SCORM compliant. That\'s why it is not exportable.').'</td></tr>';
26-
27-
return [$js, $html];
28-
}
29-
30-
$html .= '<textarea minlength="20" name="'.$identifier.'" id="'.$identifier.'" ></textarea>';
31-
$html .= '</td></tr>';
32-
$js .= 'questions_answers['.$this->questionJSId.'] = new Array();';
33-
$js .= 'questions_answers_correct['.$this->questionJSId.'] = "";';
34-
$js .= 'questions_types['.$this->questionJSId.'] = \'free\';';
35-
$jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = "0";';
36-
$js .= $jstmpw;
37-
38-
return [$js, $html];
39-
}
40-
}
41-
425
/**
436
* This class handles the SCORM export of hotpot questions.
447
*/
@@ -95,11 +58,11 @@ public function export()
9558
// Get the answers, make a list
9659
$nbrAnswers = $this->selectNbrAnswers();
9760

98-
$answerList = '<div
99-
style="padding: 10px;
100-
margin-left: -8px;
101-
border: 1px solid #4271b5;
102-
height: 448px;
61+
$answerList = '<div
62+
style="padding: 10px;
63+
margin-left: -8px;
64+
border: 1px solid #4271b5;
65+
height: 448px;
10366
width: 200px;"><b>'.get_lang('Image zones').'</b><ol>';
10467
for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
10568
$answerList .= '<li>'.$this->selectAnswer($answerId).'</li>';

0 commit comments

Comments
 (0)