4 require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
5 require_once
'Modules/Test/classes/class.ilTestExpressPage.php';
62 $this->ctrl->saveParameter($this,
"q_id");
63 $this->ctrl->saveParameter($this,
"prev_qid");
64 $this->ctrl->saveParameter($this,
"calling_test");
65 $this->ctrl->saveParameterByClass(
'ilAssQuestionPageGUI',
'test_express_mode');
66 $this->ctrl->saveParameterByClass(
'ilobjquestionpoolgui',
'test_express_mode');
68 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
69 $this->errormessage = $this->lng->txt(
"fill_out_all_required_fields");
71 $this->selfassessmenteditingmode =
false;
72 $this->new_id_listeners = array();
73 $this->new_id_listener_cnt = 0;
81 $cmd = $this->ctrl->getCmd(
"editQuestion");
82 $next_class = $this->ctrl->getNextClass($this);
148 $this->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.il_as_qpl_content.html",
"Modules/TestQuestionPool");
149 $this->tpl->addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
151 $total_of_answers = $this->
object->getTotalAnswers();
153 $color_class = array(
"tblrow1",
"tblrow2");
154 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_qpl_assessment_of_questions.html",
"Modules/TestQuestionPool");
155 if (!$total_of_answers)
157 $this->tpl->setCurrentBlock(
"emptyrow");
158 $this->tpl->setVariable(
"TXT_NO_ASSESSMENT", $this->lng->txt(
"qpl_assessment_no_assessment_of_questions"));
159 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
160 $this->tpl->parseCurrentBlock();
164 $this->tpl->setCurrentBlock(
"row");
165 $this->tpl->setVariable(
"TXT_RESULT", $this->lng->txt(
"qpl_assessment_total_of_answers"));
166 $this->tpl->setVariable(
"TXT_VALUE", $total_of_answers);
167 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
169 $this->tpl->parseCurrentBlock();
170 $this->tpl->setCurrentBlock(
"row");
171 $this->tpl->setVariable(
"TXT_RESULT", $this->lng->txt(
"qpl_assessment_total_of_right_answers"));
172 $this->tpl->setVariable(
"TXT_VALUE", sprintf(
"%2.2f", $this->object->_getTotalRightAnswers(
$_GET[
"q_id"]) * 100.0) .
" %");
173 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
174 $this->tpl->parseCurrentBlock();
177 $instances =& $this->
object->getInstances();
179 foreach ($instances as $instance)
181 if (is_array($instance[
"refs"]))
183 foreach ($instance[
"refs"] as
$ref_id)
185 $this->tpl->setCurrentBlock(
"references");
186 $this->tpl->setVariable(
"GOTO",
"./goto.php?target=tst_" . $ref_id);
187 $this->tpl->setVariable(
"TEXT_GOTO", $this->lng->txt(
"perma_link"));
188 $this->tpl->parseCurrentBlock();
191 $this->tpl->setCurrentBlock(
"instance_row");
192 $this->tpl->setVariable(
"TEST_TITLE", $instance[
"title"]);
193 $this->tpl->setVariable(
"TEST_AUTHOR", $instance[
"author"]);
194 $this->tpl->setVariable(
"QUESTION_ID", $instance[
"question_id"]);
195 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
197 $this->tpl->parseCurrentBlock();
199 $this->tpl->setCurrentBlock(
"instances");
200 $this->tpl->setVariable(
"TEXT_TEST_TITLE", $this->lng->txt(
"title"));
201 $this->tpl->setVariable(
"TEXT_TEST_AUTHOR", $this->lng->txt(
"author"));
202 $this->tpl->setVariable(
"TEXT_TEST_LOCATION", $this->lng->txt(
"location"));
203 $this->tpl->setVariable(
"INSTANCES_TITLE", $this->lng->txt(
"question_instances_title"));
204 $this->tpl->parseCurrentBlock();
206 $this->tpl->setCurrentBlock(
"adm_content");
207 $this->tpl->setVariable(
"TXT_QUESTION_TITLE", $this->lng->txt(
"question_cumulated_statistics"));
208 $this->tpl->setVariable(
"TXT_RESULT", $this->lng->txt(
"result"));
209 $this->tpl->setVariable(
"TXT_VALUE", $this->lng->txt(
"value"));
210 $this->tpl->parseCurrentBlock();
226 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
228 if ((!$question_type) and ($question_id > 0))
233 if (strlen($question_type) == 0)
return NULL;
238 $question =&
new $question_type_gui();
241 $question->object->feedbackOBJ =
new $feedbackObjectClassname($question->object, $ilCtrl, $ilDB, $lng);
243 if ($question_id > 0)
245 $question->object->loadFromDb($question_id);
256 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
257 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
268 return $q_type .
"GUI";
285 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
294 $this->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.il_as_qpl_content.html",
"Modules/TestQuestionPool");
295 $this->tpl->addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
296 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_question.html",
"Modules/TestQuestionPool");
307 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
310 $page_gui->setOutputMode(
"presentation");
311 $presentation = $page_gui->presentation();
312 $presentation = preg_replace(
"/src=\"\\.\\//ims",
"src=\"" . ILIAS_HTTP_PATH .
"/", $presentation);
313 return $presentation;
319 function outQuestionPage($a_temp_var, $a_postponed =
false, $active_id =
"", $html =
"")
324 $postponed =
" (" . $this->lng->txt(
"postponed") .
")";
327 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
328 $this->lng->loadLanguageModule(
"content");
333 $page_gui->setQuestionHTML(array($this->object->getId() => $html));
335 $page_gui->setOutputMode(
"presentation");
337 include_once
"./Modules/Test/classes/class.ilObjTest.php";
342 $obligatoryString =
'([-_-])';
346 $obligatoryString =
'';
349 switch ($title_output)
352 $page_gui->setPresentationTitle(sprintf($this->lng->txt(
"tst_position"), $this->
getSequenceNumber(), $this->
getQuestionCount()).
" - ".$this->object->getTitle().$postponed . $obligatoryString);
359 $maxpoints = $this->
object->getMaximumPoints();
362 $maxpoints =
" (".$maxpoints.
" ".$this->lng->txt(
"point").
")";
366 $maxpoints =
" (".$maxpoints.
" ".$this->lng->txt(
"points").
")";
368 $page_gui->setPresentationTitle(sprintf($this->lng->txt(
"tst_position"), $this->
getSequenceNumber(), $this->
getQuestionCount()).
" - ".$this->object->getTitle().$postponed.$maxpoints . $obligatoryString);
371 $presentation = $page_gui->presentation();
372 if (strlen($maxpoints)) $presentation = str_replace($maxpoints,
"<em>$maxpoints</em>", $presentation);
373 if (strlen($obligatoryString))
375 $replacement =
'<br><span class="obligatory" style="font-size:small">'.
376 $this->lng->txt(
"tst_you_have_to_answer_this_question").
'</span>';
377 $presentation = str_replace($obligatoryString, $replacement, $presentation);
379 $presentation = preg_replace(
"/src=\"\\.\\//ims",
"src=\"" . ILIAS_HTTP_PATH .
"/", $presentation);
380 return $presentation;
388 if (
$_GET[
"calling_test"])
393 elseif (
$_GET[
"test_ref_id"])
400 if (
$_GET[
"q_id"] > 0)
402 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id",
$_GET[
"q_id"]);
403 $this->ctrl->redirectByClass(
"ilAssQuestionPageGUI",
"edit");
407 $this->ctrl->redirectByClass(
"ilobjquestionpoolgui",
"questions");
418 if (strlen($return_to))
420 $this->ctrl->setParameter($this,
"return_to", $return_to);
423 $this->ctrl->setParameter($this,
"return_to",
$_REQUEST[
'return_to']);
425 if(strlen($return_to_feedback))
427 $this->ctrl->setParameter($this,
'return_to_fb',
'true');
430 $template =
new ilTemplate(
"tpl.il_as_qpl_sync_original.html",TRUE, TRUE,
"Modules/TestQuestionPool");
431 $template->setVariable(
"BUTTON_YES", $this->lng->txt(
"yes"));
432 $template->setVariable(
"BUTTON_NO", $this->lng->txt(
"no"));
433 $template->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
434 $template->setVariable(
"TEXT_SYNC", $this->lng->txt(
"confirm_sync_questions"));
435 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
440 $original_id = $this->
object->original_id;
443 $this->
object->syncWithOriginal();
445 if (strlen(
$_GET[
"return_to"]))
447 $this->ctrl->redirect($this,
$_GET[
"return_to"]);
451 $this->ctrl->redirectByClass(
'ilAssQuestionFeedbackEditingGUI',
'show');
462 if (strlen(
$_GET[
"return_to"]))
464 $this->ctrl->redirect($this,
$_GET[
"return_to"]);
468 $this->ctrl->redirectByClass(
'ilAssQuestionFeedbackEditingGUI',
'show');
487 $ilUser->setPref(
"tst_lastquestiontype", $this->object->getQuestionType());
488 $ilUser->writePref(
"tst_lastquestiontype", $this->object->getQuestionType());
489 $this->
object->saveToDb();
490 $originalexists = $this->
object->_questionExists($this->object->original_id);
491 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
494 $this->ctrl->redirect($this,
"originalSyncForm");
496 elseif (
$_GET[
"calling_test"])
502 elseif (
$_GET[
"test_ref_id"])
504 global $tree, $ilDB, $ilPluginAdmin;
506 include_once (
"./Modules/Test/classes/class.ilObjTest.php");
510 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
513 $test->insertQuestion( $testQuestionSetConfigFactory->getQuestionSetConfig(), $this->
object->getId() );
519 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
520 $this->editQuestion();
529 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id", $this->object->getId());
530 $this->ctrl->redirectByClass(
"ilAssQuestionPageGUI",
"edit");
541 $old_id =
$_GET[
"q_id"];
546 $ilUser->setPref(
"tst_lastquestiontype", $this->object->getQuestionType());
547 $ilUser->writePref(
"tst_lastquestiontype", $this->object->getQuestionType());
548 $this->
object->saveToDb();
549 $originalexists = $this->
object->_questionExistsInPool($this->object->original_id);
552 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
556 $this->ctrl->setParameter($this,
'return_to',
'editQuestion');
557 $this->ctrl->redirect($this,
"originalSyncForm");
560 elseif(
$_GET[
"calling_test"])
562 require_once
'Modules/Test/classes/class.ilObjTest.php';
566 global $tree, $ilDB, $ilPluginAdmin;
568 include_once(
"./Modules/Test/classes/class.ilObjTest.php");
572 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
575 $new_id =
$test->insertQuestion(
576 $testQuestionSetConfigFactory->getQuestionSetConfig(), $this->
object->getId()
581 $test->moveQuestionAfter($this->object->getId() + 1,
$_REQUEST[
'prev_qid']);
584 $this->ctrl->setParameter($this,
'q_id', $new_id);
585 $this->ctrl->setParameter($this,
'calling_test',
$_GET[
'calling_test']);
586 #$this->ctrl->setParameter($this, 'test_ref_id', false);
589 $this->ctrl->redirect($this,
'editQuestion');
596 if($this->object->getId() != $old_id)
599 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"q_id", $this->object->getId());
600 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"sel_question_types",
$_GET[
"sel_question_types"]);
611 include_once(
"./Modules/Test/classes/class.ilObjTest.php");
613 $test->moveQuestionAfter(
$_REQUEST[
'prev_qid'], $this->object->getId());
617 global $tree, $ilDB, $ilPluginAdmin;
619 include_once(
"./Modules/Test/classes/class.ilObjTest.php");
622 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
625 $test->insertQuestion(
626 $testQuestionSetConfigFactory->getQuestionSetConfig(), $this->
object->getId()
629 require_once
'Modules/Test/classes/class.ilTestExpressPage.php';
630 $_REQUEST[
'q_id'] = $this->
object->getId();
634 $this->ctrl->redirectByClass(
$_GET[
"cmdClass"],
"editQuestion");
644 $this->ctrl->redirect($this,
'editQuestion');
655 $old_id =
$_GET[
"q_id"];
659 $ilUser->setPref(
"tst_lastquestiontype", $this->object->getQuestionType());
660 $ilUser->writePref(
"tst_lastquestiontype", $this->object->getQuestionType());
661 $this->
object->saveToDb();
662 $originalexists = $this->
object->_questionExistsInPool($this->object->original_id);
663 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
667 $this->ctrl->redirect($this,
"originalSyncForm");
670 elseif(
$_GET[
"calling_test"])
672 require_once
'Modules/Test/classes/class.ilObjTest.php';
674 #var_dump(assQuestion::_questionExistsInTest($this->object->getId(), $test->getTestId()));
675 $q_id = $this->
object->getId();
678 global $tree, $ilDB, $ilPluginAdmin;
680 include_once(
"./Modules/Test/classes/class.ilObjTest.php");
684 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
687 $new_id =
$test->insertQuestion(
688 $testQuestionSetConfigFactory->getQuestionSetConfig(), $this->
object->getId()
694 $test->moveQuestionAfter($this->object->getId() + 1,
$_REQUEST[
'prev_qid']);
697 $this->ctrl->setParameter($this,
'q_id', $new_id);
698 $this->ctrl->setParameter($this,
'calling_test',
$_GET[
'calling_test']);
699 #$this->ctrl->setParameter($this, 'test_ref_id', false);
716 if($this->object->getId() != $old_id)
720 $this->ctrl->redirectByClass(
"ilobjquestionpoolgui",
"questions");
730 $this->ctrl->redirectByClass(
"ilobjquestionpoolgui",
"questions");
741 $this->
object->saveToDb();
742 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
743 $this->editQuestion();
756 $tmpPath = $cont_obj->getLMTree()->getPathFull($a_endnode_id, $a_startnode_id);
759 for ($i = 1; $i < (count($tmpPath) - 1); $i++)
766 $path .= $tmpPath[$i][
"title"];
774 $this->sequence_no = $nr;
784 $this->question_count = $a_question_count;
804 $this->errormessage .= ((strlen($this->errormessage)) ?
"<br />" :
"") .
$errormessage;
821 return $this->
object->getQuestionType();
834 if (strlen($a_value))
836 $result =
" value=\"$a_value\" ";
848 $cnt = $this->new_id_listener_cnt;
849 $this->new_id_listeners[$cnt][
"object"] =& $a_object;
850 $this->new_id_listeners[$cnt][
"method"] = $a_method;
851 $this->new_id_listeners[$cnt][
"parameters"] = $a_parameters;
852 $this->new_id_listener_cnt++;
861 for ($i=0; $i<$this->new_id_listener_cnt; $i++)
863 $this->new_id_listeners[$i][
"parameters"][
"new_id"] = $a_new_id;
864 $object =& $this->new_id_listeners[$i][
"object"];
865 $method = $this->new_id_listeners[$i][
"method"];
866 $parameters = $this->new_id_listeners[$i][
"parameters"];
881 if(!$this->object->getSelfAssessmentEditingMode())
883 $form->addCommandButton(
"saveReturn", $this->lng->txt(
"save_return"));
885 $form->addCommandButton(
"save", $this->lng->txt(
"save"));
898 $title->
setValue($this->object->getTitle());
899 $title->setRequired(TRUE);
900 $form->addItem($title);
902 if (!$this->object->getSelfAssessmentEditingMode())
905 $author =
new ilTextInputGUI($this->lng->txt(
"author"),
"author");
906 $author->
setValue($this->object->getAuthor());
907 $author->setRequired(TRUE);
908 $form->addItem($author);
911 $description =
new ilTextInputGUI($this->lng->txt(
"description"),
"comment");
912 $description->
setValue($this->object->getComment());
913 $description->setRequired(FALSE);
914 $form->addItem($description);
921 if (trim($author) ==
"")
925 $hi->setValue($author);
932 $question->
setValue($this->object->prepareTextareaOutput($this->object->getQuestion()));
933 $question->setRequired(TRUE);
934 $question->setRows(10);
935 $question->setCols(80);
936 if (!$this->object->getSelfAssessmentEditingMode())
940 $question->setUseRte(TRUE);
941 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
943 $question->addPlugin(
"latex");
944 $question->addButton(
"latex");
945 $question->addButton(
"pastelatex");
946 $question->setRTESupport($this->object->getId(),
"qpl",
"assessment");
951 $question->setRteTags(self::getSelfAssessmentTags());
952 $question->setUseTagsForRteOnly(
false);
954 $form->addItem($question);
956 if (!$this->object->getSelfAssessmentEditingMode())
961 $duration->setShowMinutes(TRUE);
962 $duration->setShowSeconds(TRUE);
963 $ewt = $this->
object->getEstimatedWorkingTime();
964 $duration->setHours($ewt[
"h"]);
965 $duration->setMinutes($ewt[
"m"]);
966 $duration->setSeconds($ewt[
"s"]);
967 $duration->setRequired(FALSE);
968 $form->addItem($duration);
973 if (strlen($this->object->getNrOfTries()))
975 $nr_tries = $this->
object->getNrOfTries();
979 $nr_tries = $this->
object->getDefaultNrOfTries();
991 $ni =
new ilNumberInputGUI($this->lng->txt(
"qst_nr_of_tries"),
"nr_of_tries");
996 $ni->setMaxLength(5);
997 $ni->setRequired(
true);
1006 require_once
'Services/Taxonomy/classes/class.ilTaxAssignInputGUI.php';
1010 $postvar =
"tax_node_assign_$taxonomyId";
1014 $tax_node_assign->saveInput(
"qpl", $this->object->getObjId(),
"quest", $this->
object->getId());
1024 $sectHeader->setTitle($this->lng->txt(
'qpl_qst_edit_form_taxonomy_section'));
1027 require_once
'Services/Taxonomy/classes/class.ilTaxAssignInputGUI.php';
1032 $label = sprintf($this->lng->txt(
'qpl_qst_edit_form_taxonomy'), $taxonomy->getTitle());
1033 $postvar =
"tax_node_assign_$taxonomyId";
1037 $taxNodeAssign->
setCurrentValues(
'qpl', $this->object->getObjId(),
'quest', $this->
object->getId());
1038 $form->
addItem($taxNodeAssign);
1054 $not_supported = array(
"img",
"p");
1058 if (!in_array($s, $not_supported))
1094 include_once
"./Modules/Test/classes/class.ilObjTest.php";
1096 if (strlen($manual_feedback))
1098 return $manual_feedback;
1100 $correct_feedback = $this->
object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(),
true);
1101 $incorrect_feedback = $this->
object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(),
false);
1102 if (strlen($correct_feedback.$incorrect_feedback))
1104 $reached_points = $this->
object->calculateReachedPoints($active_id,
$pass);
1105 $max_points = $this->
object->getMaximumPoints();
1106 if ($reached_points == $max_points)
1108 $output = $correct_feedback;
1112 $output = $incorrect_feedback;
1115 return $this->
object->prepareTextareaOutput($output, TRUE);
1133 include_once
"./Services/UICore/classes/class.ilTemplate.php";
1134 $template =
new ilTemplate(
"tpl.il_as_qpl_questiontype.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1135 $count = $this->
object->isInUse();
1139 if ($rbacsystem->checkAccess(
"write",
$_GET[
"ref_id"]))
1141 $template->setCurrentBlock(
"infosign");
1143 $template->setVariable(
"INFO_IMG_ALT", sprintf($this->lng->txt(
"qpl_question_is_in_use"), $count));
1144 $template->setVariable(
"INFO_IMG_TITLE", sprintf($this->lng->txt(
"qpl_question_is_in_use"), $count));
1145 $template->parseCurrentBlock();
1149 return $template->get();
1167 $save = (is_array(
$_POST[
"cmd"]) && array_key_exists(
"suggestedsolution",
$_POST[
"cmd"])) ? TRUE : FALSE;
1169 if ($save &&
$_POST[
"deleteSuggestedSolution"] == 1)
1171 $this->
object->deleteSuggestedSolutions();
1173 $this->ctrl->redirect($this,
"suggestedsolution");
1177 $solution_array = $this->
object->getSuggestedSolution(0);
1179 "lm" => $this->lng->txt(
"obj_lm"),
1180 "st" => $this->lng->txt(
"obj_st"),
1181 "pg" => $this->lng->txt(
"obj_pg"),
1182 "git" => $this->lng->txt(
"glossary_term"),
1183 "file" => $this->lng->txt(
"fileDownload"),
1184 "text" => $this->lng->txt(
"solutionText")
1187 if ((strcmp(
$_POST[
"solutiontype"],
"file") == 0) && (strcmp($solution_array[
"type"],
"file") != 0))
1189 $solution_array = array(
1193 elseif ((strcmp(
$_POST[
"solutiontype"],
"text") == 0) && (strcmp($solution_array[
"type"],
"text") != 0))
1195 $solution_array = array(
1200 if ($save && strlen(
$_POST[
"filename"]))
1202 $solution_array[
"value"][
"filename"] =
$_POST[
"filename"];
1204 if ($save && strlen(
$_POST[
"solutiontext"]))
1206 $solution_array[
"value"] =
$_POST[
"solutiontext"];
1208 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1209 if (count($solution_array))
1212 $form->setFormAction($this->ctrl->getFormAction($this));
1213 $form->setTitle($this->lng->txt(
"solution_hint"));
1214 $form->setMultipart(TRUE);
1215 $form->setTableWidth(
"100%");
1216 $form->setId(
"suggestedsolutiondisplay");
1219 include_once
"./Modules/TestQuestionPool/classes/class.ilSolutionTitleInputGUI.php";
1221 $template =
new ilTemplate(
"tpl.il_as_qpl_suggested_solution_input_presentation.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1222 if (strlen($solution_array[
"internal_link"]))
1225 $template->setCurrentBlock(
"preview");
1226 $template->setVariable(
"TEXT_SOLUTION", $this->lng->txt(
"solution_hint"));
1227 $template->setVariable(
"VALUE_SOLUTION",
" <a href=\"$href\" target=\"content\">" . $this->lng->txt(
"view").
"</a> ");
1228 $template->parseCurrentBlock();
1230 elseif ((strcmp($solution_array[
"type"],
"file") == 0) && (is_array($solution_array[
"value"])))
1232 $href = $this->
object->getSuggestedSolutionPathWeb() . $solution_array[
"value"][
"name"];
1233 $template->setCurrentBlock(
"preview");
1234 $template->setVariable(
"TEXT_SOLUTION", $this->lng->txt(
"solution_hint"));
1235 $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> ");
1236 $template->parseCurrentBlock();
1238 $template->setVariable(
"TEXT_TYPE", $this->lng->txt(
"type"));
1239 $template->setVariable(
"VALUE_TYPE",
$options[$solution_array[
"type"]]);
1240 $title->
setHtml($template->get());
1242 $deletesolution->setOptionTitle($this->lng->txt(
"deleteSuggestedSolution"));
1243 $title->addSubItem($deletesolution);
1244 $form->addItem($title);
1246 if (strcmp($solution_array[
"type"],
"file") == 0)
1250 $file->setRequired(TRUE);
1251 $file->enableFileNameSelection(
"filename");
1253 if( $_FILES[
"file"][
"tmp_name"] &&
$file->checkInput() )
1255 if (!file_exists($this->object->getSuggestedSolutionPath()))
ilUtil::makeDirParents($this->object->getSuggestedSolutionPath());
1257 $res =
ilUtil::moveUploadedFile($_FILES[
"file"][
"tmp_name"], $_FILES[
"file"][
"name"], $this->object->getSuggestedSolutionPath() . $_FILES[
"file"][
"name"]);
1263 if (is_array($solution_array[
"value"])) @unlink($this->object->getSuggestedSolutionPath() . $solution_array[
"value"][
"name"]);
1264 $file->setValue($_FILES[
"file"][
"name"]);
1265 $this->
object->saveSuggestedSolution(
"file",
"", 0, array(
"name" => $_FILES[
"file"][
"name"],
"type" => $_FILES[
"file"][
"type"],
"size" => $_FILES[
"file"][
"size"],
"filename" =>
$_POST[
"filename"]));
1266 $originalexists = $this->
object->_questionExistsInPool($this->object->original_id);
1274 $this->ctrl->redirect($this,
"suggestedsolution");
1285 if (is_array($solution_array[
"value"]))
1287 $file->setValue($solution_array[
"value"][
"name"]);
1288 $file->setFilename((strlen($solution_array[
"value"][
"filename"])) ? $solution_array[
"value"][
"filename"] : $solution_array[
"value"][
"name"]);
1291 $form->addItem(
$file);
1293 $hidden->setValue(
"file");
1294 $form->addItem($hidden);
1296 else if (strcmp($solution_array[
"type"],
"text") == 0)
1299 $question->
setValue($this->object->prepareTextareaOutput($solution_array[
"value"]));
1300 $question->setRequired(TRUE);
1301 $question->setRows(10);
1302 $question->setCols(80);
1303 $question->setUseRte(TRUE);
1304 $question->addPlugin(
"latex");
1305 $question->addButton(
"latex");
1306 $question->setRTESupport($this->object->getId(),
"qpl",
"assessment");
1308 $hidden->setValue(
"text");
1309 $form->addItem($hidden);
1310 $form->addItem($question);
1312 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
'ref_id']))
1314 $form->addCommandButton(
'showSuggestedSolution', $this->lng->txt(
'cancel'));
1315 $form->addCommandButton(
'suggestedsolution', $this->lng->txt(
'save'));
1320 if ($form->checkInput())
1322 switch ($solution_array[
"type"])
1325 $this->
object->saveSuggestedSolution(
"file",
"", 0, array(
"name" => $solution_array[
"value"][
"name"],
"type" => $solution_array[
"value"][
"type"],
"size" => $solution_array[
"value"][
"size"],
"filename" =>
$_POST[
"filename"]));
1328 $this->
object->saveSuggestedSolution(
"text",
"", 0, $solution_array[
"value"]);
1331 $originalexists = $this->
object->_questionExistsInPool($this->object->original_id);
1339 $this->ctrl->redirect($this,
"suggestedsolution");
1344 $output = $form->getHTML();
1347 $savechange = (strcmp($this->ctrl->getCmd(),
"saveSuggestedSolution") == 0) ? TRUE : FALSE;
1350 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
'ref_id']))
1353 $formchange->setFormAction($this->ctrl->getFormAction($this));
1354 $formchange->setTitle((count($solution_array)) ? $this->lng->txt(
"changeSuggestedSolution") : $this->lng->txt(
"addSuggestedSolution"));
1355 $formchange->setMultipart(FALSE);
1356 $formchange->setTableWidth(
"100%");
1357 $formchange->setId(
"suggestedsolution");
1359 $solutiontype =
new ilRadioGroupInputGUI($this->lng->txt(
"suggestedSolutionType"),
"solutiontype");
1360 foreach(
$options as $opt_value => $opt_caption)
1364 if (count($solution_array))
1366 $solutiontype->setValue($solution_array[
"type"]);
1368 $solutiontype->setRequired(TRUE);
1369 $formchange->addItem($solutiontype);
1371 $formchange->addCommandButton(
"saveSuggestedSolution", $this->lng->txt(
"select"));
1375 $formchange->checkInput();
1377 $changeoutput = $formchange->getHTML();
1380 $this->tpl->setVariable(
"ADM_CONTENT", $changeoutput . $output);
1387 include_once(
"./Modules/TestQuestionPool/classes/class.ilSolutionExplorer.php");
1388 $type =
$_GET[
"link_new_type"];
1389 $search =
$_GET[
"search_link_type"];
1390 $this->ctrl->setParameter($this,
"link_new_type", $type);
1391 $this->ctrl->setParameter($this,
"search_link_type", $search);
1392 $this->ctrl->saveParameter($this, array(
"subquestion_index",
"link_new_type",
"search_link_type"));
1396 $parent_ref_id = $tree->getParentId(
$_GET[
"ref_id"]);
1397 $exp =
new ilSolutionExplorer($this->ctrl->getLinkTarget($this,
'suggestedsolution'), get_class($this));
1399 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,
'outSolutionExplorer'));
1400 $exp->setTargetGet(
"ref_id");
1401 $exp->setRefId(
$_GET[
"ref_id"]);
1402 $exp->addFilter($type);
1403 $exp->setSelectableType($type);
1404 if(isset(
$_GET[
'expandCurrentPath']) &&
$_GET[
'expandCurrentPath'])
1406 $exp->expandPathByRefId($parent_ref_id);
1412 $template =
new ilTemplate(
"tpl.il_as_qpl_explorer.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1413 $template->setVariable(
"EXPLORER_TREE",$exp->getOutput());
1414 $template->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
1415 $template->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this,
"suggestedsolution"));
1416 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
1423 include_once(
"./Modules/TestQuestionPool/classes/class.ilSolutionExplorer.php");
1424 switch (
$_POST[
"solutiontype"])
1450 if(isset(
$_POST[
'solutiontype']))
1452 $this->ctrl->setParameter($this,
'expandCurrentPath', 1);
1454 $this->ctrl->setParameter($this,
"link_new_type", $type);
1455 $this->ctrl->setParameter($this,
"search_link_type", $search);
1456 $this->ctrl->redirect($this,
"outSolutionExplorer");
1461 $this->ctrl->redirect($this,
"suggestedsolution");
1466 include_once
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
1467 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1469 $cont_obj = $cont_obj_gui->object;
1471 $shownpages = array();
1472 $tree = $cont_obj->getLMTree();
1473 $chapters = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
1474 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
1475 $color_class = array(
"tblrow1",
"tblrow2");
1477 $template =
new ilTemplate(
"tpl.il_as_qpl_internallink_selection.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1478 foreach ($chapters as $chapter)
1480 $chapterpages = $tree->getChildsByType($chapter[
"obj_id"],
"pg");
1481 foreach ($chapterpages as $page)
1483 if($page[
"type"] ==
$_GET[
"search_link_type"])
1485 array_push($shownpages, $page[
"obj_id"]);
1486 $template->setCurrentBlock(
"linktable_row");
1487 $template->setVariable(
"TEXT_LINK", $page[
"title"]);
1488 $template->setVariable(
"TEXT_ADD", $this->lng->txt(
"add"));
1489 $template->setVariable(
"LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this),
"add" . strtoupper($page[
"type"])) .
"&" . $page[
"type"] .
"=" . $page[
"obj_id"]);
1490 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
1491 if ($tree->isInTree($page[
"obj_id"]))
1500 $template->parseCurrentBlock();
1505 foreach ($pages as $page)
1507 if (!in_array($page[
"obj_id"], $shownpages))
1509 $template->setCurrentBlock(
"linktable_row");
1510 $template->setVariable(
"TEXT_LINK", $page[
"title"]);
1511 $template->setVariable(
"TEXT_ADD", $this->lng->txt(
"add"));
1512 $template->setVariable(
"LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this),
"add" . strtoupper($page[
"type"])) .
"&" . $page[
"type"] .
"=" . $page[
"obj_id"]);
1513 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
1516 $template->parseCurrentBlock();
1520 $template->setCurrentBlock(
"link_selection");
1521 $template->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
1522 $template->setVariable(
"TEXT_LINK_TYPE", $this->lng->txt(
"obj_" .
$_GET[
"search_link_type"]));
1523 $template->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this,
"cancelExplorer"));
1524 $template->parseCurrentBlock();
1525 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
1530 $template =
new ilTemplate(
"tpl.il_as_qpl_internallink_selection.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1531 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
1532 $color_class = array(
"tblrow1",
"tblrow2");
1534 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1536 $cont_obj = $cont_obj_gui->object;
1538 $ctree =& $cont_obj->getLMTree();
1539 $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
1540 foreach($nodes as $node)
1542 if($node[
"type"] ==
$_GET[
"search_link_type"])
1544 $template->setCurrentBlock(
"linktable_row");
1545 $template->setVariable(
"TEXT_LINK", $node[
"title"]);
1546 $template->setVariable(
"TEXT_ADD", $this->lng->txt(
"add"));
1547 $template->setVariable(
"LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this),
"add" . strtoupper($node[
"type"])) .
"&" . $node[
"type"] .
"=" . $node[
"obj_id"]);
1548 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
1549 $template->parseCurrentBlock();
1553 $template->setCurrentBlock(
"link_selection");
1554 $template->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
1555 $template->setVariable(
"TEXT_LINK_TYPE", $this->lng->txt(
"obj_" .
$_GET[
"search_link_type"]));
1556 $template->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this,
"cancelExplorer"));
1557 $template->parseCurrentBlock();
1558 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
1563 $template =
new ilTemplate(
"tpl.il_as_qpl_internallink_selection.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1564 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
1565 $color_class = array(
"tblrow1",
"tblrow2");
1567 include_once
"./Modules/Glossary/classes/class.ilObjGlossary.php";
1570 $terms = $glossary->getTermList();
1571 foreach($terms as $term)
1573 $template->setCurrentBlock(
"linktable_row");
1574 $template->setVariable(
"TEXT_LINK", $term[
"term"]);
1575 $template->setVariable(
"TEXT_ADD", $this->lng->txt(
"add"));
1576 $template->setVariable(
"LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this),
"addGIT") .
"&git=" . $term[
"id"]);
1577 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
1578 $template->parseCurrentBlock();
1581 $template->setCurrentBlock(
"link_selection");
1582 $template->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
1583 $template->setVariable(
"TEXT_LINK_TYPE", $this->lng->txt(
"glossary_term"));
1584 $template->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this,
"cancelExplorer"));
1585 $template->parseCurrentBlock();
1586 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
1591 $this->ctrl->saveParameter($this, array(
"subquestion_index",
"link_new_type",
"search_link_type"));
1592 switch (
$_GET[
"search_link_type"])
1604 $subquestion_index = (
$_GET[
"subquestion_index"] > 0) ?
$_GET[
"subquestion_index"] : 0;
1605 $this->
object->saveSuggestedSolution(
"lm",
"il__lm_" .
$_GET[
"source_id"], $subquestion_index);
1607 $this->ctrl->redirect($this,
"suggestedsolution");
1614 $subquestion_index = 0;
1615 if (strlen(
$_GET[
"subquestion_index"]) &&
$_GET[
"subquestion_index"] >= 0)
1617 $subquestion_index =
$_GET[
"subquestion_index"];
1619 $this->
object->saveSuggestedSolution(
"pg",
"il__pg_" .
$_GET[
"pg"], $subquestion_index);
1621 $this->ctrl->redirect($this,
"suggestedsolution");
1626 $subquestion_index = 0;
1627 if (strlen(
$_GET[
"subquestion_index"]) &&
$_GET[
"subquestion_index"] >= 0)
1629 $subquestion_index =
$_GET[
"subquestion_index"];
1631 $this->
object->saveSuggestedSolution(
"st",
"il__st_" .
$_GET[
"st"], $subquestion_index);
1633 $this->ctrl->redirect($this,
"suggestedsolution");
1638 $subquestion_index = 0;
1639 if (strlen(
$_GET[
"subquestion_index"]) &&
$_GET[
"subquestion_index"] >= 0)
1641 $subquestion_index =
$_GET[
"subquestion_index"];
1643 $this->
object->saveSuggestedSolution(
"git",
"il__git_" .
$_GET[
"git"], $subquestion_index);
1645 $this->ctrl->redirect($this,
"suggestedsolution");
1650 return in_array($this->ctrl->getCmd(), array(
'save',
'saveEdit',
'saveReturn'));
1663 $reflectionClass =
new ReflectionClass($guiClassName);
1667 if( $reflectionClass instanceof ReflectionClass )
1669 $commands = array();
1671 foreach($reflectionClass->getConstants() as $constName => $constValue)
1673 if( substr($constName, 0, strlen($cmdConstantNameBegin)) == $cmdConstantNameBegin )
1675 $commands[] = $constValue;
1697 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
1702 $tabs->
addTarget(
'feedback', $tabLink, $tabCommands, $ilCtrl->getCmdClass(),
'');
1708 protected function addTab_Units(
ilTabsGUI $tabs)
1715 $tabs->
addTarget(
'units', $ilCtrl->getLinkTargetByClass(
'ilLocalUnitConfigurationGUI',
''),
'',
'illocalunitconfigurationgui');
1728 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsGUI.php';
1730 switch( $ilCtrl->getCmdClass() )
1732 case 'ilassquestionhintsgui':
1737 case 'ilassquestionhintgui':
1739 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintGUI.php';
1745 $tabCommands = array();
1750 $tabs->
addTarget(
'tst_question_hints_tab', $tabLink, $tabCommands, $ilCtrl->getCmdClass(),
'');
1756 $graphicalOutput = FALSE,
1757 $result_output = FALSE,
1758 $show_question_only = TRUE,
1759 $show_feedback = FALSE,
1760 $show_correct_solution = FALSE,
1761 $show_manual_scoring = FALSE,
1762 $show_question_text = TRUE
1767 return $this->
object->isAutosaveable();
1772 $this->
object->setTitle(
$_POST[
"title"] );
1773 $this->
object->setAuthor(
$_POST[
"author"] );
1774 $this->
object->setComment(
$_POST[
"comment"] );
1775 if ($this->object->getSelfAssessmentEditingMode())
1777 $this->
object->setNrOfTries(
$_POST[
'nr_of_tries'] );
1780 $this->
object->setEstimatedWorkingTime(
1781 $_POST[
"Estimated"][
"hh"],
1782 $_POST[
"Estimated"][
"mm"],
1783 $_POST[
"Estimated"][
"ss"]