4 require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
5 require_once
'Modules/Test/classes/class.ilTestExpressPage.php';
74 $this->ctrl->saveParameter($this,
"q_id");
75 $this->ctrl->saveParameter($this,
"prev_qid");
76 $this->ctrl->saveParameter($this,
"calling_test");
77 $this->ctrl->saveParameter($this,
"calling_consumer");
78 $this->ctrl->saveParameter($this,
"consumer_context");
79 $this->ctrl->saveParameterByClass(
'ilAssQuestionPageGUI',
'test_express_mode');
80 $this->ctrl->saveParameterByClass(
'ilAssQuestionPageGUI',
'calling_consumer');
81 $this->ctrl->saveParameterByClass(
'ilAssQuestionPageGUI',
'consumer_context');
82 $this->ctrl->saveParameterByClass(
'ilobjquestionpoolgui',
'test_express_mode');
83 $this->ctrl->saveParameterByClass(
'ilobjquestionpoolgui',
'calling_consumer');
84 $this->ctrl->saveParameterByClass(
'ilobjquestionpoolgui',
'consumer_context');
86 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
87 $this->errormessage = $this->lng->txt(
"fill_out_all_required_fields");
89 $this->selfassessmenteditingmode =
false;
90 $this->new_id_listeners = array();
91 $this->new_id_listener_cnt = 0;
99 $cmd = $this->ctrl->getCmd(
"editQuestion");
100 $next_class = $this->ctrl->getNextClass($this);
163 if( is_object($this->
object) )
187 public function assessment()
194 require_once
'Modules/TestQuestionPool/classes/tables/class.ilQuestionCumulatedStatisticsTableGUI.php';
197 require_once
'Modules/TestQuestionPool/classes/tables/class.ilQuestionUsagesTableGUI.php';
200 $tpl->setContent(implode(
'<br />', array(
201 $stats_table->getHTML(),
202 $usage_table->getHTML()
219 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
221 if ((!$question_type) and ($question_id > 0))
226 if (strlen($question_type) == 0)
return NULL;
231 $question =&
new $question_type_gui();
234 $question->object->feedbackOBJ =
new $feedbackObjectClassname($question->object, $ilCtrl, $ilDB, $lng);
236 if ($question_id > 0)
238 $question->object->loadFromDb($question_id);
249 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
250 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
261 return $q_type .
"GUI";
278 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
287 $this->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.il_as_qpl_content.html",
"Modules/TestQuestionPool");
288 $this->tpl->addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
289 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_question.html",
"Modules/TestQuestionPool");
300 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
303 $page_gui->setOutputMode(
"presentation");
304 $presentation = $page_gui->presentation();
305 $presentation = preg_replace(
"/src=\"\\.\\//ims",
"src=\"" . ILIAS_HTTP_PATH .
"/", $presentation);
306 return $presentation;
312 function outQuestionPage($a_temp_var, $a_postponed =
false, $active_id =
"", $html =
"")
317 $postponed =
" (" . $this->lng->txt(
"postponed") .
")";
320 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
321 $this->lng->loadLanguageModule(
"content");
326 $page_gui->setQuestionHTML(array($this->object->getId() => $html));
328 $page_gui->setOutputMode(
"presentation");
330 include_once
"./Modules/Test/classes/class.ilObjTest.php";
335 $obligatoryString =
'([-_-])';
339 $obligatoryString =
'';
342 switch ($title_output)
345 $page_gui->setPresentationTitle(sprintf($this->lng->txt(
"tst_position"), $this->
getSequenceNumber(), $this->
getQuestionCount()).
" - ".$this->object->getTitle().$postponed . $obligatoryString);
352 if( !is_null($this->questionHeaderBlockBuilder) )
354 $questionBlockHeader = $this->questionHeaderBlockBuilder->getHTML();
358 $maxpoints = $this->
object->getMaximumPoints();
361 $maxpoints =
" (".$maxpoints.
" ".$this->lng->txt(
"point").
")";
365 $maxpoints =
" (".$maxpoints.
" ".$this->lng->txt(
"points").
")";
367 $questionBlockHeader = sprintf($this->lng->txt(
"tst_position"), $this->
getSequenceNumber(), $this->
getQuestionCount()).
" - ".$this->object->getTitle().$postponed.$maxpoints . $obligatoryString;
370 $page_gui->setPresentationTitle($questionBlockHeader);
373 $presentation = $page_gui->presentation();
374 if (strlen($maxpoints)) $presentation = str_replace($maxpoints,
"<em>$maxpoints</em>", $presentation);
375 if (strlen($obligatoryString))
377 $replacement =
'<br><span class="obligatory" style="font-size:small">'.
378 $this->lng->txt(
"tst_you_have_to_answer_this_question").
'</span>';
379 $presentation = str_replace($obligatoryString, $replacement, $presentation);
381 $presentation = preg_replace(
"/src=\"\\.\\//ims",
"src=\"" . ILIAS_HTTP_PATH .
"/", $presentation);
382 return $presentation;
390 if (
$_GET[
"calling_test"])
395 elseif (
$_GET[
"test_ref_id"])
402 if (
$_GET[
"q_id"] > 0)
404 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id",
$_GET[
"q_id"]);
405 $this->ctrl->redirectByClass(
"ilAssQuestionPageGUI",
"edit");
409 $this->ctrl->redirectByClass(
"ilobjquestionpoolgui",
"questions");
420 if (strlen($return_to))
422 $this->ctrl->setParameter($this,
"return_to", $return_to);
425 $this->ctrl->setParameter($this,
"return_to",
$_REQUEST[
'return_to']);
427 if(strlen($return_to_feedback))
429 $this->ctrl->setParameter($this,
'return_to_fb',
'true');
432 $template =
new ilTemplate(
"tpl.il_as_qpl_sync_original.html",TRUE, TRUE,
"Modules/TestQuestionPool");
433 $template->setVariable(
"BUTTON_YES", $this->lng->txt(
"yes"));
434 $template->setVariable(
"BUTTON_NO", $this->lng->txt(
"no"));
435 $template->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
436 $template->setVariable(
"TEXT_SYNC", $this->lng->txt(
"confirm_sync_questions"));
437 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
442 $original_id = $this->
object->original_id;
445 $this->
object->syncWithOriginal();
447 if (strlen(
$_GET[
"return_to"]))
449 $this->ctrl->redirect($this,
$_GET[
"return_to"]);
453 $this->ctrl->redirectByClass(
'ilAssQuestionFeedbackEditingGUI',
'showFeedbackForm');
457 if(isset(
$_GET[
'calling_consumer']) && (
int)
$_GET[
'calling_consumer'])
459 $ref_id = (int)$_GET[
'calling_consumer'];
463 ilUtil::redirect($consumer->getQuestionEditingFormBackTarget($_GET[
'consumer_context']));
465 require_once
'Services/Link/classes/class.ilLink.php';
468 $_GET[
"ref_id"] = $_GET[
"calling_test"];
469 ilUtil::redirect(
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=".$_GET[
"calling_test"]);
475 if (strlen(
$_GET[
"return_to"]))
477 $this->ctrl->redirect($this,
$_GET[
"return_to"]);
481 $this->ctrl->redirectByClass(
'ilAssQuestionFeedbackEditingGUI',
'showFeedbackForm');
485 if(isset(
$_GET[
'calling_consumer']) && (
int)
$_GET[
'calling_consumer'])
487 $ref_id = (int)$_GET[
'calling_consumer'];
491 ilUtil::redirect($consumer->getQuestionEditingFormBackTarget($_GET[
'consumer_context']));
493 require_once
'Services/Link/classes/class.ilLink.php';
496 $_GET[
"ref_id"] = $_GET[
"calling_test"];
497 ilUtil::redirect(
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=".$_GET[
"calling_test"]);
511 $ilUser->setPref(
"tst_lastquestiontype", $this->object->getQuestionType());
512 $ilUser->writePref(
"tst_lastquestiontype", $this->object->getQuestionType());
513 $this->
object->saveToDb();
514 $originalexists = $this->
object->_questionExists($this->object->original_id);
515 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
518 $this->ctrl->redirect($this,
"originalSyncForm");
520 elseif (
$_GET[
"calling_test"])
526 elseif (
$_GET[
"test_ref_id"])
528 global $tree,
$ilDB, $ilPluginAdmin;
530 include_once (
"./Modules/Test/classes/class.ilObjTest.php");
534 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
537 $test->insertQuestion( $testQuestionSetConfigFactory->getQuestionSetConfig(), $this->
object->getId() );
543 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
544 $this->editQuestion();
553 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id", $this->object->getId());
554 $this->ctrl->redirectByClass(
"ilAssQuestionPageGUI",
"edit");
565 $old_id =
$_GET[
"q_id"];
570 $ilUser->setPref(
"tst_lastquestiontype", $this->object->getQuestionType());
571 $ilUser->writePref(
"tst_lastquestiontype", $this->object->getQuestionType());
572 $this->
object->saveToDb();
573 $originalexists = $this->
object->_questionExistsInPool($this->object->original_id);
576 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
580 $this->ctrl->setParameter($this,
'return_to',
'editQuestion');
581 $this->ctrl->redirect($this,
"originalSyncForm");
584 elseif($_GET[
"calling_test"])
586 require_once
'Modules/Test/classes/class.ilObjTest.php';
590 global $tree,
$ilDB, $ilPluginAdmin;
592 include_once(
"./Modules/Test/classes/class.ilObjTest.php");
593 $_GET[
"ref_id"] = $_GET[
"calling_test"];
596 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
599 $new_id =
$test->insertQuestion(
600 $testQuestionSetConfigFactory->getQuestionSetConfig(), $this->
object->getId()
605 $test->moveQuestionAfter($this->object->getId() + 1,
$_REQUEST[
'prev_qid']);
608 $this->ctrl->setParameter($this,
'q_id', $new_id);
609 $this->ctrl->setParameter($this,
'calling_test', $_GET[
'calling_test']);
610 #$this->ctrl->setParameter($this, 'test_ref_id', false);
613 $this->ctrl->redirect($this,
'editQuestion');
620 if($this->object->getId() != $old_id)
623 $this->ctrl->setParameterByClass($_GET[
"cmdClass"],
"q_id", $this->object->getId());
624 $this->ctrl->setParameterByClass($_GET[
"cmdClass"],
"sel_question_types", $_GET[
"sel_question_types"]);
635 include_once(
"./Modules/Test/classes/class.ilObjTest.php");
637 $test->moveQuestionAfter(
$_REQUEST[
'prev_qid'], $this->object->getId());
641 global $tree,
$ilDB, $ilPluginAdmin;
643 include_once(
"./Modules/Test/classes/class.ilObjTest.php");
646 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
649 $test->insertQuestion(
650 $testQuestionSetConfigFactory->getQuestionSetConfig(), $this->
object->getId()
653 require_once
'Modules/Test/classes/class.ilTestExpressPage.php';
654 $_REQUEST[
'q_id'] = $this->
object->getId();
658 $this->ctrl->redirectByClass($_GET[
"cmdClass"],
"editQuestion");
668 $this->ctrl->redirect($this,
'editQuestion');
679 $old_id =
$_GET[
"q_id"];
683 $ilUser->setPref(
"tst_lastquestiontype", $this->object->getQuestionType());
684 $ilUser->writePref(
"tst_lastquestiontype", $this->object->getQuestionType());
685 $this->
object->saveToDb();
686 $originalexists = $this->
object->_questionExistsInPool($this->object->original_id);
687 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
691 $this->ctrl->redirect($this,
"originalSyncForm");
694 elseif($_GET[
"calling_test"])
696 require_once
'Modules/Test/classes/class.ilObjTest.php';
698 #var_dump(assQuestion::_questionExistsInTest($this->object->getId(), $test->getTestId()));
699 $q_id = $this->
object->getId();
702 global $tree,
$ilDB, $ilPluginAdmin;
704 include_once(
"./Modules/Test/classes/class.ilObjTest.php");
705 $_GET[
"ref_id"] = $_GET[
"calling_test"];
708 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
711 $new_id =
$test->insertQuestion(
712 $testQuestionSetConfigFactory->getQuestionSetConfig(), $this->
object->getId()
718 $test->moveQuestionAfter($this->object->getId() + 1,
$_REQUEST[
'prev_qid']);
721 $this->ctrl->setParameter($this,
'q_id', $new_id);
722 $this->ctrl->setParameter($this,
'calling_test', $_GET[
'calling_test']);
723 #$this->ctrl->setParameter($this, 'test_ref_id', false);
735 ilUtil::redirect(
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=" . $_GET[
"calling_test"]);
740 if($this->object->getId() != $old_id)
744 $this->ctrl->redirectByClass(
"ilobjquestionpoolgui",
"questions");
754 $this->ctrl->redirectByClass(
"ilobjquestionpoolgui",
"questions");
765 $this->
object->saveToDb();
766 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
767 $this->editQuestion();
780 $tmpPath = $cont_obj->getLMTree()->getPathFull($a_endnode_id, $a_startnode_id);
783 for ($i = 1; $i < (count($tmpPath) - 1); $i++)
790 $path .= $tmpPath[$i][
"title"];
798 $this->sequence_no = $nr;
808 $this->question_count = $a_question_count;
828 $this->errormessage .= ((strlen($this->errormessage)) ?
"<br />" :
"") .
$errormessage;
845 return $this->
object->getQuestionType();
858 if (strlen($a_value))
860 $result =
" value=\"$a_value\" ";
872 $cnt = $this->new_id_listener_cnt;
873 $this->new_id_listeners[$cnt][
"object"] =& $a_object;
874 $this->new_id_listeners[$cnt][
"method"] = $a_method;
875 $this->new_id_listeners[$cnt][
"parameters"] = $a_parameters;
876 $this->new_id_listener_cnt++;
885 for ($i=0; $i<$this->new_id_listener_cnt; $i++)
887 $this->new_id_listeners[$i][
"parameters"][
"new_id"] = $a_new_id;
888 $object =& $this->new_id_listeners[$i][
"object"];
889 $method = $this->new_id_listeners[$i][
"method"];
890 $parameters = $this->new_id_listeners[$i][
"parameters"];
905 if(!$this->object->getSelfAssessmentEditingMode())
907 $form->addCommandButton(
"saveReturn", $this->lng->txt(
"save_return"));
909 $form->addCommandButton(
"save", $this->lng->txt(
"save"));
923 $title->setValue($this->object->getTitle());
924 $title->setRequired(TRUE);
925 $form->addItem($title);
927 if (!$this->object->getSelfAssessmentEditingMode())
930 $author =
new ilTextInputGUI($this->lng->txt(
"author"),
"author");
931 $author->
setValue($this->object->getAuthor());
932 $author->setRequired(TRUE);
933 $form->addItem($author);
936 $description =
new ilTextInputGUI($this->lng->txt(
"description"),
"comment");
937 $description->
setValue($this->object->getComment());
938 $description->setRequired(FALSE);
939 $form->addItem($description);
946 if (trim($author) ==
"")
950 $hi->setValue($author);
957 $question->
setValue($this->object->prepareTextareaOutput($this->object->getQuestion()));
958 $question->setRequired(TRUE);
959 $question->setRows(10);
960 $question->setCols(80);
961 if (!$this->object->getSelfAssessmentEditingMode())
965 $question->setUseRte(TRUE);
966 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
968 $question->addPlugin(
"latex");
969 $question->addButton(
"latex");
970 $question->addButton(
"pastelatex");
971 $question->setRTESupport($this->object->getId(),
"qpl",
"assessment");
976 $question->setRteTags(self::getSelfAssessmentTags());
977 $question->setUseTagsForRteOnly(
false);
979 $form->addItem($question);
981 if (!$this->object->getSelfAssessmentEditingMode())
986 $duration->setShowMinutes(TRUE);
987 $duration->setShowSeconds(TRUE);
988 $ewt = $this->
object->getEstimatedWorkingTime();
989 $duration->setHours($ewt[
"h"]);
990 $duration->setMinutes($ewt[
"m"]);
991 $duration->setSeconds($ewt[
"s"]);
992 $duration->setRequired(FALSE);
993 $form->addItem($duration);
998 if (strlen($this->object->getNrOfTries()))
1000 $nr_tries = $this->
object->getNrOfTries();
1004 $nr_tries = $this->
object->getDefaultNrOfTries();
1011 $ni =
new ilNumberInputGUI($this->lng->txt(
"qst_nr_of_tries"),
"nr_of_tries");
1013 $ni->setMinValue(0);
1015 $ni->setMaxLength(5);
1016 $form->addItem($ni);
1024 require_once
'Services/Taxonomy/classes/class.ilTaxAssignInputGUI.php';
1028 $postvar =
"tax_node_assign_$taxonomyId";
1032 $tax_node_assign->saveInput(
"qpl", $this->object->getObjId(),
"quest", $this->
object->getId());
1042 $sectHeader->setTitle($this->lng->txt(
'qpl_qst_edit_form_taxonomy_section'));
1045 require_once
'Services/Taxonomy/classes/class.ilTaxAssignInputGUI.php';
1050 $label = sprintf($this->lng->txt(
'qpl_qst_edit_form_taxonomy'), $taxonomy->getTitle());
1051 $postvar =
"tax_node_assign_$taxonomyId";
1055 $taxNodeAssign->
setCurrentValues(
'qpl', $this->object->getObjId(),
'quest', $this->
object->getId());
1056 $form->
addItem($taxNodeAssign);
1072 $not_supported = array(
"img",
"p");
1076 if (!in_array($s, $not_supported))
1112 include_once
"./Modules/Test/classes/class.ilObjTest.php";
1114 if (strlen($manual_feedback))
1116 return $manual_feedback;
1118 $correct_feedback = $this->
object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(),
true);
1119 $incorrect_feedback = $this->
object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(),
false);
1120 if (strlen($correct_feedback.$incorrect_feedback))
1122 $reached_points = $this->
object->calculateReachedPoints($active_id,
$pass);
1123 $max_points = $this->
object->getMaximumPoints();
1124 if ($reached_points == $max_points)
1126 $output = $correct_feedback;
1130 $output = $incorrect_feedback;
1133 return $this->
object->prepareTextareaOutput($output, TRUE);
1138 return $this->
object->prepareTextareaOutput(
1139 $this->object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(),
true),
true
1145 return $this->
object->prepareTextareaOutput(
1146 $this->object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(),
false),
true
1165 $count = $this->
object->isInUse();
1170 if ($rbacsystem->checkAccess(
"write",
$_GET[
"ref_id"]))
1172 ilUtil::sendInfo(sprintf($this->lng->txt(
"qpl_question_is_in_use"), $count));
1194 $save = (is_array(
$_POST[
"cmd"]) && array_key_exists(
"suggestedsolution",
$_POST[
"cmd"])) ? TRUE : FALSE;
1196 if ($save &&
$_POST[
"deleteSuggestedSolution"] == 1)
1198 $this->
object->deleteSuggestedSolutions();
1200 $this->ctrl->redirect($this,
"suggestedsolution");
1204 $solution_array = $this->
object->getSuggestedSolution(0);
1206 "lm" => $this->lng->txt(
"obj_lm"),
1207 "st" => $this->lng->txt(
"obj_st"),
1208 "pg" => $this->lng->txt(
"obj_pg"),
1209 "git" => $this->lng->txt(
"glossary_term"),
1210 "file" => $this->lng->txt(
"fileDownload"),
1211 "text" => $this->lng->txt(
"solutionText")
1214 if ((strcmp(
$_POST[
"solutiontype"],
"file") == 0) && (strcmp($solution_array[
"type"],
"file") != 0))
1216 $solution_array = array(
1220 elseif ((strcmp(
$_POST[
"solutiontype"],
"text") == 0) && (strcmp($solution_array[
"type"],
"text") != 0))
1222 $solution_array = array(
1227 if ($save && strlen(
$_POST[
"filename"]))
1229 $solution_array[
"value"][
"filename"] =
$_POST[
"filename"];
1231 if ($save && strlen(
$_POST[
"solutiontext"]))
1233 $solution_array[
"value"] =
$_POST[
"solutiontext"];
1235 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1236 if (count($solution_array))
1239 $form->setFormAction($this->ctrl->getFormAction($this));
1240 $form->setTitle($this->lng->txt(
"solution_hint"));
1241 $form->setMultipart(TRUE);
1242 $form->setTableWidth(
"100%");
1243 $form->setId(
"suggestedsolutiondisplay");
1246 include_once
"./Modules/TestQuestionPool/classes/class.ilSolutionTitleInputGUI.php";
1248 $template =
new ilTemplate(
"tpl.il_as_qpl_suggested_solution_input_presentation.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1249 if (strlen($solution_array[
"internal_link"]))
1252 $template->setCurrentBlock(
"preview");
1253 $template->setVariable(
"TEXT_SOLUTION", $this->lng->txt(
"suggested_solution"));
1254 $template->setVariable(
"VALUE_SOLUTION",
" <a href=\"$href\" target=\"content\">" . $this->lng->txt(
"view").
"</a> ");
1255 $template->parseCurrentBlock();
1257 elseif ((strcmp($solution_array[
"type"],
"file") == 0) && (is_array($solution_array[
"value"])))
1259 $href = $this->
object->getSuggestedSolutionPathWeb() . $solution_array[
"value"][
"name"];
1260 $template->setCurrentBlock(
"preview");
1261 $template->setVariable(
"TEXT_SOLUTION", $this->lng->txt(
"suggested_solution"));
1262 $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> ");
1263 $template->parseCurrentBlock();
1265 $template->setVariable(
"TEXT_TYPE", $this->lng->txt(
"type"));
1266 $template->setVariable(
"VALUE_TYPE",
$options[$solution_array[
"type"]]);
1267 $title->
setHtml($template->get());
1269 $deletesolution->setOptionTitle($this->lng->txt(
"deleteSuggestedSolution"));
1270 $title->addSubItem($deletesolution);
1271 $form->addItem($title);
1273 if (strcmp($solution_array[
"type"],
"file") == 0)
1277 $file->setRequired(TRUE);
1278 $file->enableFileNameSelection(
"filename");
1280 if( $_FILES[
"file"][
"tmp_name"] &&
$file->checkInput() )
1282 if (!file_exists($this->object->getSuggestedSolutionPath()))
ilUtil::makeDirParents($this->object->getSuggestedSolutionPath());
1284 $res =
ilUtil::moveUploadedFile($_FILES[
"file"][
"tmp_name"], $_FILES[
"file"][
"name"], $this->object->getSuggestedSolutionPath() . $_FILES[
"file"][
"name"]);
1290 if (is_array($solution_array[
"value"])) @unlink($this->object->getSuggestedSolutionPath() . $solution_array[
"value"][
"name"]);
1291 $file->setValue($_FILES[
"file"][
"name"]);
1292 $this->
object->saveSuggestedSolution(
"file",
"", 0, array(
"name" => $_FILES[
"file"][
"name"],
"type" => $_FILES[
"file"][
"type"],
"size" => $_FILES[
"file"][
"size"],
"filename" =>
$_POST[
"filename"]));
1293 $originalexists = $this->
object->_questionExistsInPool($this->object->original_id);
1301 $this->ctrl->redirect($this,
"suggestedsolution");
1312 if (is_array($solution_array[
"value"]))
1314 $file->setValue($solution_array[
"value"][
"name"]);
1315 $file->setFilename((strlen($solution_array[
"value"][
"filename"])) ? $solution_array[
"value"][
"filename"] : $solution_array[
"value"][
"name"]);
1318 $form->addItem(
$file);
1320 $hidden->setValue(
"file");
1321 $form->addItem($hidden);
1323 else if (strcmp($solution_array[
"type"],
"text") == 0)
1326 $question->
setValue($this->object->prepareTextareaOutput($solution_array[
"value"]));
1327 $question->setRequired(TRUE);
1328 $question->setRows(10);
1329 $question->setCols(80);
1330 $question->setUseRte(TRUE);
1331 $question->addPlugin(
"latex");
1332 $question->addButton(
"latex");
1333 $question->setRTESupport($this->object->getId(),
"qpl",
"assessment");
1335 $hidden->setValue(
"text");
1336 $form->addItem($hidden);
1337 $form->addItem($question);
1339 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
'ref_id']))
1341 $form->addCommandButton(
'showSuggestedSolution', $this->lng->txt(
'cancel'));
1342 $form->addCommandButton(
'suggestedsolution', $this->lng->txt(
'save'));
1347 if ($form->checkInput())
1349 switch ($solution_array[
"type"])
1352 $this->
object->saveSuggestedSolution(
"file",
"", 0, array(
1353 "name" => $solution_array[
"value"][
"name"],
1354 "type" => $solution_array[
"value"][
"type"],
1355 "size" => $solution_array[
"value"][
"size"],
1356 "filename" =>
$_POST[
"filename"]
1360 $this->
object->saveSuggestedSolution(
"text",
"", 0, $solution_array[
"value"]);
1363 $originalexists = $this->
object->_questionExistsInPool($this->object->original_id);
1371 $this->ctrl->redirect($this,
"suggestedsolution");
1376 $output = $form->getHTML();
1379 $savechange = (strcmp($this->ctrl->getCmd(),
"saveSuggestedSolution") == 0) ? TRUE : FALSE;
1382 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
'ref_id']))
1385 $formchange->setFormAction($this->ctrl->getFormAction($this));
1386 $formchange->setTitle((count($solution_array)) ? $this->lng->txt(
"changeSuggestedSolution") : $this->lng->txt(
"addSuggestedSolution"));
1387 $formchange->setMultipart(FALSE);
1388 $formchange->setTableWidth(
"100%");
1389 $formchange->setId(
"suggestedsolution");
1391 $solutiontype =
new ilRadioGroupInputGUI($this->lng->txt(
"suggestedSolutionType"),
"solutiontype");
1392 foreach(
$options as $opt_value => $opt_caption)
1396 if (count($solution_array))
1398 $solutiontype->setValue($solution_array[
"type"]);
1400 $solutiontype->setRequired(TRUE);
1401 $formchange->addItem($solutiontype);
1403 $formchange->addCommandButton(
"saveSuggestedSolution", $this->lng->txt(
"select"));
1407 $formchange->checkInput();
1409 $changeoutput = $formchange->getHTML();
1412 $this->tpl->setVariable(
"ADM_CONTENT", $changeoutput . $output);
1419 include_once(
"./Modules/TestQuestionPool/classes/class.ilSolutionExplorer.php");
1420 $type =
$_GET[
"link_new_type"];
1421 $search =
$_GET[
"search_link_type"];
1422 $this->ctrl->setParameter($this,
"link_new_type", $type);
1423 $this->ctrl->setParameter($this,
"search_link_type", $search);
1424 $this->ctrl->saveParameter($this, array(
"subquestion_index",
"link_new_type",
"search_link_type"));
1428 $parent_ref_id = $tree->getParentId(
$_GET[
"ref_id"]);
1429 $exp =
new ilSolutionExplorer($this->ctrl->getLinkTarget($this,
'suggestedsolution'), get_class($this));
1431 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,
'outSolutionExplorer'));
1432 $exp->setTargetGet(
"ref_id");
1433 $exp->setRefId(
$_GET[
"ref_id"]);
1434 $exp->addFilter($type);
1435 $exp->setSelectableType($type);
1436 if(isset(
$_GET[
'expandCurrentPath']) &&
$_GET[
'expandCurrentPath'])
1438 $exp->expandPathByRefId($parent_ref_id);
1444 $template =
new ilTemplate(
"tpl.il_as_qpl_explorer.html", TRUE, TRUE,
"Modules/TestQuestionPool");
1445 $template->setVariable(
"EXPLORER_TREE",$exp->getOutput());
1446 $template->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
1447 $template->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this,
"suggestedsolution"));
1448 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
1455 include_once(
"./Modules/TestQuestionPool/classes/class.ilSolutionExplorer.php");
1456 switch (
$_POST[
"solutiontype"])
1482 if(isset(
$_POST[
'solutiontype']))
1484 $this->ctrl->setParameter($this,
'expandCurrentPath', 1);
1486 $this->ctrl->setParameter($this,
"link_new_type", $type);
1487 $this->ctrl->setParameter($this,
"search_link_type", $search);
1488 $this->ctrl->redirect($this,
"outSolutionExplorer");
1493 $this->ctrl->redirect($this,
"suggestedsolution");
1498 require_once
'Modules/TestQuestionPool/classes/tables/class.ilQuestionInternalLinkSelectionTableGUI.php';
1499 require_once
'Modules/LearningModule/classes/class.ilLMPageObject.php';
1500 require_once
'Modules/LearningModule/classes/class.ilObjContentObjectGUI.php';
1502 $this->ctrl->setParameter($this,
'q_id', $this->object->getId());
1505 $cont_obj = $cont_obj_gui->object;
1507 $shownpages = array();
1508 $tree = $cont_obj->getLMTree();
1509 $chapters = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
1513 foreach($chapters as $chapter)
1515 $chapterpages = $tree->getChildsByType($chapter[
'obj_id'],
'pg');
1516 foreach($chapterpages as $page)
1518 if($page[
'type'] ==
$_GET[
'search_link_type'])
1520 array_push($shownpages, $page[
'obj_id']);
1522 if($tree->isInTree($page[
'obj_id']))
1531 $this->ctrl->setParameter($this, $page[
'type'], $page[
'obj_id']);
1533 'title' => $page[
'title'],
1535 'text_add' => $this->lng->txt(
'add'),
1536 'href_add' => $this->ctrl->getLinkTarget($this,
'add' . strtoupper($page[
'type']))
1541 foreach($pages as $page)
1543 if(!in_array($page[
'obj_id'], $shownpages))
1545 $this->ctrl->setParameter($this, $page[
'type'], $page[
'obj_id']);
1547 'title' => $page[
'title'],
1548 'description' =>
'---',
1549 'text_add' => $this->lng->txt(
'add'),
1550 'href_add' => $this->ctrl->getLinkTarget($this,
'add' . strtoupper($page[
'type']))
1555 require_once
'Modules/TestQuestionPool/classes/tables/class.ilQuestionInternalLinkSelectionTableGUI.php';
1558 $table->setData($rows);
1560 $this->tpl->setContent($table->getHTML());
1565 require_once
'Modules/TestQuestionPool/classes/tables/class.ilQuestionInternalLinkSelectionTableGUI.php';
1566 require_once
'Modules/LearningModule/classes/class.ilObjContentObjectGUI.php';
1568 $this->ctrl->setParameter($this,
'q_id', $this->object->getId());
1571 $cont_obj = $cont_obj_gui->object;
1572 $ctree = $cont_obj->getLMTree();
1573 $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
1577 foreach($nodes as $node)
1579 if($node[
'type'] ==
$_GET[
'search_link_type'])
1581 $this->ctrl->setParameter($this, $node[
'type'], $node[
'obj_id']);
1583 'title' => $node[
'title'],
1584 'description' =>
'',
1585 'text_add' => $this->lng->txt(
'add'),
1586 'href_add' => $this->ctrl->getLinkTarget($this,
'add' . strtoupper($node[
'type']))
1593 $table->setData($rows);
1595 $this->tpl->setContent($table->getHTML());
1600 require_once
'Modules/TestQuestionPool/classes/tables/class.ilQuestionInternalLinkSelectionTableGUI.php';
1601 require_once
'Modules/Glossary/classes/class.ilObjGlossary.php';
1603 $this->ctrl->setParameter($this,
'q_id', $this->object->getId());
1606 $terms = $glossary->getTermList();
1610 foreach($terms as $term)
1612 $this->ctrl->setParameter($this,
'git', $term[
'id']);
1614 'title' => $term[
'term'],
1615 'description' =>
'',
1616 'text_add' => $this->lng->txt(
'add'),
1617 'href_add' => $this->ctrl->getLinkTarget($this,
'addGIT')
1622 $table->setTitle($this->lng->txt(
'glossary_term'));
1623 $table->setData($rows);
1625 $this->tpl->setContent($table->getHTML());
1630 $this->ctrl->saveParameter($this, array(
"subquestion_index",
"link_new_type",
"search_link_type"));
1631 switch (
$_GET[
"search_link_type"])
1643 $subquestion_index = (
$_GET[
"subquestion_index"] > 0) ?
$_GET[
"subquestion_index"] : 0;
1644 $this->
object->saveSuggestedSolution(
"lm",
"il__lm_" .
$_GET[
"source_id"], $subquestion_index);
1646 $this->ctrl->redirect($this,
"suggestedsolution");
1653 $subquestion_index = 0;
1654 if (strlen(
$_GET[
"subquestion_index"]) &&
$_GET[
"subquestion_index"] >= 0)
1656 $subquestion_index =
$_GET[
"subquestion_index"];
1658 $this->
object->saveSuggestedSolution(
"pg",
"il__pg_" .
$_GET[
"pg"], $subquestion_index);
1660 $this->ctrl->redirect($this,
"suggestedsolution");
1665 $subquestion_index = 0;
1666 if (strlen(
$_GET[
"subquestion_index"]) &&
$_GET[
"subquestion_index"] >= 0)
1668 $subquestion_index =
$_GET[
"subquestion_index"];
1670 $this->
object->saveSuggestedSolution(
"st",
"il__st_" .
$_GET[
"st"], $subquestion_index);
1672 $this->ctrl->redirect($this,
"suggestedsolution");
1677 $subquestion_index = 0;
1678 if (strlen(
$_GET[
"subquestion_index"]) &&
$_GET[
"subquestion_index"] >= 0)
1680 $subquestion_index =
$_GET[
"subquestion_index"];
1682 $this->
object->saveSuggestedSolution(
"git",
"il__git_" .
$_GET[
"git"], $subquestion_index);
1684 $this->ctrl->redirect($this,
"suggestedsolution");
1689 return in_array($this->ctrl->getCmd(), array(
'save',
'saveEdit',
'saveReturn'));
1702 $reflectionClass =
new ReflectionClass($guiClassName);
1706 if( $reflectionClass instanceof ReflectionClass )
1708 $commands = array();
1710 foreach($reflectionClass->getConstants() as $constName => $constValue)
1712 if( substr($constName, 0, strlen($cmdConstantNameBegin)) == $cmdConstantNameBegin )
1714 $commands[] = $constValue;
1724 global $rbacsystem, $ilTabs;
1726 $ilTabs->clearTargets();
1728 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id",
$_GET[
"q_id"]);
1729 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
1730 $q_type = $this->
object->getQuestionType();
1732 if (strlen($q_type))
1734 $classname = $q_type .
"GUI";
1735 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
1736 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
1741 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
1744 $ilTabs->addTarget(
"edit_page",
1745 $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI",
"edit"),
1746 array(
"edit",
"insert",
"exec_pg"),
1747 "",
"", $force_active);
1752 $force_active =
false;
1753 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
1756 if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
1757 $force_active =
false;
1759 $ilTabs->addTarget(
"edit_question",
1762 $classname,
"", $force_active);
1777 $ilTabs->addTarget(
"statistics",
1778 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
1779 array(
"assessment"),
1791 $this->ctrl->getLinkTargetByClass($classname,
"suggestedsolution"),
1792 array(
"suggestedsolution",
"saveSuggestedSolution",
"outSolutionExplorer",
"cancel",
1793 "addSuggestedSolution",
"cancelExplorer",
"linkChilds",
"removeSuggestedSolution"
1808 return array(
'editQuestion',
'save',
'saveEdit',
'originalSyncForm');
1826 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
1831 $tabs->
addTarget(
'tst_feedback', $tabLink, $tabCommands, $ilCtrl->getCmdClass(),
'');
1837 protected function addTab_Units(
ilTabsGUI $tabs)
1844 $tabs->
addTarget(
'units', $ilCtrl->getLinkTargetByClass(
'ilLocalUnitConfigurationGUI',
''),
'',
'illocalunitconfigurationgui');
1857 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsGUI.php';
1859 switch( $ilCtrl->getCmdClass() )
1861 case 'ilassquestionhintsgui':
1866 case 'ilassquestionhintgui':
1868 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintGUI.php';
1874 $tabCommands = array();
1879 $tabs->
addTarget(
'tst_question_hints_tab', $tabLink, $tabCommands, $ilCtrl->getCmdClass(),
'');
1884 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewGUI.php';
1890 array(
'ilAssQuestionPreviewGUI')
1897 $graphicalOutput = FALSE,
1898 $result_output = FALSE,
1899 $show_question_only = TRUE,
1900 $show_feedback = FALSE,
1901 $show_correct_solution = FALSE,
1902 $show_manual_scoring = FALSE,
1903 $show_question_text = TRUE
1908 return $this->
object->isAutosaveable();
1913 $this->
object->setTitle(
$_POST[
"title"] );
1914 $this->
object->setAuthor(
$_POST[
"author"] );
1915 $this->
object->setComment(
$_POST[
"comment"] );
1916 if ($this->object->getSelfAssessmentEditingMode())
1918 $this->
object->setNrOfTries(
$_POST[
'nr_of_tries'] );
1921 $this->
object->setEstimatedWorkingTime(
1922 $_POST[
"Estimated"][
"hh"],
1923 $_POST[
"Estimated"][
"mm"],
1924 $_POST[
"Estimated"][
"ss"]
1928 abstract public function getPreview($show_question_only = FALSE, $showInlineFeedback =
false);
1942 $is_question_postponed = FALSE,
1943 $user_post_solutions = FALSE,
1944 $show_specific_inline_feedback = FALSE
1947 $test_output = $this->getTestOutput(
1950 $is_question_postponed,
1951 $user_post_solutions,
1952 $show_specific_inline_feedback
1955 $this->tpl->setVariable(
"QUESTION_OUTPUT", $test_output);
1956 $this->tpl->setVariable(
"FORMACTION", $formaction);
1970 if((
$_GET[
"calling_test"] > 0) || (
$_GET[
"test_ref_id"] > 0))
1975 if(!
$_GET[
'test_express_mode'] && !
$GLOBALS[
'___test_express_mode'])
1977 $ilTabs->
setBackTarget($this->lng->txt(
"backtocallingtest"),
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
1982 $ilTabs->
setBackTarget($this->lng->txt(
"backtocallingtest"), $link);
1985 else if(isset(
$_GET[
'calling_consumer']) && (int)
$_GET[
'calling_consumer'])
1987 $ref_id = (int)$_GET[
'calling_consumer'];
1991 $ilTabs->
setBackTarget($consumer->getQuestionEditingFormBackTargetLabel(), $consumer->getQuestionEditingFormBackTarget($_GET[
'consumer_context']));
1995 require_once
'Services/Link/classes/class.ilLink.php';
2001 $ilTabs->
setBackTarget($this->lng->txt(
"qpl"), $this->ctrl->getLinkTargetByClass(
"ilobjquestionpoolgui",
"questions"));
2031 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
2034 $form->setFormAction($this->ctrl->getFormAction($this));
2036 $form->setId($this->
getType());
2039 $form->setTableWidth(
'100%');
2041 $form->setMultipart(
true);