diff --git a/main/exercice/export/scorm/scorm_classes.php b/main/exercice/export/scorm/scorm_classes.php
index e9e02b1982..94b6e2c1f7 100755
--- a/main/exercice/export/scorm/scorm_classes.php
+++ b/main/exercice/export/scorm/scorm_classes.php
@@ -81,7 +81,6 @@ class ScormQuestion extends Question
function export()
{
- //echo "
".print_r($this,1)."
";
$html = $this->getQuestionHTML();
$js = $this->getQuestionJS();
@@ -91,7 +90,6 @@ class ScormQuestion extends Question
$js .= $js2;
$html .= $html2;
}
-
return array($js,$html);
}
@@ -110,32 +108,16 @@ class ScormQuestion extends Question
{
$title = $this->selectTitle();
$description = $this->selectDescription();
- $type = $this->selectType();
-
$cols = 0;
- switch($type)
- {
- case MCUA:
- case MCMA:
- case TF:
- case FIB:
- case FREE_ANSWER:
- case HOTSPOT:
- $cols = 2;
- break;
- case MATCHING:
- $cols = 3;
- break;
- }
$s='' .
'| ' . "\n" .
- api_parse_tex($title).
+ api_parse_tex($title).
+ ' | ' . "\n" .
+ '
' . "\n" .
+ '' . "\n" .
+ '| ' . "\n" .
+ ''.api_parse_tex($description).'' . "\n" .
' | ' . "\n" .
- '
' . "\n" .
- '' . "\n" .
- '| ' . "\n" .
- ' '.api_parse_tex($description).'' . "\n" .
- ' | ' . "\n" .
'
' . "\n";
return $s;
}
diff --git a/main/exercice/export/scorm/scorm_export.php b/main/exercice/export/scorm/scorm_export.php
index 369ce8a7db..afca9429a5 100755
--- a/main/exercice/export/scorm/scorm_export.php
+++ b/main/exercice/export/scorm/scorm_export.php
@@ -62,15 +62,13 @@ class ScormAssessmentItem
function start_page()
{
global $charset;
- $head = $foot = "";
-
+ $head = "";
if( $this->standalone)
{
- /*
$head = '' . "\n";
- */
+ $head .= ''."\n";
}
- return $head.''. "\n";
+ return $head;
}
/**
@@ -79,14 +77,16 @@ class ScormAssessmentItem
*/
function end_page()
{
- return '';
+ if($this->standalone){return '';}
+ return '';
}
/**
* Start document header
*/
function start_header()
{
- return ''. "\n";
+ if($this->standalone){return ''. "\n";}
+ return '';
}
/**
@@ -94,7 +94,8 @@ class ScormAssessmentItem
*/
function end_header()
{
- return ''. "\n";
+ if($this->standalone){return ''. "\n";}
+ return '';
}
/**
* Start the itemBody
@@ -102,7 +103,8 @@ class ScormAssessmentItem
*/
function start_js()
{
- return ''. "\n";
+ if($this->standalone){return ''. "\n";}
+ return '';
}
/**
* Start the itemBody
@@ -168,7 +173,8 @@ class ScormAssessmentItem
*/
function start_body()
{
- return ''. "\n".''."\n".''. "\n";
+ if($this->standalone){return '
'."\n".''. "\n";}
+ return '';
}
/**
@@ -188,27 +195,34 @@ class ScormAssessmentItem
* @param $standalone: Boolean stating if it should be exported as a stand-alone question
* @return A string, the XML flow for an Item.
*/
- function export($standalone = false)
+ function export()
{
+ $js = $html = '';
list($js,$html) = $this->question->export();
//list($js,$html) = $this->question->answer->export();
- $res = $this->start_page($standalone)
- . $this->start_header()
- . $this->start_js()
- . $this->common_js()
- . $js
- . $this->end_js()
- . $this->end_header()
- . $this->start_body()
- // .$this->answer->imsExportResponsesDeclaration($this->questionIdent)
- // . $this->start_item_body()
- // . $this->answer->scormExportResponses($this->questionIdent, $this->question->question, $this->question->description, $this->question->picture)
- // .$question
- .$html
- . $this->end_body()
- . $this->end_page();
-
- return $res;
+ if($this->standalone)
+ {
+ $res = $this->start_page()
+ . $this->start_header()
+ . $this->start_js()
+ . $this->common_js()
+ . $js
+ . $this->end_js()
+ . $this->end_header()
+ . $this->start_body()
+ // .$this->answer->imsExportResponsesDeclaration($this->questionIdent)
+ // . $this->start_item_body()
+ // . $this->answer->scormExportResponses($this->questionIdent, $this->question->question, $this->question->description, $this->question->picture)
+ // .$question
+ . $html
+ . $this->end_body()
+ . $this->end_page();
+ return $res;
+ }
+ else
+ {
+ return array($js,$html);
+ }
}
}
@@ -237,260 +251,187 @@ class ScormSection
$this->exercise = $exe;
}
- function start_section()
- {
- $out = '' . "\n";
- return $out;
- }
+
+ /**
+ * Start the XML flow.
+ *
+ * This opens the - block, with correct attributes.
+ *
+ */
+ function start_page()
+ {
+ global $charset;
+ $head = $foot = "";
+ $head = '' . "\n".''."\n";
+ return $head;
+ }
+
+ /**
+ * End the XML flow, closing the
tag.
+ *
+ */
+ function end_page()
+ {
+ return '';
+ }
+ /**
+ * Start document header
+ */
+ function start_header()
+ {
+ return ''. "\n";
+ }
- function end_section()
- {
- return "\n";
- }
-
- function export_duration()
+ /**
+ * End document header
+ */
+ function end_header()
+ {
+ return ''. "\n";
+ }
+ /**
+ * Start the itemBody
+ *
+ */
+ function start_js()
{
- if ($max_time = $this->exercise->selectTimeLimit())
- {
- // return exercise duration in ISO8601 format.
- $minutes = floor($max_time / 60);
- $seconds = $max_time % 60;
- return 'PT' . $minutes . 'M' . $seconds . "S\n";
- }
- else
- {
- return '';
- }
+ return ''. "\n";
}
-
/**
- * Export the ordering information.
- * Either sequential, through all questions, or random, with a selected number of questions.
- * @author Amand Tihon
+ * Start the itemBody
+ *
*/
- function export_ordering()
+ function start_body()
{
- $out = '';
- if ($n = $this->exercise->getShuffle()) {
- $out.= ""
- . " \n"
- . " " . $n . "\n"
- . " \n"
- . ' '
- . "\n\n";
- }
- else
- {
- $out.= '' . "\n"
- . " \n"
- . "\n";
- }
-
- return $out;
+ return ''. "\n".
+ ''.$this->exercise->selectTitle().'
'."\n".
+ ''."\n".''. "\n";
}
-
+
/**
- * Export the exercise in SCORM.
+ * Export the question as a SCORM Item.
*
- * @param bool $standalone Wether it should include XML tag and DTD line.
- * @return a string containing the XML flow
- * @author Amand Tihon
+ * This is a default behaviour, some classes may want to override this.
+ *
+ * @param $standalone: Boolean stating if it should be exported as a stand-alone question
+ * @return A string, the XML flow for an Item.
*/
- function export($standalone)
+ function export()
{
global $charset;
- $head = $foot = "";
- if ($standalone) {
+ $head = "";
+ if ($this->standalone) {
$head = '' . "\n"
- . '' . "\n"
- . "\n";
- $foot = "\n";
+ . '' . "\n";
}
- $out = $head
- . $this->start_section()
- . $this->export_duration()
- . $this->export_presentation()
- . $this->export_ordering()
- . $this->export_questions()
- . $this->end_section()
- . $foot;
-
- return $out;
- }
-}
-/*
- Some quick notes on identifiers generation.
- The IMS format requires some blocks, like items, responses, feedbacks, to be uniquely
- identified.
- The unicity is mandatory in a single XML, of course, but it's prefered that the identifier stays
- coherent for an entire site.
+ list($js,$html) = $this->export_questions();
+ //list($js,$html) = $this->question->answer->export();
+ $res = $this->start_page()
+ . $this->start_header()
+ . $this->start_js()
+ . $this->common_js()
+ . $js
+ . $this->end_js()
+ . $this->end_header()
+ . $this->start_body()
+ // .$this->answer->imsExportResponsesDeclaration($this->questionIdent)
+ // . $this->start_item_body()
+ // . $this->answer->scormExportResponses($this->questionIdent, $this->question->question, $this->question->description, $this->question->picture)
+ // .$question
+ .$html
+ . $this->end_body()
+ . $this->end_page();
+
+ return $res;
+ }
- Here's the method used to generate those identifiers.
- Question identifier :: "QST_" + + "_" +
- Response identifier :: + "_A_" +
- Condition identifier :: + "_C_" +
- Feedback identifier :: + "_F_" +
-*/
-/**
- * A SCORM item. It corresponds to a single question.
- * This class allows export from Dokeos to SCORM 1.2 format.
- * It is not usable as-is, but must be subclassed, to support different kinds of questions.
- *
- * Every start_*() and corresponding end_*(), as well as export_*() methods return a string.
- *
- * @warning Attached files are NOT exported.
- */
-class ScormItem
-{
- var $question;
- var $question_ident;
- var $answer;
-
/**
- * Constructor.
- *
- * @param $question The Question object we want to export.
- * @author Anamd Tihon
+ * Export the questions, as a succession of
+ * @author Amand Tihon
*/
- function ScormItem($question)
- {
- $this->question = $question;
- $this->answer = $question->answer;
- $this->questionIdent = "QST_" . $question->selectId() ;
- }
-
- /**
- * Start the XML flow.
- *
- * This opens the - block, with correct attributes.
- *
- * @author Amand Tihon
- */
- function start_item()
- {
- return '
- ' . "\n";
- }
-
- /**
- * End the XML flow, closing the
tag.
- *
- * @author Amand Tihon
- */
- function end_item()
- {
- return " \n";
- }
-
- /**
- * Create the opening, with the question itself.
- *
- * This means it opens the but doesn't close it, as this is the role of end_presentation().
- * Inbetween, the export_responses from the subclass should have been called.
- *
- * @author Amand Tihon
- */
- function start_presentation()
- {
- return '' . "\n"
- . 'question->selectDescription() . "]]>\n";
- }
-
- /**
- * End the part, opened by export_header.
- *
- * @author Amand Tihon
- */
- function end_presentation()
- {
- return "\n";
- }
-
- /**
- * Start the response processing, and declare the default variable, SCORE, at 0 in the outcomes.
- *
- * @author Amand Tihon
- */
- function start_processing()
- {
- return '' . "\n";
- }
-
- /**
- * End the response processing part.
- *
- * @author Amand Tihon
- */
- function end_processing()
- {
- return "\n";
- }
-
-
- /**
- * Export the question as a SCORM Item.
- *
- * This is a default behaviour, some classes may want to override this.
- *
- * @param $standalone: Boolean stating if it should be exported as a stand-alone question
- * @return A string, the XML flow for an Item.
- * @author Amand Tihon
- */
- function export($standalone = False)
- {
- global $charset;
- $head = $foot = "";
-
- if( $standalone )
+ function export_questions()
+ {
+ $js = $html = "";
+ foreach ($this->exercise->selectQuestionList() as $q)
{
- $head = '' . "\n"
- . '' . "\n"
- . "\n";
- $foot = "\n";
+ list($jstmp,$htmltmp)= export_question($q, false);
+ $js .= $jstmp."\n";
+ $html .= $htmltmp."
";
}
-
- return $head
- . $this->start_item()
- . $this->start_presentation()
- . $this->answer->imsExportResponses($this->questionIdent)
- . $this->end_presentation()
- . $this->start_processing()
- . $this->answer->imsExportProcessing($this->questionIdent)
- . $this->end_processing()
- . $this->answer->imsExportFeedback($this->questionIdent)
- . $this->end_item()
- . $foot;
- }
+ return array($js,$html);
+ }
}
-
/*--------------------------------------------------------
Functions
--------------------------------------------------------*/
@@ -535,8 +476,8 @@ function export_question($questionId, $standalone=true)
$question->weighting=$qst->weighting;
$question->position=$qst->position;
$question->picture=$qst->picture;
- $assessmentItem = new ScormAssessmentItem($question);
+ $assessmentItem = new ScormAssessmentItem($question,$standalone);
//echo "".print_r($scorm,1)."
";exit;
- return $assessmentItem->export($standalone);
+ return $assessmentItem->export();
}
?>
\ No newline at end of file