4 require_once
'./Services/Object/classes/class.ilObjectGUI.php';
5 require_once
'./Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
6 require_once
'./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
7 require_once
'./Modules/TestQuestionPool/exceptions/class.ilTestQuestionPoolException.php';
8 require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
9 require_once
'./Modules/Test/classes/class.ilObjAssessmentFolder.php';
10 require_once
'./Modules/Test/classes/class.ilObjTest.php';
46 $lng->loadLanguageModule(
"assessment");
50 $this->ctrl->saveParameter($this, array(
51 "ref_id",
"test_ref_id",
"calling_test",
"test_express_mode",
"q_id",
'tax_node'
71 global $ilLocator, $ilAccess, $ilNavigationHistory,
$tpl,
$ilCtrl,
$ilErr, $ilTabs,
$lng, $ilDB, $ilPluginAdmin;
73 if ((!$ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"])) && (!$ilAccess->checkAccess(
"visible",
"",
$_GET[
"ref_id"])))
76 $ilias->raiseError($this->lng->txt(
"permission_denied"), $ilias->error_obj->MESSAGE);
81 $ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"]))
83 if(
'qpl' == $this->object->getType())
85 $ilNavigationHistory->addItem(
$_GET[
"ref_id"],
86 "ilias.php?baseClass=ilObjQuestionPoolGUI&cmd=questions&ref_id=".
$_GET[
"ref_id"],
"qpl");
90 $cmd = $this->ctrl->getCmd(
"questions");
91 $next_class = $this->ctrl->getNextClass($this);
93 if( in_array($next_class, array(
'',
'ilobjquestionpoolgui')) &&
$cmd ==
'questions' )
100 $this->ctrl->setReturn($this,
"questions");
105 if (
$_GET[
"q_id"] < 1)
107 $q_type = (
$_POST[
"sel_question_types"] !=
"")
108 ?
$_POST[
"sel_question_types"]
109 :
$_GET[
"sel_question_types"];
111 if (
$cmd !=
"createQuestion" &&
$cmd !=
"createQuestionForTest"
112 && $next_class !=
"ilassquestionpagegui")
114 if ((
$_GET[
"test_ref_id"] !=
"") or (
$_GET[
"calling_test"]))
125 case "ilcommonactiondispatchergui":
126 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
128 $this->ctrl->forwardCommand($gui);
131 case 'ilmdeditorgui':
132 if(!$ilAccess->checkAccess(
'write',
'',$this->object->getRefId()))
134 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->WARNING);
137 include_once
'Services/MetaData/classes/class.ilMDEditorGUI.php';
139 $md_gui =
new ilMDEditorGUI($this->object->getId(), 0, $this->
object->getType());
140 $md_gui->
addObserver($this->
object,
'MDUpdateListener',
'General');
141 $this->ctrl->forwardCommand($md_gui);
143 case "ilassquestionpagegui":
144 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
145 $this->tpl->setCurrentBlock(
"ContentStyle");
147 $this->tpl->parseCurrentBlock();
150 $this->tpl->setCurrentBlock(
"SyntaxStyle");
152 $this->tpl->parseCurrentBlock();
154 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
156 $q_gui->setQuestionTabs();
157 $q_gui->outAdditionalOutput();
158 $q_gui->object->setObjId($this->object->getId());
159 $question = $q_gui->object;
160 $this->ctrl->saveParameter($this,
"q_id");
161 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
162 $this->lng->loadLanguageModule(
"content");
163 $this->ctrl->setReturnByClass(
"ilAssQuestionPageGUI",
"view");
164 $this->ctrl->setReturn($this,
"questions");
166 $page_gui->setEditPreview(
true);
167 $page_gui->setEnabledTabs(
false);
168 if (strlen($this->ctrl->getCmd()) == 0 && !isset(
$_POST[
"editImagemapForward_x"]))
170 $this->ctrl->setCmdClass(get_class($page_gui));
171 $this->ctrl->setCmd(
"preview");
173 $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(TRUE)));
174 $page_gui->setTemplateTargetVar(
"ADM_CONTENT");
175 $page_gui->setOutputMode(
"edit");
176 $page_gui->setHeader($question->getTitle());
177 $page_gui->setPresentationTitle($question->getTitle());
178 $ret = $this->ctrl->forwardCommand($page_gui);
179 $tpl->setContent(
$ret);
182 case 'ilpermissiongui':
183 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
185 $ret = $this->ctrl->forwardCommand($perm_gui);
188 case 'ilobjectcopygui':
189 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
192 $this->ctrl->forwardCommand($cp);
196 include_once(
"./Services/Export/classes/class.ilExportGUI.php");
198 $exp_gui->addFormat(
"zip", $this->lng->txt(
'qpl_export_xml'), $this,
"createExportQTI");
199 $exp_gui->addFormat(
"xls", $this->lng->txt(
'qpl_export_excel'), $this,
"createExportExcel");
202 $ret = $this->ctrl->forwardCommand($exp_gui);
205 case "ilinfoscreengui":
209 case 'ilassquestionhintsgui':
212 $this->ctrl->setReturn($this,
"questions");
215 require_once
'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
217 $questionGUI->object->setObjId($this->object->getId());
218 $questionGUI->setQuestionTabs();
221 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsGUI.php';
223 $ilCtrl->forwardCommand($gui);
227 case 'illocalunitconfigurationgui':
228 if(!$ilAccess->checkAccess(
'write',
'',$this->object->getRefId()))
230 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->WARNING);
233 require_once
'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
235 $questionGUI->object->setObjId($this->object->getId());
236 $questionGUI->setQuestionTabs();
238 $this->ctrl->setReturn($this,
'questions');
240 require_once
'Modules/TestQuestionPool/classes/class.ilLocalUnitConfigurationGUI.php';
241 require_once
'Modules/TestQuestionPool/classes/class.ilUnitConfigurationRepository.php';
245 $ilCtrl->forwardCommand($gui);
248 case 'ilassquestionfeedbackeditinggui':
251 $this->ctrl->setReturn($this,
"questions");
254 require_once
'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
256 $questionGUI->object->setObjId($this->object->getId());
257 $questionGUI->setQuestionTabs();
260 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
262 $ilCtrl->forwardCommand($gui);
266 case 'ilobjquestionpoolsettingsgeneralgui':
267 require_once
'Modules/TestQuestionPool/classes/class.ilObjQuestionPoolSettingsGeneralGUI.php';
269 $this->ctrl->forwardCommand($gui);
272 case "ilobjtaxonomygui":
274 require_once
'Modules/TestQuestionPool/classes/class.ilObjQuestionPoolTaxonomyEditingCommandForwarder.php';
276 $this->
object, $ilDB, $ilPluginAdmin, $ilCtrl, $ilTabs, $lng
279 $forwarder->forward();
283 case 'ilquestionbrowsertablegui':
287 case "ilobjquestionpoolgui":
290 if(
$cmd ==
'questions' )
292 $this->ctrl->setParameter($this,
'q_id',
'');
300 $this->ctrl->setReturn($this,
"questions");
301 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
303 $q_gui->object->setObjId($this->object->getId());
304 if($this->object->getType() ==
'qpl')
306 $q_gui->setTaxonomyIds($this->object->getTaxonomyIds());
307 $this->
object->addQuestionChangeListeners($q_gui->object);
309 $q_gui->setQuestionTabs();
310 $ret = $this->ctrl->forwardCommand($q_gui);
314 if ( !(strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui"
315 || strtolower(
$_GET[
'baseClass']) ==
'ilrepositorygui')
328 include_once(
"./Modules/File/classes/class.ilObjFile.php");
330 $fileObj->sendFile();
339 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
341 $page_gui->showMediaFullscreen();
358 $_POST[
"filter_text"] =
"";
359 $_POST[
"sel_filter_type"] =
"";
368 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
370 $pg_obj->send_paragraph (
$_GET[
"par_id"],
$_GET[
"downloadtitle"]);
379 $this->ctrl->setParameter($this,
'new_type',
$_REQUEST[
'new_type']);
380 if ($_FILES[
"xmldoc"][
"error"] > UPLOAD_ERR_OK)
385 $this->ctrl->redirect($this,
'create');
390 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
394 $file = pathinfo($_FILES[
"xmldoc"][
"name"]);
395 $full_path = $basedir.
"/".$_FILES[
"xmldoc"][
"name"];
396 $GLOBALS[
'ilLog']->write(__METHOD__.
": full path " . $full_path);
397 include_once
"./Services/Utilities/classes/class.ilUtil.php";
399 $GLOBALS[
'ilLog']->write(__METHOD__.
": full path " . $full_path);
400 if (strcmp($_FILES[
"xmldoc"][
"type"],
"text/xml") == 0)
402 $qti_file = $full_path;
411 $subdir = basename(
$file[
"basename"],
".".
$file[
"extension"]);
418 include_once
"./Services/QTI/classes/class.ilQTIParser.php";
420 $result = $qtiParser->startParsing();
421 $founditems =& $qtiParser->getFoundItems();
422 if (count($founditems) == 0)
432 $this->ctrl->redirect($this,
'create');
439 foreach ($founditems as $item)
441 if (strlen($item[
"type"]))
459 $this->ctrl->redirect($this,
'create');
464 $_SESSION[
"qpl_import_xml_file"] = $xml_file;
465 $_SESSION[
"qpl_import_qti_file"] = $qti_file;
466 $_SESSION[
"qpl_import_subdir"] = $subdir;
468 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.qpl_import_verification.html",
469 "Modules/TestQuestionPool");
470 $row_class = array(
"tblrow1",
"tblrow2");
472 foreach ($founditems as $item)
474 $this->tpl->setCurrentBlock(
"verification_row");
475 $this->tpl->setVariable(
"ROW_CLASS", $row_class[$counter++ % 2]);
476 $this->tpl->setVariable(
"QUESTION_TITLE", $item[
"title"]);
477 $this->tpl->setVariable(
"QUESTION_IDENT", $item[
"ident"]);
478 include_once
"./Services/QTI/classes/class.ilQTIItem.php";
479 switch ($item[
"type"])
482 $type = $this->lng->txt(
"assClozeTest");
485 $type = $this->lng->txt(
"assImagemapQuestion");
488 $type = $this->lng->txt(
"assJavaApplet");
491 $type = $this->lng->txt(
"assMatchingQuestion");
494 $type = $this->lng->txt(
"assMultipleChoice");
497 $type = $this->lng->txt(
"assSingleChoice");
500 $type = $this->lng->txt(
"assOrderingQuestion");
503 $type = $this->lng->txt(
"assTextQuestion");
506 $type = $this->lng->txt(
"assNumeric");
509 $type = $this->lng->txt(
"assTextSubset");
512 $type = $this->lng->txt($item[
"type"]);
516 if (strcmp($type,
"-" . $item[
"type"] .
"-") == 0)
518 global $ilPluginAdmin;
519 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
"TestQuestionPool",
"qst");
520 foreach ($pl_names as $pl_name)
523 if (strcmp($pl->getQuestionType(), $item[
"type"]) == 0)
525 $type = $pl->getQuestionTypeTranslation();
529 $this->tpl->setVariable(
"QUESTION_TYPE", $type);
530 $this->tpl->parseCurrentBlock();
533 $this->tpl->setCurrentBlock(
"import_qpl");
534 if (is_file($xml_file))
537 $fh = @fopen($xml_file,
"r") or die(
"");
538 $xml = @fread($fh, filesize($xml_file));
540 if (preg_match(
"/<ContentObject.*?MetaData.*?General.*?Title[^>]*?>([^<]*?)</", $xml, $matches))
542 $this->tpl->setVariable(
"VALUE_NEW_QUESTIONPOOL", $matches[1]);
545 $this->tpl->setVariable(
"TEXT_CREATE_NEW_QUESTIONPOOL", $this->lng->txt(
"qpl_import_create_new_qpl"));
546 $this->tpl->parseCurrentBlock();
548 $this->tpl->setCurrentBlock(
"adm_content");
549 $this->tpl->setVariable(
"TEXT_TYPE", $this->lng->txt(
"question_type"));
550 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"question_title"));
551 $this->tpl->setVariable(
"FOUND_QUESTIONS_INTRODUCTION", $this->lng->txt(
"qpl_import_verify_found_questions"));
554 $this->tpl->setVariable(
"VERIFICATION_HEADING", $this->lng->txt(
"import_questions_into_qpl"));
555 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
559 $this->tpl->setVariable(
"VERIFICATION_HEADING", $this->lng->txt(
"import_qpl"));
561 $this->ctrl->setParameter($this,
"new_type", $this->type);
562 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
567 $this->tpl->setVariable(
"VALUE_IMPORT", $this->lng->txt(
"import"));
568 $this->tpl->setVariable(
"VALUE_CANCEL", $this->lng->txt(
"cancel"));
569 $value_questions_only = 0;
570 if ($questions_only) $value_questions_only = 1;
571 $this->tpl->setVariable(
"VALUE_QUESTIONS_ONLY", $value_questions_only);
573 $this->tpl->parseCurrentBlock();
583 if (
$_POST[
"questions_only"] == 1)
589 include_once(
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
593 $newObj->setType(
$_GET[
"new_type"]);
595 $newObj->setTitle(
"dummy");
597 $newObj->setDescription(
"questionpool import");
599 $newObj->create(
true);
601 $newObj->createReference();
603 $newObj->putInTree(
$_GET[
"ref_id"]);
605 $newObj->setPermissions(
$_GET[
"ref_id"]);
607 $newObj->notify(
"new",
$_GET[
"ref_id"],
$_GET[
"parent_non_rbac_id"],
$_GET[
"ref_id"],$newObj->getRefId());
611 include_once
"./Services/QTI/classes/class.ilQTIParser.php";
613 $result = $qtiParser->startParsing();
616 if (strlen(
$_SESSION[
"qpl_import_xml_file"]))
618 include_once (
"./Modules/LearningModule/classes/class.ilContObjParser.php");
620 $contParser->setQuestionMapping($qtiParser->getImportMapping());
621 $contParser->startParsing();
625 $qpl_name =
$_POST[
"qpl_new"];
626 if ((strcmp($qpl_name, $newObj->getTitle()) != 0) && (strlen($qpl_name) > 0))
628 $newObj->setTitle($qpl_name);
633 include_once
"./Services/Utilities/classes/class.ilUtil.php";
636 if (
$_POST[
"questions_only"] == 1)
638 $this->ctrl->redirect($this,
"questions");
644 "&baseClass=ilObjQuestionPoolGUI");
650 if (
$_POST[
"questions_only"] == 1)
652 $this->ctrl->redirect($this,
"questions");
656 $this->ctrl->redirect($this,
"cancel");
665 $upload_valid =
true;
667 if($form->checkInput())
671 $form->setValuesByPost();
677 $form->setValuesByPost();
692 $this->tpl->setContent($form->getHtml());
700 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
702 $form->setTitle($this->lng->txt(
'import_question'));
703 $form->setFormAction($this->ctrl->getFormAction($this,
'upload'));
706 $file->setRequired(
true);
707 $form->addItem(
$file);
709 $form->addCommandButton(
'upload', $this->lng->txt(
'upload'));
710 $form->addCommandButton(
'questions', $this->lng->txt(
'cancel'));
722 $addContEditMode =
$_POST[
'add_quest_cont_edit_mode'];
729 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
731 $this->
object->addQuestionChangeListeners($q_gui->object);
732 $q_gui->object->setObjId($this->object->getId());
733 $q_gui->object->setAdditionalContentEditingMode($addContEditMode);
734 $q_gui->object->createNewQuestion();
735 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id", $q_gui->object->getId());
736 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types",
$_POST[
"sel_question_types"]);
737 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
747 require_once
'Modules/Test/classes/class.ilObjAssessmentFolder.php';
750 $addContEditMode =
$_REQUEST[
'add_quest_cont_edit_mode'];
757 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
759 $q_gui->object->setObjId($this->object->getId());
760 $q_gui->object->setAdditionalContentEditingMode($addContEditMode);
761 $q_gui->object->createNewQuestion();
763 $class = get_class($q_gui);
764 $qId = $q_gui->object->getId();
768 $class =
$_GET[
"sel_question_types"] .
'gui';
772 $this->ctrl->setParameterByClass($class,
"q_id", $qId);
773 $this->ctrl->setParameterByClass($class,
"sel_question_types",
$_REQUEST[
"sel_question_types"]);
774 $this->ctrl->setParameterByClass($class,
"prev_qid",
$_REQUEST[
"prev_qid"]);
776 $this->ctrl->redirectByClass($class,
"editQuestion");
789 "&baseClass=ilObjQuestionPoolGUI");
797 $this->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.il_as_qpl_content.html",
"Modules/TestQuestionPool");
798 $this->tpl->addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
803 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
805 $title = $this->lng->txt(
"statistics") .
" - $question_title";
808 $this->tpl->setVariable(
"HEADER", $title);
810 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
813 $color_class = array(
"tblrow1",
"tblrow2");
814 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_qpl_assessment_of_questions.html",
"Modules/TestQuestionPool");
815 if (!$total_of_answers)
817 $this->tpl->setCurrentBlock(
"emptyrow");
818 $this->tpl->setVariable(
"TXT_NO_ASSESSMENT", $this->lng->txt(
"qpl_assessment_no_assessment_of_questions"));
819 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
820 $this->tpl->parseCurrentBlock();
824 $this->tpl->setCurrentBlock(
"row");
825 $this->tpl->setVariable(
"TXT_RESULT", $this->lng->txt(
"qpl_assessment_total_of_answers"));
826 $this->tpl->setVariable(
"TXT_VALUE", $total_of_answers);
827 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
829 $this->tpl->parseCurrentBlock();
830 $this->tpl->setCurrentBlock(
"row");
831 $this->tpl->setVariable(
"TXT_RESULT", $this->lng->txt(
"qpl_assessment_total_of_right_answers"));
833 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
834 $this->tpl->parseCurrentBlock();
836 $this->tpl->setCurrentBlock(
"adm_content");
837 $this->tpl->setVariable(
"TXT_QUESTION_TITLE", $question_title);
838 $this->tpl->setVariable(
"TXT_RESULT", $this->lng->txt(
"result"));
839 $this->tpl->setVariable(
"TXT_VALUE", $this->lng->txt(
"value"));
840 $this->tpl->parseCurrentBlock();
846 $type =
$_GET[
"sel_question_types"];
847 $this->editQuestionForm($type);
857 if (count(
$_POST[
"q_id"]) < 1)
860 $this->ctrl->redirect($this,
"questions");
864 $deleteable_questions =& $this->
object->getDeleteableQuestionDetails(
$_POST[
"q_id"]);
865 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
867 $table_gui->
setEditable($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']));
868 $table_gui->setData($deleteable_questions);
869 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
879 foreach (
$_POST[
"q_id"] as $key => $value)
881 $this->
object->deleteQuestion($value);
882 $this->
object->cleanupClipboard($value);
886 $this->ctrl->setParameter($this,
'q_id',
'');
888 $this->ctrl->redirect($this,
"questions");
896 $this->ctrl->redirect($this,
"questions");
905 if (count(
$_POST[
"q_id"]) > 0)
907 include_once(
"./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php");
909 $export_file = $qpl_exp->buildExportFile();
912 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();
954 if(get_class($this->
object) ==
"ilObjTest")
956 if (
$_GET[
"calling_test"] > 0)
959 $q_id =
$_GET[
"q_id"];
963 ilUtil::redirect(
"ilias.php?ref_id=".
$ref_id.
"&q_id=".$q_id.
"&test_express_mode=1&cmd=showPage&cmdClass=iltestexpresspageobjectgui&baseClass=ilObjTestGUI");
965 ilUtil::redirect(
"ilias.php?ref_id=".
$ref_id.
"&test_express_mode=1&cmd=showPage&cmdClass=iltestexpresspageobjectgui&baseClass=ilObjTestGUI");
973 $this->
object->purgeQuestions();
977 require_once
'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
982 if( $rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']) )
987 $this->lng->txt(
"ass_create_question"),
988 $this->ctrl->getLinkTarget($this,
'createQuestionForm')
991 $this->tpl->setContent(
992 $this->ctrl->getHTML($toolbar) . $this->ctrl->getHTML($table_gui)
997 $this->tpl->setContent( $this->ctrl->getHTML($table_gui) );
1000 if( $this->object->getShowTaxonomies() )
1002 $this->lng->loadLanguageModule(
'tax');
1004 require_once
'Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php';
1006 foreach($taxIds as $taxId)
1008 if( $taxId != $this->object->getNavTaxonomyId() )
1014 $this,
'showNavTaxonomy', $taxId,
'ilobjquestionpoolgui',
'questions'
1017 if( !$taxExp->handleCommand() )
1019 $this->tpl->setLeftContent($taxExp->getHTML().
" ");
1031 $this->tpl->setContent( $this->ctrl->getHTML($form) );
1040 require_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1042 $form->setTitle($this->lng->txt(
'ass_create_question'));
1043 $form->setFormAction($this->ctrl->getFormAction($this));
1048 foreach( $this->object->getQuestionTypes(
false,
true) as $translation =>
$data )
1053 require_once(
"Services/Form/classes/class.ilSelectInputGUI.php");
1058 $form->addItem(
$si);
1064 $ri =
new ilRadioGroupInputGUI($this->lng->txt(
"tst_add_quest_cont_edit_mode"),
"add_quest_cont_edit_mode");
1067 $this->lng->txt(
'tst_add_quest_cont_edit_mode_default'),
1072 $this->lng->txt(
'tst_add_quest_cont_edit_mode_page_object'),
1078 $form->addItem($ri,
true);
1084 $form->addItem($hi,
true);
1089 $form->addCommandButton(
'createQuestion', $this->lng->txt(
'create'));
1090 $form->addCommandButton(
'questions', $this->lng->txt(
'cancel'));
1098 public function printObject()
1105 $ilToolbar->setFormAction($this->ctrl->getFormAction($this,
'print'));
1106 require_once
'Services/Form/classes/class.ilSelectInputGUI.php';
1109 'overview' => $this->lng->txt(
'overview'),
1110 'detailed' => $this->lng->txt(
'detailed_output_solutions'),
1111 'detailed_printview' => $this->lng->txt(
'detailed_output_printview')
1115 $ilToolbar->setFormName(
'printviewOptions');
1116 $ilToolbar->addInputItem($mode,
true);
1117 $ilToolbar->addFormButton($this->lng->txt(
'submit'),
'print');
1119 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionPoolPrintViewTableGUI.php";
1121 $data = $this->
object->getPrintviewQuestions();
1122 $table_gui->setData(
$data);
1123 $this->tpl->setContent($table_gui->getHTML());
1129 $this->update = $this->
object->update();
1138 if (array_key_exists(
"qpl_clipboard",
$_SESSION))
1140 if($this->object->pasteFromClipboard())
1153 $this->ctrl->redirect($this,
"questions");
1161 if (count(
$_POST[
"q_id"]) > 0)
1163 foreach (
$_POST[
"q_id"] as $key => $value)
1165 $this->
object->copyToClipboard($value);
1173 $this->ctrl->redirect($this,
"questions");
1181 if (count(
$_POST[
"q_id"]) > 0)
1183 foreach (
$_POST[
"q_id"] as $key => $value)
1185 $this->
object->moveToClipboard($value);
1193 $this->ctrl->redirect($this,
"questions");
1202 if ($rbacsystem->checkAccess(
"write",
$_GET[
'ref_id']))
1204 include_once(
"./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php");
1205 $question_ids =& $this->
object->getAllQuestionIds();
1207 $qpl_exp->buildExportFile();
1208 $this->ctrl->redirectByClass(
"ilexportgui",
"");
1215 if ($rbacsystem->checkAccess(
"write",
$_GET[
'ref_id']))
1217 include_once(
"./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php");
1218 $question_ids =& $this->
object->getAllQuestionIds();
1220 $qpl_exp->buildExportFile();
1221 $this->ctrl->redirectByClass(
"ilexportgui",
"");
1230 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1232 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
1237 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1239 $form->setTarget(
"_top");
1240 $form->setFormAction($this->ctrl->getFormAction($this));
1241 $form->setTitle($this->lng->txt(
"import_qpl"));
1243 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
1244 $fi =
new ilFileInputGUI($this->lng->txt(
"import_file"),
"xmldoc");
1246 $fi->setRequired(
true);
1247 $form->addItem($fi);
1249 $form->addCommandButton(
"importFile", $this->lng->txt(
"import"));
1250 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
1261 if($form->checkInput())
1267 $this->tpl->setContent($form->getHTML());
1273 switch ($this->ctrl->getCmd())
1280 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"",
$_GET[
"ref_id"]);
1283 if (
$_GET[
"q_id"] > 0)
1285 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1289 $q_gui->object->setObjId($this->object->getId());
1290 $title = $q_gui->object->getTitle();
1295 $ilLocator->addItem($title, $this->ctrl->getLinkTargetByClass(get_class($q_gui),
"editQuestion"));
1300 $this->ctrl->setParameter($this,
'q_id',
'');
1301 $this->ctrl->redirect($this);
1312 if (
$_GET[
"q_id"] > 0)
1314 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1318 $q_gui->object->setObjId($this->object->getId());
1319 $title = $q_gui->object->getTitle();
1320 if (strcmp($this->ctrl->getCmd(),
"assessment") == 0)
1322 $title .=
" - " . $this->lng->txt(
"statistics");
1328 $this->tpl->setTitle($title);
1329 $this->tpl->setDescription($q_gui->object->getComment());
1330 $this->tpl->setTitleIcon(
ilUtil::getImagePath(
"icon_".$this->object->getType().
"_b.png"), $this->lng->txt(
"obj_qpl"));
1335 $this->ctrl->setParameter($this,
'q_id',
'');
1336 $this->ctrl->redirect($this);
1341 $this->tpl->setTitle($this->object->getTitle());
1342 $this->tpl->setDescription($this->object->getLongDescription());
1343 $this->tpl->setTitleIcon(
ilUtil::getImagePath(
"icon_".$this->object->getType().
"_b.png"), $this->lng->txt(
"obj_qpl"));
1354 global $ilAccess, $ilHelp;
1356 $currentUserHasWriteAccess = $ilAccess->checkAccess(
"write",
"", $this->object->getRefId());
1358 $ilHelp->setScreenIdComponent(
"qpl");
1360 $next_class = strtolower($this->ctrl->getNextClass());
1361 switch ($next_class)
1364 case "ilpermissiongui":
1365 case "ilmdeditorgui":
1369 case 'ilobjtaxonomygui':
1370 case 'ilobjquestionpoolsettingsgeneralgui':
1372 if( $currentUserHasWriteAccess )
1384 $force_active =
false;
1385 $commands =
$_POST[
"cmd"];
1386 if (is_array($commands))
1388 foreach ($commands as $key => $value)
1390 if (preg_match(
"/^delete_.*/", $key, $matches) ||
1391 preg_match(
"/^addSelectGap_.*/", $key, $matches) ||
1392 preg_match(
"/^addTextGap_.*/", $key, $matches) ||
1393 preg_match(
"/^deleteImage_.*/", $key, $matches) ||
1394 preg_match(
"/^upload_.*/", $key, $matches) ||
1395 preg_match(
"/^addSuggestedSolution_.*/", $key, $matches)
1398 $force_active =
true;
1402 if (array_key_exists(
"imagemap_x",
$_POST))
1404 $force_active =
true;
1408 $force_active = ((strtolower($this->ctrl->getCmdClass()) == strtolower(get_class($this)) || strlen($this->ctrl->getCmdClass()) == 0) &&
1409 $this->ctrl->getCmd() ==
"")
1413 $tabs_gui->addTarget(
"assQuestions",
1414 $this->ctrl->getLinkTarget($this,
"questions"),
1415 array(
"questions",
"filter",
"resetFilter",
"createQuestion",
1416 "importQuestions",
"deleteQuestions",
"filterQuestionBrowser",
1417 "view",
"preview",
"editQuestion",
"exec_pg",
1418 "addItem",
"upload",
"save",
"cancel",
"addSuggestedSolution",
1419 "cancelExplorer",
"linkChilds",
"removeSuggestedSolution",
1420 "add",
"addYesNo",
"addTrueFalse",
"createGaps",
"saveEdit",
1421 "setMediaMode",
"uploadingImage",
"uploadingImagemap",
"addArea",
1422 "deletearea",
"saveShape",
"back",
"addPair",
"uploadingJavaapplet",
1423 "addParameter",
"assessment",
"addGIT",
"addST",
"addPG",
"delete",
1424 "toggleGraphicalAnswers",
"deleteAnswer",
"deleteImage",
"removeJavaapplet"),
1425 "",
"", $force_active);
1427 if ($ilAccess->checkAccess(
"visible",
"", $this->ref_id))
1429 $tabs_gui->addTarget(
"info_short",
1430 $this->ctrl->getLinkTarget($this,
"infoScreen"),
1431 array(
"infoScreen",
"showSummary"));
1434 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
'ref_id']))
1437 $tabs_gui->addTarget(
1438 'settings', $this->ctrl->getLinkTargetByClass(
'ilObjQuestionPoolSettingsGeneralGUI'),
1439 array(), array(
'ilObjQuestionPoolSettingsGeneralGUI',
'ilObjTaxonomyGUI')
1444 $tabs_gui->addTarget(
"print_view",
1445 $this->ctrl->getLinkTarget($this,
'print'),
1449 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
1452 $tabs_gui->addTarget(
"meta_data",
1453 $this->ctrl->getLinkTargetByClass(
'ilmdeditorgui',
'listSection'),
1454 "",
"ilmdeditorgui");
1462 if( $currentUserHasWriteAccess )
1464 $tabs_gui->addTarget(
"export",
1465 $this->ctrl->getLinkTargetByClass(
"ilexportgui",
""),
1469 if ($ilAccess->checkAccess(
"edit_permission",
"", $this->object->getRefId()))
1471 $tabs_gui->addTarget(
"perm_settings",
1472 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
1479 'qpl_settings_subtab_general',
1480 $this->ctrl->getLinkTargetByClass(
'ilObjQuestionPoolSettingsGeneralGUI'),
1481 '',
'ilObjQuestionPoolSettingsGeneralGUI'
1485 'qpl_settings_subtab_taxonomies',
1486 $this->ctrl->getLinkTargetByClass(
'ilObjTaxonomyGUI',
'editAOTaxonomySettings'),
1487 '',
'ilObjTaxonomyGUI'
1498 $this->ctrl->setCmd(
"showSummary");
1499 $this->ctrl->setCmdClass(
"ilinfoscreengui");
1508 global
$ilErr, $ilAccess;
1510 if(!$ilAccess->checkAccess(
"visible",
"", $this->ref_id))
1512 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"));
1515 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1517 $info->enablePrivateNotes();
1520 $info->addMetaDataSections($this->object->getId(), 0, $this->
object->getType());
1522 $this->ctrl->forwardCommand($info);
1537 if ($ilAccess->checkAccess(
"write",
"", $a_target))
1539 $_GET[
"baseClass"] =
"ilObjQuestionPoolGUI";
1540 $_GET[
"cmd"] =
"questions";
1541 $_GET[
"ref_id"] = $a_target;
1542 include_once(
"ilias.php");
1545 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
1551 $ilErr->raiseError($lng->txt(
"msg_no_perm_read_lm"), $ilErr->FATAL);
1564 global $rbacsystem, $ilDB,
$lng, $ilPluginAdmin;
1566 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
1567 $table_gui =
new ilQuestionBrowserTableGUI($this,
'questions', (($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']) ?
true :
false)),
false, $taxIds);
1568 $table_gui->
setEditable($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']));
1570 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
1571 $questionList =
new ilAssQuestionList($ilDB, $lng, $ilPluginAdmin, $this->object->getId());
1573 foreach ($table_gui->getFilterItems() as $item)
1575 if( substr($item->getPostVar(), 0, strlen(
'tax_')) ==
'tax_' )
1577 $v = $item->getValue();
1579 if( is_array($v) && count($v) && !(
int)$v[0] )
1584 $taxId = substr($item->getPostVar(), strlen(
'tax_'));
1587 elseif( $item->getValue() !== false )
1589 $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
1593 if( $this->object->isNavTaxonomyActive() && (int)
$_GET[
'tax_node'] )
1595 $questionList->addTaxonomyFilter( $this->object->getNavTaxonomyId(), array((
int)
$_GET[
'tax_node']) );
1598 $questionList->load();
1599 $data = $questionList->getQuestionDataArray();
1601 $table_gui->setData(
$data);