24 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
25 include_once
"./Modules/Survey/classes/inc.SurveyConstants.php";
55 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyOrdinalQuestion.php";
59 $this->
object->loadFromDb($id);
72 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_ordinal.html",
"Modules/SurveyQuestionPool");
73 $this->tpl->addBlockFile(
"OTHER_QUESTION_DATA",
"other_question_data",
"tpl.il_svy_qpl_other_question_data.html",
"Modules/SurveyQuestionPool");
74 $internallinks = array(
75 "lm" => $this->lng->txt(
"obj_lm"),
76 "st" => $this->lng->txt(
"obj_st"),
77 "pg" => $this->lng->txt(
"obj_pg"),
78 "glo" => $this->lng->txt(
"glossary_term")
80 foreach ($internallinks as $key => $value)
82 $this->tpl->setCurrentBlock(
"internallink");
83 $this->tpl->setVariable(
"TYPE_INTERNAL_LINK", $key);
84 $this->tpl->setVariable(
"TEXT_INTERNAL_LINK", $value);
85 $this->tpl->parseCurrentBlock();
88 $this->tpl->setCurrentBlock(
"adm_content");
89 $this->tpl->setVariable(
"TEXT_MATERIAL", $this->lng->txt(
"material"));
90 if (count($this->object->material))
92 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
94 $this->tpl->setVariable(
"TEXT_VALUE_MATERIAL",
" <a href=\"$href\" target=\"content\">" . $this->lng->txt(
"material").
"</a> ");
95 $this->tpl->setVariable(
"BUTTON_REMOVE_MATERIAL", $this->lng->txt(
"remove"));
96 $this->tpl->setVariable(
"BUTTON_ADD_MATERIAL", $this->lng->txt(
"change"));
97 $this->tpl->setVariable(
"VALUE_MATERIAL", $this->object->material[
"internal_link"]);
98 $this->tpl->setVariable(
"VALUE_MATERIAL_TITLE", $this->object->material[
"title"]);
99 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"title"));
103 $this->tpl->setVariable(
"BUTTON_ADD_MATERIAL", $this->lng->txt(
"add"));
105 $this->tpl->setVariable(
"TEXT_ORIENTATION", $this->lng->txt(
"orientation"));
106 switch ($this->object->getOrientation())
109 $this->tpl->setVariable(
"CHECKED_VERTICAL",
" checked=\"checked\"");
112 $this->tpl->setVariable(
"CHECKED_HORIZONTAL",
" checked=\"checked\"");
115 $this->tpl->setVariable(
"CHECKED_COMBOBOX",
" checked=\"checked\"");
118 $this->tpl->setVariable(
"TXT_VERTICAL", $this->lng->txt(
"vertical"));
119 $this->tpl->setVariable(
"TXT_HORIZONTAL", $this->lng->txt(
"horizontal"));
120 $this->tpl->setVariable(
"TXT_COMBOBOX", $this->lng->txt(
"combobox"));
121 $this->tpl->setVariable(
"QUESTION_ID", $this->object->getId());
122 $this->tpl->setVariable(
"VALUE_TITLE", $this->object->getTitle());
123 $this->tpl->setVariable(
"VALUE_DESCRIPTION", $this->object->getDescription());
124 $this->tpl->setVariable(
"VALUE_AUTHOR", $this->object->getAuthor());
125 $questiontext = $this->
object->getQuestiontext();
126 $this->tpl->setVariable(
"VALUE_QUESTION",
ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($questiontext)));
127 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"title"));
128 $this->tpl->setVariable(
"TEXT_AUTHOR", $this->lng->txt(
"author"));
129 $this->tpl->setVariable(
"TEXT_DESCRIPTION", $this->lng->txt(
"description"));
130 $this->tpl->setVariable(
"TEXT_QUESTION", $this->lng->txt(
"question"));
131 $this->tpl->setVariable(
"TEXT_QUESTION_TYPE", $this->lng->txt(
"questiontype"));
132 $this->tpl->setVariable(
"TEXT_OBLIGATORY", $this->lng->txt(
"obligatory"));
133 if ($this->object->getObligatory())
135 $this->tpl->setVariable(
"CHECKED_OBLIGATORY",
" checked=\"checked\"");
137 $this->tpl->setVariable(
"SAVE",$this->lng->txt(
"save"));
138 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
139 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
140 $this->tpl->setVariable(
"TEXT_QUESTION_TYPE", $this->lng->txt($this->getQuestionType()));
141 $this->tpl->parseCurrentBlock();
142 include_once
"./Services/RTE/classes/class.ilRTE.php";
144 include_once
"./Services/RTE/classes/class.$rtestring.php";
145 $rte =
new $rtestring();
146 $rte->addPlugin(
"latex");
147 $rte->addButton(
"latex"); $rte->addButton(
"pastelatex");
148 $rte->removePlugin(
"ibrowser");
149 include_once
"./classes/class.ilObject.php";
150 $obj_id =
$_GET[
"q_id"];
152 $rte->addRTESupport($obj_id, $obj_type,
"survey");
164 function getWorkingForm($working_data =
"", $question_title = 1, $show_questiontext = 1, $error_message =
"", $survey_id = null)
166 $template =
new ilTemplate(
"tpl.il_svy_out_ordinal.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
167 if (count($this->object->material))
169 $template->setCurrentBlock(
"material_ordinal");
170 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
172 $template->setVariable(
"TEXT_MATERIAL", $this->lng->txt(
"material") .
": <a href=\"$href\" target=\"content\">" . $this->
object->material[
"title"].
"</a> ");
173 $template->parseCurrentBlock();
175 switch ($this->object->orientation)
179 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
181 $category = $this->
object->categories->getCategory($i);
182 $template->setCurrentBlock(
"ordinal_row");
184 $template->setVariable(
"VALUE_ORDINAL", $i);
185 $template->setVariable(
"QUESTION_ID", $this->object->getId());
186 if (is_array($working_data))
188 if (strcmp($working_data[0][
"value"],
"") != 0)
190 if ($working_data[0][
"value"] == $i)
192 $template->setVariable(
"CHECKED_ORDINAL",
" checked=\"checked\"");
196 $template->parseCurrentBlock();
201 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
203 $category = $this->
object->categories->getCategory($i);
204 $template->setCurrentBlock(
"radio_col_ordinal");
205 $template->setVariable(
"VALUE_ORDINAL", $i);
206 $template->setVariable(
"QUESTION_ID", $this->object->getId());
207 if (is_array($working_data))
209 if (strcmp($working_data[0][
"value"],
"") != 0)
211 if ($working_data[0][
"value"] == $i)
213 $template->setVariable(
"CHECKED_ORDINAL",
" checked=\"checked\"");
217 $template->parseCurrentBlock();
219 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
221 $category = $this->
object->categories->getCategory($i);
222 $template->setCurrentBlock(
"text_col_ordinal");
223 $template->setVariable(
"VALUE_ORDINAL", $i);
225 $template->setVariable(
"QUESTION_ID", $this->object->getId());
226 $template->parseCurrentBlock();
231 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
233 $category = $this->
object->categories->getCategory($i);
234 $template->setCurrentBlock(
"comborow");
235 $template->setVariable(
"TEXT_ORDINAL", $category);
236 $template->setVariable(
"VALUE_ORDINAL", $i);
237 if (is_array($working_data))
239 if (strcmp($working_data[0][
"value"],
"") != 0)
241 if ($working_data[0][
"value"] == $i)
243 $template->setVariable(
"SELECTED_ORDINAL",
" selected=\"selected\"");
247 $template->parseCurrentBlock();
249 $template->setCurrentBlock(
"combooutput");
250 $template->setVariable(
"QUESTION_ID", $this->object->getId());
251 $template->setVariable(
"SELECT_OPTION", $this->lng->txt(
"select_option"));
252 $template->setVariable(
"TEXT_SELECTION", $this->lng->txt(
"selection"));
253 $template->parseCurrentBlock();
258 $template->setVariable(
"QUESTION_TITLE", $this->object->getTitle());
260 $template->setCurrentBlock(
"question_data_ordinal");
261 if (strcmp($error_message,
"") != 0)
263 $template->setVariable(
"ERROR_MESSAGE",
"<p class=\"warning\">$error_message</p>");
265 if ($show_questiontext)
267 $questiontext = $this->
object->getQuestiontext();
268 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
270 if (! $this->object->getObligatory($survey_id))
272 $template->setVariable(
"OBLIGATORY_TEXT", $this->lng->txt(
"survey_question_optional"));
274 $template->parseCurrentBlock();
275 return $template->get();
285 function getPrintView($question_title = 1, $show_questiontext = 1, $survey_id = null)
287 $template =
new ilTemplate(
"tpl.il_svy_qpl_ordinal_printview.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
288 switch ($this->object->orientation)
292 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
294 $category = $this->
object->categories->getCategory($i);
295 $template->setCurrentBlock(
"ordinal_row");
297 $template->setVariable(
"ALT_RADIO", $this->lng->txt(
"unchecked"));
298 $template->setVariable(
"TITLE_RADIO", $this->lng->txt(
"unchecked"));
300 $template->parseCurrentBlock();
305 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
307 $category = $this->
object->categories->getCategory($i);
308 $template->setCurrentBlock(
"radio_col_ordinal");
310 $template->setVariable(
"ALT_RADIO", $this->lng->txt(
"unchecked"));
311 $template->setVariable(
"TITLE_RADIO", $this->lng->txt(
"unchecked"));
312 $template->parseCurrentBlock();
314 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
316 $category = $this->
object->categories->getCategory($i);
317 $template->setCurrentBlock(
"text_col_ordinal");
318 $template->setVariable(
"TEXT_ORDINAL", $category);
319 $template->parseCurrentBlock();
324 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
326 $category = $this->
object->categories->getCategory($i);
327 $template->setCurrentBlock(
"comborow");
329 $template->setVariable(
"VALUE_ORDINAL", $i);
330 if (is_array($working_data))
332 if (strcmp($working_data[0][
"value"],
"") != 0)
334 if ($working_data[0][
"value"] == $i)
336 $template->setVariable(
"SELECTED_ORDINAL",
" selected=\"selected\"");
340 $template->parseCurrentBlock();
342 $template->setCurrentBlock(
"combooutput");
343 $template->setVariable(
"QUESTION_ID", $this->object->getId());
344 $template->setVariable(
"SELECT_OPTION", $this->lng->txt(
"select_option"));
345 $template->setVariable(
"TEXT_SELECTION", $this->lng->txt(
"selection"));
346 $template->parseCurrentBlock();
351 $template->setVariable(
"QUESTION_TITLE", $this->object->getTitle());
353 if ($show_questiontext)
355 $questiontext = $this->
object->getQuestiontext();
356 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
358 if (! $this->object->getObligatory($survey_id))
360 $template->setVariable(
"OBLIGATORY_TEXT", $this->lng->txt(
"survey_question_optional"));
362 $template->parseCurrentBlock();
363 return $template->get();
375 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_preview.html",
"Modules/SurveyQuestionPool");
377 $this->tpl->setVariable(
"QUESTION_OUTPUT", $question_output);
391 if ((!$_POST[
"title"]) or (!$_POST[
"author"]) or (!$_POST[
"question"]))
$result = 1;
394 if ($_POST[
"id"] > 0) $this->
object->setId($_POST[
"id"]);
395 include_once
"./Services/Utilities/classes/class.ilUtil.php";
399 $this->
object->setOrientation($_POST[
"orientation"]);
400 if (strlen($_POST[
"material"]))
402 $this->
object->setMaterial($_POST[
"material"], 0,
ilUtil::stripSlashes($_POST[
"material_title"]));
404 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
406 $this->
object->setQuestiontext($questiontext);
407 if ($_POST[
"obligatory"])
409 $this->
object->setObligatory(1);
413 $this->
object->setObligatory(0);
421 $this->
object->saveToDb();
435 if ($this->object->getId() < 1)
437 ilUtil::sendInfo($this->lng->txt(
"fill_out_all_required_fields_add_category"),
true);
438 $this->ctrl->redirect($this,
"editQuestion");
440 if (strcmp($this->ctrl->getCmd(),
"categories") == 0)
$_SESSION[
"spl_modified"] =
false;
441 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_ordinal_answers.html",
"Modules/SurveyQuestionPool");
443 for ($i = 0; $i < $this->
object->categories->getCategoryCount(); $i++)
445 $this->tpl->setCurrentBlock(
"cat_selector");
446 $this->tpl->setVariable(
"CATEGORY_ORDER", $i);
447 $this->tpl->parseCurrentBlock();
448 $this->tpl->setCurrentBlock(
"categories");
449 $category = $this->
object->categories->getCategory($i);
450 $this->tpl->setVariable(
"CATEGORY_ORDER", $i);
451 $this->tpl->setVariable(
"CATEGORY_NUMBER", $i+1);
453 $this->tpl->setVariable(
"TEXT_CATEGORY", $this->lng->txt(
"category"));
454 $this->tpl->parseCurrentBlock();
459 $nrOfCategories = $_POST[
"nrOfCategories"];
460 if ($nrOfCategories < 1) $nrOfCategories = 1;
462 for ($i = 1; $i <= $nrOfCategories; $i++)
464 $this->tpl->setCurrentBlock(
"categories");
465 $this->tpl->setVariable(
"CATEGORY_ORDER", $this->object->categories->getCategoryCount() + $i - 1);
466 $this->tpl->setVariable(
"TEXT_CATEGORY", $this->lng->txt(
"category"));
467 $this->tpl->parseCurrentBlock();
475 $this->tpl->setCurrentBlock(
"move_buttons");
476 $this->tpl->setVariable(
"INSERT_BEFORE", $this->lng->txt(
"insert_before"));
477 $this->tpl->setVariable(
"INSERT_AFTER", $this->lng->txt(
"insert_after"));
478 $this->tpl->parseCurrentBlock();
482 include_once
"./Services/Utilities/classes/class.ilUtil.php";
483 if ($this->object->categories->getCategoryCount() == 0)
487 $this->tpl->setCurrentBlock(
"nocategories");
488 $this->tpl->setVariable(
"NO_CATEGORIES", $this->lng->txt(
"question_contains_no_categories"));
489 $this->tpl->parseCurrentBlock();
494 $this->tpl->setCurrentBlock(
"selectall");
495 $this->tpl->setVariable(
"SELECT_ALL", $this->lng->txt(
"select_all"));
496 $this->tpl->parseCurrentBlock();
497 $this->tpl->setCurrentBlock(
"existingcategories");
498 $this->tpl->setVariable(
"DELETE", $this->lng->txt(
"delete"));
499 $this->tpl->setVariable(
"MOVE", $this->lng->txt(
"move"));
500 $this->tpl->setVariable(
"VALUE_SAVE_PHRASE", $this->lng->txt(
"save_phrase"));
501 $this->tpl->setVariable(
"ARROW",
"<img src=\"" .
ilUtil::getImagePath(
"arrow_downright.gif") .
"\" alt=\"".$this->lng->txt(
"arrow_downright").
"\">");
502 $this->tpl->parseCurrentBlock();
505 for ($i = 1; $i < 10; $i++)
507 $this->tpl->setCurrentBlock(
"numbers");
508 $this->tpl->setVariable(
"VALUE_NUMBER", $i);
511 $this->tpl->setVariable(
"TEXT_NUMBER", $i .
" " . $this->lng->txt(
"category"));
515 $this->tpl->setVariable(
"TEXT_NUMBER", $i .
" " . $this->lng->txt(
"categories"));
517 $this->tpl->parseCurrentBlock();
520 $this->tpl->setCurrentBlock(
"adm_content");
521 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
522 $this->tpl->setVariable(
"VALUE_ADD_CATEGORY", $this->lng->txt(
"add"));
523 $this->tpl->setVariable(
"VALUE_ADD_PHRASE", $this->lng->txt(
"add_phrase"));
524 $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save"));
527 $this->tpl->setVariable(
"FORM_DATA_MODIFIED_PRESS_SAVE", $this->lng->txt(
"form_data_modified_press_save"));
529 $questiontext = $this->
object->getQuestiontext();
530 $this->tpl->setVariable(
"QUESTION_TEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
531 $this->tpl->parseCurrentBlock();
549 $this->ctrl->setParameterByClass(get_class($this),
"q_id", $this->object->getId());
550 $this->ctrl->setParameterByClass(
"ilobjsurveyquestionpoolgui",
"q_id", $this->object->getId());
552 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_addphrase.html",
"Modules/SurveyQuestionPool");
555 $this->tpl->setCurrentBlock(
"hidden");
556 $this->tpl->setVariable(
"HIDDEN_NAME",
"id");
557 $this->tpl->setVariable(
"HIDDEN_VALUE", $this->object->getId());
558 $this->tpl->parseCurrentBlock();
560 include_once
"./Modules/SurveyQuestionPool/classes/class.ilSurveyPhrases.php";
562 $colors = array(
"tblrow1",
"tblrow2");
564 foreach ($phrases as $phrase_id => $phrase_array)
566 $this->tpl->setCurrentBlock(
"phraserow");
567 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter++ % 2]);
568 $this->tpl->setVariable(
"PHRASE_VALUE", $phrase_id);
569 $this->tpl->setVariable(
"PHRASE_NAME", $phrase_array[
"title"]);
571 $this->tpl->setVariable(
"PHRASE_CONTENT", join($categories,
","));
572 $this->tpl->parseCurrentBlock();
575 $this->tpl->setCurrentBlock(
"adm_content");
576 $this->tpl->setVariable(
"TEXT_CANCEL", $this->lng->txt(
"cancel"));
577 $this->tpl->setVariable(
"TEXT_PHRASE", $this->lng->txt(
"phrase"));
578 $this->tpl->setVariable(
"TEXT_CONTENT", $this->lng->txt(
"categories"));
579 $this->tpl->setVariable(
"TEXT_ADD_PHRASE", $this->lng->txt(
"add_phrase"));
580 $this->tpl->setVariable(
"TEXT_INTRODUCTION",$this->lng->txt(
"add_phrase_introduction"));
581 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
582 $this->tpl->parseCurrentBlock();
594 $this->ctrl->redirect($this,
"categories");
606 if (strcmp($_POST[
"phrases"],
"") == 0)
613 if (strcmp($this->object->getPhrase($_POST[
"phrases"]),
"dp_standard_numbers") != 0)
615 $this->
object->addPhrase($_POST[
"phrases"]);
616 $this->
object->saveCategoriesToDb();
623 $this->ctrl->redirect($this,
"categories");
636 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_addphrase_standard_numbers.html",
"Modules/SurveyQuestionPool");
639 $this->tpl->setCurrentBlock(
"hidden");
640 $this->tpl->setVariable(
"HIDDEN_NAME",
"id");
641 $this->tpl->setVariable(
"HIDDEN_VALUE", $this->object->getId());
642 $this->tpl->parseCurrentBlock();
644 $this->tpl->setCurrentBlock(
"adm_content");
645 $this->tpl->setVariable(
"ADD_STANDARD_NUMBERS", $this->lng->txt(
"add_standard_numbers"));
646 $this->tpl->setVariable(
"TEXT_ADD_LIMITS", $this->lng->txt(
"add_limits_for_standard_numbers"));
647 $this->tpl->setVariable(
"TEXT_LOWER_LIMIT",$this->lng->txt(
"lower_limit"));
648 $this->tpl->setVariable(
"TEXT_UPPER_LIMIT",$this->lng->txt(
"upper_limit"));
649 $this->tpl->setVariable(
"VALUE_LOWER_LIMIT", $_POST[
"lower_limit"]);
650 $this->tpl->setVariable(
"VALUE_UPPER_LIMIT", $_POST[
"upper_limit"]);
651 $this->tpl->setVariable(
"BTN_ADD",$this->lng->txt(
"add_phrase"));
652 $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
"cancel"));
653 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
654 $this->tpl->parseCurrentBlock();
666 $this->ctrl->redirect($this,
"categories");
678 if ((strcmp($_POST[
"lower_limit"],
"") == 0) or (strcmp($_POST[
"upper_limit"],
"") == 0))
683 else if ((
int)$_POST[
"upper_limit"] <= (
int)$_POST[
"lower_limit"])
690 $this->
object->addStandardNumbers($_POST[
"lower_limit"], $_POST[
"upper_limit"]);
691 $this->
object->saveCategoriesToDb();
692 $this->ctrl->redirect($this,
"categories");
706 $nothing_selected =
true;
707 if (array_key_exists(
"chb_category", $_POST))
709 if (count($_POST[
"chb_category"]))
711 $nothing_selected =
false;
712 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_savephrase.html",
"Modules/SurveyQuestionPool");
713 $rowclass = array(
"tblrow1",
"tblrow2");
715 foreach ($_POST[
"chb_category"] as $category)
717 $this->tpl->setCurrentBlock(
"row");
718 $this->tpl->setVariable(
"TXT_TITLE", $this->object->categories->getCategory($category));
719 $this->tpl->setVariable(
"COLOR_CLASS", $rowclass[$counter % 2]);
720 $this->tpl->parseCurrentBlock();
721 $this->tpl->setCurrentBlock(
"hidden");
722 $this->tpl->setVariable(
"HIDDEN_NAME",
"chb_category[]");
723 $this->tpl->setVariable(
"HIDDEN_VALUE", $category);
724 $this->tpl->parseCurrentBlock();
727 $this->tpl->setCurrentBlock(
"adm_content");
728 $this->tpl->setVariable(
"SAVE_PHRASE_INTRODUCTION", $this->lng->txt(
"save_phrase_introduction"));
729 $this->tpl->setVariable(
"TEXT_PHRASE_TITLE", $this->lng->txt(
"enter_phrase_title"));
730 $this->tpl->setVariable(
"TXT_TITLE", $this->lng->txt(
"category"));
731 $this->tpl->setVariable(
"VALUE_PHRASE_TITLE", $_POST[
"phrase_title"]);
732 $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
"cancel"));
733 $this->tpl->setVariable(
"BTN_CONFIRM",$this->lng->txt(
"confirm"));
734 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
735 $this->tpl->parseCurrentBlock();
738 if ($nothing_selected)
741 $this->ctrl->redirect($this,
"categories");
754 $this->ctrl->redirect($this,
"categories");
766 if (!$_POST[
"phrase_title"])
773 if ($this->object->phraseExists($_POST[
"phrase_title"]))
780 $this->
object->savePhrase($_POST[
"chb_category"], $_POST[
"phrase_title"]);
782 $this->ctrl->redirect($this,
"categories");
799 $originalexists = $this->
object->_questionExists($this->object->original_id);
800 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
801 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
809 $this->ctrl->redirect($this,
"categories");
843 $this->
object->categories->flushCategories();
847 include_once
"./Services/Utilities/classes/class.ilUtil.php";
848 foreach ($_POST as $key => $value)
850 if (preg_match(
"/^category_(\d+)/", $key, $matches))
853 if (strlen($array1[$matches[1]]) == 0) $complete =
false;
856 $this->
object->categories->addCategoryArray($array1);
859 $this->
object->saveCategoriesToDb();
874 $nothing_selected =
true;
875 if (array_key_exists(
"chb_category", $_POST))
877 if (count($_POST[
"chb_category"]))
879 $nothing_selected =
false;
880 $this->
object->categories->removeCategories($_POST[
"chb_category"]);
883 if ($nothing_selected)
ilUtil::sendInfo($this->lng->txt(
"category_delete_select_none"));
898 $nothing_selected =
true;
899 if (array_key_exists(
"chb_category", $_POST))
901 if (count($_POST[
"chb_category"]))
903 $nothing_selected =
false;
905 $_SESSION[
"spl_move"] = $_POST[
"chb_category"];
908 if ($nothing_selected)
ilUtil::sendInfo($this->lng->txt(
"no_category_selected_for_move"));
922 if (array_key_exists(
"chb_category", $_POST))
924 if (count($_POST[
"chb_category"]) == 1)
927 $this->
object->categories->removeCategories(
$_SESSION[
"spl_move"]);
928 $newinsertindex = $this->
object->categories->getCategoryIndex($_POST[
"category_".$_POST[
"chb_category"][0]]);
929 if ($newinsertindex ===
false) $newinsertindex = 0;
930 $move_categories =
$_SESSION[
"spl_move"];
931 natsort($move_categories);
932 foreach (array_reverse($move_categories) as $index)
934 $this->
object->categories->addCategoryAtPosition($_POST[
"category_$index"], $newinsertindex);
957 if (array_key_exists(
"chb_category", $_POST))
959 if (count($_POST[
"chb_category"]) == 1)
962 $this->
object->categories->removeCategories(
$_SESSION[
"spl_move"]);
963 $newinsertindex = $this->
object->categories->getCategoryIndex($_POST[
"category_".$_POST[
"chb_category"][0]]);
964 if ($newinsertindex ===
false) $newinsertindex = 0;
965 $move_categories =
$_SESSION[
"spl_move"];
966 natsort($move_categories);
967 foreach (array_reverse($move_categories) as $index)
969 $this->
object->categories->addCategoryAtPosition($_POST[
"category_$index"], $newinsertindex+1);
992 include_once
"./classes/class.ilTemplate.php";
993 if (count($this->cumulated) == 0)
995 include_once
"./Modules/Survey/classes/class.ilObjSurvey.php";
997 $this->cumulated =& $this->
object->getCumulatedResults($survey_id, $nr_of_users);
999 $template =
new ilTemplate(
"tpl.il_svy_svy_cumulated_results_row.html", TRUE, TRUE,
"Modules/Survey");
1000 $template->setVariable(
"QUESTION_TITLE", ($counter+1) .
". ".$this->object->getTitle());
1002 $questiontext = preg_replace(
"/<[^>]+?>/ims",
"", $this->object->getQuestiontext());
1003 if (strlen($questiontext) > $maxlen + 3)
1005 $questiontext = substr($questiontext, 0, $maxlen) .
"...";
1007 $template->setVariable(
"QUESTION_TEXT", $questiontext);
1008 $template->setVariable(
"USERS_ANSWERED", $this->cumulated[
"USERS_ANSWERED"]);
1009 $template->setVariable(
"USERS_SKIPPED", $this->cumulated[
"USERS_SKIPPED"]);
1010 $template->setVariable(
"QUESTION_TYPE", $this->lng->txt($this->cumulated[
"QUESTION_TYPE"]));
1011 $template->setVariable(
"MODE", $this->cumulated[
"MODE"]);
1012 $template->setVariable(
"MODE_NR_OF_SELECTIONS", $this->cumulated[
"MODE_NR_OF_SELECTIONS"]);
1013 $template->setVariable(
"MEDIAN", $this->cumulated[
"MEDIAN"]);
1014 $template->setVariable(
"ARITHMETIC_MEAN", $this->cumulated[
"ARITHMETIC_MEAN"]);
1015 $template->setVariable(
"COLOR_CLASS", $css_class);
1016 return $template->get();
1031 if (count($this->cumulated) == 0)
1033 include_once
"./Modules/Survey/classes/class.ilObjSurvey.php";
1035 $this->cumulated =& $this->
object->getCumulatedResults($survey_id, $nr_of_users);
1039 include_once
"./classes/class.ilTemplate.php";
1040 $template =
new ilTemplate(
"tpl.il_svy_svy_cumulated_results_detail.html", TRUE, TRUE,
"Modules/Survey");
1042 $template->setCurrentBlock(
"detail_row");
1043 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"question"));
1044 $questiontext = $this->
object->getQuestiontext();
1045 $template->setVariable(
"TEXT_OPTION_VALUE", $this->object->prepareTextareaOutput($questiontext, TRUE));
1046 $template->parseCurrentBlock();
1047 $template->setCurrentBlock(
"detail_row");
1048 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"question_type"));
1049 $template->setVariable(
"TEXT_OPTION_VALUE", $this->lng->txt($this->getQuestionType()));
1050 $template->parseCurrentBlock();
1051 $template->setCurrentBlock(
"detail_row");
1052 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_answered"));
1053 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"USERS_ANSWERED"]);
1054 $template->parseCurrentBlock();
1055 $template->setCurrentBlock(
"detail_row");
1056 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_skipped"));
1057 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"USERS_SKIPPED"]);
1058 $template->parseCurrentBlock();
1060 $template->setCurrentBlock(
"detail_row");
1061 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"mode"));
1062 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"MODE"]);
1063 $template->parseCurrentBlock();
1064 $template->setCurrentBlock(
"detail_row");
1065 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"mode_nr_of_selections"));
1066 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"MODE_NR_OF_SELECTIONS"]);
1067 $template->parseCurrentBlock();
1068 $template->setCurrentBlock(
"detail_row");
1069 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"median"));
1070 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"MEDIAN"]);
1071 $template->parseCurrentBlock();
1073 $template->setCurrentBlock(
"detail_row");
1074 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"categories"));
1076 foreach ($this->cumulated[
"variables"] as $key => $value)
1078 $categories .=
"<li>" . $this->lng->txt(
"title") .
":" .
"<span class=\"bold\">" . $value[
"title"] .
"</span><br />" .
1079 $this->lng->txt(
"category_nr_selected") .
": " .
"<span class=\"bold\">" . $value[
"selected"] .
"</span><br />" .
1080 $this->lng->txt(
"percentage_of_selections") .
": " .
"<span class=\"bold\">" . sprintf(
"%.2f", 100*$value[
"percentage"]) .
"</span></li>";
1082 $categories =
"<ol>$categories</ol>";
1083 $template->setVariable(
"TEXT_OPTION_VALUE", $categories);
1084 $template->parseCurrentBlock();
1087 $template->setCurrentBlock(
"chart");
1088 $template->setVariable(
"TEXT_CHART", $this->lng->txt(
"chart"));
1089 $template->setVariable(
"ALT_CHART",
$data[
"title"] .
"( " . $this->lng->txt(
"chart") .
")");
1091 include_once
"./Services/Administration/classes/class.ilSetting.php";
1092 $surveySetting =
new ilSetting(
"survey");
1093 if ($surveySetting->get(
"googlechart") == 1)
1095 $chartcolors = array(
"2A4BD7",
"9DAFFF",
"1D6914",
"81C57A",
"814A19",
"E9DEBB",
"8126C0",
"AD2323",
"29D0D0",
"FFEE33",
"FF9233",
"FFCDF3",
"A0A0A0",
"575757",
"000000");
1096 $selections = array();
1100 foreach ($this->cumulated[
"variables"] as $val)
1102 if ($val[
"selected"] > $maxselection) $maxselection = $val[
"selected"];
1103 array_push($selections, $val[
"selected"]);
1104 array_push($values, str_replace(
" ",
"+", $val[
"title"]));
1107 if ($maxselection % 2 == 0)
1109 $selectionlabels =
"0|" . ($maxselection / 2) .
"|$maxselection";
1113 $selectionlabels =
"0|$maxselection";
1115 $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(
" ",
"+", $this->object->getTitle()) .
"&chbh=20," . round($chartwidth/(count($values)+1.5)) .
"&chdl=" . implode(
"|", $values) .
"&chdlp=b";
1119 $this->ctrl->setParameterByClass(
"ilsurveyevaluationgui",
"survey", $survey_id);
1120 $this->ctrl->setParameterByClass(
"ilsurveyevaluationgui",
"question", $this->object->getId());
1121 $charturl = $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"outChart");
1123 $template->setVariable(
"CHART", $charturl);
1124 $template->parseCurrentBlock();
1126 $template->setVariable(
"QUESTION_TITLE",
"$counter. ".$this->object->getTitle());
1127 return $template->get();