57 : string
58 {
60
61 $required = false;
62 $stpl = new \ilTemplate("tpl.page.html", true, true, "components/ILIAS/Survey/Page");
63
64
65 if (count($page) > 1 && $page[0]["questionblock_show_blocktitle"]) {
66 $stpl->setCurrentBlock("questionblock_title");
67 $stpl->setVariable("TEXT_QUESTIONBLOCK_TITLE", $page[0]["questionblock_title"]);
68 $stpl->parseCurrentBlock();
69 }
70
71
72 $compress_view = false;
73 if (count($page) > 1) {
74 $compress_view = $page[0]["questionblock_compress_view"];
75 }
76 $previous_page = null;
77 $previous_key = null;
78 foreach ($page as $k =>
$data) {
79 $page[$k]["compressed"] = false;
80 $page[$k]["compressed_first"] = false;
82 $page[$k]["compressed"] = true;
83 if ($previous_key !== null && $page[$previous_key]["compressed"] == false) {
84 $page[$previous_key]["compressed_first"] = true;
85 }
86 }
87 $previous_key = $k;
88 $previous_page =
$data;
89 }
90
91
92 foreach ($page as
$data) {
93
94 if (
$data[
"heading"]) {
95 $stpl->setCurrentBlock("heading");
96 $stpl->setVariable(
"QUESTION_HEADING",
$data[
"heading"]);
97 $stpl->parseCurrentBlock();
98 }
99 $stpl->setCurrentBlock("survey_content");
100
101 $question_gui = $this->survey->getQuestionGUI(
$data[
"type_tag"],
$data[
"question_id"]);
102
103
104 $question_gui->object->setObligatory(
$data[
"obligatory"]);
105
106
107 $show_questiontext = (
$data[
"questionblock_show_questiontext"]) ? 1 : 0;
108
109
111 if (!$this->survey->getShowQuestionTitles() ||
$data[
"compressed_first"]) {
113 }
115 $error = $this->errors[
$data[
"question_id"]] ??
"";
116
117
118
119
120 $question_output = $question_gui->getWorkingForm(
123 $show_questiontext,
125 $this->survey->getSurveyId(),
126 $compress_view
127 );
128
129
130 if (
$data[
"compressed"]) {
131
132
133 $stpl->setVariable("CMPR_CLASS", "il-svy-qst-compressed");
134 }
135 $stpl->setVariable("QUESTION_OUTPUT", $question_output);
136
137
138 $this->
ctrl->setParameter($this,
"qid",
$data[
"question_id"]);
139
140 if (
$data[
"obligatory"]) {
141 $required = true;
142 }
143 $stpl->parseCurrentBlock();
144 }
145
146
147 if ($required) {
148 $stpl->setCurrentBlock("required");
149 $stpl->setVariable(
"TEXT_REQUIRED", $this->
lng->txt(
"required_field"));
150 $stpl->parseCurrentBlock();
151 }
152
153 return $stpl->get();
154 }