ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilObjQuestionPoolGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once './Services/Object/classes/class.ilObjectGUI.php';
5require_once './Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
6require_once './Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
7require_once './Modules/TestQuestionPool/exceptions/class.ilTestQuestionPoolException.php';
8require_once './Modules/Test/classes/inc.AssessmentConstants.php';
9require_once './Modules/Test/classes/class.ilObjAssessmentFolder.php';
10require_once './Modules/Test/classes/class.ilObjTest.php';
11
35{
39 public $object;
40
46 {
47 global $lng, $ilCtrl, $rbacsystem;
48 $lng->loadLanguageModule("assessment");
49 $this->type = "qpl";
50 $this->ctrl =& $ilCtrl;
51
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'
54 ));
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');
60
61 $this->ilObjectGUI("",$_GET["ref_id"], true, false);
62 }
63
76 function executeCommand()
77 {
78 global $ilUser, $ilLocator, $ilAccess, $ilNavigationHistory, $tpl, $ilCtrl, $ilErr, $ilTabs, $lng, $ilDB, $ilPluginAdmin;
79
80 if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"])) && (!$ilAccess->checkAccess("visible", "", $_GET["ref_id"])))
81 {
82 global $ilias;
83 $ilias->raiseError($this->lng->txt("permission_denied"), $ilias->error_obj->MESSAGE);
84 }
85
86 // add entry to navigation history
87 if (!$this->getCreationMode() &&
88 $ilAccess->checkAccess("read", "", $_GET["ref_id"]))
89 {
90 if('qpl' == $this->object->getType())
91 {
92 $ilNavigationHistory->addItem($_GET["ref_id"],
93 "ilias.php?baseClass=ilObjQuestionPoolGUI&cmd=questions&ref_id=".$_GET["ref_id"], "qpl");
94 }
95 }
96
97 $cmd = $this->ctrl->getCmd("questions");
98 $next_class = $this->ctrl->getNextClass($this);
99
100 if( in_array($next_class, array('', 'ilobjquestionpoolgui')) && $cmd == 'questions' )
101 {
102 $_GET['q_id'] = '';
103 }
104
105 $this->prepareOutput();
106
107 $this->ctrl->setReturn($this, "questions");
108
109 $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
110 $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "ta.css", "Modules/Test"), "screen");
111
112 if ($_GET["q_id"] < 1)
113 {
114 $q_type = ($_POST["sel_question_types"] != "")
115 ? $_POST["sel_question_types"]
116 : $_GET["sel_question_types"];
117 }
118 if ($cmd != "createQuestion" && $cmd != "createQuestionForTest"
119 && $next_class != "ilassquestionpagegui")
120 {
121 if (($_GET["test_ref_id"] != "") or ($_GET["calling_test"]))
122 {
123 $ref_id = $_GET["test_ref_id"];
124 if (!$ref_id)
125 {
126 $ref_id = $_GET["calling_test"];
127 }
128 }
129 }
130 switch($next_class)
131 {
132 case "ilcommonactiondispatchergui":
133 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
135 $this->ctrl->forwardCommand($gui);
136 break;
137
138 case 'ilmdeditorgui':
139 if(!$ilAccess->checkAccess('write','',$this->object->getRefId()))
140 {
141 $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
142 }
143
144 include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
145
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);
149 break;
150
151 case 'ilassquestionpreviewgui':
152
153 $this->ctrl->saveParameter($this, "q_id");
154
155 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewGUI.php';
156 $gui = new ilAssQuestionPreviewGUI($this->ctrl, $this->tabs_gui, $this->tpl, $this->lng, $ilDB);
157
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();
163
164 global $ilHelp;
165 $ilHelp->setScreenIdComponent("qpl");
166
167 $this->ctrl->forwardCommand($gui);
168 break;
169
170 case "ilassquestionpagegui":
171 include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
172 $this->tpl->setCurrentBlock("ContentStyle");
173 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
174 $this->tpl->parseCurrentBlock();
175
176 // syntax style
177 $this->tpl->setCurrentBlock("SyntaxStyle");
178 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
179 $this->tpl->parseCurrentBlock();
180
181 include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
182 $q_gui = assQuestionGUI::_getQuestionGUI("", $_GET["q_id"]);
183 $q_gui->setQuestionTabs();
184 $q_gui->outAdditionalOutput();
185 $q_gui->object->setObjId($this->object->getId());
186
187 $q_gui->setTargetGuiClass(null);
188 $q_gui->setQuestionActionCmd(null);
189
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");
196 $page_gui = new ilAssQuestionPageGUI($_GET["q_id"]);
197 $page_gui->setEditPreview(true);
198 $page_gui->setEnabledTabs(false);
199 if (strlen($this->ctrl->getCmd()) == 0 && !isset($_POST["editImagemapForward_x"])) // workaround for page edit imagemaps, keep in mind
200 {
201 $this->ctrl->setCmdClass(get_class($page_gui));
202 $this->ctrl->setCmd("preview");
203 }
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);
211 break;
212
213 case 'ilpermissiongui':
214 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
215 $perm_gui = new ilPermissionGUI($this);
216 $ret = $this->ctrl->forwardCommand($perm_gui);
217 break;
218
219 case 'ilobjectcopygui':
220 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
221 $cp = new ilObjectCopyGUI($this);
222 $cp->setType('qpl');
223 $this->ctrl->forwardCommand($cp);
224 break;
225
226 case "ilquestionpoolexportgui":
227 require_once 'Modules/TestQuestionPool/classes/class.ilQuestionPoolExportGUI.php';
228 $exp_gui = new ilQuestionPoolExportGUI($this);
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);
232 break;
233
234 case "ilinfoscreengui":
235 $this->infoScreenForward();
236 break;
237
238 case 'ilassquestionhintsgui':
239
240 // set return target
241 $this->ctrl->setReturn($this, "questions");
242
243 // set context tabs
244 require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
245 $questionGUI = assQuestionGUI::_getQuestionGUI($q_type, $_GET['q_id']);
246 $questionGUI->object->setObjId($this->object->getId());
247 $questionGUI->setQuestionTabs();
248 global $ilHelp;
249 $ilHelp->setScreenIdComponent("qpl");
250
251 // forward to ilAssQuestionHintsGUI
252 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsGUI.php';
253 $gui = new ilAssQuestionHintsGUI($questionGUI);
254 $ilCtrl->forwardCommand($gui);
255
256 break;
257
258 case 'illocalunitconfigurationgui':
259 if(!$ilAccess->checkAccess('write','',$this->object->getRefId()))
260 {
261 $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
262 }
263
264 require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
265 $questionGUI = assQuestionGUI::_getQuestionGUI($q_type, $_GET['q_id']);
266 $questionGUI->object->setObjId($this->object->getId());
267 $questionGUI->setQuestionTabs();
268
269 $this->ctrl->setReturn($this, 'questions');
270
271 require_once 'Modules/TestQuestionPool/classes/class.ilLocalUnitConfigurationGUI.php';
272 require_once 'Modules/TestQuestionPool/classes/class.ilUnitConfigurationRepository.php';
274 new ilUnitConfigurationRepository((int)$_GET['q_id'])
275 );
276 $ilCtrl->forwardCommand($gui);
277 break;
278
279 case 'ilassquestionfeedbackeditinggui':
280
281 // set return target
282 $this->ctrl->setReturn($this, "questions");
283
284 // set context tabs
285 require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
286 $questionGUI = assQuestionGUI::_getQuestionGUI($q_type, $_GET['q_id']);
287 $questionGUI->object->setObjId($this->object->getId());
288 $questionGUI->setQuestionTabs();
289 global $ilHelp;
290 $ilHelp->setScreenIdComponent("qpl");
291
292 // forward to ilAssQuestionFeedbackGUI
293 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
294 $gui = new ilAssQuestionFeedbackEditingGUI($questionGUI, $ilCtrl, $ilAccess, $tpl, $ilTabs, $lng);
295 $ilCtrl->forwardCommand($gui);
296
297 break;
298
299 case 'ilobjquestionpoolsettingsgeneralgui':
300 require_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPoolSettingsGeneralGUI.php';
301 $gui = new ilObjQuestionPoolSettingsGeneralGUI($ilCtrl, $ilAccess, $lng, $tpl, $ilTabs, $this);
302 $this->ctrl->forwardCommand($gui);
303 break;
304
305 case "ilobjtaxonomygui":
306
307 require_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPoolTaxonomyEditingCommandForwarder.php';
309 $this->object, $ilDB, $ilPluginAdmin, $ilCtrl, $ilTabs, $lng
310 );
311
312 $forwarder->forward();
313
314 break;
315
316 case 'ilquestionbrowsertablegui':
317 $this->ctrl->forwardCommand($this->buildQuestionBrowserTableGUI($taxIds = array())); // no tax ids required
318 break;
319
320 case "ilobjquestionpoolgui":
321 case "":
322
323 if( $cmd == 'questions' )
324 {
325 $this->ctrl->setParameter($this, 'q_id', '');
326 }
327
328 $cmd.= "Object";
329 $ret = $this->$cmd();
330 break;
331
332 default:
333 $this->ctrl->setReturn($this, "questions");
334 include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
335 $q_gui = assQuestionGUI::_getQuestionGUI($q_type, $_GET["q_id"]);
336 $q_gui->object->setObjId($this->object->getId());
337 if($this->object->getType() == 'qpl')
338 {
339 $q_gui->setTaxonomyIds($this->object->getTaxonomyIds());
340 $this->object->addQuestionChangeListeners($q_gui->object);
341 }
342 $q_gui->setQuestionTabs();
343 global $ilHelp;
344 $ilHelp->setScreenIdComponent("qpl");
345 $ret = $this->ctrl->forwardCommand($q_gui);
346 break;
347 }
348
349 if ( !(strtolower($_GET["baseClass"]) == "iladministrationgui"
350 || strtolower($_GET['baseClass']) == 'ilrepositorygui')
351 && $this->getCreationMode() != true)
352 {
353 $this->tpl->show();
354 }
355 }
356
361 {
362 $file = explode("_", $_GET["file_id"]);
363 include_once("./Modules/File/classes/class.ilObjFile.php");
364 $fileObj =& new ilObjFile($file[count($file) - 1], false);
365 $fileObj->sendFile();
366 exit;
367 }
368
373 {
374 include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
375 $page_gui = new ilAssQuestionPageGUI($_GET["pg_id"]);
376 $page_gui->showMediaFullscreen();
377 }
378
379
383 function filterObject()
384 {
385 $this->questionsObject();
386 }
387
392 {
393 $_POST["filter_text"] = "";
394 $_POST["sel_filter_type"] = "";
395 $this->questionsObject();
396 }
397
402 {
403 include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
404 $pg_obj = new ilAssQuestionPage($_GET["pg_id"]);
405 $pg_obj->send_paragraph ($_GET["par_id"], $_GET["downloadtitle"]);
406 exit;
407 }
408
412 function uploadQplObject($questions_only = false)
413 {
414 $this->ctrl->setParameter($this, 'new_type', $_REQUEST['new_type']);
415 if ($_FILES["xmldoc"]["error"] > UPLOAD_ERR_OK)
416 {
417 ilUtil::sendFailure($this->lng->txt("error_upload"), true);
418 if(!$questions_only)
419 {
420 $this->ctrl->redirect($this, 'create');
421 }
422 return false;
423 }
424 // create import directory
425 include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
427
428 // copy uploaded file to import directory
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";
433 ilUtil::moveUploadedFile($_FILES["xmldoc"]["tmp_name"], $_FILES["xmldoc"]["name"], $full_path);
434 $GLOBALS['ilLog']->write(__METHOD__.": full path " . $full_path);
435 if (strcmp($_FILES["xmldoc"]["type"], "text/xml") == 0)
436 {
437 $qti_file = $full_path;
439 }
440 else
441 {
442 // unzip file
443 ilUtil::unzip($full_path);
444
445 // determine filenames of xml files
446 $subdir = basename($file["basename"],".".$file["extension"]);
448 $xml_file = ilObjQuestionPool::_getImportDirectory().'/'.$subdir.'/'.$subdir.".xml";
449 $qti_file = ilObjQuestionPool::_getImportDirectory().'/'.$subdir.'/'. str_replace("qpl", "qti", $subdir).".xml";
450 }
451
452 // start verification of QTI files
453 include_once "./Services/QTI/classes/class.ilQTIParser.php";
454 $qtiParser = new ilQTIParser($qti_file, IL_MO_VERIFY_QTI, 0, "");
455 $result = $qtiParser->startParsing();
456 $founditems =& $qtiParser->getFoundItems();
457 if (count($founditems) == 0)
458 {
459 // nothing found
460
461 // delete import directory
462 ilUtil::delDir($basedir);
463
464 ilUtil::sendFailure($this->lng->txt("qpl_import_no_items"), true);
465 if(!$questions_only)
466 {
467 $this->ctrl->redirect($this, 'create');
468 }
469 return false;
470 }
471
472 $complete = 0;
473 $incomplete = 0;
474 foreach ($founditems as $item)
475 {
476 if (strlen($item["type"]))
477 {
478 $complete++;
479 }
480 else
481 {
482 $incomplete++;
483 }
484 }
485
486 if ($complete == 0)
487 {
488 // delete import directory
489 ilUtil::delDir($basedir);
490
491 ilUtil::sendFailure($this->lng->txt("qpl_import_non_ilias_files"), true);
492 if(!$questions_only)
493 {
494 $this->ctrl->redirect($this, 'create');
495 }
496 return false;
497 }
498
499 $_SESSION["qpl_import_xml_file"] = $xml_file;
500 $_SESSION["qpl_import_qti_file"] = $qti_file;
501 $_SESSION["qpl_import_subdir"] = $subdir;
502 // display of found questions
503 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.qpl_import_verification.html",
504 "Modules/TestQuestionPool");
505 $row_class = array("tblrow1", "tblrow2");
506 $counter = 0;
507 foreach ($founditems as $item)
508 {
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"])
515 {
517 $type = $this->lng->txt("assClozeTest");
518 break;
520 $type = $this->lng->txt("assImagemapQuestion");
521 break;
523 $type = $this->lng->txt("assJavaApplet");
524 break;
526 $type = $this->lng->txt("assMatchingQuestion");
527 break;
529 $type = $this->lng->txt("assMultipleChoice");
530 break;
532 $type = $this->lng->txt("assKprimChoice");
533 break;
535 $type = $this->lng->txt("assSingleChoice");
536 break;
538 $type = $this->lng->txt("assOrderingQuestion");
539 break;
541 $type = $this->lng->txt("assTextQuestion");
542 break;
544 $type = $this->lng->txt("assNumeric");
545 break;
547 $type = $this->lng->txt("assTextSubset");
548 break;
549 default:
550 $type = $this->lng->txt($item["type"]);
551 break;
552 }
553
554 if (strcmp($type, "-" . $item["type"] . "-") == 0)
555 {
556 global $ilPluginAdmin;
557 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
558 foreach ($pl_names as $pl_name)
559 {
560 $pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pl_name);
561 if (strcmp($pl->getQuestionType(), $item["type"]) == 0)
562 {
563 $type = $pl->getQuestionTypeTranslation();
564 }
565 }
566 }
567 $this->tpl->setVariable("QUESTION_TYPE", $type);
568 $this->tpl->parseCurrentBlock();
569 }
570
571 $this->tpl->setCurrentBlock("import_qpl");
572 if (is_file($xml_file))
573 {
574 // read file into a string
575 $fh = @fopen($xml_file, "r") or die("");
576 $xml = @fread($fh, filesize($xml_file));
577 @fclose($fh);
578 if (preg_match("/<ContentObject.*?MetaData.*?General.*?Title[^>]*?>([^<]*?)</", $xml, $matches))
579 {
580 $this->tpl->setVariable("VALUE_NEW_QUESTIONPOOL", $matches[1]);
581 }
582 }
583 $this->tpl->setVariable("TEXT_CREATE_NEW_QUESTIONPOOL", $this->lng->txt("qpl_import_create_new_qpl"));
584 $this->tpl->parseCurrentBlock();
585
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"));
590 if ($questions_only)
591 {
592 $this->tpl->setVariable("VERIFICATION_HEADING", $this->lng->txt("import_questions_into_qpl"));
593 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
594 }
595 else
596 {
597 $this->tpl->setVariable("VERIFICATION_HEADING", $this->lng->txt("import_qpl"));
598
599 $this->ctrl->setParameter($this, "new_type", $this->type);
600 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
601
602 //$this->tpl->setVariable("FORMACTION", $this->getFormAction("save","adm_object.php?cmd=gateway&ref_id=".$_GET["ref_id"]."&new_type=".$this->type));
603 }
604 $this->tpl->setVariable("ARROW", ilUtil::getImagePath("arrow_downright.svg"));
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);
610
611 $this->tpl->parseCurrentBlock();
612
613 return true;
614 }
615
620 {
621 if ($_POST["questions_only"] == 1)
622 {
623 $newObj =& $this->object;
624 }
625 else
626 {
627 include_once("./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
628 // create new questionpool object
629 $newObj = new ilObjQuestionPool(0, true);
630 // set type of questionpool object
631 $newObj->setType($_GET["new_type"]);
632 // set title of questionpool object to "dummy"
633 $newObj->setTitle("dummy");
634 // set description of questionpool object
635 $newObj->setDescription("questionpool import");
636 // create the questionpool class in the ILIAS database (object_data table)
637 $newObj->create(true);
638 // create a reference for the questionpool object in the ILIAS database (object_reference table)
639 $newObj->createReference();
640 // put the questionpool object in the administration tree
641 $newObj->putInTree($_GET["ref_id"]);
642 // get default permissions and set the permissions for the questionpool object
643 $newObj->setPermissions($_GET["ref_id"]);
644 // notify the questionpool object and all its parent objects that a "new" object was created
645 $newObj->notify("new",$_GET["ref_id"],$_GET["parent_non_rbac_id"],$_GET["ref_id"],$newObj->getRefId());
646 }
647
648 // start parsing of QTI files
649 include_once "./Services/QTI/classes/class.ilQTIParser.php";
650 $qtiParser = new ilQTIParser($_SESSION["qpl_import_qti_file"], IL_MO_PARSE_QTI, $newObj->getId(), $_POST["ident"]);
651 $result = $qtiParser->startParsing();
652
653 // import page data
654 if (strlen($_SESSION["qpl_import_xml_file"]))
655 {
656 include_once ("./Modules/LearningModule/classes/class.ilContObjParser.php");
657 $contParser = new ilContObjParser($newObj, $_SESSION["qpl_import_xml_file"], $_SESSION["qpl_import_subdir"]);
658 $contParser->setQuestionMapping($qtiParser->getImportMapping());
659 $contParser->startParsing();
660 }
661
662 // set another question pool name (if possible)
663 $qpl_name = $_POST["qpl_new"];
664 if ((strcmp($qpl_name, $newObj->getTitle()) != 0) && (strlen($qpl_name) > 0))
665 {
666 $newObj->setTitle($qpl_name);
667 $newObj->update();
668 }
669
670 // delete import directory
671 include_once "./Services/Utilities/classes/class.ilUtil.php";
673
674 if ($_POST["questions_only"] == 1)
675 {
676 $this->ctrl->redirect($this, "questions");
677 }
678 else
679 {
680 ilUtil::sendSuccess($this->lng->txt("object_imported"),true);
681 ilUtil::redirect("ilias.php?ref_id=".$newObj->getRefId().
682 "&baseClass=ilObjQuestionPoolGUI");
683 }
684 }
685
687 {
688 if ($_POST["questions_only"] == 1)
689 {
690 $this->ctrl->redirect($this, "questions");
691 }
692 else
693 {
694 $this->ctrl->redirect($this, "cancel");
695 }
696 }
697
701 function uploadObject()
702 {
703 $upload_valid = true;
704 $form = $this->getImportQuestionsForm();
705 if($form->checkInput())
706 {
707 if(!$this->uploadQplObject(true))
708 {
709 $form->setValuesByPost();
710 $this->importQuestionsObject($form);
711 }
712 }
713 else
714 {
715 $form->setValuesByPost();
716 $this->importQuestionsObject($form);
717 }
718 }
719
723 public function importQuestionsObject(ilPropertyFormGUI $form = null)
724 {
725 if(!$form instanceof ilPropertyFormGUI)
726 {
727 $form = $this->getImportQuestionsForm();
728 }
729
730 $this->tpl->setContent($form->getHtml());
731 }
732
736 protected function getImportQuestionsForm()
737 {
738 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
739 $form = new ilPropertyFormGUI();
740 $form->setTitle($this->lng->txt('import_question'));
741 $form->setFormAction($this->ctrl->getFormAction($this, 'upload'));
742
743 $file = new ilFileInputGUI($this->lng->txt('select_file'), 'xmldoc');
744 $file->setRequired(true);
745 $form->addItem($file);
746
747 $form->addCommandButton('upload', $this->lng->txt('upload'));
748 $form->addCommandButton('questions', $this->lng->txt('cancel'));
749
750 return $form;
751 }
752
757 {
759 {
760 $addContEditMode = $_POST['add_quest_cont_edit_mode'];
761 }
762 else
763 {
765 }
766
767 include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
768 $q_gui =& assQuestionGUI::_getQuestionGUI($_POST["sel_question_types"]);
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");
776 }
777
782 {
783 if( !$_REQUEST['q_id'] )
784 {
785 require_once 'Modules/Test/classes/class.ilObjAssessmentFolder.php';
787 {
788 $addContEditMode = $_REQUEST['add_quest_cont_edit_mode'];
789 }
790 else
791 {
793 }
794
795 include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
796 $q_gui =& assQuestionGUI::_getQuestionGUI($_GET["sel_question_types"]);
797 $q_gui->object->setObjId($this->object->getId());
798 $q_gui->object->setAdditionalContentEditingMode($addContEditMode);
799 $q_gui->object->createNewQuestion();
800
801 $class = get_class($q_gui);
802 $qId = $q_gui->object->getId();
803 }
804 else
805 {
806 $class = $_GET["sel_question_types"] . 'gui';
807 $qId = $_REQUEST['q_id'];
808 }
809
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"]);
813
814 $this->ctrl->redirectByClass($class, "editQuestion");
815 }
816
821 function afterSave(ilObject $a_new_object)
822 {
823 // always send a message
824 ilUtil::sendSuccess($this->lng->txt("object_added"),true);
825
826 ilUtil::redirect("ilias.php?ref_id=".$a_new_object->getRefId().
827 "&baseClass=ilObjQuestionPoolGUI");
828 }
829
830 function questionObject()
831 {
832//echo "<br>ilObjQuestionPoolGUI->questionObject()";
833 $type = $_GET["sel_question_types"];
834 $this->editQuestionForm($type);
835 }
836
841 {
842 global $rbacsystem;
843
844 if (count($_POST["q_id"]) < 1)
845 {
846 ilUtil::sendInfo($this->lng->txt("qpl_delete_select_none"), true);
847 $this->ctrl->redirect($this, "questions");
848 }
849
850 ilUtil::sendQuestion($this->lng->txt("qpl_confirm_delete_questions"));
851 $deleteable_questions =& $this->object->getDeleteableQuestionDetails($_POST["q_id"]);
852 include_once "./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
853 $table_gui = new ilQuestionBrowserTableGUI($this, 'questions', (($rbacsystem->checkAccess('write', $_GET['ref_id']) ? true : false)), true);
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());
857 }
858
859
864 {
865 // delete questions after confirmation
866 foreach ($_POST["q_id"] as $key => $value)
867 {
868 $this->object->deleteQuestion($value);
869 $this->object->cleanupClipboard($value);
870 }
871 if (count($_POST["q_id"])) ilUtil::sendSuccess($this->lng->txt("qpl_questions_deleted"), true);
872
873 $this->ctrl->setParameter($this, 'q_id', '');
874
875 $this->ctrl->redirect($this, "questions");
876 }
877
882 {
883 $this->ctrl->redirect($this, "questions");
884 }
885
890 {
891 // export button was pressed
892 if (count($_POST["q_id"]) > 0)
893 {
894 include_once("./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php");
895 $qpl_exp = new ilQuestionpoolExport($this->object, "xml", $_POST["q_id"]);
896 $export_file = $qpl_exp->buildExportFile();
897 $filename = $export_file;
898 $filename = preg_replace("/.*\//", "", $filename);
899 include_once "./Services/Utilities/classes/class.ilUtil.php";
900 ilUtil::deliverFile($export_file, $filename);
901 exit();
902 }
903 else
904 {
905 ilUtil::sendInfo($this->lng->txt("qpl_export_select_none"), true);
906 }
907 $this->ctrl->redirect($this, "questions");
908 }
909
911 {
912 require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
913 $taxIds = ilObjTaxonomy::getUsageOfObject($this->object->getId());
914
915 include_once "./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
916 $table_gui = new ilQuestionBrowserTableGUI($this, 'questions', false, false, $taxIds);
917 $table_gui->resetOffset();
918 $table_gui->writeFilterToSession();
919 $this->questionsObject();
920 }
921
923 {
924 require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
925 $taxIds = ilObjTaxonomy::getUsageOfObject($this->object->getId());
926
927 include_once "./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
928 $table_gui = new ilQuestionBrowserTableGUI($this, 'questions', false, false, $taxIds);
929 $table_gui->resetOffset();
930 $table_gui->resetFilter();
931 $this->questionsObject();
932 }
933
938 {
939 global $rbacsystem, $ilUser, $ilCtrl, $ilDB, $lng, $ilPluginAdmin;
940
941 if(get_class($this->object) == "ilObjTest")
942 {
943 if ($_GET["calling_test"] > 0)
944 {
945 $ref_id = $_GET["calling_test"];
946 $q_id = $_GET["q_id"];
947
948 if ($_REQUEST['test_express_mode']) {
949 if ($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");
951 else
952 ilUtil::redirect("ilias.php?ref_id=".$ref_id."&test_express_mode=1&cmd=showPage&cmdClass=iltestexpresspageobjectgui&baseClass=ilObjTestGUI");
953 }
954 else
955 ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&ref_id=".$ref_id."&cmd=questions");
956
957 }
958 }
959 else if(isset($_GET['calling_consumer']) && (int)$_GET['calling_consumer'])
960 {
961 $ref_id = (int)$_GET['calling_consumer'];
963 if($consumer instanceof ilQuestionEditingFormConsumer)
964 {
965 ilUtil::redirect($consumer->getQuestionEditingFormBackTarget($_GET['consumer_context']));
966 }
967 require_once 'Services/Link/classes/class.ilLink.php';
969 }
970
971 $this->object->purgeQuestions();
972 // reset test_id SESSION variable
973 $_SESSION["test_id"] = "";
974
975 require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
976 $taxIds = ilObjTaxonomy::getUsageOfObject($this->object->getId());
977
978 $table_gui = $this->buildQuestionBrowserTableGUI($taxIds);
979 $table_gui->setPreventDoubleSubmission(false);
980
981 if( $rbacsystem->checkAccess('write', $_GET['ref_id']) )
982 {
983 $toolbar = new ilToolbarGUI();
984
985 $toolbar->addButton(
986 $this->lng->txt("ass_create_question"),
987 $this->ctrl->getLinkTarget($this, 'createQuestionForm')
988 );
989
990 $this->tpl->setContent(
991 $this->ctrl->getHTML($toolbar) . $this->ctrl->getHTML($table_gui)
992 );
993 }
994 else
995 {
996 $this->tpl->setContent( $this->ctrl->getHTML($table_gui) );
997 }
998
999 if( $this->object->getShowTaxonomies() )
1000 {
1001 $this->lng->loadLanguageModule('tax');
1002
1003 require_once 'Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php';
1004
1005 foreach($taxIds as $taxId)
1006 {
1007 if( $taxId != $this->object->getNavTaxonomyId() )
1008 {
1009 continue;
1010 }
1011
1012 $taxExp = new ilTaxonomyExplorerGUI(
1013 $this, 'showNavTaxonomy', $taxId, 'ilobjquestionpoolgui', 'questions'
1014 );
1015
1016 if( !$taxExp->handleCommand() )
1017 {
1018 $this->tpl->setLeftContent($taxExp->getHTML()."&nbsp;");
1019 }
1020
1021 break;
1022 }
1023 }
1024 }
1025
1026 private function createQuestionFormObject()
1027 {
1028 $form = $this->buildCreateQuestionForm();
1029
1030 $this->tpl->setContent( $this->ctrl->getHTML($form) );
1031 }
1032
1033 private function buildCreateQuestionForm()
1034 {
1035 global $ilUser;
1036
1037 // form
1038
1039 require_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1040 $form = new ilPropertyFormGUI();
1041 $form->setTitle($this->lng->txt('ass_create_question'));
1042 $form->setFormAction($this->ctrl->getFormAction($this));
1043
1044 // question type
1045
1046 $options = array();
1047 foreach( $this->object->getQuestionTypes(false, true) as $translation => $data )
1048 {
1049 $options[$data['type_tag']] = $translation;
1050 }
1051
1052 require_once("Services/Form/classes/class.ilSelectInputGUI.php");
1053 $si = new ilSelectInputGUI($this->lng->txt('question_type'), 'sel_question_types');
1054 $si->setOptions($options);
1055 //$si->setValue($ilUser->getPref("tst_lastquestiontype"));
1056
1057 $form->addItem($si);
1058
1059 // content editing mode
1060
1062 {
1063 $ri = new ilRadioGroupInputGUI($this->lng->txt("tst_add_quest_cont_edit_mode"), "add_quest_cont_edit_mode");
1064
1065 $ri->addOption(new ilRadioOption(
1066 $this->lng->txt('tst_add_quest_cont_edit_mode_default'),
1068 ));
1069
1070 $ri->addOption(new ilRadioOption(
1071 $this->lng->txt('tst_add_quest_cont_edit_mode_page_object'),
1073 ));
1074
1076
1077 $form->addItem($ri, true);
1078 }
1079 else
1080 {
1081 $hi = new ilHiddenInputGUI("question_content_editing_type");
1083 $form->addItem($hi, true);
1084 }
1085
1086 // commands
1087
1088 $form->addCommandButton('createQuestion', $this->lng->txt('create'));
1089 $form->addCommandButton('questions', $this->lng->txt('cancel'));
1090
1091 return $form;
1092 }
1093
1097 public function printObject()
1098 {
1102 global $ilToolbar;
1103
1104 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 'print'));
1105 require_once 'Services/Form/classes/class.ilSelectInputGUI.php';
1106 $mode = new ilSelectInputGUI($this->lng->txt('output_mode'), 'output');
1107 $mode->setOptions(array(
1108 'overview' => $this->lng->txt('overview'),
1109 'detailed' => $this->lng->txt('detailed_output_solutions'),
1110 'detailed_printview' => $this->lng->txt('detailed_output_printview')
1111 ));
1112 $mode->setValue(ilUtil::stripSlashes($_POST['output']));
1113
1114 $ilToolbar->setFormName('printviewOptions');
1115 $ilToolbar->addInputItem($mode, true);
1116 $ilToolbar->addFormButton($this->lng->txt('submit'), 'print');
1117
1118 include_once "./Modules/TestQuestionPool/classes/tables/class.ilQuestionPoolPrintViewTableGUI.php";
1119 $table_gui = new ilQuestionPoolPrintViewTableGUI($this, 'print', $_POST['output']);
1120 $data = $this->object->getPrintviewQuestions();
1121 $totalPoints = 0;
1122 foreach($data as $d)
1123 {
1124 $totalPoints += $d['points'];
1125 }
1126 $table_gui->setTotalPoints($totalPoints);
1127 $table_gui->initColumns();
1128 $table_gui->setData($data);
1129 $this->tpl->setContent($table_gui->getHTML());
1130 }
1131
1132 function updateObject()
1133 {
1134// $this->update = $this->object->updateMetaData();
1135 $this->update = $this->object->update();
1136 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1137 }
1138
1142 function pasteObject()
1143 {
1144 if (array_key_exists("qpl_clipboard", $_SESSION))
1145 {
1146 if($this->object->pasteFromClipboard())
1147 {
1148 ilUtil::sendSuccess($this->lng->txt("qpl_paste_success"), true);
1149 }
1150 else
1151 {
1152 ilUtil::sendFailure($this->lng->txt("qpl_paste_error"), true);
1153 }
1154 }
1155 else
1156 {
1157 ilUtil::sendInfo($this->lng->txt("qpl_paste_no_objects"), true);
1158 }
1159 $this->ctrl->redirect($this, "questions");
1160 }
1161
1165 public function copyObject()
1166 {
1167 if (count($_POST["q_id"]) > 0)
1168 {
1169 foreach ($_POST["q_id"] as $key => $value)
1170 {
1171 $this->object->copyToClipboard($value);
1172 }
1173 ilUtil::sendInfo($this->lng->txt("qpl_copy_insert_clipboard"), true);
1174 }
1175 else
1176 {
1177 ilUtil::sendInfo($this->lng->txt("qpl_copy_select_none"), true);
1178 }
1179 $this->ctrl->redirect($this, "questions");
1180 }
1181
1185 function moveObject()
1186 {
1187 if (count($_POST["q_id"]) > 0)
1188 {
1189 foreach ($_POST["q_id"] as $key => $value)
1190 {
1191 $this->object->moveToClipboard($value);
1192 }
1193 ilUtil::sendInfo($this->lng->txt("qpl_move_insert_clipboard"), true);
1194 }
1195 else
1196 {
1197 ilUtil::sendInfo($this->lng->txt("qpl_move_select_none"), true);
1198 }
1199 $this->ctrl->redirect($this, "questions");
1200 }
1201
1206 {
1207 global $rbacsystem;
1208 if ($rbacsystem->checkAccess("write", $_GET['ref_id']))
1209 {
1210 include_once("./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php");
1211 $question_ids =& $this->object->getAllQuestionIds();
1212 $qpl_exp = new ilQuestionpoolExport($this->object, 'xml', $question_ids);
1213 $qpl_exp->buildExportFile();
1214 $this->ctrl->redirectByClass("ilquestionpoolexportgui", "");
1215 }
1216 }
1217
1219 {
1220 global $rbacsystem;
1221 if ($rbacsystem->checkAccess("write", $_GET['ref_id']))
1222 {
1223 include_once("./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php");
1224 $question_ids =& $this->object->getAllQuestionIds();
1225 $qpl_exp = new ilQuestionpoolExport($this->object, 'xls', $question_ids);
1226 $qpl_exp->buildExportFile();
1227 $this->ctrl->redirectByClass("ilquestionpoolexportgui", "");
1228 }
1229 }
1230
1235 {
1236 include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1237 $q_gui =& assQuestionGUI::_getQuestionGUI("", $_GET["q_id"]);
1238 $this->ctrl->redirectByClass(get_class($q_gui), "editQuestion");
1239 }
1240
1241 protected function initImportForm($a_new_type)
1242 {
1243 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1244 $form = new ilPropertyFormGUI();
1245 $form->setTarget("_top");
1246 $form->setFormAction($this->ctrl->getFormAction($this));
1247 $form->setTitle($this->lng->txt("import_qpl"));
1248
1249 include_once("./Services/Form/classes/class.ilFileInputGUI.php");
1250 $fi = new ilFileInputGUI($this->lng->txt("import_file"), "xmldoc");
1251 $fi->setSuffixes(array("zip"));
1252 $fi->setRequired(true);
1253 $form->addItem($fi);
1254
1255 $form->addCommandButton("importFile", $this->lng->txt("import"));
1256 $form->addCommandButton("cancel", $this->lng->txt("cancel"));
1257
1258 return $form;
1259 }
1260
1265 {
1266 $form = $this->initImportForm($_REQUEST["new_type"]);
1267 if($form->checkInput())
1268 {
1269 $this->uploadQplObject();
1270 }
1271
1272 // display form to correct errors
1273 $this->tpl->setContent($form->getHTML());
1274 }
1275
1277 {
1278 global $ilLocator;
1279 switch ($this->ctrl->getCmd())
1280 {
1281 case "create":
1282 case "importFile":
1283 case "cancel":
1284 break;
1285 default:
1286 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $_GET["ref_id"]);
1287 break;
1288 }
1289 if ($_GET["q_id"] > 0)
1290 {
1291 include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1292 $q_gui = assQuestionGUI::_getQuestionGUI("", $_GET["q_id"]);
1293 if($q_gui->object instanceof assQuestion)
1294 {
1295 $q_gui->object->setObjId($this->object->getId());
1296 $title = $q_gui->object->getTitle();
1297 if(!$title)
1298 {
1299 $title = $this->lng->txt('new').': '.assQuestion::_getQuestionTypeName($q_gui->object->getQuestionType());
1300 }
1301 $ilLocator->addItem($title, $this->ctrl->getLinkTargetByClass(get_class($q_gui), "editQuestion"));
1302 }
1303 else
1304 {
1305 // Workaround for context issues: If no object was found, redirect without q_id parameter
1306 $this->ctrl->setParameter($this, 'q_id', '');
1307 $this->ctrl->redirect($this);
1308 }
1309 }
1310 }
1311
1316 {
1317 parent::setTitleAndDescription();
1318 if ($_GET["q_id"] > 0)
1319 {
1320 include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1321 $q_gui = assQuestionGUI::_getQuestionGUI("", $_GET["q_id"]);
1322 if($q_gui->object instanceof assQuestion)
1323 {
1324 $q_gui->object->setObjId($this->object->getId());
1325 $title = $q_gui->object->getTitle();
1326 if(!$title)
1327 {
1328 $title = $this->lng->txt('new').': '.assQuestion::_getQuestionTypeName($q_gui->object->getQuestionType());
1329 }
1330 $this->tpl->setTitle($title);
1331 $this->tpl->setDescription($q_gui->object->getComment());
1332 if($this->object instanceof ilObjectPlugin)
1333 {
1334 $this->tpl->setTitleIcon($this->object->plugin->getImagePath("icon_".$this->object->getType().".svg"), $this->lng->txt("obj_" . $this->object->getType()));
1335 }
1336 else
1337 {
1338 $this->tpl->setTitleIcon(ilObject::_getIcon("", "big", $this->object->getType()));
1339 }
1340 }
1341 else
1342 {
1343 // Workaround for context issues: If no object was found, redirect without q_id parameter
1344 $this->ctrl->setParameter($this, 'q_id', '');
1345 $this->ctrl->redirect($this);
1346 }
1347 }
1348 else
1349 {
1350 $this->tpl->setTitle($this->object->getTitle());
1351 $this->tpl->setDescription($this->object->getLongDescription());
1352 $this->tpl->setTitleIcon(ilObject::_getIcon("", "big", $this->object->getType()));
1353 }
1354 }
1355
1361 function getTabs(&$tabs_gui)
1362 {
1363 global $ilAccess, $ilHelp;
1364
1365 $currentUserHasWriteAccess = $ilAccess->checkAccess("write", "", $this->object->getRefId());
1366
1367 $ilHelp->setScreenIdComponent("qpl");
1368
1369 $next_class = strtolower($this->ctrl->getNextClass());
1370 switch ($next_class)
1371 {
1372 case "":
1373 case "ilpermissiongui":
1374 case "ilmdeditorgui":
1375 case "ilquestionpoolexportgui":
1376 break;
1377
1378 case 'ilobjtaxonomygui':
1379 case 'ilobjquestionpoolsettingsgeneralgui':
1380
1381 if( $currentUserHasWriteAccess )
1382 {
1383 $this->addSettingsSubTabs($tabs_gui);
1384 }
1385
1386 break;
1387
1388 default:
1389 return;
1390 break;
1391 }
1392 // questions
1393 $force_active = false;
1394 $commands = $_POST["cmd"];
1395 if (is_array($commands))
1396 {
1397 foreach ($commands as $key => $value)
1398 {
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)
1405 )
1406 {
1407 $force_active = true;
1408 }
1409 }
1410 }
1411 if (array_key_exists("imagemap_x", $_POST))
1412 {
1413 $force_active = true;
1414 }
1415 if (!$force_active)
1416 {
1417 $force_active = ((strtolower($this->ctrl->getCmdClass()) == strtolower(get_class($this)) || strlen($this->ctrl->getCmdClass()) == 0) &&
1418 $this->ctrl->getCmd() == "")
1419 ? true
1420 : false;
1421 }
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);
1435
1436 if ($ilAccess->checkAccess("visible", "", $this->ref_id))
1437 {
1438 $tabs_gui->addTarget("info_short",
1439 $this->ctrl->getLinkTarget($this, "infoScreen"),
1440 array("infoScreen", "showSummary"));
1441 }
1442
1443 if ($ilAccess->checkAccess("write", "", $_GET['ref_id']))
1444 {
1445 // properties
1446 $tabs_gui->addTarget(
1447 'settings', $this->ctrl->getLinkTargetByClass('ilObjQuestionPoolSettingsGeneralGUI'),
1448 array(), array('ilObjQuestionPoolSettingsGeneralGUI', 'ilObjTaxonomyGUI')
1449 );
1450 }
1451
1452 // print view
1453 $tabs_gui->addTarget("print_view",
1454 $this->ctrl->getLinkTarget($this,'print'),
1455 array("print"),
1456 "", "");
1457
1458 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
1459 {
1460 // meta data
1461 $tabs_gui->addTarget("meta_data",
1462 $this->ctrl->getLinkTargetByClass('ilmdeditorgui','listSection'),
1463 "", "ilmdeditorgui");
1464
1465// $tabs_gui->addTarget("export",
1466// $this->ctrl->getLinkTarget($this,'export'),
1467// array("export", "createExportFile", "confirmDeleteExportFile", "downloadExportFile"),
1468// "", "");
1469 }
1470
1471 if( $currentUserHasWriteAccess )
1472 {
1473 $tabs_gui->addTarget("export",
1474 $this->ctrl->getLinkTargetByClass("ilquestionpoolexportgui", ""),
1475 "", "ilquestionpoolexportgui");
1476 }
1477
1478 if ($ilAccess->checkAccess("edit_permission", "", $this->object->getRefId()))
1479 {
1480 $tabs_gui->addTarget("perm_settings",
1481 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
1482 }
1483 }
1484
1485 private function addSettingsSubTabs(ilTabsGUI $tabs)
1486 {
1487 $tabs->addSubTabTarget(
1488 'qpl_settings_subtab_general',
1489 $this->ctrl->getLinkTargetByClass('ilObjQuestionPoolSettingsGeneralGUI'),
1490 '', 'ilObjQuestionPoolSettingsGeneralGUI'
1491 );
1492
1493 $tabs->addSubTabTarget(
1494 'qpl_settings_subtab_taxonomies',
1495 $this->ctrl->getLinkTargetByClass('ilObjTaxonomyGUI', 'editAOTaxonomySettings'),
1496 '', 'ilObjTaxonomyGUI'
1497 );
1498 }
1499
1506 {
1507 $this->ctrl->setCmd("showSummary");
1508 $this->ctrl->setCmdClass("ilinfoscreengui");
1509 $this->infoScreenForward();
1510 }
1511
1516 {
1517 global $ilErr, $ilAccess;
1518
1519 if(!$ilAccess->checkAccess("visible", "", $this->ref_id))
1520 {
1521 $ilErr->raiseError($this->lng->txt("msg_no_perm_read"));
1522 }
1523
1524 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1525 $info = new ilInfoScreenGUI($this);
1526 $info->enablePrivateNotes();
1527
1528 // standard meta data
1529 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
1530
1531 $this->ctrl->forwardCommand($info);
1532 }
1533
1542 public static function _goto($a_target)
1543 {
1544 global $ilAccess, $ilErr, $lng;
1545
1546 if ($ilAccess->checkAccess("write", "", $a_target))
1547 {
1548 $_GET["baseClass"] = "ilObjQuestionPoolGUI";
1549 $_GET["cmd"] = "questions";
1550 $_GET["ref_id"] = $a_target;
1551 include_once("ilias.php");
1552 exit;
1553 }
1554 else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
1555 {
1556 ilUtil::sendInfo(sprintf($lng->txt("msg_no_perm_read_item"),
1559 }
1560 $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
1561 }
1562
1571 private function buildQuestionBrowserTableGUI($taxIds)
1572 {
1573 global $rbacsystem, $ilDB, $lng, $ilPluginAdmin;
1574
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']));
1578
1579 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
1580 $questionList = new ilAssQuestionList($ilDB, $lng, $ilPluginAdmin, $this->object->getId());
1581
1582 foreach ($table_gui->getFilterItems() as $item)
1583 {
1584 if( substr($item->getPostVar(), 0, strlen('tax_')) == 'tax_' )
1585 {
1586 $v = $item->getValue();
1587
1588 if( is_array($v) && count($v) && !(int)$v[0] )
1589 {
1590 continue;
1591 }
1592
1593 $taxId = substr($item->getPostVar(), strlen('tax_'));
1594 $questionList->addTaxonomyFilter($taxId, $item->getValue());
1595 }
1596 elseif( $item->getValue() !== false )
1597 {
1598 $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
1599 }
1600 }
1601
1602 if( $this->object->isNavTaxonomyActive() && (int)$_GET['tax_node'] )
1603 {
1604 $questionList->addTaxonomyFilter( $this->object->getNavTaxonomyId(), array((int)$_GET['tax_node']) );
1605 }
1606
1607 $questionList->load();
1608 $data = $questionList->getQuestionDataArray();
1609
1610 $table_gui->setData($data);
1611
1612 return $table_gui;
1613 }
1614
1615
1616
1617} // END class.ilObjQuestionPoolGUI
1618?>
$result
print $file
$filename
Definition: buildRTE.php:89
$_GET["client_id"]
const IL_COMP_MODULE
const IL_MO_VERIFY_QTI
const IL_MO_PARSE_QTI
& _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
Abstract basic class which is to be extended by the concrete assessment question type classes.
const ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT
constant for additional content editing mode "default"
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
const ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT
constant for additional content editing mode "pageobject"
Question page GUI class.
Question page object.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Content Object Parser.
This class represents a file property in a property form.
This class represents a hidden form property in a property form.
Class ilInfoScreenGUI.
Class ilLocalUnitConfigurationGUI.
static isAdditionalQuestionContentEditingModePageObjectEnabled()
returns the fact wether content editing with ilias page editor is enabled for questions or not
Class ilObjFile.
Class ilObjQuestionPoolGUI.
ilObjQuestionPoolGUI()
Constructor @access public.
uploadQplObject($questions_only=false)
imports question(s) into the questionpool
confirmDeleteQuestionsObject()
delete questions
afterSave(ilObject $a_new_object)
save object @access public
updateObject()
updates object entry in object_data
download_paragraphObject()
download source code paragraph
deleteQuestionsObject()
delete questions confirmation screen
& createQuestionForTestObject()
create new question
filterObject()
set question list filter
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
questionsObject()
list questions of question pool
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
importVerifiedFileObject()
imports question(s) into the questionpool (after verification)
uploadObject()
imports question(s) into the questionpool
moveObject()
mark one or more question objects for moving
& createQuestionObject()
create new question
pasteObject()
paste questios from the clipboard into the question pool
initImportForm($a_new_type)
Init object import form.
importFileObject()
form for new questionpool object import
cancelDeleteQuestionsObject()
Cancel question deletion.
& editQuestionForTestObject()
edit question
setTitleAndDescription()
called by prepare output
infoScreenForward()
show information screen
static _goto($a_target)
Redirect script to call a test with the question pool reference id.
copyObject()
copy one or more question objects to the clipboard
importQuestionsObject(ilPropertyFormGUI $form=null)
display the import form to import questions into the questionpool
fullscreenObject()
show fullscreen view
getTabs(&$tabs_gui)
adds tabs to tab gui object
_getImportDirectory()
get import directory of lm
static _createImportDirectory()
creates data directory for import files (data_dir/qpl_data/qpl_<id>/import, depending on data directo...
_setImportDirectory($a_import_dir=null)
set import directory
getContentStylePath($a_style_id)
get content style path
getSyntaxStylePath()
get syntax style path
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
_setImportDirectory($a_import_dir=null)
set import directory
GUI class for the workflow of copying objects.
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObjectGUI Basic methods of all Output classes.
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor @access public.
prepareOutput()
prepare output
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
getCreationMode()
get creation mode
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
getRefId()
get reference id @access public
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
This class represents a property form user interface.
Export User Interface Class.
Export class for questionpools.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
Tabs GUI.
addSubTabTarget($a_text, $a_link, $a_cmd="", $a_cmdClass="", $a_frame="", $a_activate=false, $a_dir_text=false)
DEPRECATED.
Taxonomy explorer GUI class.
Class ilUnitConfigurationRepository.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static redirect($a_script)
http redirect to other script
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
$_POST['username']
Definition: cron.php:12
$GLOBALS['ct_recipient']
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
global $ilCtrl
Definition: ilias.php:18
const CLOZE_TEST_IDENTIFIER
Question identifier constants.
const IMAGEMAP_QUESTION_IDENTIFIER
const SINGLE_CHOICE_QUESTION_IDENTIFIER
const TEXTSUBSET_QUESTION_IDENTIFIER
const NUMERIC_QUESTION_IDENTIFIER
const JAVAAPPLET_QUESTION_IDENTIFIER
const TEXT_QUESTION_IDENTIFIER
const KPRIM_CHOICE_QUESTION_IDENTIFIER
const MATCHING_QUESTION_IDENTIFIER
const MULTIPLE_CHOICE_QUESTION_IDENTIFIER
const ORDERING_QUESTION_IDENTIFIER
exit
Definition: login.php:54
$cmd
Definition: sahs_server.php:35
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
global $ilDB
if(!is_array($argv)) $options
global $ilUser
Definition: imgupload.php:15