4include_once(
"./Services/Table/classes/class.ilTable2GUI.php");
23 $this->read_only = (bool)$a_read_only;
25 parent::__construct($a_parent_obj, $a_parent_cmd);
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)
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)
192 $this->tpl->setVariable(
"TEXT_EDIT_PRECONDITION",
$lng->txt(
"edit"));
193 $this->tpl->setVariable(
"EDIT_PRECONDITION",
$url);
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();
TableGUI class for survey constraints.
__construct($a_parent_obj, $a_parent_cmd="", ilObjSurvey $a_survey, $a_read_only)
fillRow($a_set)
Standard Version of Fill Row.
initItems(ilObjSurvey $a_survey)
getConstraints($question_id)
Returns the constraints to a given question or questionblock.
& getSurveyQuestions($with_answers=false)
Returns the survey questions and questionblocks in an array.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
getParentObject()
Get parent object.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setLimit($a_limit=0, $a_default_limit=0)
set max.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
setDescription($a_val)
Set description.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)