4require_once
'./Services/Object/classes/class.ilObjectGUI.php';
5require_once
'./Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
6require_once
'./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
7require_once
'./Modules/TestQuestionPool/exceptions/class.ilTestQuestionPoolException.php';
8require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
9require_once
'./Modules/Test/classes/class.ilObjAssessmentFolder.php';
10require_once
'./Modules/Test/classes/class.ilObjTest.php';
49 $lng->loadLanguageModule(
"assessment");
53 $this->ctrl->saveParameter($this, array(
54 "ref_id",
"test_ref_id",
"calling_test",
"test_express_mode",
"q_id",
'tax_node',
'calling_consumer',
'consumer_context'
56 $this->ctrl->saveParameter($this,
"calling_consumer");
57 $this->ctrl->saveParameterByClass(
'ilAssQuestionPageGUI',
'calling_consumer');
58 $this->ctrl->saveParameterByClass(
'ilAssQuestionPageGUI',
'consumer_context');
59 $this->ctrl->saveParameterByClass(
'ilobjquestionpoolgui',
'calling_consumer');
60 $this->ctrl->saveParameterByClass(
'ilobjquestionpoolgui',
'consumer_context');
62 parent::__construct(
"",
$_GET[
"ref_id"],
true,
false);
79 global
$ilUser, $ilLocator, $ilAccess, $ilNavigationHistory,
$tpl,
$ilCtrl,
$ilErr, $ilTabs,
$lng,
$ilDB, $ilPluginAdmin, $ilias;
81 if ((!$ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"])) && (!$ilAccess->checkAccess(
"visible",
"",
$_GET[
"ref_id"]))) {
83 $ilias->raiseError($this->lng->txt(
"permission_denied"), $ilias->error_obj->MESSAGE);
88 $ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"])) {
89 if (
'qpl' == $this->object->getType()) {
90 $ilNavigationHistory->addItem(
92 "ilias.php?baseClass=ilObjQuestionPoolGUI&cmd=questions&ref_id=" .
$_GET[
"ref_id"],
98 $cmd = $this->ctrl->getCmd(
"questions");
99 $next_class = $this->ctrl->getNextClass($this);
101 if (in_array($next_class, array(
'',
'ilobjquestionpoolgui')) && $cmd ==
'questions') {
107 $this->ctrl->setReturn($this,
"questions");
112 if (
$_GET[
"q_id"] < 1) {
113 $q_type = (
$_POST[
"sel_question_types"] !=
"")
114 ?
$_POST[
"sel_question_types"]
115 :
$_GET[
"sel_question_types"];
117 if ($cmd !=
"createQuestion" && $cmd !=
"createQuestionForTest"
118 && $next_class !=
"ilassquestionpagegui") {
119 if ((
$_GET[
"test_ref_id"] !=
"") or (
$_GET[
"calling_test"])) {
126 switch ($next_class) {
127 case "ilcommonactiondispatchergui":
128 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
130 $this->ctrl->forwardCommand($gui);
133 case 'ilobjectmetadatagui':
134 if (!$ilAccess->checkAccess(
'write',
'', $this->object->getRefId())) {
135 $ilErr->raiseError($this->lng->txt(
'permission_denied'),
$ilErr->WARNING);
137 include_once
'Services/Object/classes/class.ilObjectMetaDataGUI.php';
139 $this->ctrl->forwardCommand($md_gui);
142 case 'ilassquestionpreviewgui':
144 $this->ctrl->saveParameter($this,
"q_id");
146 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewGUI.php';
149 $gui->initQuestion((
int)
$_GET[
'q_id'], $this->object->getId());
150 $gui->initPreviewSettings($this->object->getRefId());
151 $gui->initPreviewSession(
$ilUser->getId(), $this->fetchAuthoringQuestionIdParamater());
152 $gui->initHintTracking();
153 $gui->initStyleSheets();
156 $ilHelp->setScreenIdComponent(
"qpl");
158 $this->ctrl->forwardCommand($gui);
161 case "ilassquestionpagegui":
162 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
163 $this->tpl->setCurrentBlock(
"ContentStyle");
165 $this->tpl->parseCurrentBlock();
168 $this->tpl->setCurrentBlock(
"SyntaxStyle");
170 $this->tpl->parseCurrentBlock();
172 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
175 $q_gui->setQuestionTabs();
176 $q_gui->outAdditionalOutput();
177 $q_gui->object->setObjId($this->object->getId());
179 $q_gui->setTargetGuiClass(
null);
180 $q_gui->setQuestionActionCmd(
null);
182 $question = $q_gui->object;
183 $this->ctrl->saveParameter($this,
"q_id");
184 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
185 $this->lng->loadLanguageModule(
"content");
186 $this->ctrl->setReturnByClass(
"ilAssQuestionPageGUI",
"view");
187 $this->ctrl->setReturn($this,
"questions");
189 $page_gui->obj->addUpdateListener(
193 $page_gui->setEditPreview(
true);
194 $page_gui->setEnabledTabs(
false);
195 if (strlen($this->ctrl->getCmd()) == 0 && !isset(
$_POST[
"editImagemapForward_x"])) {
196 $this->ctrl->setCmdClass(get_class($page_gui));
197 $this->ctrl->setCmd(
"preview");
199 $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(
true)));
200 $page_gui->setTemplateTargetVar(
"ADM_CONTENT");
201 $page_gui->setOutputMode(
"edit");
202 $page_gui->setHeader($question->getTitle());
203 $page_gui->setPresentationTitle($question->getTitle());
204 $ret = $this->ctrl->forwardCommand($page_gui);
208 case 'ilpermissiongui':
209 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
211 $ret = $this->ctrl->forwardCommand($perm_gui);
214 case 'ilobjectcopygui':
215 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
218 $this->ctrl->forwardCommand($cp);
221 case "ilquestionpoolexportgui":
222 require_once
'Modules/TestQuestionPool/classes/class.ilQuestionPoolExportGUI.php';
224 $exp_gui->addFormat(
'xml', $this->lng->txt(
'qpl_export_xml'));
225 $exp_gui->addFormat(
'xls', $this->lng->txt(
'qpl_export_excel'), $this,
'createExportExcel');
226 $ret = $this->ctrl->forwardCommand($exp_gui);
229 case "ilinfoscreengui":
233 case 'ilassquestionhintsgui':
236 $this->ctrl->setReturn($this,
"questions");
239 require_once
'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
241 $questionGUI->object->setObjId($this->object->getId());
242 $questionGUI->setQuestionTabs();
244 $ilHelp->setScreenIdComponent(
"qpl");
247 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsGUI.php';
252 $gui->setEditingEnabled(
253 $DIC->access()->checkAccess(
'write',
'', $this->object->getRefId())
260 case 'illocalunitconfigurationgui':
261 if (!$ilAccess->checkAccess(
'write',
'', $this->object->getRefId())) {
262 $ilErr->raiseError($this->lng->txt(
'permission_denied'),
$ilErr->WARNING);
265 require_once
'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
267 $questionGUI->object->setObjId($this->object->getId());
268 $questionGUI->setQuestionTabs();
270 $this->ctrl->setReturn($this,
'questions');
272 require_once
'Modules/TestQuestionPool/classes/class.ilLocalUnitConfigurationGUI.php';
273 require_once
'Modules/TestQuestionPool/classes/class.ilUnitConfigurationRepository.php';
280 case 'ilassquestionfeedbackeditinggui':
283 $this->ctrl->setReturn($this,
"questions");
286 require_once
'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
288 $questionGUI->object->setObjId($this->object->getId());
289 $questionGUI->setQuestionTabs();
291 $ilHelp->setScreenIdComponent(
"qpl");
294 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
300 case 'ilobjquestionpoolsettingsgeneralgui':
301 require_once
'Modules/TestQuestionPool/classes/class.ilObjQuestionPoolSettingsGeneralGUI.php';
303 $this->ctrl->forwardCommand($gui);
306 case "ilobjtaxonomygui":
308 require_once
'Modules/TestQuestionPool/classes/class.ilObjQuestionPoolTaxonomyEditingCommandForwarder.php';
318 $forwarder->forward();
322 case 'ilquestionpoolskilladministrationgui':
324 require_once
'Modules/TestQuestionPool/classes/class.ilQuestionPoolSkillAdministrationGUI.php';
338 $this->ctrl->forwardCommand($gui);
342 case 'ilquestionbrowsertablegui':
346 case "ilobjquestionpoolgui":
349 if ($cmd ==
'questions') {
350 $this->ctrl->setParameter($this,
'q_id',
'');
354 $ret = $this->$cmd();
358 $this->ctrl->setReturn($this,
"questions");
359 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
362 $q_gui->object->setObjId($this->object->getId());
363 if ($this->object->getType() ==
'qpl') {
364 $q_gui->setTaxonomyIds($this->object->getTaxonomyIds());
365 $this->
object->addQuestionChangeListeners($q_gui->object);
367 $q_gui->setQuestionTabs();
369 $ilHelp->setScreenIdComponent(
"qpl");
370 $ret = $this->ctrl->forwardCommand($q_gui);
374 if (!(strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui"
375 || strtolower(
$_GET[
'baseClass']) ==
'ilrepositorygui')
388 $DIC->ctrl()->redirectByClass(
'ilQuestionPoolExportGUI');
397 include_once(
"./Modules/File/classes/class.ilObjFile.php");
399 $fileObj->sendFile();
408 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
410 $page_gui->showMediaFullscreen();
427 $_POST[
"filter_text"] =
"";
428 $_POST[
"sel_filter_type"] =
"";
437 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
439 $pg_obj->send_paragraph(
$_GET[
"par_id"],
$_GET[
"downloadtitle"]);
448 $this->ctrl->setParameter($this,
'new_type', $_REQUEST[
'new_type']);
449 if ($_FILES[
"xmldoc"][
"error"] > UPLOAD_ERR_OK) {
451 if (!$questions_only) {
452 $this->ctrl->redirect($this,
'create');
457 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
461 $file = pathinfo($_FILES[
"xmldoc"][
"name"]);
462 $full_path = $basedir .
"/" . $_FILES[
"xmldoc"][
"name"];
463 $GLOBALS[
'ilLog']->write(__METHOD__ .
": full path " . $full_path);
464 include_once
"./Services/Utilities/classes/class.ilUtil.php";
465 ilUtil::moveUploadedFile($_FILES[
"xmldoc"][
"tmp_name"], $_FILES[
"xmldoc"][
"name"], $full_path);
466 $GLOBALS[
'ilLog']->write(__METHOD__ .
": full path " . $full_path);
467 if (strcmp($_FILES[
"xmldoc"][
"type"],
"text/xml") == 0) {
468 $qti_file = $full_path;
475 $subdir = basename(
$file[
"basename"],
"." .
$file[
"extension"]);
482 include_once
"./Services/QTI/classes/class.ilQTIParser.php";
484 $result = $qtiParser->startParsing();
485 $founditems =&$qtiParser->getFoundItems();
486 if (count($founditems) == 0) {
493 if (!$questions_only) {
494 $this->ctrl->redirect($this,
'create');
501 foreach ($founditems as $item) {
502 if (strlen($item[
"type"])) {
509 if ($complete == 0) {
514 if (!$questions_only) {
515 $this->ctrl->redirect($this,
'create');
520 $_SESSION[
"qpl_import_xml_file"] = $xml_file;
521 $_SESSION[
"qpl_import_qti_file"] = $qti_file;
522 $_SESSION[
"qpl_import_subdir"] = $subdir;
524 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.qpl_import_verification.html",
"Modules/TestQuestionPool");
526 require_once
'Modules/TestQuestionPool/classes/tables/class.ilQuestionPoolImportVerificationTableGUI.php';
530 foreach ($founditems as $item) {
532 'title' => $item[
'title'],
533 'ident' => $item[
'ident'],
536 include_once
"./Services/QTI/classes/class.ilQTIItem.php";
537 switch ($item[
"type"]) {
539 $type = $this->lng->txt(
"assClozeTest");
542 $type = $this->lng->txt(
"assImagemapQuestion");
545 $type = $this->lng->txt(
"assJavaApplet");
548 $type = $this->lng->txt(
"assMatchingQuestion");
551 $type = $this->lng->txt(
"assMultipleChoice");
554 $type = $this->lng->txt(
"assKprimChoice");
557 $type = $this->lng->txt(
"assLongMenu");
560 $type = $this->lng->txt(
"assSingleChoice");
563 $type = $this->lng->txt(
"assOrderingQuestion");
566 $type = $this->lng->txt(
"assTextQuestion");
569 $type = $this->lng->txt(
"assNumeric");
572 $type = $this->lng->txt(
"assTextSubset");
575 $type = $this->lng->txt($item[
"type"]);
579 if (strcmp(
$type,
"-" . $item[
"type"] .
"-") == 0) {
580 global $ilPluginAdmin;
581 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
"TestQuestionPool",
"qst");
582 foreach ($pl_names as $pl_name) {
584 if (strcmp($pl->getQuestionType(), $item[
"type"]) == 0) {
585 $type = $pl->getQuestionTypeTranslation();
596 $this->tpl->setCurrentBlock(
"import_qpl");
597 if (is_file($xml_file)) {
599 $fh = @fopen($xml_file,
"r") or die(
"");
600 $xml = @fread(
$fh, filesize($xml_file));
602 if (preg_match(
"/<ContentObject.*?MetaData.*?General.*?Title[^>]*?>([^<]*?)</",
$xml, $matches)) {
603 $this->tpl->setVariable(
"VALUE_NEW_QUESTIONPOOL", $matches[1]);
606 $this->tpl->setVariable(
"TEXT_CREATE_NEW_QUESTIONPOOL", $this->lng->txt(
"qpl_import_create_new_qpl"));
607 $this->tpl->parseCurrentBlock();
609 $this->tpl->setCurrentBlock(
"adm_content");
610 $this->tpl->setVariable(
"FOUND_QUESTIONS_INTRODUCTION", $this->lng->txt(
"qpl_import_verify_found_questions"));
611 if ($questions_only) {
612 $this->tpl->setVariable(
"VERIFICATION_HEADING", $this->lng->txt(
"import_questions_into_qpl"));
613 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
615 $this->tpl->setVariable(
"VERIFICATION_HEADING", $this->lng->txt(
"import_qpl"));
617 $this->ctrl->setParameter($this,
"new_type", $this->type);
618 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
621 $value_questions_only = 0;
622 if ($questions_only) {
623 $value_questions_only = 1;
625 $this->tpl->setVariable(
"VALUE_QUESTIONS_ONLY", $value_questions_only);
626 $this->tpl->setVariable(
"VERIFICATION_TABLE",
$table->getHtml());
627 $this->tpl->setVariable(
"VERIFICATION_FORM_NAME",
$table->getFormName());
629 $this->tpl->parseCurrentBlock();
639 if (
$_POST[
"questions_only"] == 1) {
642 include_once(
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
646 $newObj->setType(
$_GET[
"new_type"]);
648 $newObj->setTitle(
"dummy");
650 $newObj->setDescription(
"questionpool import");
652 $newObj->create(
true);
654 $newObj->createReference();
656 $newObj->putInTree(
$_GET[
"ref_id"]);
658 $newObj->setPermissions(
$_GET[
"ref_id"]);
661 if (is_file(
$_SESSION[
"qpl_import_dir"] .
'/' .
$_SESSION[
"qpl_import_subdir"] .
"/manifest.xml")) {
664 $fileName =
$_SESSION[
"qpl_import_subdir"] .
'.zip';
665 $fullPath =
$_SESSION[
"qpl_import_dir"] .
'/' . $fileName;
667 include_once(
"./Services/Export/classes/class.ilImport.php");
669 $map = $imp->getMapping();
670 $map->addMapping(
"Modules/TestQuestionPool",
"qpl",
"new_id", $newObj->getId());
671 $imp->importObject($newObj, $fullPath, $fileName,
"qpl",
"Modules/TestQuestionPool",
true);
674 include_once
"./Services/QTI/classes/class.ilQTIParser.php";
676 $result = $qtiParser->startParsing();
679 if (strlen(
$_SESSION[
"qpl_import_xml_file"])) {
680 include_once(
"./Modules/LearningModule/classes/class.ilContObjParser.php");
682 $contParser->setQuestionMapping($qtiParser->getImportMapping());
683 $contParser->startParsing();
686 $newObj->fromXML(
$_SESSION[
"qpl_import_xml_file"]);
690 if (isset(
$_POST[
"qpl_new"]) && strlen(
$_POST[
"qpl_new"])) {
691 $newObj->setTitle(
$_POST[
"qpl_new"]);
699 include_once
"./Services/Utilities/classes/class.ilUtil.php";
702 if (
$_POST[
"questions_only"] == 1) {
703 $this->ctrl->redirect($this,
"questions");
707 "&baseClass=ilObjQuestionPoolGUI");
713 if (
$_POST[
"questions_only"] == 1) {
714 $this->ctrl->redirect($this,
"questions");
716 $this->ctrl->redirect($this,
"cancel");
725 $upload_valid =
true;
727 if (
$form->checkInput()) {
729 $form->setValuesByPost();
733 $form->setValuesByPost();
747 $this->tpl->setContent(
$form->getHtml());
755 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
757 $form->setTitle($this->lng->txt(
'import_question'));
758 $form->setFormAction($this->ctrl->getFormAction($this,
'upload'));
761 $file->setRequired(
true);
764 $form->addCommandButton(
'upload', $this->lng->txt(
'upload'));
765 $form->addCommandButton(
'questions', $this->lng->txt(
'cancel'));
776 $addContEditMode =
$_POST[
'add_quest_cont_edit_mode'];
781 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
783 $this->
object->addQuestionChangeListeners($q_gui->object);
784 $q_gui->object->setObjId($this->object->getId());
785 $q_gui->object->setAdditionalContentEditingMode($addContEditMode);
786 $q_gui->object->createNewQuestion();
787 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id", $q_gui->object->getId());
788 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types",
$_POST[
"sel_question_types"]);
789 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
797 if (!$_REQUEST[
'q_id']) {
798 require_once
'Modules/Test/classes/class.ilObjAssessmentFolder.php';
800 $addContEditMode = $_REQUEST[
'add_quest_cont_edit_mode'];
805 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
807 $q_gui->object->setObjId($this->object->getId());
808 $q_gui->object->setAdditionalContentEditingMode($addContEditMode);
809 $q_gui->object->createNewQuestion();
811 $class = get_class($q_gui);
812 $qId = $q_gui->object->getId();
814 $class =
$_GET[
"sel_question_types"] .
'gui';
815 $qId = $_REQUEST[
'q_id'];
818 $this->ctrl->setParameterByClass($class,
"q_id", $qId);
819 $this->ctrl->setParameterByClass($class,
"sel_question_types", $_REQUEST[
"sel_question_types"]);
820 $this->ctrl->setParameterByClass($class,
"prev_qid", $_REQUEST[
"prev_qid"]);
822 $this->ctrl->redirectByClass($class,
"editQuestion");
835 "&baseClass=ilObjQuestionPoolGUI");
842 $this->editQuestionForm(
$type);
852 $questionIdsToDelete = isset(
$_POST[
'q_id']) ? (array)
$_POST[
'q_id'] : array();
853 if (0 === count($questionIdsToDelete) && isset(
$_GET[
'q_id'])) {
854 $questionIdsToDelete = array(
$_GET[
'q_id']);
857 $questionIdsToDelete = array_filter(array_map(
'intval', $questionIdsToDelete));
858 if (0 === count($questionIdsToDelete)) {
860 $this->ctrl->redirect($this,
"questions");
864 $deleteable_questions =&$this->
object->getDeleteableQuestionDetails($questionIdsToDelete);
865 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
867 $table_gui->setShowRowsSelector(
false);
868 $table_gui->setLimit(PHP_INT_MAX);
869 $table_gui->setEditable(
$rbacsystem->checkAccess(
'write', (
int)
$_GET[
'ref_id']));
870 $table_gui->setData($deleteable_questions);
871 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
882 $this->
object->deleteQuestion($value);
883 $this->
object->cleanupClipboard($value);
885 if (count(
$_POST[
"q_id"])) {
889 $this->ctrl->setParameter($this,
'q_id',
'');
891 $this->ctrl->redirect($this,
"questions");
899 $this->ctrl->redirect($this,
"questions");
908 if (count(
$_POST[
"q_id"]) > 0) {
909 include_once(
"./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php");
911 $export_file = $qpl_exp->buildExportFile();
914 include_once
"./Services/Utilities/classes/class.ilUtil.php";
920 $this->ctrl->redirect($this,
"questions");
925 require_once
'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
928 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
930 $table_gui->resetOffset();
931 $table_gui->writeFilterToSession();
937 require_once
'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
940 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
942 $table_gui->resetOffset();
943 $table_gui->resetFilter();
949 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentImportFails.php';
951 $qsaImportFails->deleteRegisteredImportFails();
953 $this->ctrl->redirect($this,
'infoScreen');
963 if (get_class($this->
object) ==
"ilObjTest") {
964 if (
$_GET[
"calling_test"] > 0) {
966 $q_id =
$_GET[
"q_id"];
968 if ($_REQUEST[
'test_express_mode']) {
970 ilUtil::redirect(
"ilias.php?ref_id=" .
$ref_id .
"&q_id=" . $q_id .
"&test_express_mode=1&cmd=showPage&cmdClass=iltestexpresspageobjectgui&baseClass=ilObjTestGUI");
972 ilUtil::redirect(
"ilias.php?ref_id=" .
$ref_id .
"&test_express_mode=1&cmd=showPage&cmdClass=iltestexpresspageobjectgui&baseClass=ilObjTestGUI");
978 } elseif (isset(
$_GET[
'calling_consumer']) && (
int)
$_GET[
'calling_consumer']) {
984 require_once
'Services/Link/classes/class.ilLink.php';
988 $this->
object->purgeQuestions();
992 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentImportFails.php';
994 if ($qsaImportFails->failedImportsRegistered()) {
995 require_once
'Services/UIComponent/Button/classes/class.ilLinkButton.php';
997 $button->setUrl($this->ctrl->getLinkTarget($this,
'renoveImportFails'));
998 $button->setCaption(
'ass_skl_import_fails_remove_btn');
1000 ilUtil::sendFailure($qsaImportFails->getFailedImportsMessage($this->lng) .
'<br />' . $button->render());
1003 require_once
'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
1007 $table_gui->setPreventDoubleSubmission(
false);
1012 require_once
'Services/UIComponent/Button/classes/class.ilLinkButton.php';
1014 $btn->setCaption(
'ass_create_question');
1015 $btn->setUrl($this->ctrl->getLinkTarget($this,
'createQuestionForm'));
1016 $btn->setPrimary(
true);
1021 $btnImport->setCaption(
'import');
1022 $btnImport->setUrl($this->ctrl->getLinkTarget($this,
'importQuestions'));
1023 $toolbar->addButtonInstance($btnImport);
1025 if (array_key_exists(
"qpl_clipboard",
$_SESSION) && count(
$_SESSION[
'qpl_clipboard'])) {
1027 $btnPaste->setCaption(
'paste');
1028 $btnPaste->setUrl($this->ctrl->getLinkTarget($this,
'paste'));
1029 $toolbar->addButtonInstance($btnPaste);
1032 $this->tpl->setContent(
1033 $this->ctrl->getHTML(
$toolbar) . $this->ctrl->getHTML($table_gui)
1036 $this->tpl->setContent($this->ctrl->getHTML($table_gui));
1039 if ($this->object->getShowTaxonomies()) {
1040 $this->lng->loadLanguageModule(
'tax');
1042 require_once
'Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php';
1044 foreach ($taxIds as $taxId) {
1045 if ($taxId != $this->object->getNavTaxonomyId()) {
1053 'ilobjquestionpoolgui',
1057 if (!$taxExp->handleCommand()) {
1058 $this->tpl->setLeftContent($taxExp->getHTML() .
" ");
1071 $qId = (int)
$_GET[
'q_id'];
1073 if ($this->object->checkQuestionParent($qId)) {
1083 $ilHelp =
$DIC[
'ilHelp'];
1085 $ilHelp->setScreenId(
'assQuestions');
1088 $ilHelp->setSubScreenId(
'createQuestion_editMode');
1090 $ilHelp->setSubScreenId(
'createQuestion');
1095 $this->tpl->setContent($this->ctrl->getHTML(
$form));
1104 require_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1106 $form->setTitle($this->lng->txt(
'ass_create_question'));
1107 $form->setFormAction($this->ctrl->getFormAction($this));
1112 foreach ($this->object->getQuestionTypes(
false,
true) as $translation =>
$data) {
1116 require_once(
"Services/Form/classes/class.ilSelectInputGUI.php");
1126 $ri =
new ilRadioGroupInputGUI($this->lng->txt(
"tst_add_quest_cont_edit_mode"),
"add_quest_cont_edit_mode");
1129 $this->lng->txt(
'tst_add_quest_cont_edit_mode_default'),
1134 $this->lng->txt(
'tst_add_quest_cont_edit_mode_page_object'),
1140 $form->addItem($ri,
true);
1144 $form->addItem($hi,
true);
1149 $form->addCommandButton(
'createQuestion', $this->lng->txt(
'create'));
1150 $form->addCommandButton(
'questions', $this->lng->txt(
'cancel'));
1158 public function printObject()
1165 $ilToolbar->setFormAction($this->ctrl->getFormAction($this,
'print'));
1166 require_once
'Services/Form/classes/class.ilSelectInputGUI.php';
1168 $mode->setOptions(array(
1169 'overview' => $this->lng->txt(
'overview'),
1170 'detailed' => $this->lng->txt(
'detailed_output_solutions'),
1171 'detailed_printview' => $this->lng->txt(
'detailed_output_printview')
1175 $ilToolbar->setFormName(
'printviewOptions');
1176 $ilToolbar->addInputItem($mode,
true);
1177 $ilToolbar->addFormButton($this->lng->txt(
'submit'),
'print');
1179 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionPoolPrintViewTableGUI.php";
1181 $data = $this->
object->getPrintviewQuestions();
1184 $totalPoints +=
$d[
'points'];
1186 $table_gui->setTotalPoints($totalPoints);
1187 $table_gui->initColumns();
1188 $table_gui->setData(
$data);
1189 $this->tpl->setContent($table_gui->getHTML());
1195 $this->
update = $this->
object->update();
1204 if (array_key_exists(
"qpl_clipboard",
$_SESSION)) {
1205 if ($this->object->pasteFromClipboard()) {
1213 $this->ctrl->redirect($this,
"questions");
1221 if (isset(
$_POST[
"q_id"]) && is_array(
$_POST[
"q_id"]) && count(
$_POST[
"q_id"]) > 0) {
1223 $this->
object->copyToClipboard($value);
1226 } elseif (isset(
$_GET[
'q_id']) &&
$_GET[
'q_id'] > 0) {
1227 $this->
object->copyToClipboard((
int)
$_GET[
'q_id']);
1232 $this->ctrl->redirect($this,
"questions");
1240 if (isset(
$_POST[
"q_id"]) && is_array(
$_POST[
"q_id"]) && count(
$_POST[
"q_id"]) > 0) {
1242 $this->
object->moveToClipboard($value);
1245 } elseif (isset(
$_GET[
'q_id']) &&
$_GET[
'q_id'] > 0) {
1246 $this->
object->moveToClipboard((
int)
$_GET[
'q_id']);
1251 $this->ctrl->redirect($this,
"questions");
1258 include_once(
"./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php");
1259 $question_ids =&$this->
object->getAllQuestionIds();
1261 $qpl_exp->buildExportFile();
1262 $this->ctrl->redirectByClass(
"ilquestionpoolexportgui",
"");
1271 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1273 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
1278 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1280 $form->setTarget(
"_top");
1281 $form->setFormAction($this->ctrl->getFormAction($this));
1282 $form->setTitle($this->lng->txt(
"import_qpl"));
1284 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
1285 $fi =
new ilFileInputGUI($this->lng->txt(
"import_file"),
"xmldoc");
1286 $fi->setSuffixes(array(
"zip"));
1287 $fi->setRequired(
true);
1288 $form->addItem($fi);
1290 $form->addCommandButton(
"importFile", $this->lng->txt(
"import"));
1291 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
1302 if (
$form->checkInput()) {
1307 $this->tpl->setContent(
$form->getHTML());
1313 switch ($this->ctrl->getCmd()) {
1319 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"",
$_GET[
"ref_id"]);
1322 if (
$_GET[
"q_id"] > 0) {
1323 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1326 $q_gui->object->setObjId($this->object->getId());
1327 $title = $q_gui->object->getTitle();
1331 $ilLocator->addItem(
$title, $this->ctrl->getLinkTargetByClass(get_class($q_gui),
"editQuestion"));
1334 $this->ctrl->setParameter($this,
'q_id',
'');
1335 $this->ctrl->redirect($this);
1345 parent::setTitleAndDescription();
1346 if (
$_GET[
"q_id"] > 0) {
1347 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1350 $q_gui->object->setObjId($this->object->getId());
1351 $title = $q_gui->object->getTitle();
1355 $this->tpl->setTitle(
$title);
1356 $this->tpl->setDescription($q_gui->object->getComment());
1360 $this->ctrl->setParameter($this,
'q_id',
'');
1361 $this->ctrl->redirect($this);
1364 $this->tpl->setTitle($this->object->getTitle());
1365 $this->tpl->setDescription($this->object->getLongDescription());
1377 global $ilAccess, $ilHelp;
1379 $currentUserHasWriteAccess = $ilAccess->checkAccess(
"write",
"", $this->object->getRefId());
1381 $ilHelp->setScreenIdComponent(
"qpl");
1383 $next_class = strtolower($this->ctrl->getNextClass());
1384 switch ($next_class) {
1386 case "ilpermissiongui":
1387 case "ilobjectmetadatagui":
1388 case "ilquestionpoolexportgui":
1389 case "ilquestionpoolskilladministrationgui":
1392 case 'ilobjtaxonomygui':
1393 case 'ilobjquestionpoolsettingsgeneralgui':
1395 if ($currentUserHasWriteAccess) {
1406 $force_active =
false;
1407 $commands =
$_POST[
"cmd"];
1408 if (is_array($commands)) {
1409 foreach ($commands as
$key => $value) {
1410 if (preg_match(
"/^delete_.*/",
$key, $matches) ||
1411 preg_match(
"/^addSelectGap_.*/",
$key, $matches) ||
1412 preg_match(
"/^addTextGap_.*/",
$key, $matches) ||
1413 preg_match(
"/^deleteImage_.*/",
$key, $matches) ||
1414 preg_match(
"/^upload_.*/",
$key, $matches) ||
1415 preg_match(
"/^addSuggestedSolution_.*/",
$key, $matches)
1417 $force_active =
true;
1421 if (array_key_exists(
"imagemap_x",
$_POST)) {
1422 $force_active =
true;
1424 if (!$force_active) {
1425 $force_active = ((strtolower($this->ctrl->getCmdClass()) == strtolower(get_class($this)) || strlen($this->ctrl->getCmdClass()) == 0) &&
1426 $this->ctrl->getCmd() ==
"")
1430 $this->tabs_gui->addTarget(
1432 $this->ctrl->getLinkTarget($this,
"questions"),
1433 array(
"questions",
"filter",
"resetFilter",
"createQuestion",
1434 "importQuestions",
"deleteQuestions",
"filterQuestionBrowser",
1435 "view",
"preview",
"editQuestion",
"exec_pg",
1436 "addItem",
"upload",
"save",
"cancel",
"addSuggestedSolution",
1437 "cancelExplorer",
"linkChilds",
"removeSuggestedSolution",
1438 "add",
"addYesNo",
"addTrueFalse",
"createGaps",
"saveEdit",
1439 "setMediaMode",
"uploadingImage",
"uploadingImagemap",
"addArea",
1440 "deletearea",
"saveShape",
"back",
"addPair",
"uploadingJavaapplet",
1441 "addParameter",
"assessment",
"addGIT",
"addST",
"addPG",
"delete",
1442 "toggleGraphicalAnswers",
"deleteAnswer",
"deleteImage",
"removeJavaapplet"),
1448 if ($ilAccess->checkAccess(
"read",
"", $this->ref_id) || $ilAccess->checkAccess(
"visible",
"", $this->ref_id)) {
1449 $this->tabs_gui->addTarget(
1451 $this->ctrl->getLinkTarget($this,
"infoScreen"),
1452 array(
"infoScreen",
"showSummary")
1456 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
'ref_id'])) {
1458 $this->tabs_gui->addTarget(
1460 $this->ctrl->getLinkTargetByClass(
'ilObjQuestionPoolSettingsGeneralGUI'),
1462 array(
'ilObjQuestionPoolSettingsGeneralGUI',
'ilObjTaxonomyGUI')
1467 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentsGUI.php';
1469 $link = $this->ctrl->getLinkTargetByClass(
1470 array(
'ilQuestionPoolSkillAdministrationGUI',
'ilAssQuestionSkillAssignmentsGUI'),
1474 $this->tabs_gui->addTarget(
'qpl_tab_competences', $link, array(), array());
1479 $this->tabs_gui->addTarget(
1481 $this->ctrl->getLinkTarget($this,
'print'),
1487 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId())) {
1489 include_once
"Services/Object/classes/class.ilObjectMetaDataGUI.php";
1491 $mdtab = $mdgui->getTab();
1493 $this->tabs_gui->addTarget(
1507 if ($currentUserHasWriteAccess) {
1508 $this->tabs_gui->addTarget(
1510 $this->ctrl->getLinkTargetByClass(
"ilquestionpoolexportgui",
""),
1512 "ilquestionpoolexportgui"
1516 if ($ilAccess->checkAccess(
"edit_permission",
"", $this->object->getRefId())) {
1517 $this->tabs_gui->addTarget(
1519 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"),
1520 array(
"perm",
"info",
"owner"),
1532 if (!$this->object->isSkillServiceEnabled()) {
1545 $tabs->addSubTabTarget(
1546 'qpl_settings_subtab_general',
1547 $this->ctrl->getLinkTargetByClass(
'ilObjQuestionPoolSettingsGeneralGUI'),
1549 'ilObjQuestionPoolSettingsGeneralGUI'
1552 $tabs->addSubTabTarget(
1553 'qpl_settings_subtab_taxonomies',
1554 $this->ctrl->getLinkTargetByClass(
'ilObjTaxonomyGUI',
'editAOTaxonomySettings'),
1567 $this->ctrl->setCmd(
"showSummary");
1568 $this->ctrl->setCmdClass(
"ilinfoscreengui");
1577 global
$ilErr, $ilAccess;
1579 if (!$ilAccess->checkAccess(
"visible",
"", $this->ref_id)) {
1580 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"));
1583 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1585 $info->enablePrivateNotes();
1588 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
1590 $this->ctrl->forwardCommand(
$info);
1605 if ($ilAccess->checkAccess(
"write",
"", $a_target) || $ilAccess->checkAccess(
'read',
'', $a_target)) {
1606 $_GET[
'cmdClass'] =
'ilObjQuestionPoolGUI';
1607 $_GET[
'cmd'] =
'questions';
1608 $_GET[
'baseClass'] =
'ilRepositoryGUI';
1609 $_GET[
"ref_id"] = $a_target;
1610 include_once(
"ilias.php");
1612 } elseif ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID)) {
1614 $lng->txt(
"msg_no_perm_read_item"),
1634 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
1636 $table_gui->setEditable(
$rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']));
1638 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
1640 $questionList->setParentObjId($this->object->getId());
1642 foreach ($table_gui->getFilterItems() as $item) {
1643 if (substr($item->getPostVar(), 0, strlen(
'tax_')) ==
'tax_') {
1644 $v = $item->getValue();
1646 if (is_array($v) && count($v) && !(
int) $v[0]) {
1650 $taxId = substr($item->getPostVar(), strlen(
'tax_'));
1652 $questionList->addTaxonomyFilter(
1655 $this->object->getId(),
1656 $this->object->getType()
1658 } elseif ($item->getValue() !==
false) {
1659 $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
1663 if ($this->object->isNavTaxonomyActive() && (
int)
$_GET[
'tax_node']) {
1664 require_once
'Services/Taxonomy/classes/class.ilTaxonomyTree.php';
1665 $taxTree =
new ilTaxonomyTree($this->object->getNavTaxonomyId());
1666 $rootNodeId = $taxTree->readRootId();
1668 if ((
int)
$_GET[
'tax_node'] != $rootNodeId) {
1669 $questionList->addTaxonomyFilter(
1670 $this->object->getNavTaxonomyId(),
1671 array((
int)
$_GET[
'tax_node']),
1672 $this->object->getId(),
1673 $this->object->getType()
1678 $questionList->load();
1679 $data = $questionList->getQuestionDataArray();
1681 $table_gui->setData(
$data);
sprintf('%.4f', $callTime)
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
An exception for terminatinating execution or to throw for unit testing.
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...
const EDIT_CONTEXT_AUTHORING
const RENDER_PURPOSE_PREVIEW
Abstract basic class which is to be extended by the concrete assessment question type classes.
const ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT
constant for additional content editing mode "default"
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
const ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT
constant for additional content editing mode "pageobject"
const CMD_SHOW_SKILL_QUEST_ASSIGNS
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
Class ilLocalUnitConfigurationGUI.
static isAdditionalQuestionContentEditingModePageObjectEnabled()
returns the fact wether content editing with ilias page editor is enabled for questions or not
Class ilObjQuestionPoolGUI.
addSettingsSubTabs(ilTabsGUI $tabs)
renoveImportFailsObject()
importFileObject($parent_id=null, $a_catch_errors=true)
form for new questionpool object import
filterQuestionBrowserObject()
uploadQplObject($questions_only=false)
imports question(s) into the questionpool
confirmDeleteQuestionsObject()
delete questions
afterSave(ilObject $a_new_object)
save object @access public
updateObject()
updates object entry in object_data
fetchAuthoringQuestionIdParamater()
download_paragraphObject()
download source code paragraph
deleteQuestionsObject()
delete questions confirmation screen
& createQuestionForTestObject()
create new question
filterObject()
set question list filter
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
questionsObject()
list questions of question pool
getTabs()
adds tabs to tab gui object
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
importVerifiedFileObject()
imports question(s) into the questionpool (after verification)
uploadObject()
imports question(s) into the questionpool
moveObject()
mark one or more question objects for moving
& createQuestionObject()
create new question
buildCreateQuestionForm()
pasteObject()
paste questios from the clipboard into the question pool
resetQuestionBrowserObject()
initImportForm($a_new_type)
Init object import form.
cancelDeleteQuestionsObject()
Cancel question deletion.
& editQuestionForTestObject()
edit question
setTitleAndDescription()
called by prepare output
exportQuestionObject()
export question
infoScreenForward()
show information screen
executeCommand()
execute command
static _goto($a_target)
Redirect script to call a test with the question pool reference id.
buildQuestionBrowserTableGUI($taxIds)
__construct()
Constructor @access public.
createQuestionFormObject()
copyObject()
copy one or more question objects to the clipboard
downloadFileObject()
download file
exportObject()
Gateway for exports initiated from workspace, as there is a generic forward to {objTypeMainGUI}::expo...
resetFilterObject()
resets filter
importQuestionsObject(ilPropertyFormGUI $form=null)
display the import form to import questions into the questionpool
fullscreenObject()
show fullscreen view
static isSkillManagementGloballyActivated()
static _createImportDirectory()
creates data directory for import files (data_dir/qpl_data/qpl_<id>/import, depending on data directo...
static _getImportDirectory()
get import directory of lm
static _setImportDirectory($a_import_dir=null)
set import directory
static getSyntaxStylePath()
get syntax style path
static getContentStylePath($a_style_id, $add_random=true)
get content style path
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
static _setImportDirectory($a_import_dir=null)
set import directory
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
GUI class for the workflow of copying objects.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObjectGUI Basic methods of all Output classes.
prepareOutput($a_show_subobjects=true)
prepare output
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
getCreationMode()
get creation mode
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
getRefId()
get reference id @access public
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
Export User Interface Class.
Class ilQuestionPoolImportVerificationTableGUI.
Export class for questionpools.
This class represents an option in a radio group.
Taxonomy explorer GUI class.
Class ilUnitConfigurationRepository.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static redirect($a_script)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
if(!empty($this->data['faventry'])) $tabs
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
const CLOZE_TEST_IDENTIFIER
Question identifier constants.
const IMAGEMAP_QUESTION_IDENTIFIER
const SINGLE_CHOICE_QUESTION_IDENTIFIER
const TEXTSUBSET_QUESTION_IDENTIFIER
const NUMERIC_QUESTION_IDENTIFIER
const JAVAAPPLET_QUESTION_IDENTIFIER
const TEXT_QUESTION_IDENTIFIER
const LONG_MENU_QUESTION_IDENTIFIER
const KPRIM_CHOICE_QUESTION_IDENTIFIER
const MATCHING_QUESTION_IDENTIFIER
const MULTIPLE_CHOICE_QUESTION_IDENTIFIER
const ORDERING_QUESTION_IDENTIFIER
update($pash, $contents, Config $config)
if(empty($password)) $table
if(isset($_POST['submit'])) $form
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file