43 include_once
"./classes/class.ilObjectGUI.php";
44 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
45 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
46 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
57 $lng->loadLanguageModule(
"assessment");
60 $this->ctrl->saveParameter($this, array(
"ref_id",
"test_ref_id",
"calling_test"));
70 global $ilLocator, $ilAccess, $ilNavigationHistory,
$tpl;
71 if ((!$ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"])) && (!$ilAccess->checkAccess(
"visible",
"",
$_GET[
"ref_id"])))
74 $ilias->raiseError($this->lng->txt(
"permission_denied"), $ilias->error_obj->MESSAGE);
79 $ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"]))
81 $ilNavigationHistory->addItem(
$_GET[
"ref_id"],
82 "ilias.php?baseClass=ilObjQuestionPoolGUI&cmd=questions&ref_id=".
$_GET[
"ref_id"],
"qpl");
85 $cmd = $this->ctrl->getCmd(
"questions");
86 $next_class = $this->ctrl->getNextClass($this);
87 $this->ctrl->setReturn($this,
"questions");
90 if (
$_GET[
"q_id"] < 1)
92 $q_type = (
$_POST[
"sel_question_types"] !=
"")
93 ?
$_POST[
"sel_question_types"]
94 :
$_GET[
"sel_question_types"];
96 if (
$cmd !=
"createQuestion" &&
$cmd !=
"createQuestionForTest"
97 && $next_class !=
"ilpageobjectgui")
99 if ((
$_GET[
"test_ref_id"] !=
"") or (
$_GET[
"calling_test"]))
110 case 'ilmdeditorgui':
111 include_once
'Services/MetaData/classes/class.ilMDEditorGUI.php';
113 $md_gui =&
new ilMDEditorGUI($this->object->getId(), 0, $this->
object->getType());
114 $md_gui->
addObserver($this->
object,
'MDUpdateListener',
'General');
115 $this->ctrl->forwardCommand($md_gui);
117 case "ilpageobjectgui":
118 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
119 $this->tpl->setCurrentBlock(
"ContentStyle");
120 $this->tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
122 $this->tpl->parseCurrentBlock();
125 $this->tpl->setCurrentBlock(
"SyntaxStyle");
126 $this->tpl->setVariable(
"LOCATION_SYNTAX_STYLESHEET",
128 $this->tpl->parseCurrentBlock();
129 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
131 $q_gui->setQuestionTabs();
132 $q_gui->outAdditionalOutput();
133 $q_gui->object->setObjId($this->object->getId());
134 $question =& $q_gui->object;
135 $this->ctrl->saveParameter($this,
"q_id");
136 include_once(
"./Services/COPage/classes/class.ilPageObject.php");
137 include_once(
"./Services/COPage/classes/class.ilPageObjectGUI.php");
138 $this->lng->loadLanguageModule(
"content");
139 $this->ctrl->setReturnByClass(
"ilPageObjectGUI",
"view");
140 $this->ctrl->setReturn($this,
"questions");
143 $page_gui->setEditPreview(
true);
144 $page_gui->setEnabledTabs(
false);
145 $page_gui->setEnabledInternalLinks(
false);
146 if (strlen($this->ctrl->getCmd()) == 0)
148 $this->ctrl->setCmdClass(get_class($page_gui));
149 $this->ctrl->setCmd(
"preview");
152 $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(TRUE)));
153 $page_gui->setTemplateTargetVar(
"ADM_CONTENT");
154 $page_gui->setOutputMode(
"edit");
155 $page_gui->setHeader($question->getTitle());
156 $page_gui->setFileDownloadLink($this->ctrl->getLinkTarget($this,
"downloadFile"));
157 $page_gui->setFullscreenLink($this->ctrl->getLinkTarget($this,
"fullscreen"));
158 $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTarget($this));
159 $page_gui->setPresentationTitle($question->getTitle());
160 $ret =& $this->ctrl->forwardCommand($page_gui);
161 $tpl->setContent(
$ret);
164 case 'ilpermissiongui':
165 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
167 $ret =& $this->ctrl->forwardCommand($perm_gui);
170 case 'ilobjectcopygui':
171 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
174 $this->ctrl->forwardCommand($cp);
177 case "ilobjquestionpoolgui":
183 $this->ctrl->setReturn($this,
"questions");
184 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
186 $q_gui->object->setObjId($this->object->getId());
187 $q_gui->setQuestionTabs();
188 $ret =& $this->ctrl->forwardCommand($q_gui);
192 if (strtolower(
$_GET[
"baseClass"]) !=
"iladministrationgui" &&
204 $save = ((strcmp($this->ctrl->getCmd(),
"save") == 0)) ?
true :
false;
207 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
209 $form->setFormAction($this->ctrl->getFormAction($this,
'properties'));
210 $form->setTitle($this->lng->txt(
"properties"));
211 $form->setMultipart(
false);
213 $form->setId(
"properties");
217 $online->
setInfo($this->lng->txt(
"qpl_online_property_description"));
218 $online->setChecked($this->object->getOnline());
219 $form->addItem($online);
221 $form->addCommandButton(
"saveProperties", $this->lng->txt(
"save"));
227 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
246 $qpl_online =
$_POST[
"online"];
247 if (strlen($qpl_online) == 0) $qpl_online =
"0";
248 $this->
object->setOnline($qpl_online);
249 $this->
object->saveToDb();
251 $this->ctrl->redirect($this,
"properties");
260 include_once(
"./Modules/File/classes/class.ilObjFile.php");
262 $fileObj->sendFile();
271 include_once(
"./Services/COPage/classes/class.ilPageObject.php");
272 include_once(
"./Services/COPage/classes/class.ilPageObjectGUI.php");
275 $page_gui->showMediaFullscreen();
293 $_POST[
"filter_text"] =
"";
294 $_POST[
"sel_filter_type"] =
"";
303 include_once(
"./Services/COPage/classes/class.ilPageObject.php");
305 $pg_obj->send_paragraph (
$_GET[
"par_id"],
$_GET[
"downloadtitle"]);
314 if ($_FILES[
"xmldoc"][
"error"] > UPLOAD_ERR_OK)
321 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
325 $file = pathinfo($_FILES[
"xmldoc"][
"name"]);
327 include_once
"./Services/Utilities/classes/class.ilUtil.php";
329 if (strcmp($_FILES[
"xmldoc"][
"type"],
"text/xml") == 0)
331 $qti_file = $full_path;
339 $subdir = basename(
$file[
"basename"],
".".
$file[
"extension"]);
345 include_once
"./Services/QTI/classes/class.ilQTIParser.php";
347 $result = $qtiParser->startParsing();
348 $founditems =& $qtiParser->getFoundItems();
349 if (count($founditems) == 0)
363 foreach ($founditems as $item)
365 if (strlen($item[
"type"]))
385 $_SESSION[
"qpl_import_xml_file"] = $xml_file;
386 $_SESSION[
"qpl_import_qti_file"] = $qti_file;
387 $_SESSION[
"qpl_import_subdir"] = $subdir;
389 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.qpl_import_verification.html");
390 $row_class = array(
"tblrow1",
"tblrow2");
392 foreach ($founditems as $item)
394 $this->tpl->setCurrentBlock(
"verification_row");
395 $this->tpl->setVariable(
"ROW_CLASS", $row_class[$counter++ % 2]);
396 $this->tpl->setVariable(
"QUESTION_TITLE", $item[
"title"]);
397 $this->tpl->setVariable(
"QUESTION_IDENT", $item[
"ident"]);
398 include_once
"./Services/QTI/classes/class.ilQTIItem.php";
399 switch ($item[
"type"])
402 $type = $this->lng->txt(
"assClozeTest");
405 $type = $this->lng->txt(
"assImagemapQuestion");
408 $type = $this->lng->txt(
"assJavaApplet");
411 $type = $this->lng->txt(
"assMatchingQuestion");
414 $type = $this->lng->txt(
"assMultipleChoice");
417 $type = $this->lng->txt(
"assSingleChoice");
420 $type = $this->lng->txt(
"assOrderingQuestion");
423 $type = $this->lng->txt(
"assTextQuestion");
426 $type = $this->lng->txt(
"assNumeric");
429 $type = $this->lng->txt(
"assTextSubset");
432 $type = $this->lng->txt($item[
"type"]);
436 if (strcmp(
$type,
"-" . $item[
"type"] .
"-") == 0)
438 global $ilPluginAdmin;
439 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
"TestQuestionPool",
"qst");
440 foreach ($pl_names as $pl_name)
443 if (strcmp($pl->getQuestionType(), $item[
"type"]) == 0)
445 $type = $pl->getQuestionTypeTranslation();
449 $this->tpl->setVariable(
"QUESTION_TYPE",
$type);
450 $this->tpl->parseCurrentBlock();
453 $this->tpl->setCurrentBlock(
"import_qpl");
454 if (is_file($xml_file))
457 $fh = @fopen($xml_file,
"r") or die(
"");
458 $xml = @fread($fh, filesize($xml_file));
460 if (preg_match(
"/<ContentObject.*?MetaData.*?General.*?Title[^>]*?>([^<]*?)</", $xml, $matches))
462 $this->tpl->setVariable(
"VALUE_NEW_QUESTIONPOOL", $matches[1]);
465 $this->tpl->setVariable(
"TEXT_CREATE_NEW_QUESTIONPOOL", $this->lng->txt(
"qpl_import_create_new_qpl"));
466 $this->tpl->parseCurrentBlock();
468 $this->tpl->setCurrentBlock(
"adm_content");
469 $this->tpl->setVariable(
"TEXT_TYPE", $this->lng->txt(
"question_type"));
470 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"question_title"));
471 $this->tpl->setVariable(
"FOUND_QUESTIONS_INTRODUCTION", $this->lng->txt(
"qpl_import_verify_found_questions"));
474 $this->tpl->setVariable(
"VERIFICATION_HEADING", $this->lng->txt(
"import_questions_into_qpl"));
475 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
479 $this->tpl->setVariable(
"VERIFICATION_HEADING", $this->lng->txt(
"import_qpl"));
481 $this->ctrl->setParameter($this,
"new_type", $this->type);
482 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
487 $this->tpl->setVariable(
"VALUE_IMPORT", $this->lng->txt(
"import"));
488 $this->tpl->setVariable(
"VALUE_CANCEL", $this->lng->txt(
"cancel"));
489 $value_questions_only = 0;
490 if ($questions_only) $value_questions_only = 1;
491 $this->tpl->setVariable(
"VALUE_QUESTIONS_ONLY", $value_questions_only);
493 $this->tpl->parseCurrentBlock();
501 if (
$_POST[
"questions_only"] == 1)
507 include_once(
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
511 $newObj->setType(
$_GET[
"new_type"]);
513 $newObj->setTitle(
"dummy");
515 $newObj->setDescription(
"questionpool import");
517 $newObj->create(
true);
519 $newObj->createReference();
521 $newObj->putInTree(
$_GET[
"ref_id"]);
523 $newObj->setPermissions(
$_GET[
"ref_id"]);
525 $newObj->notify(
"new",
$_GET[
"ref_id"],
$_GET[
"parent_non_rbac_id"],
$_GET[
"ref_id"],$newObj->getRefId());
529 include_once
"./Services/QTI/classes/class.ilQTIParser.php";
534 if (strlen(
$_SESSION[
"qpl_import_xml_file"]))
536 include_once (
"./Modules/LearningModule/classes/class.ilContObjParser.php");
538 $contParser->setQuestionMapping($qtiParser->getImportMapping());
539 $contParser->startParsing();
543 $qpl_name =
$_POST[
"qpl_new"];
544 if ((strcmp($qpl_name, $newObj->getTitle()) != 0) && (strlen($qpl_name) > 0))
546 $newObj->setTitle($qpl_name);
551 include_once
"./Services/Utilities/classes/class.ilUtil.php";
554 if (
$_POST[
"questions_only"] == 1)
556 $this->ctrl->redirect($this,
"questions");
562 "&baseClass=ilObjQuestionPoolGUI");
568 if (
$_POST[
"questions_only"] == 1)
570 $this->ctrl->redirect($this,
"questions");
574 $this->ctrl->redirect($this,
"cancel");
591 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_import_question.html",
"Modules/TestQuestionPool");
592 $this->tpl->setCurrentBlock(
"adm_content");
593 $this->tpl->setVariable(
"TEXT_IMPORT_QUESTION", $this->lng->txt(
"import_question"));
594 $this->tpl->setVariable(
"TEXT_SELECT_FILE", $this->lng->txt(
"select_file"));
595 $this->tpl->setVariable(
"TEXT_UPLOAD", $this->lng->txt(
"upload"));
596 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
597 $this->tpl->parseCurrentBlock();
608 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"]))
610 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
613 $this->ctrl->setParameter($this,
"new_type", $this->type);
614 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
616 $this->tpl->setVariable(
"BTN_NAME",
"uploadQpl");
617 $this->tpl->setVariable(
"TXT_UPLOAD", $this->lng->txt(
"import"));
618 $this->tpl->setVariable(
"NEW_TYPE", $this->type);
619 $this->tpl->setVariable(
"TXT_IMPORT_QPL", $this->lng->txt(
"import_qpl"));
620 $this->tpl->setVariable(
"TXT_SELECT_MODE", $this->lng->txt(
"select_mode"));
621 $this->tpl->setVariable(
"TXT_SELECT_FILE", $this->lng->txt(
"select_file"));
622 $this->tpl->parseCurrentBlock();
630 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
632 $q_gui->object->setObjId($this->object->getId());
633 $q_gui->object->createNewQuestion();
634 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id", $q_gui->object->getId());
635 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types",
$_POST[
"sel_question_types"]);
636 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
644 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
646 $q_gui->object->setObjId($this->object->getId());
647 $q_gui->object->createNewQuestion();
648 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id", $q_gui->object->getId());
649 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types",
$_GET[
"sel_question_types"]);
650 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
661 if (!strlen(
$_POST[
'Fobject'][
'title']))
664 $this->ctrl->setParameter($this,
'new_type',
$_GET[
'new_type']);
665 $this->ctrl->redirect($this,
'create');
675 "&baseClass=ilObjQuestionPoolGUI");
693 $this->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.il_as_qpl_content.html",
"Modules/TestQuestionPool");
694 $this->tpl->addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
699 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
701 $title = $this->lng->txt(
"statistics") .
" - $question_title";
704 $this->tpl->setVariable(
"HEADER",
$title);
706 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
709 $color_class = array(
"tblrow1",
"tblrow2");
710 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_qpl_assessment_of_questions.html",
"Modules/TestQuestionPool");
711 if (!$total_of_answers)
713 $this->tpl->setCurrentBlock(
"emptyrow");
714 $this->tpl->setVariable(
"TXT_NO_ASSESSMENT", $this->lng->txt(
"qpl_assessment_no_assessment_of_questions"));
715 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
716 $this->tpl->parseCurrentBlock();
720 $this->tpl->setCurrentBlock(
"row");
721 $this->tpl->setVariable(
"TXT_RESULT", $this->lng->txt(
"qpl_assessment_total_of_answers"));
722 $this->tpl->setVariable(
"TXT_VALUE", $total_of_answers);
723 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
725 $this->tpl->parseCurrentBlock();
726 $this->tpl->setCurrentBlock(
"row");
727 $this->tpl->setVariable(
"TXT_RESULT", $this->lng->txt(
"qpl_assessment_total_of_right_answers"));
729 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
730 $this->tpl->parseCurrentBlock();
732 $this->tpl->setCurrentBlock(
"adm_content");
733 $this->tpl->setVariable(
"TXT_QUESTION_TITLE", $question_title);
734 $this->tpl->setVariable(
"TXT_RESULT", $this->lng->txt(
"result"));
735 $this->tpl->setVariable(
"TXT_VALUE", $this->lng->txt(
"value"));
736 $this->tpl->parseCurrentBlock();
743 $this->editQuestionForm(
$type);
753 if (count(
$_POST[
"q_id"]) < 1)
756 $this->ctrl->redirect($this,
"questions");
760 $deleteable_questions =& $this->
object->getDeleteableQuestionDetails(
$_POST[
"q_id"]);
761 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
763 $table_gui->
setEditable($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']));
764 $table_gui->setData($deleteable_questions);
765 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
775 foreach (
$_POST[
"q_id"] as $key => $value)
777 $this->
object->deleteQuestion($value);
780 $this->ctrl->redirect($this,
"questions");
788 $this->ctrl->redirect($this,
"questions");
797 if (count(
$_POST[
"q_id"]) > 0)
799 include_once(
"./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php");
801 $export_file = $qpl_exp->buildExportFile();
804 include_once
"./Services/Utilities/classes/class.ilUtil.php";
812 $this->ctrl->redirect($this,
"questions");
817 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
819 $table_gui->resetOffset();
820 $table_gui->writeFilterToSession();
826 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
828 $table_gui->resetOffset();
829 $table_gui->resetFilter();
841 $this->
object->purgeQuestions();
845 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_qpl_questionbrowser.html",
"Modules/TestQuestionPool");
846 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
848 $table_gui->
setEditable($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']));
849 $arrFilter = array();
850 foreach ($table_gui->getFilterItems() as $item)
852 if ($item->getValue() !==
false)
854 $arrFilter[$item->getPostVar()] = $item->getValue();
857 $data = $this->
object->getQuestionBrowserData($arrFilter);
858 $table_gui->setData(
$data);
859 $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());
861 if ($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']))
863 $this->tpl->setCurrentBlock(
"QTypes");
864 $types =& $this->
object->getQuestionTypes();
865 $lastquestiontype = $ilUser->getPref(
"tst_lastquestiontype");
866 foreach ($types as $translation =>
$data)
868 if (
$data[
"type_tag"] == $lastquestiontype)
870 $this->tpl->setVariable(
"QUESTION_TYPE_SELECTED",
" selected=\"selected\"");
872 $this->tpl->setVariable(
"QUESTION_TYPE_ID",
$data[
"type_tag"]);
873 $this->tpl->setVariable(
"QUESTION_TYPE", $translation);
874 $this->tpl->parseCurrentBlock();
876 $this->tpl->setVariable(
"QUESTION_ADD", $this->lng->txt(
"create"));
877 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
'questions'));
878 $this->tpl->parseCurrentBlock();
889 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_qpl_printview.html",
"Modules/TestQuestionPool");
893 $this->tpl->setVariable(
"SELECTED_DETAILED",
" selected=\"selected\"");
895 case 'detailed_printview':
896 $this->tpl->setVariable(
"SELECTED_DETAILED_PRINTVIEW",
" selected=\"selected\"");
901 $this->tpl->setVariable(
"TEXT_DETAILED", $this->lng->txt(
"detailed_output_solutions"));
902 $this->tpl->setVariable(
"TEXT_DETAILED_PRINTVIEW", $this->lng->txt(
"detailed_output_printview"));
903 $this->tpl->setVariable(
"TEXT_OVERVIEW", $this->lng->txt(
"overview"));
904 $this->tpl->setVariable(
"TEXT_SUBMIT", $this->lng->txt(
"submit"));
905 $this->tpl->setVariable(
"OUTPUT_MODE", $this->lng->txt(
"output_mode"));
906 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
'print'));
908 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionPoolPrintViewTableGUI.php";
910 $data =& $this->
object->getPrintviewQuestions();
911 $table_gui->setData(
$data);
912 $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());
917 "title" => $this->lng->txt(
"title"),
918 "description" => $this->lng->txt(
"description"),
919 "type" => $this->lng->txt(
"question_type"),
920 "author" => $this->lng->txt(
"author"),
921 "created" => $this->lng->txt(
"create_date"),
922 "updated" => $this->lng->txt(
"last_update")
924 foreach ($sortorder as $value => $text)
926 $this->tpl->setCurrentBlock(
"sortorder");
927 $this->tpl->setVariable(
"VALUE_SORTORDER", $value);
928 $this->tpl->setVariable(
"TEXT_SORTORDER", $text);
929 if (strcmp($sort, $value) == 0)
931 $this->tpl->setVariable(
"SELECTED_SORTORDER",
" selected=\"selected\"");
933 $this->tpl->parseCurrentBlock();
935 $table =& $this->
object->getPrintviewQuestions($sort);
936 $colors = array(
"tblrow1top",
"tblrow2top");
938 include_once
"./classes/class.ilFormat.php";
939 foreach ($table as
$row)
941 if ((strcmp(
$_POST[
"output"],
"detailed") == 0) || (strcmp(
$_POST[
"output"],
"detailed_printview") == 0))
943 $this->tpl->setCurrentBlock(
"overview_row_detail");
944 $this->tpl->setVariable(
"ROW_CLASS", $colors[$counter % 2]);
945 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
947 if (strcmp(
$_POST[
"output"],
"detailed") == 0)
949 $solutionoutput = $question_gui->getSolutionOutput($active_id =
"",
$pass = NULL, $graphicalOutput = FALSE, $result_output = FALSE, $show_question_only = FALSE, $show_feedback = FALSE, $show_correct_solution =
true, $show_manual_scoring =
false);
950 if (strlen($solutionoutput) == 0) $solutionoutput = $question_gui->getPreview();
951 $this->tpl->setVariable(
"PREVIEW", $solutionoutput);
955 $this->tpl->setVariable(
"PREVIEW", $question_gui->getPreview());
957 $this->tpl->parseCurrentBlock();
958 $this->tpl->setCurrentBlock(
"overview_row_detail");
959 $this->tpl->setVariable(
"ROW_CLASS", $colors[$counter % 2]);
960 $this->tpl->parseCurrentBlock();
962 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
963 $this->tpl->setCurrentBlock(
"overview_row");
964 $this->tpl->setVariable(
"ROW_CLASS", $colors[$counter % 2]);
965 $this->tpl->setVariable(
"TEXT_COUNTER", $counter);
969 $this->tpl->setVariable(
"TEXT_AUTHOR", $row[
"author"]);
972 $this->tpl->parseCurrentBlock();
975 $this->tpl->setCurrentBlock(
"overview");
976 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"title"));
977 $this->tpl->setVariable(
"TEXT_DESCRIPTION", $this->lng->txt(
"description"));
978 $this->tpl->setVariable(
"TEXT_QUESTIONTYPE", $this->lng->txt(
"question_type"));
979 $this->tpl->setVariable(
"TEXT_AUTHOR", $this->lng->txt(
"author"));
980 $this->tpl->setVariable(
"TEXT_CREATED", $this->lng->txt(
"create_date"));
981 $this->tpl->setVariable(
"TEXT_UPDATED", $this->lng->txt(
"last_update"));
982 $this->tpl->parseCurrentBlock();
983 $this->tpl->setCurrentBlock(
"adm_content");
984 $this->tpl->setVariable(
"SORT_TEXT", $this->lng->txt(
"sort_by_this_column"));
985 $this->tpl->setVariable(
"TEXT_SUBMIT", $this->lng->txt(
"submit"));
986 $this->tpl->setVariable(
"PRINT", $this->lng->txt(
"print"));
987 $this->tpl->parseCurrentBlock();
996 $this->update = $this->
object->update();
1005 if (array_key_exists(
"qpl_clipboard",
$_SESSION))
1007 $this->
object->pasteFromClipboard();
1014 $this->ctrl->redirect($this,
"questions");
1022 if (count(
$_POST[
"q_id"]) > 0)
1024 foreach (
$_POST[
"q_id"] as $key => $value)
1026 $this->
object->copyToClipboard($value);
1034 $this->ctrl->redirect($this,
"questions");
1042 if (count(
$_POST[
"q_id"]) > 0)
1044 foreach (
$_POST[
"q_id"] as $key => $value)
1046 $this->
object->moveToClipboard($value);
1054 $this->ctrl->redirect($this,
"questions");
1062 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionPoolExportTableGUI.php";
1064 $export_dir = $this->
object->getExportDirectory();
1065 $export_files = $this->
object->getExportFiles($export_dir);
1067 foreach ($export_files as $exp_file)
1069 $file_arr = explode(
"__", $exp_file);
1072 $table_gui->setData(
$data);
1073 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
1083 if ($rbacsystem->checkAccess(
"write",
$_GET[
'ref_id']))
1085 include_once(
"./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php");
1086 $question_ids =& $this->
object->getAllQuestionIds();
1088 $qpl_exp->buildExportFile();
1089 $this->ctrl->redirect($this,
"export");
1094 $this->ctrl->redirect($this,
"export");
1103 if(!isset(
$_POST[
"file"]))
1106 $this->ctrl->redirect($this,
"export");
1109 if (count(
$_POST[
"file"]) > 1)
1112 $this->ctrl->redirect($this,
"export");
1116 $export_dir = $this->
object->getExportDirectory();
1117 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1120 $this->ctrl->redirect($this,
"export");
1128 if(!isset(
$_POST[
"file"]))
1131 $this->ctrl->redirect($this,
"export");
1135 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionPoolExportTableGUI.php";
1137 $export_dir = $this->
object->getExportDirectory();
1139 foreach (
$_POST[
'file'] as $exp_file)
1141 $file_arr = explode(
"__", $exp_file);
1144 $table_gui->setData(
$data);
1145 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
1154 session_unregister(
"ilExportFiles");
1155 $this->ctrl->redirect($this,
"export");
1163 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1164 $export_dir = $this->
object->getExportDirectory();
1167 $exp_file = $export_dir.
"/".
$file;
1168 include_once
"./Services/Utilities/classes/class.ilStr.php";
1170 if (@is_file($exp_file))
1174 if (@is_dir($exp_dir))
1179 $this->ctrl->redirect($this,
"export");
1187 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1189 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
1199 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"], $new_type))
1201 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
1209 $this->tpl->setCurrentBlock(
"adm_content");
1213 $data[
"fields"] = array();
1214 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1218 foreach (
$data[
"fields"] as $key => $val)
1220 $this->tpl->setVariable(
"TXT_".strtoupper($key), $this->lng->txt($key));
1221 $this->tpl->setVariable(strtoupper($key), $val);
1223 if ($this->prepare_output)
1225 $this->tpl->parseCurrentBlock();
1229 $this->ctrl->setParameter($this,
"new_type", $this->type);
1230 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1231 $this->tpl->setVariable(
"TXT_HEADER", $this->lng->txt($new_type.
"_new"));
1232 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
1233 $this->tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt($new_type.
"_add"));
1234 $this->tpl->setVariable(
"CMD_SUBMIT",
"save");
1235 $this->tpl->setVariable(
"TARGET",
' target="'.
1237 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
1239 $this->tpl->setVariable(
"TXT_IMPORT_QPL", $this->lng->txt(
"import_qpl"));
1240 $this->tpl->setVariable(
"TXT_QPL_FILE", $this->lng->txt(
"qpl_upload_file"));
1241 $this->tpl->setVariable(
"NEW_TYPE", $this->type);
1242 $this->tpl->setVariable(
"TXT_IMPORT", $this->lng->txt(
"import"));
1245 $this->tpl->setVariable(
"ALT_IMG",$this->lng->txt(
"obj_qpl"));
1247 $this->tpl->setVariable(
"ALT_IMG2",$this->lng->txt(
"obj_qpl"));
1249 $this->tpl->parseCurrentBlock();
1258 if (strcmp($_FILES[
"xmldoc"][
"tmp_name"],
"") == 0)
1270 switch ($this->ctrl->getCmd())
1277 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"",
$_GET[
"ref_id"]);
1280 if (
$_GET[
"q_id"] > 0)
1282 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1284 $q_gui->object->setObjId($this->object->getId());
1285 if (
$_GET[
"q_id"] > 0)
1287 $ilLocator->addItem($q_gui->object->getTitle(), $this->ctrl->getLinkTargetByClass(get_class($q_gui),
"editQuestion"));
1297 if (
$_GET[
"q_id"] > 0)
1299 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1301 $q_gui->object->setObjId($this->object->getId());
1302 $title = $q_gui->object->getTitle();
1303 if (strcmp($this->ctrl->getCmd(),
"assessment") == 0)
1305 $title .=
" - " . $this->lng->txt(
"statistics");
1307 $this->tpl->setTitle(
$title);
1308 $this->tpl->setDescription($q_gui->object->getComment());
1309 $this->tpl->setTitleIcon(
ilUtil::getImagePath(
"icon_".$this->object->getType().
"_b.gif"), $this->lng->txt(
"obj_qpl"));
1313 $this->tpl->setTitle($this->object->getTitle());
1314 $this->tpl->setDescription($this->object->getLongDescription());
1315 $this->tpl->setTitleIcon(
ilUtil::getImagePath(
"icon_".$this->object->getType().
"_b.gif"), $this->lng->txt(
"obj_qpl"));
1328 $next_class = $this->ctrl->getNextClass($this);
1329 switch ($next_class)
1332 case "ilpermissiongui":
1333 case "ilmdeditorgui":
1340 $force_active =
false;
1341 $commands =
$_POST[
"cmd"];
1342 if (is_array($commands))
1344 foreach ($commands as $key => $value)
1346 if (preg_match(
"/^delete_.*/", $key, $matches) ||
1347 preg_match(
"/^addSelectGap_.*/", $key, $matches) ||
1348 preg_match(
"/^addTextGap_.*/", $key, $matches) ||
1349 preg_match(
"/^deleteImage_.*/", $key, $matches) ||
1350 preg_match(
"/^upload_.*/", $key, $matches) ||
1351 preg_match(
"/^addSuggestedSolution_.*/", $key, $matches)
1354 $force_active =
true;
1358 if (array_key_exists(
"imagemap_x",
$_POST))
1360 $force_active =
true;
1364 $force_active = ((strtolower($this->ctrl->getCmdClass()) == strtolower(get_class($this)) || strlen($this->ctrl->getCmdClass()) == 0) &&
1365 $this->ctrl->getCmd() ==
"")
1369 $tabs_gui->addTarget(
"assQuestions",
1370 $this->ctrl->getLinkTarget($this,
"questions"),
1371 array(
"questions",
"filter",
"resetFilter",
"createQuestion",
1372 "importQuestions",
"deleteQuestions",
"filterQuestionBrowser",
1373 "view",
"preview",
"editQuestion",
"exec_pg",
1374 "addItem",
"upload",
"save",
"cancel",
"addSuggestedSolution",
1375 "cancelExplorer",
"linkChilds",
"removeSuggestedSolution",
1376 "add",
"addYesNo",
"addTrueFalse",
"createGaps",
"saveEdit",
1377 "setMediaMode",
"uploadingImage",
"uploadingImagemap",
"addArea",
1378 "deletearea",
"saveShape",
"back",
"addPair",
"uploadingJavaapplet",
1379 "addParameter",
"assessment",
"addGIT",
"addST",
"addPG",
"delete",
1380 "toggleGraphicalAnswers",
"deleteAnswer",
"deleteImage",
"removeJavaapplet"),
1381 "",
"", $force_active);
1383 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
'ref_id']))
1386 $tabs_gui->addTarget(
"settings",
1387 $this->ctrl->getLinkTarget($this,
'properties'),
1393 $tabs_gui->addTarget(
"print_view",
1394 $this->ctrl->getLinkTarget($this,
'print'),
1398 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
'ref_id']))
1401 $tabs_gui->addTarget(
"meta_data",
1402 $this->ctrl->getLinkTargetByClass(
'ilmdeditorgui',
'listSection'),
1403 "",
"ilmdeditorgui");
1406 $tabs_gui->addTarget(
"export",
1407 $this->ctrl->getLinkTarget($this,
'export'),
1408 array(
"export",
"createExportFile",
"confirmDeleteExportFile",
"downloadExportFile"),
1412 if ($ilAccess->checkAccess(
"edit_permission",
"",
$_GET[
'ref_id']))
1414 $tabs_gui->addTarget(
"perm_settings",
1415 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
1431 if ($ilAccess->checkAccess(
"write",
"", $a_target))
1433 $_GET[
"baseClass"] =
"ilObjQuestionPoolGUI";
1434 $_GET[
"cmd"] =
"questions";
1435 $_GET[
"ref_id"] = $a_target;
1436 include_once(
"ilias.php");
1439 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
1441 $_GET[
"cmd"] =
"frameset";
1442 $_GET[
"target"] =
"";
1443 $_GET[
"ref_id"] = ROOT_FOLDER_ID;
1446 include(
"repository.php");
1449 $ilErr->raiseError($lng->txt(
"msg_no_perm_read_lm"), $ilErr->FATAL);