4 require_once
'Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php';
28 parent::__construct($a_title, $a_postvar);
38 $this->pairs = array();
39 $this->terms = array();
40 $this->definitions = array();
41 if (is_array($a_value)) {
42 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php";
43 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
44 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
45 if (is_array($a_value[
'term'])) {
46 foreach ($a_value[
'term'] as $idx => $term) {
50 $term_ids = explode(
",", $a_value[
'term_id']);
51 foreach ($term_ids as
$id) {
54 $definition_ids = explode(
",", $a_value[
'definition_id']);
55 foreach ($definition_ids as $id) {
68 $this->terms = $a_terms;
78 $this->definitions = $a_definitions;
88 $this->pairs = $a_pairs;
98 $this->allowMove = $a_allow_move;
125 if (is_array($foundvalues)) {
127 if (is_array($foundvalues[
'term'])) {
128 foreach ($foundvalues[
'term'] as $val) {
134 foreach ($foundvalues[
'definition'] as $val) {
141 foreach ($foundvalues[
'points'] as $val) {
151 $this->
setAlert(
$lng->txt(
"enter_enough_positive_points"));
179 $tpl =
new ilTemplate(
"tpl.prop_matchingpairinput.html",
true,
true,
"Modules/TestQuestionPool");
182 foreach ($this->pairs as $pair) {
184 $tpl->setCurrentBlock(
"option_term");
186 $tpl->setVariable(
"VALUE_OPTION", 0);
187 $tpl->parseCurrentBlock();
188 foreach ($this->terms as $term) {
189 $tpl->setCurrentBlock(
"option_term");
191 $tpl->setVariable(
"TEXT_OPTION",
$lng->txt(
'term') .
" " . $counter);
192 if ($pair->term->identifier == $term->identifier) {
193 $tpl->setVariable(
'SELECTED_OPTION',
' selected="selected"');
195 $tpl->parseCurrentBlock();
199 $tpl->setCurrentBlock(
"option_definition");
201 $tpl->setVariable(
"VALUE_OPTION", 0);
202 $tpl->parseCurrentBlock();
203 foreach ($this->definitions as $definition) {
204 $tpl->setCurrentBlock(
"option_definition");
206 $tpl->setVariable(
"TEXT_OPTION",
$lng->txt(
'definition') .
" " . $counter);
207 if ($pair->definition->identifier == $definition->identifier) {
208 $tpl->setVariable(
'SELECTED_OPTION',
' selected="selected"');
210 $tpl->parseCurrentBlock();
214 if (strlen($pair->points)) {
215 $tpl->setCurrentBlock(
'points_value');
216 $tpl->setVariable(
'POINTS_VALUE', $pair->points);
217 $tpl->parseCurrentBlock();
220 $tpl->setCurrentBlock(
"move");
221 $tpl->setVariable(
"CMD_UP",
"cmd[up" . $this->
getFieldId() .
"][$i]");
222 $tpl->setVariable(
"CMD_DOWN",
"cmd[down" . $this->
getFieldId() .
"][$i]");
226 $tpl->parseCurrentBlock();
229 $tpl->setCurrentBlock(
"row");
230 $tpl->setVariable(
"ROW_NUMBER",
$i);
233 $tpl->setVariable(
"CMD_ADD",
"cmd[add" . $this->
getFieldId() .
"][$i]");
234 $tpl->setVariable(
"CMD_REMOVE",
"cmd[remove" . $this->
getFieldId() .
"][$i]");
240 $tpl->parseCurrentBlock();
245 $tpl->setCurrentBlock(
'term_ids');
247 foreach ($this->terms as $term) {
248 array_push($ids, $term->identifier);
251 $tpl->setVariable(
"TERM_IDS", join(
",", $ids));
252 $tpl->parseCurrentBlock();
254 $tpl->setCurrentBlock(
'definition_ids');
256 foreach ($this->definitions as $definition) {
257 array_push($ids, $definition->identifier);
260 $tpl->setVariable(
"DEFINITION_IDS", join(
",", $ids));
261 $tpl->parseCurrentBlock();
264 $tpl->setVariable(
"TEXT_POINTS",
$lng->txt(
'points'));
265 $tpl->setVariable(
"TEXT_DEFINITION",
$lng->txt(
'definition'));
266 $tpl->setVariable(
"TEXT_TERM",
$lng->txt(
'term'));
267 $tpl->setVariable(
"TEXT_ACTIONS",
$lng->txt(
'actions'));
269 $a_tpl->setCurrentBlock(
"prop_generic");
270 $a_tpl->setVariable(
"PROP_GENERIC",
$tpl->get());
271 $a_tpl->parseCurrentBlock();
275 $tpl->addJavascript(
"./Services/Form/js/ServiceFormWizardInput.js");
276 $tpl->addJavascript(
"./Modules/TestQuestionPool/templates/default/matchingpairwizard.js");
Class for matching question terms.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
Class for matching question pairs.
if(!array_key_exists('StateId', $_REQUEST)) $id
static get($a_glyph, $a_text="")
Get glyph html.
special template class to simplify handling of ITX/PEAR
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
This class represents a text property in a property form.
Class for matching question definitions.