46 $this->pairs = array();
47 $this->terms = array();
48 $this->definitions = array();
49 if (is_array($a_value)) {
50 if (isset($a_value[
'term']) && is_array($a_value[
'term'])) {
51 foreach ($a_value[
'term'] as $idx => $term) {
55 (
float) $a_value[
'points'][$idx]
59 $term_ids = explode(
",", $a_value[
'term_id']);
60 foreach ($term_ids as
$id) {
63 $definition_ids = explode(
",", $a_value[
'definition_id']);
64 foreach ($definition_ids as $id) {
77 $this->terms = $a_terms;
87 $this->definitions = $a_definitions;
97 $this->pairs = $a_pairs;
107 $this->allowMove = $a_allow_move;
134 if (is_array($foundvalues)) {
136 if (isset($foundvalues[
'term']) && is_array($foundvalues[
'term'])) {
137 foreach ($foundvalues[
'term'] as $val) {
143 foreach ($foundvalues[
'definition'] as $val) {
150 foreach ($foundvalues[
'points'] as $val) {
151 if ($this->
getRequired() && (strlen($val)) === 0) {
155 $val = str_replace(
",",
".", $val);
156 if (!is_numeric($val)) {
194 $global_tpl->addJavascript(
"./Services/Form/js/ServiceFormWizardInput.js");
195 $global_tpl->addJavascript(
"./Modules/TestQuestionPool/templates/default/matchingpairwizard.js");
197 $tpl =
new ilTemplate(
"tpl.prop_matchingpairinput.html",
true,
true,
"Modules/TestQuestionPool");
200 foreach ($this->pairs as $pair) {
202 $tpl->setCurrentBlock(
"option_term");
204 $tpl->setVariable(
"VALUE_OPTION", 0);
205 $tpl->parseCurrentBlock();
206 foreach ($this->terms as $term) {
207 $tpl->setCurrentBlock(
"option_term");
209 $tpl->setVariable(
"TEXT_OPTION",
$lng->
txt(
'term') .
" " . $counter);
210 if ($pair->getTerm()->getIdentifier() == $term->getIdentifier()) {
211 $tpl->setVariable(
'SELECTED_OPTION',
' selected="selected"');
213 $tpl->parseCurrentBlock();
217 $tpl->setCurrentBlock(
"option_definition");
219 $tpl->setVariable(
"VALUE_OPTION", 0);
220 $tpl->parseCurrentBlock();
221 foreach ($this->definitions as $definition) {
222 $tpl->setCurrentBlock(
"option_definition");
224 $tpl->setVariable(
"TEXT_OPTION",
$lng->
txt(
'definition') .
" " . $counter);
225 if ($pair->getDefinition()->getIdentifier() == $definition->getIdentifier()) {
226 $tpl->setVariable(
'SELECTED_OPTION',
' selected="selected"');
228 $tpl->parseCurrentBlock();
233 $tpl->setCurrentBlock(
'points_value');
234 $tpl->setVariable(
'POINTS_VALUE', $pair->getPoints());
235 $tpl->parseCurrentBlock();
238 $tpl->setCurrentBlock(
"move");
239 $tpl->setVariable(
"CMD_UP",
"cmd[up" . $this->
getFieldId() .
"][$i]");
240 $tpl->setVariable(
"CMD_DOWN",
"cmd[down" . $this->
getFieldId() .
"][$i]");
244 $tpl->parseCurrentBlock();
247 $tpl->setCurrentBlock(
"row");
248 $tpl->setVariable(
"ROW_NUMBER",
$i);
251 $tpl->setVariable(
"CMD_ADD",
"cmd[add" . $this->
getFieldId() .
"][$i]");
252 $tpl->setVariable(
"CMD_REMOVE",
"cmd[remove" . $this->
getFieldId() .
"][$i]");
258 $tpl->parseCurrentBlock();
263 $tpl->setCurrentBlock(
'term_ids');
265 foreach ($this->terms as $term) {
266 array_push($ids, $term->getIdentifier());
269 $tpl->setVariable(
"TERM_IDS", join(
",", $ids));
270 $tpl->parseCurrentBlock();
272 $tpl->setCurrentBlock(
'definition_ids');
274 foreach ($this->definitions as $definition) {
275 array_push($ids, $definition->getIdentifier());
278 $tpl->setVariable(
"DEFINITION_IDS", join(
",", $ids));
279 $tpl->parseCurrentBlock();
282 $tpl->setVariable(
"TEXT_POINTS",
$lng->
txt(
'points'));
283 $tpl->setVariable(
"TEXT_DEFINITION",
$lng->
txt(
'definition'));
285 $tpl->setVariable(
"TEXT_ACTIONS",
$lng->
txt(
'actions'));
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static stripSlashesRecursive($a_data, bool $a_strip_html=true, string $a_allow="")
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static get(string $a_glyph, string $a_text="")
setVariable($variable, $value='')
Sets a variable value.
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
__construct(Container $dic, ilPlugin $plugin)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl