24 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
25 include_once
"./Modules/Survey/classes/inc.SurveyConstants.php";
55 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveySingleChoiceQuestion.php";
59 $this->
object->loadFromDb($id);
71 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
74 $this->
object->setTitle(
$_POST[
"title"]);
75 $this->
object->setAuthor(
$_POST[
"author"]);
76 $this->
object->setDescription(
$_POST[
"description"]);
77 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
78 $questiontext =
$_POST[
"question"];
79 $this->
object->setQuestiontext($questiontext);
80 $this->
object->setObligatory((
$_POST[
"obligatory"]) ? 1 : 0);
81 $this->
object->setOrientation(
$_POST[
"orientation"]);
82 $this->
object->label =
$_POST[
'label'];
84 $this->
object->categories->flushCategories();
86 foreach (
$_POST[
'answers'][
'answer'] as $key => $value)
88 if (strlen($value)) $this->
object->getCategories()->addCategory($value,
$_POST[
'answers'][
'other'][$key], 0, null,
$_POST[
'answers'][
'scale'][$key]);
90 if (strlen(
$_POST[
'answers'][
'neutral']))
92 $this->
object->getCategories()->addCategory(
$_POST[
'answers'][
'neutral'], 0, 1, null,
$_POST[
'answers_neutral_scale']);
109 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
111 $form->setFormAction($this->ctrl->getFormAction($this));
112 $form->setTitle($this->lng->txt($this->getQuestionType()));
113 $form->setMultipart(FALSE);
114 $form->setTableWidth(
"100%");
115 $form->setId(
"singlechoice");
119 $title->setValue($this->object->getTitle());
120 $title->setRequired(TRUE);
125 $label->
setValue($this->object->label);
126 $label->setInfo($this->lng->txt(
"label_info"));
127 $label->setRequired(
false);
128 $form->addItem($label);
131 $author =
new ilTextInputGUI($this->lng->txt(
"author"),
"author");
132 $author->
setValue($this->object->getAuthor());
133 $author->setRequired(TRUE);
134 $form->addItem($author);
137 $description =
new ilTextInputGUI($this->lng->txt(
"description"),
"description");
138 $description->
setValue($this->object->getDescription());
139 $description->setRequired(FALSE);
140 $form->addItem($description);
144 $question->
setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext()));
145 $question->setRequired(TRUE);
146 $question->setRows(10);
147 $question->setCols(80);
148 $question->setUseRte(TRUE);
149 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
151 $question->addPlugin(
"latex");
152 $question->addButton(
"latex");
153 $question->addButton(
"pastelatex");
154 $question->setRTESupport($this->object->getId(),
"spl",
"survey", null,
false,
"3.4.7");
155 $form->addItem($question);
160 $shuffle->setChecked($this->object->getObligatory());
161 $shuffle->setRequired(FALSE);
162 $form->addItem($shuffle);
167 $orientation->setValue($this->object->getOrientation());
168 $orientation->addOption(
new ilRadioOption($this->lng->txt(
'vertical'), 0));
169 $orientation->addOption(
new ilRadioOption($this->lng->txt(
'horizontal'), 1));
170 $orientation->addOption(
new ilRadioOption($this->lng->txt(
'combobox'), 2));
171 $form->addItem($orientation);
174 include_once
"./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php";
177 $answers->setAllowMove(
true);
178 $answers->setShowWizard(
true);
179 $answers->setShowSavePhrase(
true);
180 $answers->setUseOtherAnswer(
true);
181 $answers->setShowNeutralCategory(
true);
182 $answers->setNeutralCategoryTitle($this->lng->txt(
'svy_neutral_answer'));
183 if (!$this->object->getCategories()->getCategoryCount())
185 $this->
object->getCategories()->addCategory(
"");
187 $answers->setValues($this->object->getCategories());
188 $answers->setDisabledScale(
false);
189 $form->addItem($answers);
195 if ($this->
isSaveCommand(array(
"wizardanswers",
"savePhraseanswers")))
197 $form->setValuesByPost();
198 $errors = !$form->checkInput();
199 $form->setValuesByPost();
200 if (
$errors) $checkonly =
false;
203 if (!$checkonly) $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
213 $position = key(
$_POST[
'cmd'][
'addanswers']);
214 $this->
object->getCategories()->addCategoryAtPosition(
"", $position+1);
224 $position = key(
$_POST[
'cmd'][
'removeanswers']);
225 $this->
object->getCategories()->removeCategory($position);
235 $position = key(
$_POST[
'cmd'][
'upanswers']);
236 $this->
object->getCategories()->moveCategoryUp($position);
246 $position = key(
$_POST[
'cmd'][
'downanswers']);
247 $this->
object->getCategories()->moveCategoryDown($position);
259 if (
$result == 0 || !$save_post_data)
261 if ($save_post_data) $this->
object->saveToDb();
262 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_addphrase.html",
"Modules/SurveyQuestionPool");
265 $this->tpl->setCurrentBlock(
"hidden");
266 $this->tpl->setVariable(
"HIDDEN_NAME",
"id");
267 $this->tpl->setVariable(
"HIDDEN_VALUE", $this->object->getId());
268 $this->tpl->parseCurrentBlock();
270 include_once
"./Modules/SurveyQuestionPool/classes/class.ilSurveyPhrases.php";
272 $colors = array(
"tblrow1",
"tblrow2");
274 foreach ($phrases as $phrase_id => $phrase_array)
276 $this->tpl->setCurrentBlock(
"phraserow");
277 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter++ % 2]);
278 $this->tpl->setVariable(
"PHRASE_VALUE", $phrase_id);
279 $this->tpl->setVariable(
"PHRASE_NAME", $phrase_array[
"title"]);
281 $this->tpl->setVariable(
"PHRASE_CONTENT", join($categories,
","));
282 $this->tpl->parseCurrentBlock();
285 $this->tpl->setCurrentBlock(
"adm_content");
286 $this->tpl->setVariable(
"TEXT_CANCEL", $this->lng->txt(
"cancel"));
287 $this->tpl->setVariable(
"TEXT_PHRASE", $this->lng->txt(
"phrase"));
288 $this->tpl->setVariable(
"TEXT_CONTENT", $this->lng->txt(
"categories"));
289 $this->tpl->setVariable(
"TEXT_ADD_PHRASE", $this->lng->txt(
"add_phrase"));
290 $this->tpl->setVariable(
"TEXT_INTRODUCTION",$this->lng->txt(
"add_phrase_introduction"));
291 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
292 $this->tpl->parseCurrentBlock();
304 $this->ctrl->redirect($this,
'editQuestion');
314 if (strcmp(
$_POST[
"phrases"],
"") == 0)
321 if (strcmp($this->object->getPhrase(
$_POST[
"phrases"]),
"dp_standard_numbers") != 0)
323 $this->
object->addPhrase(
$_POST[
"phrases"]);
324 $this->
object->saveToDb();
332 $this->ctrl->redirect($this,
'editQuestion');
343 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_addphrase_standard_numbers.html",
"Modules/SurveyQuestionPool");
346 $this->tpl->setCurrentBlock(
"hidden");
347 $this->tpl->setVariable(
"HIDDEN_NAME",
"id");
348 $this->tpl->setVariable(
"HIDDEN_VALUE", $this->object->getId());
349 $this->tpl->parseCurrentBlock();
351 $this->tpl->setCurrentBlock(
"adm_content");
352 $this->tpl->setVariable(
"ADD_STANDARD_NUMBERS", $this->lng->txt(
"add_standard_numbers"));
353 $this->tpl->setVariable(
"TEXT_ADD_LIMITS", $this->lng->txt(
"add_limits_for_standard_numbers"));
354 $this->tpl->setVariable(
"TEXT_LOWER_LIMIT",$this->lng->txt(
"lower_limit"));
355 $this->tpl->setVariable(
"TEXT_UPPER_LIMIT",$this->lng->txt(
"upper_limit"));
356 $this->tpl->setVariable(
"VALUE_LOWER_LIMIT",
$_POST[
"lower_limit"]);
357 $this->tpl->setVariable(
"VALUE_UPPER_LIMIT",
$_POST[
"upper_limit"]);
358 $this->tpl->setVariable(
"BTN_ADD",$this->lng->txt(
"add_phrase"));
359 $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
"cancel"));
360 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
361 $this->tpl->parseCurrentBlock();
372 $this->ctrl->redirect($this,
"editQuestion");
382 if ((strcmp(
$_POST[
"lower_limit"],
"") == 0) or (strcmp(
$_POST[
"upper_limit"],
"") == 0))
387 else if ((
int)
$_POST[
"upper_limit"] <= (
int)
$_POST[
"lower_limit"])
394 $this->
object->addStandardNumbers($_POST[
"lower_limit"], $_POST[
"upper_limit"]);
395 $this->
object->saveToDb();
397 $this->ctrl->redirect($this,
"editQuestion");
411 if (!$haserror) $this->
object->saveToDb();
413 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_savephrase.html",
"Modules/SurveyQuestionPool");
414 $this->tpl->setCurrentBlock(
"adm_content");
415 $this->tpl->setVariable(
"SAVE_PHRASE_INTRODUCTION", $this->lng->txt(
"save_phrase_introduction"));
416 $this->tpl->setVariable(
"TEXT_PHRASE_TITLE", $this->lng->txt(
"enter_phrase_title"));
417 $this->tpl->setVariable(
"VALUE_PHRASE_TITLE",
$_POST[
"phrase_title"]);
418 $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
"cancel"));
419 $this->tpl->setVariable(
"BTN_CONFIRM",$this->lng->txt(
"confirm"));
420 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
422 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveySavePhraseTableGUI.php";
428 foreach (
$_POST[
'answers'][
'answer'] as $key => $value)
430 array_push(
$data, array(
'answer' => $value,
'other' => ((
$_POST[
'answers'][
'other'][$key]) ?
true :
false),
'scale' =>
$_POST[
'answers'][
'scale'][$key],
'neutral' =>
false));
432 if (strlen(
$_POST[
'answers'][
'neutral']))
434 array_push(
$data, array(
'answer' =>
$_POST[
'answers'][
'neutral'],
'other' =>
false,
'scale' =>
$_POST[
'answers_neutral_scale'],
'neutral' =>
true));
441 $table_gui->setData(
$data);
443 $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());
444 $this->tpl->parseCurrentBlock();
456 $this->ctrl->redirect($this,
"editQuestion");
466 if (!
$_POST[
"phrase_title"])
473 if ($this->object->phraseExists(
$_POST[
"phrase_title"]))
480 $this->
object->savePhrase(
$_POST[
"phrase_title"]);
482 $this->ctrl->redirect($this,
"editQuestion");
491 function getWorkingForm($working_data =
"", $question_title = 1, $show_questiontext = 1, $error_message =
"", $survey_id = null)
493 $template =
new ilTemplate(
"tpl.il_svy_out_sc.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
494 $template->setCurrentBlock(
"material");
496 $template->parseCurrentBlock();
497 switch ($this->object->orientation)
501 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
503 $cat = $this->
object->categories->getCategory($i);
506 $template->setCurrentBlock(
"other_row");
507 if (strlen($cat->title))
509 $template->setVariable(
"OTHER_LABEL", $cat->title);
511 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) : $i);
512 $template->setVariable(
"QUESTION_ID", $this->object->getId());
513 if (is_array($working_data))
515 foreach ($working_data as $value)
517 if (strlen($value[
"value"]))
519 if ($value[
"value"] == $cat->scale-1)
521 if (strlen($value[
'textanswer'])) $template->setVariable(
"OTHER_VALUE",
' value="' .
ilUtil::prepareFormOutput($value[
'textanswer']) .
'"');
522 if (!$value[
'uncheck'])
524 $template->setVariable(
"CHECKED_SC",
" checked=\"checked\"");
530 $template->parseCurrentBlock();
534 $template->setCurrentBlock(
"row");
535 if ($cat->neutral) $template->setVariable(
'ROWCLASS',
' class="neutral"');
537 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) : $i);
538 $template->setVariable(
"QUESTION_ID", $this->object->getId());
539 if (is_array($working_data))
541 foreach ($working_data as $value)
543 if (strcmp($value[
"value"],
"") != 0)
545 if ($value[
"value"] == $cat->scale-1)
547 if (!$value[
'uncheck'])
549 $template->setVariable(
"CHECKED_SC",
" checked=\"checked\"");
555 $template->parseCurrentBlock();
557 $template->touchBlock(
'outer_row');
562 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
564 $cat = $this->
object->categories->getCategory($i);
565 $template->setCurrentBlock(
"radio_col");
566 if ($cat->neutral) $template->setVariable(
'COLCLASS',
' neutral');
567 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) : $i);
568 $template->setVariable(
"QUESTION_ID", $this->object->getId());
569 if (is_array($working_data))
571 foreach ($working_data as $value)
573 if (strcmp($value[
"value"],
"") != 0)
575 if ($value[
"value"] == $cat->scale-1)
577 if (!$value[
'uncheck'])
579 $template->setVariable(
"CHECKED_SC",
" checked=\"checked\"");
585 $template->parseCurrentBlock();
587 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
589 $cat = $this->
object->categories->getCategory($i);
592 $template->setCurrentBlock(
"text_other_col");
593 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) : $i);
594 $template->setVariable(
"QUESTION_ID", $this->object->getId());
595 if (strlen($cat->title))
597 $template->setVariable(
"OTHER_LABEL", $cat->title);
599 if (is_array($working_data))
601 foreach ($working_data as $value)
603 if (strlen($value[
"value"]))
605 if ($value[
"value"] == $cat->scale-1 && strlen($value[
'textanswer']))
612 $template->parseCurrentBlock();
616 $template->setCurrentBlock(
"text_col");
617 if ($cat->neutral) $template->setVariable(
'COLCLASS',
' neutral');
618 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) : $i);
620 $template->setVariable(
"QUESTION_ID", $this->object->getId());
621 $template->parseCurrentBlock();
623 $template->touchBlock(
'text_outer_col');
628 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
630 $cat = $this->
object->categories->getCategory($i);
631 $template->setCurrentBlock(
"comborow");
632 $template->setVariable(
"TEXT_SC", $cat->title);
633 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) : $i);
634 if (is_array($working_data))
636 if (strcmp($working_data[0][
"value"],
"") != 0)
638 if ($working_data[0][
"value"] == $cat->scale-1)
640 $template->setVariable(
"SELECTED_SC",
" selected=\"selected\"");
644 $template->parseCurrentBlock();
646 $template->setCurrentBlock(
"combooutput");
647 $template->setVariable(
"QUESTION_ID", $this->object->getId());
648 $template->setVariable(
"SELECT_OPTION", $this->lng->txt(
"select_option"));
649 $template->setVariable(
"TEXT_SELECTION", $this->lng->txt(
"selection"));
650 $template->parseCurrentBlock();
655 $template->setVariable(
"QUESTION_TITLE", $this->object->getTitle());
657 $template->setCurrentBlock(
"question_data");
658 if (strcmp($error_message,
"") != 0)
660 $template->setVariable(
"ERROR_MESSAGE",
"<p class=\"warning\">$error_message</p>");
662 if ($show_questiontext)
666 $template->parseCurrentBlock();
667 return $template->get();
675 function getPrintView($question_title = 1, $show_questiontext = 1, $survey_id = null)
677 $template =
new ilTemplate(
"tpl.il_svy_qpl_sc_printview.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
678 switch ($this->object->orientation)
682 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
684 $cat = $this->
object->categories->getCategory($i);
687 $template->setCurrentBlock(
"other_row");
689 $template->setVariable(
"ALT_RADIO", $this->lng->txt(
"unchecked"));
690 $template->setVariable(
"TITLE_RADIO", $this->lng->txt(
"unchecked"));
692 $template->setVariable(
"OTHER_ANSWER",
" ");
693 $template->parseCurrentBlock();
697 $template->setCurrentBlock(
"row");
699 $template->setVariable(
"ALT_RADIO", $this->lng->txt(
"unchecked"));
700 $template->setVariable(
"TITLE_RADIO", $this->lng->txt(
"unchecked"));
702 $template->parseCurrentBlock();
708 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
710 $template->setCurrentBlock(
"radio_col");
712 $template->setVariable(
"ALT_RADIO", $this->lng->txt(
"unchecked"));
713 $template->setVariable(
"TITLE_RADIO", $this->lng->txt(
"unchecked"));
714 $template->parseCurrentBlock();
716 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
718 $cat = $this->
object->categories->getCategory($i);
721 $template->setCurrentBlock(
"other_text_col");
723 $template->setVariable(
"OTHER_ANSWER",
" ");
724 $template->parseCurrentBlock();
728 $template->setCurrentBlock(
"text_col");
730 $template->parseCurrentBlock();
736 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
738 $cat = $this->
object->categories->getCategory($i);
739 $template->setCurrentBlock(
"comborow");
741 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) : $i);
742 if (is_array($working_data))
744 if (strcmp($working_data[0][
"value"],
"") != 0)
746 if ($working_data[0][
"value"] == $i)
748 $template->setVariable(
"SELECTED_SC",
" selected=\"selected\"");
752 $template->parseCurrentBlock();
754 $template->setCurrentBlock(
"combooutput");
755 $template->setVariable(
"QUESTION_ID", $this->object->getId());
756 $template->setVariable(
"SELECT_OPTION", $this->lng->txt(
"select_option"));
757 $template->setVariable(
"TEXT_SELECTION", $this->lng->txt(
"selection"));
758 $template->parseCurrentBlock();
763 $template->setVariable(
"QUESTION_TITLE", $this->object->getTitle());
765 if ($show_questiontext)
769 $template->parseCurrentBlock();
770 return $template->get();
775 global $rbacsystem,$ilTabs;
776 $this->ctrl->setParameter($this,
"sel_question_types", $this->
getQuestionType());
777 $this->ctrl->setParameter($this,
"q_id",
$_GET[
"q_id"]);
779 if ((
$_GET[
"calling_survey"] > 0) || (
$_GET[
"new_for_survey"] > 0))
784 if (strlen(
$_GET[
"new_for_survey"]))
786 $addurl =
"&new_id=" .
$_GET[
"q_id"];
790 $addurl .=
"&pgov=".$_REQUEST[
"pgov"];
791 $addurl .=
"&pgov_pos=".$_REQUEST[
"pgov_pos"];
793 $ilTabs->setBackTarget($this->lng->txt(
"menubacktosurvey"),
"ilias.php?baseClass=ilObjSurveyGUI&ref_id=$ref_id&cmd=questions" . $addurl);
797 $this->ctrl->setParameterByClass(
"ilObjSurveyQuestionPoolGUI",
"q_id_table_nav",
$_SESSION[
'q_id_table_nav']);
798 $ilTabs->setBackTarget($this->lng->txt(
"spl"), $this->ctrl->getLinkTargetByClass(
"ilObjSurveyQuestionPoolGUI",
"questions"));
802 $ilTabs->addTarget(
"preview",
803 $this->ctrl->getLinkTarget($this,
"preview"),
809 if ($rbacsystem->checkAccess(
'edit',
$_GET[
"ref_id"])) {
810 $ilTabs->addTarget(
"edit_properties",
811 $this->ctrl->getLinkTarget($this,
"editQuestion"),
812 array(
"editQuestion",
"save",
"cancel",
"wizardanswers",
"addSelectedPhrase",
813 "insertStandardNumbers",
"savePhraseanswers",
"confirmSavePhrase"),
820 $ilTabs->addTarget(
"material",
821 $this->ctrl->getLinkTarget($this,
"material"),
822 array(
"material",
"cancelExplorer",
"linkChilds",
"addGIT",
"addST",
823 "addPG",
"addMaterial",
"removeMaterial"),
829 if ($this->object->getId() > 0)
831 $title = $this->lng->txt(
"edit") .
" "" . $this->
object->getTitle() .
""";
838 $this->tpl->setVariable(
"HEADER",
$title);
851 if (count($this->cumulated) == 0)
853 include_once
"./Modules/Survey/classes/class.ilObjSurvey.php";
855 $this->cumulated =& $this->
object->getCumulatedResults($survey_id, $nr_of_users);
858 include_once
"./Services/UICore/classes/class.ilTemplate.php";
859 $template =
new ilTemplate(
"tpl.il_svy_svy_cumulated_results_detail.html", TRUE, TRUE,
"Modules/Survey");
861 $template->setCurrentBlock(
"detail_row");
862 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"question"));
863 $questiontext = $this->
object->getQuestiontext();
864 $template->setVariable(
"TEXT_OPTION_VALUE", $this->object->prepareTextareaOutput($questiontext, TRUE));
865 $template->parseCurrentBlock();
866 $template->setCurrentBlock(
"detail_row");
867 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"question_type"));
868 $template->setVariable(
"TEXT_OPTION_VALUE", $this->lng->txt($this->getQuestionType()));
869 $template->parseCurrentBlock();
870 $template->setCurrentBlock(
"detail_row");
871 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_answered"));
872 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"USERS_ANSWERED"]);
873 $template->parseCurrentBlock();
874 $template->setCurrentBlock(
"detail_row");
875 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_skipped"));
876 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"USERS_SKIPPED"]);
877 $template->parseCurrentBlock();
888 $template->setCurrentBlock(
"detail_row");
889 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"median"));
890 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"MEDIAN"]);
891 $template->parseCurrentBlock();
893 $template->setCurrentBlock(
"detail_row");
894 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"categories"));
896 foreach ($this->cumulated[
"variables"] as $key => $value)
898 $categories .=
"<li>" . $value[
"title"] .
": n=" . $value[
"selected"] .
899 " (" . sprintf(
"%.2f", 100*$value[
"percentage"]) .
"%)</li>";
901 $categories =
"<ol>$categories</ol>";
902 $template->setVariable(
"TEXT_OPTION_VALUE", $categories);
903 $template->parseCurrentBlock();
906 if (is_array($this->cumulated[
"textanswers"]))
908 $template->setCurrentBlock(
"detail_row");
909 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"freetext_answers"));
911 foreach ($this->cumulated[
"textanswers"] as $key => $answers)
913 $html .= $this->cumulated[
"variables"][$key][
"title"] .
"\n";
915 foreach ($answers as $answer)
917 $html .=
"<li>" . preg_replace(
"/\n/",
"<br>\n", $answer) .
"</li>\n";
921 $template->setVariable(
"TEXT_OPTION_VALUE", $html);
922 $template->parseCurrentBlock();
926 $template->setCurrentBlock(
"detail_row");
927 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"chart"));
928 $template->setVariable(
"TEXT_OPTION_VALUE", $this->
renderChart(
"svy_ch_".$this->object->getId(), $this->cumulated[
"variables"]));
929 $template->parseCurrentBlock();
931 $template->setVariable(
"QUESTION_TITLE",
"$counter. ".$this->object->getTitle());
932 return $template->get();