ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
SurveyMatrixQuestionGUI Class Reference

Matrix question GUI representation. More...

+ Inheritance diagram for SurveyMatrixQuestionGUI:
+ Collaboration diagram for SurveyMatrixQuestionGUI:

Public Member Functions

 setQuestionTabs ()
 
 getParsedAnswers (array $a_working_data=null, $a_only_user_anwers=false)
 
 getPrintView ($question_title=1, $show_questiontext=1, $survey_id=null, array $a_working_data=null)
 Creates a HTML representation of the question. More...
 
 layout ()
 Creates a layout view of the question. More...
 
 saveLayout ()
 Saves the layout for the matrix question. More...
 
 getLayoutRow ()
 Creates a row to define the matrix question layout with percentage values. More...
 
 getWorkingForm ($working_data="", $question_title=1, $show_questiontext=1, $error_message="", $survey_id=null)
 Creates the question output form for the learner. More...
 
 getCumulatedResultsDetails ($survey_id, $counter, $finished_ids)
 Creates the detailed output of the cumulated results for the question. More...
 
- Public Member Functions inherited from SurveyQuestionGUI
 __construct ($a_id=-1)
 
 setQuestionTabs ()
 
executeCommand ()
 
 _getGUIClassNameForId ($a_q_id)
 
 _getClassNameForQType ($q_type)
 
 getQuestionType ()
 Returns the question type string. More...
 
 setBackUrl ($a_url)
 
 setQuestionTabsForClass ($guiclass)
 
 getPrintView ($question_title=1, $show_questiontext=1)
 
 preview ()
 Creates a preview of the question. More...
 
 getWorkingForm ($working_data="", $question_title=1, $show_questiontext=1, $error_message="", $survey_id=null)
 
 getCumulatedResultsDetails ($survey_id, $counter, $finished_ids)
 
 material ($checkonly=FALSE)
 Material tab of the survey questions. More...
 
 deleteMaterial ()
 
 addMaterial ()
 Add materials to a question. More...
 
 removeMaterial ()
 
 cancelExplorer ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 linkChilds ()
 
 savePhrase ($a_reload=false)
 Creates an output to save the current answers as a phrase. More...
 
 confirmSavePhrase ()
 Save a new phrase to the database. More...
 

Protected Member Functions

 initObject ()
 
 addFieldsToEditForm (ilPropertyFormGUI $a_form)
 
 importEditFormValues (ilPropertyFormGUI $a_form)
 
- Protected Member Functions inherited from SurveyQuestionGUI
 initObject ()
 
 outQuestionText ($template)
 
 initEditForm ()
 
 addCommandButtons ($a_form)
 
 editQuestion (ilPropertyFormGUI $a_form=null)
 
 saveSync ()
 
 saveReturn ()
 
 saveForm ()
 
 save ($a_return=false, $a_sync=false)
 
 copySyncForm ()
 
 syncCopies ()
 
 originalSyncForm ()
 
 sync ()
 
 cancelSync ()
 
 redirectAfterSaving ($a_return=false)
 Redirect to calling survey or to edit form. More...
 
 cancel ()
 
 validateEditForm (ilPropertyFormGUI $a_form)
 
 addFieldsToEditForm (ilPropertyFormGUI $a_form)
 
 importEditFormValues (ilPropertyFormGUI $a_form)
 
 getMaterialOutput ()
 Creates the HTML output of the question material(s) More...
 
 renderChart ($a_id, $a_variables)
 
 initPhrasesForm ()
 
 addPhrase (ilPropertyFormGUI $a_form=null)
 Creates an output for the addition of phrases. More...
 
 addSelectedPhrase ()
 

Protected Attributes

 $show_layout_row
 
- Protected Attributes inherited from SurveyQuestionGUI
 $tpl
 
 $lng
 
 $ctrl
 
 $cumulated
 
 $parent_url
 

Additional Inherited Members

- Static Public Member Functions inherited from SurveyQuestionGUI
static & _getQuestionGUI ($questiontype, $question_id=-1)
 Creates a question gui representation. More...
 
- Data Fields inherited from SurveyQuestionGUI
 $object
 

Detailed Description

Matrix question GUI representation.

The SurveyMatrixQuestionGUI class encapsulates the GUI representation for matrix question types.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Version
$Id$

Definition at line 37 of file class.SurveyMatrixQuestionGUI.php.

Member Function Documentation

◆ addFieldsToEditForm()

SurveyMatrixQuestionGUI::addFieldsToEditForm ( ilPropertyFormGUI  $a_form)
protected

Reimplemented from SurveyQuestionGUI.

Definition at line 57 of file class.SurveyMatrixQuestionGUI.php.

58 {
59 // subtype
60 $subtype = new ilRadioGroupInputGUI($this->lng->txt("subtype"), "type");
61 $subtype->setRequired(false);
62 $subtypes = array(
63 "0" => "matrix_subtype_sr",
64 "1" => "matrix_subtype_mr",
65 //"2" => "matrix_subtype_text",
66 //"3" => "matrix_subtype_integer",
67 //"4" => "matrix_subtype_double",
68 //"5" => "matrix_subtype_date",
69 //"6" => "matrix_subtype_time"
70 );
71 foreach ($subtypes as $idx => $st)
72 {
73 $subtype->addOption(new ilRadioOption($this->lng->txt($st), $idx));
74 }
75 $a_form->addItem($subtype);
76
77
78 $header = new ilFormSectionHeaderGUI();
79 $header->setTitle($this->lng->txt("matrix_appearance"));
80 $a_form->addItem($header);
81
82 // column separators
83 $column_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_column_separators"), "column_separators");
84 $column_separators->setValue(1);
85 $column_separators->setInfo($this->lng->txt("matrix_column_separators_description"));
86 $column_separators->setRequired(false);
87 $a_form->addItem($column_separators);
88
89 // row separators
90 $row_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_row_separators"), "row_separators");
91 $row_separators->setValue(1);
92 $row_separators->setInfo($this->lng->txt("matrix_row_separators_description"));
93 $row_separators->setRequired(false);
94 $a_form->addItem($row_separators);
95
96 // neutral column separators
97 $neutral_column_separator = new ilCheckboxInputGUI($this->lng->txt("matrix_neutral_column_separator"), "neutral_column_separator");
98 $neutral_column_separator->setValue(1);
99 $neutral_column_separator->setInfo($this->lng->txt("matrix_neutral_column_separator_description"));
100 $neutral_column_separator->setRequired(false);
101 $a_form->addItem($neutral_column_separator);
102
103
104 $header = new ilFormSectionHeaderGUI();
105 $header->setTitle($this->lng->txt("matrix_columns"));
106 $a_form->addItem($header);
107
108 // Answers
109 include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php";
110 $columns = new ilCategoryWizardInputGUI("", "columns");
111 $columns->setRequired(false);
112 $columns->setAllowMove(true);
113 $columns->setShowWizard(true);
114 $columns->setShowNeutralCategory(true);
115 $columns->setDisabledScale(false);
116 $columns->setNeutralCategoryTitle($this->lng->txt('matrix_neutral_answer'));
117 $columns->setCategoryText($this->lng->txt('matrix_standard_answers'));
118 $columns->setShowSavePhrase(true);
119 $a_form->addItem($columns);
120
121
122 $header = new ilFormSectionHeaderGUI();
123 $header->setTitle($this->lng->txt("matrix_column_settings"));
124 $a_form->addItem($header);
125
126 // bipolar adjectives
127 $bipolar = new ilCustomInputGUI($this->lng->txt("matrix_bipolar_adjectives"));
128 $bipolar->setInfo($this->lng->txt("matrix_bipolar_adjectives_description"));
129
130 // left pole
131 $bipolar1 = new ilTextInputGUI($this->lng->txt("matrix_left_pole"), "bipolar1");
132 $bipolar1->setRequired(false);
133 $bipolar->addSubItem($bipolar1);
134
135 // right pole
136 $bipolar2 = new ilTextInputGUI($this->lng->txt("matrix_right_pole"), "bipolar2");
137 $bipolar2->setRequired(false);
138 $bipolar->addSubItem($bipolar2);
139
140 $a_form->addItem($bipolar);
141
142
143 $header = new ilFormSectionHeaderGUI();
144 $header->setTitle($this->lng->txt("matrix_rows"));
145 $a_form->addItem($header);
146
147 // matrix rows
148 include_once "./Modules/SurveyQuestionPool/classes/class.ilMatrixRowWizardInputGUI.php";
149 $rows = new ilMatrixRowWizardInputGUI("", "rows");
150 $rows->setRequired(false);
151 $rows->setAllowMove(true);
152 $rows->setLabelText($this->lng->txt('label'));
153 $rows->setUseOtherAnswer(true);
154 $a_form->addItem($rows);
155
156
157 // values
158 $subtype->setValue($this->object->getSubtype());
159 $column_separators->setChecked($this->object->getColumnSeparators());
160 $row_separators->setChecked($this->object->getRowSeparators());
161 $neutral_column_separator->setChecked($this->object->getNeutralColumnSeparator());
162
163 if (!$this->object->getColumnCount())
164 {
165 $this->object->columns->addCategory("");
166 }
167 $columns->setValues($this->object->getColumns());
168
169 $bipolar1->setValue($this->object->getBipolarAdjective(0));
170 $bipolar2->setValue($this->object->getBipolarAdjective(1));
171
172 if ($this->object->getRowCount() == 0)
173 {
174 $this->object->getRows()->addCategory("");
175 }
176 $rows->setValues($this->object->getRows());
177 }
if(! $in) $columns
Definition: Utf8Test.php:46
This class represents a survey question category wizard property in a property form.
This class represents a checkbox property in a property form.
This class represents a custom property in a property form.
This class represents a section header in a property form.
This class represents a survey question category wizard property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a text property in a property form.

References $columns, and ilPropertyFormGUI\addItem().

+ Here is the call graph for this function:

◆ getCumulatedResultsDetails()

SurveyMatrixQuestionGUI::getCumulatedResultsDetails (   $survey_id,
  $counter,
  $finished_ids 
)

Creates the detailed output of the cumulated results for the question.

Parameters
integer$survey_idThe database ID of the survey
integer$counterThe counter of the question position in the survey
Returns
string HTML text with the cumulated results @access private

Reimplemented from SurveyQuestionGUI.

Definition at line 948 of file class.SurveyMatrixQuestionGUI.php.

949 {
950 if (count($this->cumulated) == 0)
951 {
952 if(!$finished_ids)
953 {
954 include_once "./Modules/Survey/classes/class.ilObjSurvey.php";
955 $nr_of_users = ilObjSurvey::_getNrOfParticipants($survey_id);
956 }
957 else
958 {
959 $nr_of_users = sizeof($finished_ids);
960 }
961 $this->cumulated =& $this->object->getCumulatedResults($survey_id, $nr_of_users, $finished_ids);
962 }
963
964 $cumulated_count = 0;
965 foreach ($this->cumulated as $key => $value)
966 {
967 if (is_numeric($key))
968 {
969 $cumulated_count++;
970 }
971 }
972
973 $output = "";
974
975 include_once "./Services/UICore/classes/class.ilTemplate.php";
976 $template = new ilTemplate("tpl.il_svy_svy_cumulated_results_detail.html", TRUE, TRUE, "Modules/Survey");
977
978 $template->setCurrentBlock("detail_row");
979 $template->setVariable("TEXT_OPTION", $this->lng->txt("question"));
980 $questiontext = $this->object->getQuestiontext();
981 $template->setVariable("TEXT_OPTION_VALUE", $this->object->prepareTextareaOutput($questiontext, TRUE));
982 $template->parseCurrentBlock();
983 $template->setCurrentBlock("detail_row");
984 $template->setVariable("TEXT_OPTION", $this->lng->txt("question_type"));
985 $template->setVariable("TEXT_OPTION_VALUE", $this->lng->txt($this->getQuestionType()).
986 " (".$cumulated_count." ".$this->lng->txt("rows").")");
987 $template->parseCurrentBlock();
988 $template->setCurrentBlock("detail_row");
989 $template->setVariable("TEXT_OPTION", $this->lng->txt("users_answered"));
990 $template->setVariable("TEXT_OPTION_VALUE", $this->cumulated["TOTAL"]["USERS_ANSWERED"]);
991 $template->parseCurrentBlock();
992 $template->setCurrentBlock("detail_row");
993 $template->setVariable("TEXT_OPTION", $this->lng->txt("users_skipped"));
994 $template->setVariable("TEXT_OPTION_VALUE", $this->cumulated["TOTAL"]["USERS_SKIPPED"]);
995 $template->parseCurrentBlock();
996 /*
997 $template->setCurrentBlock("detail_row");
998 $template->setVariable("TEXT_OPTION", $this->lng->txt("mode"));
999 $template->setVariable("TEXT_OPTION_VALUE", $this->cumulated["TOTAL"]["MODE"]);
1000 $template->parseCurrentBlock();
1001 $template->setCurrentBlock("detail_row");
1002 $template->setVariable("TEXT_OPTION", $this->lng->txt("mode_nr_of_selections"));
1003 $template->setVariable("TEXT_OPTION_VALUE", $this->cumulated["TOTAL"]["MODE_NR_OF_SELECTIONS"]);
1004 $template->parseCurrentBlock();
1005 */
1006 $template->setCurrentBlock("detail_row");
1007 $template->setVariable("TEXT_OPTION", $this->lng->txt("median"));
1008 $template->setVariable("TEXT_OPTION_VALUE", $this->cumulated["TOTAL"]["MEDIAN"]);
1009 $template->parseCurrentBlock();
1010
1011 $template->setCurrentBlock("detail_row");
1012 $template->setVariable("TEXT_OPTION", $this->lng->txt("categories"));
1013 $columns = "";
1014 foreach ($this->cumulated["TOTAL"]["variables"] as $key => $value)
1015 {
1016 $columns .= "<li>" . $value["title"] . ": n=" . $value["selected"] .
1017 " (" . sprintf("%.2f", 100*$value["percentage"]) . "%)</li>";
1018 }
1019 $columns = "<ol>$columns</ol>";
1020 $template->setVariable("TEXT_OPTION_VALUE", $columns);
1021 $template->parseCurrentBlock();
1022
1023 // total chart
1024 $template->setCurrentBlock("detail_row");
1025 $template->setVariable("TEXT_OPTION", $this->lng->txt("chart"));
1026 $template->setVariable("TEXT_OPTION_VALUE", $this->renderChart("svy_ch_".$this->object->getId()."_total", $this->cumulated["TOTAL"]["variables"]));
1027 $template->parseCurrentBlock();
1028
1029 $template->setVariable("QUESTION_TITLE", "$counter. ".$this->object->getTitle());
1030
1031 $output .= $template->get();
1032
1033 foreach ($this->cumulated as $key => $value)
1034 {
1035 if (is_numeric($key))
1036 {
1037 $template = new ilTemplate("tpl.il_svy_svy_cumulated_results_detail.html", TRUE, TRUE, "Modules/Survey");
1038
1039 $template->setCurrentBlock("detail_row");
1040 $template->setVariable("TEXT_OPTION", $this->lng->txt("users_answered"));
1041 $template->setVariable("TEXT_OPTION_VALUE", $value["USERS_ANSWERED"]);
1042 $template->parseCurrentBlock();
1043 $template->setCurrentBlock("detail_row");
1044 $template->setVariable("TEXT_OPTION", $this->lng->txt("users_skipped"));
1045 $template->setVariable("TEXT_OPTION_VALUE", $value["USERS_SKIPPED"]);
1046 $template->parseCurrentBlock();
1047 /*
1048 $template->setCurrentBlock("detail_row");
1049 $template->setVariable("TEXT_OPTION", $this->lng->txt("mode"));
1050 $template->setVariable("TEXT_OPTION_VALUE", $value["MODE"]);
1051 $template->parseCurrentBlock();
1052 $template->setCurrentBlock("detail_row");
1053 $template->setVariable("TEXT_OPTION", $this->lng->txt("mode_nr_of_selections"));
1054 $template->setVariable("TEXT_OPTION_VALUE", $value["MODE_NR_OF_SELECTIONS"]);
1055 $template->parseCurrentBlock();
1056 */
1057 $template->setCurrentBlock("detail_row");
1058 $template->setVariable("TEXT_OPTION", $this->lng->txt("median"));
1059 $template->setVariable("TEXT_OPTION_VALUE", $value["MEDIAN"]);
1060 $template->parseCurrentBlock();
1061
1062 $template->setCurrentBlock("detail_row");
1063 $template->setVariable("TEXT_OPTION", $this->lng->txt("categories"));
1064 $columns = "";
1065 foreach ($value["variables"] as $cvalue)
1066 {
1067 $columns .= "<li>" . $cvalue["title"] . ": n=". $cvalue["selected"] .
1068 " (".sprintf("%.2f", 100*$cvalue["percentage"]) . "%)</li>";
1069 }
1070 $columns = "<ol>".$columns."</ol>";
1071 $template->setVariable("TEXT_OPTION_VALUE", $columns);
1072 $template->parseCurrentBlock();
1073
1074 // add text answers to detailed results
1075 if (is_array($value["textanswers"]))
1076 {
1077 $template->setCurrentBlock("detail_row");
1078 $template->setVariable("TEXT_OPTION", $this->lng->txt("freetext_answers"));
1079 $html = "";
1080 foreach ($value["textanswers"] as $tkey => $answers)
1081 {
1082 $html .= $value["variables"][$tkey]["title"] ."\n";
1083 $html .= "<ul>\n";
1084 foreach ($answers as $answer)
1085 {
1086 $html .= "<li>" . preg_replace("/\n/", "<br>\n", $answer) . "</li>\n";
1087 }
1088 $html .= "</ul>\n";
1089 }
1090 $template->setVariable("TEXT_OPTION_VALUE", $html);
1091 $template->parseCurrentBlock();
1092 }
1093
1094 // chart
1095 $template->setCurrentBlock("detail_row");
1096 $template->setVariable("TEXT_OPTION", $this->lng->txt("chart"));
1097 $template->setVariable("TEXT_OPTION_VALUE", $this->renderChart("svy_ch_".$this->object->getId()."_".$key, $value["variables"]));
1098 $template->parseCurrentBlock();
1099
1100 $template->setVariable("QUESTION_SUBTITLE", $counter.".".($key+1)." ".
1101 $this->object->prepareTextareaOutput($value["ROW"], TRUE));
1102
1103 $output .= $template->get();
1104 }
1105 }
1106
1107 return $output;
1108 }
renderChart($a_id, $a_variables)
_getNrOfParticipants($survey_id)
Returns the number of participants for a survey.
special template class to simplify handling of ITX/PEAR

References $columns, ilObjSurvey\_getNrOfParticipants(), and SurveyQuestionGUI\renderChart().

+ Here is the call graph for this function:

◆ getLayoutRow()

SurveyMatrixQuestionGUI::getLayoutRow ( )

Creates a row to define the matrix question layout with percentage values.

@access public

Definition at line 600 of file class.SurveyMatrixQuestionGUI.php.

601 {
602 $percent_values = $this->object->getLayout();
603 $template = new ilTemplate("tpl.il_svy_out_matrix_layout.html", TRUE, TRUE, "Modules/SurveyQuestionPool");
604 if (strlen($this->object->getBipolarAdjective(0)) && strlen($this->object->getBipolarAdjective(1)))
605 {
606 $template->setCurrentBlock("bipolar_start");
607 $template->setVariable("VALUE_PERCENT_BIPOLAR_ADJECTIVE1", " value=\"" . $percent_values["percent_bipolar_adjective1"] . "\"");
608 $template->setVariable("STYLE", " style=\"width:" . $percent_values["percent_bipolar_adjective1"] . "%\"");
609 $template->parseCurrentBlock();
610 $template->setCurrentBlock("bipolar_end");
611 $template->setVariable("VALUE_PERCENT_BIPOLAR_ADJECTIVE2", " value=\"" . $percent_values["percent_bipolar_adjective2"] . "\"");
612 $template->setVariable("STYLE", " style=\"width:" . $percent_values["percent_bipolar_adjective2"] . "%\"");
613 $template->parseCurrentBlock();
614 }
615 $counter = $this->object->getColumnCount();
616 if (strlen($this->object->hasNeutralColumn()))
617 {
618 $template->setCurrentBlock("neutral_start");
619 $template->setVariable("VALUE_PERCENT_NEUTRAL", " value=\"" . $percent_values["percent_neutral"] . "\"");
620 $template->setVariable("STYLE_NEUTRAL", " style=\"width:" . $percent_values["percent_neutral"] . "%\"");
621 $template->parseCurrentBlock();
622 $counter--;
623 }
624 $template->setVariable("VALUE_PERCENT_ROW", " value=\"" . $percent_values["percent_row"] . "\"");
625 $template->setVariable("STYLE_ROW", " style=\"width:" . $percent_values["percent_row"] . "%\"");
626 $template->setVariable("COLSPAN_COLUMNS", $counter);
627 $template->setVariable("VALUE_PERCENT_COLUMNS", " value=\"" . $percent_values["percent_columns"] . "\"");
628 $template->setVariable("STYLE_COLUMNS", " style=\"width:" . $percent_values["percent_columns"] . "%\"");
629 return $template->get();
630 }

Referenced by getPrintView(), and getWorkingForm().

+ Here is the caller graph for this function:

◆ getParsedAnswers()

SurveyMatrixQuestionGUI::getParsedAnswers ( array  $a_working_data = null,
  $a_only_user_anwers = false 
)

Definition at line 210 of file class.SurveyMatrixQuestionGUI.php.

211 {
212 if(is_array($a_working_data))
213 {
214 $user_answers = $a_working_data;
215 }
216
217 $options = array();
218 for ($i = 0; $i < $this->object->getRowCount(); $i++)
219 {
220 $rowobj = $this->object->getRow($i);
221
222 $text = null;
223
224 $cols = array();
225 for ($j = 0; $j < $this->object->getColumnCount(); $j++)
226 {
227 $cat = $this->object->getColumn($j);
228 $value = ($cat->scale) ? ($cat->scale - 1) : $j;
229
230 $checked = "unchecked";
231 if(is_array($a_working_data))
232 {
233 foreach($user_answers as $user_answer)
234 {
235 if($user_answer["rowvalue"] == $i &&
236 $user_answer["value"] == $value)
237 {
238 $checked = "checked";
239 if($user_answer["textanswer"])
240 {
241 $text = $user_answer["textanswer"];
242 }
243 }
244 }
245 }
246
247 if(!$a_only_user_anwers || $checked == "checked")
248 {
249 $cols[$value] = array(
250 "title" => trim($cat->title)
251 ,"neutral" => (bool)$cat->neutral
252 ,"checked" => $checked
253 );
254 }
255 }
256
257 if($a_only_user_anwers || sizeof($cols) || $text)
258 {
259 $row_idx = $i;
260 $options[$row_idx] = array(
261 "title" => trim($rowobj->title)
262 ,"other" => (bool)$rowobj->other
263 ,"textanswer" => $text
264 ,"cols" => $cols
265 );
266 }
267 }
268
269 return $options;
270 }
if(!is_array($argv)) $options

References $options.

Referenced by getPrintView().

+ Here is the caller graph for this function:

◆ getPrintView()

SurveyMatrixQuestionGUI::getPrintView (   $question_title = 1,
  $show_questiontext = 1,
  $survey_id = null,
array  $a_working_data = null 
)

Creates a HTML representation of the question.

@access private

Definition at line 277 of file class.SurveyMatrixQuestionGUI.php.

278 {
279 $options = $this->getParsedAnswers($a_working_data);
280
281 $layout = $this->object->getLayout();
282 $neutralstyle = "3px solid #808080";
283 $bordercolor = "#808080";
284 $template = new ilTemplate("tpl.il_svy_qpl_matrix_printview.html", TRUE, TRUE, "Modules/SurveyQuestionPool");
285
286 if ($this->show_layout_row)
287 {
288 $layout_row = $this->getLayoutRow();
289 $template->setCurrentBlock("matrix_row");
290 $template->setVariable("ROW", $layout_row);
291 $template->parseCurrentBlock();
292 }
293
294 $tplheaders = new ilTemplate("tpl.il_svy_out_matrix_columnheaders.html", TRUE, TRUE, "Modules/SurveyQuestionPool");
295 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
296 {
297 $tplheaders->setCurrentBlock("bipolar_start");
298 $style = array();
299 array_push($style, sprintf("width: %.2f%s!important", $layout["percent_bipolar_adjective1"], "%"));
300 if (count($style) > 0)
301 {
302 $tplheaders->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
303 }
304 $tplheaders->parseCurrentBlock();
305 }
306 // column headers
307 for ($i = 0; $i < $this->object->getColumnCount(); $i++)
308 {
309 $cat = $this->object->getColumn($i);
310 if ($cat->neutral)
311 {
312 $tplheaders->setCurrentBlock("neutral_column_header");
313 $tplheaders->setVariable("TEXT", ilUtil::prepareFormOutput($cat->title));
314 $tplheaders->setVariable("CLASS", "rsep");
315 $style = array();
316 array_push($style, sprintf("width: %.2f%s!important", $layout["percent_neutral"], "%"));
317 if ($this->object->getNeutralColumnSeparator())
318 {
319 array_push($style, "border-left: $neutralstyle!important;");
320 }
321 if (count($style) > 0)
322 {
323 $tplheaders->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
324 }
325 $tplheaders->parseCurrentBlock();
326 }
327 else
328 {
329 $style = array();
330 if ($this->object->getColumnSeparators() == 1)
331 {
332 if (($i < $this->object->getColumnCount() - 1))
333 {
334 array_push($style, "border-right: 1px solid $bordercolor!important");
335 }
336 }
337 array_push($style, sprintf("width: %.2f%s!important", $layout["percent_columns"] / $this->object->getColumnCount(), "%"));
338 $tplheaders->setCurrentBlock("column_header");
339 $tplheaders->setVariable("TEXT", ilUtil::prepareFormOutput($cat->title));
340 $tplheaders->setVariable("CLASS", "center");
341 if (count($style) > 0)
342 {
343 $tplheaders->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
344 }
345 $tplheaders->parseCurrentBlock();
346 }
347 }
348
349 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
350 {
351 $tplheaders->setCurrentBlock("bipolar_end");
352 $style = array();
353 array_push($style, sprintf("width: %.2f%s!important", $layout["percent_bipolar_adjective2"], "%"));
354 if (count($style) > 0)
355 {
356 $tplheaders->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
357 }
358 $tplheaders->parseCurrentBlock();
359 }
360
361 $style = array();
362 array_push($style, sprintf("width: %.2f%s!important", $layout["percent_row"], "%"));
363 if (count($style) > 0)
364 {
365 $tplheaders->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
366 }
367
368 $template->setCurrentBlock("matrix_row");
369 $template->setVariable("ROW", $tplheaders->get());
370 $template->parseCurrentBlock();
371
372 $rowclass = array("tblrow1", "tblrow2");
373
374 for ($i = 0; $i < $this->object->getRowCount(); $i++)
375 {
376 $rowobj = $this->object->getRow($i);
377 $tplrow = new ilTemplate("tpl.il_svy_qpl_matrix_printview_row.html", TRUE, TRUE, "Modules/SurveyQuestionPool");
378 for ($j = 0; $j < $this->object->getColumnCount(); $j++)
379 {
380 $cat = $this->object->getColumn($j);
381 if (($i == 0) && ($j == 0))
382 {
383 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
384 {
385 $tplrow->setCurrentBlock("bipolar_start");
386 $tplrow->setVariable("TEXT_BIPOLAR_START", ilUtil::prepareFormOutput($this->object->getBipolarAdjective(0)));
387 $tplrow->setVariable("ROWSPAN", $this->object->getRowCount());
388 $tplrow->parseCurrentBlock();
389 }
390 }
391 if (($i == 0) && ($j == $this->object->getColumnCount()-1))
392 {
393 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
394 {
395 $tplrow->setCurrentBlock("bipolar_end");
396 $tplrow->setVariable("TEXT_BIPOLAR_END", ilUtil::prepareFormOutput($this->object->getBipolarAdjective(1)));
397 $tplrow->setVariable("ROWSPAN", $this->object->getRowCount());
398 $tplrow->parseCurrentBlock();
399 }
400 }
401
402 $value = ($cat->scale) ? ($cat->scale - 1) : $j;
403 $col = $options[$i]["cols"][$value];
404
405 switch ($this->object->getSubtype())
406 {
407 case 0:
408 if ($cat->neutral)
409 {
410 $tplrow->setCurrentBlock("neutral_radiobutton");
411 $tplrow->setVariable("IMAGE_RADIO", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_".$col["checked"].".png")));
412 $tplrow->setVariable("ALT_RADIO", $this->lng->txt($col["checked"]));
413 $tplrow->setVariable("TITLE_RADIO", $this->lng->txt($col["checked"]));
414 $tplrow->parseCurrentBlock();
415 }
416 else
417 {
418 $tplrow->setCurrentBlock("radiobutton");
419 $tplrow->setVariable("IMAGE_RADIO", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_".$col["checked"].".png")));
420 $tplrow->setVariable("ALT_RADIO", $this->lng->txt($col["checked"]));
421 $tplrow->setVariable("TITLE_RADIO", $this->lng->txt($col["checked"]));
422 $tplrow->parseCurrentBlock();
423 }
424 break;
425 case 1:
426 if ($cat->neutral)
427 {
428 $tplrow->setCurrentBlock("neutral_checkbox");
429 $tplrow->setVariable("IMAGE_CHECKBOX", ilUtil::getHtmlPath(ilUtil::getImagePath("checkbox_".$col["checked"].".png")));
430 $tplrow->setVariable("ALT_CHECKBOX", $this->lng->txt($col["checked"]));
431 $tplrow->setVariable("TITLE_CHECKBOX", $this->lng->txt($col["checked"]));
432 $tplrow->parseCurrentBlock();
433 }
434 else
435 {
436 $tplrow->setCurrentBlock("checkbox");
437 $tplrow->setVariable("IMAGE_CHECKBOX", ilUtil::getHtmlPath(ilUtil::getImagePath("checkbox_".$col["checked"].".png")));
438 $tplrow->setVariable("ALT_CHECKBOX", $this->lng->txt($col["checked"]));
439 $tplrow->setVariable("TITLE_CHECKBOX", $this->lng->txt($col["checked"]));
440 $tplrow->parseCurrentBlock();
441 }
442 break;
443 }
444 if ($cat->neutral)
445 {
446 $tplrow->setCurrentBlock("neutral_answer");
447 $style = array();
448 if ($this->object->getNeutralColumnSeparator())
449 {
450 array_push($style, "border-left: $neutralstyle!important");
451 }
452 if ($this->object->getColumnSeparators() == 1)
453 {
454 if ($j < $this->object->getColumnCount() - 1)
455 {
456 array_push($style, "border-right: 1px solid $bordercolor!important");
457 }
458 }
459
460 if ($this->object->getRowSeparators() == 1)
461 {
462 if ($i < $this->object->getRowCount() - 1)
463 {
464 array_push($style, "border-bottom: 1px solid $bordercolor!important");
465 }
466 }
467 if (count($style))
468 {
469 $tplrow->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
470 }
471 $tplrow->parseCurrentBlock();
472 }
473 else
474 {
475 $tplrow->setCurrentBlock("answer");
476 $style = array();
477
478 if ($this->object->getColumnSeparators() == 1)
479 {
480 if ($j < $this->object->getColumnCount() - 1)
481 {
482 array_push($style, "border-right: 1px solid $bordercolor!important");
483 }
484 }
485
486 if ($this->object->getRowSeparators() == 1)
487 {
488 if ($i < $this->object->getRowCount() - 1)
489 {
490 array_push($style, "border-bottom: 1px solid $bordercolor!important");
491 }
492 }
493 if (count($style))
494 {
495 $tplrow->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
496 }
497 $tplrow->parseCurrentBlock();
498 }
499 }
500
501 if ($rowobj->other)
502 {
503 $text = $options[$i]["textanswer"];
504 $tplrow->setCurrentBlock("text_other");
505 $tplrow->setVariable("TEXT_OTHER", $text
506 ? $text
507 : "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
508 $tplrow->parseCurrentBlock();
509 }
510
511 $tplrow->setVariable("TEXT_ROW", ilUtil::prepareFormOutput($rowobj->title));
512 $tplrow->setVariable("ROWCLASS", $rowclass[$i % 2]);
513 if ($this->object->getRowSeparators() == 1)
514 {
515 if ($i < $this->object->getRowCount() - 1)
516 {
517 $tplrow->setVariable("STYLE", " style=\"border-bottom: 1px solid $bordercolor!important\"");
518 }
519 }
520 $template->setCurrentBlock("matrix_row");
521 $template->setVariable("ROW", $tplrow->get());
522 $template->parseCurrentBlock();
523 }
524
525 if ($question_title)
526 {
527 $template->setVariable("QUESTION_TITLE", ilUtil::prepareFormOutput($this->object->getTitle()));
528 }
529 $template->setCurrentBlock();
530 if ($show_questiontext)
531 {
532 $this->outQuestionText($template);
533 }
534 $template->parseCurrentBlock();
535 return $template->get();
536 }
getLayoutRow()
Creates a row to define the matrix question layout with percentage values.
getParsedAnswers(array $a_working_data=null, $a_only_user_anwers=false)
static getHtmlPath($relative_path)
get url of path
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public

References $options, ilUtil\getHtmlPath(), ilUtil\getImagePath(), getLayoutRow(), getParsedAnswers(), SurveyQuestionGUI\outQuestionText(), and ilUtil\prepareFormOutput().

+ Here is the call graph for this function:

◆ getWorkingForm()

SurveyMatrixQuestionGUI::getWorkingForm (   $working_data = "",
  $question_title = 1,
  $show_questiontext = 1,
  $error_message = "",
  $survey_id = null 
)

Creates the question output form for the learner.

@access public

Reimplemented from SurveyQuestionGUI.

Definition at line 642 of file class.SurveyMatrixQuestionGUI.php.

643 {
644 $layout = $this->object->getLayout();
645 $neutralstyle = "3px solid #808080";
646 $bordercolor = "#808080";
647 $template = new ilTemplate("tpl.il_svy_out_matrix.html", TRUE, TRUE, "Modules/SurveyQuestionPool");
648 $template->setCurrentBlock("material_matrix");
649 $template->setVariable("TEXT_MATERIAL", $this->getMaterialOutput());
650 $template->parseCurrentBlock();
651
652 if ($this->show_layout_row)
653 {
654 $layout_row = $this->getLayoutRow();
655 $template->setCurrentBlock("matrix_row");
656 $template->setVariable("ROW", $layout_row);
657 $template->parseCurrentBlock();
658 }
659
660 $tplheaders = new ilTemplate("tpl.il_svy_out_matrix_columnheaders.html", TRUE, TRUE, "Modules/SurveyQuestionPool");
661 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
662 {
663 $tplheaders->setCurrentBlock("bipolar_start");
664 $style = array();
665 array_push($style, sprintf("width: %.2F%s!important", $layout["percent_bipolar_adjective1"], "%"));
666 if (count($style) > 0)
667 {
668 $tplheaders->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
669 }
670 $tplheaders->parseCurrentBlock();
671 }
672 // column headers
673 for ($i = 0; $i < $this->object->getColumnCount(); $i++)
674 {
675 $style = array();
676 $col = $this->object->getColumn($i);
677 if ($col->neutral)
678 {
679 $tplheaders->setCurrentBlock("neutral_column_header");
680 $tplheaders->setVariable("TEXT", ilUtil::prepareFormOutput($col->title));
681 $tplheaders->setVariable("CLASS", "rsep");
682 $style = array();
683 array_push($style, sprintf("width: %.2F%s!important", $layout["percent_neutral"], "%"));
684 if ($this->object->getNeutralColumnSeparator())
685 {
686 array_push($style, "border-left: $neutralstyle!important;");
687 }
688 if (count($style) > 0)
689 {
690 $tplheaders->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
691 }
692 $tplheaders->parseCurrentBlock();
693 }
694 else
695 {
696 if ($this->object->getColumnSeparators() == 1)
697 {
698 if (($i < $this->object->getColumnCount() - 1))
699 {
700 array_push($style, "border-right: 1px solid $bordercolor!important");
701 }
702 }
703 array_push($style, sprintf("width: %.2F%s!important", $layout["percent_columns"] / $this->object->getColumnCount(), "%"));
704 $tplheaders->setCurrentBlock("column_header");
705 $tplheaders->setVariable("TEXT", ilUtil::prepareFormOutput($col->title));
706 $tplheaders->setVariable("CLASS", "center");
707 if (count($style) > 0)
708 {
709 $tplheaders->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
710 }
711 $tplheaders->parseCurrentBlock();
712 }
713 }
714 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
715 {
716 $tplheaders->setCurrentBlock("bipolar_end");
717 $style = array();
718 array_push($style, sprintf("width: %.2F%s!important", $layout["percent_bipolar_adjective2"], "%"));
719 if (count($style) > 0)
720 {
721 $tplheaders->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
722 }
723 $tplheaders->parseCurrentBlock();
724 }
725
726 $style = array();
727 array_push($style, sprintf("width: %.2F%s!important", $layout["percent_row"], "%"));
728 if (count($style) > 0)
729 {
730 $tplheaders->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
731 }
732
733 $template->setCurrentBlock("matrix_row");
734 $template->setVariable("ROW", $tplheaders->get());
735 $template->parseCurrentBlock();
736
737 $rowclass = array("tblrow1", "tblrow2");
738 for ($i = 0; $i < $this->object->getRowCount(); $i++)
739 {
740 $rowobj = $this->object->getRow($i);
741 $tplrow = new ilTemplate("tpl.il_svy_out_matrix_row.html", TRUE, TRUE, "Modules/SurveyQuestionPool");
742 for ($j = 0; $j < $this->object->getColumnCount(); $j++)
743 {
744 $cat = $this->object->getColumn($j);
745 if (($i == 0) && ($j == 0))
746 {
747 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
748 {
749 $tplrow->setCurrentBlock("bipolar_start");
750 $tplrow->setVariable("TEXT_BIPOLAR_START", ilUtil::prepareFormOutput($this->object->getBipolarAdjective(0)));
751 $tplrow->setVariable("ROWSPAN", $this->object->getRowCount());
752 $tplrow->parseCurrentBlock();
753 }
754 }
755 if (($i == 0) && ($j == $this->object->getColumnCount()-1))
756 {
757 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
758 {
759 $tplrow->setCurrentBlock("bipolar_end");
760 $tplrow->setVariable("TEXT_BIPOLAR_END", ilUtil::prepareFormOutput($this->object->getBipolarAdjective(1)));
761 $tplrow->setVariable("ROWSPAN", $this->object->getRowCount());
762 $tplrow->parseCurrentBlock();
763 }
764 }
765 switch ($this->object->getSubtype())
766 {
767 case 0:
768 if ($cat->neutral)
769 {
770 $tplrow->setCurrentBlock("neutral_radiobutton");
771 $tplrow->setVariable("QUESTION_ID", $this->object->getId());
772 $tplrow->setVariable("ROW", $i);
773 $tplrow->setVariable("VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
774 if (is_array($working_data))
775 {
776 foreach ($working_data as $data)
777 {
778 if (($data["value"] == $cat->scale-1) && ($data["rowvalue"] == $i))
779 {
780 $tplrow->setVariable("CHECKED_RADIOBUTTON", " checked=\"checked\"");
781 }
782 }
783 }
784 $tplrow->parseCurrentBlock();
785 }
786 else
787 {
788 $tplrow->setCurrentBlock("radiobutton");
789 $tplrow->setVariable("QUESTION_ID", $this->object->getId());
790 $tplrow->setVariable("ROW", $i);
791 $tplrow->setVariable("VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
792 if (is_array($working_data))
793 {
794 foreach ($working_data as $data)
795 {
796 if (($data["value"] == $cat->scale-1) && ($data["rowvalue"] == $i))
797 {
798 $tplrow->setVariable("CHECKED_RADIOBUTTON", " checked=\"checked\"");
799 }
800 }
801 }
802 $tplrow->parseCurrentBlock();
803 }
804 break;
805 case 1:
806 if ($cat->neutral)
807 {
808 $tplrow->setCurrentBlock("neutral_checkbox");
809 $tplrow->setVariable("QUESTION_ID", $this->object->getId());
810 $tplrow->setVariable("ROW", $i);
811 $tplrow->setVariable("VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
812 if (is_array($working_data))
813 {
814 foreach ($working_data as $data)
815 {
816 if (($data["value"] == $cat->scale-1) && ($data["rowvalue"] == $i))
817 {
818 $tplrow->setVariable("CHECKED_CHECKBOX", " checked=\"checked\"");
819 }
820 }
821 }
822 $tplrow->parseCurrentBlock();
823 }
824 else
825 {
826 $tplrow->setCurrentBlock("checkbox");
827 $tplrow->setVariable("QUESTION_ID", $this->object->getId());
828 $tplrow->setVariable("ROW", $i);
829 $tplrow->setVariable("VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
830 if (is_array($working_data))
831 {
832 foreach ($working_data as $data)
833 {
834 if (($data["value"] == $cat->scale-1) && ($data["rowvalue"] == $i))
835 {
836 $tplrow->setVariable("CHECKED_CHECKBOX", " checked=\"checked\"");
837 }
838 }
839 }
840 $tplrow->parseCurrentBlock();
841 }
842 break;
843 }
844 if ($cat->neutral)
845 {
846 $tplrow->setCurrentBlock("neutral_answer");
847 $style = array();
848 if ($this->object->getNeutralColumnSeparator())
849 {
850 array_push($style, "border-left: $neutralstyle!important");
851 }
852 if ($this->object->getColumnSeparators() == 1)
853 {
854 if ($j < $this->object->getColumnCount() - 1)
855 {
856 array_push($style, "border-right: 1px solid $bordercolor!important");
857 }
858 }
859 }
860 else
861 {
862 $tplrow->setCurrentBlock("answer");
863 $style = array();
864
865 if ($this->object->getColumnSeparators() == 1)
866 {
867 if ($j < $this->object->getColumnCount() - 1)
868 {
869 array_push($style, "border-right: 1px solid $bordercolor!important");
870 }
871 }
872 }
873 if ($this->object->getRowSeparators() == 1)
874 {
875 if ($i < $this->object->getRowCount() - 1)
876 {
877 array_push($style, "border-bottom: 1px solid $bordercolor!important");
878 }
879 }
880 if (count($style))
881 {
882 $tplrow->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
883 }
884 $tplrow->parseCurrentBlock();
885 }
886
887 if ($rowobj->other)
888 {
889 $tplrow->setCurrentBlock("row_other");
890 $tplrow->setVariable("QUESTION_ID", $this->object->getId());
891 $tplrow->setVariable("ROW", $i);
892 if (is_array($working_data))
893 {
894 foreach ($working_data as $data)
895 {
896 if ($data["rowvalue"] == $i)
897 {
898 $tplrow->setVariable("VALUE_OTHER", ilUtil::prepareFormOutput($data['textanswer']));
899 }
900 }
901 }
902 $tplrow->parseCurrentBlock();
903 }
904 $tplrow->setVariable("TEXT_ROW", ilUtil::prepareFormOutput($rowobj->title));
905 $tplrow->setVariable("ROWCLASS", $rowclass[$i % 2]);
906 if ($this->object->getRowSeparators() == 1)
907 {
908 if ($i < $this->object->getRowCount() - 1)
909 {
910 $tplrow->setVariable("STYLE", " style=\"border-bottom: 1px solid $bordercolor!important\"");
911 }
912 }
913 $template->setCurrentBlock("matrix_row");
914 $template->setVariable("ROW", $tplrow->get());
915 $template->parseCurrentBlock();
916 }
917
918 if ($question_title)
919 {
920 $template->setVariable("QUESTION_TITLE", ilUtil::prepareFormOutput($this->object->getTitle()));
921 }
922 $template->setCurrentBlock("question_data_matrix");
923 if (strcmp($error_message, "") != 0)
924 {
925 $template->setVariable("ERROR_MESSAGE", "<p class=\"warning\">$error_message</p>");
926 }
927 if ($show_questiontext)
928 {
929 $this->outQuestionText($template);
930 }
931 $template->parseCurrentBlock();
932 return $template->get();
933 }
getMaterialOutput()
Creates the HTML output of the question material(s)

References $data, getLayoutRow(), SurveyQuestionGUI\getMaterialOutput(), SurveyQuestionGUI\outQuestionText(), and ilUtil\prepareFormOutput().

Referenced by layout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importEditFormValues()

SurveyMatrixQuestionGUI::importEditFormValues ( ilPropertyFormGUI  $a_form)
protected

Reimplemented from SurveyQuestionGUI.

Definition at line 179 of file class.SurveyMatrixQuestionGUI.php.

180 {
181 $this->object->setSubtype($a_form->getInput("type"));
182 $this->object->setRowSeparators($a_form->getInput("row_separators") ? 1 : 0);
183 $this->object->setColumnSeparators($a_form->getInput("column_separators") ? 1 : 0);
184 $this->object->setNeutralColumnSeparator($a_form->getInput("neutral_column_separator") ? 1 : 0);
185
186 // Set bipolar adjectives
187 $this->object->setBipolarAdjective(0, $a_form->getInput("bipolar1"));
188 $this->object->setBipolarAdjective(1, $a_form->getInput("bipolar2"));
189
190 // set columns
191 $this->object->flushColumns();
192
193 foreach ($_POST['columns']['answer'] as $key => $value)
194 {
195 if (strlen($value)) $this->object->getColumns()->addCategory($value, $_POST['columns']['other'][$key], 0, null, $_POST['columns']['scale'][$key]);
196 }
197 if (strlen($_POST["columns"]["neutral"]))
198 {
199 $this->object->getColumns()->addCategory($_POST['columns']['neutral'], 0, 1, null, $_POST['columns_neutral_scale']);
200 }
201
202 // set rows
203 $this->object->flushRows();
204 foreach ($_POST['rows']['answer'] as $key => $value)
205 {
206 if (strlen($value)) $this->object->getRows()->addCategory($value, $_POST['rows']['other'][$key], 0, $_POST['rows']['label'][$key]);
207 }
208 }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
$_POST['username']
Definition: cron.php:12

References $_POST, and ilPropertyFormGUI\getInput().

+ Here is the call graph for this function:

◆ initObject()

SurveyMatrixQuestionGUI::initObject ( )
protected

Reimplemented from SurveyQuestionGUI.

Definition at line 41 of file class.SurveyMatrixQuestionGUI.php.

42 {
43 include_once "./Modules/SurveyQuestionPool/classes/class.SurveyMatrixQuestion.php";
44 $this->object = new SurveyMatrixQuestion();
45 }
The SurveyMatrixQuestion class defines and encapsulates basic methods and attributes for matrix quest...

◆ layout()

SurveyMatrixQuestionGUI::layout ( )

Creates a layout view of the question.

@access public

Definition at line 548 of file class.SurveyMatrixQuestionGUI.php.

549 {
550 global $ilTabs;
551
552 $ilTabs->activateTab("layout");
553
554 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_qpl_layout.html", "Modules/SurveyQuestionPool");
555 $this->show_layout_row = TRUE;
556 $question_output = $this->getWorkingForm();
557 $this->tpl->setVariable("QUESTION_OUTPUT", $question_output);
558 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "saveLayout"));
559 $this->tpl->setVariable("SAVE", $this->lng->txt("save"));
560 }
getWorkingForm($working_data="", $question_title=1, $show_questiontext=1, $error_message="", $survey_id=null)
Creates the question output form for the learner.

References getWorkingForm().

Referenced by saveLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveLayout()

SurveyMatrixQuestionGUI::saveLayout ( )

Saves the layout for the matrix question.

Returns
void

Definition at line 567 of file class.SurveyMatrixQuestionGUI.php.

568 {
569 $percent_values = array(
570 "percent_row" => (int)$_POST["percent_row"],
571 "percent_columns" => (int)$_POST["percent_columns"],
572 "percent_bipolar_adjective1" => (int)$_POST['percent_bipolar_adjective1'],
573 "percent_bipolar_adjective2" => (int)$_POST['percent_bipolar_adjective2'],
574 "percent_neutral" => (int)$_POST["percent_neutral"]
575 );
576 $this->object->setLayout($percent_values);
577
578 // #9364
579 if(array_sum($percent_values) == 100)
580 {
581 $this->object->saveLayout($percent_values["percent_row"],
582 $percent_values['percent_columns'],
583 $percent_values['percent_bipolar_adjective1'],
584 $percent_values['percent_bipolar_adjective2'],
585 $percent_values["percent_neutral"]);
586 ilUtil::sendSuccess($this->lng->txt("settings_saved"));
587 }
588 else
589 {
590 ilUtil::sendFailure($this->lng->txt("svy_matrix_layout_percentages_sum_invalid"));
591 }
592 $this->layout();
593 }
layout()
Creates a layout view of the question.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References $_POST, layout(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ setQuestionTabs()

SurveyMatrixQuestionGUI::setQuestionTabs ( )

Reimplemented from SurveyQuestionGUI.

Definition at line 52 of file class.SurveyMatrixQuestionGUI.php.

53 {
54 $this->setQuestionTabsForClass("surveymatrixquestiongui");
55 }

References SurveyQuestionGUI\setQuestionTabsForClass().

+ Here is the call graph for this function:

Field Documentation

◆ $show_layout_row

SurveyMatrixQuestionGUI::$show_layout_row
protected

Definition at line 39 of file class.SurveyMatrixQuestionGUI.php.


The documentation for this class was generated from the following file: