24 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
43 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyMatrixQuestion.php";
63 "0" =>
"matrix_subtype_sr",
64 "1" =>
"matrix_subtype_mr",
71 foreach ($subtypes as $idx => $st)
73 $subtype->addOption(
new ilRadioOption($this->lng->txt($st), $idx));
79 $header->setTitle($this->lng->txt(
"matrix_appearance"));
83 $column_separators =
new ilCheckboxInputGUI($this->lng->txt(
"matrix_column_separators"),
"column_separators");
85 $column_separators->setInfo($this->lng->txt(
"matrix_column_separators_description"));
86 $column_separators->setRequired(
false);
87 $a_form->
addItem($column_separators);
90 $row_separators =
new ilCheckboxInputGUI($this->lng->txt(
"matrix_row_separators"),
"row_separators");
92 $row_separators->setInfo($this->lng->txt(
"matrix_row_separators_description"));
93 $row_separators->setRequired(
false);
94 $a_form->
addItem($row_separators);
97 $neutral_column_separator =
new ilCheckboxInputGUI($this->lng->txt(
"matrix_neutral_column_separator"),
"neutral_column_separator");
98 $neutral_column_separator->
setValue(1);
99 $neutral_column_separator->setInfo($this->lng->txt(
"matrix_neutral_column_separator_description"));
100 $neutral_column_separator->setRequired(
false);
101 $a_form->
addItem($neutral_column_separator);
105 $header->setTitle($this->lng->txt(
"matrix_columns"));
109 include_once
"./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php";
114 $columns->setShowNeutralCategory(
true);
116 $columns->setNeutralCategoryTitle($this->lng->txt(
'matrix_neutral_answer'));
117 $columns->setCategoryText($this->lng->txt(
'matrix_standard_answers'));
123 $header->setTitle($this->lng->txt(
"matrix_column_settings"));
127 $bipolar =
new ilCustomInputGUI($this->lng->txt(
"matrix_bipolar_adjectives"));
128 $bipolar->
setInfo($this->lng->txt(
"matrix_bipolar_adjectives_description"));
131 $bipolar1 =
new ilTextInputGUI($this->lng->txt(
"matrix_left_pole"),
"bipolar1");
133 $bipolar->addSubItem($bipolar1);
136 $bipolar2 =
new ilTextInputGUI($this->lng->txt(
"matrix_right_pole"),
"bipolar2");
138 $bipolar->addSubItem($bipolar2);
144 $header->setTitle($this->lng->txt(
"matrix_rows"));
148 include_once
"./Modules/SurveyQuestionPool/classes/class.ilMatrixRowWizardInputGUI.php";
150 $rows->setRequired(
false);
151 $rows->setAllowMove(
true);
152 $rows->setLabelText($this->lng->txt(
'label'));
153 $rows->setUseOtherAnswer(
true);
158 $subtype->setValue($this->
object->getSubtype());
159 $column_separators->setChecked($this->
object->getColumnSeparators());
160 $row_separators->setChecked($this->
object->getRowSeparators());
161 $neutral_column_separator->setChecked($this->
object->getNeutralColumnSeparator());
163 if (!$this->
object->getColumnCount())
165 $this->
object->columns->addCategory(
"");
169 $bipolar1->setValue($this->
object->getBipolarAdjective(0));
170 $bipolar2->setValue($this->
object->getBipolarAdjective(1));
172 if ($this->
object->getRowCount() == 0)
174 $this->
object->getRows()->addCategory(
"");
176 $rows->setValues($this->
object->getRows());
181 $this->
object->setSubtype($a_form->
getInput(
"type"));
182 $this->
object->setRowSeparators($a_form->
getInput(
"row_separators") ? 1 : 0);
183 $this->
object->setColumnSeparators($a_form->
getInput(
"column_separators") ? 1 : 0);
184 $this->
object->setNeutralColumnSeparator($a_form->
getInput(
"neutral_column_separator") ? 1 : 0);
187 $this->
object->setBipolarAdjective(0, $a_form->
getInput(
"bipolar1"));
188 $this->
object->setBipolarAdjective(1, $a_form->
getInput(
"bipolar2"));
191 $this->
object->flushColumns();
193 foreach (
$_POST[
'columns'][
'answer'] as $key => $value)
195 if (strlen($value)) $this->
object->getColumns()->addCategory($value,
$_POST[
'columns'][
'other'][$key], 0, null,
$_POST[
'columns'][
'scale'][$key]);
197 if (strlen(
$_POST[
"columns"][
"neutral"]))
199 $this->
object->getColumns()->addCategory(
$_POST[
'columns'][
'neutral'], 0, 1, null,
$_POST[
'columns_neutral_scale']);
203 $this->
object->flushRows();
204 foreach (
$_POST[
'rows'][
'answer'] as $key => $value)
206 if (strlen($value)) $this->
object->getRows()->addCategory($value,
$_POST[
'rows'][
'other'][$key], 0,
$_POST[
'rows'][
'label'][$key]);
212 if(is_array($a_working_data))
214 $user_answers = $a_working_data;
218 for ($i = 0; $i < $this->
object->getRowCount(); $i++)
220 $rowobj = $this->
object->getRow($i);
225 for ($j = 0; $j < $this->
object->getColumnCount(); $j++)
227 $cat = $this->
object->getColumn($j);
228 $value = ($cat->scale) ? ($cat->scale - 1) : $j;
230 $checked =
"unchecked";
231 if(is_array($a_working_data))
233 foreach($user_answers as $user_answer)
235 if($user_answer[
"rowvalue"] == $i &&
236 $user_answer[
"value"] == $value)
238 $checked =
"checked";
239 if($user_answer[
"textanswer"])
241 $text = $user_answer[
"textanswer"];
247 if(!$a_only_user_anwers || $checked ==
"checked")
249 $cols[$value] =
array(
250 "title" => trim($cat->title)
251 ,
"neutral" => (
bool)$cat->neutral
252 ,
"checked" => $checked
257 if($a_only_user_anwers ||
sizeof($cols) ||
$text)
261 "title" => trim($rowobj->title)
262 ,
"other" => (
bool)$rowobj->other
263 ,
"textanswer" =>
$text 277 function getPrintView($question_title = 1, $show_questiontext = 1, $survey_id = null,
array $a_working_data = null)
281 $layout = $this->
object->getLayout();
282 $neutralstyle =
"3px solid #808080";
283 $bordercolor =
"#808080";
284 $template =
new ilTemplate(
"tpl.il_svy_qpl_matrix_printview.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
286 if ($this->show_layout_row)
289 $template->setCurrentBlock(
"matrix_row");
290 $template->setVariable(
"ROW", $layout_row);
291 $template->parseCurrentBlock();
294 $tplheaders =
new ilTemplate(
"tpl.il_svy_out_matrix_columnheaders.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
295 if ((strlen($this->
object->getBipolarAdjective(0))) && (strlen($this->
object->getBipolarAdjective(1))))
297 $tplheaders->setCurrentBlock(
"bipolar_start");
299 array_push(
$style, sprintf(
"width: %.2F%s!important",
$layout[
"percent_bipolar_adjective1"],
"%"));
302 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
304 $tplheaders->parseCurrentBlock();
307 for ($i = 0; $i < $this->
object->getColumnCount(); $i++)
309 $cat = $this->
object->getColumn($i);
312 $tplheaders->setCurrentBlock(
"neutral_column_header");
314 $tplheaders->setVariable(
"CLASS",
"rsep");
316 array_push(
$style, sprintf(
"width: %.2F%s!important",
$layout[
"percent_neutral"],
"%"));
317 if ($this->
object->getNeutralColumnSeparator())
319 array_push(
$style,
"border-left: $neutralstyle!important;");
323 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
325 $tplheaders->parseCurrentBlock();
330 if ($this->
object->getColumnSeparators() == 1)
332 if (($i < $this->
object->getColumnCount() - 1))
334 array_push(
$style,
"border-right: 1px solid $bordercolor!important");
337 array_push(
$style, sprintf(
"width: %.2F%s!important",
$layout[
"percent_columns"] / $this->
object->getColumnCount(),
"%"));
338 $tplheaders->setCurrentBlock(
"column_header");
340 $tplheaders->setVariable(
"CLASS",
"center");
343 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
345 $tplheaders->parseCurrentBlock();
349 if ((strlen($this->
object->getBipolarAdjective(0))) && (strlen($this->
object->getBipolarAdjective(1))))
351 $tplheaders->setCurrentBlock(
"bipolar_end");
353 array_push(
$style, sprintf(
"width: %.2F%s!important",
$layout[
"percent_bipolar_adjective2"],
"%"));
356 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
358 $tplheaders->parseCurrentBlock();
362 array_push(
$style, sprintf(
"width: %.2F%s!important",
$layout[
"percent_row"],
"%"));
365 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
368 $template->setCurrentBlock(
"matrix_row");
369 $template->setVariable(
"ROW", $tplheaders->get());
370 $template->parseCurrentBlock();
372 $rowclass =
array(
"tblrow1",
"tblrow2");
374 for ($i = 0; $i < $this->
object->getRowCount(); $i++)
376 $rowobj = $this->
object->getRow($i);
377 $tplrow =
new ilTemplate(
"tpl.il_svy_qpl_matrix_printview_row.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
378 for ($j = 0; $j < $this->
object->getColumnCount(); $j++)
380 $cat = $this->
object->getColumn($j);
381 if (($i == 0) && ($j == 0))
383 if ((strlen($this->
object->getBipolarAdjective(0))) && (strlen($this->
object->getBipolarAdjective(1))))
385 $tplrow->setCurrentBlock(
"bipolar_start");
387 $tplrow->setVariable(
"ROWSPAN", $this->
object->getRowCount());
388 $tplrow->parseCurrentBlock();
391 if (($i == 0) && ($j == $this->
object->getColumnCount()-1))
393 if ((strlen($this->
object->getBipolarAdjective(0))) && (strlen($this->
object->getBipolarAdjective(1))))
395 $tplrow->setCurrentBlock(
"bipolar_end");
397 $tplrow->setVariable(
"ROWSPAN", $this->
object->getRowCount());
398 $tplrow->parseCurrentBlock();
402 $value = ($cat->scale) ? ($cat->scale - 1) : $j;
403 $col =
$options[$i][
"cols"][$value];
405 switch ($this->
object->getSubtype())
410 $tplrow->setCurrentBlock(
"neutral_radiobutton");
412 $tplrow->setVariable(
"ALT_RADIO", $this->lng->txt($col[
"checked"]));
413 $tplrow->setVariable(
"TITLE_RADIO", $this->lng->txt($col[
"checked"]));
414 $tplrow->parseCurrentBlock();
418 $tplrow->setCurrentBlock(
"radiobutton");
420 $tplrow->setVariable(
"ALT_RADIO", $this->lng->txt($col[
"checked"]));
421 $tplrow->setVariable(
"TITLE_RADIO", $this->lng->txt($col[
"checked"]));
422 $tplrow->parseCurrentBlock();
428 $tplrow->setCurrentBlock(
"neutral_checkbox");
430 $tplrow->setVariable(
"ALT_CHECKBOX", $this->lng->txt($col[
"checked"]));
431 $tplrow->setVariable(
"TITLE_CHECKBOX", $this->lng->txt($col[
"checked"]));
432 $tplrow->parseCurrentBlock();
436 $tplrow->setCurrentBlock(
"checkbox");
438 $tplrow->setVariable(
"ALT_CHECKBOX", $this->lng->txt($col[
"checked"]));
439 $tplrow->setVariable(
"TITLE_CHECKBOX", $this->lng->txt($col[
"checked"]));
440 $tplrow->parseCurrentBlock();
446 $tplrow->setCurrentBlock(
"neutral_answer");
448 if ($this->
object->getNeutralColumnSeparator())
450 array_push(
$style,
"border-left: $neutralstyle!important");
452 if ($this->
object->getColumnSeparators() == 1)
454 if ($j < $this->
object->getColumnCount() - 1)
456 array_push(
$style,
"border-right: 1px solid $bordercolor!important");
460 if ($this->
object->getRowSeparators() == 1)
462 if ($i < $this->
object->getRowCount() - 1)
464 array_push(
$style,
"border-bottom: 1px solid $bordercolor!important");
469 $tplrow->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
471 $tplrow->parseCurrentBlock();
475 $tplrow->setCurrentBlock(
"answer");
478 if ($this->
object->getColumnSeparators() == 1)
480 if ($j < $this->
object->getColumnCount() - 1)
482 array_push(
$style,
"border-right: 1px solid $bordercolor!important");
486 if ($this->
object->getRowSeparators() == 1)
488 if ($i < $this->
object->getRowCount() - 1)
490 array_push(
$style,
"border-bottom: 1px solid $bordercolor!important");
495 $tplrow->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
497 $tplrow->parseCurrentBlock();
504 $tplrow->setCurrentBlock(
"text_other");
505 $tplrow->setVariable(
"TEXT_OTHER",
$text 507 :
" ");
508 $tplrow->parseCurrentBlock();
511 switch ($question_title)
516 #19448 matrix rows always contains the titles.(never only labels because they are optional) 524 if(trim($rowobj->label))
526 $row_title .=
' <span class="questionLabel">('.ilUtil::prepareFormOutput($rowobj->label).
')</span>';
530 $tplrow->setVariable(
"TEXT_ROW", $row_title);
531 $tplrow->setVariable(
"ROWCLASS", $rowclass[$i % 2]);
532 if ($this->
object->getRowSeparators() == 1)
534 if ($i < $this->
object->getRowCount() - 1)
536 $tplrow->setVariable(
"STYLE",
" style=\"border-bottom: 1px solid $bordercolor!important\"");
539 $template->setCurrentBlock(
"matrix_row");
540 $template->setVariable(
"ROW", $tplrow->get());
541 $template->parseCurrentBlock();
548 $template->setCurrentBlock();
549 if ($show_questiontext)
553 $template->parseCurrentBlock();
554 return $template->get();
571 $ilTabs->activateTab(
"layout");
573 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_layout.html",
"Modules/SurveyQuestionPool");
574 $this->show_layout_row = TRUE;
576 $this->tpl->setVariable(
"QUESTION_OUTPUT", $question_output);
577 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"saveLayout"));
578 $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save"));
588 $percent_values =
array(
589 "percent_row" => (
int)
$_POST[
"percent_row"],
590 "percent_columns" => (
int)$_POST[
"percent_columns"],
591 "percent_bipolar_adjective1" => (
int)$_POST[
'percent_bipolar_adjective1'],
592 "percent_bipolar_adjective2" => (
int)$_POST[
'percent_bipolar_adjective2'],
593 "percent_neutral" => (
int)$_POST[
"percent_neutral"]
595 $this->
object->setLayout($percent_values);
598 if(array_sum($percent_values) == 100)
600 $this->
object->saveLayout($percent_values[
"percent_row"],
601 $percent_values[
'percent_columns'],
602 $percent_values[
'percent_bipolar_adjective1'],
603 $percent_values[
'percent_bipolar_adjective2'],
604 $percent_values[
"percent_neutral"]);
621 $percent_values = $this->
object->getLayout();
622 $template =
new ilTemplate(
"tpl.il_svy_out_matrix_layout.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
623 if (strlen($this->
object->getBipolarAdjective(0)) && strlen($this->
object->getBipolarAdjective(1)))
625 $template->setCurrentBlock(
"bipolar_start");
626 $template->setVariable(
"VALUE_PERCENT_BIPOLAR_ADJECTIVE1",
" value=\"" . $percent_values[
"percent_bipolar_adjective1"] .
"\"");
627 $template->setVariable(
"STYLE",
" style=\"width:" . $percent_values[
"percent_bipolar_adjective1"] .
"%\"");
628 $template->parseCurrentBlock();
629 $template->setCurrentBlock(
"bipolar_end");
630 $template->setVariable(
"VALUE_PERCENT_BIPOLAR_ADJECTIVE2",
" value=\"" . $percent_values[
"percent_bipolar_adjective2"] .
"\"");
631 $template->setVariable(
"STYLE",
" style=\"width:" . $percent_values[
"percent_bipolar_adjective2"] .
"%\"");
632 $template->parseCurrentBlock();
634 $counter = $this->
object->getColumnCount();
635 if (strlen($this->
object->hasNeutralColumn()))
637 $template->setCurrentBlock(
"neutral_start");
638 $template->setVariable(
"VALUE_PERCENT_NEUTRAL",
" value=\"" . $percent_values[
"percent_neutral"] .
"\"");
639 $template->setVariable(
"STYLE_NEUTRAL",
" style=\"width:" . $percent_values[
"percent_neutral"] .
"%\"");
640 $template->parseCurrentBlock();
643 $template->setVariable(
"VALUE_PERCENT_ROW",
" value=\"" . $percent_values[
"percent_row"] .
"\"");
644 $template->setVariable(
"STYLE_ROW",
" style=\"width:" . $percent_values[
"percent_row"] .
"%\"");
645 $template->setVariable(
"COLSPAN_COLUMNS",
$counter);
646 $template->setVariable(
"VALUE_PERCENT_COLUMNS",
" value=\"" . $percent_values[
"percent_columns"] .
"\"");
647 $template->setVariable(
"STYLE_COLUMNS",
" style=\"width:" . $percent_values[
"percent_columns"] .
"%\"");
648 return $template->get();
661 function getWorkingForm($working_data =
"", $question_title = 1, $show_questiontext = 1, $error_message =
"", $survey_id = null)
663 $layout = $this->
object->getLayout();
664 $neutralstyle =
"3px solid #808080";
665 $bordercolor =
"#808080";
666 $template =
new ilTemplate(
"tpl.il_svy_out_matrix.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
667 $template->setCurrentBlock(
"material_matrix");
669 $template->parseCurrentBlock();
671 if ($this->show_layout_row)
674 $template->setCurrentBlock(
"matrix_row");
675 $template->setVariable(
"ROW", $layout_row);
676 $template->parseCurrentBlock();
679 $tplheaders =
new ilTemplate(
"tpl.il_svy_out_matrix_columnheaders.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
680 if ((strlen($this->
object->getBipolarAdjective(0))) && (strlen($this->
object->getBipolarAdjective(1))))
682 $tplheaders->setCurrentBlock(
"bipolar_start");
684 array_push(
$style, sprintf(
"width: %.2f%s!important",
$layout[
"percent_bipolar_adjective1"],
"%"));
687 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
689 $tplheaders->parseCurrentBlock();
692 for ($i = 0; $i < $this->
object->getColumnCount(); $i++)
695 $col = $this->
object->getColumn($i);
698 $tplheaders->setCurrentBlock(
"neutral_column_header");
700 $tplheaders->setVariable(
"CLASS",
"rsep");
702 array_push(
$style, sprintf(
"width: %.2f%s!important",
$layout[
"percent_neutral"],
"%"));
703 if ($this->
object->getNeutralColumnSeparator())
705 array_push(
$style,
"border-left: $neutralstyle!important;");
709 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
711 $tplheaders->parseCurrentBlock();
715 if ($this->
object->getColumnSeparators() == 1)
717 if (($i < $this->
object->getColumnCount() - 1))
719 array_push(
$style,
"border-right: 1px solid $bordercolor!important");
722 array_push(
$style, sprintf(
"width: %.2f%s!important",
$layout[
"percent_columns"] / $this->
object->getColumnCount(),
"%"));
723 $tplheaders->setCurrentBlock(
"column_header");
725 $tplheaders->setVariable(
"CLASS",
"center");
728 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
730 $tplheaders->parseCurrentBlock();
733 if ((strlen($this->
object->getBipolarAdjective(0))) && (strlen($this->
object->getBipolarAdjective(1))))
735 $tplheaders->setCurrentBlock(
"bipolar_end");
737 array_push(
$style, sprintf(
"width: %.2f%s!important",
$layout[
"percent_bipolar_adjective2"],
"%"));
740 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
742 $tplheaders->parseCurrentBlock();
746 array_push(
$style, sprintf(
"width: %.2f%s!important",
$layout[
"percent_row"],
"%"));
749 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
752 $template->setCurrentBlock(
"matrix_row");
753 $template->setVariable(
"ROW", $tplheaders->get());
754 $template->parseCurrentBlock();
756 $rowclass =
array(
"tblrow1",
"tblrow2");
757 for ($i = 0; $i < $this->
object->getRowCount(); $i++)
759 $rowobj = $this->
object->getRow($i);
760 $tplrow =
new ilTemplate(
"tpl.il_svy_out_matrix_row.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
761 for ($j = 0; $j < $this->
object->getColumnCount(); $j++)
763 $cat = $this->
object->getColumn($j);
764 if (($i == 0) && ($j == 0))
766 if ((strlen($this->
object->getBipolarAdjective(0))) && (strlen($this->
object->getBipolarAdjective(1))))
768 $tplrow->setCurrentBlock(
"bipolar_start");
770 $tplrow->setVariable(
"ROWSPAN", $this->
object->getRowCount());
771 $tplrow->parseCurrentBlock();
774 if (($i == 0) && ($j == $this->
object->getColumnCount()-1))
776 if ((strlen($this->
object->getBipolarAdjective(0))) && (strlen($this->
object->getBipolarAdjective(1))))
778 $tplrow->setCurrentBlock(
"bipolar_end");
780 $tplrow->setVariable(
"ROWSPAN", $this->
object->getRowCount());
781 $tplrow->parseCurrentBlock();
784 switch ($this->
object->getSubtype())
789 $tplrow->setCurrentBlock(
"neutral_radiobutton");
790 $tplrow->setVariable(
"QUESTION_ID", $this->
object->getId());
791 $tplrow->setVariable(
"ROW", $i);
792 $tplrow->setVariable(
"VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
793 if (is_array($working_data))
795 foreach ($working_data as
$data)
797 if (($data[
"value"] == $cat->scale-1) && ($data[
"rowvalue"] == $i))
799 $tplrow->setVariable(
"CHECKED_RADIOBUTTON",
" checked=\"checked\"");
803 $tplrow->parseCurrentBlock();
807 $tplrow->setCurrentBlock(
"radiobutton");
808 $tplrow->setVariable(
"QUESTION_ID", $this->
object->getId());
809 $tplrow->setVariable(
"ROW", $i);
810 $tplrow->setVariable(
"VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
811 if (is_array($working_data))
813 foreach ($working_data as
$data)
815 if (($data[
"value"] == $cat->scale-1) && ($data[
"rowvalue"] == $i))
817 $tplrow->setVariable(
"CHECKED_RADIOBUTTON",
" checked=\"checked\"");
821 $tplrow->parseCurrentBlock();
827 $tplrow->setCurrentBlock(
"neutral_checkbox");
828 $tplrow->setVariable(
"QUESTION_ID", $this->
object->getId());
829 $tplrow->setVariable(
"ROW", $i);
830 $tplrow->setVariable(
"VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
831 if (is_array($working_data))
833 foreach ($working_data as
$data)
835 if (($data[
"value"] == $cat->scale-1) && ($data[
"rowvalue"] == $i))
837 $tplrow->setVariable(
"CHECKED_CHECKBOX",
" checked=\"checked\"");
841 $tplrow->parseCurrentBlock();
845 $tplrow->setCurrentBlock(
"checkbox");
846 $tplrow->setVariable(
"QUESTION_ID", $this->
object->getId());
847 $tplrow->setVariable(
"ROW", $i);
848 $tplrow->setVariable(
"VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
849 if (is_array($working_data))
851 foreach ($working_data as
$data)
853 if (($data[
"value"] == $cat->scale-1) && ($data[
"rowvalue"] == $i))
855 $tplrow->setVariable(
"CHECKED_CHECKBOX",
" checked=\"checked\"");
859 $tplrow->parseCurrentBlock();
865 $tplrow->setCurrentBlock(
"neutral_answer");
867 if ($this->
object->getNeutralColumnSeparator())
869 array_push(
$style,
"border-left: $neutralstyle!important");
871 if ($this->
object->getColumnSeparators() == 1)
873 if ($j < $this->
object->getColumnCount() - 1)
875 array_push(
$style,
"border-right: 1px solid $bordercolor!important");
881 $tplrow->setCurrentBlock(
"answer");
884 if ($this->
object->getColumnSeparators() == 1)
886 if ($j < $this->
object->getColumnCount() - 1)
888 array_push(
$style,
"border-right: 1px solid $bordercolor!important");
892 if ($this->
object->getRowSeparators() == 1)
894 if ($i < $this->
object->getRowCount() - 1)
896 array_push(
$style,
"border-bottom: 1px solid $bordercolor!important");
901 $tplrow->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
903 $tplrow->parseCurrentBlock();
908 $tplrow->setCurrentBlock(
"row_other");
909 $tplrow->setVariable(
"QUESTION_ID", $this->
object->getId());
910 $tplrow->setVariable(
"ROW", $i);
911 if (is_array($working_data))
913 foreach ($working_data as
$data)
915 if ($data[
"rowvalue"] == $i)
921 $tplrow->parseCurrentBlock();
924 $tplrow->setVariable(
"ROWCLASS", $rowclass[$i % 2]);
925 if ($this->
object->getRowSeparators() == 1)
927 if ($i < $this->
object->getRowCount() - 1)
929 $tplrow->setVariable(
"STYLE",
" style=\"border-bottom: 1px solid $bordercolor!important\"");
932 $template->setCurrentBlock(
"matrix_row");
933 $template->setVariable(
"ROW", $tplrow->get());
934 $template->parseCurrentBlock();
941 $template->setCurrentBlock(
"question_data_matrix");
942 if (strcmp($error_message,
"") != 0)
944 $template->setVariable(
"ERROR_MESSAGE",
"<p class=\"warning\">$error_message</p>");
946 if ($show_questiontext)
950 $template->parseCurrentBlock();
951 return $template->get();
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
setQuestionTabsForClass($guiclass)
importEditFormValues(ilPropertyFormGUI $a_form)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
This class represents an option in a radio group.
getMaterialOutput()
Creates the HTML output of the question material(s)
outQuestionText($template)
saveLayout()
Saves the layout for the matrix question.
layout()
Creates a layout view of the question.
Matrix question GUI representation.
addFieldsToEditForm(ilPropertyFormGUI $a_form)
if(!is_array($argv)) $options
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
The SurveyMatrixQuestion class defines and encapsulates basic methods and attributes for matrix quest...
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
static getHtmlPath($relative_path)
get url of path
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
getWorkingForm($working_data="", $question_title=1, $show_questiontext=1, $error_message="", $survey_id=null)
Creates the question output form for the learner.
getLayoutRow()
Creates a row to define the matrix question layout with percentage values.
Create new PHPExcel object
obj_idprivate
getPrintViewQuestionTitle($question_title=1)
Basic class for all survey question types.
getParsedAnswers(array $a_working_data=null, $a_only_user_anwers=false)
getPrintView($question_title=1, $show_questiontext=1, $survey_id=null, array $a_working_data=null)
Creates a HTML representation of the question.