ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilQuestionExporter Class Reference

Scorm 2004 Question Exporter. More...

+ Collaboration diagram for ilQuestionExporter:

Public Member Functions

 ilQuestionExporter ($a_preview_mode=false)
 Constructor public.
 exportQuestion ($a_ref_id, $a_image_path=null, $a_output_mode="presentation")

Static Public Member Functions

static indicateNewSco ()
static getMobs ()
static getFiles ()
static questionsJS ()

Data Fields

 $db
 $ilias
 $ref_id
 $inst_id
 $q_gui
 $tpl
 $json
 $json_decoded
 $preview_mode

Static Public Attributes

static $exported = array()
static $mobs = array()
static $media_files = array()

Private Member Functions

 setHeaderFooter ()
 assSingleChoice ()
 assMultipleChoice ()
 assTextQuestion ()
 assClozeTest ()
 assOrderingQuestion ()
 assMatchingQuestion ()
 assImagemapQuestion ()
 assTextSubset ()
 assOrderingHorizontal ()
 assErrorText ()

Detailed Description

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.

Member Function Documentation

ilQuestionExporter::assClozeTest ( )
private

Definition at line 191 of file class.ilQuestionExporter.php.

{
$this->tpl->setCurrentBlock("clozequestion");
$this->tpl->setVariable("VAL_ID", $this->json_decoded->id);
$this->tpl->setVariable("TXT_SUBMIT_ANSWERS", $this->lng->txt("cont_submit_answers"));
if ($this->preview_mode) {
$this->tpl->setVariable("VAL_NO_DISPLAY", "style=\"display:none\"");
}
$this->tpl->parseCurrentBlock();
// $this->setHeaderFooter();
return $this->tpl->get();
}
ilQuestionExporter::assErrorText ( )
private

Definition at line 292 of file class.ilQuestionExporter.php.

{
$this->tpl->setCurrentBlock("errortext");
$this->tpl->setVariable("VAL_ID", $this->json_decoded->id);
$this->tpl->setVariable("TXT_SUBMIT_ANSWERS", $this->lng->txt("cont_submit_answers"));
if ($this->preview_mode) {
$this->tpl->setVariable("VAL_NO_DISPLAY", "style=\"display:none\"");
}
$this->tpl->parseCurrentBlock();
// $this->setHeaderFooter();
return $this->tpl->get();
}
ilQuestionExporter::assImagemapQuestion ( )
private

Definition at line 244 of file class.ilQuestionExporter.php.

{
$this->tpl->setVariable("TXT_SUBMIT_ANSWERS", $this->lng->txt("cont_submit_answers"));
array_push(self::$media_files,$this->q_gui->object->getImagePath().$this->q_gui->object->getImageFilename());
$this->tpl->setCurrentBlock("mapareas");
$areas = $this->json_decoded->answers;
//set areas in PHP cause of inteference between pure and highlighter
foreach ($areas as $area) {
$this->tpl->setVariable("VAL_COORDS", $area->coords);
$this->tpl->setVariable("VAL_ORDER", $area->order);
$this->tpl->setVariable("VAL_AREA", $area->area);
$this->tpl->setVariable("VAL_ID", $this->json_decoded->id);
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("imagemapquestion");
$this->tpl->setVariable("VAL_ID", $this->json_decoded->id);
if ($this->preview_mode) {
$this->tpl->setVariable("VAL_NO_DISPLAY", "style=\"display:none\"");
}
$this->tpl->parseCurrentBlock();
// $this->setHeaderFooter();
return $this->tpl->get();
}
ilQuestionExporter::assMatchingQuestion ( )
private

Definition at line 232 of file class.ilQuestionExporter.php.

{
$this->tpl->setCurrentBlock("matchingquestion");
$this->tpl->setVariable("VAL_ID", $this->json_decoded->id);
$this->tpl->setVariable("TXT_SUBMIT_ANSWERS", $this->lng->txt("cont_submit_answers"));
if ($this->preview_mode) {
$this->tpl->setVariable("VAL_NO_DISPLAY", "style=\"display:none\"");
}
$this->tpl->parseCurrentBlock();
// $this->setHeaderFooter();
return $this->tpl->get();
}
ilQuestionExporter::assMultipleChoice ( )
private

Definition at line 153 of file class.ilQuestionExporter.php.

{
$this->tpl->setCurrentBlock("multiplechoice");
$this->tpl->setVariable("TXT_SUBMIT_ANSWERS", $this->lng->txt("cont_submit_answers"));
$this->tpl->setVariable("VAL_ID", $this->json_decoded->id);
if ($this->preview_mode) {
$this->tpl->setVariable("VAL_NO_DISPLAY", "style=\"display:none\"");
}
if($this->json_decoded->path)
{
$this->tpl->setVariable("HANDLE_IMAGES",
"ilias.questions.handleMCImages(".$this->json_decoded->id.");");
}
$this->tpl->parseCurrentBlock();
foreach ($this->json_decoded->answers as $answer) {
if ($answer->image!="") {
array_push(self::$media_files,$this->q_gui->object->getImagePath().$answer->image);
array_push(self::$media_files,$this->q_gui->object->getImagePath()."thumb.".$answer->image);
}
}
// $this->setHeaderFooter();
return $this->tpl->get();
}
ilQuestionExporter::assOrderingHorizontal ( )
private

Definition at line 280 of file class.ilQuestionExporter.php.

{
$this->tpl->setCurrentBlock("orderinghorizontal");
$this->tpl->setVariable("VAL_ID", $this->json_decoded->id);
$this->tpl->setVariable("TXT_SUBMIT_ANSWERS", $this->lng->txt("cont_submit_answers"));
if ($this->preview_mode) {
$this->tpl->setVariable("VAL_NO_DISPLAY", "style=\"display:none\"");
}
$this->tpl->parseCurrentBlock();
// $this->setHeaderFooter();
return $this->tpl->get();
}
ilQuestionExporter::assOrderingQuestion ( )
private

Definition at line 203 of file class.ilQuestionExporter.php.

References OQ_PICTURES.

{
$this->tpl->setCurrentBlock("orderingquestion");
$this->tpl->setVariable("VAL_ID", $this->json_decoded->id);
$this->tpl->setVariable("TXT_SUBMIT_ANSWERS", $this->lng->txt("cont_submit_answers"));
if ($this->preview_mode) {
$this->tpl->setVariable("VAL_NO_DISPLAY", "style=\"display:none\"");
}
if($this->q_gui->object->getOrderingType() == OQ_PICTURES)
{
$this->tpl->setVariable("VAL_SUBTYPE", "_images");
$this->tpl->setVariable("HANDLE_IMAGES",
"ilias.questions.handleOrderingImages(".$this->json_decoded->id.");");
foreach ($this->json_decoded->answers as $answer) {
if ($answer->answertext!="") {
array_push(self::$media_files,$this->q_gui->object->getImagePath().$answer->answertext);
array_push(self::$media_files,$this->q_gui->object->getImagePath()."thumb.".$answer->answertext);
}
}
}
else
{
$this->tpl->setVariable("VAL_SUBTYPE", "_terms");
}
$this->tpl->parseCurrentBlock();
// $this->setHeaderFooter();
return $this->tpl->get();
}
ilQuestionExporter::assSingleChoice ( )
private

Definition at line 126 of file class.ilQuestionExporter.php.

{
$this->tpl->setCurrentBlock("singlechoice");
$this->tpl->setVariable("TXT_SUBMIT_ANSWERS", $this->lng->txt("cont_submit_answers"));
$this->tpl->setVariable("VAL_ID", $this->json_decoded->id);
if ($this->preview_mode) {
$this->tpl->setVariable("VAL_NO_DISPLAY", "style=\"display:none\"");
}
if($this->json_decoded->path)
{
$this->tpl->setVariable("HANDLE_IMAGES",
"ilias.questions.handleMCImages(".$this->json_decoded->id.");");
}
$this->tpl->parseCurrentBlock();
foreach ($this->json_decoded->answers as $answer) {
if ($answer->image!="") {
array_push(self::$media_files,$this->q_gui->object->getImagePath().$answer->image);
if (is_file($this->q_gui->object->getImagePath()."thumb.".$answer->image))
{
array_push(self::$media_files,$this->q_gui->object->getImagePath()."thumb.".$answer->image);
}
}
}
// $this->setHeaderFooter();
return $this->tpl->get();
}
ilQuestionExporter::assTextQuestion ( )
private

Definition at line 177 of file class.ilQuestionExporter.php.

{
$maxlength = $this->json_decoded->maxlength == 0 ? 4096 : $this->json_decoded->maxlength;
$this->tpl->setCurrentBlock("textquestion");
$this->tpl->setVariable("VAL_ID", $this->json_decoded->id);
$this->tpl->setVariable("TXT_SUBMIT_ANSWERS", $this->lng->txt("cont_submit_answers"));
$this->tpl->setVariable("VAL_MAXLENGTH", $maxlength);
if ($this->preview_mode) {
$this->tpl->setVariable("VAL_NO_DISPLAY", "style=\"display:none\"");
}
$this->tpl->parseCurrentBlock();
// $this->setHeaderFooter();
return $this->tpl->get();
}
ilQuestionExporter::assTextSubset ( )
private

Definition at line 267 of file class.ilQuestionExporter.php.

{
$this->tpl->setCurrentBlock("textsubset");
$this->tpl->setVariable("VAL_ID", $this->json_decoded->id);
$this->tpl->setVariable("TXT_SUBMIT_ANSWERS", $this->lng->txt("cont_submit_answers"));
$this->tpl->setVariable("VAL_MAXLENGTH", $maxlength);
if ($this->preview_mode) {
$this->tpl->setVariable("VAL_NO_DISPLAY", "style=\"display:none\"");
}
$this->tpl->parseCurrentBlock();
// $this->setHeaderFooter();
return $this->tpl->get();
}
ilQuestionExporter::exportQuestion (   $a_ref_id,
  $a_image_path = null,
  $a_output_mode = "presentation" 
)

Definition at line 61 of file class.ilQuestionExporter.php.

References $inst_id, $json, $mobs, ilInternalLink\_extractInstOfTarget(), ilInternalLink\_extractObjIdOfTarget(), and assQuestionGUI\_getQuestionGUI().

{
if ($a_ref_id != "")
{
if (!($inst_id > 0))
{
}
}
$this->q_gui =& assQuestionGUI::_getQuestionGUI("", $q_id);
$type = $this->q_gui->object->getQuestionType();
if (method_exists($this,$type))
{
$this->q_gui->object->setExportImagePath($a_image_path);
$this->q_gui->object->feedbackOBJ->setPageObjectOutputMode($a_output_mode);
$this->json = $this->q_gui->object->toJSON();
$this->json_decoded = json_decode($this->json);
self::$exported[$this->json_decoded->id] = $this->json;
self::$mobs[$this->json_decoded->id] = $this->json_decoded->mobs;
return $this->$type();
} else {
return "Error: Question Type not implemented/Question editing not finished";
}
}

+ Here is the call graph for this function:

static ilQuestionExporter::getFiles ( )
static

Definition at line 106 of file class.ilQuestionExporter.php.

References $media_files.

Referenced by ilSCORM2004Asset\exportHTMLPageObjects().

{
}

+ Here is the caller graph for this function:

static ilQuestionExporter::getMobs ( )
static

Definition at line 96 of file class.ilQuestionExporter.php.

References $mobs, and $mobs.

Referenced by ilSCORM2004Asset\exportHTMLPageObjects().

{
$allmobs = array();
foreach (self::$mobs as $key => $value) {
for ($i=0;$i<count($mobs[$key]);$i++) {
array_push($allmobs,$mobs[$key][$i]);
}
}
return $allmobs;
}

+ Here is the caller graph for this function:

ilQuestionExporter::ilQuestionExporter (   $a_preview_mode = false)

Constructor public.

Definition at line 36 of file class.ilQuestionExporter.php.

References $ilias, and $lng.

{
global $ilDB, $ilias, $lng;
$this->ref_id =& $a_ref_id;
$this->db =& $ilDB;
$this->lng = $lng;
$this->inst_id = IL_INST_ID;
$this->preview_mode = $a_preview_mode;
$this->tpl = new ilTemplate("tpl.question_export.html", true, true, "Modules/Scorm2004");
// fix for bug 5386, alex 29.10.2009
if (!$a_preview_mode)
{
$this->tpl->setVariable("FORM_BEGIN", "<form onsubmit='return false;'>");
$this->tpl->setVariable("FORM_END", "</form>");
}
}
static ilQuestionExporter::indicateNewSco ( )
static

Definition at line 90 of file class.ilQuestionExporter.php.

References $mobs.

Referenced by ilSCORM2004Asset\exportHTMLPageObjects().

{
self::$exported = array();
self::$mobs = array();
self::$media_files = array();
}

+ Here is the caller graph for this function:

static ilQuestionExporter::questionsJS ( )
static

Definition at line 110 of file class.ilQuestionExporter.php.

Referenced by ilSCORM2004Asset\exportHTMLPageObjects().

{
$exportstring ='var questions = new Array();';
foreach (self::$exported as $key => $value) {
$exportstring .= "questions[$key]= $value;";
}
return $exportstring;
}

+ Here is the caller graph for this function:

ilQuestionExporter::setHeaderFooter ( )
private

Definition at line 118 of file class.ilQuestionExporter.php.

{
$this->tpl->setCurrentBlock("common");
$this->tpl->setVariable("VAL_ID", $this->json_decoded->id);
$this->tpl->setVariable("VAL_TYPE", $this->json_decoded->type);
$this->tpl->parseCurrentBlock();
}

Field Documentation

ilQuestionExporter::$db

Definition at line 22 of file class.ilQuestionExporter.php.

ilQuestionExporter::$exported = array()
static

Definition at line 18 of file class.ilQuestionExporter.php.

ilQuestionExporter::$ilias

Definition at line 23 of file class.ilQuestionExporter.php.

Referenced by ilQuestionExporter().

ilQuestionExporter::$inst_id

Definition at line 25 of file class.ilQuestionExporter.php.

Referenced by exportQuestion().

ilQuestionExporter::$json

Definition at line 28 of file class.ilQuestionExporter.php.

Referenced by exportQuestion().

ilQuestionExporter::$json_decoded

Definition at line 29 of file class.ilQuestionExporter.php.

ilQuestionExporter::$media_files = array()
static

Definition at line 20 of file class.ilQuestionExporter.php.

Referenced by getFiles().

ilQuestionExporter::$mobs = array()
static

Definition at line 19 of file class.ilQuestionExporter.php.

Referenced by getMobs().

ilQuestionExporter::$preview_mode

Definition at line 30 of file class.ilQuestionExporter.php.

ilQuestionExporter::$q_gui

Definition at line 26 of file class.ilQuestionExporter.php.

ilQuestionExporter::$ref_id

Definition at line 24 of file class.ilQuestionExporter.php.

ilQuestionExporter::$tpl

Definition at line 27 of file class.ilQuestionExporter.php.


The documentation for this class was generated from the following file: