4 include_once(
"./Services/Table/classes/class.ilTable2GUI.php");
23 $this->read_only = (bool)$a_read_only;
38 $this->
addColumn($lng->txt(
"constraints_list_of_entities"),
"");
39 $this->
addColumn($lng->txt(
"existing_constraints"),
"");
42 $this->
setRowTemplate(
"tpl.svy_constraints_row.html",
"Modules/Survey");
46 $this->
addMultiCommand(
"createConstraints", $lng->txt(
"constraint_add"));
57 $this->structure = array();
62 $last_questionblock_id = 0;
64 foreach ($survey_questions as
$data)
68 if ($data[
"questionblock_id"] > 0)
70 $title = $data[
"questionblock_title"];
71 $type = $lng->txt(
"questionblock");
72 if ($data[
"questionblock_id"] != $last_questionblock_id)
74 $last_questionblock_id = $data[
"questionblock_id"];
75 $this->structure[$counter] = array();
76 array_push($this->structure[$counter], $data[
"question_id"]);
80 array_push($this->structure[$counter-1], $data[
"question_id"]);
86 $this->structure[$counter] = array($data[
"question_id"]);
87 $type = $lng->txt(
"question");
91 $id = $content = $parsed = $conjunction = null;
95 $content = $lng->txt(
"constraints_first_question_description");
100 if (count($constraints))
104 foreach ($constraints as $constraint)
107 "id" => $constraint[
"id"],
108 "title" => $survey_questions[$constraint[
"question"]][
"title"] .
" " .
109 $constraint[
"short"] .
" " .
110 $constraint[
"valueoutput"]
114 if (count($constraints) > 1)
116 $conjunction = ($constraints[0][
'conjunction'])
117 ? $lng->txt(
'conjunction_or_title')
118 : $lng->txt(
'conjunction_and_title');
127 $icontype =
"question.png";
128 if ($data[
"questionblock_id"] > 0)
130 $icontype =
"questionblock.png";
134 "counter" => $counter,
139 "content" => $content,
140 "constraints" => $parsed,
141 "conjunction" => $conjunction
162 if(!$this->read_only)
166 $this->tpl->setVariable(
"ID", $a_set[
"id"]);
170 $this->tpl->touchBlock(
"checkbox");
174 $this->tpl->setVariable(
"COUNTER", $a_set[
"counter"]);
175 $this->tpl->setVariable(
"TITLE", $a_set[
"title"]);
176 $this->tpl->setVariable(
"TYPE", $a_set[
"type"]);
177 $this->tpl->setVariable(
"ICON_HREF", $a_set[
"icon"]);
178 $this->tpl->setVariable(
"ICON_ALT", $a_set[
"type"]);
179 $this->tpl->setVariable(
"CONTENT", $a_set[
"content"]);
181 if(is_array($a_set[
"constraints"]))
183 foreach($a_set[
"constraints"] as $constraint)
185 if(!$this->read_only)
187 $ilCtrl->setParameter($this->
getParentObject(),
"precondition", $constraint[
"id"]);
188 $ilCtrl->setParameter($this->
getParentObject(),
"start", $a_set[
"counter"]);
189 $url = $ilCtrl->getLinkTarget($this->
getParentObject(),
"editPrecondition");
192 $this->tpl->setVariable(
"TEXT_EDIT_PRECONDITION", $lng->txt(
"edit"));
193 $this->tpl->setVariable(
"EDIT_PRECONDITION", $url);
195 $ilCtrl->setParameter($this->
getParentObject(),
"precondition", $constraint[
"id"]);
196 $url = $ilCtrl->getLinkTarget($this->
getParentObject(),
"confirmDeleteConstraints");
198 $this->tpl->setVariable(
"TEXT_DELETE_PRECONDITION", $lng->txt(
"delete"));
199 $this->tpl->setVariable(
"DELETE_PRECONDITION", $url);
202 $this->tpl->setCurrentBlock(
"constraint");
203 $this->tpl->setVariable(
"CONSTRAINT_TEXT", $constraint[
"title"]);
204 $this->tpl->parseCurrentBlock();
207 if($a_set[
"conjunction"])
209 $this->tpl->setCurrentBlock(
"conjunction");
210 $this->tpl->setVariable(
"TEXT_CONJUNCTION", $a_set[
"conjunction"]);
211 $this->tpl->parseCurrentBlock();