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(
"");
167 $columns->setValues($this->object->getColumns());
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]);
217 $layout = $this->
object->getLayout();
218 $neutralstyle =
"3px solid #808080";
219 $bordercolor =
"#808080";
220 $template =
new ilTemplate(
"tpl.il_svy_qpl_matrix_printview.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
222 if ($this->show_layout_row)
225 $template->setCurrentBlock(
"matrix_row");
226 $template->setVariable(
"ROW", $layout_row);
227 $template->parseCurrentBlock();
230 $tplheaders =
new ilTemplate(
"tpl.il_svy_out_matrix_columnheaders.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
231 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
233 $tplheaders->setCurrentBlock(
"bipolar_start");
235 array_push($style, sprintf(
"width: %.2F%s!important", $layout[
"percent_bipolar_adjective1"],
"%"));
236 if (count($style) > 0)
238 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
240 $tplheaders->parseCurrentBlock();
243 for ($i = 0; $i < $this->
object->getColumnCount(); $i++)
245 $cat = $this->
object->getColumn($i);
248 $tplheaders->setCurrentBlock(
"neutral_column_header");
250 $tplheaders->setVariable(
"CLASS",
"rsep");
252 array_push($style, sprintf(
"width: %.2F%s!important", $layout[
"percent_neutral"],
"%"));
253 if ($this->object->getNeutralColumnSeparator())
255 array_push($style,
"border-left: $neutralstyle!important;");
257 if (count($style) > 0)
259 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
261 $tplheaders->parseCurrentBlock();
266 if ($this->object->getColumnSeparators() == 1)
268 if (($i < $this->object->getColumnCount() - 1))
270 array_push($style,
"border-right: 1px solid $bordercolor!important");
273 array_push($style, sprintf(
"width: %.2F%s!important", $layout[
"percent_columns"] / $this->object->getColumnCount(),
"%"));
274 $tplheaders->setCurrentBlock(
"column_header");
276 $tplheaders->setVariable(
"CLASS",
"center");
277 if (count($style) > 0)
279 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
281 $tplheaders->parseCurrentBlock();
285 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
287 $tplheaders->setCurrentBlock(
"bipolar_end");
289 array_push($style, sprintf(
"width: %.2F%s!important", $layout[
"percent_bipolar_adjective2"],
"%"));
290 if (count($style) > 0)
292 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
294 $tplheaders->parseCurrentBlock();
298 array_push($style, sprintf(
"width: %.2F%s!important", $layout[
"percent_row"],
"%"));
299 if (count($style) > 0)
301 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
304 $template->setCurrentBlock(
"matrix_row");
305 $template->setVariable(
"ROW", $tplheaders->get());
306 $template->parseCurrentBlock();
308 $rowclass = array(
"tblrow1",
"tblrow2");
310 for ($i = 0; $i < $this->
object->getRowCount(); $i++)
312 $rowobj = $this->
object->getRow($i);
313 $tplrow =
new ilTemplate(
"tpl.il_svy_qpl_matrix_printview_row.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
314 for ($j = 0; $j < $this->
object->getColumnCount(); $j++)
316 $cat = $this->
object->getColumn($j);
317 if (($i == 0) && ($j == 0))
319 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
321 $tplrow->setCurrentBlock(
"bipolar_start");
323 $tplrow->setVariable(
"ROWSPAN", $this->object->getRowCount());
324 $tplrow->parseCurrentBlock();
327 if (($i == 0) && ($j == $this->object->getColumnCount()-1))
329 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
331 $tplrow->setCurrentBlock(
"bipolar_end");
333 $tplrow->setVariable(
"ROWSPAN", $this->object->getRowCount());
334 $tplrow->parseCurrentBlock();
337 switch ($this->object->getSubtype())
342 $tplrow->setCurrentBlock(
"neutral_radiobutton");
344 $tplrow->setVariable(
"ALT_RADIO", $this->lng->txt(
"unchecked"));
345 $tplrow->setVariable(
"TITLE_RADIO", $this->lng->txt(
"unchecked"));
346 $tplrow->parseCurrentBlock();
350 $tplrow->setCurrentBlock(
"radiobutton");
352 $tplrow->setVariable(
"ALT_RADIO", $this->lng->txt(
"unchecked"));
353 $tplrow->setVariable(
"TITLE_RADIO", $this->lng->txt(
"unchecked"));
354 $tplrow->parseCurrentBlock();
360 $tplrow->setCurrentBlock(
"neutral_checkbox");
362 $tplrow->setVariable(
"ALT_CHECKBOX", $this->lng->txt(
"unchecked"));
363 $tplrow->setVariable(
"TITLE_CHECKBOX", $this->lng->txt(
"unchecked"));
364 $tplrow->parseCurrentBlock();
368 $tplrow->setCurrentBlock(
"checkbox");
370 $tplrow->setVariable(
"ALT_CHECKBOX", $this->lng->txt(
"unchecked"));
371 $tplrow->setVariable(
"TITLE_CHECKBOX", $this->lng->txt(
"unchecked"));
372 $tplrow->parseCurrentBlock();
378 $tplrow->setCurrentBlock(
"neutral_answer");
380 if ($this->object->getNeutralColumnSeparator())
382 array_push($style,
"border-left: $neutralstyle!important");
384 if ($this->object->getColumnSeparators() == 1)
386 if ($j < $this->object->getColumnCount() - 1)
388 array_push($style,
"border-right: 1px solid $bordercolor!important");
392 if ($this->object->getRowSeparators() == 1)
394 if ($i < $this->object->getRowCount() - 1)
396 array_push($style,
"border-bottom: 1px solid $bordercolor!important");
401 $tplrow->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
403 $tplrow->parseCurrentBlock();
407 $tplrow->setCurrentBlock(
"answer");
410 if ($this->object->getColumnSeparators() == 1)
412 if ($j < $this->object->getColumnCount() - 1)
414 array_push($style,
"border-right: 1px solid $bordercolor!important");
418 if ($this->object->getRowSeparators() == 1)
420 if ($i < $this->object->getRowCount() - 1)
422 array_push($style,
"border-bottom: 1px solid $bordercolor!important");
427 $tplrow->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
429 $tplrow->parseCurrentBlock();
435 $tplrow->setCurrentBlock(
"text_other");
436 $tplrow->setVariable(
"TEXT_OTHER",
" ");
437 $tplrow->parseCurrentBlock();
441 $tplrow->setVariable(
"ROWCLASS", $rowclass[$i % 2]);
442 if ($this->object->getRowSeparators() == 1)
444 if ($i < $this->object->getRowCount() - 1)
446 $tplrow->setVariable(
"STYLE",
" style=\"border-bottom: 1px solid $bordercolor!important\"");
449 $template->setCurrentBlock(
"matrix_row");
450 $template->setVariable(
"ROW", $tplrow->get());
451 $template->parseCurrentBlock();
458 $template->setCurrentBlock();
459 if ($show_questiontext)
463 $template->parseCurrentBlock();
464 return $template->get();
481 $ilTabs->activateTab(
"layout");
483 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_layout.html",
"Modules/SurveyQuestionPool");
484 $this->show_layout_row = TRUE;
486 $this->tpl->setVariable(
"QUESTION_OUTPUT", $question_output);
487 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"saveLayout"));
488 $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save"));
498 $percent_values = array(
499 "percent_row" => (
int)
$_POST[
"percent_row"],
500 "percent_columns" => (
int)$_POST[
"percent_columns"],
501 "percent_bipolar_adjective1" => (
int)$_POST[
'percent_bipolar_adjective1'],
502 "percent_bipolar_adjective2" => (
int)$_POST[
'percent_bipolar_adjective2'],
503 "percent_neutral" => (
int)$_POST[
"percent_neutral"]
505 $this->
object->setLayout($percent_values);
508 if(array_sum($percent_values) == 100)
510 $this->
object->saveLayout($percent_values[
"percent_row"],
511 $percent_values[
'percent_columns'],
512 $percent_values[
'percent_bipolar_adjective1'],
513 $percent_values[
'percent_bipolar_adjective2'],
514 $percent_values[
"percent_neutral"]);
531 $percent_values = $this->
object->getLayout();
532 $template =
new ilTemplate(
"tpl.il_svy_out_matrix_layout.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
533 if (strlen($this->object->getBipolarAdjective(0)) && strlen($this->object->getBipolarAdjective(1)))
535 $template->setCurrentBlock(
"bipolar_start");
536 $template->setVariable(
"VALUE_PERCENT_BIPOLAR_ADJECTIVE1",
" value=\"" . $percent_values[
"percent_bipolar_adjective1"] .
"\"");
537 $template->setVariable(
"STYLE",
" style=\"width:" . $percent_values[
"percent_bipolar_adjective1"] .
"%\"");
538 $template->parseCurrentBlock();
539 $template->setCurrentBlock(
"bipolar_end");
540 $template->setVariable(
"VALUE_PERCENT_BIPOLAR_ADJECTIVE2",
" value=\"" . $percent_values[
"percent_bipolar_adjective2"] .
"\"");
541 $template->setVariable(
"STYLE",
" style=\"width:" . $percent_values[
"percent_bipolar_adjective2"] .
"%\"");
542 $template->parseCurrentBlock();
544 $counter = $this->
object->getColumnCount();
545 if (strlen($this->object->hasNeutralColumn()))
547 $template->setCurrentBlock(
"neutral_start");
548 $template->setVariable(
"VALUE_PERCENT_NEUTRAL",
" value=\"" . $percent_values[
"percent_neutral"] .
"\"");
549 $template->setVariable(
"STYLE_NEUTRAL",
" style=\"width:" . $percent_values[
"percent_neutral"] .
"%\"");
550 $template->parseCurrentBlock();
553 $template->setVariable(
"VALUE_PERCENT_ROW",
" value=\"" . $percent_values[
"percent_row"] .
"\"");
554 $template->setVariable(
"STYLE_ROW",
" style=\"width:" . $percent_values[
"percent_row"] .
"%\"");
555 $template->setVariable(
"COLSPAN_COLUMNS", $counter);
556 $template->setVariable(
"VALUE_PERCENT_COLUMNS",
" value=\"" . $percent_values[
"percent_columns"] .
"\"");
557 $template->setVariable(
"STYLE_COLUMNS",
" style=\"width:" . $percent_values[
"percent_columns"] .
"%\"");
558 return $template->get();
571 function getWorkingForm($working_data =
"", $question_title = 1, $show_questiontext = 1, $error_message =
"", $survey_id = null)
573 $layout = $this->
object->getLayout();
574 $neutralstyle =
"3px solid #808080";
575 $bordercolor =
"#808080";
576 $template =
new ilTemplate(
"tpl.il_svy_out_matrix.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
577 $template->setCurrentBlock(
"material_matrix");
579 $template->parseCurrentBlock();
581 if ($this->show_layout_row)
584 $template->setCurrentBlock(
"matrix_row");
585 $template->setVariable(
"ROW", $layout_row);
586 $template->parseCurrentBlock();
589 $tplheaders =
new ilTemplate(
"tpl.il_svy_out_matrix_columnheaders.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
590 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
592 $tplheaders->setCurrentBlock(
"bipolar_start");
594 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_bipolar_adjective1"],
"%"));
595 if (count($style) > 0)
597 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
599 $tplheaders->parseCurrentBlock();
602 for ($i = 0; $i < $this->
object->getColumnCount(); $i++)
605 $col = $this->
object->getColumn($i);
608 $tplheaders->setCurrentBlock(
"neutral_column_header");
610 $tplheaders->setVariable(
"CLASS",
"rsep");
612 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_neutral"],
"%"));
613 if ($this->object->getNeutralColumnSeparator())
615 array_push($style,
"border-left: $neutralstyle!important;");
617 if (count($style) > 0)
619 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
621 $tplheaders->parseCurrentBlock();
625 if ($this->object->getColumnSeparators() == 1)
627 if (($i < $this->object->getColumnCount() - 1))
629 array_push($style,
"border-right: 1px solid $bordercolor!important");
632 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_columns"] / $this->object->getColumnCount(),
"%"));
633 $tplheaders->setCurrentBlock(
"column_header");
635 $tplheaders->setVariable(
"CLASS",
"center");
636 if (count($style) > 0)
638 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
640 $tplheaders->parseCurrentBlock();
643 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
645 $tplheaders->setCurrentBlock(
"bipolar_end");
647 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_bipolar_adjective2"],
"%"));
648 if (count($style) > 0)
650 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
652 $tplheaders->parseCurrentBlock();
656 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_row"],
"%"));
657 if (count($style) > 0)
659 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
662 $template->setCurrentBlock(
"matrix_row");
663 $template->setVariable(
"ROW", $tplheaders->get());
664 $template->parseCurrentBlock();
666 $rowclass = array(
"tblrow1",
"tblrow2");
667 for ($i = 0; $i < $this->
object->getRowCount(); $i++)
669 $rowobj = $this->
object->getRow($i);
670 $tplrow =
new ilTemplate(
"tpl.il_svy_out_matrix_row.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
671 for ($j = 0; $j < $this->
object->getColumnCount(); $j++)
673 $cat = $this->
object->getColumn($j);
674 if (($i == 0) && ($j == 0))
676 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))
686 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
688 $tplrow->setCurrentBlock(
"bipolar_end");
690 $tplrow->setVariable(
"ROWSPAN", $this->object->getRowCount());
691 $tplrow->parseCurrentBlock();
694 switch ($this->object->getSubtype())
699 $tplrow->setCurrentBlock(
"neutral_radiobutton");
700 $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
701 $tplrow->setVariable(
"ROW", $i);
702 $tplrow->setVariable(
"VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
703 if (is_array($working_data))
705 foreach ($working_data as $data)
707 if (($data[
"value"] == $cat->scale-1) && ($data[
"rowvalue"] == $i))
709 $tplrow->setVariable(
"CHECKED_RADIOBUTTON",
" checked=\"checked\"");
713 $tplrow->parseCurrentBlock();
717 $tplrow->setCurrentBlock(
"radiobutton");
718 $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
719 $tplrow->setVariable(
"ROW", $i);
720 $tplrow->setVariable(
"VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
721 if (is_array($working_data))
723 foreach ($working_data as $data)
725 if (($data[
"value"] == $cat->scale-1) && ($data[
"rowvalue"] == $i))
727 $tplrow->setVariable(
"CHECKED_RADIOBUTTON",
" checked=\"checked\"");
731 $tplrow->parseCurrentBlock();
737 $tplrow->setCurrentBlock(
"neutral_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))
743 foreach ($working_data as $data)
745 if (($data[
"value"] == $cat->scale-1) && ($data[
"rowvalue"] == $i))
747 $tplrow->setVariable(
"CHECKED_CHECKBOX",
" checked=\"checked\"");
751 $tplrow->parseCurrentBlock();
755 $tplrow->setCurrentBlock(
"checkbox");
756 $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
757 $tplrow->setVariable(
"ROW", $i);
758 $tplrow->setVariable(
"VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
759 if (is_array($working_data))
761 foreach ($working_data as $data)
763 if (($data[
"value"] == $cat->scale-1) && ($data[
"rowvalue"] == $i))
765 $tplrow->setVariable(
"CHECKED_CHECKBOX",
" checked=\"checked\"");
769 $tplrow->parseCurrentBlock();
775 $tplrow->setCurrentBlock(
"neutral_answer");
777 if ($this->object->getNeutralColumnSeparator())
779 array_push($style,
"border-left: $neutralstyle!important");
781 if ($this->object->getColumnSeparators() == 1)
783 if ($j < $this->object->getColumnCount() - 1)
785 array_push($style,
"border-right: 1px solid $bordercolor!important");
791 $tplrow->setCurrentBlock(
"answer");
794 if ($this->object->getColumnSeparators() == 1)
796 if ($j < $this->object->getColumnCount() - 1)
798 array_push($style,
"border-right: 1px solid $bordercolor!important");
802 if ($this->object->getRowSeparators() == 1)
804 if ($i < $this->object->getRowCount() - 1)
806 array_push($style,
"border-bottom: 1px solid $bordercolor!important");
811 $tplrow->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
813 $tplrow->parseCurrentBlock();
818 $tplrow->setCurrentBlock(
"row_other");
819 $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
820 $tplrow->setVariable(
"ROW", $i);
821 if (is_array($working_data))
823 foreach ($working_data as $data)
825 if ($data[
"rowvalue"] == $i)
831 $tplrow->parseCurrentBlock();
834 $tplrow->setVariable(
"ROWCLASS", $rowclass[$i % 2]);
835 if ($this->object->getRowSeparators() == 1)
837 if ($i < $this->object->getRowCount() - 1)
839 $tplrow->setVariable(
"STYLE",
" style=\"border-bottom: 1px solid $bordercolor!important\"");
842 $template->setCurrentBlock(
"matrix_row");
843 $template->setVariable(
"ROW", $tplrow->get());
844 $template->parseCurrentBlock();
851 $template->setCurrentBlock(
"question_data_matrix");
852 if (strcmp($error_message,
"") != 0)
854 $template->setVariable(
"ERROR_MESSAGE",
"<p class=\"warning\">$error_message</p>");
856 if ($show_questiontext)
860 $template->parseCurrentBlock();
861 return $template->get();
879 if (count($this->cumulated) == 0)
883 include_once
"./Modules/Survey/classes/class.ilObjSurvey.php";
888 $nr_of_users =
sizeof($finished_ids);
890 $this->cumulated =& $this->
object->getCumulatedResults($survey_id, $nr_of_users, $finished_ids);
893 $cumulated_count = 0;
894 foreach ($this->cumulated as $key => $value)
896 if (is_numeric($key))
904 include_once
"./Services/UICore/classes/class.ilTemplate.php";
905 $template =
new ilTemplate(
"tpl.il_svy_svy_cumulated_results_detail.html", TRUE, TRUE,
"Modules/Survey");
907 $template->setCurrentBlock(
"detail_row");
908 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"question"));
909 $questiontext = $this->
object->getQuestiontext();
910 $template->setVariable(
"TEXT_OPTION_VALUE", $this->object->prepareTextareaOutput($questiontext, TRUE));
911 $template->parseCurrentBlock();
912 $template->setCurrentBlock(
"detail_row");
913 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"question_type"));
914 $template->setVariable(
"TEXT_OPTION_VALUE", $this->lng->txt($this->getQuestionType()).
915 " (".$cumulated_count.
" ".$this->lng->txt(
"rows").
")");
916 $template->parseCurrentBlock();
917 $template->setCurrentBlock(
"detail_row");
918 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_answered"));
919 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"TOTAL"][
"USERS_ANSWERED"]);
920 $template->parseCurrentBlock();
921 $template->setCurrentBlock(
"detail_row");
922 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_skipped"));
923 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"TOTAL"][
"USERS_SKIPPED"]);
924 $template->parseCurrentBlock();
935 $template->setCurrentBlock(
"detail_row");
936 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"median"));
937 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"TOTAL"][
"MEDIAN"]);
938 $template->parseCurrentBlock();
940 $template->setCurrentBlock(
"detail_row");
941 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"categories"));
943 foreach ($this->cumulated[
"TOTAL"][
"variables"] as $key => $value)
945 $columns .=
"<li>" . $value[
"title"] .
": n=" . $value[
"selected"] .
946 " (" . sprintf(
"%.2f", 100*$value[
"percentage"]) .
"%)</li>";
949 $template->setVariable(
"TEXT_OPTION_VALUE",
$columns);
950 $template->parseCurrentBlock();
953 $template->setCurrentBlock(
"detail_row");
954 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"chart"));
955 $template->setVariable(
"TEXT_OPTION_VALUE", $this->
renderChart(
"svy_ch_".$this->object->getId().
"_total", $this->cumulated[
"TOTAL"][
"variables"]));
956 $template->parseCurrentBlock();
958 $template->setVariable(
"QUESTION_TITLE",
"$counter. ".$this->object->getTitle());
960 $output .= $template->get();
962 foreach ($this->cumulated as $key => $value)
964 if (is_numeric($key))
966 $template =
new ilTemplate(
"tpl.il_svy_svy_cumulated_results_detail.html", TRUE, TRUE,
"Modules/Survey");
968 $template->setCurrentBlock(
"detail_row");
969 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_answered"));
970 $template->setVariable(
"TEXT_OPTION_VALUE", $value[
"USERS_ANSWERED"]);
971 $template->parseCurrentBlock();
972 $template->setCurrentBlock(
"detail_row");
973 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_skipped"));
974 $template->setVariable(
"TEXT_OPTION_VALUE", $value[
"USERS_SKIPPED"]);
975 $template->parseCurrentBlock();
986 $template->setCurrentBlock(
"detail_row");
987 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"median"));
988 $template->setVariable(
"TEXT_OPTION_VALUE", $value[
"MEDIAN"]);
989 $template->parseCurrentBlock();
991 $template->setCurrentBlock(
"detail_row");
992 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"categories"));
994 foreach ($value[
"variables"] as $cvalue)
996 $columns .=
"<li>" . $cvalue[
"title"] .
": n=". $cvalue[
"selected"] .
997 " (".sprintf(
"%.2f", 100*$cvalue[
"percentage"]) .
"%)</li>";
1000 $template->setVariable(
"TEXT_OPTION_VALUE",
$columns);
1001 $template->parseCurrentBlock();
1004 if (is_array($value[
"textanswers"]))
1006 $template->setCurrentBlock(
"detail_row");
1007 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"freetext_answers"));
1009 foreach ($value[
"textanswers"] as $tkey => $answers)
1011 $html .= $value[
"variables"][$tkey][
"title"] .
"\n";
1013 foreach ($answers as $answer)
1015 $html .=
"<li>" . preg_replace(
"/\n/",
"<br>\n", $answer) .
"</li>\n";
1019 $template->setVariable(
"TEXT_OPTION_VALUE", $html);
1020 $template->parseCurrentBlock();
1024 $template->setCurrentBlock(
"detail_row");
1025 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"chart"));
1026 $template->setVariable(
"TEXT_OPTION_VALUE", $this->
renderChart(
"svy_ch_".$this->object->getId().
"_".$key, $value[
"variables"]));
1027 $template->parseCurrentBlock();
1029 $template->setVariable(
"QUESTION_SUBTITLE", $counter.
".".($key+1).
" ".
1030 $this->object->prepareTextareaOutput($value[
"ROW"], TRUE));
1032 $output .= $template->get();