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->removePlugin(
"ibrowser");
155 $question->setRTESupport($this->object->getId(),
"spl",
"survey", null,
false,
"3.4.7");
156 $form->addItem($question);
161 $shuffle->setChecked($this->object->getObligatory());
162 $shuffle->setRequired(FALSE);
163 $form->addItem($shuffle);
168 $orientation->setValue($this->object->getOrientation());
169 $orientation->addOption(
new ilRadioOption($this->lng->txt(
'vertical'), 0));
170 $orientation->addOption(
new ilRadioOption($this->lng->txt(
'horizontal'), 1));
171 $orientation->addOption(
new ilRadioOption($this->lng->txt(
'combobox'), 2));
172 $form->addItem($orientation);
175 include_once
"./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php";
178 $answers->setAllowMove(
true);
179 $answers->setShowWizard(
true);
180 $answers->setShowSavePhrase(
true);
181 $answers->setUseOtherAnswer(
true);
182 $answers->setShowNeutralCategory(
true);
183 $answers->setNeutralCategoryTitle($this->lng->txt(
'matrix_neutral_answer'));
184 if (!$this->object->getCategories()->getCategoryCount())
186 $this->
object->getCategories()->addCategory(
"");
188 $answers->setValues($this->object->getCategories());
189 $answers->setDisabledScale(
false);
190 $form->addItem($answers);
196 if ($this->
isSaveCommand(array(
"wizardanswers",
"savePhraseanswers")))
198 $form->setValuesByPost();
199 $errors = !$form->checkInput();
200 $form->setValuesByPost();
201 if (
$errors) $checkonly =
false;
204 if (!$checkonly) $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
214 $position = key(
$_POST[
'cmd'][
'addanswers']);
215 $this->
object->getCategories()->addCategoryAtPosition(
"", $position+1);
225 $position = key(
$_POST[
'cmd'][
'removeanswers']);
226 $this->
object->getCategories()->removeCategory($position);
236 $position = key(
$_POST[
'cmd'][
'upanswers']);
237 $this->
object->getCategories()->moveCategoryUp($position);
247 $position = key(
$_POST[
'cmd'][
'downanswers']);
248 $this->
object->getCategories()->moveCategoryDown($position);
260 if (
$result == 0 || !$save_post_data)
262 if ($save_post_data) $this->
object->saveToDb();
263 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_addphrase.html",
"Modules/SurveyQuestionPool");
266 $this->tpl->setCurrentBlock(
"hidden");
267 $this->tpl->setVariable(
"HIDDEN_NAME",
"id");
268 $this->tpl->setVariable(
"HIDDEN_VALUE", $this->object->getId());
269 $this->tpl->parseCurrentBlock();
271 include_once
"./Modules/SurveyQuestionPool/classes/class.ilSurveyPhrases.php";
273 $colors = array(
"tblrow1",
"tblrow2");
275 foreach ($phrases as $phrase_id => $phrase_array)
277 $this->tpl->setCurrentBlock(
"phraserow");
278 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter++ % 2]);
279 $this->tpl->setVariable(
"PHRASE_VALUE", $phrase_id);
280 $this->tpl->setVariable(
"PHRASE_NAME", $phrase_array[
"title"]);
282 $this->tpl->setVariable(
"PHRASE_CONTENT", join($categories,
","));
283 $this->tpl->parseCurrentBlock();
286 $this->tpl->setCurrentBlock(
"adm_content");
287 $this->tpl->setVariable(
"TEXT_CANCEL", $this->lng->txt(
"cancel"));
288 $this->tpl->setVariable(
"TEXT_PHRASE", $this->lng->txt(
"phrase"));
289 $this->tpl->setVariable(
"TEXT_CONTENT", $this->lng->txt(
"categories"));
290 $this->tpl->setVariable(
"TEXT_ADD_PHRASE", $this->lng->txt(
"add_phrase"));
291 $this->tpl->setVariable(
"TEXT_INTRODUCTION",$this->lng->txt(
"add_phrase_introduction"));
292 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
293 $this->tpl->parseCurrentBlock();
305 $this->ctrl->redirect($this,
'editQuestion');
315 if (strcmp(
$_POST[
"phrases"],
"") == 0)
322 if (strcmp($this->object->getPhrase(
$_POST[
"phrases"]),
"dp_standard_numbers") != 0)
324 $this->
object->addPhrase(
$_POST[
"phrases"]);
325 $this->
object->saveToDb();
333 $this->ctrl->redirect($this,
'editQuestion');
344 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_addphrase_standard_numbers.html",
"Modules/SurveyQuestionPool");
347 $this->tpl->setCurrentBlock(
"hidden");
348 $this->tpl->setVariable(
"HIDDEN_NAME",
"id");
349 $this->tpl->setVariable(
"HIDDEN_VALUE", $this->object->getId());
350 $this->tpl->parseCurrentBlock();
352 $this->tpl->setCurrentBlock(
"adm_content");
353 $this->tpl->setVariable(
"ADD_STANDARD_NUMBERS", $this->lng->txt(
"add_standard_numbers"));
354 $this->tpl->setVariable(
"TEXT_ADD_LIMITS", $this->lng->txt(
"add_limits_for_standard_numbers"));
355 $this->tpl->setVariable(
"TEXT_LOWER_LIMIT",$this->lng->txt(
"lower_limit"));
356 $this->tpl->setVariable(
"TEXT_UPPER_LIMIT",$this->lng->txt(
"upper_limit"));
357 $this->tpl->setVariable(
"VALUE_LOWER_LIMIT",
$_POST[
"lower_limit"]);
358 $this->tpl->setVariable(
"VALUE_UPPER_LIMIT",
$_POST[
"upper_limit"]);
359 $this->tpl->setVariable(
"BTN_ADD",$this->lng->txt(
"add_phrase"));
360 $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
"cancel"));
361 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
362 $this->tpl->parseCurrentBlock();
373 $this->ctrl->redirect($this,
"editQuestion");
383 if ((strcmp(
$_POST[
"lower_limit"],
"") == 0) or (strcmp(
$_POST[
"upper_limit"],
"") == 0))
388 else if ((
int)
$_POST[
"upper_limit"] <= (
int)
$_POST[
"lower_limit"])
395 $this->
object->addStandardNumbers($_POST[
"lower_limit"], $_POST[
"upper_limit"]);
396 $this->
object->saveToDb();
398 $this->ctrl->redirect($this,
"editQuestion");
412 if (!$haserror) $this->
object->saveToDb();
414 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_savephrase.html",
"Modules/SurveyQuestionPool");
415 $this->tpl->setCurrentBlock(
"adm_content");
416 $this->tpl->setVariable(
"SAVE_PHRASE_INTRODUCTION", $this->lng->txt(
"save_phrase_introduction"));
417 $this->tpl->setVariable(
"TEXT_PHRASE_TITLE", $this->lng->txt(
"enter_phrase_title"));
418 $this->tpl->setVariable(
"VALUE_PHRASE_TITLE",
$_POST[
"phrase_title"]);
419 $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
"cancel"));
420 $this->tpl->setVariable(
"BTN_CONFIRM",$this->lng->txt(
"confirm"));
421 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
423 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveySavePhraseTableGUI.php";
429 foreach (
$_POST[
'answers'][
'answer'] as $key => $value)
431 array_push(
$data, array(
'answer' => $value,
'other' => ((
$_POST[
'answers'][
'other'][$key]) ?
true :
false),
'scale' =>
$_POST[
'answers'][
'scale'][$key],
'neutral' =>
false));
433 if (strlen(
$_POST[
'answers'][
'neutral']))
435 array_push(
$data, array(
'answer' =>
$_POST[
'answers'][
'neutral'],
'other' =>
false,
'scale' =>
$_POST[
'answers_neutral_scale'],
'neutral' =>
true));
442 $table_gui->setData(
$data);
444 $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());
445 $this->tpl->parseCurrentBlock();
457 $this->ctrl->redirect($this,
"editQuestion");
467 if (!
$_POST[
"phrase_title"])
474 if ($this->object->phraseExists(
$_POST[
"phrase_title"]))
481 $this->
object->savePhrase(
$_POST[
"phrase_title"]);
483 $this->ctrl->redirect($this,
"editQuestion");
492 function getWorkingForm($working_data =
"", $question_title = 1, $show_questiontext = 1, $error_message =
"", $survey_id = null)
494 $template =
new ilTemplate(
"tpl.il_svy_out_sc.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
495 $template->setCurrentBlock(
"material");
497 $template->parseCurrentBlock();
498 switch ($this->object->orientation)
502 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
504 $cat = $this->
object->categories->getCategory($i);
507 $template->setCurrentBlock(
"other_row");
508 if (strlen($cat->title))
510 $template->setVariable(
"OTHER_LABEL", $cat->title);
512 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) : $i);
513 $template->setVariable(
"QUESTION_ID", $this->object->getId());
514 if (is_array($working_data))
516 foreach ($working_data as $value)
518 if (strlen($value[
"value"]))
520 if ($value[
"value"] == $cat->scale-1)
522 if (strlen($value[
'textanswer'])) $template->setVariable(
"OTHER_VALUE",
' value="' .
ilUtil::prepareFormOutput($value[
'textanswer']) .
'"');
523 if (!$value[
'uncheck'])
525 $template->setVariable(
"CHECKED_SC",
" checked=\"checked\"");
531 $template->parseCurrentBlock();
535 $template->setCurrentBlock(
"row");
536 if ($cat->neutral) $template->setVariable(
'ROWCLASS',
' class="neutral"');
538 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) : $i);
539 $template->setVariable(
"QUESTION_ID", $this->object->getId());
540 if (is_array($working_data))
542 foreach ($working_data as $value)
544 if (strcmp($value[
"value"],
"") != 0)
546 if ($value[
"value"] == $cat->scale-1)
548 if (!$value[
'uncheck'])
550 $template->setVariable(
"CHECKED_SC",
" checked=\"checked\"");
556 $template->parseCurrentBlock();
558 $template->touchBlock(
'outer_row');
563 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
565 $cat = $this->
object->categories->getCategory($i);
566 $template->setCurrentBlock(
"radio_col");
567 if ($cat->neutral) $template->setVariable(
'COLCLASS',
' neutral');
568 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) : $i);
569 $template->setVariable(
"QUESTION_ID", $this->object->getId());
570 if (is_array($working_data))
572 foreach ($working_data as $value)
574 if (strcmp($value[
"value"],
"") != 0)
576 if ($value[
"value"] == $cat->scale-1)
578 if (!$value[
'uncheck'])
580 $template->setVariable(
"CHECKED_SC",
" checked=\"checked\"");
586 $template->parseCurrentBlock();
588 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
590 $cat = $this->
object->categories->getCategory($i);
593 $template->setCurrentBlock(
"text_other_col");
594 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) : $i);
595 $template->setVariable(
"QUESTION_ID", $this->object->getId());
596 if (strlen($cat->title))
598 $template->setVariable(
"OTHER_LABEL", $cat->title);
600 if (is_array($working_data))
602 foreach ($working_data as $value)
604 if (strlen($value[
"value"]))
606 if ($value[
"value"] == $cat->scale-1 && strlen($value[
'textanswer']))
613 $template->parseCurrentBlock();
617 $template->setCurrentBlock(
"text_col");
618 if ($cat->neutral) $template->setVariable(
'COLCLASS',
' neutral');
619 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) : $i);
621 $template->setVariable(
"QUESTION_ID", $this->object->getId());
622 $template->parseCurrentBlock();
624 $template->touchBlock(
'text_outer_col');
629 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
631 $cat = $this->
object->categories->getCategory($i);
632 $template->setCurrentBlock(
"comborow");
633 $template->setVariable(
"TEXT_SC", $cat->title);
634 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) : $i);
635 if (is_array($working_data))
637 if (strcmp($working_data[0][
"value"],
"") != 0)
639 if ($working_data[0][
"value"] == $cat->scale-1)
641 $template->setVariable(
"SELECTED_SC",
" selected=\"selected\"");
645 $template->parseCurrentBlock();
647 $template->setCurrentBlock(
"combooutput");
648 $template->setVariable(
"QUESTION_ID", $this->object->getId());
649 $template->setVariable(
"SELECT_OPTION", $this->lng->txt(
"select_option"));
650 $template->setVariable(
"TEXT_SELECTION", $this->lng->txt(
"selection"));
651 $template->parseCurrentBlock();
656 $template->setVariable(
"QUESTION_TITLE", $this->object->getTitle());
658 $template->setCurrentBlock(
"question_data");
659 if (strcmp($error_message,
"") != 0)
661 $template->setVariable(
"ERROR_MESSAGE",
"<p class=\"warning\">$error_message</p>");
663 if ($show_questiontext)
667 $template->parseCurrentBlock();
668 return $template->get();
676 function getPrintView($question_title = 1, $show_questiontext = 1, $survey_id = null)
678 $template =
new ilTemplate(
"tpl.il_svy_qpl_sc_printview.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
679 switch ($this->object->orientation)
683 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
685 $cat = $this->
object->categories->getCategory($i);
688 $template->setCurrentBlock(
"other_row");
690 $template->setVariable(
"ALT_RADIO", $this->lng->txt(
"unchecked"));
691 $template->setVariable(
"TITLE_RADIO", $this->lng->txt(
"unchecked"));
693 $template->setVariable(
"OTHER_ANSWER",
" ");
694 $template->parseCurrentBlock();
698 $template->setCurrentBlock(
"row");
700 $template->setVariable(
"ALT_RADIO", $this->lng->txt(
"unchecked"));
701 $template->setVariable(
"TITLE_RADIO", $this->lng->txt(
"unchecked"));
703 $template->parseCurrentBlock();
709 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
711 $template->setCurrentBlock(
"radio_col");
713 $template->setVariable(
"ALT_RADIO", $this->lng->txt(
"unchecked"));
714 $template->setVariable(
"TITLE_RADIO", $this->lng->txt(
"unchecked"));
715 $template->parseCurrentBlock();
717 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
719 $cat = $this->
object->categories->getCategory($i);
722 $template->setCurrentBlock(
"other_text_col");
724 $template->setVariable(
"OTHER_ANSWER",
" ");
725 $template->parseCurrentBlock();
729 $template->setCurrentBlock(
"text_col");
731 $template->parseCurrentBlock();
737 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
739 $cat = $this->
object->categories->getCategory($i);
740 $template->setCurrentBlock(
"comborow");
742 $template->setVariable(
"VALUE_SC", ($cat->scale) ? ($cat->scale - 1) : $i);
743 if (is_array($working_data))
745 if (strcmp($working_data[0][
"value"],
"") != 0)
747 if ($working_data[0][
"value"] == $i)
749 $template->setVariable(
"SELECTED_SC",
" selected=\"selected\"");
753 $template->parseCurrentBlock();
755 $template->setCurrentBlock(
"combooutput");
756 $template->setVariable(
"QUESTION_ID", $this->object->getId());
757 $template->setVariable(
"SELECT_OPTION", $this->lng->txt(
"select_option"));
758 $template->setVariable(
"TEXT_SELECTION", $this->lng->txt(
"selection"));
759 $template->parseCurrentBlock();
764 $template->setVariable(
"QUESTION_TITLE", $this->object->getTitle());
766 if ($show_questiontext)
770 $template->parseCurrentBlock();
771 return $template->get();
776 global $rbacsystem,$ilTabs;
777 $this->ctrl->setParameter($this,
"sel_question_types", $this->
getQuestionType());
778 $this->ctrl->setParameter($this,
"q_id",
$_GET[
"q_id"]);
780 if ((
$_GET[
"calling_survey"] > 0) || (
$_GET[
"new_for_survey"] > 0))
785 if (strlen(
$_GET[
"new_for_survey"]))
787 $addurl =
"&new_id=" .
$_GET[
"q_id"];
791 $addurl .=
"&pgov=".$_REQUEST[
"pgov"];
792 $addurl .=
"&pgov_pos=".$_REQUEST[
"pgov_pos"];
794 $ilTabs->setBackTarget($this->lng->txt(
"menubacktosurvey"),
"ilias.php?baseClass=ilObjSurveyGUI&ref_id=$ref_id&cmd=questions" . $addurl);
798 $this->ctrl->setParameterByClass(
"ilObjSurveyQuestionPoolGUI",
"q_id_table_nav",
$_SESSION[
'q_id_table_nav']);
799 $ilTabs->setBackTarget($this->lng->txt(
"spl"), $this->ctrl->getLinkTargetByClass(
"ilObjSurveyQuestionPoolGUI",
"questions"));
803 $ilTabs->addTarget(
"preview",
804 $this->ctrl->getLinkTarget($this,
"preview"),
810 if ($rbacsystem->checkAccess(
'edit',
$_GET[
"ref_id"])) {
811 $ilTabs->addTarget(
"edit_properties",
812 $this->ctrl->getLinkTarget($this,
"editQuestion"),
813 array(
"editQuestion",
"save",
"cancel",
"wizardanswers",
"addSelectedPhrase",
814 "insertStandardNumbers",
"savePhraseanswers",
"confirmSavePhrase"),
821 $ilTabs->addTarget(
"material",
822 $this->ctrl->getLinkTarget($this,
"material"),
823 array(
"material",
"cancelExplorer",
"linkChilds",
"addGIT",
"addST",
824 "addPG",
"addMaterial",
"removeMaterial"),
830 if ($this->object->getId() > 0)
832 $title = $this->lng->txt(
"edit") .
" "" . $this->
object->getTitle() .
""";
839 $this->tpl->setVariable(
"HEADER",
$title);
852 if (count($this->cumulated) == 0)
854 include_once
"./Modules/Survey/classes/class.ilObjSurvey.php";
856 $this->cumulated =& $this->
object->getCumulatedResults($survey_id, $nr_of_users);
859 include_once
"./classes/class.ilTemplate.php";
860 $template =
new ilTemplate(
"tpl.il_svy_svy_cumulated_results_detail.html", TRUE, TRUE,
"Modules/Survey");
862 $template->setCurrentBlock(
"detail_row");
863 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"question"));
864 $questiontext = $this->
object->getQuestiontext();
865 $template->setVariable(
"TEXT_OPTION_VALUE", $this->object->prepareTextareaOutput($questiontext, TRUE));
866 $template->parseCurrentBlock();
867 $template->setCurrentBlock(
"detail_row");
868 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"question_type"));
869 $template->setVariable(
"TEXT_OPTION_VALUE", $this->lng->txt($this->getQuestionType()));
870 $template->parseCurrentBlock();
871 $template->setCurrentBlock(
"detail_row");
872 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_answered"));
873 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"USERS_ANSWERED"]);
874 $template->parseCurrentBlock();
875 $template->setCurrentBlock(
"detail_row");
876 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_skipped"));
877 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"USERS_SKIPPED"]);
878 $template->parseCurrentBlock();
889 $template->setCurrentBlock(
"detail_row");
890 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"median"));
891 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"MEDIAN"]);
892 $template->parseCurrentBlock();
894 $template->setCurrentBlock(
"detail_row");
895 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"categories"));
897 foreach ($this->cumulated[
"variables"] as $key => $value)
899 $categories .=
"<li>" . $value[
"title"] .
": n=" . $value[
"selected"] .
900 " (" . sprintf(
"%.2f", 100*$value[
"percentage"]) .
"%)</li>";
902 $categories =
"<ol>$categories</ol>";
903 $template->setVariable(
"TEXT_OPTION_VALUE", $categories);
904 $template->parseCurrentBlock();
907 if (is_array($this->cumulated[
"textanswers"]))
909 $template->setCurrentBlock(
"detail_row");
910 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"freetext_answers"));
912 foreach ($this->cumulated[
"textanswers"] as $key => $answers)
914 $html .= $this->cumulated[
"variables"][$key][
"title"] .
"\n";
916 foreach ($answers as $answer)
918 $html .=
"<li>" . preg_replace(
"/\n/",
"<br>\n", $answer) .
"</li>\n";
922 $template->setVariable(
"TEXT_OPTION_VALUE", $html);
923 $template->parseCurrentBlock();
927 $template->setCurrentBlock(
"detail_row");
928 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"chart"));
929 $template->setVariable(
"TEXT_OPTION_VALUE", $this->
renderChart(
"svy_ch_".$this->object->getId(), $this->cumulated[
"variables"]));
930 $template->parseCurrentBlock();
932 $template->setVariable(
"QUESTION_TITLE",
"$counter. ".$this->object->getTitle());
933 return $template->get();