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';
48 $lng->loadLanguageModule(
"assessment");
52 $this->ctrl->saveParameter($this, array(
53 "ref_id",
"test_ref_id",
"calling_test",
"test_express_mode",
"q_id",
'tax_node',
'calling_consumer',
'consumer_context'
55 $this->ctrl->saveParameter($this,
"calling_consumer");
56 $this->ctrl->saveParameterByClass(
'ilAssQuestionPageGUI',
'calling_consumer');
57 $this->ctrl->saveParameterByClass(
'ilAssQuestionPageGUI',
'consumer_context');
58 $this->ctrl->saveParameterByClass(
'ilobjquestionpoolgui',
'calling_consumer');
59 $this->ctrl->saveParameterByClass(
'ilobjquestionpoolgui',
'consumer_context');
78 global
$ilUser, $ilLocator, $ilAccess, $ilNavigationHistory,
$tpl,
$ilCtrl,
$ilErr, $ilTabs,
$lng,
$ilDB, $ilPluginAdmin;
80 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"]))
90 if(
'qpl' == $this->object->getType())
92 $ilNavigationHistory->addItem(
$_GET[
"ref_id"],
93 "ilias.php?baseClass=ilObjQuestionPoolGUI&cmd=questions&ref_id=".
$_GET[
"ref_id"],
"qpl");
97 $cmd = $this->ctrl->getCmd(
"questions");
98 $next_class = $this->ctrl->getNextClass($this);
100 if( in_array($next_class, array(
'',
'ilobjquestionpoolgui')) &&
$cmd ==
'questions' )
107 $this->ctrl->setReturn($this,
"questions");
112 if (
$_GET[
"q_id"] < 1)
114 $q_type = (
$_POST[
"sel_question_types"] !=
"")
115 ?
$_POST[
"sel_question_types"]
116 :
$_GET[
"sel_question_types"];
118 if (
$cmd !=
"createQuestion" &&
$cmd !=
"createQuestionForTest"
119 && $next_class !=
"ilassquestionpagegui")
121 if ((
$_GET[
"test_ref_id"] !=
"") or (
$_GET[
"calling_test"]))
132 case "ilcommonactiondispatchergui":
133 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
135 $this->ctrl->forwardCommand($gui);
138 case 'ilmdeditorgui':
139 if(!$ilAccess->checkAccess(
'write',
'',$this->object->getRefId()))
141 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->WARNING);
144 include_once
'Services/MetaData/classes/class.ilMDEditorGUI.php';
146 $md_gui =
new ilMDEditorGUI($this->object->getId(), 0, $this->
object->getType());
147 $md_gui->
addObserver($this->
object,
'MDUpdateListener',
'General');
148 $this->ctrl->forwardCommand($md_gui);
151 case 'ilassquestionpreviewgui':
153 $this->ctrl->saveParameter($this,
"q_id");
155 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewGUI.php';
158 $gui->initQuestion((
int)
$_GET[
'q_id'], $this->object->getId());
159 $gui->initPreviewSettings($this->object->getRefId());
160 $gui->initPreviewSession($ilUser->getId(), (int)$_GET[
'q_id']);
161 $gui->initHintTracking();
162 $gui->initStyleSheets();
165 $ilHelp->setScreenIdComponent(
"qpl");
167 $this->ctrl->forwardCommand($gui);
170 case "ilassquestionpagegui":
171 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
172 $this->tpl->setCurrentBlock(
"ContentStyle");
174 $this->tpl->parseCurrentBlock();
177 $this->tpl->setCurrentBlock(
"SyntaxStyle");
179 $this->tpl->parseCurrentBlock();
181 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
183 $q_gui->setQuestionTabs();
184 $q_gui->outAdditionalOutput();
185 $q_gui->object->setObjId($this->object->getId());
187 $q_gui->setTargetGuiClass(null);
188 $q_gui->setQuestionActionCmd(null);
190 $question = $q_gui->object;
191 $this->ctrl->saveParameter($this,
"q_id");
192 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
193 $this->lng->loadLanguageModule(
"content");
194 $this->ctrl->setReturnByClass(
"ilAssQuestionPageGUI",
"view");
195 $this->ctrl->setReturn($this,
"questions");
197 $page_gui->setEditPreview(
true);
198 $page_gui->setEnabledTabs(
false);
199 if (strlen($this->ctrl->getCmd()) == 0 && !isset(
$_POST[
"editImagemapForward_x"]))
201 $this->ctrl->setCmdClass(get_class($page_gui));
202 $this->ctrl->setCmd(
"preview");
204 $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(TRUE)));
205 $page_gui->setTemplateTargetVar(
"ADM_CONTENT");
206 $page_gui->setOutputMode(
"edit");
207 $page_gui->setHeader($question->getTitle());
208 $page_gui->setPresentationTitle($question->getTitle());
209 $ret = $this->ctrl->forwardCommand($page_gui);
210 $tpl->setContent(
$ret);
213 case 'ilpermissiongui':
214 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
216 $ret = $this->ctrl->forwardCommand($perm_gui);
219 case 'ilobjectcopygui':
220 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
223 $this->ctrl->forwardCommand($cp);
226 case "ilquestionpoolexportgui":
227 require_once
'Modules/TestQuestionPool/classes/class.ilQuestionPoolExportGUI.php';
229 $exp_gui->addFormat(
'zip', $this->lng->txt(
'qpl_export_xml'), $this,
'createExportQTI');
230 $exp_gui->addFormat(
'xls', $this->lng->txt(
'qpl_export_excel'), $this,
'createExportExcel');
231 $ret = $this->ctrl->forwardCommand($exp_gui);
234 case "ilinfoscreengui":
238 case 'ilassquestionhintsgui':
241 $this->ctrl->setReturn($this,
"questions");
244 require_once
'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
246 $questionGUI->object->setObjId($this->object->getId());
247 $questionGUI->setQuestionTabs();
249 $ilHelp->setScreenIdComponent(
"qpl");
252 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsGUI.php';
254 $ilCtrl->forwardCommand($gui);
258 case 'illocalunitconfigurationgui':
259 if(!$ilAccess->checkAccess(
'write',
'',$this->object->getRefId()))
261 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->WARNING);
264 require_once
'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
266 $questionGUI->object->setObjId($this->object->getId());
267 $questionGUI->setQuestionTabs();
269 $this->ctrl->setReturn($this,
'questions');
271 require_once
'Modules/TestQuestionPool/classes/class.ilLocalUnitConfigurationGUI.php';
272 require_once
'Modules/TestQuestionPool/classes/class.ilUnitConfigurationRepository.php';
276 $ilCtrl->forwardCommand($gui);
279 case 'ilassquestionfeedbackeditinggui':
282 $this->ctrl->setReturn($this,
"questions");
285 require_once
'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
287 $questionGUI->object->setObjId($this->object->getId());
288 $questionGUI->setQuestionTabs();
290 $ilHelp->setScreenIdComponent(
"qpl");
293 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
295 $ilCtrl->forwardCommand($gui);
299 case 'ilobjquestionpoolsettingsgeneralgui':
300 require_once
'Modules/TestQuestionPool/classes/class.ilObjQuestionPoolSettingsGeneralGUI.php';
302 $this->ctrl->forwardCommand($gui);
305 case "ilobjtaxonomygui":
307 require_once
'Modules/TestQuestionPool/classes/class.ilObjQuestionPoolTaxonomyEditingCommandForwarder.php';
309 $this->
object, $ilDB, $ilPluginAdmin, $ilCtrl, $ilTabs, $lng
312 $forwarder->forward();
316 case 'ilquestionbrowsertablegui':
320 case "ilobjquestionpoolgui":
323 if(
$cmd ==
'questions' )
325 $this->ctrl->setParameter($this,
'q_id',
'');
333 $this->ctrl->setReturn($this,
"questions");
334 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
336 $q_gui->object->setObjId($this->object->getId());
337 if($this->object->getType() ==
'qpl')
339 $q_gui->setTaxonomyIds($this->object->getTaxonomyIds());
340 $this->
object->addQuestionChangeListeners($q_gui->object);
342 $q_gui->setQuestionTabs();
344 $ilHelp->setScreenIdComponent(
"qpl");
345 $ret = $this->ctrl->forwardCommand($q_gui);
349 if ( !(strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui"
350 || strtolower(
$_GET[
'baseClass']) ==
'ilrepositorygui')
363 include_once(
"./Modules/File/classes/class.ilObjFile.php");
365 $fileObj->sendFile();
374 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
376 $page_gui->showMediaFullscreen();
393 $_POST[
"filter_text"] =
"";
394 $_POST[
"sel_filter_type"] =
"";
403 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
405 $pg_obj->send_paragraph (
$_GET[
"par_id"],
$_GET[
"downloadtitle"]);
414 $this->ctrl->setParameter($this,
'new_type',
$_REQUEST[
'new_type']);
415 if ($_FILES[
"xmldoc"][
"error"] > UPLOAD_ERR_OK)
420 $this->ctrl->redirect($this,
'create');
425 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
429 $file = pathinfo($_FILES[
"xmldoc"][
"name"]);
430 $full_path = $basedir.
"/".$_FILES[
"xmldoc"][
"name"];
431 $GLOBALS[
'ilLog']->write(__METHOD__.
": full path " . $full_path);
432 include_once
"./Services/Utilities/classes/class.ilUtil.php";
434 $GLOBALS[
'ilLog']->write(__METHOD__.
": full path " . $full_path);
435 if (strcmp($_FILES[
"xmldoc"][
"type"],
"text/xml") == 0)
437 $qti_file = $full_path;
446 $subdir = basename(
$file[
"basename"],
".".
$file[
"extension"]);
453 include_once
"./Services/QTI/classes/class.ilQTIParser.php";
455 $result = $qtiParser->startParsing();
456 $founditems =& $qtiParser->getFoundItems();
457 if (count($founditems) == 0)
467 $this->ctrl->redirect($this,
'create');
474 foreach ($founditems as $item)
476 if (strlen($item[
"type"]))
494 $this->ctrl->redirect($this,
'create');
499 $_SESSION[
"qpl_import_xml_file"] = $xml_file;
500 $_SESSION[
"qpl_import_qti_file"] = $qti_file;
501 $_SESSION[
"qpl_import_subdir"] = $subdir;
503 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.qpl_import_verification.html",
504 "Modules/TestQuestionPool");
505 $row_class = array(
"tblrow1",
"tblrow2");
507 foreach ($founditems as $item)
509 $this->tpl->setCurrentBlock(
"verification_row");
510 $this->tpl->setVariable(
"ROW_CLASS", $row_class[$counter++ % 2]);
511 $this->tpl->setVariable(
"QUESTION_TITLE", $item[
"title"]);
512 $this->tpl->setVariable(
"QUESTION_IDENT", $item[
"ident"]);
513 include_once
"./Services/QTI/classes/class.ilQTIItem.php";
514 switch ($item[
"type"])
517 $type = $this->lng->txt(
"assClozeTest");
520 $type = $this->lng->txt(
"assImagemapQuestion");
523 $type = $this->lng->txt(
"assJavaApplet");
526 $type = $this->lng->txt(
"assMatchingQuestion");
529 $type = $this->lng->txt(
"assMultipleChoice");
532 $type = $this->lng->txt(
"assKprimChoice");
535 $type = $this->lng->txt(
"assSingleChoice");
538 $type = $this->lng->txt(
"assOrderingQuestion");
541 $type = $this->lng->txt(
"assTextQuestion");
544 $type = $this->lng->txt(
"assNumeric");
547 $type = $this->lng->txt(
"assTextSubset");
550 $type = $this->lng->txt($item[
"type"]);
554 if (strcmp($type,
"-" . $item[
"type"] .
"-") == 0)
556 global $ilPluginAdmin;
557 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
"TestQuestionPool",
"qst");
558 foreach ($pl_names as $pl_name)
561 if (strcmp($pl->getQuestionType(), $item[
"type"]) == 0)
563 $type = $pl->getQuestionTypeTranslation();
567 $this->tpl->setVariable(
"QUESTION_TYPE", $type);
568 $this->tpl->parseCurrentBlock();
571 $this->tpl->setCurrentBlock(
"import_qpl");
572 if (is_file($xml_file))
575 $fh = @fopen($xml_file,
"r") or die(
"");
576 $xml = @fread($fh, filesize($xml_file));
578 if (preg_match(
"/<ContentObject.*?MetaData.*?General.*?Title[^>]*?>([^<]*?)</", $xml, $matches))
580 $this->tpl->setVariable(
"VALUE_NEW_QUESTIONPOOL", $matches[1]);
583 $this->tpl->setVariable(
"TEXT_CREATE_NEW_QUESTIONPOOL", $this->lng->txt(
"qpl_import_create_new_qpl"));
584 $this->tpl->parseCurrentBlock();
586 $this->tpl->setCurrentBlock(
"adm_content");
587 $this->tpl->setVariable(
"TEXT_TYPE", $this->lng->txt(
"question_type"));
588 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"question_title"));
589 $this->tpl->setVariable(
"FOUND_QUESTIONS_INTRODUCTION", $this->lng->txt(
"qpl_import_verify_found_questions"));
592 $this->tpl->setVariable(
"VERIFICATION_HEADING", $this->lng->txt(
"import_questions_into_qpl"));
593 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
597 $this->tpl->setVariable(
"VERIFICATION_HEADING", $this->lng->txt(
"import_qpl"));
599 $this->ctrl->setParameter($this,
"new_type", $this->type);
600 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
605 $this->tpl->setVariable(
"VALUE_IMPORT", $this->lng->txt(
"import"));
606 $this->tpl->setVariable(
"VALUE_CANCEL", $this->lng->txt(
"cancel"));
607 $value_questions_only = 0;
608 if ($questions_only) $value_questions_only = 1;
609 $this->tpl->setVariable(
"VALUE_QUESTIONS_ONLY", $value_questions_only);
611 $this->tpl->parseCurrentBlock();
621 if (
$_POST[
"questions_only"] == 1)
627 include_once(
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
631 $newObj->setType(
$_GET[
"new_type"]);
633 $newObj->setTitle(
"dummy");
635 $newObj->setDescription(
"questionpool import");
637 $newObj->create(
true);
639 $newObj->createReference();
641 $newObj->putInTree(
$_GET[
"ref_id"]);
643 $newObj->setPermissions(
$_GET[
"ref_id"]);
645 $newObj->notify(
"new",
$_GET[
"ref_id"],
$_GET[
"parent_non_rbac_id"],
$_GET[
"ref_id"],$newObj->getRefId());
649 include_once
"./Services/QTI/classes/class.ilQTIParser.php";
651 $result = $qtiParser->startParsing();
654 if (strlen(
$_SESSION[
"qpl_import_xml_file"]))
656 include_once (
"./Modules/LearningModule/classes/class.ilContObjParser.php");
658 $contParser->setQuestionMapping($qtiParser->getImportMapping());
659 $contParser->startParsing();
663 $qpl_name =
$_POST[
"qpl_new"];
664 if ((strcmp($qpl_name, $newObj->getTitle()) != 0) && (strlen($qpl_name) > 0))
666 $newObj->setTitle($qpl_name);
671 include_once
"./Services/Utilities/classes/class.ilUtil.php";
674 if (
$_POST[
"questions_only"] == 1)
676 $this->ctrl->redirect($this,
"questions");
682 "&baseClass=ilObjQuestionPoolGUI");
688 if (
$_POST[
"questions_only"] == 1)
690 $this->ctrl->redirect($this,
"questions");
694 $this->ctrl->redirect($this,
"cancel");
703 $upload_valid =
true;
705 if($form->checkInput())
709 $form->setValuesByPost();
715 $form->setValuesByPost();
730 $this->tpl->setContent($form->getHtml());
738 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
740 $form->setTitle($this->lng->txt(
'import_question'));
741 $form->setFormAction($this->ctrl->getFormAction($this,
'upload'));
744 $file->setRequired(
true);
745 $form->addItem(
$file);
747 $form->addCommandButton(
'upload', $this->lng->txt(
'upload'));
748 $form->addCommandButton(
'questions', $this->lng->txt(
'cancel'));
760 $addContEditMode =
$_POST[
'add_quest_cont_edit_mode'];
767 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
769 $this->
object->addQuestionChangeListeners($q_gui->object);
770 $q_gui->object->setObjId($this->object->getId());
771 $q_gui->object->setAdditionalContentEditingMode($addContEditMode);
772 $q_gui->object->createNewQuestion();
773 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id", $q_gui->object->getId());
774 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types",
$_POST[
"sel_question_types"]);
775 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
785 require_once
'Modules/Test/classes/class.ilObjAssessmentFolder.php';
788 $addContEditMode =
$_REQUEST[
'add_quest_cont_edit_mode'];
795 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
797 $q_gui->object->setObjId($this->object->getId());
798 $q_gui->object->setAdditionalContentEditingMode($addContEditMode);
799 $q_gui->object->createNewQuestion();
801 $class = get_class($q_gui);
802 $qId = $q_gui->object->getId();
806 $class =
$_GET[
"sel_question_types"] .
'gui';
810 $this->ctrl->setParameterByClass($class,
"q_id", $qId);
811 $this->ctrl->setParameterByClass($class,
"sel_question_types",
$_REQUEST[
"sel_question_types"]);
812 $this->ctrl->setParameterByClass($class,
"prev_qid",
$_REQUEST[
"prev_qid"]);
814 $this->ctrl->redirectByClass($class,
"editQuestion");
827 "&baseClass=ilObjQuestionPoolGUI");
833 $type =
$_GET[
"sel_question_types"];
834 $this->editQuestionForm($type);
844 if (count(
$_POST[
"q_id"]) < 1)
847 $this->ctrl->redirect($this,
"questions");
851 $deleteable_questions =& $this->
object->getDeleteableQuestionDetails(
$_POST[
"q_id"]);
852 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
854 $table_gui->
setEditable($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']));
855 $table_gui->setData($deleteable_questions);
856 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
866 foreach (
$_POST[
"q_id"] as $key => $value)
868 $this->
object->deleteQuestion($value);
869 $this->
object->cleanupClipboard($value);
873 $this->ctrl->setParameter($this,
'q_id',
'');
875 $this->ctrl->redirect($this,
"questions");
883 $this->ctrl->redirect($this,
"questions");
892 if (count(
$_POST[
"q_id"]) > 0)
894 include_once(
"./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php");
896 $export_file = $qpl_exp->buildExportFile();
899 include_once
"./Services/Utilities/classes/class.ilUtil.php";
907 $this->ctrl->redirect($this,
"questions");
912 require_once
'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
915 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
917 $table_gui->resetOffset();
918 $table_gui->writeFilterToSession();
924 require_once
'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
927 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
929 $table_gui->resetOffset();
930 $table_gui->resetFilter();
941 if(get_class($this->
object) ==
"ilObjTest")
943 if (
$_GET[
"calling_test"] > 0)
946 $q_id =
$_GET[
"q_id"];
950 ilUtil::redirect(
"ilias.php?ref_id=".
$ref_id.
"&q_id=".$q_id.
"&test_express_mode=1&cmd=showPage&cmdClass=iltestexpresspageobjectgui&baseClass=ilObjTestGUI");
952 ilUtil::redirect(
"ilias.php?ref_id=".
$ref_id.
"&test_express_mode=1&cmd=showPage&cmdClass=iltestexpresspageobjectgui&baseClass=ilObjTestGUI");
959 else if(isset(
$_GET[
'calling_consumer']) && (
int)
$_GET[
'calling_consumer'])
961 $ref_id = (int)$_GET[
'calling_consumer'];
965 ilUtil::redirect($consumer->getQuestionEditingFormBackTarget($_GET[
'consumer_context']));
967 require_once
'Services/Link/classes/class.ilLink.php';
971 $this->
object->purgeQuestions();
975 require_once
'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
979 $table_gui->setPreventDoubleSubmission(
false);
981 if( $rbacsystem->checkAccess(
'write', $_GET[
'ref_id']) )
986 $this->lng->txt(
"ass_create_question"),
987 $this->ctrl->getLinkTarget($this,
'createQuestionForm')
990 $this->tpl->setContent(
991 $this->ctrl->getHTML($toolbar) . $this->ctrl->getHTML($table_gui)
996 $this->tpl->setContent( $this->ctrl->getHTML($table_gui) );
999 if( $this->object->getShowTaxonomies() )
1001 $this->lng->loadLanguageModule(
'tax');
1003 require_once
'Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php';
1005 foreach($taxIds as $taxId)
1007 if( $taxId != $this->object->getNavTaxonomyId() )
1013 $this,
'showNavTaxonomy', $taxId,
'ilobjquestionpoolgui',
'questions'
1016 if( !$taxExp->handleCommand() )
1018 $this->tpl->setLeftContent($taxExp->getHTML().
" ");
1030 $this->tpl->setContent( $this->ctrl->getHTML($form) );
1039 require_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1041 $form->setTitle($this->lng->txt(
'ass_create_question'));
1042 $form->setFormAction($this->ctrl->getFormAction($this));
1047 foreach( $this->object->getQuestionTypes(
false,
true) as $translation =>
$data )
1052 require_once(
"Services/Form/classes/class.ilSelectInputGUI.php");
1057 $form->addItem(
$si);
1063 $ri =
new ilRadioGroupInputGUI($this->lng->txt(
"tst_add_quest_cont_edit_mode"),
"add_quest_cont_edit_mode");
1066 $this->lng->txt(
'tst_add_quest_cont_edit_mode_default'),
1071 $this->lng->txt(
'tst_add_quest_cont_edit_mode_page_object'),
1077 $form->addItem($ri,
true);
1083 $form->addItem($hi,
true);
1088 $form->addCommandButton(
'createQuestion', $this->lng->txt(
'create'));
1089 $form->addCommandButton(
'questions', $this->lng->txt(
'cancel'));
1097 public function printObject()
1104 $ilToolbar->setFormAction($this->ctrl->getFormAction($this,
'print'));
1105 require_once
'Services/Form/classes/class.ilSelectInputGUI.php';
1108 'overview' => $this->lng->txt(
'overview'),
1109 'detailed' => $this->lng->txt(
'detailed_output_solutions'),
1110 'detailed_printview' => $this->lng->txt(
'detailed_output_printview')
1114 $ilToolbar->setFormName(
'printviewOptions');
1115 $ilToolbar->addInputItem($mode,
true);
1116 $ilToolbar->addFormButton($this->lng->txt(
'submit'),
'print');
1118 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionPoolPrintViewTableGUI.php";
1120 $data = $this->
object->getPrintviewQuestions();
1124 $totalPoints += $d[
'points'];
1126 $table_gui->setTotalPoints($totalPoints);
1127 $table_gui->initColumns();
1128 $table_gui->setData(
$data);
1129 $this->tpl->setContent($table_gui->getHTML());
1135 $this->update = $this->
object->update();
1144 if (array_key_exists(
"qpl_clipboard",
$_SESSION))
1146 if($this->object->pasteFromClipboard())
1159 $this->ctrl->redirect($this,
"questions");
1167 if (count(
$_POST[
"q_id"]) > 0)
1169 foreach (
$_POST[
"q_id"] as $key => $value)
1171 $this->
object->copyToClipboard($value);
1179 $this->ctrl->redirect($this,
"questions");
1187 if (count(
$_POST[
"q_id"]) > 0)
1189 foreach (
$_POST[
"q_id"] as $key => $value)
1191 $this->
object->moveToClipboard($value);
1199 $this->ctrl->redirect($this,
"questions");
1208 if ($rbacsystem->checkAccess(
"write",
$_GET[
'ref_id']))
1210 include_once(
"./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php");
1211 $question_ids =& $this->
object->getAllQuestionIds();
1213 $qpl_exp->buildExportFile();
1214 $this->ctrl->redirectByClass(
"ilquestionpoolexportgui",
"");
1221 if ($rbacsystem->checkAccess(
"write",
$_GET[
'ref_id']))
1223 include_once(
"./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php");
1224 $question_ids =& $this->
object->getAllQuestionIds();
1226 $qpl_exp->buildExportFile();
1227 $this->ctrl->redirectByClass(
"ilquestionpoolexportgui",
"");
1236 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1238 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
1243 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1245 $form->setTarget(
"_top");
1246 $form->setFormAction($this->ctrl->getFormAction($this));
1247 $form->setTitle($this->lng->txt(
"import_qpl"));
1249 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
1250 $fi =
new ilFileInputGUI($this->lng->txt(
"import_file"),
"xmldoc");
1252 $fi->setRequired(
true);
1253 $form->addItem($fi);
1255 $form->addCommandButton(
"importFile", $this->lng->txt(
"import"));
1256 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
1267 if($form->checkInput())
1273 $this->tpl->setContent($form->getHTML());
1279 switch ($this->ctrl->getCmd())
1286 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"",
$_GET[
"ref_id"]);
1289 if (
$_GET[
"q_id"] > 0)
1291 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1295 $q_gui->object->setObjId($this->object->getId());
1296 $title = $q_gui->object->getTitle();
1301 $ilLocator->addItem($title, $this->ctrl->getLinkTargetByClass(get_class($q_gui),
"editQuestion"));
1306 $this->ctrl->setParameter($this,
'q_id',
'');
1307 $this->ctrl->redirect($this);
1318 if (
$_GET[
"q_id"] > 0)
1320 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1324 $q_gui->object->setObjId($this->object->getId());
1325 $title = $q_gui->object->getTitle();
1330 $this->tpl->setTitle($title);
1331 $this->tpl->setDescription($q_gui->object->getComment());
1334 $this->tpl->setTitleIcon($this->object->plugin->getImagePath(
"icon_".$this->object->getType().
".svg"), $this->lng->txt(
"obj_" . $this->object->getType()));
1344 $this->ctrl->setParameter($this,
'q_id',
'');
1345 $this->ctrl->redirect($this);
1350 $this->tpl->setTitle($this->object->getTitle());
1351 $this->tpl->setDescription($this->object->getLongDescription());
1363 global $ilAccess, $ilHelp;
1365 $currentUserHasWriteAccess = $ilAccess->checkAccess(
"write",
"", $this->object->getRefId());
1367 $ilHelp->setScreenIdComponent(
"qpl");
1369 $next_class = strtolower($this->ctrl->getNextClass());
1370 switch ($next_class)
1373 case "ilpermissiongui":
1374 case "ilmdeditorgui":
1375 case "ilquestionpoolexportgui":
1378 case 'ilobjtaxonomygui':
1379 case 'ilobjquestionpoolsettingsgeneralgui':
1381 if( $currentUserHasWriteAccess )
1393 $force_active =
false;
1394 $commands =
$_POST[
"cmd"];
1395 if (is_array($commands))
1397 foreach ($commands as $key => $value)
1399 if (preg_match(
"/^delete_.*/", $key, $matches) ||
1400 preg_match(
"/^addSelectGap_.*/", $key, $matches) ||
1401 preg_match(
"/^addTextGap_.*/", $key, $matches) ||
1402 preg_match(
"/^deleteImage_.*/", $key, $matches) ||
1403 preg_match(
"/^upload_.*/", $key, $matches) ||
1404 preg_match(
"/^addSuggestedSolution_.*/", $key, $matches)
1407 $force_active =
true;
1411 if (array_key_exists(
"imagemap_x",
$_POST))
1413 $force_active =
true;
1417 $force_active = ((strtolower($this->ctrl->getCmdClass()) == strtolower(get_class($this)) || strlen($this->ctrl->getCmdClass()) == 0) &&
1418 $this->ctrl->getCmd() ==
"")
1422 $tabs_gui->addTarget(
"assQuestions",
1423 $this->ctrl->getLinkTarget($this,
"questions"),
1424 array(
"questions",
"filter",
"resetFilter",
"createQuestion",
1425 "importQuestions",
"deleteQuestions",
"filterQuestionBrowser",
1426 "view",
"preview",
"editQuestion",
"exec_pg",
1427 "addItem",
"upload",
"save",
"cancel",
"addSuggestedSolution",
1428 "cancelExplorer",
"linkChilds",
"removeSuggestedSolution",
1429 "add",
"addYesNo",
"addTrueFalse",
"createGaps",
"saveEdit",
1430 "setMediaMode",
"uploadingImage",
"uploadingImagemap",
"addArea",
1431 "deletearea",
"saveShape",
"back",
"addPair",
"uploadingJavaapplet",
1432 "addParameter",
"assessment",
"addGIT",
"addST",
"addPG",
"delete",
1433 "toggleGraphicalAnswers",
"deleteAnswer",
"deleteImage",
"removeJavaapplet"),
1434 "",
"", $force_active);
1436 if ($ilAccess->checkAccess(
"visible",
"", $this->ref_id))
1438 $tabs_gui->addTarget(
"info_short",
1439 $this->ctrl->getLinkTarget($this,
"infoScreen"),
1440 array(
"infoScreen",
"showSummary"));
1443 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
'ref_id']))
1446 $tabs_gui->addTarget(
1447 'settings', $this->ctrl->getLinkTargetByClass(
'ilObjQuestionPoolSettingsGeneralGUI'),
1448 array(), array(
'ilObjQuestionPoolSettingsGeneralGUI',
'ilObjTaxonomyGUI')
1453 $tabs_gui->addTarget(
"print_view",
1454 $this->ctrl->getLinkTarget($this,
'print'),
1458 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
1461 $tabs_gui->addTarget(
"meta_data",
1462 $this->ctrl->getLinkTargetByClass(
'ilmdeditorgui',
'listSection'),
1463 "",
"ilmdeditorgui");
1471 if( $currentUserHasWriteAccess )
1473 $tabs_gui->addTarget(
"export",
1474 $this->ctrl->getLinkTargetByClass(
"ilquestionpoolexportgui",
""),
1475 "",
"ilquestionpoolexportgui");
1478 if ($ilAccess->checkAccess(
"edit_permission",
"", $this->object->getRefId()))
1480 $tabs_gui->addTarget(
"perm_settings",
1481 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
1488 'qpl_settings_subtab_general',
1489 $this->ctrl->getLinkTargetByClass(
'ilObjQuestionPoolSettingsGeneralGUI'),
1490 '',
'ilObjQuestionPoolSettingsGeneralGUI'
1494 'qpl_settings_subtab_taxonomies',
1495 $this->ctrl->getLinkTargetByClass(
'ilObjTaxonomyGUI',
'editAOTaxonomySettings'),
1496 '',
'ilObjTaxonomyGUI'
1507 $this->ctrl->setCmd(
"showSummary");
1508 $this->ctrl->setCmdClass(
"ilinfoscreengui");
1517 global
$ilErr, $ilAccess;
1519 if(!$ilAccess->checkAccess(
"visible",
"", $this->ref_id))
1521 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"));
1524 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1526 $info->enablePrivateNotes();
1529 $info->addMetaDataSections($this->object->getId(), 0, $this->
object->getType());
1531 $this->ctrl->forwardCommand($info);
1546 if ($ilAccess->checkAccess(
"write",
"", $a_target))
1548 $_GET[
"baseClass"] =
"ilObjQuestionPoolGUI";
1549 $_GET[
"cmd"] =
"questions";
1550 $_GET[
"ref_id"] = $a_target;
1551 include_once(
"ilias.php");
1554 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
1560 $ilErr->raiseError($lng->txt(
"msg_no_perm_read_lm"), $ilErr->FATAL);
1573 global $rbacsystem,
$ilDB,
$lng, $ilPluginAdmin;
1575 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
1576 $table_gui =
new ilQuestionBrowserTableGUI($this,
'questions', (($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']) ?
true :
false)),
false, $taxIds);
1577 $table_gui->
setEditable($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']));
1579 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
1580 $questionList =
new ilAssQuestionList($ilDB, $lng, $ilPluginAdmin, $this->object->getId());
1582 foreach ($table_gui->getFilterItems() as $item)
1584 if( substr($item->getPostVar(), 0, strlen(
'tax_')) ==
'tax_' )
1586 $v = $item->getValue();
1588 if( is_array($v) && count($v) && !(
int)$v[0] )
1593 $taxId = substr($item->getPostVar(), strlen(
'tax_'));
1596 elseif( $item->getValue() !== false )
1598 $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
1602 if( $this->object->isNavTaxonomyActive() && (int)
$_GET[
'tax_node'] )
1604 $questionList->addTaxonomyFilter( $this->object->getNavTaxonomyId(), array((
int)
$_GET[
'tax_node']) );
1607 $questionList->load();
1608 $data = $questionList->getQuestionDataArray();
1610 $table_gui->setData(
$data);