29 protected \ilLanguage
$lng;
42 array $working_data = [],
44 int $question_title_mode = 1
48 $this->
ctrl = $DIC->ctrl();
49 $this->
lng = $DIC->language();
62 $stpl = new \ilTemplate(
"tpl.page.html",
true,
true,
"Modules/Survey/Page");
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();
72 $compress_view =
false;
73 if (count($page) > 1) {
74 $compress_view = $page[0][
"questionblock_compress_view"];
76 $previous_page = 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;
88 $previous_page =
$data;
92 foreach ($page as
$data) {
95 if ($data[
"heading"]) {
96 $stpl->setCurrentBlock(
"heading");
97 $stpl->setVariable(
"QUESTION_HEADING", $data[
"heading"]);
98 $stpl->parseCurrentBlock();
100 $stpl->setCurrentBlock(
"survey_content");
102 $question_gui = $this->survey->getQuestionGUI($data[
"type_tag"], $data[
"question_id"]);
105 $question_gui->object->setObligatory($data[
"obligatory"]);
108 $show_questiontext = ($data[
"questionblock_show_questiontext"]) ? 1 : 0;
112 if (!$this->survey->getShowQuestionTitles() || $data[
"compressed_first"]) {
113 $question_title_mode = 0;
115 $working_data = $this->working_data[$data[
"question_id"]] ?? null;
116 $error = $this->errors[$data[
"question_id"]] ??
"";
121 $question_output = $question_gui->getWorkingForm(
123 $question_title_mode,
126 $this->survey->getSurveyId(),
131 if ($data[
"compressed"]) {
134 $stpl->setVariable(
"CMPR_CLASS",
"il-svy-qst-compressed");
136 $stpl->setVariable(
"QUESTION_OUTPUT", $question_output);
139 $this->
ctrl->setParameter($this,
"qid", $data[
"question_id"]);
141 if ($data[
"obligatory"]) {
144 $stpl->parseCurrentBlock();
149 $stpl->setCurrentBlock(
"required");
150 $stpl->setVariable(
"TEXT_REQUIRED", $this->
lng->txt(
"required_field"));
151 $stpl->parseCurrentBlock();
158 ?array $previous_page,
161 if (is_null($previous_page)) {
165 if ($previous_page[
"type_tag"] === $page[
"type_tag"] &&
166 $page[
"type_tag"] ===
"SurveySingleChoiceQuestion") {
167 if (\SurveySingleChoiceQuestion::compressable($previous_page[
"question_id"], $page[
"question_id"])) {
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...