24 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
25 include_once
"./Modules/Survey/classes/inc.SurveyConstants.php";
56 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyMatrixQuestion.php";
58 $this->show_layout_row = FALSE;
61 $this->
object->loadFromDb($id);
70 $cmd = $this->ctrl->getCmd();
71 $next_class = $this->ctrl->getNextClass($this);
92 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_matrix.html",
"Modules/SurveyQuestionPool");
93 $this->tpl->addBlockFile(
"OTHER_QUESTION_DATA",
"other_question_data",
"tpl.il_svy_qpl_other_question_data.html",
"Modules/SurveyQuestionPool");
96 "0" =>
"matrix_subtype_sr",
97 "1" =>
"matrix_subtype_mr",
105 foreach ($subtypes as $value => $text)
107 $this->tpl->setCurrentBlock(
"subtype_row");
108 $this->tpl->setVariable(
"VALUE_SUBTYPE", $value);
109 $this->tpl->setVariable(
"TEXT_SUBTYPE", $this->lng->txt($text));
110 if ($value == $this->object->getSubtype())
112 $this->tpl->setVariable(
"CHECKED_SUBTYPE",
" checked=\"checked\"");
114 $this->tpl->parseCurrentBlock();
117 $internallinks = array(
118 "lm" => $this->lng->txt(
"obj_lm"),
119 "st" => $this->lng->txt(
"obj_st"),
120 "pg" => $this->lng->txt(
"obj_pg"),
121 "glo" => $this->lng->txt(
"glossary_term")
123 foreach ($internallinks as $key => $value)
125 $this->tpl->setCurrentBlock(
"internallink");
126 $this->tpl->setVariable(
"TYPE_INTERNAL_LINK", $key);
127 $this->tpl->setVariable(
"TEXT_INTERNAL_LINK", $value);
128 $this->tpl->parseCurrentBlock();
131 $this->tpl->setCurrentBlock(
"adm_content");
132 $this->tpl->setVariable(
"TEXT_MATERIAL", $this->lng->txt(
"material"));
133 if (count($this->object->material))
135 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
137 $this->tpl->setVariable(
"TEXT_VALUE_MATERIAL",
" <a href=\"$href\" target=\"content\">" . $this->lng->txt(
"material").
"</a> ");
138 $this->tpl->setVariable(
"BUTTON_REMOVE_MATERIAL", $this->lng->txt(
"remove"));
139 $this->tpl->setVariable(
"BUTTON_ADD_MATERIAL", $this->lng->txt(
"change"));
140 $this->tpl->setVariable(
"VALUE_MATERIAL", $this->object->material[
"internal_link"]);
141 $this->tpl->setVariable(
"VALUE_MATERIAL_TITLE", $this->object->material[
"title"]);
142 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"title"));
146 $this->tpl->setVariable(
"BUTTON_ADD_MATERIAL", $this->lng->txt(
"add"));
148 $this->tpl->setVariable(
"TEXT_ORIENTATION", $this->lng->txt(
"orientation"));
149 $this->tpl->setVariable(
"QUESTION_ID", $this->object->getId());
150 $this->tpl->setVariable(
"VALUE_TITLE", $this->object->getTitle());
151 $this->tpl->setVariable(
"VALUE_DESCRIPTION", $this->object->getDescription());
152 $this->tpl->setVariable(
"VALUE_AUTHOR", $this->object->getAuthor());
153 $questiontext = $this->
object->getQuestiontext();
154 $this->tpl->setVariable(
"VALUE_QUESTION",
ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($questiontext)));
155 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"title"));
156 $this->tpl->setVariable(
"TEXT_AUTHOR", $this->lng->txt(
"author"));
157 $this->tpl->setVariable(
"TEXT_DESCRIPTION", $this->lng->txt(
"description"));
158 $this->tpl->setVariable(
"TEXT_QUESTION", $this->lng->txt(
"question"));
159 $this->tpl->setVariable(
"TEXT_QUESTION_TYPE", $this->lng->txt(
"questiontype"));
160 $this->tpl->setVariable(
"TEXT_OBLIGATORY", $this->lng->txt(
"obligatory"));
161 if ($this->object->getObligatory())
163 $this->tpl->setVariable(
"CHECKED_OBLIGATORY",
" checked=\"checked\"");
166 $this->tpl->setVariable(
"TEXT_APPEARANCE", $this->lng->txt(
"matrix_appearance"));
167 $this->tpl->setVariable(
"TEXT_COLUMN_SEPARATORS", $this->lng->txt(
"matrix_column_separators"));
168 $this->tpl->setVariable(
"TEXT_ROW_SEPARATORS", $this->lng->txt(
"matrix_row_separators"));
169 $this->tpl->setVariable(
"TEXT_NEUTRAL_COLUMN_SEPARATOR", $this->lng->txt(
"matrix_neutral_column_separator"));
170 $this->tpl->setVariable(
"DESCRIPTION_NEUTRAL_COLUMN_SEPARATOR", $this->lng->txt(
"matrix_neutral_column_separator_description"));
171 $this->tpl->setVariable(
"DESCRIPTION_ROW_SEPARATORS", $this->lng->txt(
"matrix_row_separators_description"));
172 $this->tpl->setVariable(
"DESCRIPTION_COLUMN_SEPARATORS", $this->lng->txt(
"matrix_column_separators_description"));
173 if ($this->object->getRowSeparators())
175 $this->tpl->setVariable(
"CHECKED_ROW_SEPARATORS",
" checked=\"checked\"");
177 if ($this->object->getColumnSeparators())
179 $this->tpl->setVariable(
"CHECKED_COLUMN_SEPARATORS",
" checked=\"checked\"");
181 if ($this->object->getNeutralColumnSeparator())
183 $this->tpl->setVariable(
"CHECKED_NEUTRAL_COLUMN_SEPARATOR",
" checked=\"checked\"");
186 $this->tpl->setVariable(
"SAVE",$this->lng->txt(
"save"));
187 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
188 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"editQuestion"));
189 $this->tpl->setVariable(
"TEXT_QUESTION_TYPE", $this->lng->txt($this->getQuestionType()));
190 $this->tpl->setVariable(
"TEXT_SUBTYPE", $this->lng->txt(
"subtype"));
191 $this->tpl->setVariable(
"DESCRIPTION_SUBTYPE", $this->lng->txt(
"matrix_subtype_description"));
192 $this->tpl->parseCurrentBlock();
194 include_once
"./Services/RTE/classes/class.ilRTE.php";
196 include_once
"./Services/RTE/classes/class.$rtestring.php";
197 $rte =
new $rtestring();
198 $rte->addPlugin(
"latex");
199 $rte->addButton(
"latex"); $rte->addButton(
"pastelatex");
200 $rte->removePlugin(
"ibrowser");
201 include_once
"./classes/class.ilObject.php";
202 $obj_id =
$_GET[
"q_id"];
204 $rte->addRTESupport($obj_id, $obj_type,
"survey");
216 function getWorkingForm($working_data =
"", $question_title = 1, $show_questiontext = 1, $error_message =
"")
218 $layout = $this->
object->getLayout();
219 $neutralstyle =
"3px solid #808080";
220 $bordercolor =
"#808080";
221 $template =
new ilTemplate(
"tpl.il_svy_out_matrix.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
222 if (count($this->object->material))
224 $template->setCurrentBlock(
"material_matrix");
225 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
227 $template->setVariable(
"TEXT_MATERIAL", $this->lng->txt(
"material") .
": <a href=\"$href\" target=\"content\">" . $this->
object->material[
"title"].
"</a> ");
228 $template->parseCurrentBlock();
231 if ($this->show_layout_row)
234 $template->setCurrentBlock(
"matrix_row");
235 $template->setVariable(
"ROW", $layout_row);
236 $template->parseCurrentBlock();
239 $tplheaders =
new ilTemplate(
"tpl.il_svy_out_matrix_columnheaders.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
240 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
242 $tplheaders->setCurrentBlock(
"bipolar_start");
244 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_bipolar_adjective1"],
"%"));
245 if (count($style) > 0)
247 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
249 $tplheaders->parseCurrentBlock();
252 for ($i = 0; $i < $this->
object->getColumnCount(); $i++)
255 if ($this->object->getColumnSeparators() == 1)
257 if (($i < $this->object->getColumnCount() - 1))
259 array_push($style,
"border-right: 1px solid $bordercolor!important");
262 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_columns"] / $this->object->getColumnCount(),
"%"));
263 $tplheaders->setCurrentBlock(
"column_header");
265 $tplheaders->setVariable(
"CLASS",
"center");
266 if (count($style) > 0)
268 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
270 $tplheaders->parseCurrentBlock();
272 if (strlen($this->object->getNeutralColumn()))
274 $tplheaders->setCurrentBlock(
"neutral_column_header");
276 $tplheaders->setVariable(
"CLASS",
"rsep");
278 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_neutral"],
"%"));
279 if ($this->object->getNeutralColumnSeparator())
281 array_push($style,
"border-left: $neutralstyle!important;");
283 if (count($style) > 0)
285 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
287 $tplheaders->parseCurrentBlock();
289 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
291 $tplheaders->setCurrentBlock(
"bipolar_end");
293 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_bipolar_adjective2"],
"%"));
294 if (count($style) > 0)
296 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
298 $tplheaders->parseCurrentBlock();
302 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_row"],
"%"));
303 if (count($style) > 0)
305 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
308 $template->setCurrentBlock(
"matrix_row");
309 $template->setVariable(
"ROW", $tplheaders->get());
310 $template->parseCurrentBlock();
312 $rowclass = array(
"tblrow1",
"tblrow2");
313 for ($i = 0; $i < $this->
object->getRowCount(); $i++)
315 $tplrow =
new ilTemplate(
"tpl.il_svy_out_matrix_row.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
316 for ($j = 0; $j < $this->
object->getColumnCount(); $j++)
318 if (($i == 0) && ($j == 0))
320 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
322 $tplrow->setCurrentBlock(
"bipolar_start");
324 $tplrow->setVariable(
"ROWSPAN", $this->object->getRowCount());
325 $tplrow->parseCurrentBlock();
328 if (($i == 0) && ($j == $this->object->getColumnCount()-1))
330 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
332 $tplrow->setCurrentBlock(
"bipolar_end");
334 $tplrow->setVariable(
"ROWSPAN", $this->object->getRowCount());
335 $tplrow->parseCurrentBlock();
338 switch ($this->object->getSubtype())
341 $tplrow->setCurrentBlock(
"radiobutton");
342 $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
343 $tplrow->setVariable(
"ROW", $i);
344 $tplrow->setVariable(
"VALUE", $j);
345 if (is_array($working_data))
347 foreach ($working_data as
$data)
349 if (($data[
"value"] == $j) && ($data[
"row"] == $i))
351 $tplrow->setVariable(
"CHECKED_RADIOBUTTON",
" checked=\"checked\"");
355 $tplrow->parseCurrentBlock();
358 $tplrow->setCurrentBlock(
"checkbox");
359 $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
360 $tplrow->setVariable(
"ROW", $i);
361 $tplrow->setVariable(
"VALUE", $j);
362 if (is_array($working_data))
364 foreach ($working_data as
$data)
366 if (($data[
"value"] == $j) && ($data[
"row"] == $i))
368 $tplrow->setVariable(
"CHECKED_CHECKBOX",
" checked=\"checked\"");
372 $tplrow->parseCurrentBlock();
375 $tplrow->setCurrentBlock(
"answer");
378 if ($this->object->getColumnSeparators() == 1)
380 if ($j < $this->object->getColumnCount() - 1)
382 array_push($style,
"border-right: 1px solid $bordercolor!important");
386 if ($this->object->getRowSeparators() == 1)
388 if ($i < $this->object->getRowCount() - 1)
390 array_push($style,
"border-bottom: 1px solid $bordercolor!important");
395 $tplrow->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
397 $tplrow->parseCurrentBlock();
401 if (strlen($this->object->getNeutralColumn()))
403 $j = $this->
object->getNeutralColumnIndex();
404 switch ($this->object->getSubtype())
407 $tplrow->setCurrentBlock(
"neutral_radiobutton");
408 $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
409 $tplrow->setVariable(
"ROW", $i);
410 $tplrow->setVariable(
"VALUE", $j);
411 if (is_array($working_data))
413 foreach ($working_data as
$data)
415 if (($data[
"value"] == $j) && ($data[
"row"] == $i))
417 $tplrow->setVariable(
"CHECKED_RADIOBUTTON",
" checked=\"checked\"");
421 $tplrow->parseCurrentBlock();
424 $tplrow->setCurrentBlock(
"neutral_checkbox");
425 $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
426 $tplrow->setVariable(
"ROW", $i);
427 $tplrow->setVariable(
"VALUE", $j);
428 if (is_array($working_data))
430 foreach ($working_data as
$data)
432 if (($data[
"value"] == $j) && ($data[
"row"] == $i))
434 $tplrow->setVariable(
"CHECKED_CHECKBOX",
" checked=\"checked\"");
438 $tplrow->parseCurrentBlock();
441 $tplrow->setCurrentBlock(
"neutral_answer");
443 if ($this->object->getNeutralColumnSeparator())
445 array_push($style,
"border-left: $neutralstyle!important");
447 if ($this->object->getColumnSeparators() == 1)
449 if ($j < $this->object->getColumnCount() - 1)
451 array_push($style,
"border-right: 1px solid $bordercolor!important");
455 if ($this->object->getRowSeparators() == 1)
457 if ($i < $this->object->getRowCount() - 1)
459 array_push($style,
"border-bottom: 1px solid $bordercolor!important");
464 $tplrow->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
466 $tplrow->parseCurrentBlock();
470 $tplrow->setVariable(
"ROWCLASS", $rowclass[$i % 2]);
471 if ($this->object->getRowSeparators() == 1)
473 if ($i < $this->object->getRowCount() - 1)
475 $tplrow->setVariable(
"STYLE",
" style=\"border-bottom: 1px solid $bordercolor!important\"");
478 $template->setCurrentBlock(
"matrix_row");
479 $template->setVariable(
"ROW", $tplrow->get());
480 $template->parseCurrentBlock();
487 $template->setCurrentBlock(
"question_data_matrix");
488 if (strcmp($error_message,
"") != 0)
490 $template->setVariable(
"ERROR_MESSAGE",
"<p class=\"warning\">$error_message</p>");
492 if ($show_questiontext)
494 $questiontext = $this->
object->getQuestiontext();
495 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
497 if (! $this->object->getObligatory())
499 $template->setVariable(
"OBLIGATORY_TEXT", $this->lng->txt(
"survey_question_optional"));
501 $template->parseCurrentBlock();
502 return $template->get();
514 $layout = $this->
object->getLayout();
515 $neutralstyle =
"3px solid #808080";
516 $bordercolor =
"#808080";
517 $template =
new ilTemplate(
"tpl.il_svy_qpl_matrix_printview.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
519 if ($this->show_layout_row)
522 $template->setCurrentBlock(
"matrix_row");
523 $template->setVariable(
"ROW", $layout_row);
524 $template->parseCurrentBlock();
527 $tplheaders =
new ilTemplate(
"tpl.il_svy_out_matrix_columnheaders.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
528 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
530 $tplheaders->setCurrentBlock(
"bipolar_start");
532 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_bipolar_adjective1"],
"%"));
533 if (count($style) > 0)
535 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
537 $tplheaders->parseCurrentBlock();
540 for ($i = 0; $i < $this->
object->getColumnCount(); $i++)
543 if ($this->object->getColumnSeparators() == 1)
545 if (($i < $this->object->getColumnCount() - 1))
547 array_push($style,
"border-right: 1px solid $bordercolor!important");
550 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_columns"] / $this->object->getColumnCount(),
"%"));
551 $tplheaders->setCurrentBlock(
"column_header");
553 $tplheaders->setVariable(
"CLASS",
"center");
554 if (count($style) > 0)
556 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
558 $tplheaders->parseCurrentBlock();
560 if (strlen($this->object->getNeutralColumn()))
562 $tplheaders->setCurrentBlock(
"neutral_column_header");
564 $tplheaders->setVariable(
"CLASS",
"rsep");
566 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_neutral"],
"%"));
567 if ($this->object->getNeutralColumnSeparator())
569 array_push($style,
"border-left: $neutralstyle!important;");
571 if (count($style) > 0)
573 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
575 $tplheaders->parseCurrentBlock();
577 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
579 $tplheaders->setCurrentBlock(
"bipolar_end");
581 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_bipolar_adjective2"],
"%"));
582 if (count($style) > 0)
584 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
586 $tplheaders->parseCurrentBlock();
590 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_row"],
"%"));
591 if (count($style) > 0)
593 $tplheaders->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
596 $template->setCurrentBlock(
"matrix_row");
597 $template->setVariable(
"ROW", $tplheaders->get());
598 $template->parseCurrentBlock();
600 $rowclass = array(
"tblrow1",
"tblrow2");
602 for ($i = 0; $i < $this->
object->getRowCount(); $i++)
604 $tplrow =
new ilTemplate(
"tpl.il_svy_qpl_matrix_printview_row.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
605 for ($j = 0; $j < $this->
object->getColumnCount(); $j++)
607 if (($i == 0) && ($j == 0))
609 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
611 $tplrow->setCurrentBlock(
"bipolar_start");
613 $tplrow->setVariable(
"ROWSPAN", $this->object->getRowCount());
614 $tplrow->parseCurrentBlock();
617 if (($i == 0) && ($j == $this->object->getColumnCount()-1))
619 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
621 $tplrow->setCurrentBlock(
"bipolar_end");
623 $tplrow->setVariable(
"ROWSPAN", $this->object->getRowCount());
624 $tplrow->parseCurrentBlock();
627 switch ($this->object->getSubtype())
630 $tplrow->setCurrentBlock(
"radiobutton");
632 $tplrow->setVariable(
"ALT_RADIO", $this->lng->txt(
"unchecked"));
633 $tplrow->setVariable(
"TITLE_RADIO", $this->lng->txt(
"unchecked"));
634 $tplrow->parseCurrentBlock();
637 $tplrow->setCurrentBlock(
"checkbox");
639 $tplrow->setVariable(
"ALT_CHECKBOX", $this->lng->txt(
"unchecked"));
640 $tplrow->setVariable(
"TITLE_CHECKBOX", $this->lng->txt(
"unchecked"));
641 $tplrow->parseCurrentBlock();
644 $tplrow->setCurrentBlock(
"answer");
647 if ($this->object->getColumnSeparators() == 1)
649 if ($j < $this->object->getColumnCount() - 1)
651 array_push($style,
"border-right: 1px solid $bordercolor!important");
655 if ($this->object->getRowSeparators() == 1)
657 if ($i < $this->object->getRowCount() - 1)
659 array_push($style,
"border-bottom: 1px solid $bordercolor!important");
664 $tplrow->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
666 $tplrow->parseCurrentBlock();
669 if (strlen($this->object->getNeutralColumn()))
671 $j = $this->
object->getRowCount();
672 switch ($this->object->getSubtype())
675 $tplrow->setCurrentBlock(
"neutral_radiobutton");
677 $tplrow->setVariable(
"ALT_RADIO", $this->lng->txt(
"unchecked"));
678 $tplrow->setVariable(
"TITLE_RADIO", $this->lng->txt(
"unchecked"));
679 $tplrow->parseCurrentBlock();
682 $tplrow->setCurrentBlock(
"neutral_checkbox");
684 $tplrow->setVariable(
"ALT_CHECKBOX", $this->lng->txt(
"unchecked"));
685 $tplrow->setVariable(
"TITLE_CHECKBOX", $this->lng->txt(
"unchecked"));
686 $tplrow->parseCurrentBlock();
689 $tplrow->setCurrentBlock(
"neutral_answer");
691 if ($this->object->getNeutralColumnSeparator())
693 array_push($style,
"border-left: $neutralstyle!important");
695 if ($this->object->getColumnSeparators() == 1)
697 if ($j < $this->object->getColumnCount() - 1)
699 array_push($style,
"border-right: 1px solid $bordercolor!important");
703 if ($this->object->getRowSeparators() == 1)
705 if ($i < $this->object->getRowCount() - 1)
707 array_push($style,
"border-bottom: 1px solid $bordercolor!important");
712 $tplrow->setVariable(
"STYLE",
" style=\"" . implode(
";", $style) .
"\"");
714 $tplrow->parseCurrentBlock();
718 $tplrow->setVariable(
"ROWCLASS", $rowclass[$i % 2]);
719 if ($this->object->getRowSeparators() == 1)
721 if ($i < $this->object->getRowCount() - 1)
723 $tplrow->setVariable(
"STYLE",
" style=\"border-bottom: 1px solid $bordercolor!important\"");
726 $template->setCurrentBlock(
"matrix_row");
727 $template->setVariable(
"ROW", $tplrow->get());
728 $template->parseCurrentBlock();
735 $template->setCurrentBlock();
736 if ($show_questiontext)
738 $questiontext = $this->
object->getQuestiontext();
739 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
741 if (! $this->object->getObligatory())
743 $template->setVariable(
"OBLIGATORY_TEXT", $this->lng->txt(
"survey_question_optional"));
745 $template->parseCurrentBlock();
746 return $template->get();
758 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_preview.html",
"Modules/SurveyQuestionPool");
760 $this->tpl->setVariable(
"QUESTION_OUTPUT", $question_output);
772 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_layout.html",
"Modules/SurveyQuestionPool");
773 $this->show_layout_row = TRUE;
775 $this->tpl->setVariable(
"QUESTION_OUTPUT", $question_output);
776 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"saveLayout"));
777 $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save"));
789 $this->
object->saveLayout($_POST[
"percent_row"], $_POST[
'percent_columns'], $_POST[
'percent_bipolar_adjective1'], $_POST[
'percent_bipolar_adjective2'], $_POST[
"percent_neutral"]);
790 $percent_values = array(
791 "percent_row" => $_POST[
"percent_row"],
792 "percent_columns" => $_POST[
"percent_columns"],
793 "percent_bipolar_adjective1" => $_POST[
'percent_bipolar_adjective1'],
794 "percent_bipolar_adjective2" => $_POST[
'percent_bipolar_adjective2'],
795 "percent_neutral" => $_POST[
"percent_neutral"]
797 $this->
object->setLayout($percent_values);
810 $percent_values = $this->
object->getLayout();
811 $template =
new ilTemplate(
"tpl.il_svy_out_matrix_layout.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
812 if (strlen($this->object->getBipolarAdjective(0)) && strlen($this->object->getBipolarAdjective(1)))
814 $template->setCurrentBlock(
"bipolar_start");
815 $template->setVariable(
"VALUE_PERCENT_BIPOLAR_ADJECTIVE1",
" value=\"" . $percent_values[
"percent_bipolar_adjective1"] .
"\"");
816 $template->setVariable(
"STYLE",
" style=\"width:" . $percent_values[
"percent_bipolar_adjective1"] .
"%\"");
817 $template->parseCurrentBlock();
818 $template->setCurrentBlock(
"bipolar_end");
819 $template->setVariable(
"VALUE_PERCENT_BIPOLAR_ADJECTIVE2",
" value=\"" . $percent_values[
"percent_bipolar_adjective2"] .
"\"");
820 $template->setVariable(
"STYLE",
" style=\"width:" . $percent_values[
"percent_bipolar_adjective2"] .
"%\"");
821 $template->parseCurrentBlock();
823 if (strlen($this->object->getNeutralColumn()))
825 $template->setCurrentBlock(
"bipolar_end");
826 $template->setVariable(
"VALUE_PERCENT_NEUTRAL",
" value=\"" . $percent_values[
"percent_neutral"] .
"\"");
827 $template->setVariable(
"STYLE_NEUTRAL",
" style=\"width:" . $percent_values[
"percent_neutral"] .
"%\"");
828 $template->parseCurrentBlock();
830 $template->setVariable(
"VALUE_PERCENT_ROW",
" value=\"" . $percent_values[
"percent_row"] .
"\"");
831 $template->setVariable(
"STYLE_ROW",
" style=\"width:" . $percent_values[
"percent_row"] .
"%\"");
832 $counter = $this->
object->getColumnCount();
833 $template->setVariable(
"COLSPAN_COLUMNS", $counter);
834 $template->setVariable(
"VALUE_PERCENT_COLUMNS",
" value=\"" . $percent_values[
"percent_columns"] .
"\"");
835 $template->setVariable(
"STYLE_COLUMNS",
" style=\"width:" . $percent_values[
"percent_columns"] .
"%\"");
836 return $template->get();
850 if ((!$_POST[
"title"]) or (!$_POST[
"author"]) or (!$_POST[
"question"]))
$result = 1;
853 if ($_POST[
"id"] > 0) $this->
object->setId($_POST[
"id"]);
854 include_once
"./Services/Utilities/classes/class.ilUtil.php";
858 $this->
object->setOrientation($_POST[
"orientation"]);
859 if (strlen($_POST[
"material"]))
861 $this->
object->setMaterial($_POST[
"material"], 0,
ilUtil::stripSlashes($_POST[
"material_title"]));
863 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
865 $this->
object->setQuestiontext($questiontext);
866 if ($_POST[
"obligatory"])
868 $this->
object->setObligatory(1);
872 $this->
object->setObligatory(0);
874 $this->
object->setSubtype($_POST[
"subtype"]);
875 $this->
object->setRowSeparators(($_POST[
"row_separators"]) ? 1 : 0);
876 $this->
object->setColumnSeparators(($_POST[
"column_separators"]) ? 1 : 0);
877 $this->
object->setNeutralColumnSeparator(($_POST[
"neutral_column_separator"]) ? 1 : 0);
885 $this->
object->saveToDb();
900 $columntext = $this->
object->getColumn($column);
901 $this->
object->removeColumn($column);
902 $this->
object->addColumnAtPosition($columntext, $column - 1);
916 $columntext = $this->
object->getColumn($column);
917 $this->
object->removeColumn($column);
918 $this->
object->addColumnAtPosition($columntext, $column + 1);
931 if (count($_POST) == 0)
$_SESSION[
"spl_modified"] = FALSE;
932 if (is_array($_POST))
934 foreach ($_POST as $key => $value)
936 if (preg_match(
"/moveUp_(\d+)_x/", $key, $matches))
940 if (preg_match(
"/moveDown_(\d+)_x/", $key, $matches))
946 if ($this->object->getId() < 1)
948 ilUtil::sendInfo($this->lng->txt(
"fill_out_all_required_fields_add_category"),
true);
949 $this->ctrl->redirect($this,
"editQuestion");
951 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_matrix_answers.html",
"Modules/SurveyQuestionPool");
954 if ($this->object->getSubtype() == 0)
956 $this->tpl->setCurrentBlock(
"ordinal");
957 $this->tpl->setVariable(
"TEXT_COLUMN_SETTINGS", $this->lng->txt(
"matrix_column_settings"));
958 $this->tpl->setVariable(
"TEXT_BIPOLAR_ADJECTIVES", $this->lng->txt(
"matrix_bipolar_adjectives"));
959 $this->tpl->setVariable(
"TEXT_BIPOLAR_ADJECTIVES_DESCRIPTION", $this->lng->txt(
"matrix_bipolar_adjectives_description"));
960 $this->tpl->setVariable(
"TEXT_ADJECTIVE_1", $this->lng->txt(
"matrix_adjective") .
" 1");
961 $this->tpl->setVariable(
"TEXT_ADJECTIVE_2", $this->lng->txt(
"matrix_adjective") .
" 2");
962 $this->tpl->setVariable(
"VALUE_BIPOLAR1",
" value=\"" .
ilUtil::prepareFormOutput($this->object->getBipolarAdjective(0)) .
"\"");
963 $this->tpl->setVariable(
"VALUE_BIPOLAR2",
" value=\"" .
ilUtil::prepareFormOutput($this->object->getBipolarAdjective(1)) .
"\"");
964 $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save"));
965 $this->tpl->parseCurrentBlock();
969 if ($this->object->getColumnCount() == 0)
971 $this->
object->addColumn(
"");
973 if (strcmp($this->ctrl->getCmd(),
"addColumn") == 0)
975 $nrOfCategories = $_POST[
"nrOfCategories"];
976 if ($nrOfCategories < 1) $nrOfCategories = 1;
978 for ($i = 1; $i <= $nrOfCategories; $i++)
980 $this->
object->addColumn(
"");
984 $hasneutralcolumn = FALSE;
985 for ($i = 0; $i < $this->
object->getColumnCount(); $i++)
987 $column = $this->
object->getColumn($i);
988 if ($this->object->getColumnCount() > 1)
992 $this->tpl->setCurrentBlock(
"move_down");
994 $this->tpl->setVariable(
"ALT_DOWN", $this->lng->txt(
"move_down"));
995 $this->tpl->setVariable(
"TITLE_DOWN", $this->lng->txt(
"move_down"));
996 $this->tpl->setVariable(
"COLUMN", $i);
997 $this->tpl->parseCurrentBlock();
999 else if ($i == $this->object->getColumnCount() - 1)
1001 $this->tpl->setCurrentBlock(
"move_up");
1003 $this->tpl->setVariable(
"ALT_UP", $this->lng->txt(
"move_up"));
1004 $this->tpl->setVariable(
"TITLE_UP", $this->lng->txt(
"move_up"));
1005 $this->tpl->setVariable(
"COLUMN", $i);
1006 $this->tpl->parseCurrentBlock();
1010 $this->tpl->setCurrentBlock(
"move_down");
1012 $this->tpl->setVariable(
"ALT_DOWN", $this->lng->txt(
"move_down"));
1013 $this->tpl->setVariable(
"TITLE_DOWN", $this->lng->txt(
"move_down"));
1014 $this->tpl->setVariable(
"COLUMN", $i);
1015 $this->tpl->parseCurrentBlock();
1016 $this->tpl->setCurrentBlock(
"move_up");
1018 $this->tpl->setVariable(
"ALT_UP", $this->lng->txt(
"move_up"));
1019 $this->tpl->setVariable(
"TITLE_UP", $this->lng->txt(
"move_up"));
1020 $this->tpl->setVariable(
"COLUMN", $i);
1021 $this->tpl->parseCurrentBlock();
1024 $this->tpl->setCurrentBlock(
"categories");
1025 $this->tpl->setVariable(
"CATEGORY_ORDER", $i);
1026 $this->tpl->setVariable(
"CATEGORY_ORDER", $i);
1027 $this->tpl->setVariable(
"CATEGORY_NUMBER", $i+1);
1028 $this->tpl->setVariable(
"VALUE_CATEGORY", $column);
1029 $this->tpl->setVariable(
"TEXT_CATEGORY", $this->lng->txt(
"category"));
1030 $this->tpl->parseCurrentBlock();
1033 if (strlen($this->object->getNeutralColumn()))
1035 $this->tpl->setVariable(
"VALUE_NEUTRAL",
" value=\"" .
ilUtil::prepareFormOutput($this->object->getNeutralColumn()) .
"\"");
1037 $this->tpl->setVariable(
"CATEGORY_NEUTRAL", $this->object->getColumnCount() + 1);
1039 if ($this->object->getRowCount() == 0)
1041 $this->
object->addRow(
"");
1043 if (strcmp($this->ctrl->getCmd(),
"addRow") == 0)
1045 $nrOfRows = $_POST[
"nrOfRows"];
1046 if ($nrOfRows < 1) $nrOfRows = 1;
1048 for ($i = 1; $i <= $nrOfRows; $i++)
1050 $this->
object->addRow(
"");
1054 for ($i = 0; $i < $this->
object->getRowCount(); $i++)
1056 $this->tpl->setCurrentBlock(
"rows");
1057 $this->tpl->setVariable(
"ROW_ORDER", $i);
1058 $row = $this->
object->getRow($i);
1059 $this->tpl->setVariable(
"ROW_ORDER", $i);
1060 $this->tpl->setVariable(
"ROW_NUMBER", $i+1);
1061 $this->tpl->setVariable(
"VALUE_ROW", $row);
1062 $this->tpl->setVariable(
"TEXT_ROW", $this->lng->txt(
"row"));
1063 $this->tpl->parseCurrentBlock();
1066 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1067 if ($this->object->getColumnCount() > 0)
1069 $this->tpl->setCurrentBlock(
"selectall");
1070 $this->tpl->setVariable(
"SELECT_ALL", $this->lng->txt(
"select_all"));
1071 $this->tpl->parseCurrentBlock();
1072 $this->tpl->setCurrentBlock(
"existingcategories");
1073 $this->tpl->setVariable(
"DELETE", $this->lng->txt(
"delete"));
1074 $this->tpl->setVariable(
"VALUE_SAVE_PHRASE", $this->lng->txt(
"save_phrase"));
1075 $this->tpl->setVariable(
"ARROW",
"<img src=\"" .
ilUtil::getImagePath(
"arrow_downright.gif") .
"\" alt=\"".$this->lng->txt(
"arrow_downright").
"\">");
1076 $this->tpl->parseCurrentBlock();
1079 if ($this->object->getRowCount() > 0)
1081 $this->tpl->setCurrentBlock(
"selectall_rows");
1082 $this->tpl->setVariable(
"SELECT_ALL", $this->lng->txt(
"select_all"));
1083 $this->tpl->parseCurrentBlock();
1086 for ($i = 1; $i < 10; $i++)
1088 $this->tpl->setCurrentBlock(
"numbers");
1089 $this->tpl->setVariable(
"VALUE_NUMBER", $i);
1092 $this->tpl->setVariable(
"TEXT_NUMBER", $i .
" " . $this->lng->txt(
"category"));
1096 $this->tpl->setVariable(
"TEXT_NUMBER", $i .
" " . $this->lng->txt(
"categories"));
1098 $this->tpl->parseCurrentBlock();
1099 $this->tpl->setCurrentBlock(
"rownumbers");
1100 $this->tpl->setVariable(
"VALUE_NUMBER", $i);
1103 $this->tpl->setVariable(
"TEXT_NUMBER", $i .
" " . $this->lng->txt(
"row"));
1107 $this->tpl->setVariable(
"TEXT_NUMBER", $i .
" " . $this->lng->txt(
"rows"));
1109 $this->tpl->parseCurrentBlock();
1112 $this->tpl->setCurrentBlock(
"adm_content");
1113 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"categories"));
1114 $this->tpl->setVariable(
"TEXT_ANSWERS", $this->lng->txt(
"matrix_columns"));
1115 $this->tpl->setVariable(
"VALUE_ADD_CATEGORY", $this->lng->txt(
"add"));
1116 $this->tpl->setVariable(
"VALUE_ADD_PHRASE", $this->lng->txt(
"add_phrase"));
1117 $this->tpl->setVariable(
"TEXT_STANDARD_ANSWERS", $this->lng->txt(
"matrix_standard_answers"));
1118 $this->tpl->setVariable(
"TEXT_NEUTRAL_ANSWER", $this->lng->txt(
"matrix_neutral_answer"));
1119 if (!$hasneutralcolumn)
1121 $this->tpl->setVariable(
"CATEGORY_NEUTRAL", $this->object->getColumnCount()+1);
1123 $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save"));
1125 $this->tpl->setVariable(
"TEXT_ROWS", $this->lng->txt(
"matrix_rows"));
1126 $this->tpl->setVariable(
"SAVEROWS", $this->lng->txt(
"save"));
1127 $this->tpl->setVariable(
"VALUE_ADD_ROW", $this->lng->txt(
"add"));
1128 $this->tpl->setVariable(
"DELETE", $this->lng->txt(
"delete"));
1129 $this->tpl->setVariable(
"ARROW",
"<img src=\"" .
ilUtil::getImagePath(
"arrow_downright.gif") .
"\" alt=\"".$this->lng->txt(
"arrow_downright").
"\">");
1133 $this->tpl->setVariable(
"FORM_DATA_MODIFIED_PRESS_SAVE", $this->lng->txt(
"form_data_modified_press_save"));
1135 $questiontext = $this->
object->getQuestiontext();
1136 $this->tpl->setVariable(
"QUESTION_TEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
1137 $this->tpl->parseCurrentBlock();
1142 global $rbacsystem,$ilTabs;
1143 $this->ctrl->setParameterByClass(
"$guiclass",
"sel_question_types", $this->
getQuestionType());
1144 $this->ctrl->setParameterByClass(
"$guiclass",
"q_id",
$_GET[
"q_id"]);
1146 if ((
$_GET[
"calling_survey"] > 0) || (
$_GET[
"new_for_survey"] > 0))
1151 if (strlen(
$_GET[
"new_for_survey"]))
1153 $addurl =
"&new_id=" .
$_GET[
"q_id"];
1155 $ilTabs->setBackTarget($this->lng->txt(
"menubacktosurvey"),
"ilias.php?baseClass=ilObjSurveyGUI&ref_id=$ref_id&cmd=questions" . $addurl);
1159 $ilTabs->setBackTarget($this->lng->txt(
"spl"), $this->ctrl->getLinkTargetByClass(
"ilObjSurveyQuestionPoolGUI",
"questions"));
1163 $ilTabs->addTarget(
"preview",
1164 $this->ctrl->getLinkTarget($this,
"preview"),
1169 $ilTabs->addTarget(
"layout",
1170 $this->ctrl->getLinkTarget($this,
"layout"),
1171 array(
"layout",
"saveLayout"),
1175 if ($rbacsystem->checkAccess(
'edit',
$_GET[
"ref_id"]))
1177 $ilTabs->addTarget(
"edit_properties",
1178 $this->ctrl->getLinkTarget($this,
"editQuestion"),
1179 array(
"editQuestion",
"cancelExplorer",
"linkChilds",
"addGIT",
"addST",
1180 "addPG",
"editQuestion",
"addMaterial",
"removeMaterial",
1186 if ($this->object->getId() > 0)
1188 $ilTabs->addTarget(
"matrix_columns_rows",
1189 $this->ctrl->getLinkTarget($this,
"categories"),
1190 array(
"categories",
"addColumn",
"addRow",
"deleteRow",
"moveColumn",
1191 "deleteColumn",
"saveRowColEditor",
"savePhrase",
"addPhrase",
1192 "savePhrase",
"addSelectedPhrase",
"cancelViewPhrase",
"confirmSavePhrase",
1193 "cancelSavePhrase",
"confirmdeleteColumn",
"canceldeleteColumn"),
1199 if ($this->object->getId() > 0)
1201 $title = $this->lng->txt(
"edit") .
" "" . $this->
object->getTitle() .
""";
1208 $this->tpl->setVariable(
"HEADER",
$title);
1221 $this->ctrl->setParameterByClass(get_class($this),
"q_id", $this->object->getId());
1222 $this->ctrl->setParameterByClass(
"ilobjsurveyquestionpoolgui",
"q_id", $this->object->getId());
1224 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_addphrase.html",
"Modules/SurveyQuestionPool");
1227 $this->tpl->setCurrentBlock(
"hidden");
1228 $this->tpl->setVariable(
"HIDDEN_NAME",
"id");
1229 $this->tpl->setVariable(
"HIDDEN_VALUE", $this->object->getId());
1230 $this->tpl->parseCurrentBlock();
1232 include_once
"./Modules/SurveyQuestionPool/classes/class.ilSurveyPhrases.php";
1234 $colors = array(
"tblrow1",
"tblrow2");
1236 foreach ($phrases as $phrase_id => $phrase_array)
1238 $this->tpl->setCurrentBlock(
"phraserow");
1239 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter++ % 2]);
1240 $this->tpl->setVariable(
"PHRASE_VALUE", $phrase_id);
1241 $this->tpl->setVariable(
"PHRASE_NAME", $phrase_array[
"title"]);
1243 $this->tpl->setVariable(
"PHRASE_CONTENT", join(
$columns,
","));
1244 $this->tpl->parseCurrentBlock();
1247 $this->tpl->setCurrentBlock(
"adm_content");
1248 $this->tpl->setVariable(
"TEXT_CANCEL", $this->lng->txt(
"cancel"));
1249 $this->tpl->setVariable(
"TEXT_PHRASE", $this->lng->txt(
"phrase"));
1250 $this->tpl->setVariable(
"TEXT_CONTENT", $this->lng->txt(
"categories"));
1251 $this->tpl->setVariable(
"TEXT_ADD_PHRASE", $this->lng->txt(
"add_phrase"));
1252 $this->tpl->setVariable(
"TEXT_INTRODUCTION",$this->lng->txt(
"add_phrase_introduction"));
1253 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"addPhrase"));
1254 $this->tpl->parseCurrentBlock();
1266 $this->ctrl->redirect($this,
"categories");
1278 if (strcmp($_POST[
"phrases"],
"") == 0)
1285 if (strcmp($this->object->getPhrase($_POST[
"phrases"]),
"dp_standard_numbers") != 0)
1287 $this->
object->addPhrase($_POST[
"phrases"]);
1288 $this->
object->saveColumnsToDb();
1295 $this->ctrl->redirect($this,
"categories");
1308 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_addphrase_standard_numbers.html",
"Modules/SurveyQuestionPool");
1311 $this->tpl->setCurrentBlock(
"hidden");
1312 $this->tpl->setVariable(
"HIDDEN_NAME",
"id");
1313 $this->tpl->setVariable(
"HIDDEN_VALUE", $this->object->getId());
1314 $this->tpl->parseCurrentBlock();
1316 $this->tpl->setCurrentBlock(
"adm_content");
1317 $this->tpl->setVariable(
"ADD_STANDARD_NUMBERS", $this->lng->txt(
"add_standard_numbers"));
1318 $this->tpl->setVariable(
"TEXT_ADD_LIMITS", $this->lng->txt(
"add_limits_for_standard_numbers"));
1319 $this->tpl->setVariable(
"TEXT_LOWER_LIMIT",$this->lng->txt(
"lower_limit"));
1320 $this->tpl->setVariable(
"TEXT_UPPER_LIMIT",$this->lng->txt(
"upper_limit"));
1321 $this->tpl->setVariable(
"VALUE_LOWER_LIMIT", $_POST[
"lower_limit"]);
1322 $this->tpl->setVariable(
"VALUE_UPPER_LIMIT", $_POST[
"upper_limit"]);
1323 $this->tpl->setVariable(
"BTN_ADD",$this->lng->txt(
"add_phrase"));
1324 $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
"cancel"));
1325 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"addStandardNumbers"));
1326 $this->tpl->parseCurrentBlock();
1338 $this->ctrl->redirect($this,
"categories");
1350 if ((strcmp($_POST[
"lower_limit"],
"") == 0) or (strcmp($_POST[
"upper_limit"],
"") == 0))
1355 else if ((
int)$_POST[
"upper_limit"] <= (
int)$_POST[
"lower_limit"])
1362 $this->
object->addStandardNumbers($_POST[
"lower_limit"], $_POST[
"upper_limit"]);
1363 $this->
object->saveColumnsToDb();
1364 $this->ctrl->redirect($this,
"categories");
1384 $nothing_selected =
true;
1385 if (array_key_exists(
"chb_category", $_POST))
1387 if (count($_POST[
"chb_category"]))
1389 $nothing_selected =
false;
1390 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_savephrase.html",
"Modules/SurveyQuestionPool");
1391 $rowclass = array(
"tblrow1",
"tblrow2");
1393 foreach ($_POST[
"chb_category"] as $column)
1395 $this->tpl->setCurrentBlock(
"row");
1396 $this->tpl->setVariable(
"TXT_TITLE", $this->object->getColumn($column));
1397 $this->tpl->setVariable(
"COLOR_CLASS", $rowclass[$counter % 2]);
1398 $this->tpl->parseCurrentBlock();
1399 $this->tpl->setCurrentBlock(
"hidden");
1400 $this->tpl->setVariable(
"HIDDEN_NAME",
"chb_category[]");
1401 $this->tpl->setVariable(
"HIDDEN_VALUE", $column[
"title"]);
1402 $this->tpl->parseCurrentBlock();
1405 $this->tpl->setCurrentBlock(
"adm_content");
1406 $this->tpl->setVariable(
"SAVE_PHRASE_INTRODUCTION", $this->lng->txt(
"save_phrase_introduction"));
1407 $this->tpl->setVariable(
"TEXT_PHRASE_TITLE", $this->lng->txt(
"enter_phrase_title"));
1408 $this->tpl->setVariable(
"TXT_TITLE", $this->lng->txt(
"category"));
1409 $this->tpl->setVariable(
"VALUE_PHRASE_TITLE", $_POST[
"phrase_title"]);
1410 $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
"cancel"));
1411 $this->tpl->setVariable(
"BTN_CONFIRM",$this->lng->txt(
"confirm"));
1412 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"savePhrase"));
1413 $this->tpl->parseCurrentBlock();
1416 if ($nothing_selected)
1419 $this->ctrl->redirect($this,
"categories");
1432 $this->ctrl->redirect($this,
"categories");
1444 if (!$_POST[
"phrase_title"])
1451 if ($this->object->phraseExists($_POST[
"phrase_title"]))
1458 $this->
object->savePhrase($_POST[
"chb_category"], $_POST[
"phrase_title"]);
1460 $this->ctrl->redirect($this,
"categories");
1501 $this->
object->flushColumns();
1502 $this->
object->flushRows();
1503 $columnscomplete = TRUE;
1504 $rowscomplete = TRUE;
1506 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1509 foreach ($_POST as $key => $value)
1511 if (preg_match(
"/^category_(\d+)/", $key, $matches))
1516 if (preg_match(
"/^row_(\d+)/", $key, $matches))
1523 if (strlen($cats) == 0)
1525 $columnscomplete = FALSE;
1528 if (strlen($rows) == 0)
1530 $rowscomplete = FALSE;
1543 $this->
object->saveColumnsToDb();
1544 $this->
object->saveRowsToDb();
1545 if (array_key_exists(
"bipolar1", $_POST))
1551 return $columnscomplete && $rowscomplete;
1575 $originalexists = $this->
object->_questionExists($this->object->original_id);
1576 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
1577 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
1585 $this->ctrl->redirect($this,
"categories");
1600 $nothing_selected =
true;
1601 if (array_key_exists(
"chb_category", $_POST))
1603 if (count($_POST[
"chb_category"]))
1605 $nothing_selected =
false;
1606 $this->
object->removeColumns($_POST[
"chb_category"]);
1609 if ($nothing_selected)
1630 $nothing_selected =
true;
1631 if (array_key_exists(
"chb_row", $_POST))
1633 if (count($_POST[
"chb_row"]))
1635 $nothing_selected =
false;
1636 $this->
object->removeRows($_POST[
"chb_row"]);
1639 if ($nothing_selected)
1661 include_once
"./classes/class.ilTemplate.php";
1662 if (count($this->cumulated) == 0)
1664 include_once
"./Modules/Survey/classes/class.ilObjSurvey.php";
1666 $this->cumulated =& $this->
object->getCumulatedResults($survey_id, $nr_of_users);
1668 $template =
new ilTemplate(
"tpl.il_svy_svy_cumulated_results_row.html", TRUE, TRUE,
"Modules/Survey");
1669 $template->setVariable(
"QUESTION_TITLE", ($counter+1) .
". ".$this->object->getTitle());
1671 $questiontext = preg_replace(
"/<[^>]+?>/ims",
"", $this->object->getQuestiontext());
1672 if (strlen($questiontext) > $maxlen + 3)
1674 $questiontext = substr($questiontext, 0, $maxlen) .
"...";
1676 $template->setVariable(
"QUESTION_TEXT", $questiontext);
1677 $template->setVariable(
"USERS_ANSWERED", $this->cumulated[
"TOTAL"][
"USERS_ANSWERED"]);
1678 $template->setVariable(
"USERS_SKIPPED", $this->cumulated[
"TOTAL"][
"USERS_SKIPPED"]);
1679 $template->setVariable(
"QUESTION_TYPE", $this->lng->txt($this->cumulated[
"TOTAL"][
"QUESTION_TYPE"]));
1680 $template->setVariable(
"MODE", $this->cumulated[
"TOTAL"][
"MODE"]);
1681 $template->setVariable(
"MODE_NR_OF_SELECTIONS", $this->cumulated[
"TOTAL"][
"MODE_NR_OF_SELECTIONS"]);
1682 $template->setVariable(
"MEDIAN", $this->cumulated[
"TOTAL"][
"MEDIAN"]);
1683 $template->setVariable(
"ARITHMETIC_MEAN", $this->cumulated[
"TOTAL"][
"ARITHMETIC_MEAN"]);
1684 $template->setVariable(
"COLOR_CLASS", $css_class);
1685 $output = $template->get();
1686 foreach ($this->cumulated as $key => $value)
1688 if (is_numeric($key))
1690 $template =
new ilTemplate(
"tpl.il_svy_svy_cumulated_results_row_matrix.html", TRUE, TRUE,
"Modules/Survey");
1691 $template->setVariable(
"QUESTION_TITLE",
"");
1692 $template->setVariable(
"ROW", ($key+1) .
". " . $value[
"ROW"]);
1693 $template->setVariable(
"USERS_ANSWERED", $value[
"USERS_ANSWERED"]);
1694 $template->setVariable(
"USERS_SKIPPED", $value[
"USERS_SKIPPED"]);
1695 $template->setVariable(
"MODE", $value[
"MODE"]);
1696 $template->setVariable(
"MODE_NR_OF_SELECTIONS", $value[
"MODE_NR_OF_SELECTIONS"]);
1697 $template->setVariable(
"MEDIAN", $value[
"MEDIAN"]);
1698 $template->setVariable(
"ARITHMETIC_MEAN", $value[
"ARITHMETIC_MEAN"]);
1699 $template->setVariable(
"COLOR_CLASS", $css_class);
1700 $output .= $template->get();
1718 if (count($this->cumulated) == 0)
1720 include_once
"./Modules/Survey/classes/class.ilObjSurvey.php";
1722 $this->cumulated =& $this->
object->getCumulatedResults($survey_id, $nr_of_users);
1726 include_once
"./classes/class.ilTemplate.php";
1727 $template =
new ilTemplate(
"tpl.il_svy_svy_cumulated_results_detail.html", TRUE, TRUE,
"Modules/Survey");
1729 $template->setCurrentBlock(
"detail_row");
1730 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"question"));
1731 $questiontext = $this->
object->getQuestiontext();
1732 $template->setVariable(
"TEXT_OPTION_VALUE", $this->object->prepareTextareaOutput($questiontext, TRUE));
1733 $template->parseCurrentBlock();
1734 $template->setCurrentBlock(
"detail_row");
1735 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"question_type"));
1736 $template->setVariable(
"TEXT_OPTION_VALUE", $this->lng->txt($this->getQuestionType()));
1737 $template->parseCurrentBlock();
1738 $template->setCurrentBlock(
"detail_row");
1739 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_answered"));
1740 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"TOTAL"][
"USERS_ANSWERED"]);
1741 $template->parseCurrentBlock();
1742 $template->setCurrentBlock(
"detail_row");
1743 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_skipped"));
1744 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"TOTAL"][
"USERS_SKIPPED"]);
1745 $template->parseCurrentBlock();
1747 $template->setCurrentBlock(
"detail_row");
1748 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"mode"));
1749 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"TOTAL"][
"MODE"]);
1750 $template->parseCurrentBlock();
1751 $template->setCurrentBlock(
"detail_row");
1752 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"mode_nr_of_selections"));
1753 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"TOTAL"][
"MODE_NR_OF_SELECTIONS"]);
1754 $template->parseCurrentBlock();
1755 $template->setCurrentBlock(
"detail_row");
1756 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"median"));
1757 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"TOTAL"][
"MEDIAN"]);
1758 $template->parseCurrentBlock();
1760 $template->setCurrentBlock(
"detail_row");
1761 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"categories"));
1763 foreach ($this->cumulated[
"TOTAL"][
"variables"] as $key => $value)
1765 $columns .=
"<li>" . $this->lng->txt(
"title") .
":" .
"<span class=\"bold\">" . $value[
"title"] .
"</span><br />" .
1766 $this->lng->txt(
"category_nr_selected") .
": " .
"<span class=\"bold\">" . $value[
"selected"] .
"</span><br />" .
1767 $this->lng->txt(
"percentage_of_selections") .
": " .
"<span class=\"bold\">" . sprintf(
"%.2f", 100*$value[
"percentage"]) .
"</span></li>";
1770 $template->setVariable(
"TEXT_OPTION_VALUE",
$columns);
1771 $template->parseCurrentBlock();
1773 foreach ($this->cumulated as $key => $value)
1775 if (is_numeric($key))
1777 $template->setCurrentBlock(
"detail_row");
1778 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"row"));
1779 $questiontext = $value[
"ROW"];
1780 $template->setVariable(
"TEXT_OPTION_VALUE", $this->object->prepareTextareaOutput($questiontext, TRUE));
1781 $template->parseCurrentBlock();
1782 $template->setCurrentBlock(
"detail_row");
1783 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_answered"));
1784 $template->setVariable(
"TEXT_OPTION_VALUE", $value[
"USERS_ANSWERED"]);
1785 $template->parseCurrentBlock();
1786 $template->setCurrentBlock(
"detail_row");
1787 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_skipped"));
1788 $template->setVariable(
"TEXT_OPTION_VALUE", $value[
"USERS_SKIPPED"]);
1789 $template->parseCurrentBlock();
1791 $template->setCurrentBlock(
"detail_row");
1792 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"mode"));
1793 $template->setVariable(
"TEXT_OPTION_VALUE", $value[
"MODE"]);
1794 $template->parseCurrentBlock();
1795 $template->setCurrentBlock(
"detail_row");
1796 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"mode_nr_of_selections"));
1797 $template->setVariable(
"TEXT_OPTION_VALUE", $value[
"MODE_NR_OF_SELECTIONS"]);
1798 $template->parseCurrentBlock();
1799 $template->setCurrentBlock(
"detail_row");
1800 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"median"));
1801 $template->setVariable(
"TEXT_OPTION_VALUE", $value[
"MEDIAN"]);
1802 $template->parseCurrentBlock();
1804 $template->setCurrentBlock(
"detail_row");
1805 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"categories"));
1807 foreach ($value[
"variables"] as $key => $value)
1809 $columns .=
"<li>" . $this->lng->txt(
"title") .
":" .
"<span class=\"bold\">" . $value[
"title"] .
"</span><br />" .
1810 $this->lng->txt(
"category_nr_selected") .
": " .
"<span class=\"bold\">" . $value[
"selected"] .
"</span><br />" .
1811 $this->lng->txt(
"percentage_of_selections") .
": " .
"<span class=\"bold\">" . sprintf(
"%.2f", 100*$value[
"percentage"]) .
"</span></li>";
1814 $template->setVariable(
"TEXT_OPTION_VALUE",
$columns);
1815 $template->parseCurrentBlock();
1820 foreach ($this->cumulated as $key => $value)
1822 if (is_numeric($key))
1824 $template->setCurrentBlock(
"chartimage");
1827 include_once
"./Services/Administration/classes/class.ilSetting.php";
1828 $surveySetting =
new ilSetting(
"survey");
1829 if ($surveySetting->get(
"googlechart") == 1)
1831 $chartcolors = array(
"2A4BD7",
"9DAFFF",
"1D6914",
"81C57A",
"814A19",
"E9DEBB",
"8126C0",
"AD2323",
"29D0D0",
"FFEE33",
"FF9233",
"FFCDF3",
"A0A0A0",
"575757",
"000000");
1832 $selections = array();
1835 foreach ($value[
"variables"] as $val)
1837 if ($val[
"selected"] > $maxselection) $maxselection = $val[
"selected"];
1838 array_push($selections, $val[
"selected"]);
1839 array_push($values, str_replace(
" ",
"+", $val[
"title"]));
1842 $selectionlabels =
"";
1843 if ($maxselection % 2 == 0)
1845 $selectionlabels =
"0|" . ($maxselection / 2) .
"|$maxselection";
1849 $selectionlabels =
"0|$maxselection";
1851 $charturl =
"http://chart.apis.google.com/chart?chco=" . implode(
"|", array_slice($chartcolors, 0, count($values))).
"&cht=bvs&chs=" . $chartwidth .
"x250&chd=t:" . implode(
",", $selections) .
"&chds=0,$maxselection&chxt=y,y&chxl=0:|$selectionlabels|1:||".str_replace(
" ",
"+", $this->lng->txt(
"mode_nr_of_selections")).
"|" .
"&chxr=1,0,$maxselection&chtt=" . str_replace(
" ",
"+", $value[
"ROW"]) .
"&chbh=20," . round($chartwidth/(count($values)+1.5)) .
"&chdl=" . implode(
"|", $values) .
"&chdlp=b";
1855 $this->ctrl->setParameterByClass(
"ilsurveyevaluationgui",
"type", $key);
1856 $this->ctrl->setParameterByClass(
"ilsurveyevaluationgui",
"survey", $survey_id);
1857 $this->ctrl->setParameterByClass(
"ilsurveyevaluationgui",
"question", $this->object->getId());
1858 $charturl = $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"outChart");
1860 $template->setVariable(
"CHART", $charturl);
1861 $template->setVariable(
"ALT_CHART", $this->lng->txt(
"chart"));
1862 $template->parseCurrentBlock();
1865 $template->setCurrentBlock(
"chart");
1866 $template->setVariable(
"TEXT_CHART", $this->lng->txt(
"chart"));
1867 $template->parseCurrentBlock();
1869 $template->setVariable(
"QUESTION_TITLE",
"$counter. ".$this->object->getTitle());
1870 $output = $template->get();