|
|
|
|
@ -11,7 +11,6 @@ use Chamilo\CoreBundle\Component\Utils\ChamiloApi; |
|
|
|
|
* @author Yannick Warnier <yannick.warnier@beeznest.com> |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Unzip the exercise in the temp folder |
|
|
|
|
* @param string The path of the temporary directory where the exercise was uploaded and unzipped |
|
|
|
|
@ -427,13 +426,13 @@ function startElementQti2($parser, $name, $attributes) |
|
|
|
|
|
|
|
|
|
switch ($current_element) { |
|
|
|
|
case 'ASSESSMENTITEM': |
|
|
|
|
//retrieve current question |
|
|
|
|
// retrieve current question |
|
|
|
|
$current_question_ident = $attributes['IDENTIFIER']; |
|
|
|
|
$exercise_info['question'][$current_question_ident] = array(); |
|
|
|
|
$exercise_info['question'][$current_question_ident]['answer'] = array(); |
|
|
|
|
$exercise_info['question'][$current_question_ident]['correct_answers'] = array(); |
|
|
|
|
$exercise_info['question'][$current_question_ident]['title'] = $attributes['TITLE']; |
|
|
|
|
$exercise_info['question'][$current_question_ident]['category'] = $attributes['CATEGORY']; |
|
|
|
|
$exercise_info['question'][$current_question_ident] = []; |
|
|
|
|
$exercise_info['question'][$current_question_ident]['answer'] = []; |
|
|
|
|
$exercise_info['question'][$current_question_ident]['correct_answers'] = []; |
|
|
|
|
$exercise_info['question'][$current_question_ident]['title'] = isset($attributes['TITLE']) ? $attributes['TITLE'] : ''; |
|
|
|
|
$exercise_info['question'][$current_question_ident]['category'] = isset($attributes['CATEGORY']) ? $attributes['CATEGORY'] : ''; |
|
|
|
|
$exercise_info['question'][$current_question_ident]['tempdir'] = $questionTempDir; |
|
|
|
|
break; |
|
|
|
|
case 'SECTION': |
|
|
|
|
@ -444,11 +443,11 @@ function startElementQti2($parser, $name, $attributes) |
|
|
|
|
break; |
|
|
|
|
case 'RESPONSEDECLARATION': |
|
|
|
|
// Retrieve question type |
|
|
|
|
if ("multiple" == $attributes['CARDINALITY']) { |
|
|
|
|
if ('multiple' == $attributes['CARDINALITY']) { |
|
|
|
|
$exercise_info['question'][$current_question_ident]['type'] = MCMA; |
|
|
|
|
$cardinality = 'multiple'; |
|
|
|
|
} |
|
|
|
|
if ("single" == $attributes['CARDINALITY']) { |
|
|
|
|
if ('single' == $attributes['CARDINALITY']) { |
|
|
|
|
$exercise_info['question'][$current_question_ident]['type'] = MCUA; |
|
|
|
|
$cardinality = 'single'; |
|
|
|
|
} |
|
|
|
|
@ -540,21 +539,20 @@ function endElementQti2($parser, $name) |
|
|
|
|
if (sizeof($element_pile) >= 2) { |
|
|
|
|
$parent_element = $element_pile[sizeof($element_pile) - 2]; |
|
|
|
|
} else { |
|
|
|
|
$parent_element = ""; |
|
|
|
|
$parent_element = ''; |
|
|
|
|
} |
|
|
|
|
if (sizeof($element_pile) >= 3) { |
|
|
|
|
$grand_parent_element = $element_pile[sizeof($element_pile) - 3]; |
|
|
|
|
} else { |
|
|
|
|
$grand_parent_element = ""; |
|
|
|
|
$grand_parent_element = ''; |
|
|
|
|
} |
|
|
|
|
if (sizeof($element_pile) >= 4) { |
|
|
|
|
$great_grand_parent_element = $element_pile[sizeof($element_pile) - 4]; |
|
|
|
|
} else { |
|
|
|
|
$great_grand_parent_element = ""; |
|
|
|
|
$great_grand_parent_element = ''; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//treat the record of the full content of itembody tag : |
|
|
|
|
|
|
|
|
|
//treat the record of the full content of itembody tag: |
|
|
|
|
if ($record_item_body && (!in_array($current_element, $non_HTML_tag_to_avoid))) { |
|
|
|
|
$current_question_item_body .= "</".$name.">"; |
|
|
|
|
} |
|
|
|
|
@ -595,17 +593,17 @@ function elementDataQti2($parser, $data) |
|
|
|
|
if (sizeof($element_pile) >= 2) { |
|
|
|
|
$parent_element = $element_pile[sizeof($element_pile) - 2]; |
|
|
|
|
} else { |
|
|
|
|
$parent_element = ""; |
|
|
|
|
$parent_element = ''; |
|
|
|
|
} |
|
|
|
|
if (sizeof($element_pile) >= 3) { |
|
|
|
|
$grand_parent_element = $element_pile[sizeof($element_pile) - 3]; |
|
|
|
|
} else { |
|
|
|
|
$grand_parent_element = ""; |
|
|
|
|
$grand_parent_element = ''; |
|
|
|
|
} |
|
|
|
|
if (sizeof($element_pile) >= 4) { |
|
|
|
|
$great_grand_parent_element = $element_pile[sizeof($element_pile) - 4]; |
|
|
|
|
} else { |
|
|
|
|
$great_grand_parent_element = ""; |
|
|
|
|
$great_grand_parent_element = ''; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//treat the record of the full content of itembody tag (needed for question statment and/or FIB text: |
|
|
|
|
@ -1076,9 +1074,9 @@ function qtiProcessManifest($filePath) |
|
|
|
|
$specialHref = Database::escape_string(preg_replace('/_/', '-', strtolower($href))); |
|
|
|
|
$specialHref = preg_replace('/(-){2,8}/', '-', $specialHref); |
|
|
|
|
|
|
|
|
|
$sql = "SELECT iid FROM ".$tableDocuments." |
|
|
|
|
$sql = "SELECT iid FROM $tableDocuments |
|
|
|
|
WHERE |
|
|
|
|
c_id = " . $course['real_id']." AND |
|
|
|
|
c_id = ".$course['real_id']." AND |
|
|
|
|
session_id = $sessionId AND |
|
|
|
|
path = '/".$specialHref."'"; |
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
|