4 include_once(
"./Services/Table/classes/class.ilTable2GUI.php");
23 $this->ctrl = $DIC->ctrl();
24 $this->lng = $DIC->language();
26 $lng = $DIC->language();
28 $this->read_only = (bool) $a_read_only;
30 parent::__construct($a_parent_obj, $a_parent_cmd);
37 if (!$this->read_only) {
42 $this->
addColumn(
$lng->txt(
"constraints_list_of_entities"),
"");
46 $this->
setRowTemplate(
"tpl.svy_constraints_row.html",
"Modules/Survey");
48 if (!$this->read_only) {
60 $this->structure =
array();
65 $last_questionblock_id = 0;
67 foreach ($survey_questions as
$data) {
70 if ($data[
"questionblock_id"] > 0) {
71 $title = $data[
"questionblock_title"];
73 if ($data[
"questionblock_id"] != $last_questionblock_id) {
74 $last_questionblock_id = $data[
"questionblock_id"];
76 array_push($this->structure[
$counter], $data[
"question_id"]);
78 array_push($this->structure[
$counter-1], $data[
"question_id"]);
86 $id = $content = $parsed = $conjunction = null;
89 $content =
$lng->txt(
"constraints_first_question_description");
92 if (count($constraints)) {
95 foreach ($constraints as $constraint) {
97 "id" => $constraint[
"id"],
98 "title" => $survey_questions[$constraint[
"question"]][
"title"] .
" " .
99 $constraint[
"short"] .
" " .
100 $constraint[
"valueoutput"]
104 if (count($constraints) > 1) {
105 $conjunction = ($constraints[0][
'conjunction'])
106 ?
$lng->txt(
'conjunction_or_title')
107 :
$lng->txt(
'conjunction_and_title');
115 $icontype =
"question.png";
116 if ($data[
"questionblock_id"] > 0) {
117 $icontype =
"questionblock.png";
126 "content" => $content,
127 "constraints" => $parsed,
128 "conjunction" => $conjunction
150 if (!$this->read_only) {
152 $this->tpl->setVariable(
"ID", $a_set[
"id"]);
154 $this->tpl->touchBlock(
"checkbox");
158 $this->tpl->setVariable(
"COUNTER", $a_set[
"counter"]);
159 $this->tpl->setVariable(
"TITLE", $a_set[
"title"]);
160 $this->tpl->setVariable(
"TYPE", $a_set[
"type"]);
161 $this->tpl->setVariable(
"ICON_HREF", $a_set[
"icon"]);
162 $this->tpl->setVariable(
"ICON_ALT", $a_set[
"type"]);
163 $this->tpl->setVariable(
"CONTENT", $a_set[
"content"]);
165 if (is_array($a_set[
"constraints"])) {
166 foreach ($a_set[
"constraints"] as $constraint) {
167 if (!$this->read_only) {
173 $this->tpl->setVariable(
"TEXT_EDIT_PRECONDITION",
$lng->txt(
"edit"));
174 $this->tpl->setVariable(
"EDIT_PRECONDITION",
$url);
179 $this->tpl->setVariable(
"TEXT_DELETE_PRECONDITION",
$lng->txt(
"delete"));
180 $this->tpl->setVariable(
"DELETE_PRECONDITION",
$url);
183 $this->tpl->setCurrentBlock(
"constraint");
184 $this->tpl->setVariable(
"CONSTRAINT_TEXT", $constraint[
"title"]);
185 $this->tpl->parseCurrentBlock();
188 if ($a_set[
"conjunction"]) {
189 $this->tpl->setCurrentBlock(
"conjunction");
190 $this->tpl->setVariable(
"TEXT_CONJUNCTION", $a_set[
"conjunction"]);
191 $this->tpl->parseCurrentBlock();
setDescription($a_val)
Set description.
getConstraints($question_id)
Returns the constraints to a given question or questionblock.
if(!array_key_exists('StateId', $_REQUEST)) $id
initItems(ilObjSurvey $a_survey)
getParentObject()
Get parent object.
TableGUI class for survey constraints.
& getSurveyQuestions($with_answers=false)
Returns the survey questions and questionblocks in an array.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
addMultiCommand($a_cmd, $a_text)
Add Command button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
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.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
setLimit($a_limit=0, $a_default_limit=0)
__construct($a_parent_obj, $a_parent_cmd="", ilObjSurvey $a_survey, $a_read_only)