43 include_once
"./classes/class.ilObjectGUI.php";
44 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
45 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
46 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
57 $lng->loadLanguageModule(
"assessment");
60 $this->ctrl->saveParameter($this, array(
"ref_id",
"test_ref_id",
"calling_test"));
70 global $ilLocator, $ilAccess, $ilNavigationHistory,
$tpl;
71 if ((!$ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"])) && (!$ilAccess->checkAccess(
"visible",
"",
$_GET[
"ref_id"])))
74 $ilias->raiseError($this->lng->txt(
"permission_denied"), $ilias->error_obj->MESSAGE);
79 $ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"]))
81 $ilNavigationHistory->addItem(
$_GET[
"ref_id"],
82 "ilias.php?baseClass=ilObjQuestionPoolGUI&cmd=questions&ref_id=".
$_GET[
"ref_id"],
"qpl");
85 $cmd = $this->ctrl->getCmd(
"questions");
86 $next_class = $this->ctrl->getNextClass($this);
87 $this->ctrl->setReturn($this,
"questions");
90 if (
$_GET[
"q_id"] < 1)
92 $q_type = (
$_POST[
"sel_question_types"] !=
"")
93 ?
$_POST[
"sel_question_types"]
94 :
$_GET[
"sel_question_types"];
96 if (
$cmd !=
"createQuestion" &&
$cmd !=
"createQuestionForTest"
97 && $next_class !=
"ilpageobjectgui")
99 if ((
$_GET[
"test_ref_id"] !=
"") or (
$_GET[
"calling_test"]))
110 case 'ilmdeditorgui':
111 include_once
'Services/MetaData/classes/class.ilMDEditorGUI.php';
113 $md_gui =&
new ilMDEditorGUI($this->object->getId(), 0, $this->
object->getType());
114 $md_gui->
addObserver($this->
object,
'MDUpdateListener',
'General');
115 $this->ctrl->forwardCommand($md_gui);
117 case "ilpageobjectgui":
118 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
119 $this->tpl->setCurrentBlock(
"ContentStyle");
120 $this->tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
122 $this->tpl->parseCurrentBlock();
125 $this->tpl->setCurrentBlock(
"SyntaxStyle");
126 $this->tpl->setVariable(
"LOCATION_SYNTAX_STYLESHEET",
128 $this->tpl->parseCurrentBlock();
129 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
131 $q_gui->setQuestionTabs();
132 $q_gui->outAdditionalOutput();
133 $q_gui->object->setObjId($this->object->getId());
134 $question =& $q_gui->object;
135 $this->ctrl->saveParameter($this,
"q_id");
136 include_once(
"./Services/COPage/classes/class.ilPageObject.php");
137 include_once(
"./Services/COPage/classes/class.ilPageObjectGUI.php");
138 $this->lng->loadLanguageModule(
"content");
139 $this->ctrl->setReturnByClass(
"ilPageObjectGUI",
"view");
140 $this->ctrl->setReturn($this,
"questions");
143 $page_gui->setEditPreview(
true);
144 $page_gui->setEnabledTabs(
false);
145 $page_gui->setEnabledInternalLinks(
false);
146 if (strlen($this->ctrl->getCmd()) == 0)
148 $this->ctrl->setCmdClass(get_class($page_gui));
149 $this->ctrl->setCmd(
"preview");
152 $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(TRUE)));
153 $page_gui->setTemplateTargetVar(
"ADM_CONTENT");
154 $page_gui->setOutputMode(
"edit");
155 $page_gui->setHeader($question->getTitle());
156 $page_gui->setFileDownloadLink($this->ctrl->getLinkTarget($this,
"downloadFile"));
157 $page_gui->setFullscreenLink($this->ctrl->getLinkTarget($this,
"fullscreen"));
158 $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTarget($this));
159 $page_gui->setPresentationTitle($question->getTitle());
160 $ret =& $this->ctrl->forwardCommand($page_gui);
161 $tpl->setContent(
$ret);
164 case 'ilpermissiongui':
165 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
167 $ret =& $this->ctrl->forwardCommand($perm_gui);
170 case 'ilobjectcopygui':
171 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
174 $this->ctrl->forwardCommand($cp);
177 case "ilobjquestionpoolgui":
180 if(
$cmd ==
'questions' )
182 $this->ctrl->setParameter($this,
'q_id',
'');
190 $this->ctrl->setReturn($this,
"questions");
191 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
193 $q_gui->object->setObjId($this->object->getId());
194 $q_gui->setQuestionTabs();
195 $ret =& $this->ctrl->forwardCommand($q_gui);
199 if (strtolower(
$_GET[
"baseClass"]) !=
"iladministrationgui" &&
211 $save = ((strcmp($this->ctrl->getCmd(),
"save") == 0)) ?
true :
false;
214 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
216 $form->setFormAction($this->ctrl->getFormAction($this,
'properties'));
217 $form->setTitle($this->lng->txt(
"properties"));
218 $form->setMultipart(
false);
220 $form->setId(
"properties");
224 $online->
setInfo($this->lng->txt(
"qpl_online_property_description"));
225 $online->setChecked($this->object->getOnline());
226 $form->addItem($online);
228 $form->addCommandButton(
"saveProperties", $this->lng->txt(
"save"));
234 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
253 $qpl_online =
$_POST[
"online"];
254 if (strlen($qpl_online) == 0) $qpl_online =
"0";
255 $this->
object->setOnline($qpl_online);
256 $this->
object->saveToDb();
258 $this->ctrl->redirect($this,
"properties");
267 include_once(
"./Modules/File/classes/class.ilObjFile.php");
269 $fileObj->sendFile();
278 include_once(
"./Services/COPage/classes/class.ilPageObject.php");
279 include_once(
"./Services/COPage/classes/class.ilPageObjectGUI.php");
282 $page_gui->showMediaFullscreen();
300 $_POST[
"filter_text"] =
"";
301 $_POST[
"sel_filter_type"] =
"";
310 include_once(
"./Services/COPage/classes/class.ilPageObject.php");
312 $pg_obj->send_paragraph (
$_GET[
"par_id"],
$_GET[
"downloadtitle"]);
321 if ($_FILES[
"xmldoc"][
"error"] > UPLOAD_ERR_OK)
328 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
332 $file = pathinfo($_FILES[
"xmldoc"][
"name"]);
334 include_once
"./Services/Utilities/classes/class.ilUtil.php";
336 if (strcmp($_FILES[
"xmldoc"][
"type"],
"text/xml") == 0)
338 $qti_file = $full_path;
346 $subdir = basename(
$file[
"basename"],
".".
$file[
"extension"]);
352 include_once
"./Services/QTI/classes/class.ilQTIParser.php";
354 $result = $qtiParser->startParsing();
355 $founditems =& $qtiParser->getFoundItems();
356 if (count($founditems) == 0)
370 foreach ($founditems as $item)
372 if (strlen($item[
"type"]))
392 $_SESSION[
"qpl_import_xml_file"] = $xml_file;
393 $_SESSION[
"qpl_import_qti_file"] = $qti_file;
394 $_SESSION[
"qpl_import_subdir"] = $subdir;
396 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.qpl_import_verification.html");
397 $row_class = array(
"tblrow1",
"tblrow2");
399 foreach ($founditems as $item)
401 $this->tpl->setCurrentBlock(
"verification_row");
402 $this->tpl->setVariable(
"ROW_CLASS", $row_class[$counter++ % 2]);
403 $this->tpl->setVariable(
"QUESTION_TITLE", $item[
"title"]);
404 $this->tpl->setVariable(
"QUESTION_IDENT", $item[
"ident"]);
405 include_once
"./Services/QTI/classes/class.ilQTIItem.php";
406 switch ($item[
"type"])
409 $type = $this->lng->txt(
"assClozeTest");
412 $type = $this->lng->txt(
"assImagemapQuestion");
415 $type = $this->lng->txt(
"assJavaApplet");
418 $type = $this->lng->txt(
"assMatchingQuestion");
421 $type = $this->lng->txt(
"assMultipleChoice");
424 $type = $this->lng->txt(
"assSingleChoice");
427 $type = $this->lng->txt(
"assOrderingQuestion");
430 $type = $this->lng->txt(
"assTextQuestion");
433 $type = $this->lng->txt(
"assNumeric");
436 $type = $this->lng->txt(
"assTextSubset");
439 $type = $this->lng->txt($item[
"type"]);
443 if (strcmp($type,
"-" . $item[
"type"] .
"-") == 0)
445 global $ilPluginAdmin;
446 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
"TestQuestionPool",
"qst");
447 foreach ($pl_names as $pl_name)
450 if (strcmp($pl->getQuestionType(), $item[
"type"]) == 0)
452 $type = $pl->getQuestionTypeTranslation();
456 $this->tpl->setVariable(
"QUESTION_TYPE", $type);
457 $this->tpl->parseCurrentBlock();
460 $this->tpl->setCurrentBlock(
"import_qpl");
461 if (is_file($xml_file))
464 $fh = @fopen($xml_file,
"r") or die(
"");
465 $xml = @fread($fh, filesize($xml_file));
467 if (preg_match(
"/<ContentObject.*?MetaData.*?General.*?Title[^>]*?>([^<]*?)</", $xml, $matches))
469 $this->tpl->setVariable(
"VALUE_NEW_QUESTIONPOOL", $matches[1]);
472 $this->tpl->setVariable(
"TEXT_CREATE_NEW_QUESTIONPOOL", $this->lng->txt(
"qpl_import_create_new_qpl"));
473 $this->tpl->parseCurrentBlock();
475 $this->tpl->setCurrentBlock(
"adm_content");
476 $this->tpl->setVariable(
"TEXT_TYPE", $this->lng->txt(
"question_type"));
477 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"question_title"));
478 $this->tpl->setVariable(
"FOUND_QUESTIONS_INTRODUCTION", $this->lng->txt(
"qpl_import_verify_found_questions"));
481 $this->tpl->setVariable(
"VERIFICATION_HEADING", $this->lng->txt(
"import_questions_into_qpl"));
482 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
486 $this->tpl->setVariable(
"VERIFICATION_HEADING", $this->lng->txt(
"import_qpl"));
488 $this->ctrl->setParameter($this,
"new_type", $this->type);
489 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
494 $this->tpl->setVariable(
"VALUE_IMPORT", $this->lng->txt(
"import"));
495 $this->tpl->setVariable(
"VALUE_CANCEL", $this->lng->txt(
"cancel"));
496 $value_questions_only = 0;
497 if ($questions_only) $value_questions_only = 1;
498 $this->tpl->setVariable(
"VALUE_QUESTIONS_ONLY", $value_questions_only);
500 $this->tpl->parseCurrentBlock();
508 if (
$_POST[
"questions_only"] == 1)
514 include_once(
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
518 $newObj->setType(
$_GET[
"new_type"]);
520 $newObj->setTitle(
"dummy");
522 $newObj->setDescription(
"questionpool import");
524 $newObj->create(
true);
526 $newObj->createReference();
528 $newObj->putInTree(
$_GET[
"ref_id"]);
530 $newObj->setPermissions(
$_GET[
"ref_id"]);
532 $newObj->notify(
"new",
$_GET[
"ref_id"],
$_GET[
"parent_non_rbac_id"],
$_GET[
"ref_id"],$newObj->getRefId());
536 include_once
"./Services/QTI/classes/class.ilQTIParser.php";
538 $result = $qtiParser->startParsing();
541 if (strlen(
$_SESSION[
"qpl_import_xml_file"]))
543 include_once (
"./Modules/LearningModule/classes/class.ilContObjParser.php");
545 $contParser->setQuestionMapping($qtiParser->getImportMapping());
546 $contParser->startParsing();
550 $qpl_name =
$_POST[
"qpl_new"];
551 if ((strcmp($qpl_name, $newObj->getTitle()) != 0) && (strlen($qpl_name) > 0))
553 $newObj->setTitle($qpl_name);
558 include_once
"./Services/Utilities/classes/class.ilUtil.php";
561 if (
$_POST[
"questions_only"] == 1)
563 $this->ctrl->redirect($this,
"questions");
569 "&baseClass=ilObjQuestionPoolGUI");
575 if (
$_POST[
"questions_only"] == 1)
577 $this->ctrl->redirect($this,
"questions");
581 $this->ctrl->redirect($this,
"cancel");
598 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_import_question.html",
"Modules/TestQuestionPool");
599 $this->tpl->setCurrentBlock(
"adm_content");
600 $this->tpl->setVariable(
"TEXT_IMPORT_QUESTION", $this->lng->txt(
"import_question"));
601 $this->tpl->setVariable(
"TEXT_SELECT_FILE", $this->lng->txt(
"select_file"));
602 $this->tpl->setVariable(
"TEXT_UPLOAD", $this->lng->txt(
"upload"));
603 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
604 $this->tpl->parseCurrentBlock();
615 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"]))
617 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
620 $this->ctrl->setParameter($this,
"new_type", $this->type);
621 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
623 $this->tpl->setVariable(
"BTN_NAME",
"uploadQpl");
624 $this->tpl->setVariable(
"TXT_UPLOAD", $this->lng->txt(
"import"));
625 $this->tpl->setVariable(
"NEW_TYPE", $this->type);
626 $this->tpl->setVariable(
"TXT_IMPORT_QPL", $this->lng->txt(
"import_qpl"));
627 $this->tpl->setVariable(
"TXT_SELECT_MODE", $this->lng->txt(
"select_mode"));
628 $this->tpl->setVariable(
"TXT_SELECT_FILE", $this->lng->txt(
"select_file"));
629 $this->tpl->parseCurrentBlock();
637 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
639 $q_gui->object->setObjId($this->object->getId());
640 $q_gui->object->createNewQuestion();
641 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id", $q_gui->object->getId());
642 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types",
$_POST[
"sel_question_types"]);
643 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
651 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
653 $q_gui->object->setObjId($this->object->getId());
654 $q_gui->object->createNewQuestion();
655 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id", $q_gui->object->getId());
656 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types",
$_GET[
"sel_question_types"]);
657 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
668 if (!strlen(
$_POST[
'Fobject'][
'title']))
671 $this->ctrl->setParameter($this,
'new_type',
$_GET[
'new_type']);
672 $this->ctrl->redirect($this,
'create');
682 "&baseClass=ilObjQuestionPoolGUI");
700 $this->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.il_as_qpl_content.html",
"Modules/TestQuestionPool");
701 $this->tpl->addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
706 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
708 $title = $this->lng->txt(
"statistics") .
" - $question_title";
711 $this->tpl->setVariable(
"HEADER",
$title);
713 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
716 $color_class = array(
"tblrow1",
"tblrow2");
717 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_qpl_assessment_of_questions.html",
"Modules/TestQuestionPool");
718 if (!$total_of_answers)
720 $this->tpl->setCurrentBlock(
"emptyrow");
721 $this->tpl->setVariable(
"TXT_NO_ASSESSMENT", $this->lng->txt(
"qpl_assessment_no_assessment_of_questions"));
722 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
723 $this->tpl->parseCurrentBlock();
727 $this->tpl->setCurrentBlock(
"row");
728 $this->tpl->setVariable(
"TXT_RESULT", $this->lng->txt(
"qpl_assessment_total_of_answers"));
729 $this->tpl->setVariable(
"TXT_VALUE", $total_of_answers);
730 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
732 $this->tpl->parseCurrentBlock();
733 $this->tpl->setCurrentBlock(
"row");
734 $this->tpl->setVariable(
"TXT_RESULT", $this->lng->txt(
"qpl_assessment_total_of_right_answers"));
736 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
737 $this->tpl->parseCurrentBlock();
739 $this->tpl->setCurrentBlock(
"adm_content");
740 $this->tpl->setVariable(
"TXT_QUESTION_TITLE", $question_title);
741 $this->tpl->setVariable(
"TXT_RESULT", $this->lng->txt(
"result"));
742 $this->tpl->setVariable(
"TXT_VALUE", $this->lng->txt(
"value"));
743 $this->tpl->parseCurrentBlock();
749 $type =
$_GET[
"sel_question_types"];
750 $this->editQuestionForm($type);
760 if (count(
$_POST[
"q_id"]) < 1)
763 $this->ctrl->redirect($this,
"questions");
767 $deleteable_questions =& $this->
object->getDeleteableQuestionDetails(
$_POST[
"q_id"]);
768 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
770 $table_gui->
setEditable($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']));
771 $table_gui->setData($deleteable_questions);
772 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
782 foreach (
$_POST[
"q_id"] as $key => $value)
784 $this->
object->deleteQuestion($value);
787 $this->ctrl->redirect($this,
"questions");
795 $this->ctrl->redirect($this,
"questions");
804 if (count(
$_POST[
"q_id"]) > 0)
806 include_once(
"./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php");
808 $export_file = $qpl_exp->buildExportFile();
811 include_once
"./Services/Utilities/classes/class.ilUtil.php";
819 $this->ctrl->redirect($this,
"questions");
824 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
826 $table_gui->resetOffset();
827 $table_gui->writeFilterToSession();
833 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
835 $table_gui->resetOffset();
836 $table_gui->resetFilter();
848 $this->
object->purgeQuestions();
852 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_qpl_questionbrowser.html",
"Modules/TestQuestionPool");
853 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
855 $table_gui->
setEditable($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']));
856 $arrFilter = array();
857 foreach ($table_gui->getFilterItems() as $item)
859 if ($item->getValue() !==
false)
861 $arrFilter[$item->getPostVar()] = $item->getValue();
864 $data = $this->
object->getQuestionBrowserData($arrFilter);
865 $table_gui->setData(
$data);
866 $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());
868 if ($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']))
870 $this->tpl->setCurrentBlock(
"QTypes");
871 $types =& $this->
object->getQuestionTypes();
872 $lastquestiontype = $ilUser->getPref(
"tst_lastquestiontype");
873 foreach ($types as $translation =>
$data)
875 if (
$data[
"type_tag"] == $lastquestiontype)
877 $this->tpl->setVariable(
"QUESTION_TYPE_SELECTED",
" selected=\"selected\"");
879 $this->tpl->setVariable(
"QUESTION_TYPE_ID",
$data[
"type_tag"]);
880 $this->tpl->setVariable(
"QUESTION_TYPE", $translation);
881 $this->tpl->parseCurrentBlock();
883 $this->tpl->setVariable(
"QUESTION_ADD", $this->lng->txt(
"create"));
884 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
'questions'));
885 $this->tpl->parseCurrentBlock();
896 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_qpl_printview.html",
"Modules/TestQuestionPool");
900 $this->tpl->setVariable(
"SELECTED_DETAILED",
" selected=\"selected\"");
902 case 'detailed_printview':
903 $this->tpl->setVariable(
"SELECTED_DETAILED_PRINTVIEW",
" selected=\"selected\"");
908 $this->tpl->setVariable(
"TEXT_DETAILED", $this->lng->txt(
"detailed_output_solutions"));
909 $this->tpl->setVariable(
"TEXT_DETAILED_PRINTVIEW", $this->lng->txt(
"detailed_output_printview"));
910 $this->tpl->setVariable(
"TEXT_OVERVIEW", $this->lng->txt(
"overview"));
911 $this->tpl->setVariable(
"TEXT_SUBMIT", $this->lng->txt(
"submit"));
912 $this->tpl->setVariable(
"OUTPUT_MODE", $this->lng->txt(
"output_mode"));
913 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
'print'));
915 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionPoolPrintViewTableGUI.php";
917 $data =& $this->
object->getPrintviewQuestions();
918 $table_gui->setData(
$data);
919 $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());
924 "title" => $this->lng->txt(
"title"),
925 "description" => $this->lng->txt(
"description"),
926 "type" => $this->lng->txt(
"question_type"),
927 "author" => $this->lng->txt(
"author"),
928 "created" => $this->lng->txt(
"create_date"),
929 "updated" => $this->lng->txt(
"last_update")
931 foreach ($sortorder as $value => $text)
933 $this->tpl->setCurrentBlock(
"sortorder");
934 $this->tpl->setVariable(
"VALUE_SORTORDER", $value);
935 $this->tpl->setVariable(
"TEXT_SORTORDER", $text);
936 if (strcmp($sort, $value) == 0)
938 $this->tpl->setVariable(
"SELECTED_SORTORDER",
" selected=\"selected\"");
940 $this->tpl->parseCurrentBlock();
942 $table =& $this->
object->getPrintviewQuestions($sort);
943 $colors = array(
"tblrow1top",
"tblrow2top");
945 include_once
"./classes/class.ilFormat.php";
946 foreach ($table as
$row)
948 if ((strcmp(
$_POST[
"output"],
"detailed") == 0) || (strcmp(
$_POST[
"output"],
"detailed_printview") == 0))
950 $this->tpl->setCurrentBlock(
"overview_row_detail");
951 $this->tpl->setVariable(
"ROW_CLASS", $colors[$counter % 2]);
952 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
954 if (strcmp(
$_POST[
"output"],
"detailed") == 0)
956 $solutionoutput = $question_gui->getSolutionOutput($active_id =
"",
$pass = NULL, $graphicalOutput = FALSE, $result_output = FALSE, $show_question_only = FALSE, $show_feedback = FALSE, $show_correct_solution =
true, $show_manual_scoring =
false);
957 if (strlen($solutionoutput) == 0) $solutionoutput = $question_gui->getPreview();
958 $this->tpl->setVariable(
"PREVIEW", $solutionoutput);
962 $this->tpl->setVariable(
"PREVIEW", $question_gui->getPreview());
964 $this->tpl->parseCurrentBlock();
965 $this->tpl->setCurrentBlock(
"overview_row_detail");
966 $this->tpl->setVariable(
"ROW_CLASS", $colors[$counter % 2]);
967 $this->tpl->parseCurrentBlock();
969 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
970 $this->tpl->setCurrentBlock(
"overview_row");
971 $this->tpl->setVariable(
"ROW_CLASS", $colors[$counter % 2]);
972 $this->tpl->setVariable(
"TEXT_COUNTER", $counter);
976 $this->tpl->setVariable(
"TEXT_AUTHOR", $row[
"author"]);
979 $this->tpl->parseCurrentBlock();
982 $this->tpl->setCurrentBlock(
"overview");
983 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"title"));
984 $this->tpl->setVariable(
"TEXT_DESCRIPTION", $this->lng->txt(
"description"));
985 $this->tpl->setVariable(
"TEXT_QUESTIONTYPE", $this->lng->txt(
"question_type"));
986 $this->tpl->setVariable(
"TEXT_AUTHOR", $this->lng->txt(
"author"));
987 $this->tpl->setVariable(
"TEXT_CREATED", $this->lng->txt(
"create_date"));
988 $this->tpl->setVariable(
"TEXT_UPDATED", $this->lng->txt(
"last_update"));
989 $this->tpl->parseCurrentBlock();
990 $this->tpl->setCurrentBlock(
"adm_content");
991 $this->tpl->setVariable(
"SORT_TEXT", $this->lng->txt(
"sort_by_this_column"));
992 $this->tpl->setVariable(
"TEXT_SUBMIT", $this->lng->txt(
"submit"));
993 $this->tpl->setVariable(
"PRINT", $this->lng->txt(
"print"));
994 $this->tpl->parseCurrentBlock();
1003 $this->update = $this->
object->update();
1012 if (array_key_exists(
"qpl_clipboard",
$_SESSION))
1014 $this->
object->pasteFromClipboard();
1021 $this->ctrl->redirect($this,
"questions");
1029 if (count(
$_POST[
"q_id"]) > 0)
1031 foreach (
$_POST[
"q_id"] as $key => $value)
1033 $this->
object->copyToClipboard($value);
1041 $this->ctrl->redirect($this,
"questions");
1049 if (count(
$_POST[
"q_id"]) > 0)
1051 foreach (
$_POST[
"q_id"] as $key => $value)
1053 $this->
object->moveToClipboard($value);
1061 $this->ctrl->redirect($this,
"questions");
1069 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionPoolExportTableGUI.php";
1071 $export_dir = $this->
object->getExportDirectory();
1072 $export_files = $this->
object->getExportFiles($export_dir);
1074 foreach ($export_files as $exp_file)
1076 $file_arr = explode(
"__", $exp_file);
1079 $table_gui->setData(
$data);
1080 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
1090 if ($rbacsystem->checkAccess(
"write",
$_GET[
'ref_id']))
1092 include_once(
"./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php");
1093 $question_ids =& $this->
object->getAllQuestionIds();
1095 $qpl_exp->buildExportFile();
1096 $this->ctrl->redirect($this,
"export");
1101 $this->ctrl->redirect($this,
"export");
1110 if(!isset(
$_POST[
"file"]))
1113 $this->ctrl->redirect($this,
"export");
1116 if (count(
$_POST[
"file"]) > 1)
1119 $this->ctrl->redirect($this,
"export");
1123 $export_dir = $this->
object->getExportDirectory();
1124 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1127 $this->ctrl->redirect($this,
"export");
1135 if(!isset(
$_POST[
"file"]))
1138 $this->ctrl->redirect($this,
"export");
1142 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionPoolExportTableGUI.php";
1144 $export_dir = $this->
object->getExportDirectory();
1146 foreach (
$_POST[
'file'] as $exp_file)
1148 $file_arr = explode(
"__", $exp_file);
1151 $table_gui->setData(
$data);
1152 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
1161 session_unregister(
"ilExportFiles");
1162 $this->ctrl->redirect($this,
"export");
1170 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1171 $export_dir = $this->
object->getExportDirectory();
1174 $exp_file = $export_dir.
"/".
$file;
1175 include_once
"./Services/Utilities/classes/class.ilStr.php";
1177 if (@is_file($exp_file))
1181 if (@is_dir($exp_dir))
1186 $this->ctrl->redirect($this,
"export");
1194 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1196 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
1206 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"], $new_type))
1208 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
1216 $this->tpl->setCurrentBlock(
"adm_content");
1220 $data[
"fields"] = array();
1221 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1225 foreach (
$data[
"fields"] as $key => $val)
1227 $this->tpl->setVariable(
"TXT_".strtoupper($key), $this->lng->txt($key));
1228 $this->tpl->setVariable(strtoupper($key), $val);
1230 if ($this->prepare_output)
1232 $this->tpl->parseCurrentBlock();
1236 $this->ctrl->setParameter($this,
"new_type", $this->type);
1237 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1238 $this->tpl->setVariable(
"TXT_HEADER", $this->lng->txt($new_type.
"_new"));
1239 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
1240 $this->tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt($new_type.
"_add"));
1241 $this->tpl->setVariable(
"CMD_SUBMIT",
"save");
1242 $this->tpl->setVariable(
"TARGET",
' target="'.
1244 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
1246 $this->tpl->setVariable(
"TXT_IMPORT_QPL", $this->lng->txt(
"import_qpl"));
1247 $this->tpl->setVariable(
"TXT_QPL_FILE", $this->lng->txt(
"qpl_upload_file"));
1248 $this->tpl->setVariable(
"NEW_TYPE", $this->type);
1249 $this->tpl->setVariable(
"TXT_IMPORT", $this->lng->txt(
"import"));
1252 $this->tpl->setVariable(
"ALT_IMG",$this->lng->txt(
"obj_qpl"));
1254 $this->tpl->setVariable(
"ALT_IMG2",$this->lng->txt(
"obj_qpl"));
1256 $this->tpl->parseCurrentBlock();
1265 if (strcmp($_FILES[
"xmldoc"][
"tmp_name"],
"") == 0)
1277 switch ($this->ctrl->getCmd())
1284 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"",
$_GET[
"ref_id"]);
1287 if (
$_GET[
"q_id"] > 0)
1289 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1291 $q_gui->object->setObjId($this->object->getId());
1292 if (
$_GET[
"q_id"] > 0)
1294 $ilLocator->addItem($q_gui->object->getTitle(), $this->ctrl->getLinkTargetByClass(get_class($q_gui),
"editQuestion"));
1304 if (
$_GET[
"q_id"] > 0)
1306 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1308 $q_gui->object->setObjId($this->object->getId());
1309 $title = $q_gui->object->getTitle();
1310 if (strcmp($this->ctrl->getCmd(),
"assessment") == 0)
1312 $title .=
" - " . $this->lng->txt(
"statistics");
1314 $this->tpl->setTitle(
$title);
1315 $this->tpl->setDescription($q_gui->object->getComment());
1316 $this->tpl->setTitleIcon(
ilUtil::getImagePath(
"icon_".$this->object->getType().
"_b.gif"), $this->lng->txt(
"obj_qpl"));
1320 $this->tpl->setTitle($this->object->getTitle());
1321 $this->tpl->setDescription($this->object->getLongDescription());
1322 $this->tpl->setTitleIcon(
ilUtil::getImagePath(
"icon_".$this->object->getType().
"_b.gif"), $this->lng->txt(
"obj_qpl"));
1335 $next_class = $this->ctrl->getNextClass($this);
1336 switch ($next_class)
1339 case "ilpermissiongui":
1340 case "ilmdeditorgui":
1347 $force_active =
false;
1348 $commands =
$_POST[
"cmd"];
1349 if (is_array($commands))
1351 foreach ($commands as $key => $value)
1353 if (preg_match(
"/^delete_.*/", $key, $matches) ||
1354 preg_match(
"/^addSelectGap_.*/", $key, $matches) ||
1355 preg_match(
"/^addTextGap_.*/", $key, $matches) ||
1356 preg_match(
"/^deleteImage_.*/", $key, $matches) ||
1357 preg_match(
"/^upload_.*/", $key, $matches) ||
1358 preg_match(
"/^addSuggestedSolution_.*/", $key, $matches)
1361 $force_active =
true;
1365 if (array_key_exists(
"imagemap_x",
$_POST))
1367 $force_active =
true;
1371 $force_active = ((strtolower($this->ctrl->getCmdClass()) == strtolower(get_class($this)) || strlen($this->ctrl->getCmdClass()) == 0) &&
1372 $this->ctrl->getCmd() ==
"")
1376 $tabs_gui->addTarget(
"assQuestions",
1377 $this->ctrl->getLinkTarget($this,
"questions"),
1378 array(
"questions",
"filter",
"resetFilter",
"createQuestion",
1379 "importQuestions",
"deleteQuestions",
"filterQuestionBrowser",
1380 "view",
"preview",
"editQuestion",
"exec_pg",
1381 "addItem",
"upload",
"save",
"cancel",
"addSuggestedSolution",
1382 "cancelExplorer",
"linkChilds",
"removeSuggestedSolution",
1383 "add",
"addYesNo",
"addTrueFalse",
"createGaps",
"saveEdit",
1384 "setMediaMode",
"uploadingImage",
"uploadingImagemap",
"addArea",
1385 "deletearea",
"saveShape",
"back",
"addPair",
"uploadingJavaapplet",
1386 "addParameter",
"assessment",
"addGIT",
"addST",
"addPG",
"delete",
1387 "toggleGraphicalAnswers",
"deleteAnswer",
"deleteImage",
"removeJavaapplet"),
1388 "",
"", $force_active);
1390 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
'ref_id']))
1393 $tabs_gui->addTarget(
"settings",
1394 $this->ctrl->getLinkTarget($this,
'properties'),
1400 $tabs_gui->addTarget(
"print_view",
1401 $this->ctrl->getLinkTarget($this,
'print'),
1405 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
'ref_id']))
1408 $tabs_gui->addTarget(
"meta_data",
1409 $this->ctrl->getLinkTargetByClass(
'ilmdeditorgui',
'listSection'),
1410 "",
"ilmdeditorgui");
1413 $tabs_gui->addTarget(
"export",
1414 $this->ctrl->getLinkTarget($this,
'export'),
1415 array(
"export",
"createExportFile",
"confirmDeleteExportFile",
"downloadExportFile"),
1419 if ($ilAccess->checkAccess(
"edit_permission",
"",
$_GET[
'ref_id']))
1421 $tabs_gui->addTarget(
"perm_settings",
1422 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
1438 if ($ilAccess->checkAccess(
"write",
"", $a_target))
1440 $_GET[
"baseClass"] =
"ilObjQuestionPoolGUI";
1441 $_GET[
"cmd"] =
"questions";
1442 $_GET[
"ref_id"] = $a_target;
1443 include_once(
"ilias.php");
1446 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
1448 $_GET[
"cmd"] =
"frameset";
1449 $_GET[
"target"] =
"";
1450 $_GET[
"ref_id"] = ROOT_FOLDER_ID;
1453 include(
"repository.php");
1456 $ilErr->raiseError($lng->txt(
"msg_no_perm_read_lm"), $ilErr->FATAL);