24 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
72 $this->ctrl->saveParameter($this,
"q_id");
74 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
75 $this->errormessage = $this->lng->txt(
"fill_out_all_required_fields");
77 $this->selfassessmenteditingmode =
false;
78 $this->new_id_listeners = array();
79 $this->new_id_listener_cnt = 0;
87 $cmd = $this->ctrl->getCmd(
"editQuestion");
88 $next_class = $this->ctrl->getNextClass($this);
129 $this->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.il_as_qpl_content.html",
"Modules/TestQuestionPool");
130 $this->tpl->addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
132 $total_of_answers = $this->
object->getTotalAnswers();
134 $color_class = array(
"tblrow1",
"tblrow2");
135 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_qpl_assessment_of_questions.html",
"Modules/TestQuestionPool");
136 if (!$total_of_answers)
138 $this->tpl->setCurrentBlock(
"emptyrow");
139 $this->tpl->setVariable(
"TXT_NO_ASSESSMENT", $this->lng->txt(
"qpl_assessment_no_assessment_of_questions"));
140 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
141 $this->tpl->parseCurrentBlock();
145 $this->tpl->setCurrentBlock(
"row");
146 $this->tpl->setVariable(
"TXT_RESULT", $this->lng->txt(
"qpl_assessment_total_of_answers"));
147 $this->tpl->setVariable(
"TXT_VALUE", $total_of_answers);
148 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
150 $this->tpl->parseCurrentBlock();
151 $this->tpl->setCurrentBlock(
"row");
152 $this->tpl->setVariable(
"TXT_RESULT", $this->lng->txt(
"qpl_assessment_total_of_right_answers"));
153 $this->tpl->setVariable(
"TXT_VALUE", sprintf(
"%2.2f", $this->object->_getTotalRightAnswers(
$_GET[
"q_id"]) * 100.0) .
" %");
154 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
155 $this->tpl->parseCurrentBlock();
158 $instances =& $this->
object->getInstances();
160 foreach ($instances as $instance)
162 if (is_array($instance[
"refs"]))
164 foreach ($instance[
"refs"] as
$ref_id)
166 $this->tpl->setCurrentBlock(
"references");
167 $this->tpl->setVariable(
"GOTO",
"./goto.php?target=tst_" . $ref_id);
168 $this->tpl->setVariable(
"TEXT_GOTO", $this->lng->txt(
"perma_link"));
169 $this->tpl->parseCurrentBlock();
172 $this->tpl->setCurrentBlock(
"instance_row");
173 $this->tpl->setVariable(
"TEST_TITLE", $instance[
"title"]);
174 $this->tpl->setVariable(
"TEST_AUTHOR", $instance[
"author"]);
175 $this->tpl->setVariable(
"QUESTION_ID", $instance[
"question_id"]);
176 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
178 $this->tpl->parseCurrentBlock();
180 $this->tpl->setCurrentBlock(
"instances");
181 $this->tpl->setVariable(
"TEXT_TEST_TITLE", $this->lng->txt(
"title"));
182 $this->tpl->setVariable(
"TEXT_TEST_AUTHOR", $this->lng->txt(
"author"));
183 $this->tpl->setVariable(
"TEXT_TEST_LOCATION", $this->lng->txt(
"location"));
184 $this->tpl->setVariable(
"INSTANCES_TITLE", $this->lng->txt(
"question_instances_title"));
185 $this->tpl->parseCurrentBlock();
187 $this->tpl->setCurrentBlock(
"adm_content");
188 $this->tpl->setVariable(
"TXT_QUESTION_TITLE", $this->lng->txt(
"question_cumulated_statistics"));
189 $this->tpl->setVariable(
"TXT_RESULT", $this->lng->txt(
"result"));
190 $this->tpl->setVariable(
"TXT_VALUE", $this->lng->txt(
"value"));
191 $this->tpl->parseCurrentBlock();
205 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
206 if ((!$question_type) and ($question_id > 0))
210 if (strlen($question_type) == 0)
return NULL;
211 $question_type_gui = $question_type .
"GUI";
213 $question =&
new $question_type_gui();
214 if ($question_id > 0)
216 $question->object->loadFromDb($question_id);
223 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
224 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
232 return $q_type .
"GUI";
247 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
256 $this->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.il_as_qpl_content.html",
"Modules/TestQuestionPool");
257 $this->tpl->addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
258 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_question.html",
"Modules/TestQuestionPool");
269 include_once(
"./Services/COPage/classes/class.ilPageObject.php");
270 include_once(
"./Services/COPage/classes/class.ilPageObjectGUI.php");
274 $page_gui->setEnabledInternalLinks(
false);
275 $page_gui->setQuestionHTML(array($this->object->getId() => $html));
276 $page_gui->setFileDownloadLink(
"ilias.php?baseClass=ilObjTestGUI&cmd=downloadFile".
277 "&ref_id=".
$_GET[
"ref_id"]);
278 $page_gui->setFullscreenLink(
"ilias.php?baseClass=ilObjTestGUI&cmd=fullscreen".
279 "&ref_id=".
$_GET[
"ref_id"]);
280 $page_gui->setSourcecodeDownloadScript(
"ilias.php?baseClass=ilObjTestGUI&ref_id=".
$_GET[
"ref_id"]);
281 $page_gui->setEnabledPageFocus(
false);
282 $page_gui->setOutputMode(
"presentation");
283 $page_gui->setPresentationTitle(
"");
284 $presentation = $page_gui->presentation();
286 $presentation = preg_replace(
"/src=\".\\//ims",
"src=\"" . ILIAS_HTTP_PATH .
"/", $presentation);
287 return $presentation;
293 function outQuestionPage($a_temp_var, $a_postponed =
false, $active_id =
"", $html =
"")
298 $postponed =
" (" . $this->lng->txt(
"postponed") .
")";
301 include_once(
"./Services/COPage/classes/class.ilPageObject.php");
302 include_once(
"./Services/COPage/classes/class.ilPageObjectGUI.php");
303 $this->lng->loadLanguageModule(
"content");
307 $page_gui->setFileDownloadLink(
"ilias.php?baseClass=ilObjTestGUI&cmd=downloadFile".
308 "&ref_id=".
$_GET[
"ref_id"]);
309 $page_gui->setFullscreenLink(
"ilias.php?baseClass=ilObjTestGUI&cmd=fullscreen".
310 "&ref_id=".
$_GET[
"ref_id"]);
311 $page_gui->setEnabledPageFocus(
false);
314 $page_gui->setQuestionHTML(array($this->object->getId() => $html));
316 $page_gui->setSourcecodeDownloadScript(
"ilias.php?baseClass=ilObjTestGUI&ref_id=".
$_GET[
"ref_id"]);
317 $page_gui->setOutputMode(
"presentation");
319 include_once
"./Modules/Test/classes/class.ilObjTest.php";
321 switch ($title_output)
324 $page_gui->setPresentationTitle(sprintf($this->lng->txt(
"tst_position"), $this->
getSequenceNumber(), $this->
getQuestionCount()).
" - ".$this->object->getTitle().$postponed);
331 $maxpoints = $this->
object->getMaximumPoints();
334 $maxpoints =
" (".$maxpoints.
" ".$this->lng->txt(
"point").
")";
338 $maxpoints =
" (".$maxpoints.
" ".$this->lng->txt(
"points").
")";
340 $page_gui->setPresentationTitle(sprintf($this->lng->txt(
"tst_position"), $this->
getSequenceNumber(), $this->
getQuestionCount()).
" - ".$this->object->getTitle().$postponed.$maxpoints);
343 $presentation = $page_gui->presentation();
344 if (strlen($maxpoints)) $presentation = str_replace($maxpoints,
"<em>$maxpoints</em>", $presentation);
346 $presentation = preg_replace(
"/src=\".\\//ims",
"src=\"" . ILIAS_HTTP_PATH .
"/", $presentation);
347 return $presentation;
355 if (
$_GET[
"calling_test"])
367 if (
$_GET[
"q_id"] > 0)
369 $this->ctrl->setParameterByClass(
"ilpageobjectgui",
"q_id",
$_GET[
"q_id"]);
370 $this->ctrl->redirectByClass(
"ilpageobjectgui",
"edit");
374 $this->ctrl->redirectByClass(
"ilobjquestionpoolgui",
"questions");
381 if (strlen($return_to))
383 $this->ctrl->setParameter($this,
"return_to", $return_to);
385 $template =
new ilTemplate(
"tpl.il_as_qpl_sync_original.html",TRUE, TRUE,
"Modules/TestQuestionPool");
386 $template->setVariable(
"BUTTON_YES", $this->lng->txt(
"yes"));
387 $template->setVariable(
"BUTTON_NO", $this->lng->txt(
"no"));
388 $template->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
389 $template->setVariable(
"TEXT_SYNC", $this->lng->txt(
"confirm_sync_questions"));
390 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
395 $original_id = $this->
object->original_id;
398 $this->
object->syncWithOriginal();
400 if (strlen(
$_GET[
"return_to"]))
402 $this->ctrl->redirect($this,
$_GET[
"return_to"]);
413 if (strlen(
$_GET[
"return_to"]))
415 $this->ctrl->redirect($this,
$_GET[
"return_to"]);
435 $originalexists = $this->
object->_questionExistsInPool($this->object->original_id);
436 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
458 $ilUser->setPref(
"tst_lastquestiontype", $this->object->getQuestionType());
459 $ilUser->writePref(
"tst_lastquestiontype", $this->object->getQuestionType());
460 $this->
object->saveToDb();
461 $originalexists = $this->
object->_questionExists($this->object->original_id);
462 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
465 $this->ctrl->redirect($this,
"originalSyncForm");
475 include_once (
"./Modules/Test/classes/class.ilObjTest.php");
478 $test->insertQuestion($this->object->getId());
483 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
484 $this->editQuestion();
493 $this->ctrl->setParameterByClass(
"ilpageobjectgui",
"q_id", $this->object->getId());
494 $this->ctrl->redirectByClass(
"ilpageobjectgui",
"edit");
505 $old_id =
$_GET[
"q_id"];
509 $ilUser->setPref(
"tst_lastquestiontype", $this->object->getQuestionType());
510 $ilUser->writePref(
"tst_lastquestiontype", $this->object->getQuestionType());
511 $this->
object->saveToDb();
512 $originalexists = $this->
object->_questionExists($this->object->original_id);
513 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
516 $this->ctrl->redirect($this,
"originalSyncForm");
526 include_once (
"./Modules/Test/classes/class.ilObjTest.php");
529 $test->insertQuestion($this->object->getId());
534 if ($this->object->getId() != $old_id)
537 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"q_id", $this->object->getId());
538 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"sel_question_types",
$_GET[
"sel_question_types"]);
541 $this->ctrl->redirectByClass(
$_GET[
"cmdClass"],
"editQuestion");
551 $this->ctrl->redirect($this,
'editQuestion');
562 $this->
object->saveToDb();
563 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
564 $this->editQuestion();
577 $tmpPath = $cont_obj->getLMTree()->getPathFull($a_endnode_id, $a_startnode_id);
580 for ($i = 1; $i < (count($tmpPath) - 1); $i++)
587 $path .= $tmpPath[$i][
"title"];
595 $this->sequence_no = $nr;
605 $this->question_count = $a_question_count;
625 $this->errormessage .= ((strlen($this->errormessage)) ?
"<br />" :
"") .
$errormessage;
642 return $this->
object->getQuestionType();
655 if (strlen($a_value))
657 $result =
" value=\"$a_value\" ";
669 $cnt = $this->new_id_listener_cnt;
670 $this->new_id_listeners[$cnt][
"object"] =& $a_object;
671 $this->new_id_listeners[$cnt][
"method"] = $a_method;
672 $this->new_id_listeners[$cnt][
"parameters"] = $a_parameters;
673 $this->new_id_listener_cnt++;
682 for ($i=0; $i<$this->new_id_listener_cnt; $i++)
684 $this->new_id_listeners[$i][
"parameters"][
"new_id"] = $a_new_id;
685 $object =& $this->new_id_listeners[$i][
"object"];
686 $method = $this->new_id_listeners[$i][
"method"];
687 $parameters = $this->new_id_listeners[$i][
"parameters"];
703 $this->selfassessmenteditingmode = $a_selfassessmenteditingmode;
713 return $this->selfassessmenteditingmode;
723 $this->defaultnroftries = $a_defaultnroftries;
733 return $this->defaultnroftries;
741 $form->addCommandButton(
"save", $this->lng->txt(
"save"));
755 $title->setValue($this->object->getTitle());
756 $title->setRequired(TRUE);
762 $author =
new ilTextInputGUI($this->lng->txt(
"author"),
"author");
763 $author->
setValue($this->object->getAuthor());
764 $author->setRequired(TRUE);
765 $form->addItem($author);
768 $description =
new ilTextInputGUI($this->lng->txt(
"description"),
"comment");
769 $description->
setValue($this->object->getComment());
770 $description->setRequired(FALSE);
771 $form->addItem($description);
778 if (trim($author) ==
"")
782 $hi->setValue($author);
789 $question->
setValue($this->object->prepareTextareaOutput($this->object->getQuestion()));
790 $question->setRequired(TRUE);
791 $question->setRows(10);
792 $question->setCols(80);
795 $question->setUseRte(TRUE);
796 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
798 $question->addPlugin(
"latex");
799 $question->addButton(
"latex");
800 $question->addButton(
"pastelatex");
801 $question->setRTESupport($this->object->getId(),
"qpl",
"assessment");
803 $form->addItem($question);
810 $duration->setShowMinutes(TRUE);
811 $duration->setShowSeconds(TRUE);
812 $ewt = $this->
object->getEstimatedWorkingTime();
813 $duration->setHours($ewt[
"h"]);
814 $duration->setMinutes($ewt[
"m"]);
815 $duration->setSeconds($ewt[
"s"]);
816 $duration->setRequired(FALSE);
817 $form->addItem($duration);
822 if (strlen($this->object->getNrOfTries()))
824 $nr_tries = $this->
object->getNrOfTries();
834 $ni =
new ilNumberInputGUI($this->lng->txt(
"qst_nr_of_tries"),
"nr_of_tries");
838 $ni->setMaxLength(5);
839 $ni->setRequired(
true);
857 include_once
"./Modules/Test/classes/class.ilObjTest.php";
859 if (strlen($manual_feedback))
861 return $manual_feedback;
863 $correct_feedback = $this->
object->getFeedbackGeneric(1);
864 $incorrect_feedback = $this->
object->getFeedbackGeneric(0);
865 if (strlen($correct_feedback.$incorrect_feedback))
867 $reached_points = $this->
object->calculateReachedPoints($active_id,
$pass);
868 $max_points = $this->
object->getMaximumPoints();
869 if ($reached_points == $max_points)
871 $output = $correct_feedback;
875 $output = $incorrect_feedback;
878 return $this->
object->prepareTextareaOutput($output, TRUE);
888 $save = (strcmp($this->ctrl->getCmd(),
"saveFeedback") == 0) ? TRUE : FALSE;
889 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
891 $form->setFormAction($this->ctrl->getFormAction($this));
892 $form->setTitle($this->lng->txt(
'feedback_answers'));
893 $form->setTableWidth(
"100%");
894 $form->setId(
"feedback");
896 $complete =
new ilTextAreaInputGUI($this->lng->txt(
"feedback_complete_solution"),
"feedback_complete");
897 $complete->
setValue($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(1)));
898 $complete->setRequired(
false);
899 $complete->setRows(10);
900 $complete->setCols(80);
901 $complete->setUseRte(
true);
902 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
904 $complete->addPlugin(
"latex");
905 $complete->addButton(
"latex");
906 $complete->addButton(
"pastelatex");
907 $complete->setRTESupport($this->object->getId(),
"qpl",
"assessment");
908 $form->addItem($complete);
910 $incomplete =
new ilTextAreaInputGUI($this->lng->txt(
"feedback_incomplete_solution"),
"feedback_incomplete");
911 $incomplete->
setValue($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(0)));
912 $incomplete->setRequired(
false);
913 $incomplete->setRows(10);
914 $incomplete->setCols(80);
915 $incomplete->setUseRte(
true);
916 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
918 $incomplete->addPlugin(
"latex");
919 $incomplete->addButton(
"latex");
920 $incomplete->addButton(
"pastelatex");
921 $incomplete->setRTESupport($this->object->getId(),
"qpl",
"assessment");
922 $form->addItem($incomplete);
924 $form->addCommandButton(
"saveFeedback", $this->lng->txt(
"save"));
927 $form->setValuesByPost();
928 $errors = !$form->checkInput();
929 $form->setValuesByPost();
931 if (!$checkonly) $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
937 include_once
"./classes/class.ilTemplate.php";
938 $template =
new ilTemplate(
"tpl.il_as_qpl_questiontype.html", TRUE, TRUE,
"Modules/TestQuestionPool");
939 $count = $this->
object->isInUse();
943 if ($rbacsystem->checkAccess(
"write",
$_GET[
"ref_id"]))
945 $template->setCurrentBlock(
"infosign");
947 $template->setVariable(
"INFO_IMG_ALT", sprintf($this->lng->txt(
"qpl_question_is_in_use"), $count));
948 $template->setVariable(
"INFO_IMG_TITLE", sprintf($this->lng->txt(
"qpl_question_is_in_use"), $count));
949 $template->parseCurrentBlock();
953 return $template->get();
965 if (
$_POST[
"deleteSuggestedSolution"] == 1)
967 $this->
object->deleteSuggestedSolutions();
969 $this->ctrl->redirect($this,
"suggestedsolution");
972 $save = (is_array(
$_POST[
"cmd"]) && array_key_exists(
"suggestedsolution",
$_POST[
"cmd"])) ? TRUE : FALSE;
974 $solution_array = $this->
object->getSuggestedSolution(0);
976 "lm" => $this->lng->txt(
"obj_lm"),
977 "st" => $this->lng->txt(
"obj_st"),
978 "pg" => $this->lng->txt(
"obj_pg"),
979 "git" => $this->lng->txt(
"glossary_term"),
980 "file" => $this->lng->txt(
"fileDownload"),
981 "text" => $this->lng->txt(
"solutionText")
984 if ((strcmp(
$_POST[
"solutiontype"],
"file") == 0) && (strcmp($solution_array[
"type"],
"file") != 0))
986 $solution_array = array(
990 elseif ((strcmp(
$_POST[
"solutiontype"],
"text") == 0) && (strcmp($solution_array[
"type"],
"text") != 0))
992 $solution_array = array(
994 "value" => $this->getSolutionOutput(0, NULL, FALSE, FALSE, TRUE, FALSE, TRUE)
997 if ($save && strlen(
$_POST[
"filename"]))
999 $solution_array[
"value"][
"filename"] =
$_POST[
"filename"];
1001 if ($save && strlen(
$_POST[
"solutiontext"]))
1003 $solution_array[
"value"] =
$_POST[
"solutiontext"];
1005 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1006 if (count($solution_array))
1009 $form->setFormAction($this->ctrl->getFormAction($this));
1010 $form->setTitle($this->lng->txt(
"solution_hint"));
1011 $form->setMultipart(TRUE);
1012 $form->setTableWidth(
"100%");
1013 $form->setId(
"suggestedsolutiondisplay");
1016 include_once
"./Modules/TestQuestionPool/classes/class.ilSolutionTitleInputGUI.php";
1018 $template =
new ilTemplate(
"tpl.il_as_qpl_suggested_solution_input_presentation.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1019 if (strlen($solution_array[
"internal_link"]))
1022 $template->setCurrentBlock(
"preview");
1023 $template->setVariable(
"TEXT_SOLUTION", $this->lng->txt(
"solution_hint"));
1024 $template->setVariable(
"VALUE_SOLUTION",
" <a href=\"$href\" target=\"content\">" . $this->lng->txt(
"view").
"</a> ");
1025 $template->parseCurrentBlock();
1027 elseif ((strcmp($solution_array[
"type"],
"file") == 0) && (is_array($solution_array[
"value"])))
1029 $href = $this->
object->getSuggestedSolutionPathWeb() . $solution_array[
"value"][
"name"];
1030 $template->setCurrentBlock(
"preview");
1031 $template->setVariable(
"TEXT_SOLUTION", $this->lng->txt(
"solution_hint"));
1032 $template->setVariable(
"VALUE_SOLUTION",
" <a href=\"$href\" target=\"content\">" .
ilUtil::prepareFormOutput((strlen($solution_array[
"value"][
"filename"])) ? $solution_array[
"value"][
"filename"] : $solution_array[
"value"][
"name"]).
"</a> ");
1033 $template->parseCurrentBlock();
1035 $template->setVariable(
"TEXT_TYPE", $this->lng->txt(
"type"));
1036 $template->setVariable(
"VALUE_TYPE", $options[$solution_array[
"type"]]);
1037 $title->setHtml($template->get());
1039 $deletesolution->setOptionTitle($this->lng->txt(
"deleteSuggestedSolution"));
1040 $title->addSubItem($deletesolution);
1043 if (strcmp($solution_array[
"type"],
"file") == 0)
1047 $file->setRequired(TRUE);
1048 $file->enableFileNameSelection(
"filename");
1050 if ($_FILES[
"file"][
"tmp_name"])
1052 if (!file_exists($this->object->getSuggestedSolutionPath()))
ilUtil::makeDirParents($this->object->getSuggestedSolutionPath());
1053 $res =
ilUtil::moveUploadedFile($_FILES[
"file"][
"tmp_name"], $_FILES[
"file"][
"name"], $this->object->getSuggestedSolutionPath() . $_FILES[
"file"][
"name"]);
1057 if (is_array($solution_array[
"value"])) @unlink($this->object->getSuggestedSolutionPath() . $solution_array[
"value"][
"name"]);
1058 $file->setValue($_FILES[
"file"][
"name"]);
1059 $this->
object->saveSuggestedSolution(
"file",
"", 0, array(
"name" => $_FILES[
"file"][
"name"],
"type" => $_FILES[
"file"][
"type"],
"size" => $_FILES[
"file"][
"size"],
"filename" =>
$_POST[
"filename"]));
1060 $originalexists = $this->
object->_questionExistsInPool($this->object->original_id);
1068 $this->ctrl->redirect($this,
"suggestedsolution");
1078 if (is_array($solution_array[
"value"]))
1080 $file->setValue($solution_array[
"value"][
"name"]);
1081 $file->setFilename((strlen($solution_array[
"value"][
"filename"])) ? $solution_array[
"value"][
"filename"] : $solution_array[
"value"][
"name"]);
1084 $form->addItem(
$file);
1086 $hidden->setValue(
"file");
1087 $form->addItem($hidden);
1089 else if (strcmp($solution_array[
"type"],
"text") == 0)
1092 $question->
setValue($this->object->prepareTextareaOutput($solution_array[
"value"]));
1093 $question->setRequired(TRUE);
1094 $question->setRows(10);
1095 $question->setCols(80);
1096 $question->setUseRte(TRUE);
1097 $question->addPlugin(
"latex");
1098 $question->addButton(
"latex");
1099 $question->setRTESupport($this->object->getId(),
"qpl",
"assessment");
1101 $hidden->setValue(
"text");
1102 $form->addItem($hidden);
1103 $form->addItem($question);
1105 $form->addCommandButton(
"suggestedsolution", $this->lng->txt(
"save"));
1108 if ($form->checkInput())
1110 switch ($solution_array[
"type"])
1113 $this->
object->saveSuggestedSolution(
"file",
"", 0, array(
"name" => $solution_array[
"value"][
"name"],
"type" => $solution_array[
"value"][
"type"],
"size" => $solution_array[
"value"][
"size"],
"filename" =>
$_POST[
"filename"]));
1116 $this->
object->saveSuggestedSolution(
"text",
"", 0, $solution_array[
"value"]);
1119 $originalexists = $this->
object->_questionExistsInPool($this->object->original_id);
1127 $this->ctrl->redirect($this,
"suggestedsolution");
1131 $output = $form->getHTML();
1134 $savechange = (strcmp($this->ctrl->getCmd(),
"saveSuggestedSolution") == 0) ? TRUE : FALSE;
1137 $formchange->setFormAction($this->ctrl->getFormAction($this));
1138 $formchange->setTitle((count($solution_array)) ? $this->lng->txt(
"changeSuggestedSolution") : $this->lng->txt(
"addSuggestedSolution"));
1139 $formchange->setMultipart(FALSE);
1140 $formchange->setTableWidth(
"100%");
1141 $formchange->setId(
"suggestedsolution");
1143 $solutiontype =
new ilRadioMatrixInputGUI($this->lng->txt(
"suggestedSolutionType"),
"solutiontype");
1145 if (count($solution_array))
1147 $solutiontype->setValue($solution_array[
"type"]);
1149 $solutiontype->setRequired(TRUE);
1150 $formchange->addItem($solutiontype);
1152 $formchange->addCommandButton(
"saveSuggestedSolution", $this->lng->txt(
"select"));
1156 $formchange->checkInput();
1159 $this->tpl->setVariable(
"ADM_CONTENT", $formchange->getHTML() . $output);
1166 include_once(
"./Modules/TestQuestionPool/classes/class.ilSolutionExplorer.php");
1168 $search =
$_GET[
"search_link_type"];
1169 $this->ctrl->setParameter($this,
"link_new_type",
$type);
1170 $this->ctrl->setParameter($this,
"search_link_type", $search);
1171 $this->ctrl->saveParameter($this, array(
"subquestion_index",
"link_new_type",
"search_link_type"));
1175 $exp =
new ilSolutionExplorer($this->ctrl->getLinkTarget($this,
'suggestedsolution'), get_class($this));
1178 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,
'outSolutionExplorer'));
1179 $exp->setTargetGet(
"ref_id");
1180 $exp->setRefId(
$_GET[
"ref_id"]);
1181 $exp->addFilter(
$type);
1182 $exp->setSelectableType(
$type);
1187 $template =
new ilTemplate(
"tpl.il_as_qpl_explorer.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1188 $template->setVariable(
"EXPLORER_TREE",$exp->getOutput());
1189 $template->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
1190 $template->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this,
"suggestedsolution"));
1191 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
1198 include_once(
"./Modules/TestQuestionPool/classes/class.ilSolutionExplorer.php");
1199 switch (
$_POST[
"solutiontype"])
1225 $this->ctrl->setParameter($this,
"link_new_type",
$type);
1226 $this->ctrl->setParameter($this,
"search_link_type", $search);
1227 $this->ctrl->redirect($this,
"outSolutionExplorer");
1232 $this->ctrl->redirect($this,
"suggestedsolution");
1237 include_once
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
1238 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1240 $cont_obj = $cont_obj_gui->object;
1242 $shownpages = array();
1243 $tree = $cont_obj->getLMTree();
1244 $chapters = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
1245 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
1246 $color_class = array(
"tblrow1",
"tblrow2");
1248 $template =
new ilTemplate(
"tpl.il_as_qpl_internallink_selection.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1249 foreach ($chapters as $chapter)
1251 $chapterpages = $tree->getChildsByType($chapter[
"obj_id"],
"pg");
1252 foreach ($chapterpages as $page)
1254 if($page[
"type"] ==
$_GET[
"search_link_type"])
1256 array_push($shownpages, $page[
"obj_id"]);
1257 $template->setCurrentBlock(
"linktable_row");
1258 $template->setVariable(
"TEXT_LINK", $page[
"title"]);
1259 $template->setVariable(
"TEXT_ADD", $this->lng->txt(
"add"));
1260 $template->setVariable(
"LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this),
"add" . strtoupper($page[
"type"])) .
"&" . $page[
"type"] .
"=" . $page[
"obj_id"]);
1261 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
1262 if ($tree->isInTree($page[
"obj_id"]))
1271 $template->parseCurrentBlock();
1276 foreach ($pages as $page)
1278 if (!in_array($page[
"obj_id"], $shownpages))
1280 $template->setCurrentBlock(
"linktable_row");
1281 $template->setVariable(
"TEXT_LINK", $page[
"title"]);
1282 $template->setVariable(
"TEXT_ADD", $this->lng->txt(
"add"));
1283 $template->setVariable(
"LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this),
"add" . strtoupper($page[
"type"])) .
"&" . $page[
"type"] .
"=" . $page[
"obj_id"]);
1284 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
1287 $template->parseCurrentBlock();
1291 $template->setCurrentBlock(
"link_selection");
1292 $template->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
1293 $template->setVariable(
"TEXT_LINK_TYPE", $this->lng->txt(
"obj_" .
$_GET[
"search_link_type"]));
1294 $template->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this,
"cancelExplorer"));
1295 $template->parseCurrentBlock();
1296 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
1301 $template =
new ilTemplate(
"tpl.il_as_qpl_internallink_selection.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1302 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
1303 $color_class = array(
"tblrow1",
"tblrow2");
1305 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1307 $cont_obj = $cont_obj_gui->object;
1309 $ctree =& $cont_obj->getLMTree();
1310 $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
1311 foreach($nodes as $node)
1313 if($node[
"type"] ==
$_GET[
"search_link_type"])
1315 $template->setCurrentBlock(
"linktable_row");
1316 $template->setVariable(
"TEXT_LINK", $node[
"title"]);
1317 $template->setVariable(
"TEXT_ADD", $this->lng->txt(
"add"));
1318 $template->setVariable(
"LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this),
"add" . strtoupper($node[
"type"])) .
"&" . $node[
"type"] .
"=" . $node[
"obj_id"]);
1319 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
1320 $template->parseCurrentBlock();
1324 $template->setCurrentBlock(
"link_selection");
1325 $template->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
1326 $template->setVariable(
"TEXT_LINK_TYPE", $this->lng->txt(
"obj_" .
$_GET[
"search_link_type"]));
1327 $template->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this,
"cancelExplorer"));
1328 $template->parseCurrentBlock();
1329 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
1334 $template =
new ilTemplate(
"tpl.il_as_qpl_internallink_selection.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1335 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
1336 $color_class = array(
"tblrow1",
"tblrow2");
1338 include_once
"./Modules/Glossary/classes/class.ilObjGlossary.php";
1341 $terms = $glossary->getTermList();
1342 foreach($terms as $term)
1344 $template->setCurrentBlock(
"linktable_row");
1345 $template->setVariable(
"TEXT_LINK", $term[
"term"]);
1346 $template->setVariable(
"TEXT_ADD", $this->lng->txt(
"add"));
1347 $template->setVariable(
"LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this),
"addGIT") .
"&git=" . $term[
"id"]);
1348 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
1349 $template->parseCurrentBlock();
1352 $template->setCurrentBlock(
"link_selection");
1353 $template->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
1354 $template->setVariable(
"TEXT_LINK_TYPE", $this->lng->txt(
"glossary_term"));
1355 $template->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this,
"cancelExplorer"));
1356 $template->parseCurrentBlock();
1357 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
1362 $this->ctrl->saveParameter($this, array(
"subquestion_index",
"link_new_type",
"search_link_type"));
1363 switch (
$_GET[
"search_link_type"])
1375 $subquestion_index = (
$_GET[
"subquestion_index"] > 0) ?
$_GET[
"subquestion_index"] : 0;
1376 $this->
object->saveSuggestedSolution(
"lm",
"il__lm_" .
$_GET[
"source_id"], $subquestion_index);
1378 $this->ctrl->redirect($this,
"suggestedsolution");
1385 $subquestion_index = 0;
1386 if (strlen(
$_GET[
"subquestion_index"]) &&
$_GET[
"subquestion_index"] >= 0)
1388 $subquestion_index =
$_GET[
"subquestion_index"];
1390 $this->
object->saveSuggestedSolution(
"pg",
"il__pg_" .
$_GET[
"pg"], $subquestion_index);
1392 $this->ctrl->redirect($this,
"suggestedsolution");
1397 $subquestion_index = 0;
1398 if (strlen(
$_GET[
"subquestion_index"]) &&
$_GET[
"subquestion_index"] >= 0)
1400 $subquestion_index =
$_GET[
"subquestion_index"];
1402 $this->
object->saveSuggestedSolution(
"st",
"il__st_" .
$_GET[
"st"], $subquestion_index);
1404 $this->ctrl->redirect($this,
"suggestedsolution");
1409 $subquestion_index = 0;
1410 if (strlen(
$_GET[
"subquestion_index"]) &&
$_GET[
"subquestion_index"] >= 0)
1412 $subquestion_index =
$_GET[
"subquestion_index"];
1414 $this->
object->saveSuggestedSolution(
"git",
"il__git_" .
$_GET[
"git"], $subquestion_index);
1416 $this->ctrl->redirect($this,
"suggestedsolution");