24 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
77 $this->ctrl->saveParameter($this,
"q_id");
79 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
80 $this->errormessage = $this->lng->txt(
"fill_out_all_required_fields");
82 $this->selfassessmenteditingmode =
false;
83 $this->new_id_listeners = array();
84 $this->new_id_listener_cnt = 0;
92 $cmd = $this->ctrl->getCmd(
"editQuestion");
93 $next_class = $this->ctrl->getNextClass($this);
134 $this->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.il_as_qpl_content.html",
"Modules/TestQuestionPool");
135 $this->tpl->addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
137 $total_of_answers = $this->
object->getTotalAnswers();
139 $color_class = array(
"tblrow1",
"tblrow2");
140 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_qpl_assessment_of_questions.html",
"Modules/TestQuestionPool");
141 if (!$total_of_answers)
143 $this->tpl->setCurrentBlock(
"emptyrow");
144 $this->tpl->setVariable(
"TXT_NO_ASSESSMENT", $this->lng->txt(
"qpl_assessment_no_assessment_of_questions"));
145 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
146 $this->tpl->parseCurrentBlock();
150 $this->tpl->setCurrentBlock(
"row");
151 $this->tpl->setVariable(
"TXT_RESULT", $this->lng->txt(
"qpl_assessment_total_of_answers"));
152 $this->tpl->setVariable(
"TXT_VALUE", $total_of_answers);
153 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
155 $this->tpl->parseCurrentBlock();
156 $this->tpl->setCurrentBlock(
"row");
157 $this->tpl->setVariable(
"TXT_RESULT", $this->lng->txt(
"qpl_assessment_total_of_right_answers"));
158 $this->tpl->setVariable(
"TXT_VALUE", sprintf(
"%2.2f", $this->object->_getTotalRightAnswers(
$_GET[
"q_id"]) * 100.0) .
" %");
159 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
160 $this->tpl->parseCurrentBlock();
163 $instances =& $this->
object->getInstances();
165 foreach ($instances as $instance)
167 if (is_array($instance[
"refs"]))
169 foreach ($instance[
"refs"] as
$ref_id)
171 $this->tpl->setCurrentBlock(
"references");
172 $this->tpl->setVariable(
"GOTO",
"./goto.php?target=tst_" . $ref_id);
173 $this->tpl->setVariable(
"TEXT_GOTO", $this->lng->txt(
"perma_link"));
174 $this->tpl->parseCurrentBlock();
177 $this->tpl->setCurrentBlock(
"instance_row");
178 $this->tpl->setVariable(
"TEST_TITLE", $instance[
"title"]);
179 $this->tpl->setVariable(
"TEST_AUTHOR", $instance[
"author"]);
180 $this->tpl->setVariable(
"QUESTION_ID", $instance[
"question_id"]);
181 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
183 $this->tpl->parseCurrentBlock();
185 $this->tpl->setCurrentBlock(
"instances");
186 $this->tpl->setVariable(
"TEXT_TEST_TITLE", $this->lng->txt(
"title"));
187 $this->tpl->setVariable(
"TEXT_TEST_AUTHOR", $this->lng->txt(
"author"));
188 $this->tpl->setVariable(
"TEXT_TEST_LOCATION", $this->lng->txt(
"location"));
189 $this->tpl->setVariable(
"INSTANCES_TITLE", $this->lng->txt(
"question_instances_title"));
190 $this->tpl->parseCurrentBlock();
192 $this->tpl->setCurrentBlock(
"adm_content");
193 $this->tpl->setVariable(
"TXT_QUESTION_TITLE", $this->lng->txt(
"question_cumulated_statistics"));
194 $this->tpl->setVariable(
"TXT_RESULT", $this->lng->txt(
"result"));
195 $this->tpl->setVariable(
"TXT_VALUE", $this->lng->txt(
"value"));
196 $this->tpl->parseCurrentBlock();
210 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
211 if ((!$question_type) and ($question_id > 0))
215 if (strlen($question_type) == 0)
return NULL;
216 $question_type_gui = $question_type .
"GUI";
218 $question =&
new $question_type_gui();
219 if ($question_id > 0)
221 $question->object->loadFromDb($question_id);
228 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
229 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
237 return $q_type .
"GUI";
252 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
261 $this->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.il_as_qpl_content.html",
"Modules/TestQuestionPool");
262 $this->tpl->addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
263 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_question.html",
"Modules/TestQuestionPool");
274 include_once(
"./Services/COPage/classes/class.ilPageObject.php");
275 include_once(
"./Services/COPage/classes/class.ilPageObjectGUI.php");
279 $page_gui->setEnabledInternalLinks(
false);
280 $page_gui->setQuestionHTML(array($this->object->getId() => $html));
281 $page_gui->setFileDownloadLink(
"ilias.php?baseClass=ilObjTestGUI&cmd=downloadFile".
282 "&ref_id=".
$_GET[
"ref_id"]);
283 $page_gui->setFullscreenLink(
"ilias.php?baseClass=ilObjTestGUI&cmd=fullscreen".
284 "&ref_id=".
$_GET[
"ref_id"]);
285 $page_gui->setSourcecodeDownloadScript(
"ilias.php?baseClass=ilObjTestGUI&ref_id=".
$_GET[
"ref_id"]);
286 $page_gui->setEnabledPageFocus(
false);
287 $page_gui->setOutputMode(
"presentation");
288 $page_gui->setPresentationTitle(
"");
289 $presentation = $page_gui->presentation();
291 $presentation = preg_replace(
"/src=\".\\//ims",
"src=\"" . ILIAS_HTTP_PATH .
"/", $presentation);
292 return $presentation;
298 function outQuestionPage($a_temp_var, $a_postponed =
false, $active_id =
"", $html =
"")
303 $postponed =
" (" . $this->lng->txt(
"postponed") .
")";
306 include_once(
"./Services/COPage/classes/class.ilPageObject.php");
307 include_once(
"./Services/COPage/classes/class.ilPageObjectGUI.php");
308 $this->lng->loadLanguageModule(
"content");
312 $page_gui->setFileDownloadLink(
"ilias.php?baseClass=ilObjTestGUI&cmd=downloadFile".
313 "&ref_id=".
$_GET[
"ref_id"]);
314 $page_gui->setFullscreenLink(
"ilias.php?baseClass=ilObjTestGUI&cmd=fullscreen".
315 "&ref_id=".
$_GET[
"ref_id"]);
316 $page_gui->setEnabledPageFocus(
false);
319 $page_gui->setQuestionHTML(array($this->object->getId() => $html));
321 $page_gui->setSourcecodeDownloadScript(
"ilias.php?baseClass=ilObjTestGUI&ref_id=".
$_GET[
"ref_id"]);
322 $page_gui->setOutputMode(
"presentation");
324 include_once
"./Modules/Test/classes/class.ilObjTest.php";
326 switch ($title_output)
329 $page_gui->setPresentationTitle(sprintf($this->lng->txt(
"tst_position"), $this->
getSequenceNumber(), $this->
getQuestionCount()).
" - ".$this->object->getTitle().$postponed);
336 $maxpoints = $this->
object->getMaximumPoints();
339 $maxpoints =
" (".$maxpoints.
" ".$this->lng->txt(
"point").
")";
343 $maxpoints =
" (".$maxpoints.
" ".$this->lng->txt(
"points").
")";
345 $page_gui->setPresentationTitle(sprintf($this->lng->txt(
"tst_position"), $this->
getSequenceNumber(), $this->
getQuestionCount()).
" - ".$this->object->getTitle().$postponed.$maxpoints);
348 $presentation = $page_gui->presentation();
349 if (strlen($maxpoints)) $presentation = str_replace($maxpoints,
"<em>$maxpoints</em>", $presentation);
351 $presentation = preg_replace(
"/src=\".\\//ims",
"src=\"" . ILIAS_HTTP_PATH .
"/", $presentation);
352 return $presentation;
360 if (
$_GET[
"calling_test"])
365 elseif (
$_GET[
"test_ref_id"])
372 if (
$_GET[
"q_id"] > 0)
374 $this->ctrl->setParameterByClass(
"ilpageobjectgui",
"q_id",
$_GET[
"q_id"]);
375 $this->ctrl->redirectByClass(
"ilpageobjectgui",
"edit");
379 $this->ctrl->redirectByClass(
"ilobjquestionpoolgui",
"questions");
386 if (strlen($return_to))
388 $this->ctrl->setParameter($this,
"return_to", $return_to);
390 $template =
new ilTemplate(
"tpl.il_as_qpl_sync_original.html",TRUE, TRUE,
"Modules/TestQuestionPool");
391 $template->setVariable(
"BUTTON_YES", $this->lng->txt(
"yes"));
392 $template->setVariable(
"BUTTON_NO", $this->lng->txt(
"no"));
393 $template->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
394 $template->setVariable(
"TEXT_SYNC", $this->lng->txt(
"confirm_sync_questions"));
395 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
400 $original_id = $this->
object->original_id;
403 $this->
object->syncWithOriginal();
405 if (strlen(
$_GET[
"return_to"]))
407 $this->ctrl->redirect($this,
$_GET[
"return_to"]);
418 if (strlen(
$_GET[
"return_to"]))
420 $this->ctrl->redirect($this,
$_GET[
"return_to"]);
440 $originalexists = $this->
object->_questionExists($this->object->original_id);
441 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
463 $ilUser->setPref(
"tst_lastquestiontype", $this->object->getQuestionType());
464 $ilUser->writePref(
"tst_lastquestiontype", $this->object->getQuestionType());
465 $this->
object->saveToDb();
466 $originalexists = $this->
object->_questionExists($this->object->original_id);
467 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
470 $this->ctrl->redirect($this,
"originalSyncForm");
472 elseif (
$_GET[
"calling_test"])
478 elseif (
$_GET[
"test_ref_id"])
480 include_once (
"./Modules/Test/classes/class.ilObjTest.php");
483 $test->insertQuestion($this->object->getId());
488 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
489 $this->editQuestion();
498 $this->ctrl->setParameterByClass(
"ilpageobjectgui",
"q_id", $this->object->getId());
499 $this->ctrl->redirectByClass(
"ilpageobjectgui",
"edit");
510 $old_id =
$_GET[
"q_id"];
514 $ilUser->setPref(
"tst_lastquestiontype", $this->object->getQuestionType());
515 $ilUser->writePref(
"tst_lastquestiontype", $this->object->getQuestionType());
516 $this->
object->saveToDb();
517 $originalexists = $this->
object->_questionExists($this->object->original_id);
518 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
521 $this->ctrl->redirect($this,
"originalSyncForm");
523 elseif (
$_GET[
"calling_test"])
529 elseif (
$_GET[
"test_ref_id"])
531 include_once (
"./Modules/Test/classes/class.ilObjTest.php");
534 $test->insertQuestion($this->object->getId());
539 if ($this->object->getId() != $old_id)
542 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"q_id", $this->object->getId());
543 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"sel_question_types",
$_GET[
"sel_question_types"]);
546 $this->ctrl->redirectByClass(
$_GET[
"cmdClass"],
"editQuestion");
556 $this->ctrl->redirect($this,
'editQuestion');
567 $this->
object->saveToDb();
568 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
569 $this->editQuestion();
582 $tmpPath = $cont_obj->getLMTree()->getPathFull($a_endnode_id, $a_startnode_id);
585 for ($i = 1; $i < (count($tmpPath) - 1); $i++)
592 $path .= $tmpPath[$i][
"title"];
600 $this->sequence_no = $nr;
610 $this->question_count = $a_question_count;
630 $this->errormessage .= ((strlen($this->errormessage)) ?
"<br />" :
"") .
$errormessage;
647 return $this->
object->getQuestionType();
660 if (strlen($a_value))
662 $result =
" value=\"$a_value\" ";
674 $cnt = $this->new_id_listener_cnt;
675 $this->new_id_listeners[$cnt][
"object"] =& $a_object;
676 $this->new_id_listeners[$cnt][
"method"] = $a_method;
677 $this->new_id_listeners[$cnt][
"parameters"] = $a_parameters;
678 $this->new_id_listener_cnt++;
687 for ($i=0; $i<$this->new_id_listener_cnt; $i++)
689 $this->new_id_listeners[$i][
"parameters"][
"new_id"] = $a_new_id;
690 $object =& $this->new_id_listeners[$i][
"object"];
691 $method = $this->new_id_listeners[$i][
"method"];
692 $parameters = $this->new_id_listeners[$i][
"parameters"];
708 $this->selfassessmenteditingmode = $a_selfassessmenteditingmode;
718 return $this->selfassessmenteditingmode;
728 $this->prevent_rte_usage = $a_val;
748 $this->defaultnroftries = $a_defaultnroftries;
758 return $this->defaultnroftries;
766 $form->addCommandButton(
"save", $this->lng->txt(
"save"));
780 $title->setValue($this->object->getTitle());
781 $title->setRequired(TRUE);
787 $author =
new ilTextInputGUI($this->lng->txt(
"author"),
"author");
788 $author->
setValue($this->object->getAuthor());
789 $author->setRequired(TRUE);
790 $form->addItem($author);
793 $description =
new ilTextInputGUI($this->lng->txt(
"description"),
"comment");
794 $description->
setValue($this->object->getComment());
795 $description->setRequired(FALSE);
796 $form->addItem($description);
803 if (trim($author) ==
"")
807 $hi->setValue($author);
814 $question->
setValue($this->object->prepareTextareaOutput($this->object->getQuestion()));
815 $question->setRequired(TRUE);
816 $question->setRows(10);
817 $question->setCols(80);
820 $question->setUseRte(TRUE);
821 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
823 $question->addPlugin(
"latex");
824 $question->addButton(
"latex");
825 $question->addButton(
"pastelatex");
826 $question->setRTESupport($this->object->getId(),
"qpl",
"assessment");
828 $form->addItem($question);
835 $duration->setShowMinutes(TRUE);
836 $duration->setShowSeconds(TRUE);
837 $ewt = $this->
object->getEstimatedWorkingTime();
838 $duration->setHours($ewt[
"h"]);
839 $duration->setMinutes($ewt[
"m"]);
840 $duration->setSeconds($ewt[
"s"]);
841 $duration->setRequired(FALSE);
842 $form->addItem($duration);
847 if (strlen($this->object->getNrOfTries()))
849 $nr_tries = $this->
object->getNrOfTries();
859 $ni =
new ilNumberInputGUI($this->lng->txt(
"qst_nr_of_tries"),
"nr_of_tries");
863 $ni->setMaxLength(5);
864 $ni->setRequired(
true);
882 include_once
"./Modules/Test/classes/class.ilObjTest.php";
884 if (strlen($manual_feedback))
886 return $manual_feedback;
888 $correct_feedback = $this->
object->getFeedbackGeneric(1);
889 $incorrect_feedback = $this->
object->getFeedbackGeneric(0);
890 if (strlen($correct_feedback.$incorrect_feedback))
892 $reached_points = $this->
object->calculateReachedPoints($active_id,
$pass);
893 $max_points = $this->
object->getMaximumPoints();
894 if ($reached_points == $max_points)
896 $output = $correct_feedback;
900 $output = $incorrect_feedback;
903 return $this->
object->prepareTextareaOutput($output, TRUE);
913 $save = (strcmp($this->ctrl->getCmd(),
"saveFeedback") == 0) ? TRUE : FALSE;
914 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
916 $form->setFormAction($this->ctrl->getFormAction($this));
917 $form->setTitle($this->lng->txt(
'feedback_answers'));
918 $form->setTableWidth(
"100%");
919 $form->setId(
"feedback");
921 $complete =
new ilTextAreaInputGUI($this->lng->txt(
"feedback_complete_solution"),
"feedback_complete");
922 $complete->
setValue($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(1)));
923 $complete->setRequired(
false);
924 $complete->setRows(10);
925 $complete->setCols(80);
928 $complete->setUseRte(
true);
930 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
932 $complete->addPlugin(
"latex");
933 $complete->addButton(
"latex");
934 $complete->addButton(
"pastelatex");
935 $complete->setRTESupport($this->object->getId(),
"qpl",
"assessment");
936 $form->addItem($complete);
938 $incomplete =
new ilTextAreaInputGUI($this->lng->txt(
"feedback_incomplete_solution"),
"feedback_incomplete");
939 $incomplete->
setValue($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(0)));
940 $incomplete->setRequired(
false);
941 $incomplete->setRows(10);
942 $incomplete->setCols(80);
945 $incomplete->setUseRte(
true);
947 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
949 $incomplete->addPlugin(
"latex");
950 $incomplete->addButton(
"latex");
951 $incomplete->addButton(
"pastelatex");
952 $incomplete->setRTESupport($this->object->getId(),
"qpl",
"assessment");
953 $form->addItem($incomplete);
958 $form->addCommandButton(
"saveFeedback", $this->lng->txt(
"save"));
963 $form->setValuesByPost();
964 $errors = !$form->checkInput();
965 $form->setValuesByPost();
967 if (!$checkonly) $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
973 include_once
"./classes/class.ilTemplate.php";
974 $template =
new ilTemplate(
"tpl.il_as_qpl_questiontype.html", TRUE, TRUE,
"Modules/TestQuestionPool");
975 $count = $this->
object->isInUse();
979 if ($rbacsystem->checkAccess(
"write",
$_GET[
"ref_id"]))
981 $template->setCurrentBlock(
"infosign");
983 $template->setVariable(
"INFO_IMG_ALT", sprintf($this->lng->txt(
"qpl_question_is_in_use"), $count));
984 $template->setVariable(
"INFO_IMG_TITLE", sprintf($this->lng->txt(
"qpl_question_is_in_use"), $count));
985 $template->parseCurrentBlock();
989 return $template->get();
1002 if (
$_POST[
"deleteSuggestedSolution"] == 1)
1004 $this->
object->deleteSuggestedSolutions();
1006 $this->ctrl->redirect($this,
"suggestedsolution");
1009 $save = (is_array(
$_POST[
"cmd"]) && array_key_exists(
"suggestedsolution",
$_POST[
"cmd"])) ? TRUE : FALSE;
1011 $solution_array = $this->
object->getSuggestedSolution(0);
1013 "lm" => $this->lng->txt(
"obj_lm"),
1014 "st" => $this->lng->txt(
"obj_st"),
1015 "pg" => $this->lng->txt(
"obj_pg"),
1016 "git" => $this->lng->txt(
"glossary_term"),
1017 "file" => $this->lng->txt(
"fileDownload"),
1018 "text" => $this->lng->txt(
"solutionText")
1021 if ((strcmp(
$_POST[
"solutiontype"],
"file") == 0) && (strcmp($solution_array[
"type"],
"file") != 0))
1023 $solution_array = array(
1027 elseif ((strcmp(
$_POST[
"solutiontype"],
"text") == 0) && (strcmp($solution_array[
"type"],
"text") != 0))
1029 $solution_array = array(
1031 "value" => $this->getSolutionOutput(0, NULL, FALSE, FALSE, TRUE, FALSE, TRUE)
1034 if ($save && strlen(
$_POST[
"filename"]))
1036 $solution_array[
"value"][
"filename"] =
$_POST[
"filename"];
1038 if ($save && strlen(
$_POST[
"solutiontext"]))
1040 $solution_array[
"value"] =
$_POST[
"solutiontext"];
1042 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1043 if (count($solution_array))
1046 $form->setFormAction($this->ctrl->getFormAction($this));
1047 $form->setTitle($this->lng->txt(
"solution_hint"));
1048 $form->setMultipart(TRUE);
1049 $form->setTableWidth(
"100%");
1050 $form->setId(
"suggestedsolutiondisplay");
1053 include_once
"./Modules/TestQuestionPool/classes/class.ilSolutionTitleInputGUI.php";
1055 $template =
new ilTemplate(
"tpl.il_as_qpl_suggested_solution_input_presentation.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1056 if (strlen($solution_array[
"internal_link"]))
1059 $template->setCurrentBlock(
"preview");
1060 $template->setVariable(
"TEXT_SOLUTION", $this->lng->txt(
"solution_hint"));
1061 $template->setVariable(
"VALUE_SOLUTION",
" <a href=\"$href\" target=\"content\">" . $this->lng->txt(
"view").
"</a> ");
1062 $template->parseCurrentBlock();
1064 elseif ((strcmp($solution_array[
"type"],
"file") == 0) && (is_array($solution_array[
"value"])))
1066 $href = $this->
object->getSuggestedSolutionPathWeb() . $solution_array[
"value"][
"name"];
1067 $template->setCurrentBlock(
"preview");
1068 $template->setVariable(
"TEXT_SOLUTION", $this->lng->txt(
"solution_hint"));
1069 $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> ");
1070 $template->parseCurrentBlock();
1072 $template->setVariable(
"TEXT_TYPE", $this->lng->txt(
"type"));
1073 $template->setVariable(
"VALUE_TYPE", $options[$solution_array[
"type"]]);
1074 $title->setHtml($template->get());
1076 $deletesolution->setOptionTitle($this->lng->txt(
"deleteSuggestedSolution"));
1077 $title->addSubItem($deletesolution);
1080 if (strcmp($solution_array[
"type"],
"file") == 0)
1084 $file->setRequired(TRUE);
1085 $file->enableFileNameSelection(
"filename");
1087 if ($_FILES[
"file"][
"tmp_name"])
1089 if (!file_exists($this->object->getSuggestedSolutionPath()))
ilUtil::makeDirParents($this->object->getSuggestedSolutionPath());
1090 $res =
ilUtil::moveUploadedFile($_FILES[
"file"][
"tmp_name"], $_FILES[
"file"][
"name"], $this->object->getSuggestedSolutionPath() . $_FILES[
"file"][
"name"]);
1094 if (is_array($solution_array[
"value"])) @unlink($this->object->getSuggestedSolutionPath() . $solution_array[
"value"][
"name"]);
1095 $file->setValue($_FILES[
"file"][
"name"]);
1096 $this->
object->saveSuggestedSolution(
"file",
"", 0, array(
"name" => $_FILES[
"file"][
"name"],
"type" => $_FILES[
"file"][
"type"],
"size" => $_FILES[
"file"][
"size"],
"filename" =>
$_POST[
"filename"]));
1097 $originalexists = $this->
object->_questionExistsInPool($this->object->original_id);
1105 $this->ctrl->redirect($this,
"suggestedsolution");
1115 if (is_array($solution_array[
"value"]))
1117 $file->setValue($solution_array[
"value"][
"name"]);
1118 $file->setFilename((strlen($solution_array[
"value"][
"filename"])) ? $solution_array[
"value"][
"filename"] : $solution_array[
"value"][
"name"]);
1121 $form->addItem(
$file);
1123 $hidden->setValue(
"file");
1124 $form->addItem($hidden);
1126 else if (strcmp($solution_array[
"type"],
"text") == 0)
1129 $question->
setValue($this->object->prepareTextareaOutput($solution_array[
"value"]));
1130 $question->setRequired(TRUE);
1131 $question->setRows(10);
1132 $question->setCols(80);
1133 $question->setUseRte(TRUE);
1134 $question->addPlugin(
"latex");
1135 $question->addButton(
"latex");
1136 $question->setRTESupport($this->object->getId(),
"qpl",
"assessment");
1138 $hidden->setValue(
"text");
1139 $form->addItem($hidden);
1140 $form->addItem($question);
1142 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
'ref_id'])) $form->addCommandButton(
"suggestedsolution", $this->lng->txt(
"save"));
1146 if ($form->checkInput())
1148 switch ($solution_array[
"type"])
1151 $this->
object->saveSuggestedSolution(
"file",
"", 0, array(
"name" => $solution_array[
"value"][
"name"],
"type" => $solution_array[
"value"][
"type"],
"size" => $solution_array[
"value"][
"size"],
"filename" =>
$_POST[
"filename"]));
1154 $this->
object->saveSuggestedSolution(
"text",
"", 0, $solution_array[
"value"]);
1157 $originalexists = $this->
object->_questionExistsInPool($this->object->original_id);
1165 $this->ctrl->redirect($this,
"suggestedsolution");
1169 $output = $form->getHTML();
1172 $savechange = (strcmp($this->ctrl->getCmd(),
"saveSuggestedSolution") == 0) ? TRUE : FALSE;
1175 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
'ref_id']))
1178 $formchange->setFormAction($this->ctrl->getFormAction($this));
1179 $formchange->setTitle((count($solution_array)) ? $this->lng->txt(
"changeSuggestedSolution") : $this->lng->txt(
"addSuggestedSolution"));
1180 $formchange->setMultipart(FALSE);
1181 $formchange->setTableWidth(
"100%");
1182 $formchange->setId(
"suggestedsolution");
1184 $solutiontype =
new ilRadioMatrixInputGUI($this->lng->txt(
"suggestedSolutionType"),
"solutiontype");
1186 if (count($solution_array))
1188 $solutiontype->setValue($solution_array[
"type"]);
1190 $solutiontype->setRequired(TRUE);
1191 $formchange->addItem($solutiontype);
1193 $formchange->addCommandButton(
"saveSuggestedSolution", $this->lng->txt(
"select"));
1197 $formchange->checkInput();
1199 $changeoutput = $formchange->getHTML();
1202 $this->tpl->setVariable(
"ADM_CONTENT", $changeoutput . $output);
1209 include_once(
"./Modules/TestQuestionPool/classes/class.ilSolutionExplorer.php");
1210 $type =
$_GET[
"link_new_type"];
1211 $search =
$_GET[
"search_link_type"];
1212 $this->ctrl->setParameter($this,
"link_new_type", $type);
1213 $this->ctrl->setParameter($this,
"search_link_type", $search);
1214 $this->ctrl->saveParameter($this, array(
"subquestion_index",
"link_new_type",
"search_link_type"));
1218 $exp =
new ilSolutionExplorer($this->ctrl->getLinkTarget($this,
'suggestedsolution'), get_class($this));
1221 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,
'outSolutionExplorer'));
1222 $exp->setTargetGet(
"ref_id");
1223 $exp->setRefId(
$_GET[
"ref_id"]);
1224 $exp->addFilter($type);
1225 $exp->setSelectableType($type);
1230 $template =
new ilTemplate(
"tpl.il_as_qpl_explorer.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1231 $template->setVariable(
"EXPLORER_TREE",$exp->getOutput());
1232 $template->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
1233 $template->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this,
"suggestedsolution"));
1234 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
1241 include_once(
"./Modules/TestQuestionPool/classes/class.ilSolutionExplorer.php");
1242 switch (
$_POST[
"solutiontype"])
1268 $this->ctrl->setParameter($this,
"link_new_type", $type);
1269 $this->ctrl->setParameter($this,
"search_link_type", $search);
1270 $this->ctrl->redirect($this,
"outSolutionExplorer");
1275 $this->ctrl->redirect($this,
"suggestedsolution");
1280 include_once
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
1281 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1283 $cont_obj = $cont_obj_gui->object;
1285 $shownpages = array();
1286 $tree = $cont_obj->getLMTree();
1287 $chapters = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
1288 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
1289 $color_class = array(
"tblrow1",
"tblrow2");
1291 $template =
new ilTemplate(
"tpl.il_as_qpl_internallink_selection.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1292 foreach ($chapters as $chapter)
1294 $chapterpages = $tree->getChildsByType($chapter[
"obj_id"],
"pg");
1295 foreach ($chapterpages as $page)
1297 if($page[
"type"] ==
$_GET[
"search_link_type"])
1299 array_push($shownpages, $page[
"obj_id"]);
1300 $template->setCurrentBlock(
"linktable_row");
1301 $template->setVariable(
"TEXT_LINK", $page[
"title"]);
1302 $template->setVariable(
"TEXT_ADD", $this->lng->txt(
"add"));
1303 $template->setVariable(
"LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this),
"add" . strtoupper($page[
"type"])) .
"&" . $page[
"type"] .
"=" . $page[
"obj_id"]);
1304 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
1305 if ($tree->isInTree($page[
"obj_id"]))
1314 $template->parseCurrentBlock();
1319 foreach ($pages as $page)
1321 if (!in_array($page[
"obj_id"], $shownpages))
1323 $template->setCurrentBlock(
"linktable_row");
1324 $template->setVariable(
"TEXT_LINK", $page[
"title"]);
1325 $template->setVariable(
"TEXT_ADD", $this->lng->txt(
"add"));
1326 $template->setVariable(
"LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this),
"add" . strtoupper($page[
"type"])) .
"&" . $page[
"type"] .
"=" . $page[
"obj_id"]);
1327 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
1330 $template->parseCurrentBlock();
1334 $template->setCurrentBlock(
"link_selection");
1335 $template->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
1336 $template->setVariable(
"TEXT_LINK_TYPE", $this->lng->txt(
"obj_" .
$_GET[
"search_link_type"]));
1337 $template->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this,
"cancelExplorer"));
1338 $template->parseCurrentBlock();
1339 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
1344 $template =
new ilTemplate(
"tpl.il_as_qpl_internallink_selection.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1345 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
1346 $color_class = array(
"tblrow1",
"tblrow2");
1348 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1350 $cont_obj = $cont_obj_gui->object;
1352 $ctree =& $cont_obj->getLMTree();
1353 $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
1354 foreach($nodes as $node)
1356 if($node[
"type"] ==
$_GET[
"search_link_type"])
1358 $template->setCurrentBlock(
"linktable_row");
1359 $template->setVariable(
"TEXT_LINK", $node[
"title"]);
1360 $template->setVariable(
"TEXT_ADD", $this->lng->txt(
"add"));
1361 $template->setVariable(
"LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this),
"add" . strtoupper($node[
"type"])) .
"&" . $node[
"type"] .
"=" . $node[
"obj_id"]);
1362 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
1363 $template->parseCurrentBlock();
1367 $template->setCurrentBlock(
"link_selection");
1368 $template->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
1369 $template->setVariable(
"TEXT_LINK_TYPE", $this->lng->txt(
"obj_" .
$_GET[
"search_link_type"]));
1370 $template->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this,
"cancelExplorer"));
1371 $template->parseCurrentBlock();
1372 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
1377 $template =
new ilTemplate(
"tpl.il_as_qpl_internallink_selection.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1378 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
1379 $color_class = array(
"tblrow1",
"tblrow2");
1381 include_once
"./Modules/Glossary/classes/class.ilObjGlossary.php";
1384 $terms = $glossary->getTermList();
1385 foreach($terms as $term)
1387 $template->setCurrentBlock(
"linktable_row");
1388 $template->setVariable(
"TEXT_LINK", $term[
"term"]);
1389 $template->setVariable(
"TEXT_ADD", $this->lng->txt(
"add"));
1390 $template->setVariable(
"LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this),
"addGIT") .
"&git=" . $term[
"id"]);
1391 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
1392 $template->parseCurrentBlock();
1395 $template->setCurrentBlock(
"link_selection");
1396 $template->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
1397 $template->setVariable(
"TEXT_LINK_TYPE", $this->lng->txt(
"glossary_term"));
1398 $template->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this,
"cancelExplorer"));
1399 $template->parseCurrentBlock();
1400 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
1405 $this->ctrl->saveParameter($this, array(
"subquestion_index",
"link_new_type",
"search_link_type"));
1406 switch (
$_GET[
"search_link_type"])
1418 $subquestion_index = (
$_GET[
"subquestion_index"] > 0) ?
$_GET[
"subquestion_index"] : 0;
1419 $this->
object->saveSuggestedSolution(
"lm",
"il__lm_" .
$_GET[
"source_id"], $subquestion_index);
1421 $this->ctrl->redirect($this,
"suggestedsolution");
1428 $subquestion_index = 0;
1429 if (strlen(
$_GET[
"subquestion_index"]) &&
$_GET[
"subquestion_index"] >= 0)
1431 $subquestion_index =
$_GET[
"subquestion_index"];
1433 $this->
object->saveSuggestedSolution(
"pg",
"il__pg_" .
$_GET[
"pg"], $subquestion_index);
1435 $this->ctrl->redirect($this,
"suggestedsolution");
1440 $subquestion_index = 0;
1441 if (strlen(
$_GET[
"subquestion_index"]) &&
$_GET[
"subquestion_index"] >= 0)
1443 $subquestion_index =
$_GET[
"subquestion_index"];
1445 $this->
object->saveSuggestedSolution(
"st",
"il__st_" .
$_GET[
"st"], $subquestion_index);
1447 $this->ctrl->redirect($this,
"suggestedsolution");
1452 $subquestion_index = 0;
1453 if (strlen(
$_GET[
"subquestion_index"]) &&
$_GET[
"subquestion_index"] >= 0)
1455 $subquestion_index =
$_GET[
"subquestion_index"];
1457 $this->
object->saveSuggestedSolution(
"git",
"il__git_" .
$_GET[
"git"], $subquestion_index);
1459 $this->ctrl->redirect($this,
"suggestedsolution");