Scorm 2004 Question Exporter.
More...
Scorm 2004 Question Exporter.
- Author
- Hendrik Holtmann holtm.nosp@m.ann@.nosp@m.me.co.nosp@m.m
- Version
- Id
- class.ilQuestionExporter.php 12658 2006-11-29 08:51:48Z akill
Definition at line 16 of file class.ilQuestionExporter.php.
◆ __construct()
ilQuestionExporter::__construct |
( |
|
$a_preview_mode = false | ) |
|
Constructor public.
Definition at line 36 of file class.ilQuestionExporter.php.
References $ilDB, and $lng.
43 $this->lng->loadLanguageModule(
'assessment');
45 $this->inst_id = IL_INST_ID;
47 $this->preview_mode = $a_preview_mode;
49 $this->tpl =
new ilTemplate(
"tpl.question_export.html",
true,
true,
"Modules/Scorm2004");
54 $this->tpl->setVariable(
"FORM_BEGIN",
"<form onsubmit='return false;'>");
55 $this->tpl->setVariable(
"FORM_END",
"</form>");
special template class to simplify handling of ITX/PEAR
◆ assClozeTest()
ilQuestionExporter::assClozeTest |
( |
| ) |
|
|
private |
Definition at line 270 of file class.ilQuestionExporter.php.
271 $this->tpl->setCurrentBlock(
"clozequestion");
272 $this->tpl->setVariable(
"VAL_ID", $this->json_decoded->id);
273 $this->tpl->setVariable(
"TXT_SUBMIT_ANSWERS", $this->lng->txt(
"cont_submit_answers"));
274 if ($this->preview_mode) {
275 $this->tpl->setVariable(
"VAL_NO_DISPLAY",
"style=\"display:none\"");
277 $this->tpl->parseCurrentBlock();
279 return $this->tpl->get();
◆ assErrorText()
ilQuestionExporter::assErrorText |
( |
| ) |
|
|
private |
Definition at line 388 of file class.ilQuestionExporter.php.
389 $this->tpl->setCurrentBlock(
"errortext");
390 $this->tpl->setVariable(
"VAL_ID", $this->json_decoded->id);
391 $this->tpl->setVariable(
"TXT_SUBMIT_ANSWERS", $this->lng->txt(
"cont_submit_answers"));
392 if ($this->preview_mode) {
393 $this->tpl->setVariable(
"VAL_NO_DISPLAY",
"style=\"display:none\"");
395 $this->tpl->parseCurrentBlock();
397 return $this->tpl->get();
◆ assImagemapQuestion()
ilQuestionExporter::assImagemapQuestion |
( |
| ) |
|
|
private |
Definition at line 339 of file class.ilQuestionExporter.php.
340 $this->tpl->setVariable(
"TXT_SUBMIT_ANSWERS", $this->lng->txt(
"cont_submit_answers"));
341 array_push(self::$media_files,$this->q_gui->object->getImagePath().$this->q_gui->object->getImageFilename());
342 $this->tpl->setCurrentBlock(
"mapareas");
343 $areas = $this->json_decoded->answers;
345 foreach ($areas as $area) {
346 $this->tpl->setVariable(
"VAL_TOOLTIP", htmlspecialchars($area->answertext));
347 $this->tpl->setVariable(
"VAL_COORDS", $area->coords);
348 $this->tpl->setVariable(
"VAL_ORDER", $area->order);
349 $this->tpl->setVariable(
"VAL_AREA", $area->area);
350 $this->tpl->setVariable(
"VAL_ID", $this->json_decoded->id);
351 $this->tpl->parseCurrentBlock();
353 $this->tpl->setCurrentBlock(
"imagemapquestion");
354 $this->tpl->setVariable(
"VAL_ID", $this->json_decoded->id);
355 if ($this->preview_mode) {
356 $this->tpl->setVariable(
"VAL_NO_DISPLAY",
"style=\"display:none\"");
358 $this->tpl->parseCurrentBlock();
360 return $this->tpl->get();
◆ assKprimChoice()
ilQuestionExporter::assKprimChoice |
( |
| ) |
|
|
private |
Definition at line 205 of file class.ilQuestionExporter.php.
References $tpl.
208 $tpl->addCss(
'Modules/Test/templates/default/ta.css');
210 $this->tpl->setCurrentBlock(
"kprimchoice");
212 $this->tpl->setVariable(
"TXT_SUBMIT_ANSWERS", $this->lng->txt(
"cont_submit_answers"));
213 $this->tpl->setVariable(
"VAL_ID", $this->json_decoded->id);
215 if( $this->preview_mode )
217 $this->tpl->setVariable(
"VAL_NO_DISPLAY",
"style=\"display:none\"");
220 if( $this->json_decoded->path )
222 $this->tpl->setVariable(
"HANDLE_IMAGES",
223 "ilias.questions.handleKprimImages(".$this->json_decoded->id.
");");
226 $this->tpl->setVariable(
'OPTION_LABEL_TRUE', $this->json_decoded->trueOptionLabel);
227 $this->tpl->setVariable(
'OPTION_LABEL_FALSE', $this->json_decoded->falseOptionLabel);
229 $this->tpl->setVariable(
'VALUE_TRUE', 1);
230 $this->tpl->setVariable(
'VALUE_FALSE', 0);
232 $this->tpl->parseCurrentBlock();
234 foreach( $this->json_decoded->answers as $answer )
236 if( is_object($answer->image) )
238 self::$media_files[] = $answer->getImageFsPath();
239 self::$media_files[] = $answer->getThumbFsPath();
241 else if( is_string($answer->image) )
243 self::$media_files[] = $this->q_gui->object->getImagePath() . $answer->image;
244 if (is_file($this->q_gui->object->getImagePath().
"thumb.".$answer->image))
246 self::$media_files[] = $this->q_gui->object->getImagePath() .
"thumb." . $answer->image;
253 return $this->tpl->get();
◆ assLongMenu()
ilQuestionExporter::assLongMenu |
( |
| ) |
|
|
private |
Definition at line 282 of file class.ilQuestionExporter.php.
283 $this->tpl->setCurrentBlock(
"longmenu");
284 $this->tpl->setVariable(
"VAL_ID", $this->json_decoded->id);
285 $this->tpl->setVariable(
"TXT_SUBMIT_ANSWERS", $this->lng->txt(
"cont_submit_answers"));
286 if ($this->preview_mode) {
287 $this->tpl->setVariable(
"VAL_NO_DISPLAY",
"style=\"display:none\"");
289 $this->tpl->parseCurrentBlock();
291 return $this->tpl->get();
◆ assMatchingQuestion()
ilQuestionExporter::assMatchingQuestion |
( |
| ) |
|
|
private |
Definition at line 323 of file class.ilQuestionExporter.php.
References $tpl.
325 $tpl->addJavaScript(
'Modules/TestQuestionPool/js/ilMatchingQuestion.js');
326 $tpl->addCss(
'Modules/TestQuestionPool/templates/default/test_javascript.css');
327 $this->tpl->setCurrentBlock(
"matchingquestion");
328 $this->tpl->setVariable(
"VAL_ID", $this->json_decoded->id);
329 $this->tpl->setVariable(
"BTN_LABEL_RESET", $this->lng->txt(
"reset_terms"));
330 $this->tpl->setVariable(
"TXT_SUBMIT_ANSWERS", $this->lng->txt(
"cont_submit_answers"));
331 if ($this->preview_mode) {
332 $this->tpl->setVariable(
"VAL_NO_DISPLAY",
"style=\"display:none\"");
334 $this->tpl->parseCurrentBlock();
336 return $this->tpl->get();
◆ assMultipleChoice()
ilQuestionExporter::assMultipleChoice |
( |
| ) |
|
|
private |
Definition at line 162 of file class.ilQuestionExporter.php.
References $tpl.
165 $this->q_gui->populateJavascriptFilesRequiredForWorkForm($tpl);
166 $tpl->addCss(
'Modules/Test/templates/default/ta.css');
168 $this->tpl->setCurrentBlock(
"multiplechoice");
169 $this->tpl->setVariable(
"TXT_SUBMIT_ANSWERS", $this->lng->txt(
"cont_submit_answers"));
170 $this->tpl->setVariable(
"VAL_ID", $this->json_decoded->id);
171 if($this->json_decoded->selection_limit)
173 $this->tpl->setVariable(
'SELECTION_LIMIT_HINT', sprintf(
174 $this->lng->txt(
'ass_mc_sel_lim_hint'),
175 $this->json_decoded->selection_limit,
176 count($this->json_decoded->answers)
179 $this->tpl->setVariable(
'SELECTION_LIMIT_VALUE', $this->json_decoded->selection_limit);
183 $this->tpl->setVariable(
'SELECTION_LIMIT_VALUE',
'null');
185 if ($this->preview_mode) {
186 $this->tpl->setVariable(
"VAL_NO_DISPLAY",
"style=\"display:none\"");
188 if($this->json_decoded->path)
190 $this->tpl->setVariable(
"HANDLE_IMAGES",
191 "ilias.questions.handleMCImages(".$this->json_decoded->id.
");");
193 $this->tpl->parseCurrentBlock();
194 foreach ($this->json_decoded->answers as $answer) {
195 if ($answer->image!=
"") {
196 array_push(self::$media_files,$this->q_gui->object->getImagePath().$answer->image);
197 array_push(self::$media_files,$this->q_gui->object->getImagePath().
"thumb.".$answer->image);
201 return $this->tpl->get();
◆ assOrderingHorizontal()
ilQuestionExporter::assOrderingHorizontal |
( |
| ) |
|
|
private |
Definition at line 376 of file class.ilQuestionExporter.php.
377 $this->tpl->setCurrentBlock(
"orderinghorizontal");
378 $this->tpl->setVariable(
"VAL_ID", $this->json_decoded->id);
379 $this->tpl->setVariable(
"TXT_SUBMIT_ANSWERS", $this->lng->txt(
"cont_submit_answers"));
380 if ($this->preview_mode) {
381 $this->tpl->setVariable(
"VAL_NO_DISPLAY",
"style=\"display:none\"");
383 $this->tpl->parseCurrentBlock();
385 return $this->tpl->get();
◆ assOrderingQuestion()
ilQuestionExporter::assOrderingQuestion |
( |
| ) |
|
|
private |
Definition at line 294 of file class.ilQuestionExporter.php.
References OQ_PICTURES.
295 $this->tpl->setCurrentBlock(
"orderingquestion");
296 $this->tpl->setVariable(
"VAL_ID", $this->json_decoded->id);
297 $this->tpl->setVariable(
"TXT_SUBMIT_ANSWERS", $this->lng->txt(
"cont_submit_answers"));
298 if ($this->preview_mode) {
299 $this->tpl->setVariable(
"VAL_NO_DISPLAY",
"style=\"display:none\"");
301 if($this->q_gui->object->getOrderingType() ==
OQ_PICTURES)
303 $this->tpl->setVariable(
"VAL_SUBTYPE",
"_images");
304 $this->tpl->setVariable(
"HANDLE_IMAGES",
305 "ilias.questions.handleOrderingImages(".$this->json_decoded->id.
");");
307 foreach ($this->json_decoded->answers as $answer) {
308 if ($answer->answertext!=
"") {
309 array_push(self::$media_files,$this->q_gui->object->getImagePath().$answer->answertext);
310 array_push(self::$media_files,$this->q_gui->object->getImagePath().
"thumb.".$answer->answertext);
316 $this->tpl->setVariable(
"VAL_SUBTYPE",
"_terms");
318 $this->tpl->parseCurrentBlock();
320 return $this->tpl->get();
const OQ_PICTURES
Ordering question constants.
◆ assSingleChoice()
ilQuestionExporter::assSingleChoice |
( |
| ) |
|
|
private |
Definition at line 135 of file class.ilQuestionExporter.php.
137 $this->tpl->setCurrentBlock(
"singlechoice");
138 $this->tpl->setVariable(
"TXT_SUBMIT_ANSWERS", $this->lng->txt(
"cont_submit_answers"));
139 $this->tpl->setVariable(
"VAL_ID", $this->json_decoded->id);
140 if ($this->preview_mode) {
141 $this->tpl->setVariable(
"VAL_NO_DISPLAY",
"style=\"display:none\"");
143 if($this->json_decoded->path)
145 $this->tpl->setVariable(
"HANDLE_IMAGES",
146 "ilias.questions.handleMCImages(".$this->json_decoded->id.
");");
148 $this->tpl->parseCurrentBlock();
149 foreach ($this->json_decoded->answers as $answer) {
150 if ($answer->image!=
"") {
151 array_push(self::$media_files,$this->q_gui->object->getImagePath().$answer->image);
152 if (is_file($this->q_gui->object->getImagePath().
"thumb.".$answer->image))
154 array_push(self::$media_files,$this->q_gui->object->getImagePath().
"thumb.".$answer->image);
159 return $this->tpl->get();
◆ assTextQuestion()
ilQuestionExporter::assTextQuestion |
( |
| ) |
|
|
private |
Definition at line 256 of file class.ilQuestionExporter.php.
257 $maxlength = $this->json_decoded->maxlength == 0 ? 4096 : $this->json_decoded->maxlength;
258 $this->tpl->setCurrentBlock(
"textquestion");
259 $this->tpl->setVariable(
"VAL_ID", $this->json_decoded->id);
260 $this->tpl->setVariable(
"TXT_SUBMIT_ANSWERS", $this->lng->txt(
"cont_submit_answers"));
261 $this->tpl->setVariable(
"VAL_MAXLENGTH", $maxlength);
262 if ($this->preview_mode) {
263 $this->tpl->setVariable(
"VAL_NO_DISPLAY",
"style=\"display:none\"");
265 $this->tpl->parseCurrentBlock();
267 return $this->tpl->get();
◆ assTextSubset()
ilQuestionExporter::assTextSubset |
( |
| ) |
|
|
private |
Definition at line 363 of file class.ilQuestionExporter.php.
364 $this->tpl->setCurrentBlock(
"textsubset");
365 $this->tpl->setVariable(
"VAL_ID", $this->json_decoded->id);
366 $this->tpl->setVariable(
"TXT_SUBMIT_ANSWERS", $this->lng->txt(
"cont_submit_answers"));
367 $this->tpl->setVariable(
"VAL_MAXLENGTH", $maxlength);
368 if ($this->preview_mode) {
369 $this->tpl->setVariable(
"VAL_NO_DISPLAY",
"style=\"display:none\"");
371 $this->tpl->parseCurrentBlock();
373 return $this->tpl->get();
◆ exportQuestion()
ilQuestionExporter::exportQuestion |
( |
|
$a_ref_id, |
|
|
|
$a_image_path = null , |
|
|
|
$a_output_mode = "presentation" |
|
) |
| |
Definition at line 61 of file class.ilQuestionExporter.php.
References $json, $mobs, ilInternalLink\_extractInstOfTarget(), ilInternalLink\_extractObjIdOfTarget(), and assQuestionGUI\_getQuestionGUI().
74 if (!is_object($this->q_gui->object))
76 return "Error: Question not found.";
79 $type = $this->q_gui->object->getQuestionType();
80 if (method_exists($this,$type))
82 $this->q_gui->object->setExportImagePath($a_image_path);
83 $this->q_gui->object->feedbackOBJ->setPageObjectOutputMode($a_output_mode);
84 $this->json = $this->q_gui->object->toJSON();
85 $this->json_decoded = json_decode($this->json);
86 self::$exported[$this->json_decoded->id] =
$this->json;
87 self::$mobs[$this->json_decoded->id] = $this->json_decoded->mobs;
88 return $this->$type();
90 return "Error: Question Type not implemented/Question editing not finished";
static _extractInstOfTarget($a_target)
Extract installation id out of target.
static _extractObjIdOfTarget($a_target)
Extract object id out of target.
static _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
◆ getFiles()
static ilQuestionExporter::getFiles |
( |
| ) |
|
|
static |
◆ getMobs()
static ilQuestionExporter::getMobs |
( |
| ) |
|
|
static |
◆ indicateNewSco()
static ilQuestionExporter::indicateNewSco |
( |
| ) |
|
|
static |
◆ questionsJS()
static ilQuestionExporter::questionsJS |
( |
array |
$a_qids = null | ) |
|
|
static |
Definition at line 114 of file class.ilQuestionExporter.php.
Referenced by ilSCORM2004Asset\exportHTMLPageObjects().
116 if(!is_array($a_qids)) {
117 $exportstring =
'var questions = new Array();';
119 foreach (self::$exported as $key => $value) {
120 if(!is_array($a_qids) || in_array($key, $a_qids)) {
121 $exportstring .=
"questions[$key]= $value;";
124 return $exportstring;
◆ setHeaderFooter()
ilQuestionExporter::setHeaderFooter |
( |
| ) |
|
|
private |
Definition at line 127 of file class.ilQuestionExporter.php.
129 $this->tpl->setCurrentBlock(
"common");
130 $this->tpl->setVariable(
"VAL_ID", $this->json_decoded->id);
131 $this->tpl->setVariable(
"VAL_TYPE", $this->json_decoded->type);
132 $this->tpl->parseCurrentBlock();
◆ $db
◆ $exported
ilQuestionExporter::$exported = array() |
|
static |
◆ $ilias
ilQuestionExporter::$ilias |
◆ $inst_id
ilQuestionExporter::$inst_id |
◆ $json
ilQuestionExporter::$json |
◆ $json_decoded
ilQuestionExporter::$json_decoded |
◆ $media_files
ilQuestionExporter::$media_files = array() |
|
static |
◆ $mobs
ilQuestionExporter::$mobs = array() |
|
static |
◆ $preview_mode
ilQuestionExporter::$preview_mode |
◆ $q_gui
ilQuestionExporter::$q_gui |
◆ $ref_id
ilQuestionExporter::$ref_id |
◆ $tpl
The documentation for this class was generated from the following file: