From 4262494a993c3901c9e984632c0a42de72378abd Mon Sep 17 00:00:00 2001 From: gbateson Date: Thu, 19 Jun 2008 05:59:58 +0000 Subject: [PATCH] allow and other tags in LHS of JMatch in "v6" output format --- mod/hotpot/template/v6.php | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/mod/hotpot/template/v6.php b/mod/hotpot/template/v6.php index 6db415dee1..56ed581cbd 100644 --- a/mod/hotpot/template/v6.php +++ b/mod/hotpot/template/v6.php @@ -429,19 +429,19 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default { $options = ''; foreach ($r_keys as $key) { - if (empty($r_items[$key]['fixed'][0]['#'])) { - $options .= ''."\n"; + if (empty($r_items[$key]['fixed'])) { + $options .= ''."\n"; } } $str = ''; foreach ($l_keys as $key) { - $str .= ''.$l_items[$key]['text'][0]['#'].''; + $str .= ''.$l_items[$key]['text'].''; $str .= ''; - if (empty($r_items[$key]['fixed'][0]['#'])) { + if (empty($r_items[$key]['fixed'])) { $str .= ''; } else { - $str .= $r_items[$key]['text'][0]['#']; + $str .= $r_items[$key]['text']; } $str .= ''; } @@ -718,7 +718,7 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default { $str = ''; foreach ($l_items as $i=>$item) { $str .= "F[$i] = new Array();\n"; - $str .= "F[$i][0] = '".$this->js_safe($item['text'][0]['#'], true)."';\n"; + $str .= "F[$i][0] = '".$this->js_safe($item['text'], true)."';\n"; $str .= "F[$i][1] = ".($i+1).";\n"; } return $str; @@ -731,9 +731,9 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default { $str = ''; foreach ($r_items as $i=>$item) { $str .= "D[$i] = new Array();\n"; - $str .= "D[$i][0] = '".$this->js_safe($item['text'][0]['#'], true)."';\n"; + $str .= "D[$i][0] = '".$this->js_safe($item['text'], true)."';\n"; $str .= "D[$i][1] = ".($i+1).";\n"; - $str .= "D[$i][2] = '".(empty($item['fixed'][0]['#']) ? 0 : 1)."';\n"; + $str .= "D[$i][2] = '".(empty($item['fixed']) ? 0 : 1)."';\n"; } return $str; } @@ -741,16 +741,18 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default { function get_jmatch_items(&$l_items, &$r_items) { $tags = 'data,matching-exercise,pair'; $i = 0; - while($item = $this->parent->xml_value($tags,"[$i]['#']['left-item'][0]['#']")) { - if (!empty($item['text'][0]['#'])) { - $l_items[] = $item; + while($this->parent->xml_value($tags,"[$i]['#']['left-item'][0]['#']")) { + if ($text = $this->parent->xml_value($tags,"[$i]['#']['left-item'][0]['#']['text'][0]['#']")) { + $fixed = $this->parent->xml_value($tags,"[$i]['#']['left-item'][0]['#']['fixed'][0]['#']"); + $l_items[] = array('text'=>$text, 'fixed'=>$fixed); } $i++; } $i = 0; - while($item = $this->parent->xml_value($tags,"[$i]['#']['right-item'][0]['#']")) { - if (!empty($item['text'][0]['#'])) { - $r_items[] = $item; + while($this->parent->xml_value($tags,"[$i]['#']['right-item'][0]['#']")) { + if ($text = $this->parent->xml_value($tags,"[$i]['#']['right-item'][0]['#']['text'][0]['#']")) { + $fixed = $this->parent->xml_value($tags,"[$i]['#']['right-item'][0]['#']['fixed'][0]['#']"); + $r_items[] = array('text'=>$text, 'fixed'=>$fixed); } $i++; } @@ -759,7 +761,7 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default { // get moveable items $moveable_keys = array(); for($i=0; $i