4use Psr\Http\Message\RequestInterface;
 
    5use Psr\Http\Message\ServerRequestInterface;
 
    7require_once 
'./Modules/Test/classes/inc.AssessmentConstants.php';
 
    8require_once 
'Modules/Test/classes/class.ilTestExpressPage.php';
 
    9require_once 
'Modules/TestQuestionPool/exceptions/class.ilTestQuestionPoolException.php';
 
   10require_once 
'Modules/Test/classes/class.ilTestExpressPage.php';
 
   11require_once 
'Modules/Test/classes/class.ilObjAssessmentFolder.php';
 
  138        $ilCtrl = 
$DIC[
'ilCtrl'];
 
  142        $this->ctrl = &$ilCtrl;
 
  143        $this->request = 
$DIC->http()->request();
 
  145        $this->ctrl->saveParameter($this, 
"q_id");
 
  146        $this->ctrl->saveParameter($this, 
"prev_qid");
 
  147        $this->ctrl->saveParameter($this, 
"calling_test");
 
  148        $this->ctrl->saveParameter($this, 
"calling_consumer");
 
  149        $this->ctrl->saveParameter($this, 
"consumer_context");
 
  150        $this->ctrl->saveParameterByClass(
'ilAssQuestionPageGUI', 
'test_express_mode');
 
  151        $this->ctrl->saveParameterByClass(
'ilAssQuestionPageGUI', 
'calling_consumer');
 
  152        $this->ctrl->saveParameterByClass(
'ilAssQuestionPageGUI', 
'consumer_context');
 
  153        $this->ctrl->saveParameterByClass(
'ilobjquestionpoolgui', 
'test_express_mode');
 
  154        $this->ctrl->saveParameterByClass(
'ilobjquestionpoolgui', 
'calling_consumer');
 
  155        $this->ctrl->saveParameterByClass(
'ilobjquestionpoolgui', 
'consumer_context');
 
  157        $this->errormessage = $this->lng->txt(
"fill_out_all_required_fields");
 
  158        $this->selfassessmenteditingmode = 
false;
 
  159        $this->new_id_listeners = array();
 
  160        $this->new_id_listener_cnt = 0;
 
  161        $this->navigationGUI = 
null;
 
  181        echo $this->
getHeaderAction() . $DIC->ui()->mainTemplate()->getOnLoadCodeForAsynch();
 
  189        $ilObjDataCache = 
$DIC[
'ilObjDataCache'];
 
  191        $parentObjType = $ilObjDataCache->lookupType($this->object->getObjId());
 
  198            $this->object->getObjId()
 
  201        $dispatcher->setSubObject(
"quest", $this->object->getId());
 
  203        $ha = $dispatcher->initHeaderAction();
 
  204        $ha->enableComments(
true, 
false);
 
  206        return $ha->getHeaderAction(
$DIC->ui()->mainTemplate());
 
  211        $notesGUI = 
new ilNoteGUI($this->object->getObjId(), $this->object->getId(), 
'quest');
 
  212        $notesGUI->enablePublicNotes(
true);
 
  213        $notesGUI->enablePublicNotesDeletion(
true);
 
  215        return $notesGUI->getNotesHTML();
 
  224        $DIC[
'ilHelp']->setScreenIdComponent(
'qpl');
 
  226        $next_class = $this->ctrl->getNextClass($this);
 
  228        switch ($next_class) {
 
  229            case 'ilformpropertydispatchgui':
 
  233                $this->ctrl->forwardCommand($form_prop_dispatch);
 
  237                $cmd = $this->ctrl->getCmd(
'editQuestion');
 
  239                if (in_array($cmd, [
'save', 
'saveReturn',
'saveFQ', 
'saveReturnFQ', 
'editQuestion'])) {
 
  245                if (method_exists($this, $cmd)) {
 
  251                    $this->callSpecialQuestionCommands($cmd);
 
  258        return static::HAS_SPECIAL_QUESTION_COMMANDS;
 
  462        if (is_object($this->
object)) {
 
  494        $tpl->setContent(implode(
'<br />', array(
 
  495            $stats_table->getHTML(),
 
  496            $usage_table->getHTML()
 
  512        $ilCtrl = 
$DIC[
'ilCtrl'];
 
  516        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
  518        if ((!$question_type) and ($question_id > 0)) {
 
  522        if (strlen($question_type) == 0) {
 
  529        $question = 
new $question_type_gui();
 
  532        $question->object->feedbackOBJ = 
new $feedbackObjectClassname($question->object, $ilCtrl, 
$ilDB, 
$lng);
 
  534        if ($question_id > 0) {
 
  535            $question->object->loadFromDb($question_id);
 
  546        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
  547        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
 
  558        return $q_type . 
"GUI";
 
  575        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
 
  582            $tpl->addJavaScript($jsFile);
 
  597        if (!$this->tpl->blockExists(
'content')) {
 
  598            $this->tpl->addBlockFile(
"CONTENT", 
"content", 
"tpl.il_as_qpl_content.html", 
"Modules/TestQuestionPool");
 
  601        if (!$this->tpl->blockExists(
'statusline')) {
 
  602            $this->tpl->addBlockFile(
"STATUSLINE", 
"statusline", 
"tpl.statusline.html");
 
  605        if (!$this->tpl->blockExists(
'adm_content')) {
 
  606            $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_as_question.html", 
"Modules/TestQuestionPool");
 
  616        $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
 
  627        include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
 
  629        $page_gui->setQuestionHTML(array($this->object->getId() => $html));
 
  630        $presentation = $page_gui->presentation();
 
  631        $presentation = preg_replace(
"/src=\"\\.\\//ims", 
"src=\"" . ILIAS_HTTP_PATH . 
"/", $presentation);
 
  632        return $presentation;
 
  638    public function outQuestionPage($a_temp_var, $a_postponed = 
false, $active_id = 
"", $html = 
"", $inlineFeedbackEnabled = 
false)
 
  642        if ($this->object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
 
  650        ($this->
object->getTestPresentationConfig()->isUnchangedAnswerPossible()) {
 
  656        $this->lng->loadLanguageModule(
"content");
 
  659        include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
 
  661        $page_gui->setOutputMode(
"presentation");
 
  662        $page_gui->setTemplateTargetVar($a_temp_var);
 
  666            $page_gui->setQuestionActionsHTML($this->
getNavigationGUI()->getActionsHTML());
 
  671            $page_gui->setQuestionHTML(array($this->object->getId() => $html));
 
  675        $page_gui->setPresentationTitle($this->questionHeaderBlockBuilder->getPresentationTitle());
 
  676        $page_gui->setQuestionInfoHTML($this->questionHeaderBlockBuilder->getQuestionInfoHTML());
 
  679        return $page_gui->presentation();
 
  686        $tpl = 
new ilTemplate(
'tpl.tst_question_additional_behaviour_checkbox.html', 
true, 
true, 
'Modules/TestQuestionPool');
 
  687        $tpl->setVariable(
'TXT_FORCE_FORM_DIFF_LABEL', $this->object->getTestPresentationConfig()->getUseUnchangedAnswerLabel());
 
  696        return $this->lng->txt(
'use_previous_solution_advice');
 
  701        $tpl = 
new ilTemplate(
'tpl.tst_question_additional_behaviour_checkbox.html', 
true, 
true, 
'Modules/TestQuestionPool');
 
  703        $tpl->setVariable(
'TXT_FORCE_FORM_DIFF_LABEL', $this->lng->txt(
'use_previous_solution'));
 
  714        if (
$_GET[
"calling_test"]) {
 
  717        } elseif (
$_GET[
"test_ref_id"]) {
 
  721            if (
$_GET[
"q_id"] > 0) {
 
  722                $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI", 
"q_id", 
$_GET[
"q_id"]);
 
  723                $this->ctrl->redirectByClass(
"ilAssQuestionPageGUI", 
"edit");
 
  725                $this->ctrl->redirectByClass(
"ilobjquestionpoolgui", 
"questions");
 
  736        if (strlen($return_to)) {
 
  737            $this->ctrl->setParameter($this, 
"return_to", $return_to);
 
  738        } elseif ($_REQUEST[
'return_to']) {
 
  739            $this->ctrl->setParameter($this, 
"return_to", $_REQUEST[
'return_to']);
 
  741        if (strlen($return_to_feedback)) {
 
  742            $this->ctrl->setParameter($this, 
'return_to_fb', 
'true');
 
  745        $this->ctrl->saveParameter($this, 
'test_express_mode');
 
  747        $template = 
new ilTemplate(
"tpl.il_as_qpl_sync_original.html", 
true, 
true, 
"Modules/TestQuestionPool");
 
  748        $template->setVariable(
"BUTTON_YES", $this->lng->txt(
"yes"));
 
  749        $template->setVariable(
"BUTTON_NO", $this->lng->txt(
"no"));
 
  750        $template->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
 
  751        $template->setVariable(
"TEXT_SYNC", $this->lng->txt(
"confirm_sync_questions"));
 
  752        $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
 
  757        $original_id = $this->
object->original_id;
 
  759            $this->
object->syncWithOriginal();
 
  761        if (strlen(
$_GET[
"return_to"])) {
 
  762            $this->ctrl->redirect($this, 
$_GET[
"return_to"]);
 
  764        if (strlen($_REQUEST[
"return_to_fb"])) {
 
  765            $this->ctrl->redirectByClass(
'ilAssQuestionFeedbackEditingGUI', 
'showFeedbackForm');
 
  767            if (isset(
$_GET[
'calling_consumer']) && (
int) 
$_GET[
'calling_consumer']) {
 
  768                $ref_id = (int) 
$_GET[
'calling_consumer'];
 
  773                require_once 
'Services/Link/classes/class.ilLink.php';
 
  778            if ($_REQUEST[
'test_express_mode']) {
 
  788        if (strlen(
$_GET[
"return_to"])) {
 
  789            $this->ctrl->redirect($this, 
$_GET[
"return_to"]);
 
  791        if (strlen($_REQUEST[
'return_to_fb'])) {
 
  792            $this->ctrl->redirectByClass(
'ilAssQuestionFeedbackEditingGUI', 
'showFeedbackForm');
 
  794            if (isset(
$_GET[
'calling_consumer']) && (
int) 
$_GET[
'calling_consumer']) {
 
  795                $ref_id = (int) 
$_GET[
'calling_consumer'];
 
  800                require_once 
'Services/Link/classes/class.ilLink.php';
 
  805            if ($_REQUEST[
'test_express_mode']) {
 
  823            $ilUser->setPref(
"tst_lastquestiontype", $this->object->getQuestionType());
 
  824            $ilUser->writePref(
"tst_lastquestiontype", $this->object->getQuestionType());
 
  825            $this->
object->saveToDb();
 
  826            $originalexists = $this->
object->_questionExists($this->object->original_id);
 
  827            include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
  829                $this->ctrl->redirect($this, 
"originalSyncForm");
 
  830            } elseif (
$_GET[
"calling_test"]) {
 
  834            } elseif (
$_GET[
"test_ref_id"]) {
 
  836                $tree = 
$DIC[
'tree'];
 
  838                $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
  840                include_once(
"./Modules/Test/classes/class.ilObjTest.php");
 
  844                require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
  847                $test->insertQuestion($testQuestionSetConfigFactory->getQuestionSetConfig(), $this->object->getId());
 
  851                $this->ctrl->setParameter($this, 
"q_id", $this->object->getId());
 
  852                $this->editQuestion();
 
  853                if (strcmp(
$_SESSION[
"info"], 
"") != 0) {
 
  854                    ilUtil::sendSuccess(
$_SESSION[
"info"] . 
"<br />" . $this->lng->txt(
"msg_obj_modified"), 
false);
 
  856                    ilUtil::sendSuccess($this->lng->txt(
"msg_obj_modified"), 
false);
 
  858                $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI", 
"q_id", $this->object->getId());
 
  859                $this->ctrl->redirectByClass(
"ilAssQuestionPageGUI", 
"edit");
 
  871        $old_id = 
$_GET[
"q_id"];
 
  875            $ilUser->setPref(
"tst_lastquestiontype", $this->object->getQuestionType());
 
  876            $ilUser->writePref(
"tst_lastquestiontype", $this->object->getQuestionType());
 
  877            $this->
object->saveToDb();
 
  878            $originalexists = $this->
object->_questionExistsInPool($this->object->original_id);
 
  881            include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
  883                ilUtil::sendSuccess($this->lng->txt(
"msg_obj_modified"), 
true);
 
  884                $this->ctrl->setParameter($this, 
'return_to', 
'editQuestion');
 
  885                $this->ctrl->redirect($this, 
"originalSyncForm");
 
  887            } elseif (
$_GET[
"calling_test"]) {
 
  888                require_once 
'Modules/Test/classes/class.ilObjTest.php';
 
  891                    $tree = 
$DIC[
'tree'];
 
  893                    $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
  895                    include_once(
"./Modules/Test/classes/class.ilObjTest.php");
 
  899                    require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
  902                    $new_id = 
$test->insertQuestion(
 
  903                        $testQuestionSetConfigFactory->getQuestionSetConfig(),
 
  904                        $this->object->getId()
 
  907                    if (isset($_REQUEST[
'prev_qid'])) {
 
  908                        $test->moveQuestionAfter($this->object->getId() + 1, $_REQUEST[
'prev_qid']);
 
  911                    $this->ctrl->setParameter($this, 
'q_id', $new_id);
 
  912                    $this->ctrl->setParameter($this, 
'calling_test', 
$_GET[
'calling_test']);
 
  913                    #$this->ctrl->setParameter($this, 'test_ref_id', false); 
  915                ilUtil::sendSuccess($this->lng->txt(
"msg_obj_modified"), 
true);
 
  916                $this->ctrl->redirect($this, 
'editQuestion');
 
  920                if ($this->object->getId() != $old_id) {
 
  922                    $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"], 
"q_id", $this->object->getId());
 
  923                    $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"], 
"sel_question_types", 
$_GET[
"sel_question_types"]);
 
  924                    ilUtil::sendSuccess($this->lng->txt(
"msg_obj_modified"), 
true);
 
  930                    if ($_REQUEST[
'prev_qid']) {
 
  933                        include_once(
"./Modules/Test/classes/class.ilObjTest.php");
 
  935                        $test->moveQuestionAfter($_REQUEST[
'prev_qid'], $this->object->getId());
 
  937                    if (  $_REQUEST[
'express_mode']) {
 
  938                        $tree = 
$DIC[
'tree'];
 
  940                        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
  942                        include_once(
"./Modules/Test/classes/class.ilObjTest.php");
 
  945                        require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
  948                        $test->insertQuestion(
 
  949                            $testQuestionSetConfigFactory->getQuestionSetConfig(),
 
  950                            $this->object->getId()
 
  953                        require_once 
'Modules/Test/classes/class.ilTestExpressPage.php';
 
  954                        $_REQUEST[
'q_id'] = $this->
object->getId();
 
  958                    $this->ctrl->redirectByClass(
$_GET[
"cmdClass"], 
"editQuestion");
 
  960                if (strcmp(
$_SESSION[
"info"], 
"") != 0) {
 
  961                    ilUtil::sendSuccess(
$_SESSION[
"info"] . 
"<br />" . $this->lng->txt(
"msg_obj_modified"), 
true);
 
  963                    ilUtil::sendSuccess($this->lng->txt(
"msg_obj_modified"), 
true);
 
  965                $this->ctrl->redirect($this, 
'editQuestion');
 
  968        $tabs = 
$DIC[
'ilTabs'];
 
  969        $tabs->setTabActive(
'edit_question');
 
  979        $old_id = 
$_GET[
"q_id"];
 
  982            $ilUser->setPref(
"tst_lastquestiontype", $this->object->getQuestionType());
 
  983            $ilUser->writePref(
"tst_lastquestiontype", $this->object->getQuestionType());
 
  984            $this->
object->saveToDb();
 
  985            $originalexists = $this->
object->_questionExistsInPool($this->object->original_id);
 
  987            include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
  989                ilUtil::sendSuccess($this->lng->txt(
"msg_obj_modified"), 
true);
 
  990                $this->ctrl->setParameter($this, 
'test_express_mode', $_REQUEST[
'test_express_mode']);
 
  991                $this->ctrl->redirect($this, 
"originalSyncForm");
 
  993            } elseif (
$_GET[
"calling_test"]) {
 
  994                require_once 
'Modules/Test/classes/class.ilObjTest.php';
 
  996                $q_id = $this->
object->getId();
 
  998                    $tree = 
$DIC[
'tree'];
 
 1000                    $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 1002                    include_once(
"./Modules/Test/classes/class.ilObjTest.php");
 
 1006                    require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
 1009                    $new_id = 
$test->insertQuestion(
 
 1010                        $testQuestionSetConfigFactory->getQuestionSetConfig(),
 
 1011                        $this->object->getId()
 
 1015                    if (isset($_REQUEST[
'prev_qid'])) {
 
 1016                        $test->moveQuestionAfter($this->object->getId() + 1, $_REQUEST[
'prev_qid']);
 
 1019                    $this->ctrl->setParameter($this, 
'q_id', $new_id);
 
 1020                    $this->ctrl->setParameter($this, 
'calling_test', 
$_GET[
'calling_test']);
 
 1022                ilUtil::sendSuccess($this->lng->txt(
"msg_obj_modified"), 
true);
 
 1023                $this->ctrl->setParameterByClass(
'ilAssQuestionPreviewGUI', 
'q_id', $q_id);
 
 1026                if ($this->object->getId() != $old_id) {
 
 1028                    ilUtil::sendSuccess($this->lng->txt(
"msg_obj_modified"), 
true);
 
 1029                    $this->ctrl->redirectByClass(
"ilobjquestionpoolgui", 
"questions");
 
 1031                if (strcmp(
$_SESSION[
"info"], 
"") != 0) {
 
 1032                    ilUtil::sendSuccess(
$_SESSION[
"info"] . 
"<br />" . $this->lng->txt(
"msg_obj_modified"), 
true);
 
 1034                    ilUtil::sendSuccess($this->lng->txt(
"msg_obj_modified"), 
true);
 
 1039        $tabs = 
$DIC[
'ilTabs'];
 
 1040        $tabs->setTabActive(
'edit_question');
 
 1049        $this->
object->saveToDb();
 
 1050        $this->ctrl->setParameter($this, 
"q_id", $this->object->getId());
 
 1051        $this->editQuestion();
 
 1064        $tmpPath = $cont_obj->getLMTree()->getPathFull($a_endnode_id, $a_startnode_id);
 
 1067        for (
$i = 1; 
$i < (count($tmpPath) - 1); 
$i++) {
 
 1072            $path .= $tmpPath[
$i][
"title"];
 
 1080        $this->sequence_no = $nr;
 
 1090        $this->question_count = $a_question_count;
 
 1110        $this->errormessage .= ((strlen($this->errormessage)) ? 
"<br />" : 
"") . 
$errormessage;
 
 1127        return $this->
object->getQuestionType();
 
 1140        if (strlen($a_value)) {
 
 1141            $result = 
" value=\"$a_value\" ";
 
 1153        $cnt = $this->new_id_listener_cnt;
 
 1154        $this->new_id_listeners[$cnt][
"object"] = &$a_object;
 
 1155        $this->new_id_listeners[$cnt][
"method"] = $a_method;
 
 1156        $this->new_id_listeners[$cnt][
"parameters"] = $a_parameters;
 
 1157        $this->new_id_listener_cnt++;
 
 1165        for (
$i = 0; 
$i < $this->new_id_listener_cnt; 
$i++) {
 
 1166            $this->new_id_listeners[
$i][
"parameters"][
"new_id"] = $a_new_id;
 
 1167            $object = &$this->new_id_listeners[
$i][
"object"];
 
 1168            $method = $this->new_id_listeners[
$i][
"method"];
 
 1169            $parameters = $this->new_id_listeners[
$i][
"parameters"];
 
 1174            $object->$method($parameters);
 
 1184        if (!$this->object->getSelfAssessmentEditingMode()) {
 
 1185            $form->addCommandButton(
"saveReturn", $this->lng->txt(
"save_return"));
 
 1187        $form->addCommandButton(
"save", $this->lng->txt(
"save"));
 
 1200        $title->setMaxLength(100);
 
 1201        $title->setValue($this->object->getTitle());
 
 1202        $title->setRequired(
true);
 
 1203        $form->addItem($title);
 
 1205        if (!$this->object->getSelfAssessmentEditingMode()) {
 
 1207            $author = 
new ilTextInputGUI($this->lng->txt(
"author"), 
"author");
 
 1208            $author->setValue($this->object->getAuthor());
 
 1209            $author->setRequired(
true);
 
 1210            $form->addItem($author);
 
 1213            $description = 
new ilTextInputGUI($this->lng->txt(
"description"), 
"comment");
 
 1214            $description->setValue($this->object->getComment());
 
 1215            $description->setRequired(
false);
 
 1216            $form->addItem($description);
 
 1221            if (trim($author) == 
"") {
 
 1224            $hi->setValue($author);
 
 1225            $form->addItem($hi);
 
 1229        $lifecycle = 
new ilSelectInputGUI($this->lng->txt(
'qst_lifecycle'), 
'lifecycle');
 
 1230        $lifecycle->setOptions($this->object->getLifecycle()->getSelectOptions($this->lng));
 
 1231        $lifecycle->setValue($this->object->getLifecycle()->getIdentifier());
 
 1232        $form->addItem($lifecycle);
 
 1236        $question->setValue($this->object->getQuestion());
 
 1237        $question->setRequired(
true);
 
 1238        $question->setRows(10);
 
 1239        $question->setCols(80);
 
 1241        if (!$this->object->getSelfAssessmentEditingMode()) {
 
 1243                $question->setUseRte(
true);
 
 1244                include_once 
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
 
 1246                $question->addPlugin(
"latex");
 
 1247                $question->addButton(
"latex");
 
 1248                $question->addButton(
"pastelatex");
 
 1249                $question->setRTESupport($this->object->getId(), 
"qpl", 
"assessment");
 
 1252            require_once 
'Modules/TestQuestionPool/classes/questions/class.ilAssSelfAssessmentQuestionFormatter.php';
 
 1254            $question->setUseTagsForRteOnly(
false);
 
 1256        $form->addItem($question);
 
 1258        if (!$this->object->getSelfAssessmentEditingMode()) {
 
 1261            $duration->setShowHours(
true);
 
 1262            $duration->setShowMinutes(
true);
 
 1263            $duration->setShowSeconds(
true);
 
 1264            $ewt = $this->
object->getEstimatedWorkingTime();
 
 1265            $duration->setHours($ewt[
"h"]);
 
 1266            $duration->setMinutes($ewt[
"m"]);
 
 1267            $duration->setSeconds($ewt[
"s"]);
 
 1268            $duration->setRequired(
false);
 
 1269            $form->addItem($duration);
 
 1272            if (strlen($this->object->getNrOfTries())) {
 
 1273                $nr_tries = $this->
object->getNrOfTries();
 
 1275                $nr_tries = $this->
object->getDefaultNrOfTries();
 
 1277            if ($nr_tries < 1) {
 
 1281            $ni = 
new ilNumberInputGUI($this->lng->txt(
"qst_nr_of_tries"), 
"nr_of_tries");
 
 1282            $ni->setValue($nr_tries);
 
 1283            $ni->setMinValue(0);
 
 1285            $ni->setMaxLength(5);
 
 1286            $form->addItem($ni);
 
 1293            require_once 
'Services/Taxonomy/classes/class.ilTaxAssignInputGUI.php';
 
 1296                $postvar = 
"tax_node_assign_$taxonomyId";
 
 1300                $tax_node_assign->saveInput(
"qpl", $this->object->getObjId(), 
"quest", $this->object->getId());
 
 1309            require_once 
'Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php';
 
 1310            ilOverlayGUI::initJavaScript();
 
 1313            $sectHeader->setTitle($this->lng->txt(
'qpl_qst_edit_form_taxonomy_section'));
 
 1316            require_once 
'Services/Taxonomy/classes/class.ilTaxSelectInputGUI.php';
 
 1320                $label = sprintf($this->lng->txt(
'qpl_qst_edit_form_taxonomy'), $taxonomy->getTitle());
 
 1321                $postvar = 
"tax_node_assign_$taxonomyId";
 
 1324                $taxSelect->setTitle($label);
 
 1326                require_once 
'Services/Taxonomy/classes/class.ilTaxNodeAssignment.php';
 
 1328                $assignedNodes = $taxNodeAssignments->getAssignmentsOfItem($this->object->getId());
 
 1330                $taxSelect->setValue(array_map(
function ($assignedNode) {
 
 1331                    return $assignedNode[
'node_id'];
 
 1332                }, $assignedNodes));
 
 1364        include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
 1366        if (strlen($manual_feedback)) {
 
 1367            return $manual_feedback;
 
 1370        $correct_feedback = $this->
object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(), 
true);
 
 1371        $incorrect_feedback = $this->
object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(), 
false);
 
 1372        if (strlen($correct_feedback . $incorrect_feedback)) {
 
 1373            $reached_points = $this->
object->calculateReachedPoints($active_id, 
$pass);
 
 1374            $max_points = $this->
object->getMaximumPoints();
 
 1375            if ($reached_points == $max_points) {
 
 1376                $output = $correct_feedback;
 
 1378                $output = $incorrect_feedback;
 
 1382        if ($this->object->isAdditionalContentEditingModePageObject()) {
 
 1385        return $this->
object->prepareTextareaOutput($output, 
true);
 
 1390        return $this->
object->prepareTextareaOutput(
 
 1391            $this->object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(), 
true),
 
 1398        return $this->
object->prepareTextareaOutput(
 
 1399            $this->object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(), 
false),
 
 1418        $count = $this->
object->isInUse();
 
 1420        if ($this->object->_questionExistsInPool($this->object->getId()) && $count) {
 
 1422            $rbacsystem = 
$DIC[
'rbacsystem'];
 
 1423            if ($rbacsystem->checkAccess(
"write", 
$_GET[
"ref_id"])) {
 
 1424                ilUtil::sendInfo(sprintf($this->lng->txt(
"qpl_question_is_in_use"), $count));
 
 1445        $ilAccess = 
$DIC[
'ilAccess'];
 
 1447        $save = (is_array(
$_POST[
"cmd"]) && array_key_exists(
"suggestedsolution", 
$_POST[
"cmd"])) ? 
true : 
false;
 
 1449        if ($save && 
$_POST[
"deleteSuggestedSolution"] == 1) {
 
 1450            $this->
object->deleteSuggestedSolutions();
 
 1451            ilUtil::sendSuccess($this->lng->txt(
"msg_obj_modified"), 
true);
 
 1452            $this->ctrl->redirect($this, 
"suggestedsolution");
 
 1456        $solution_array = $this->
object->getSuggestedSolution(0);
 
 1458            "lm" => $this->lng->txt(
"obj_lm"),
 
 1459            "st" => $this->lng->txt(
"obj_st"),
 
 1460            "pg" => $this->lng->txt(
"obj_pg"),
 
 1461            "git" => $this->lng->txt(
"glossary_term"),
 
 1462            "file" => $this->lng->txt(
"fileDownload"),
 
 1463            "text" => $this->lng->txt(
"solutionText")
 
 1466        if ((strcmp(
$_POST[
"solutiontype"], 
"file") == 0) && (strcmp($solution_array[
"type"], 
"file") != 0)) {
 
 1467            $solution_array = array(
 
 1470        } elseif ((strcmp(
$_POST[
"solutiontype"], 
"text") == 0) && (strcmp($solution_array[
"type"], 
"text") != 0)) {
 
 1474            $solution_array = array(
 
 1480        if ($save && strlen(
$_POST[
"filename"])) {
 
 1481            $solution_array[
"value"][
"filename"] = 
$_POST[
"filename"];
 
 1483        if ($save && strlen(
$_POST[
"solutiontext"])) {
 
 1484            $solution_array[
"value"] = 
$_POST[
"solutiontext"];
 
 1486        include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
 1487        if (count($solution_array)) {
 
 1489            $form->setFormAction($this->ctrl->getFormAction($this));
 
 1490            $form->setTitle($this->lng->txt(
"solution_hint"));
 
 1491            $form->setMultipart(
true);
 
 1492            $form->setTableWidth(
"100%");
 
 1493            $form->setId(
"suggestedsolutiondisplay");
 
 1496            include_once 
"./Modules/TestQuestionPool/classes/class.ilSolutionTitleInputGUI.php";
 
 1498            $template = 
new ilTemplate(
"tpl.il_as_qpl_suggested_solution_input_presentation.html", 
true, 
true, 
"Modules/TestQuestionPool");
 
 1499            if (strlen($solution_array[
"internal_link"])) {
 
 1501                $template->setCurrentBlock(
"preview");
 
 1502                $template->setVariable(
"TEXT_SOLUTION", $this->lng->txt(
"suggested_solution"));
 
 1503                $template->setVariable(
"VALUE_SOLUTION", 
" <a href=\"$href\" target=\"content\">" . $this->lng->txt(
"view") . 
"</a> ");
 
 1504                $template->parseCurrentBlock();
 
 1505            } elseif ((strcmp($solution_array[
"type"], 
"file") == 0) && (is_array($solution_array[
"value"]))) {
 
 1506                $href = $this->
object->getSuggestedSolutionPathWeb() . $solution_array[
"value"][
"name"];
 
 1507                $template->setCurrentBlock(
"preview");
 
 1508                $template->setVariable(
"TEXT_SOLUTION", $this->lng->txt(
"suggested_solution"));
 
 1509                $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> ");
 
 1510                $template->parseCurrentBlock();
 
 1512            $template->setVariable(
"TEXT_TYPE", $this->lng->txt(
"type"));
 
 1513            $template->setVariable(
"VALUE_TYPE", $options[$solution_array[
"type"]]);
 
 1514            $title->setHtml($template->get());
 
 1516            $deletesolution->setOptionTitle($this->lng->txt(
"deleteSuggestedSolution"));
 
 1517            $title->addSubItem($deletesolution);
 
 1518            $form->addItem($title);
 
 1520            if (strcmp($solution_array[
"type"], 
"file") == 0) {
 
 1522                $file = 
new ilFileInputGUI($this->lng->txt(
"fileDownload"), 
"file");
 
 1523                $file->setRequired(
true);
 
 1524                $file->enableFileNameSelection(
"filename");
 
 1526                if ($_FILES[
"file"][
"tmp_name"] && $file->checkInput()) {
 
 1527                    if (!file_exists($this->object->getSuggestedSolutionPath())) {
 
 1531                    $res = 
ilUtil::moveUploadedFile($_FILES[
"file"][
"tmp_name"], $_FILES[
"file"][
"name"], $this->object->getSuggestedSolutionPath() . $_FILES[
"file"][
"name"]);
 
 1536                        if (is_array($solution_array[
"value"])) {
 
 1537                            @unlink($this->object->getSuggestedSolutionPath() . $solution_array[
"value"][
"name"]);
 
 1539                        $file->setValue($_FILES[
"file"][
"name"]);
 
 1540                        $this->
object->saveSuggestedSolution(
"file", 
"", 0, array(
"name" => $_FILES[
"file"][
"name"], 
"type" => $_FILES[
"file"][
"type"], 
"size" => $_FILES[
"file"][
"size"], 
"filename" => 
$_POST[
"filename"]));
 
 1541                        $originalexists = $this->
object->_questionExistsInPool($this->object->original_id);
 
 1545                            ilUtil::sendSuccess($this->lng->txt(
"suggested_solution_added_successfully"), 
true);
 
 1546                            $this->ctrl->redirect($this, 
"suggestedsolution");
 
 1553                    if (is_array($solution_array[
"value"])) {
 
 1554                        $file->setValue($solution_array[
"value"][
"name"]);
 
 1555                        $file->setFilename((strlen($solution_array[
"value"][
"filename"])) ? $solution_array[
"value"][
"filename"] : $solution_array[
"value"][
"name"]);
 
 1558                $form->addItem($file);
 
 1560                $hidden->setValue(
"file");
 
 1561                $form->addItem($hidden);
 
 1562            } elseif (strcmp($solution_array[
"type"], 
"text") == 0) {
 
 1563                $solutionContent = $solution_array[
'value'];
 
 1564                $solutionContent = $this->
object->fixSvgToPng($solutionContent);
 
 1565                $solutionContent = $this->
object->fixUnavailableSkinImageSources($solutionContent);
 
 1567                $question->setValue($this->object->prepareTextareaOutput($solutionContent));
 
 1568                $question->setRequired(
true);
 
 1569                $question->setRows(10);
 
 1570                $question->setCols(80);
 
 1571                $question->setUseRte(
true);
 
 1572                $question->addPlugin(
"latex");
 
 1573                $question->addButton(
"latex");
 
 1574                $question->setRTESupport($this->object->getId(), 
"qpl", 
"assessment");
 
 1576                $hidden->setValue(
"text");
 
 1577                $form->addItem($hidden);
 
 1578                $form->addItem($question);
 
 1580            if ($ilAccess->checkAccess(
"write", 
"", 
$_GET[
'ref_id'])) {
 
 1581                $form->addCommandButton(
'showSuggestedSolution', $this->lng->txt(
'cancel'));
 
 1582                $form->addCommandButton(
'suggestedsolution', $this->lng->txt(
'save'));
 
 1586                if ($form->checkInput()) {
 
 1587                    switch ($solution_array[
"type"]) {
 
 1589                            $this->
object->saveSuggestedSolution(
"file", 
"", 0, array(
 
 1590                                "name" => $solution_array[
"value"][
"name"],
 
 1591                                "type" => $solution_array[
"value"][
"type"],
 
 1592                                "size" => $solution_array[
"value"][
"size"],
 
 1593                                "filename" => 
$_POST[
"filename"]
 
 1597                            $this->
object->saveSuggestedSolution(
"text", 
"", 0, $solution_array[
"value"]);
 
 1600                    $originalexists = $this->
object->_questionExistsInPool($this->object->original_id);
 
 1604                        ilUtil::sendSuccess($this->lng->txt(
"msg_obj_modified"), 
true);
 
 1605                        $this->ctrl->redirect($this, 
"suggestedsolution");
 
 1610            $output = $form->getHTML();
 
 1613        $savechange = (strcmp($this->ctrl->getCmd(), 
"saveSuggestedSolution") == 0) ? 
true : 
false;
 
 1616        if ($ilAccess->checkAccess(
"write", 
"", 
$_GET[
'ref_id'])) {
 
 1618            $formchange->setFormAction($this->ctrl->getFormAction($this));
 
 1619            $formchange->setTitle((count($solution_array)) ? $this->lng->txt(
"changeSuggestedSolution") : $this->lng->txt(
"addSuggestedSolution"));
 
 1620            $formchange->setMultipart(
false);
 
 1621            $formchange->setTableWidth(
"100%");
 
 1622            $formchange->setId(
"suggestedsolution");
 
 1624            $solutiontype = 
new ilRadioGroupInputGUI($this->lng->txt(
"suggestedSolutionType"), 
"solutiontype");
 
 1625            foreach ($options as $opt_value => $opt_caption) {
 
 1626                $solutiontype->addOption(
new ilRadioOption($opt_caption, $opt_value));
 
 1628            if (count($solution_array)) {
 
 1629                $solutiontype->setValue($solution_array[
"type"]);
 
 1631            $solutiontype->setRequired(
true);
 
 1632            $formchange->addItem($solutiontype);
 
 1634            $formchange->addCommandButton(
"saveSuggestedSolution", $this->lng->txt(
"select"));
 
 1637                $formchange->checkInput();
 
 1639            $changeoutput = $formchange->getHTML();
 
 1642        $this->tpl->setVariable(
"ADM_CONTENT", $changeoutput . $output);
 
 1648        $tree = 
$DIC[
'tree'];
 
 1650        include_once(
"./Modules/TestQuestionPool/classes/class.ilSolutionExplorer.php");
 
 1652        $search = 
$_GET[
"search_link_type"];
 
 1653        $this->ctrl->setParameter($this, 
"link_new_type", 
$type);
 
 1654        $this->ctrl->setParameter($this, 
"search_link_type", $search);
 
 1655        $this->ctrl->saveParameter($this, array(
"subquestion_index", 
"link_new_type", 
"search_link_type"));
 
 1659        $parent_ref_id = $tree->getParentId(
$_GET[
"ref_id"]);
 
 1660        $exp = 
new ilSolutionExplorer($this->ctrl->getLinkTarget($this, 
'suggestedsolution'), get_class($this));
 
 1661        $exp->setExpand(
$_GET[
'expand_sol'] ? 
$_GET[
'expand_sol'] : $parent_ref_id);
 
 1662        $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 
'outSolutionExplorer'));
 
 1663        $exp->setTargetGet(
"ref_id");
 
 1664        $exp->setRefId(
$_GET[
"ref_id"]);
 
 1665        $exp->addFilter(
$type);
 
 1666        $exp->setSelectableType(
$type);
 
 1667        if (isset(
$_GET[
'expandCurrentPath']) && 
$_GET[
'expandCurrentPath']) {
 
 1668            $exp->expandPathByRefId($parent_ref_id);
 
 1674        $template = 
new ilTemplate(
"tpl.il_as_qpl_explorer.html", 
true, 
true, 
"Modules/TestQuestionPool");
 
 1675        $template->setVariable(
"EXPLORER_TREE", $exp->getOutput());
 
 1676        $template->setVariable(
"BUTTON_CANCEL", $this->lng->txt(
"cancel"));
 
 1677        $template->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this, 
"suggestedsolution"));
 
 1678        $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
 
 1684        $tree = 
$DIC[
'tree'];
 
 1686        include_once(
"./Modules/TestQuestionPool/classes/class.ilSolutionExplorer.php");
 
 1687        switch (
$_POST[
"solutiontype"]) {
 
 1712        if (isset(
$_POST[
'solutiontype'])) {
 
 1713            $this->ctrl->setParameter($this, 
'expandCurrentPath', 1);
 
 1715        $this->ctrl->setParameter($this, 
"link_new_type", 
$type);
 
 1716        $this->ctrl->setParameter($this, 
"search_link_type", $search);
 
 1717        $this->ctrl->redirect($this, 
"outSolutionExplorer");
 
 1722        $this->ctrl->redirect($this, 
"suggestedsolution");
 
 1727        require_once 
'Modules/TestQuestionPool/classes/tables/class.ilQuestionInternalLinkSelectionTableGUI.php';
 
 1728        require_once 
'Modules/LearningModule/classes/class.ilLMPageObject.php';
 
 1729        require_once 
'Modules/LearningModule/classes/class.ilObjContentObjectGUI.php';
 
 1731        $this->ctrl->setParameter($this, 
'q_id', $this->object->getId());
 
 1734        $cont_obj = $cont_obj_gui->object;
 
 1736        $shownpages = array();
 
 1737        $tree = $cont_obj->getLMTree();
 
 1738        $chapters = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
 
 1742        foreach ($chapters as $chapter) {
 
 1743            $chapterpages = $tree->getChildsByType($chapter[
'obj_id'], 
'pg');
 
 1744            foreach ($chapterpages as $page) {
 
 1745                if ($page[
'type'] == 
$_GET[
'search_link_type']) {
 
 1746                    array_push($shownpages, $page[
'obj_id']);
 
 1748                    if ($tree->isInTree($page[
'obj_id'])) {
 
 1754                    $this->ctrl->setParameter($this, $page[
'type'], $page[
'obj_id']);
 
 1756                        'title' => $page[
'title'],
 
 1758                        'text_add' => $this->lng->txt(
'add'),
 
 1759                        'href_add' => $this->ctrl->getLinkTarget($this, 
'add' . strtoupper($page[
'type']))
 
 1764        foreach ($pages as $page) {
 
 1765            if (!in_array($page[
'obj_id'], $shownpages)) {
 
 1766                $this->ctrl->setParameter($this, $page[
'type'], $page[
'obj_id']);
 
 1768                    'title' => $page[
'title'],
 
 1769                    'description' => 
'---',
 
 1770                    'text_add' => $this->lng->txt(
'add'),
 
 1771                    'href_add' => $this->ctrl->getLinkTarget($this, 
'add' . strtoupper($page[
'type']))
 
 1776        require_once 
'Modules/TestQuestionPool/classes/tables/class.ilQuestionInternalLinkSelectionTableGUI.php';
 
 1779        $table->setData(
$rows);
 
 1781        $this->tpl->setContent($table->getHTML());
 
 1786        require_once 
'Modules/TestQuestionPool/classes/tables/class.ilQuestionInternalLinkSelectionTableGUI.php';
 
 1787        require_once 
'Modules/LearningModule/classes/class.ilObjContentObjectGUI.php';
 
 1789        $this->ctrl->setParameter($this, 
'q_id', $this->object->getId());
 
 1792        $cont_obj = $cont_obj_gui->object;
 
 1793        $ctree = $cont_obj->getLMTree();
 
 1794        $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
 
 1798        foreach ($nodes as $node) {
 
 1799            if ($node[
'type'] == 
$_GET[
'search_link_type']) {
 
 1800                $this->ctrl->setParameter($this, $node[
'type'], $node[
'obj_id']);
 
 1802                    'title' => $node[
'title'],
 
 1803                    'description' => 
'',
 
 1804                    'text_add' => $this->lng->txt(
'add'),
 
 1805                    'href_add' => $this->ctrl->getLinkTarget($this, 
'add' . strtoupper($node[
'type']))
 
 1812        $table->setData(
$rows);
 
 1814        $this->tpl->setContent($table->getHTML());
 
 1819        $this->ctrl->setParameter($this, 
'q_id', $this->object->getId());
 
 1822        $terms = $glossary->getTermList();
 
 1826        foreach ($terms as $term) {
 
 1827            $this->ctrl->setParameter($this, 
'git', $term[
'id']);
 
 1829                'title' => $term[
'term'],
 
 1830                'description' => 
'',
 
 1831                'text_add' => $this->lng->txt(
'add'),
 
 1832                'href_add' => $this->ctrl->getLinkTarget($this, 
'addGIT')
 
 1837        $table->setTitle($this->lng->txt(
'glossary_term'));
 
 1838        $table->setData(
$rows);
 
 1840        $this->tpl->setContent($table->getHTML());
 
 1845        $this->ctrl->saveParameter($this, array(
"subquestion_index", 
"link_new_type", 
"search_link_type"));
 
 1846        switch (
$_GET[
"search_link_type"]) {
 
 1857                $subquestion_index = (
$_GET[
"subquestion_index"] > 0) ? 
$_GET[
"subquestion_index"] : 0;
 
 1858                $this->
object->saveSuggestedSolution(
"lm", 
"il__lm_" . 
$_GET[
"source_id"], $subquestion_index);
 
 1859                ilUtil::sendSuccess($this->lng->txt(
"suggested_solution_added_successfully"), 
true);
 
 1860                $this->ctrl->redirect($this, 
"suggestedsolution");
 
 1867        $subquestion_index = 0;
 
 1868        if (strlen(
$_GET[
"subquestion_index"]) && 
$_GET[
"subquestion_index"] >= 0) {
 
 1869            $subquestion_index = 
$_GET[
"subquestion_index"];
 
 1871        $this->
object->saveSuggestedSolution(
"pg", 
"il__pg_" . 
$_GET[
"pg"], $subquestion_index);
 
 1872        ilUtil::sendSuccess($this->lng->txt(
"suggested_solution_added_successfully"), 
true);
 
 1873        $this->ctrl->redirect($this, 
"suggestedsolution");
 
 1878        $subquestion_index = 0;
 
 1879        if (strlen(
$_GET[
"subquestion_index"]) && 
$_GET[
"subquestion_index"] >= 0) {
 
 1880            $subquestion_index = 
$_GET[
"subquestion_index"];
 
 1882        $this->
object->saveSuggestedSolution(
"st", 
"il__st_" . 
$_GET[
"st"], $subquestion_index);
 
 1883        ilUtil::sendSuccess($this->lng->txt(
"suggested_solution_added_successfully"), 
true);
 
 1884        $this->ctrl->redirect($this, 
"suggestedsolution");
 
 1889        $subquestion_index = 0;
 
 1890        if (strlen(
$_GET[
"subquestion_index"]) && 
$_GET[
"subquestion_index"] >= 0) {
 
 1891            $subquestion_index = 
$_GET[
"subquestion_index"];
 
 1893        $this->
object->saveSuggestedSolution(
"git", 
"il__git_" . 
$_GET[
"git"], $subquestion_index);
 
 1894        ilUtil::sendSuccess($this->lng->txt(
"suggested_solution_added_successfully"), 
true);
 
 1895        $this->ctrl->redirect($this, 
"suggestedsolution");
 
 1900        return in_array($this->ctrl->getCmd(), array(
'save', 
'saveEdit', 
'saveReturn'));
 
 1913        $reflectionClass = 
new ReflectionClass($guiClassName);
 
 1917        if ($reflectionClass instanceof ReflectionClass) {
 
 1918            $commands = array();
 
 1920            foreach ($reflectionClass->getConstants() as $constName => $constValue) {
 
 1921                if (substr($constName, 0, strlen($cmdConstantNameBegin)) == $cmdConstantNameBegin) {
 
 1922                    $commands[] = $constValue;
 
 1933        $ilTabs = 
$DIC[
'ilTabs'];
 
 1935        $ilTabs->clearTargets();
 
 1943        $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI", 
"q_id", 
$_GET[
"q_id"]);
 
 1944        $q_type = $this->
object->getQuestionType();
 
 1946        if (strlen($q_type)) {
 
 1947            $classname = $q_type . 
"GUI";
 
 1948            $this->ctrl->setParameterByClass(strtolower($classname), 
"sel_question_types", $q_type);
 
 1949            $this->ctrl->setParameterByClass(strtolower($classname), 
"q_id", 
$_GET[
"q_id"]);
 
 1952        if (
$_GET[
"q_id"]) {
 
 1972        if (
$_GET[
"q_id"]) {
 
 1974                "suggested_solution",
 
 1975                $this->ctrl->getLinkTargetByClass($classname, 
"suggestedsolution"),
 
 1976                array(
"suggestedsolution", 
"saveSuggestedSolution", 
"outSolutionExplorer", 
"cancel",
 
 1977                    "addSuggestedSolution",
"cancelExplorer", 
"linkChilds", 
"removeSuggestedSolution" 
 1992        return array(
'editQuestion', 
'save', 
'saveEdit', 
'originalSyncForm');
 
 2009        $ilCtrl = 
$DIC[
'ilCtrl'];
 
 2011        require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
 
 2016        $tabs->
addTarget(
'tst_feedback', $tabLink, $tabCommands, $ilCtrl->getCmdClass(), 
'');
 
 2028        $ilCtrl = 
$DIC[
'ilCtrl'];
 
 2030        require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsGUI.php';
 
 2032        switch ($ilCtrl->getCmdClass()) {
 
 2033            case 'ilassquestionhintsgui':
 
 2038            case 'ilassquestionhintgui':
 
 2040                require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintGUI.php';
 
 2046                $tabCommands = array();
 
 2051        $tabs->
addTarget(
'tst_question_hints_tab', $tabLink, $tabCommands, $ilCtrl->getCmdClass(), 
'');
 
 2056        require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewGUI.php';
 
 2060            $this->ctrl->getLinkTargetByClass(
 
 2061                array(
'ilrepositorygui',
'ilobjquestionpoolgui', get_class($this)),
 
 2074        $graphicalOutput = 
false,
 
 2075        $result_output = 
false,
 
 2076        $show_question_only = 
true,
 
 2077        $show_feedback = 
false,
 
 2078        $show_correct_solution = 
false,
 
 2079        $show_manual_scoring = 
false,
 
 2080        $show_question_text = 
true 
 2101        $result = $this->
object->lookupForExistingSolutions($activeId, $passIndex);
 
 2102        return (
$result[
'intermediate']);
 
 2111        $this->use_intermediate_solution = (bool) $use;
 
 2125        $reachedPoints = $this->
object->getAdjustedReachedPoints($activeId, $passIndex, 
true);
 
 2126        $maximumPoints = $this->
object->getMaximumPoints();
 
 2128        return $reachedPoints == $maximumPoints;
 
 2133        return $this->
object->isAutosaveable();
 
 2138        $this->
object->setTitle(
$_POST[
"title"]);
 
 2139        $this->
object->setAuthor(
$_POST[
"author"]);
 
 2140        $this->
object->setComment(
$_POST[
"comment"]);
 
 2141        if ($this->object->getSelfAssessmentEditingMode()) {
 
 2142            $this->
object->setNrOfTries(
$_POST[
'nr_of_tries']);
 
 2147            $this->
object->setLifecycle($lifecycle);
 
 2152        $this->
object->setEstimatedWorkingTime(
 
 2153            $_POST[
"Estimated"][
"hh"],
 
 2154            $_POST[
"Estimated"][
"mm"],
 
 2155            $_POST[
"Estimated"][
"ss"]
 
 2159    abstract public function getPreview($show_question_only = 
false, $showInlineFeedback = 
false);
 
 2175        $is_question_postponed = 
false,
 
 2176        $user_post_solutions = 
false,
 
 2177        $show_specific_inline_feedback = 
false 
 2184            $is_question_postponed,
 
 2185            $user_post_solutions,
 
 2186            $show_specific_inline_feedback
 
 2191        $this->tpl->setVariable(
"QUESTION_OUTPUT", $test_output);
 
 2192        $this->tpl->setVariable(
"FORMACTION", $formaction);
 
 2194        $this->tpl->setVariable(
"FORM_TIMESTAMP", time());
 
 2212        $is_question_postponed,
 
 2213        $user_post_solutions,
 
 2214        $show_specific_inline_feedback
 
 2227        $this->ctrl->saveParameterByClass(ilAssQuestionPreviewGUI::class, 
'prev_qid');
 
 2229            $this->lng->txt(
'backtocallingpage'),
 
 2260        require_once 
'Services/Form/classes/class.ilPropertyFormGUI.php';
 
 2263        $form->setFormAction($this->ctrl->getFormAction($this));
 
 2265        $form->setId($this->
getType());
 
 2268        $form->setTableWidth(
'100%');
 
 2270        $form->setMultipart(
true);
 
 2278        $ilCtrl = 
$DIC[
'ilCtrl'];
 
 2284        return str_replace([
'{',
'}'], [
'{',
'}'], $text);
 
 2292        $errors = $this->editQuestion(
true); 
 
 2301        return '<div id="focus"></div>';
 
 2328        require_once 
'Modules/TestQuestionPool/classes/tables/class.ilAnswerFrequencyStatisticTableGUI.php';
 
 2331        $table->setQuestionIndex($questionIndex);
 
 2333        $table->initColumns();
 
 2361        $this->tpl->addOnloadCode(
" 
 2362            let form = document.querySelector('#ilContentContainer form'); 
 2363            let button = form.querySelector('input[name=\"cmd[save]\"]'); 
 2364            if (button === null) { 
 2365                button = form.querySelector('input[name=\"cmd[saveFQ]\"]'); 
 2367            if (form && button) { 
 2368                form.addEventListener('keydown', function (e) { 
 2369                    if (e.key === 'Enter' 
 2370                        && e.target.type !== 'textarea' 
 2371                        && e.target.type !== 'submit' 
 2372                        && e.target.type !== 'file' 
 2375                        form.requestSubmit(button); 
An exception for terminatinating execution or to throw for unit testing.
Basic GUI class for assessment questions.
const FORM_ENCODING_MULTIPART
static _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
isRenderPurposeInputValue()
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addNewIdListener(&$a_object, $a_method, $a_parameters="")
Add a listener that is notified with the new question ID, when a new question is saved.
getGenericFeedbackOutputForIncorrectSolution()
callNewIdListeners($a_new_id)
Call the new id listeners.
getGenericFeedbackOutputForCorrectSolution()
saveCorrectionsFormProperties(ilPropertyFormGUI $form)
const SESSION_PREVIEW_DATA_BASE_INDEX
writePostData($always=false)
Evaluates a posted edit form and writes the form data in the question object.
getContextPath($cont_obj, $a_endnode_id, $a_startnode_id=1)
get context path in content object tree
setErrorMessage($errormessage)
const RENDER_PURPOSE_DEMOPLAY
getSolutionOutput( $active_id, $pass=null, $graphicalOutput=false, $result_output=false, $show_question_only=true, $show_feedback=false, $show_correct_solution=false, $show_manual_scoring=false, $show_question_text=true)
const PRESENTATION_CONTEXT_TEST
getQuestionType()
Returns the question type string.
$questionHeaderBlockBuilder
static _getClassNameForQType($q_type)
getType()
needed for page editor compliance
setEditContext($editContext)
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
setNavigationGUI($navigationGUI)
hasIntermediateSolution($activeId, $passIndex)
Check if the question has an intermediate solution.
addTab_Question(ilTabsGUI $tabsGUI)
setTargetGuiClass($targetGuiClass)
setQuestionSpecificTabs(ilTabsGUI $ilTabs)
isRenderPurposePrintPdf()
writeQuestionGenericPostData()
setQuestionCount($a_question_count)
getAnswerFrequencyTableGUI($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
escapeTemplatePlaceholders(string $text)
addSaveOnEnterOnLoadCode()
getBasicEditQuestionTabCommands()
getILIASPage($html="")
Returns the ILIAS Page around a question.
const RENDER_PURPOSE_PLAYBACK
isPreviousSolutionPrefilled()
getQuestionTemplate()
get question template
& createQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation.
setTaxonomyIds($taxonomyIds)
originalSyncForm($return_to="", $return_to_feedback='')
getAsValueAttribute($a_value)
Returns a HTML value attribute.
setPreviewSession($previewSession)
setTargetGui($linkTargetGui)
populateCorrectionsFormProperties(ilPropertyFormGUI $form)
getAdditionalEditQuestionCommands()
$previousSolutionPrefilled
const FORM_ENCODING_URLENCODE
isRenderPurposePlayback()
const RENDER_PURPOSE_PRINT_PDF
saveReturn()
save question
prepareReprintableCorrectionsForm(ilPropertyFormGUI $form)
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
outQuestionForTest( $formaction, $active_id, $pass, $is_question_postponed=false, $user_post_solutions=false, $show_specific_inline_feedback=false)
getQuestionHeaderBlockBuilder()
const EDIT_CONTEXT_ADJUSTMENT
setAdjustmentEditContext()
getTestOutput( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
$use_intermediate_solution
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
output question page
const EDIT_CONTEXT_AUTHORING
const RENDER_PURPOSE_PREVIEW
renderPurposeSupportsFormHtml()
getUseIntermediateSolution()
Get if intermediate solution should be used for solution output.
static _getGUIClassNameForId($a_q_id)
saveTaxonomyAssignments()
setPresentationContext($presentationContext)
getAnswersFrequency($relevantAnswers, $questionIndex)
populateJavascriptFilesRequiredForWorkForm(ilGlobalTemplateInterface $tpl)
setQuestionHeaderBlockBuilder($questionHeaderBlockBuilder)
addErrorMessage($errormessage)
isAnswerFreuqencyStatisticSupported()
suggestedsolution()
Allows to add suggested solutions for questions.
buildBasicEditFormObject()
const PRESENTATION_CONTEXT_RESULTS
getPreviousSolutionProvidedMessage()
getEditQuestionTabCommands()
setDefaultTabs(ilTabsGUI $ilTabs)
completeTestOutputFormAction($formAction, $active_id, $pass)
getSpecificFeedbackOutput($userSolution)
Returns the answer specific feedback for the question.
supportsIntermediateSolutionOutput()
Question type specific support of intermediate solution output The function getSolutionOutput respect...
addBackTab(ilTabsGUI $ilTabs)
setUseIntermediateSolution($use)
getUseUnchangedAnswerCheckboxHtml()
getPresentationJavascripts()
const RENDER_PURPOSE_INPUT_VALUE
setPreviousSolutionPrefilled($previousSolutionPrefilled)
isTestPresentationContext()
isRenderPurposeDemoplay()
__construct()
assQuestionGUI constructor
setRenderPurpose($renderPurpose)
hasCorrectSolution($activeId, $passIndex)
hasSpecialQuestionCommands()
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question,...
static getCommandsFromClassConstants($guiClassName, $cmdConstantNameBegin='CMD_')
extracts values of all constants of given class with given prefix as array can be used to get all pos...
isAdjustmentEditContext()
setQuestionActionCmd($questionActionCmd)
executeCommand()
execute command
getPreview($show_question_only=false, $showInlineFeedback=false)
const HAS_SPECIAL_QUESTION_COMMANDS
hasInlineFeedback()
this method can be overwritten per question type
$sequence_no
sequence number in test
$question_count
question count in test
getAnswerFeedbackOutput($active_id, $pass)
Returns the answer generic feedback depending on the results of the question.
getPreviousSolutionConfirmationCheckboxHtml()
getGenericFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
static getFeedbackClassNameByQuestionType($questionType)
const ADDITIONAL_CONTENT_EDITING_MODE_IPE
constant for additional content editing mode "pageobject"
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
static _questionExistsInTest($question_id, $test_id)
static _getInternalLinkHref($target="")
static getGuiClassNameByQuestionType($questionType)
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
static getQuestionTypeFromDb($question_id)
get question type for question id
static _isWriteable($question_id, $user_id)
Returns true if the question is writeable by a certain user.
const CMD_SHOW
command constants
const CMD_SHOW_LIST
command constants
static getInstance($identifier)
Class ilCommonActionDispatcherGUI.
static getPageList($lm_id)
static
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
static _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
Class ilObjContentObjectGUI.
static getManualFeedback($active_id, $question_id, $pass)
Retrieves the feedback comment for a question in a test if it is finalized.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _lookupType($a_id, $a_reference=false)
lookup object type
Class ilQuestionUsagesTableGUI.
Class ilQuestionInternalLinkSelectionTableGUI.
Class ilQuestionUsagesTableGUI.
This class represents an option in a radio group.
addTarget( $a_text, $a_link, $a_cmd="", $a_cmdClass="", $a_frame="", $a_activate=false, $a_dir_text=false)
setBackTarget($a_title, $a_target, $a_frame="")
back target for upper context
Taxonomy node <-> item assignment.
special template class to simplify handling of ITX/PEAR
static getReturnToPageLink($q_id=null)
This class represents a text area property in a property form.
This class represents a text property in a property form.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static stripOnlySlashes($a_str)
strip slashes if magic qoutes is enabled
static redirect($a_script)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
foreach($_POST as $key=> $value) $res