36 $this->
ctrl = $DIC->ctrl();
37 $this->
lng = $DIC->language();
38 $ilCtrl = $DIC->ctrl();
39 $lng = $DIC->language();
41 $this->read_only = $a_read_only;
50 if (!$this->read_only) {
59 $this->
setRowTemplate(
"tpl.svy_constraints_row.html",
"Modules/Survey");
61 if (!$this->read_only) {
73 $this->structure = array();
78 $last_questionblock_id = 0;
80 foreach ($survey_questions as
$data) {
83 if ($data[
"questionblock_id"] > 0) {
84 $title = $data[
"questionblock_title"];
86 if ($data[
"questionblock_id"] != $last_questionblock_id) {
87 $last_questionblock_id = $data[
"questionblock_id"];
88 $this->structure[$counter] = array();
89 $this->structure[$counter][] = $data[
"question_id"];
91 $this->structure[$counter - 1][] = $data[
"question_id"];
95 $this->structure[$counter] = array($data[
"question_id"]);
99 $id = $content = $parsed = $conjunction = null;
101 if ($counter === 1) {
102 $content =
$lng->
txt(
"constraints_first_question_description");
105 if (count($constraints)) {
108 foreach ($constraints as $constraint) {
110 "id" => $constraint[
"id"],
111 "title" => $survey_questions[$constraint[
"question"]][
"title"] .
" " .
112 $constraint[
"short"] .
" " .
113 $constraint[
"valueoutput"]
117 if (count($constraints) > 1) {
118 $conjunction = ($constraints[0][
'conjunction'])
119 ?
$lng->
txt(
'conjunction_or_title')
120 :
$lng->
txt(
'conjunction_and_title');
124 if ($counter !== 1) {
128 $icontype =
"question.png";
129 if ($data[
"questionblock_id"] > 0) {
130 $icontype =
"questionblock.png";
134 "counter" => $counter,
139 "content" => $content,
140 "constraints" => $parsed,
141 "conjunction" => $conjunction
156 protected function fillRow(array $a_set): void
163 if (!$this->read_only) {
165 $this->tpl->setVariable(
"ID", $a_set[
"id"]);
167 $this->tpl->touchBlock(
"checkbox");
171 $this->tpl->setVariable(
"COUNTER", $a_set[
"counter"]);
172 $this->tpl->setVariable(
"TITLE", $a_set[
"title"]);
173 $this->tpl->setVariable(
"TYPE", $a_set[
"type"]);
174 $this->tpl->setVariable(
"ICON_HREF", $a_set[
"icon"]);
175 $this->tpl->setVariable(
"ICON_ALT", $a_set[
"type"]);
176 $this->tpl->setVariable(
"CONTENT", $a_set[
"content"]);
178 if (is_array($a_set[
"constraints"])) {
179 foreach ($a_set[
"constraints"] as $constraint) {
180 if (!$this->read_only) {
181 $ilCtrl->setParameter($this->
getParentObject(),
"precondition", $constraint[
"id"]);
182 $ilCtrl->setParameter($this->
getParentObject(),
"start", $a_set[
"counter"]);
186 $this->tpl->setVariable(
"TEXT_EDIT_PRECONDITION",
$lng->
txt(
"edit"));
187 $this->tpl->setVariable(
"EDIT_PRECONDITION",
$url);
189 $ilCtrl->setParameter($this->
getParentObject(),
"precondition", $constraint[
"id"]);
192 $this->tpl->setVariable(
"TEXT_DELETE_PRECONDITION",
$lng->
txt(
"delete"));
193 $this->tpl->setVariable(
"DELETE_PRECONDITION",
$url);
196 $this->tpl->setCurrentBlock(
"constraint");
197 $this->tpl->setVariable(
"CONSTRAINT_TEXT", $constraint[
"title"]);
198 $this->tpl->parseCurrentBlock();
201 if ($a_set[
"conjunction"]) {
202 $this->tpl->setCurrentBlock(
"conjunction");
203 $this->tpl->setVariable(
"TEXT_CONJUNCTION", $a_set[
"conjunction"]);
204 $this->tpl->parseCurrentBlock();
getSurveyQuestions(bool $with_answers=false)
Returns the survey questions and questionblocks in an array.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setFormAction(string $a_form_action, bool $a_multipart=false)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
setDescription(string $a_val)
initItems(ilObjSurvey $a_survey)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getConstraints(int $question_id)
Returns the constraints to a given question or questionblock.
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
__construct(object $a_parent_obj, string $a_parent_cmd, ilObjSurvey $a_survey, bool $a_read_only)
__construct(Container $dic, ilPlugin $plugin)
setLimit(int $a_limit=0, int $a_default_limit=0)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
disable(string $a_module_name)
addMultiCommand(string $a_cmd, string $a_text)