4require_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))
 
   43                        include_once 
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php";
 
   44                        include_once 
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
 
   45                        include_once 
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
 
   46                        if (is_array($a_value[
'term']))
 
   48                                foreach ($a_value[
'term'] as $idx => $term)
 
   53                        $term_ids = split(
",", $a_value[
'term_id']);
 
   54                        foreach ($term_ids as $id)
 
   58                        $definition_ids = split(
",", $a_value[
'definition_id']);
 
   59                        foreach ($definition_ids as $id)
 
   73                $this->terms = $a_terms;
 
   83                $this->definitions = $a_definitions;
 
   93                $this->pairs = $a_pairs;
 
  103                $this->allowMove = $a_allow_move;
 
  127                if (is_array($foundvalues))
 
  130                        if (is_array($foundvalues[
'term']))
 
  132                                foreach ($foundvalues[
'term'] as $val)
 
  136                                                $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  140                                foreach ($foundvalues[
'definition'] as $val)
 
  144                                                $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  149                                foreach ($foundvalues[
'points'] as $val)
 
  151                                        if ($val > 0) $max += $val;
 
  154                                                $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  160                                        $this->
setAlert($lng->txt(
"enter_enough_positive_points"));
 
  168                                        $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  177                                $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  193                $tpl = 
new ilTemplate(
"tpl.prop_matchingpairinput.html", 
true, 
true, 
"Modules/TestQuestionPool");
 
  196                foreach ($this->pairs as $pair)
 
  199                        $tpl->setCurrentBlock(
"option_term");
 
  201                        $tpl->setVariable(
"VALUE_OPTION", 0);
 
  202                        $tpl->parseCurrentBlock();
 
  203                        foreach ($this->terms as $term)
 
  205                                $tpl->setCurrentBlock(
"option_term");
 
  207                                $tpl->setVariable(
"TEXT_OPTION", 
$lng->txt(
'term') . 
" " . $counter);
 
  208                                if ($pair->term->identifier == $term->identifier) 
$tpl->setVariable(
'SELECTED_OPTION', 
' selected="selected"');
 
  209                                $tpl->parseCurrentBlock();
 
  213                        $tpl->setCurrentBlock(
"option_definition");
 
  215                        $tpl->setVariable(
"VALUE_OPTION", 0);
 
  216                        $tpl->parseCurrentBlock();
 
  217                        foreach ($this->definitions as $definition)
 
  219                                $tpl->setCurrentBlock(
"option_definition");
 
  221                                $tpl->setVariable(
"TEXT_OPTION", 
$lng->txt(
'definition') . 
" " . $counter);
 
  222                                if ($pair->definition->identifier == $definition->identifier) 
$tpl->setVariable(
'SELECTED_OPTION', 
' selected="selected"');
 
  223                                $tpl->parseCurrentBlock();
 
  227                        if (strlen($pair->points))
 
  229                                $tpl->setCurrentBlock(
'points_value');
 
  230                                $tpl->setVariable(
'POINTS_VALUE', $pair->points);
 
  231                                $tpl->parseCurrentBlock();
 
  235                                $tpl->setCurrentBlock(
"move");
 
  236                                $tpl->setVariable(
"CMD_UP", 
"cmd[up" . $this->
getFieldId() . 
"][$i]");
 
  237                                $tpl->setVariable(
"CMD_DOWN", 
"cmd[down" . $this->
getFieldId() . 
"][$i]");
 
  241                                $tpl->parseCurrentBlock();
 
  244                        $tpl->setCurrentBlock(
"row");
 
  245                        $tpl->setVariable(
"ROW_NUMBER", $i);
 
  248                        $tpl->setVariable(
"CMD_ADD", 
"cmd[add" . $this->
getFieldId() . 
"][$i]");
 
  249                        $tpl->setVariable(
"CMD_REMOVE", 
"cmd[remove" . $this->
getFieldId() . 
"][$i]");
 
  255                        $tpl->parseCurrentBlock();
 
  260                $tpl->setCurrentBlock(
'term_ids');
 
  262                foreach ($this->terms as $term)
 
  264                        array_push($ids, $term->identifier);
 
  267                $tpl->setVariable(
"TERM_IDS", join($ids, 
","));
 
  268                $tpl->parseCurrentBlock();
 
  270                $tpl->setCurrentBlock(
'definition_ids');
 
  272                foreach ($this->definitions as $definition)
 
  274                        array_push($ids, $definition->identifier);
 
  277                $tpl->setVariable(
"DEFINITION_IDS", join($ids, 
","));
 
  278                $tpl->parseCurrentBlock();
 
  281                $tpl->setVariable(
"TEXT_POINTS", $lng->txt(
'points'));
 
  282                $tpl->setVariable(
"TEXT_DEFINITION", 
$lng->txt(
'definition'));
 
  283                $tpl->setVariable(
"TEXT_TERM", 
$lng->txt(
'term'));
 
  284                $tpl->setVariable(
"TEXT_ACTIONS", 
$lng->txt(
'actions'));
 
  286                $a_tpl->setCurrentBlock(
"prop_generic");
 
  287                $a_tpl->setVariable(
"PROP_GENERIC", 
$tpl->get());
 
  288                $a_tpl->parseCurrentBlock();
 
  291                $tpl->addJavascript(
"./Services/Form/js/ServiceFormWizardInput.js");
 
  292                $tpl->addJavascript(
"./Modules/TestQuestionPool/templates/default/matchingpairwizard.js");
 
Class for matching question definitions.
Class for matching question pairs.
Class for matching question terms.
static get($a_glyph, $a_text="")
Get glyph html.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public