getQuestionType();
$questionId = $this->questionJSId;
$jstmpw = 'questions_answers_ponderation['.$questionId.'] = new Array();';
$jstmpw .= 'questions_answers_ponderation['.$questionId.'][0] = 0;';
$jstmpw .= 'questions_answers_correct['.$questionId.'] = new Array();';
$html = [];
//not sure if we are going to export also the MULTIPLE_ANSWER_COMBINATION to SCORM
//if ($type == MCMA || $type == MULTIPLE_ANSWER_COMBINATION ) {
if ($type == MCMA) {
$id = 1;
$jstmp = '';
$jstmpc = '';
foreach ($this->answer as $i => $answer) {
$identifier = 'question_'.$questionId.'_multiple_'.$i;
$html[] =
'
|
|
';
$jstmp .= $i.',';
if ($this->correct[$i]) {
$jstmpc .= $i.',';
}
$jstmpw .= 'questions_answers_ponderation['.$questionId.']['.$i.'] = '.$this->weighting[$i].";";
$jstmpw .= 'questions_answers_correct['.$questionId.']['.$i.'] = '.$this->correct[$i].';';
$id++;
}
$js[] = 'questions_answers['.$questionId.'] = new Array('.substr($jstmp, 0, -1).');'."\n";
$js[] = 'questions_types['.$questionId.'] = \'mcma\';'."\n";
$js[] = $jstmpw;
} elseif ($type == MULTIPLE_ANSWER_COMBINATION) {
$js = '';
$id = 1;
$jstmp = '';
$jstmpc = '';
foreach ($this->answer as $i => $answer) {
$identifier = 'question_'.$questionId.'_exact_'.$i;
$html[] =
'
|
|
';
$jstmp .= $i.',';
if ($this->correct[$i]) {
$jstmpc .= $i.',';
}
$jstmpw .= 'questions_answers_ponderation['.$questionId.']['.$i.'] = '.$this->weighting[$i].';';
$jstmpw .= 'questions_answers_correct['.$questionId.']['.$i.'] = '.$this->correct[$i].';';
$id++;
}
$js[] = 'questions_answers['.$questionId.'] = new Array('.substr($jstmp, 0, -1).');';
$js[] = 'questions_types['.$questionId.'] = "exact";';
$js[] = $jstmpw;
} else {
$id = 1;
$jstmp = '';
$jstmpc = '';
foreach ($this->answer as $i => $answer) {
$identifier = 'question_'.$questionId.'_unique_'.$i;
$identifier_name = 'question_'.$questionId.'_unique_answer';
$html[] =
'
|
|
';
$jstmp .= $i.',';
if ($this->correct[$i]) {
$jstmpc .= $i;
}
$jstmpw .= 'questions_answers_ponderation['.$questionId.']['.$i.'] = '.$this->weighting[$i].';';
$jstmpw .= 'questions_answers_correct['.$questionId.']['.$i.'] = '.$this->correct[$i].';';
$id++;
}
$js[] = 'questions_answers['.$questionId.'] = new Array('.substr($jstmp, 0, -1).');';
$js[] = 'questions_types['.$questionId.'] = \'mcua\';';
$js[] = $jstmpw;
}
$htmlResult = '';
$htmlResult .= implode("\n", $html);
$htmlResult .= ' |
';
$js = implode("\n", $js);
return [$js, $htmlResult];
}
}