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;
124 if (is_array($foundvalues)) {
126 if (is_array($foundvalues[
'term'])) {
127 foreach ($foundvalues[
'term'] as $val) {
129 $this->
setAlert($lng->txt(
"msg_input_is_required"));
133 foreach ($foundvalues[
'definition'] as $val) {
135 $this->
setAlert($lng->txt(
"msg_input_is_required"));
140 foreach ($foundvalues[
'points'] as $val) {
145 $this->
setAlert($lng->txt(
"msg_input_is_required"));
150 $this->
setAlert($lng->txt(
"enter_enough_positive_points"));
155 $this->
setAlert($lng->txt(
"msg_input_is_required"));
161 $this->
setAlert($lng->txt(
"msg_input_is_required"));
177 $tpl =
new ilTemplate(
"tpl.prop_matchingpairinput.html",
true,
true,
"Modules/TestQuestionPool");
180 foreach ($this->pairs as $pair) {
182 $tpl->setCurrentBlock(
"option_term");
184 $tpl->setVariable(
"VALUE_OPTION", 0);
185 $tpl->parseCurrentBlock();
186 foreach ($this->terms as $term) {
187 $tpl->setCurrentBlock(
"option_term");
189 $tpl->setVariable(
"TEXT_OPTION", $lng->txt(
'term') .
" " .
$counter);
190 if ($pair->term->identifier == $term->identifier) {
191 $tpl->setVariable(
'SELECTED_OPTION',
' selected="selected"');
193 $tpl->parseCurrentBlock();
197 $tpl->setCurrentBlock(
"option_definition");
199 $tpl->setVariable(
"VALUE_OPTION", 0);
200 $tpl->parseCurrentBlock();
201 foreach ($this->definitions as $definition) {
202 $tpl->setCurrentBlock(
"option_definition");
204 $tpl->setVariable(
"TEXT_OPTION", $lng->txt(
'definition') .
" " .
$counter);
205 if ($pair->definition->identifier == $definition->identifier) {
206 $tpl->setVariable(
'SELECTED_OPTION',
' selected="selected"');
208 $tpl->parseCurrentBlock();
212 if (strlen($pair->points)) {
213 $tpl->setCurrentBlock(
'points_value');
214 $tpl->setVariable(
'POINTS_VALUE', $pair->points);
215 $tpl->parseCurrentBlock();
218 $tpl->setCurrentBlock(
"move");
219 $tpl->setVariable(
"CMD_UP",
"cmd[up" . $this->
getFieldId() .
"][$i]");
220 $tpl->setVariable(
"CMD_DOWN",
"cmd[down" . $this->
getFieldId() .
"][$i]");
224 $tpl->parseCurrentBlock();
227 $tpl->setCurrentBlock(
"row");
228 $tpl->setVariable(
"ROW_NUMBER",
$i);
231 $tpl->setVariable(
"CMD_ADD",
"cmd[add" . $this->
getFieldId() .
"][$i]");
232 $tpl->setVariable(
"CMD_REMOVE",
"cmd[remove" . $this->
getFieldId() .
"][$i]");
238 $tpl->parseCurrentBlock();
243 $tpl->setCurrentBlock(
'term_ids');
245 foreach ($this->terms as $term) {
246 array_push($ids, $term->identifier);
249 $tpl->setVariable(
"TERM_IDS", join($ids,
","));
250 $tpl->parseCurrentBlock();
252 $tpl->setCurrentBlock(
'definition_ids');
254 foreach ($this->definitions as $definition) {
255 array_push($ids, $definition->identifier);
258 $tpl->setVariable(
"DEFINITION_IDS", join($ids,
","));
259 $tpl->parseCurrentBlock();
262 $tpl->setVariable(
"TEXT_POINTS", $lng->txt(
'points'));
263 $tpl->setVariable(
"TEXT_DEFINITION", $lng->txt(
'definition'));
264 $tpl->setVariable(
"TEXT_TERM", $lng->txt(
'term'));
265 $tpl->setVariable(
"TEXT_ACTIONS", $lng->txt(
'actions'));
267 $a_tpl->setCurrentBlock(
"prop_generic");
268 $a_tpl->setVariable(
"PROP_GENERIC",
$tpl->get());
269 $a_tpl->parseCurrentBlock();
272 $tpl->addJavascript(
"./Services/Form/js/ServiceFormWizardInput.js");
273 $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.
Create styles array
The data for the language used.
Class for matching question definitions.