ILIAS  Release_4_0_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)

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 ()

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 39 of file class.ilQuestionExporter.php.

Member Function Documentation

ilQuestionExporter::assClozeTest ( )
private

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

{
$this->tpl->setCurrentBlock("clozequestion");
$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::assImagemapQuestion ( )
private

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

{
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 212 of file class.ilQuestionExporter.php.

{
$this->tpl->setCurrentBlock("matchingquestion");
$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::assMultipleChoice ( )
private

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

{
$this->tpl->setCurrentBlock("multiplechoice");
$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();
foreach ($this->json_decoded->answers as $answer) {
if ($answer->image!="") {
array_push(self::$media_files,$this->q_gui->object->getImagePath().$answer->image);
}
}
// $this->setHeaderFooter();
return $this->tpl->get();
}
ilQuestionExporter::assOrderingQuestion ( )
private

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

{
$this->tpl->setCurrentBlock("orderingquestion");
$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::assSingleChoice ( )
private

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

{
$this->tpl->setCurrentBlock("singlechoice");
$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();
foreach ($this->json_decoded->answers as $answer) {
if ($answer->image!="") {
array_push(self::$media_files,$this->q_gui->object->getImagePath().$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("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)

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

References $inst_id, $json, $mobs, $type, 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->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 125 of file class.ilQuestionExporter.php.

References $media_files.

Referenced by ilSCORM2004Sco\exportHTMLPageObjects().

{
}

+ Here is the caller graph for this function:

static ilQuestionExporter::getMobs ( )
static

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

References $key, $mobs, and $mobs.

Referenced by ilSCORM2004Sco\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 58 of file class.ilQuestionExporter.php.

References $ilDB, and $ilias.

{
global $ilDB, $ilias;
$this->ref_id =& $a_ref_id;
$this->ilias =& $ilias;
$this->db =& $ilDB;
$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>");
$this->tpl->setVariable("FORM_END", "<form>");
}
}
static ilQuestionExporter::indicateNewSco ( )
static

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

References $mobs.

Referenced by ilSCORM2004Sco\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 129 of file class.ilQuestionExporter.php.

References $key.

Referenced by ilSCORM2004Sco\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 137 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 45 of file class.ilQuestionExporter.php.

ilQuestionExporter::$exported = array()
static

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

ilQuestionExporter::$ilias

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

Referenced by ilQuestionExporter().

ilQuestionExporter::$inst_id

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

Referenced by exportQuestion().

ilQuestionExporter::$json

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

Referenced by exportQuestion().

ilQuestionExporter::$json_decoded

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

ilQuestionExporter::$media_files = array()
static

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

Referenced by getFiles().

ilQuestionExporter::$mobs = array()
static

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

Referenced by getMobs().

ilQuestionExporter::$preview_mode

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

ilQuestionExporter::$q_gui

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

ilQuestionExporter::$ref_id

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

ilQuestionExporter::$tpl

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


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