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);
222 $tablecols =
new ilCustomInputGUI($this->lng->txt(
'qpl_browsercolumns'),
'browsercolumn');
223 $tablecols->
setInfo($this->lng->txt(
"qpl_browsercolumns_description"));
225 $description->
setChecked($qplSetting->get(
"description", 1) ?
true :
false);
227 $type->setChecked($qplSetting->get(
"type", 1) ?
true :
false);
229 $points->setChecked($qplSetting->get(
"points", 1) ?
true :
false);
231 $statistics->
setChecked($qplSetting->get(
"statistics", 1) ?
true :
false);
233 $author->
setChecked($qplSetting->get(
"author", 1) ?
true :
false);
235 $created->
setChecked($qplSetting->get(
"created", 1) ?
true :
false);
237 $updated->
setChecked($qplSetting->get(
"updated", 1) ?
true :
false);
238 $tablecols->addSubitem($description);
239 $tablecols->addSubitem(
$type);
240 $tablecols->addSubitem(
$points);
241 $tablecols->addSubitem($statistics);
242 $tablecols->addSubitem($author);
243 $tablecols->addSubitem($created);
244 $tablecols->addSubitem($updated);
245 $form->addItem($tablecols);
247 $form->addCommandButton(
"saveProperties", $this->lng->txt(
"save"));
253 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
272 $qpl_online =
$_POST[
"online"];
273 if (strlen($qpl_online) == 0) $qpl_online =
"0";
274 $this->
object->setOnline($qpl_online);
275 $this->
object->saveToDb();
278 $qplSetting->set(
'description', (
$_POST[
"description"]) ? 1 : 0);
279 $qplSetting->set(
'type', (
$_POST[
"type"]) ? 1 : 0);
280 $qplSetting->set(
'points', (
$_POST[
"points"]) ? 1 : 0);
281 $qplSetting->set(
'statistics', (
$_POST[
"statistics"]) ? 1 : 0);
282 $qplSetting->set(
'author', (
$_POST[
"author"]) ? 1 : 0);
283 $qplSetting->set(
'created', (
$_POST[
"created"]) ? 1 : 0);
284 $qplSetting->set(
'updated', (
$_POST[
"updated"]) ? 1 : 0);
286 $this->ctrl->redirect($this,
"properties");
295 include_once(
"./Modules/File/classes/class.ilObjFile.php");
297 $fileObj->sendFile();
306 include_once(
"./Services/COPage/classes/class.ilPageObject.php");
307 include_once(
"./Services/COPage/classes/class.ilPageObjectGUI.php");
310 $page_gui->showMediaFullscreen();
328 $_POST[
"filter_text"] =
"";
329 $_POST[
"sel_filter_type"] =
"";
338 include_once(
"./Services/COPage/classes/class.ilPageObject.php");
340 $pg_obj->send_paragraph (
$_GET[
"par_id"],
$_GET[
"downloadtitle"]);
349 if ($_FILES[
"xmldoc"][
"error"] > UPLOAD_ERR_OK)
356 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
360 $file = pathinfo($_FILES[
"xmldoc"][
"name"]);
362 include_once
"./Services/Utilities/classes/class.ilUtil.php";
364 if (strcmp($_FILES[
"xmldoc"][
"type"],
"text/xml") == 0)
366 $qti_file = $full_path;
374 $subdir = basename(
$file[
"basename"],
".".
$file[
"extension"]);
380 include_once
"./Services/QTI/classes/class.ilQTIParser.php";
382 $result = $qtiParser->startParsing();
383 $founditems =& $qtiParser->getFoundItems();
384 if (count($founditems) == 0)
398 foreach ($founditems as $item)
400 if (strlen($item[
"type"]))
420 $_SESSION[
"qpl_import_xml_file"] = $xml_file;
421 $_SESSION[
"qpl_import_qti_file"] = $qti_file;
422 $_SESSION[
"qpl_import_subdir"] = $subdir;
424 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.qpl_import_verification.html");
425 $row_class = array(
"tblrow1",
"tblrow2");
427 foreach ($founditems as $item)
429 $this->tpl->setCurrentBlock(
"verification_row");
430 $this->tpl->setVariable(
"ROW_CLASS", $row_class[$counter++ % 2]);
431 $this->tpl->setVariable(
"QUESTION_TITLE", $item[
"title"]);
432 $this->tpl->setVariable(
"QUESTION_IDENT", $item[
"ident"]);
433 include_once
"./Services/QTI/classes/class.ilQTIItem.php";
434 switch ($item[
"type"])
437 $type = $this->lng->txt(
"assClozeTest");
440 $type = $this->lng->txt(
"assImagemapQuestion");
443 $type = $this->lng->txt(
"assJavaApplet");
446 $type = $this->lng->txt(
"assMatchingQuestion");
449 $type = $this->lng->txt(
"assMultipleChoice");
452 $type = $this->lng->txt(
"assSingleChoice");
455 $type = $this->lng->txt(
"assOrderingQuestion");
458 $type = $this->lng->txt(
"assTextQuestion");
461 $type = $this->lng->txt(
"assNumeric");
464 $type = $this->lng->txt(
"assTextSubset");
467 $type = $this->lng->txt($item[
"type"]);
471 if (strcmp(
$type,
"-" . $item[
"type"] .
"-") == 0)
473 global $ilPluginAdmin;
474 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
"TestQuestionPool",
"qst");
475 foreach ($pl_names as $pl_name)
478 if (strcmp($pl->getQuestionType(), $item[
"type"]) == 0)
480 $type = $pl->getQuestionTypeTranslation();
484 $this->tpl->setVariable(
"QUESTION_TYPE",
$type);
485 $this->tpl->parseCurrentBlock();
488 $this->tpl->setCurrentBlock(
"import_qpl");
489 if (is_file($xml_file))
492 $fh = @fopen($xml_file,
"r") or die(
"");
493 $xml = @fread($fh, filesize($xml_file));
495 if (preg_match(
"/<ContentObject.*?MetaData.*?General.*?Title[^>]*?>([^<]*?)</", $xml, $matches))
497 $this->tpl->setVariable(
"VALUE_NEW_QUESTIONPOOL", $matches[1]);
500 $this->tpl->setVariable(
"TEXT_CREATE_NEW_QUESTIONPOOL", $this->lng->txt(
"qpl_import_create_new_qpl"));
501 $this->tpl->parseCurrentBlock();
503 $this->tpl->setCurrentBlock(
"adm_content");
504 $this->tpl->setVariable(
"TEXT_TYPE", $this->lng->txt(
"question_type"));
505 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"question_title"));
506 $this->tpl->setVariable(
"FOUND_QUESTIONS_INTRODUCTION", $this->lng->txt(
"qpl_import_verify_found_questions"));
509 $this->tpl->setVariable(
"VERIFICATION_HEADING", $this->lng->txt(
"import_questions_into_qpl"));
510 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
514 $this->tpl->setVariable(
"VERIFICATION_HEADING", $this->lng->txt(
"import_qpl"));
516 $this->ctrl->setParameter($this,
"new_type", $this->type);
517 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
522 $this->tpl->setVariable(
"VALUE_IMPORT", $this->lng->txt(
"import"));
523 $this->tpl->setVariable(
"VALUE_CANCEL", $this->lng->txt(
"cancel"));
524 $value_questions_only = 0;
525 if ($questions_only) $value_questions_only = 1;
526 $this->tpl->setVariable(
"VALUE_QUESTIONS_ONLY", $value_questions_only);
528 $this->tpl->parseCurrentBlock();
536 if (
$_POST[
"questions_only"] == 1)
542 include_once(
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
546 $newObj->setType(
$_GET[
"new_type"]);
548 $newObj->setTitle(
"dummy");
550 $newObj->setDescription(
"questionpool import");
552 $newObj->create(
true);
554 $newObj->createReference();
556 $newObj->putInTree(
$_GET[
"ref_id"]);
558 $newObj->setPermissions(
$_GET[
"ref_id"]);
560 $newObj->notify(
"new",
$_GET[
"ref_id"],
$_GET[
"parent_non_rbac_id"],
$_GET[
"ref_id"],$newObj->getRefId());
564 include_once
"./Services/QTI/classes/class.ilQTIParser.php";
566 $result = $qtiParser->startParsing();
569 if (strlen(
$_SESSION[
"qpl_import_xml_file"]))
571 include_once (
"./Modules/LearningModule/classes/class.ilContObjParser.php");
573 $contParser->setQuestionMapping($qtiParser->getImportMapping());
574 $contParser->startParsing();
578 $qpl_name =
$_POST[
"qpl_new"];
579 if ((strcmp($qpl_name, $newObj->getTitle()) != 0) && (strlen($qpl_name) > 0))
581 $newObj->setTitle($qpl_name);
586 include_once
"./Services/Utilities/classes/class.ilUtil.php";
589 if (
$_POST[
"questions_only"] == 1)
591 $this->ctrl->redirect($this,
"questions");
597 "&baseClass=ilObjQuestionPoolGUI");
603 if (
$_POST[
"questions_only"] == 1)
605 $this->ctrl->redirect($this,
"questions");
609 $this->ctrl->redirect($this,
"cancel");
626 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_import_question.html",
"Modules/TestQuestionPool");
627 $this->tpl->setCurrentBlock(
"adm_content");
628 $this->tpl->setVariable(
"TEXT_IMPORT_QUESTION", $this->lng->txt(
"import_question"));
629 $this->tpl->setVariable(
"TEXT_SELECT_FILE", $this->lng->txt(
"select_file"));
630 $this->tpl->setVariable(
"TEXT_UPLOAD", $this->lng->txt(
"upload"));
631 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
632 $this->tpl->parseCurrentBlock();
643 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"]))
645 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
648 $this->ctrl->setParameter($this,
"new_type", $this->type);
649 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
651 $this->tpl->setVariable(
"BTN_NAME",
"uploadQpl");
652 $this->tpl->setVariable(
"TXT_UPLOAD", $this->lng->txt(
"import"));
653 $this->tpl->setVariable(
"NEW_TYPE", $this->type);
654 $this->tpl->setVariable(
"TXT_IMPORT_QPL", $this->lng->txt(
"import_qpl"));
655 $this->tpl->setVariable(
"TXT_SELECT_MODE", $this->lng->txt(
"select_mode"));
656 $this->tpl->setVariable(
"TXT_SELECT_FILE", $this->lng->txt(
"select_file"));
657 $this->tpl->parseCurrentBlock();
665 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
667 $q_gui->object->setObjId($this->object->getId());
668 $q_gui->object->createNewQuestion();
669 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id", $q_gui->object->getId());
670 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types",
$_POST[
"sel_question_types"]);
671 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
679 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
681 $q_gui->object->setObjId($this->object->getId());
682 $q_gui->object->createNewQuestion();
683 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id", $q_gui->object->getId());
684 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types",
$_GET[
"sel_question_types"]);
685 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
696 if (!strlen(
$_POST[
'Fobject'][
'title']))
699 $this->ctrl->setParameter($this,
'new_type',
$_GET[
'new_type']);
700 $this->ctrl->redirect($this,
'create');
710 "&baseClass=ilObjQuestionPoolGUI");
728 $this->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.il_as_qpl_content.html",
"Modules/TestQuestionPool");
729 $this->tpl->addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
734 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
736 $title = $this->lng->txt(
"statistics") .
" - $question_title";
739 $this->tpl->setVariable(
"HEADER",
$title);
741 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
744 $color_class = array(
"tblrow1",
"tblrow2");
745 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_qpl_assessment_of_questions.html",
"Modules/TestQuestionPool");
746 if (!$total_of_answers)
748 $this->tpl->setCurrentBlock(
"emptyrow");
749 $this->tpl->setVariable(
"TXT_NO_ASSESSMENT", $this->lng->txt(
"qpl_assessment_no_assessment_of_questions"));
750 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
751 $this->tpl->parseCurrentBlock();
755 $this->tpl->setCurrentBlock(
"row");
756 $this->tpl->setVariable(
"TXT_RESULT", $this->lng->txt(
"qpl_assessment_total_of_answers"));
757 $this->tpl->setVariable(
"TXT_VALUE", $total_of_answers);
758 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
760 $this->tpl->parseCurrentBlock();
761 $this->tpl->setCurrentBlock(
"row");
762 $this->tpl->setVariable(
"TXT_RESULT", $this->lng->txt(
"qpl_assessment_total_of_right_answers"));
764 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
765 $this->tpl->parseCurrentBlock();
767 $this->tpl->setCurrentBlock(
"adm_content");
768 $this->tpl->setVariable(
"TXT_QUESTION_TITLE", $question_title);
769 $this->tpl->setVariable(
"TXT_RESULT", $this->lng->txt(
"result"));
770 $this->tpl->setVariable(
"TXT_VALUE", $this->lng->txt(
"value"));
771 $this->tpl->parseCurrentBlock();
778 $this->editQuestionForm(
$type);
788 if (count(
$_POST[
"q_id"]) < 1)
791 $this->ctrl->redirect($this,
"questions");
795 $deleteable_questions =& $this->
object->getDeleteableQuestionDetails(
$_POST[
"q_id"]);
796 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
797 $table_gui =
new ilQuestionBrowserTableGUI($this,
'questions', (($rbacsystem->checkAccess(
'write', $this->ref_id) ?
true :
false)),
true);
798 $table_gui->
setEditable($rbacsystem->checkAccess(
'write', $this->ref_id));
799 $table_gui->setData($deleteable_questions);
800 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
812 $this->
object->deleteQuestion($value);
815 $this->ctrl->redirect($this,
"questions");
823 $this->ctrl->redirect($this,
"questions");
832 if (count(
$_POST[
"q_id"]) > 0)
834 include_once(
"./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php");
836 $export_file = $qpl_exp->buildExportFile();
839 include_once
"./Services/Utilities/classes/class.ilUtil.php";
847 $this->ctrl->redirect($this,
"questions");
852 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
854 $table_gui->resetOffset();
855 $table_gui->writeFilterToSession();
861 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
863 $table_gui->resetOffset();
864 $table_gui->resetFilter();
876 $this->
object->purgeQuestions();
880 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_qpl_questionbrowser.html",
"Modules/TestQuestionPool");
881 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
882 $table_gui =
new ilQuestionBrowserTableGUI($this,
'questions', (($rbacsystem->checkAccess(
'write', $this->ref_id) ?
true :
false)));
883 $table_gui->
setEditable($rbacsystem->checkAccess(
'write', $this->ref_id));
884 $arrFilter = array();
885 foreach ($table_gui->getFilterItems() as $item)
887 if ($item->getValue() !==
false)
889 $arrFilter[$item->getPostVar()] = $item->getValue();
892 $data = $this->
object->getQuestionBrowserData($arrFilter);
893 $table_gui->setData(
$data);
894 $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());
896 $this->tpl->setCurrentBlock(
"QTypes");
897 $types =& $this->
object->getQuestionTypes();
898 $lastquestiontype = $ilUser->getPref(
"tst_lastquestiontype");
899 foreach ($types as $translation =>
$data)
901 if (
$data[
"type_tag"] == $lastquestiontype)
903 $this->tpl->setVariable(
"QUESTION_TYPE_SELECTED",
" selected=\"selected\"");
905 $this->tpl->setVariable(
"QUESTION_TYPE_ID",
$data[
"type_tag"]);
906 $this->tpl->setVariable(
"QUESTION_TYPE", $translation);
907 $this->tpl->parseCurrentBlock();
909 $this->tpl->setVariable(
"QUESTION_ADD", $this->lng->txt(
"create"));
910 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
'questions'));
911 $this->tpl->parseCurrentBlock();
921 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_qpl_printview.html",
"Modules/TestQuestionPool");
925 $this->tpl->setVariable(
"SELECTED_DETAILED",
" selected=\"selected\"");
927 case 'detailed_printview':
928 $this->tpl->setVariable(
"SELECTED_DETAILED_PRINTVIEW",
" selected=\"selected\"");
933 $this->tpl->setVariable(
"TEXT_DETAILED", $this->lng->txt(
"detailed_output_solutions"));
934 $this->tpl->setVariable(
"TEXT_DETAILED_PRINTVIEW", $this->lng->txt(
"detailed_output_printview"));
935 $this->tpl->setVariable(
"TEXT_OVERVIEW", $this->lng->txt(
"overview"));
936 $this->tpl->setVariable(
"TEXT_SUBMIT", $this->lng->txt(
"submit"));
937 $this->tpl->setVariable(
"OUTPUT_MODE", $this->lng->txt(
"output_mode"));
938 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
'print'));
940 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionPoolPrintViewTableGUI.php";
942 $data =& $this->
object->getPrintviewQuestions();
943 $table_gui->setData(
$data);
944 $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());
949 "title" => $this->lng->txt(
"title"),
950 "description" => $this->lng->txt(
"description"),
951 "type" => $this->lng->txt(
"question_type"),
952 "author" => $this->lng->txt(
"author"),
953 "created" => $this->lng->txt(
"create_date"),
954 "updated" => $this->lng->txt(
"last_update")
956 foreach ($sortorder as $value => $text)
958 $this->tpl->setCurrentBlock(
"sortorder");
959 $this->tpl->setVariable(
"VALUE_SORTORDER", $value);
960 $this->tpl->setVariable(
"TEXT_SORTORDER", $text);
961 if (strcmp($sort, $value) == 0)
963 $this->tpl->setVariable(
"SELECTED_SORTORDER",
" selected=\"selected\"");
965 $this->tpl->parseCurrentBlock();
967 $table =& $this->
object->getPrintviewQuestions($sort);
968 $colors = array(
"tblrow1top",
"tblrow2top");
970 include_once
"./classes/class.ilFormat.php";
971 foreach ($table as
$row)
973 if ((strcmp(
$_POST[
"output"],
"detailed") == 0) || (strcmp(
$_POST[
"output"],
"detailed_printview") == 0))
975 $this->tpl->setCurrentBlock(
"overview_row_detail");
976 $this->tpl->setVariable(
"ROW_CLASS", $colors[$counter % 2]);
977 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
979 if (strcmp(
$_POST[
"output"],
"detailed") == 0)
981 $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);
982 if (strlen($solutionoutput) == 0) $solutionoutput = $question_gui->getPreview();
983 $this->tpl->setVariable(
"PREVIEW", $solutionoutput);
987 $this->tpl->setVariable(
"PREVIEW", $question_gui->getPreview());
989 $this->tpl->parseCurrentBlock();
990 $this->tpl->setCurrentBlock(
"overview_row_detail");
991 $this->tpl->setVariable(
"ROW_CLASS", $colors[$counter % 2]);
992 $this->tpl->parseCurrentBlock();
994 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
995 $this->tpl->setCurrentBlock(
"overview_row");
996 $this->tpl->setVariable(
"ROW_CLASS", $colors[$counter % 2]);
997 $this->tpl->setVariable(
"TEXT_COUNTER", $counter);
1001 $this->tpl->setVariable(
"TEXT_AUTHOR", $row[
"author"]);
1004 $this->tpl->parseCurrentBlock();
1007 $this->tpl->setCurrentBlock(
"overview");
1008 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"title"));
1009 $this->tpl->setVariable(
"TEXT_DESCRIPTION", $this->lng->txt(
"description"));
1010 $this->tpl->setVariable(
"TEXT_QUESTIONTYPE", $this->lng->txt(
"question_type"));
1011 $this->tpl->setVariable(
"TEXT_AUTHOR", $this->lng->txt(
"author"));
1012 $this->tpl->setVariable(
"TEXT_CREATED", $this->lng->txt(
"create_date"));
1013 $this->tpl->setVariable(
"TEXT_UPDATED", $this->lng->txt(
"last_update"));
1014 $this->tpl->parseCurrentBlock();
1015 $this->tpl->setCurrentBlock(
"adm_content");
1016 $this->tpl->setVariable(
"SORT_TEXT", $this->lng->txt(
"sort_by_this_column"));
1017 $this->tpl->setVariable(
"TEXT_SUBMIT", $this->lng->txt(
"submit"));
1018 $this->tpl->setVariable(
"PRINT", $this->lng->txt(
"print"));
1019 $this->tpl->parseCurrentBlock();
1028 $this->update = $this->
object->update();
1037 if (array_key_exists(
"qpl_clipboard",
$_SESSION))
1039 $this->
object->pasteFromClipboard();
1046 $this->ctrl->redirect($this,
"questions");
1054 if (count(
$_POST[
"q_id"]) > 0)
1058 $this->
object->copyToClipboard($value);
1066 $this->ctrl->redirect($this,
"questions");
1074 if (count(
$_POST[
"q_id"]) > 0)
1078 $this->
object->moveToClipboard($value);
1086 $this->ctrl->redirect($this,
"questions");
1094 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionPoolExportTableGUI.php";
1096 $export_dir = $this->
object->getExportDirectory();
1097 $export_files = $this->
object->getExportFiles($export_dir);
1099 foreach ($export_files as $exp_file)
1101 $file_arr = explode(
"__", $exp_file);
1104 $table_gui->setData(
$data);
1105 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
1115 if ($rbacsystem->checkAccess(
"write", $this->ref_id))
1117 include_once(
"./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php");
1118 $question_ids =& $this->
object->getAllQuestionIds();
1120 $qpl_exp->buildExportFile();
1121 $this->ctrl->redirect($this,
"export");
1126 $this->ctrl->redirect($this,
"export");
1135 if(!isset(
$_POST[
"file"]))
1138 $this->ctrl->redirect($this,
"export");
1141 if (count(
$_POST[
"file"]) > 1)
1144 $this->ctrl->redirect($this,
"export");
1148 $export_dir = $this->
object->getExportDirectory();
1149 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1152 $this->ctrl->redirect($this,
"export");
1160 if(!isset(
$_POST[
"file"]))
1163 $this->ctrl->redirect($this,
"export");
1167 include_once
"./Modules/TestQuestionPool/classes/tables/class.ilQuestionPoolExportTableGUI.php";
1169 $export_dir = $this->
object->getExportDirectory();
1171 foreach (
$_POST[
'file'] as $exp_file)
1173 $file_arr = explode(
"__", $exp_file);
1176 $table_gui->setData(
$data);
1177 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
1186 session_unregister(
"ilExportFiles");
1187 $this->ctrl->redirect($this,
"export");
1195 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1196 $export_dir = $this->
object->getExportDirectory();
1199 $exp_file = $export_dir.
"/".
$file;
1200 include_once
"./Services/Utilities/classes/class.ilStr.php";
1202 if (@is_file($exp_file))
1206 if (@is_dir($exp_dir))
1211 $this->ctrl->redirect($this,
"export");
1219 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1221 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
1231 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"], $new_type))
1233 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
1241 $this->tpl->setCurrentBlock(
"adm_content");
1245 $data[
"fields"] = array();
1246 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1250 foreach (
$data[
"fields"] as
$key => $val)
1252 $this->tpl->setVariable(
"TXT_".strtoupper(
$key), $this->lng->txt(
$key));
1253 $this->tpl->setVariable(strtoupper(
$key), $val);
1255 if ($this->prepare_output)
1257 $this->tpl->parseCurrentBlock();
1261 $this->ctrl->setParameter($this,
"new_type", $this->type);
1262 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1263 $this->tpl->setVariable(
"TXT_HEADER", $this->lng->txt($new_type.
"_new"));
1264 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
1265 $this->tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt($new_type.
"_add"));
1266 $this->tpl->setVariable(
"CMD_SUBMIT",
"save");
1267 $this->tpl->setVariable(
"TARGET",
' target="'.
1269 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
1271 $this->tpl->setVariable(
"TXT_IMPORT_QPL", $this->lng->txt(
"import_qpl"));
1272 $this->tpl->setVariable(
"TXT_QPL_FILE", $this->lng->txt(
"qpl_upload_file"));
1273 $this->tpl->setVariable(
"NEW_TYPE", $this->type);
1274 $this->tpl->setVariable(
"TXT_IMPORT", $this->lng->txt(
"import"));
1277 $this->tpl->setVariable(
"ALT_IMG",$this->lng->txt(
"obj_qpl"));
1279 $this->tpl->setVariable(
"ALT_IMG2",$this->lng->txt(
"obj_qpl"));
1281 $this->tpl->parseCurrentBlock();
1290 if (strcmp($_FILES[
"xmldoc"][
"tmp_name"],
"") == 0)
1302 switch ($this->ctrl->getCmd())
1309 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"",
$_GET[
"ref_id"]);
1312 if (
$_GET[
"q_id"] > 0)
1314 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1316 $q_gui->object->setObjId($this->object->getId());
1317 if (
$_GET[
"q_id"] > 0)
1319 $ilLocator->addItem($q_gui->object->getTitle(), $this->ctrl->getLinkTargetByClass(get_class($q_gui),
"editQuestion"));
1329 if (
$_GET[
"q_id"] > 0)
1331 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1333 $q_gui->object->setObjId($this->object->getId());
1334 $title = $q_gui->object->getTitle();
1335 if (strcmp($this->ctrl->getCmd(),
"assessment") == 0)
1337 $title .=
" - " . $this->lng->txt(
"statistics");
1339 $this->tpl->setTitle(
$title);
1340 $this->tpl->setDescription($q_gui->object->getComment());
1341 $this->tpl->setTitleIcon(
ilUtil::getImagePath(
"icon_".$this->object->getType().
"_b.gif"), $this->lng->txt(
"obj_qpl"));
1345 $this->tpl->setTitle($this->object->getTitle());
1346 $this->tpl->setDescription($this->object->getLongDescription());
1347 $this->tpl->setTitleIcon(
ilUtil::getImagePath(
"icon_".$this->object->getType().
"_b.gif"), $this->lng->txt(
"obj_qpl"));
1360 $next_class = $this->ctrl->getNextClass($this);
1361 switch ($next_class)
1364 case "ilpermissiongui":
1365 case "ilmdeditorgui":
1372 $force_active =
false;
1373 $commands =
$_POST[
"cmd"];
1374 if (is_array($commands))
1376 foreach ($commands as
$key => $value)
1378 if (preg_match(
"/^delete_.*/",
$key, $matches) ||
1379 preg_match(
"/^addSelectGap_.*/",
$key, $matches) ||
1380 preg_match(
"/^addTextGap_.*/",
$key, $matches) ||
1381 preg_match(
"/^deleteImage_.*/",
$key, $matches) ||
1382 preg_match(
"/^upload_.*/",
$key, $matches) ||
1383 preg_match(
"/^addSuggestedSolution_.*/",
$key, $matches)
1386 $force_active =
true;
1390 if (array_key_exists(
"imagemap_x",
$_POST))
1392 $force_active =
true;
1396 $force_active = ((strtolower($this->ctrl->getCmdClass()) == strtolower(get_class($this)) || strlen($this->ctrl->getCmdClass()) == 0) &&
1397 $this->ctrl->getCmd() ==
"")
1401 $tabs_gui->addTarget(
"assQuestions",
1402 $this->ctrl->getLinkTarget($this,
"questions"),
1403 array(
"questions",
"filter",
"resetFilter",
"createQuestion",
1404 "importQuestions",
"deleteQuestions",
"filterQuestionBrowser",
1405 "view",
"preview",
"editQuestion",
"exec_pg",
1406 "addItem",
"upload",
"save",
"cancel",
"addSuggestedSolution",
1407 "cancelExplorer",
"linkChilds",
"removeSuggestedSolution",
1408 "add",
"addYesNo",
"addTrueFalse",
"createGaps",
"saveEdit",
1409 "setMediaMode",
"uploadingImage",
"uploadingImagemap",
"addArea",
1410 "deletearea",
"saveShape",
"back",
"addPair",
"uploadingJavaapplet",
1411 "addParameter",
"assessment",
"addGIT",
"addST",
"addPG",
"delete",
1412 "toggleGraphicalAnswers",
"deleteAnswer",
"deleteImage",
"removeJavaapplet"),
1413 "",
"", $force_active);
1416 $tabs_gui->addTarget(
"properties",
1417 $this->ctrl->getLinkTarget($this,
'properties'),
1422 if ($rbacsystem->checkAccess(
"write", $this->ref_id))
1425 $tabs_gui->addTarget(
"meta_data",
1426 $this->ctrl->getLinkTargetByClass(
'ilmdeditorgui',
'listSection'),
1427 "",
"ilmdeditorgui");
1431 $tabs_gui->addTarget(
"print_view",
1432 $this->ctrl->getLinkTarget($this,
'print'),
1437 $tabs_gui->addTarget(
"export",
1438 $this->ctrl->getLinkTarget($this,
'export'),
1439 array(
"export",
"createExportFile",
"confirmDeleteExportFile",
"downloadExportFile"),
1442 if ($ilAccess->checkAccess(
"edit_permission",
"", $this->ref_id))
1444 $tabs_gui->addTarget(
"perm_settings",
1445 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
1461 if ($ilAccess->checkAccess(
"write",
"", $a_target))
1463 $_GET[
"baseClass"] =
"ilObjQuestionPoolGUI";
1464 $_GET[
"cmd"] =
"questions";
1465 $_GET[
"ref_id"] = $a_target;
1466 include_once(
"ilias.php");
1469 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
1471 $_GET[
"cmd"] =
"frameset";
1472 $_GET[
"target"] =
"";
1473 $_GET[
"ref_id"] = ROOT_FOLDER_ID;
1476 include(
"repository.php");
1479 $ilErr->raiseError($lng->txt(
"msg_no_perm_read_lm"), $ilErr->FATAL);