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) {
72 $subtype->addOption(
new ilRadioOption($this->lng->txt($st), $idx));
78 $header->setTitle($this->lng->txt(
"matrix_appearance"));
82 $column_separators =
new ilCheckboxInputGUI($this->lng->txt(
"matrix_column_separators"),
"column_separators");
84 $column_separators->setInfo($this->lng->txt(
"matrix_column_separators_description"));
85 $column_separators->setRequired(
false);
86 $a_form->
addItem($column_separators);
89 $row_separators =
new ilCheckboxInputGUI($this->lng->txt(
"matrix_row_separators"),
"row_separators");
91 $row_separators->setInfo($this->lng->txt(
"matrix_row_separators_description"));
92 $row_separators->setRequired(
false);
93 $a_form->
addItem($row_separators);
96 $neutral_column_separator =
new ilCheckboxInputGUI($this->lng->txt(
"matrix_neutral_column_separator"),
"neutral_column_separator");
97 $neutral_column_separator->
setValue(1);
98 $neutral_column_separator->setInfo($this->lng->txt(
"matrix_neutral_column_separator_description"));
99 $neutral_column_separator->setRequired(
false);
100 $a_form->
addItem($neutral_column_separator);
104 $header->setTitle($this->lng->txt(
"matrix_columns"));
108 include_once
"./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php";
113 $columns->setShowNeutralCategory(
true);
115 $columns->setNeutralCategoryTitle($this->lng->txt(
'matrix_neutral_answer'));
116 $columns->setCategoryText($this->lng->txt(
'matrix_standard_answers'));
122 $header->setTitle($this->lng->txt(
"matrix_column_settings"));
126 $bipolar =
new ilCustomInputGUI($this->lng->txt(
"matrix_bipolar_adjectives"));
127 $bipolar->
setInfo($this->lng->txt(
"matrix_bipolar_adjectives_description"));
130 $bipolar1 =
new ilTextInputGUI($this->lng->txt(
"matrix_left_pole"),
"bipolar1");
132 $bipolar->addSubItem($bipolar1);
135 $bipolar2 =
new ilTextInputGUI($this->lng->txt(
"matrix_right_pole"),
"bipolar2");
137 $bipolar->addSubItem($bipolar2);
143 $header->setTitle($this->lng->txt(
"matrix_rows"));
147 include_once
"./Modules/SurveyQuestionPool/classes/class.ilMatrixRowWizardInputGUI.php";
149 $rows->setRequired(
false);
150 $rows->setAllowMove(
true);
151 $rows->setLabelText($this->lng->txt(
'label'));
152 $rows->setUseOtherAnswer(
true);
157 $subtype->setValue($this->object->getSubtype());
158 $column_separators->setChecked($this->object->getColumnSeparators());
159 $row_separators->setChecked($this->object->getRowSeparators());
160 $neutral_column_separator->setChecked($this->object->getNeutralColumnSeparator());
162 if (!$this->object->getColumnCount()) {
163 $this->
object->columns->addCategory(
"");
165 $columns->setValues($this->object->getColumns());
167 $bipolar1->setValue($this->object->getBipolarAdjective(0));
168 $bipolar2->setValue($this->object->getBipolarAdjective(1));
170 if ($this->object->getRowCount() == 0) {
171 $this->
object->getRows()->addCategory(
"");
173 $rows->setValues($this->object->getRows());
178 $this->
object->setSubtype($a_form->
getInput(
"type"));
179 $this->
object->setRowSeparators($a_form->
getInput(
"row_separators") ? 1 : 0);
180 $this->
object->setColumnSeparators($a_form->
getInput(
"column_separators") ? 1 : 0);
181 $this->
object->setNeutralColumnSeparator($a_form->
getInput(
"neutral_column_separator") ? 1 : 0);
184 $this->
object->setBipolarAdjective(0, $a_form->
getInput(
"bipolar1"));
185 $this->
object->setBipolarAdjective(1, $a_form->
getInput(
"bipolar2"));
188 $this->
object->flushColumns();
190 foreach (
$_POST[
'columns'][
'answer'] as
$key => $value) {
191 if (strlen($value)) {
192 $this->
object->getColumns()->addCategory($value,
$_POST[
'columns'][
'other'][
$key], 0, null,
$_POST[
'columns'][
'scale'][$key]);
195 if (strlen(
$_POST[
"columns"][
"neutral"])) {
196 $this->
object->getColumns()->addCategory(
$_POST[
'columns'][
'neutral'], 0, 1, null,
$_POST[
'columns_neutral_scale']);
200 $this->
object->flushRows();
201 foreach (
$_POST[
'rows'][
'answer'] as
$key => $value) {
202 if (strlen($value)) {
203 $this->
object->getRows()->addCategory($value,
$_POST[
'rows'][
'other'][
$key], 0,
$_POST[
'rows'][
'label'][$key]);
208 public function getParsedAnswers(array $a_working_data = null, $a_only_user_anwers =
false)
210 if (is_array($a_working_data)) {
211 $user_answers = $a_working_data;
215 for (
$i = 0;
$i < $this->
object->getRowCount();
$i++) {
216 $rowobj = $this->
object->getRow(
$i);
221 for ($j = 0; $j < $this->
object->getColumnCount(); $j++) {
222 $cat = $this->
object->getColumn($j);
223 $value = ($cat->scale) ? ($cat->scale - 1) : $j;
225 $checked =
"unchecked";
226 if (is_array($a_working_data)) {
227 foreach ($user_answers as $user_answer) {
228 if ($user_answer[
"rowvalue"] ==
$i &&
229 $user_answer[
"value"] == $value) {
230 $checked =
"checked";
231 if ($user_answer[
"textanswer"]) {
232 $text = $user_answer[
"textanswer"];
238 if (!$a_only_user_anwers || $checked ==
"checked") {
239 $cols[$value] = array(
240 "title" => trim($cat->title)
241 ,
"neutral" => (
bool) $cat->neutral
242 ,
"checked" => $checked
247 if ($a_only_user_anwers ||
sizeof(
$cols) ||
$text) {
250 "title" => trim($rowobj->title)
251 ,
"other" => (
bool) $rowobj->other
252 ,
"textanswer" =>
$text 266 public function getPrintView($question_title = 1, $show_questiontext = 1, $survey_id = null, array $a_working_data = null)
270 $layout = $this->
object->getLayout();
271 $neutralstyle =
"3px solid #808080";
272 $bordercolor =
"#808080";
273 $template =
new ilTemplate(
"tpl.il_svy_qpl_matrix_printview.html",
true,
true,
"Modules/SurveyQuestionPool");
275 if ($this->show_layout_row) {
277 $template->setCurrentBlock(
"matrix_row");
278 $template->setVariable(
"ROW", $layout_row);
282 $tplheaders =
new ilTemplate(
"tpl.il_svy_out_matrix_columnheaders.html",
true,
true,
"Modules/SurveyQuestionPool");
283 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1)))) {
284 $tplheaders->setCurrentBlock(
"bipolar_start");
286 array_push(
$style, sprintf(
"width: %.2F%s!important", $layout[
"percent_bipolar_adjective1"],
"%"));
288 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
290 $tplheaders->parseCurrentBlock();
293 for (
$i = 0;
$i < $this->
object->getColumnCount();
$i++) {
294 $cat = $this->
object->getColumn(
$i);
296 $tplheaders->setCurrentBlock(
"neutral_column_header");
298 $tplheaders->setVariable(
"CLASS",
"rsep");
300 array_push(
$style, sprintf(
"width: %.2F%s!important", $layout[
"percent_neutral"],
"%"));
301 if ($this->object->getNeutralColumnSeparator()) {
302 array_push(
$style,
"border-left: $neutralstyle!important;");
305 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
307 $tplheaders->parseCurrentBlock();
310 if ($this->object->getColumnSeparators() == 1) {
311 if (($i < $this->object->getColumnCount() - 1)) {
312 array_push(
$style,
"border-right: 1px solid $bordercolor!important");
315 array_push(
$style, sprintf(
"width: %.2F%s!important", $layout[
"percent_columns"] / $this->object->getColumnCount(),
"%"));
316 $tplheaders->setCurrentBlock(
"column_header");
318 $tplheaders->setVariable(
"CLASS",
"center");
320 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
322 $tplheaders->parseCurrentBlock();
326 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1)))) {
327 $tplheaders->setCurrentBlock(
"bipolar_end");
329 array_push(
$style, sprintf(
"width: %.2F%s!important", $layout[
"percent_bipolar_adjective2"],
"%"));
331 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
333 $tplheaders->parseCurrentBlock();
337 array_push(
$style, sprintf(
"width: %.2F%s!important", $layout[
"percent_row"],
"%"));
339 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
342 $template->setCurrentBlock(
"matrix_row");
343 $template->setVariable(
"ROW", $tplheaders->get());
346 $rowclass = array(
"tblrow1",
"tblrow2");
348 for (
$i = 0;
$i < $this->
object->getRowCount();
$i++) {
349 $rowobj = $this->
object->getRow(
$i);
350 $tplrow =
new ilTemplate(
"tpl.il_svy_qpl_matrix_printview_row.html",
true,
true,
"Modules/SurveyQuestionPool");
351 for ($j = 0; $j < $this->
object->getColumnCount(); $j++) {
352 $cat = $this->
object->getColumn($j);
353 if ((
$i == 0) && ($j == 0)) {
354 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1)))) {
355 $tplrow->setCurrentBlock(
"bipolar_start");
357 $tplrow->setVariable(
"ROWSPAN", $this->object->getRowCount());
358 $tplrow->parseCurrentBlock();
361 if ((
$i == 0) && ($j == $this->object->getColumnCount() - 1)) {
362 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1)))) {
363 $tplrow->setCurrentBlock(
"bipolar_end");
365 $tplrow->setVariable(
"ROWSPAN", $this->object->getRowCount());
366 $tplrow->parseCurrentBlock();
370 $value = ($cat->scale) ? ($cat->scale - 1) : $j;
373 switch ($this->object->getSubtype()) {
376 $tplrow->setCurrentBlock(
"neutral_radiobutton");
378 $tplrow->setVariable(
"ALT_RADIO", $this->lng->txt($col[
"checked"]));
379 $tplrow->setVariable(
"TITLE_RADIO", $this->lng->txt($col[
"checked"]));
380 $tplrow->parseCurrentBlock();
382 $tplrow->setCurrentBlock(
"radiobutton");
384 $tplrow->setVariable(
"ALT_RADIO", $this->lng->txt($col[
"checked"]));
385 $tplrow->setVariable(
"TITLE_RADIO", $this->lng->txt($col[
"checked"]));
386 $tplrow->parseCurrentBlock();
391 $tplrow->setCurrentBlock(
"neutral_checkbox");
393 $tplrow->setVariable(
"ALT_CHECKBOX", $this->lng->txt($col[
"checked"]));
394 $tplrow->setVariable(
"TITLE_CHECKBOX", $this->lng->txt($col[
"checked"]));
395 $tplrow->parseCurrentBlock();
397 $tplrow->setCurrentBlock(
"checkbox");
399 $tplrow->setVariable(
"ALT_CHECKBOX", $this->lng->txt($col[
"checked"]));
400 $tplrow->setVariable(
"TITLE_CHECKBOX", $this->lng->txt($col[
"checked"]));
401 $tplrow->parseCurrentBlock();
406 $tplrow->setCurrentBlock(
"neutral_answer");
408 if ($this->object->getNeutralColumnSeparator()) {
409 array_push(
$style,
"border-left: $neutralstyle!important");
411 if ($this->object->getColumnSeparators() == 1) {
412 if ($j < $this->object->getColumnCount() - 1) {
413 array_push(
$style,
"border-right: 1px solid $bordercolor!important");
417 if ($this->object->getRowSeparators() == 1) {
418 if ($i < $this->object->getRowCount() - 1) {
419 array_push(
$style,
"border-bottom: 1px solid $bordercolor!important");
423 $tplrow->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
425 $tplrow->parseCurrentBlock();
427 $tplrow->setCurrentBlock(
"answer");
430 if ($this->object->getColumnSeparators() == 1) {
431 if ($j < $this->object->getColumnCount() - 1) {
432 array_push(
$style,
"border-right: 1px solid $bordercolor!important");
436 if ($this->object->getRowSeparators() == 1) {
437 if ($i < $this->object->getRowCount() - 1) {
438 array_push(
$style,
"border-bottom: 1px solid $bordercolor!important");
442 $tplrow->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
444 $tplrow->parseCurrentBlock();
448 if ($rowobj->other) {
450 $tplrow->setCurrentBlock(
"text_other");
451 $tplrow->setVariable(
"TEXT_OTHER",
$text 453 :
" ");
454 $tplrow->parseCurrentBlock();
457 #force to have always the title 460 if ($question_title == 3) {
461 if (trim($rowobj->label)) {
466 $tplrow->setVariable(
"TEXT_ROW", $row_title);
467 $tplrow->setVariable(
"ROWCLASS", $rowclass[
$i % 2]);
468 if ($this->object->getRowSeparators() == 1) {
469 if ($i < $this->object->getRowCount() - 1) {
470 $tplrow->setVariable(
"STYLE",
" style=\"border-bottom: 1px solid $bordercolor!important\"");
473 $template->setCurrentBlock(
"matrix_row");
474 $template->setVariable(
"ROW", $tplrow->get());
478 if ($question_title) {
482 if ($show_questiontext) {
503 $ilTabs->activateTab(
"layout");
505 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_layout.html",
"Modules/SurveyQuestionPool");
506 $this->show_layout_row =
true;
508 $this->tpl->setVariable(
"QUESTION_OUTPUT", $question_output);
509 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"saveLayout"));
510 $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save"));
520 $percent_values = array(
521 "percent_row" => (
int)
$_POST[
"percent_row"],
522 "percent_columns" => (
int) $_POST[
"percent_columns"],
523 "percent_bipolar_adjective1" => (
int) $_POST[
'percent_bipolar_adjective1'],
524 "percent_bipolar_adjective2" => (
int) $_POST[
'percent_bipolar_adjective2'],
525 "percent_neutral" => (
int) $_POST[
"percent_neutral"]
527 $this->
object->setLayout($percent_values);
530 if (array_sum($percent_values) == 100) {
531 $this->
object->saveLayout(
532 $percent_values[
"percent_row"],
533 $percent_values[
'percent_columns'],
534 $percent_values[
'percent_bipolar_adjective1'],
535 $percent_values[
'percent_bipolar_adjective2'],
536 $percent_values[
"percent_neutral"]
538 ilUtil::sendSuccess($this->lng->txt(
"settings_saved"));
552 $percent_values = $this->
object->getLayout();
553 $template =
new ilTemplate(
"tpl.il_svy_out_matrix_layout.html",
true,
true,
"Modules/SurveyQuestionPool");
554 if (strlen($this->object->getBipolarAdjective(0)) && strlen($this->object->getBipolarAdjective(1))) {
555 $template->setCurrentBlock(
"bipolar_start");
556 $template->setVariable(
"VALUE_PERCENT_BIPOLAR_ADJECTIVE1",
" value=\"" . $percent_values[
"percent_bipolar_adjective1"] .
"\"");
557 $template->setVariable(
"STYLE",
" style=\"width:" . $percent_values[
"percent_bipolar_adjective1"] .
"%\"");
559 $template->setCurrentBlock(
"bipolar_end");
560 $template->setVariable(
"VALUE_PERCENT_BIPOLAR_ADJECTIVE2",
" value=\"" . $percent_values[
"percent_bipolar_adjective2"] .
"\"");
561 $template->setVariable(
"STYLE",
" style=\"width:" . $percent_values[
"percent_bipolar_adjective2"] .
"%\"");
564 $counter = $this->
object->getColumnCount();
565 if (strlen($this->object->hasNeutralColumn())) {
566 $template->setCurrentBlock(
"neutral_start");
567 $template->setVariable(
"VALUE_PERCENT_NEUTRAL",
" value=\"" . $percent_values[
"percent_neutral"] .
"\"");
568 $template->setVariable(
"STYLE_NEUTRAL",
" style=\"width:" . $percent_values[
"percent_neutral"] .
"%\"");
572 $template->setVariable(
"VALUE_PERCENT_ROW",
" value=\"" . $percent_values[
"percent_row"] .
"\"");
573 $template->setVariable(
"STYLE_ROW",
" style=\"width:" . $percent_values[
"percent_row"] .
"%\"");
574 $template->setVariable(
"COLSPAN_COLUMNS", $counter);
575 $template->setVariable(
"VALUE_PERCENT_COLUMNS",
" value=\"" . $percent_values[
"percent_columns"] .
"\"");
576 $template->setVariable(
"STYLE_COLUMNS",
" style=\"width:" . $percent_values[
"percent_columns"] .
"%\"");
590 public function getWorkingForm($working_data =
"", $question_title = 1, $show_questiontext = 1, $error_message =
"", $survey_id = null)
592 $layout = $this->
object->getLayout();
593 $neutralstyle =
"3px solid #808080";
594 $bordercolor =
"#808080";
595 $template =
new ilTemplate(
"tpl.il_svy_out_matrix.html",
true,
true,
"Modules/SurveyQuestionPool");
596 $template->setCurrentBlock(
"material_matrix");
600 if ($this->show_layout_row) {
602 $template->setCurrentBlock(
"matrix_row");
603 $template->setVariable(
"ROW", $layout_row);
607 $tplheaders =
new ilTemplate(
"tpl.il_svy_out_matrix_columnheaders.html",
true,
true,
"Modules/SurveyQuestionPool");
608 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1)))) {
609 $tplheaders->setCurrentBlock(
"bipolar_start");
611 array_push(
$style, sprintf(
"width: %.2f%s!important", $layout[
"percent_bipolar_adjective1"],
"%"));
613 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
615 $tplheaders->parseCurrentBlock();
618 for (
$i = 0;
$i < $this->
object->getColumnCount();
$i++) {
620 $col = $this->
object->getColumn(
$i);
622 $tplheaders->setCurrentBlock(
"neutral_column_header");
624 $tplheaders->setVariable(
"CLASS",
"rsep");
626 array_push(
$style, sprintf(
"width: %.2f%s!important", $layout[
"percent_neutral"],
"%"));
627 if ($this->object->getNeutralColumnSeparator()) {
628 array_push(
$style,
"border-left: $neutralstyle!important;");
631 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
633 $tplheaders->parseCurrentBlock();
635 if ($this->object->getColumnSeparators() == 1) {
636 if (($i < $this->object->getColumnCount() - 1)) {
637 array_push(
$style,
"border-right: 1px solid $bordercolor!important");
640 array_push(
$style, sprintf(
"width: %.2f%s!important", $layout[
"percent_columns"] / $this->object->getColumnCount(),
"%"));
641 $tplheaders->setCurrentBlock(
"column_header");
643 $tplheaders->setVariable(
"CLASS",
"center");
645 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
647 $tplheaders->parseCurrentBlock();
650 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1)))) {
651 $tplheaders->setCurrentBlock(
"bipolar_end");
653 array_push(
$style, sprintf(
"width: %.2f%s!important", $layout[
"percent_bipolar_adjective2"],
"%"));
655 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
657 $tplheaders->parseCurrentBlock();
661 array_push(
$style, sprintf(
"width: %.2f%s!important", $layout[
"percent_row"],
"%"));
663 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
666 $template->setCurrentBlock(
"matrix_row");
667 $template->setVariable(
"ROW", $tplheaders->get());
670 $rowclass = array(
"tblrow1",
"tblrow2");
671 for (
$i = 0;
$i < $this->
object->getRowCount();
$i++) {
672 $rowobj = $this->
object->getRow(
$i);
673 $tplrow =
new ilTemplate(
"tpl.il_svy_out_matrix_row.html",
true,
true,
"Modules/SurveyQuestionPool");
674 for ($j = 0; $j < $this->
object->getColumnCount(); $j++) {
675 $cat = $this->
object->getColumn($j);
676 if ((
$i == 0) && ($j == 0)) {
677 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1)))) {
678 $tplrow->setCurrentBlock(
"bipolar_start");
680 $tplrow->setVariable(
"ROWSPAN", $this->object->getRowCount());
681 $tplrow->parseCurrentBlock();
684 if ((
$i == 0) && ($j == $this->object->getColumnCount() - 1)) {
685 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1)))) {
686 $tplrow->setCurrentBlock(
"bipolar_end");
688 $tplrow->setVariable(
"ROWSPAN", $this->object->getRowCount());
689 $tplrow->parseCurrentBlock();
692 switch ($this->object->getSubtype()) {
695 $tplrow->setCurrentBlock(
"neutral_radiobutton");
696 $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
697 $tplrow->setVariable(
"ROW",
$i);
698 $tplrow->setVariable(
"VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
699 if (is_array($working_data)) {
700 foreach ($working_data as
$data) {
701 if (($data[
"value"] == $cat->scale - 1) && ($data[
"rowvalue"] ==
$i)) {
702 $tplrow->setVariable(
"CHECKED_RADIOBUTTON",
" checked=\"checked\"");
706 $tplrow->parseCurrentBlock();
708 $tplrow->setCurrentBlock(
"radiobutton");
709 $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
710 $tplrow->setVariable(
"ROW",
$i);
711 $tplrow->setVariable(
"VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
712 if (is_array($working_data)) {
713 foreach ($working_data as
$data) {
714 if (($data[
"value"] == $cat->scale - 1) && ($data[
"rowvalue"] ==
$i)) {
715 $tplrow->setVariable(
"CHECKED_RADIOBUTTON",
" checked=\"checked\"");
719 $tplrow->parseCurrentBlock();
724 $tplrow->setCurrentBlock(
"neutral_checkbox");
725 $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
726 $tplrow->setVariable(
"ROW",
$i);
727 $tplrow->setVariable(
"VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
728 if (is_array($working_data)) {
729 foreach ($working_data as
$data) {
730 if (($data[
"value"] == $cat->scale - 1) && ($data[
"rowvalue"] ==
$i)) {
731 $tplrow->setVariable(
"CHECKED_CHECKBOX",
" checked=\"checked\"");
735 $tplrow->parseCurrentBlock();
737 $tplrow->setCurrentBlock(
"checkbox");
738 $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
739 $tplrow->setVariable(
"ROW",
$i);
740 $tplrow->setVariable(
"VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
741 if (is_array($working_data)) {
742 foreach ($working_data as
$data) {
743 if (($data[
"value"] == $cat->scale - 1) && ($data[
"rowvalue"] ==
$i)) {
744 $tplrow->setVariable(
"CHECKED_CHECKBOX",
" checked=\"checked\"");
748 $tplrow->parseCurrentBlock();
753 $tplrow->setCurrentBlock(
"neutral_answer");
755 if ($this->object->getNeutralColumnSeparator()) {
756 array_push(
$style,
"border-left: $neutralstyle!important");
758 if ($this->object->getColumnSeparators() == 1) {
759 if ($j < $this->object->getColumnCount() - 1) {
760 array_push(
$style,
"border-right: 1px solid $bordercolor!important");
764 $tplrow->setCurrentBlock(
"answer");
767 if ($this->object->getColumnSeparators() == 1) {
768 if ($j < $this->object->getColumnCount() - 1) {
769 array_push(
$style,
"border-right: 1px solid $bordercolor!important");
773 if ($this->object->getRowSeparators() == 1) {
774 if ($i < $this->object->getRowCount() - 1) {
775 array_push(
$style,
"border-bottom: 1px solid $bordercolor!important");
779 $tplrow->setVariable(
"STYLE",
" style=\"" . implode(
";",
$style) .
"\"");
781 $tplrow->parseCurrentBlock();
784 if ($rowobj->other) {
785 $tplrow->setCurrentBlock(
"row_other");
786 $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
787 $tplrow->setVariable(
"ROW",
$i);
788 if (is_array($working_data)) {
789 foreach ($working_data as
$data) {
790 if ($data[
"rowvalue"] ==
$i) {
795 $tplrow->parseCurrentBlock();
798 $tplrow->setVariable(
"ROWCLASS", $rowclass[
$i % 2]);
799 if ($this->object->getRowSeparators() == 1) {
800 if ($i < $this->object->getRowCount() - 1) {
801 $tplrow->setVariable(
"STYLE",
" style=\"border-bottom: 1px solid $bordercolor!important\"");
804 $template->setCurrentBlock(
"matrix_row");
805 $template->setVariable(
"ROW", $tplrow->get());
809 if ($question_title) {
812 $template->setCurrentBlock(
"question_data_matrix");
813 if (strcmp($error_message,
"") != 0) {
814 $template->setVariable(
"ERROR_MESSAGE",
"<p class=\"warning\">$error_message</p>");
816 if ($show_questiontext) {
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)
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
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.
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.