ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilObjQuestionPoolGUI.php
Go to the documentation of this file.
1 <?php
2 
19 require_once './Modules/Test/classes/inc.AssessmentConstants.php';
20 
21 use ILIAS\Refinery\Random\Group as RandomGroup;
22 
47 {
48  public ?ilObject $object;
50 
55  public function __construct()
56  {
57  global $DIC;
58  $lng = $DIC['lng'];
59  $ilCtrl = $DIC['ilCtrl'];
60  $rbacsystem = $DIC['rbacsystem'];
61  $lng->loadLanguageModule("assessment");
62  $this->type = "qpl";
63  $this->error = $DIC['ilErr'];
64  $this->ctrl = &$ilCtrl;
65 
66  $this->ctrl->saveParameter($this, array(
67  "ref_id", "test_ref_id", "calling_test", "test_express_mode", "q_id", 'tax_node', 'calling_consumer', 'consumer_context'
68  ));
69  $this->ctrl->saveParameter($this, "calling_consumer");
70  $this->ctrl->saveParameterByClass('ilAssQuestionPageGUI', 'calling_consumer');
71  $this->ctrl->saveParameterByClass('ilAssQuestionPageGUI', 'consumer_context');
72  $this->ctrl->saveParameterByClass('ilobjquestionpoolgui', 'calling_consumer');
73  $this->ctrl->saveParameterByClass('ilobjquestionpoolgui', 'consumer_context');
74  $this->qplrequest = $DIC->testQuestionPool()->internal()->request();
75 
76  parent::__construct("", $this->qplrequest->raw("ref_id"), true, false);
77  }
78 
79 
80  protected function getQueryParamString(string $param): ?string
81  {
82  if (!$this->request_wrapper->has($param)) {
83  return null;
84  }
85  $trafo = $this->refinery->byTrying([
86  $this->refinery->kindlyTo()->null(),
87  $this->refinery->kindlyTo()->string()
88  ]);
89  return $this->request_wrapper->retrieve($param, $trafo);
90  }
91 
92  protected function getQueryParamInt(string $param): ?int
93  {
94  if (!$this->request_wrapper->has($param)) {
95  return null;
96  }
97  $trafo = $this->refinery->byTrying([
98  $this->refinery->kindlyTo()->null(),
99  $this->refinery->kindlyTo()->int()
100  ]);
101  return $this->request_wrapper->retrieve($param, $trafo);
102  }
103 
116  public function executeCommand(): void
117  {
118  global $DIC;
119  $ilUser = $DIC['ilUser'];
120  $ilLocator = $DIC['ilLocator'];
121  $ilAccess = $DIC['ilAccess'];
122  $ilNavigationHistory = $DIC['ilNavigationHistory'];
123  $tpl = $DIC['tpl'];
124  $ilCtrl = $DIC['ilCtrl'];
125  $ilErr = $DIC['ilErr'];
126  $ilTabs = $DIC['ilTabs'];
127  $lng = $DIC['lng'];
128  $ilDB = $DIC['ilDB'];
129  $component_repository = $DIC['component.repository'];
130  $ilias = $DIC['ilias'];
131  $randomGroup = $DIC->refinery()->random();
132 
133  $writeAccess = $ilAccess->checkAccess("write", "", $this->qplrequest->getRefId());
134 
135  if ((!$ilAccess->checkAccess("read", "", $this->qplrequest->getRefId()))
136  && (!$ilAccess->checkAccess("visible", "", $this->qplrequest->getRefId()))) {
137  global $DIC;
138  $ilias = $DIC['ilias'];
139  $ilias->raiseError($this->lng->txt("permission_denied"), $ilias->error_obj->MESSAGE);
140  }
141 
142  // add entry to navigation history
143  if (!$this->getCreationMode() &&
144  $ilAccess->checkAccess("read", "", $this->qplrequest->getRefId())) {
145  if ('qpl' == $this->object->getType()) {
146  $ilNavigationHistory->addItem(
147  $this->qplrequest->getRefId(),
148  "ilias.php?baseClass=ilObjQuestionPoolGUI&cmd=questions&ref_id=" . $this->qplrequest->getRefId(),
149  "qpl"
150  );
151  }
152  }
153 
154  $cmd = $this->ctrl->getCmd("questions");
155  $next_class = $this->ctrl->getNextClass($this);
156  $q_id = $this->getQueryParamInt('q_id');
157 
158  if (in_array($next_class, array('', 'ilobjquestionpoolgui')) && $cmd == 'questions') {
159  $q_id = -1;
160  }
161 
162  $this->prepareOutput();
163 
164  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
165 
166  $q_type = '';
167  if (!(in_array($next_class, array('', 'ilobjquestionpoolgui')) && $cmd == 'questions') && $q_id < 1) {
168  $q_type = $this->qplrequest->raw("sel_question_types");
169  }
170  if ($cmd != "createQuestion" && $cmd != "createQuestionForTest"
171  && $next_class != "ilassquestionpagegui") {
172  if (($this->qplrequest->raw("test_ref_id") != "") or ($this->qplrequest->raw("calling_test"))) {
173  $ref_id = $this->qplrequest->raw("test_ref_id");
174  if (!$ref_id) {
175  $ref_id = $this->qplrequest->raw("calling_test");
176  }
177  }
178  }
179  switch ($next_class) {
180  case "ilcommonactiondispatchergui":
182  $this->ctrl->forwardCommand($gui);
183  break;
184 
185  case 'ilobjectmetadatagui':
186  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
187  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
188  }
189  $md_gui = new ilObjectMetaDataGUI($this->object);
190  $this->ctrl->forwardCommand($md_gui);
191  break;
192 
193  case 'ilassquestionpreviewgui':
194  if (!$ilAccess->checkAccess('read', '', $this->object->getRefId())) {
195  $this->redirectAfterMissingWrite();
196  }
197 
198  $this->ctrl->saveParameter($this, "q_id");
199  $gui = new ilAssQuestionPreviewGUI(
200  $this->ctrl,
201  $this->rbac_system,
202  $this->tabs_gui,
203  $this->tpl,
204  $this->lng,
205  $ilDB,
206  $ilUser,
207  $randomGroup,
208  $this->ref_id,
209  $DIC->rbac()
210  );
211 
212  $gui->initQuestion((int) $this->qplrequest->raw('q_id'), $this->object->getId());
213  $gui->initPreviewSettings($this->object->getRefId());
214  $gui->initPreviewSession($ilUser->getId(), $this->fetchAuthoringQuestionIdParamater());
215  $gui->initHintTracking();
216 
217  global $DIC;
218  $ilHelp = $DIC['ilHelp'];
219  $ilHelp->setScreenIdComponent("qpl");
220 
221  $this->ctrl->forwardCommand($gui);
222  break;
223 
224  case "ilassquestionpagegui":
225  if ($cmd == 'finishEditing') {
226  $this->ctrl->redirectByClass('ilassquestionpreviewgui', 'show');
227  break;
228  }
229  if ($cmd === 'edit' && !$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
230  $this->redirectAfterMissingWrite();
231  }
232  $this->tpl->setCurrentBlock("ContentStyle");
233  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
234  $this->tpl->parseCurrentBlock();
235 
236  // syntax style
237  $this->tpl->setCurrentBlock("SyntaxStyle");
238  $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
239  $this->tpl->parseCurrentBlock();
241  $q_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PREVIEW);
242  $q_gui->setQuestionTabs();
243  $q_gui->outAdditionalOutput();
244  $q_gui->object->setObjId($this->object->getId());
245 
246  $q_gui->setTargetGuiClass(null);
247  $q_gui->setQuestionActionCmd('');
248 
249  if ($this->object->getType() == 'qpl') {
250  $q_gui->addHeaderAction();
251  }
252 
253  $question = $q_gui->object;
254 
255  if ($question->isInActiveTest()) {
256  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("question_is_part_of_running_test"), true);
257  $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW);
258  }
259 
260  $this->ctrl->saveParameter($this, "q_id");
261  $this->lng->loadLanguageModule("content");
262  $this->ctrl->setReturnByClass("ilAssQuestionPageGUI", "view");
263  $this->ctrl->setReturn($this, "questions");
264  $page_gui = new ilAssQuestionPageGUI($this->qplrequest->getQuestionId());
265  $page_gui->obj->addUpdateListener(
266  $question,
267  'updateTimestamp'
268  );
269  $page_gui->setEditPreview(true);
270  $page_gui->setEnabledTabs(false);
271  if (strlen($this->ctrl->getCmd()) == 0 && !isset($_POST["editImagemapForward_x"])) { // workaround for page edit imagemaps, keep in mind
272  $this->ctrl->setCmdClass(get_class($page_gui));
273  $this->ctrl->setCmd("preview");
274  }
275  $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(true)));
276  $page_gui->setTemplateTargetVar("ADM_CONTENT");
277  $page_gui->setOutputMode("edit");
278  $page_gui->setHeader($question->getTitleForHTMLOutput());
279  $page_gui->setPresentationTitle($question->getTitleForHTMLOutput());
280  $ret = $this->ctrl->forwardCommand($page_gui);
281  if ($ret != "") {
282  $tpl->setContent($ret);
283  }
284  break;
285 
286  case 'ilpermissiongui':
287  $perm_gui = new ilPermissionGUI($this);
288  $this->ctrl->forwardCommand($perm_gui);
289  break;
290 
291  case 'ilobjectcopygui':
292  $cp = new ilObjectCopyGUI($this);
293  $cp->setType('qpl');
294  $this->ctrl->forwardCommand($cp);
295  break;
296 
297  case "ilquestionpoolexportgui":
298  $exp_gui = new ilQuestionPoolExportGUI($this);
299  $exp_gui->addFormat('xml', $this->lng->txt('qpl_export_xml'));
300  $exp_gui->addFormat('xls', $this->lng->txt('qpl_export_excel'), $this, 'createExportExcel');
301  $ret = $this->ctrl->forwardCommand($exp_gui);
302  break;
303 
304  case "ilinfoscreengui":
305  $this->infoScreenForward();
306  break;
307 
308  case 'ilassquestionhintsgui':
309  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
310  $this->redirectAfterMissingWrite();
311  }
312  // set return target
313  $this->ctrl->setReturn($this, "questions");
314  $questionGUI = assQuestionGUI::_getQuestionGUI($q_type ?? '', $this->fetchAuthoringQuestionIdParamater());
315  $questionGUI->object->setObjId($this->object->getId());
316  $questionGUI->setQuestionTabs();
317 
318  if ($questionGUI->object->isInActiveTest()) {
319  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("question_is_part_of_running_test"), true);
320  $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW);
321  }
322 
323  $ilHelp = $DIC['ilHelp'];
324  $ilHelp->setScreenIdComponent("qpl");
325 
326  if ($this->object->getType() == 'qpl' && $writeAccess) {
327  $questionGUI->addHeaderAction();
328  }
329  $gui = new ilAssQuestionHintsGUI($questionGUI);
330 
331  $gui->setEditingEnabled(
332  $DIC->access()->checkAccess('write', '', $this->object->getRefId())
333  );
334 
335  $ilCtrl->forwardCommand($gui);
336 
337  break;
338 
339  case 'illocalunitconfigurationgui':
340  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
341  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
342  }
343  $questionGUI = assQuestionGUI::_getQuestionGUI($q_type, $this->fetchAuthoringQuestionIdParamater());
344  $questionGUI->object->setObjId($this->object->getId());
345  $questionGUI->setQuestionTabs();
346 
347  $this->ctrl->setReturn($this, 'questions');
348  $gui = new ilLocalUnitConfigurationGUI(
349  new ilUnitConfigurationRepository($this->qplrequest->getQuestionId())
350  );
351  $ilCtrl->forwardCommand($gui);
352  break;
353 
354  case 'ilassquestionfeedbackeditinggui':
355  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
356  $this->redirectAfterMissingWrite();
357  }
358 
359  // set return target
360  $this->ctrl->setReturn($this, "questions");
361  $questionGUI = assQuestionGUI::_getQuestionGUI($q_type, $this->fetchAuthoringQuestionIdParamater());
362  $questionGUI->object->setObjId($this->object->getId());
363  $questionGUI->setQuestionTabs();
364 
365  if ($questionGUI->object->isInActiveTest()) {
366  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("question_is_part_of_running_test"), true);
367  $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW);
368  }
369 
370  $ilHelp = $DIC['ilHelp'];
371  $ilHelp->setScreenIdComponent("qpl");
372 
373  if ($this->object->getType() == 'qpl' && $writeAccess) {
374  $questionGUI->addHeaderAction();
375  }
376  $gui = new ilAssQuestionFeedbackEditingGUI($questionGUI, $ilCtrl, $ilAccess, $tpl, $ilTabs, $lng);
377  $ilCtrl->forwardCommand($gui);
378 
379  break;
380 
381  case 'ilobjquestionpoolsettingsgeneralgui':
382  $gui = new ilObjQuestionPoolSettingsGeneralGUI($ilCtrl, $ilAccess, $lng, $tpl, $ilTabs, $this);
383  $this->ctrl->forwardCommand($gui);
384  break;
385 
386  case "ilobjtaxonomygui":
387  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
388  $this->redirectAfterMissingWrite();
389  }
391  $obj = $this->object;
393  $obj,
394  $ilDB,
395  $this->refinery,
396  $component_repository,
397  $ilCtrl,
398  $ilTabs,
399  $lng
400  );
401 
402  $forwarder->forward();
403 
404  break;
405 
406  case 'ilquestionpoolskilladministrationgui':
407 
409  $obj = $this->object;
411  $ilias,
412  $ilCtrl,
413  $this->refinery,
414  $ilAccess,
415  $ilTabs,
416  $tpl,
417  $lng,
418  $ilDB,
419  $component_repository,
420  $obj,
421  $this->ref_id
422  );
423 
424  $this->ctrl->forwardCommand($gui);
425 
426  break;
427 
428  case 'ilquestionbrowsertablegui':
429  $this->ctrl->forwardCommand($this->buildQuestionBrowserTableGUI($taxIds = array())); // no tax ids required
430  break;
431 
432  case "ilobjquestionpoolgui":
433  case "":
434 
435  if ($cmd == 'questions') {
436  $this->ctrl->setParameter($this, 'q_id', '');
437  }
438 
439  $cmd .= "Object";
440  $ret = $this->$cmd();
441  break;
442 
443  default:
444  if (in_array($cmd, ['editQuestion', 'save', 'suggestedsolution']) && !$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
445  $this->redirectAfterMissingWrite();
446  }
447 
448  if ($cmd === 'assessment' &&
449  $this->object->getType() === 'tst' &&
450  !$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
451  $this->redirectAfterMissingWrite();
452  }
453 
454  $this->ctrl->setReturn($this, "questions");
455 
456  $questionGUI = assQuestionGUI::_getQuestionGUI($q_type, $this->fetchAuthoringQuestionIdParamater());
457  $questionGUI->setEditContext(assQuestionGUI::EDIT_CONTEXT_AUTHORING);
458  $questionGUI->object->setObjId($this->object->getId());
459 
460  if (in_array($cmd, ['editQuestion', 'save', 'suggestedsolution']) && $questionGUI->object->isInActiveTest()) {
461  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("question_is_part_of_running_test"), true);
462  $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW);
463  }
464 
465  if ($this->object->getType() == 'qpl') {
466  $questionGUI->setTaxonomyIds($this->object->getTaxonomyIds());
467 
468  if ($writeAccess) {
469  $questionGUI->addHeaderAction();
470  }
471  }
472  $questionGUI->setQuestionTabs();
473 
474  $ilHelp = $DIC['ilHelp'];
475  $ilHelp->setScreenIdComponent("qpl");
476  $ret = $this->ctrl->forwardCommand($questionGUI);
477  break;
478  }
479 
480  if (!(strtolower($this->qplrequest->raw("baseClass")) == "iladministrationgui"
481  || strtolower($this->qplrequest->raw('baseClass')) == 'ilrepositorygui')
482  && $this->getCreationMode() != true) {
483  $this->tpl->printToStdout();
484  }
485  }
486 
487 
488  protected function redirectAfterMissingWrite()
489  {
490  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_permission"), true);
491  $target_class = get_class($this->object) . "GUI";
492  $this->ctrl->setParameterByClass($target_class, 'ref_id', $this->ref_id);
493  $this->ctrl->redirectByClass($target_class);
494  }
495 
500  protected function exportObject(): void
501  {
502  global $DIC; /* @var ILIAS\DI\Container $DIC */
503  $DIC->ctrl()->redirectByClass('ilQuestionPoolExportGUI');
504  }
505 
509  public function downloadFileObject(): void
510  {
511  $file = explode("_", $this->qplrequest->raw("file_id"));
512  $fileObj = new ilObjFile($file[count($file) - 1], false);
513  $fileObj->sendFile();
514  exit;
515  }
516 
520  public function fullscreenObject(): void
521  {
522  $page_gui = new ilAssQuestionPageGUI($this->qplrequest->raw("pg_id"));
523  $page_gui->showMediaFullscreen();
524  }
525 
526 
530  public function filterObject(): void
531  {
532  $this->questionsObject();
533  }
534 
538  public function resetFilterObject(): void
539  {
540  $_POST["filter_text"] = "";
541  $_POST["sel_filter_type"] = "";
542  $this->questionsObject();
543  }
544 
548  public function download_paragraphObject(): void
549  {
550  $pg_obj = new ilAssQuestionPage($this->qplrequest->raw("pg_id"));
551  $pg_obj->send_paragraph($this->qplrequest->raw("par_id"), $this->qplrequest->raw("downloadtitle"));
552  exit;
553  }
554 
558  public function uploadQplObject($questions_only = false)
559  {
560 
561  $this->ctrl->setParameter($this, 'new_type', $this->qplrequest->raw('new_type'));
562  if (!isset($_FILES['xmldoc']) || !isset($_FILES['xmldoc']['error']) || $_FILES['xmldoc']['error'] > UPLOAD_ERR_OK) {
563  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("error_upload"), true);
564  if (!$questions_only) {
565  $this->ctrl->redirect($this, 'create');
566  }
567  return false;
568  }
570 
571  $xml_file = '';
572  $qti_file = '';
573  $subdir = '';
574 
575  global $DIC; /* @var ILIAS\DI\Container $DIC */
576  // copy uploaded file to import directory
577  $file = pathinfo($_FILES["xmldoc"]["name"]);
578  $full_path = $basedir . "/" . $_FILES["xmldoc"]["name"];
579 
580  if (strpos($file['filename'], 'qpl') === false
581  && strpos($file['filename'], 'qti') === false) {
582  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('import_file_not_valid'), true);
583  $cmd = $this->ctrl->getCmd() === 'upload' ? 'importQuestions' : 'create';
584  $this->ctrl->redirect($this, $cmd);
585  return;
586  }
587 
588 
589  $DIC['ilLog']->write(__METHOD__ . ": full path " . $full_path);
590  try {
591  ilFileUtils::moveUploadedFile($_FILES["xmldoc"]["tmp_name"], $_FILES["xmldoc"]["name"], $full_path);
592  } catch (Error $e) {
593  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('import_file_not_valid'), true);
594  $cmd = $this->ctrl->getCmd() === 'upload' ? 'importQuestions' : 'create';
595  $this->ctrl->redirect($this, $cmd);
596  return;
597  }
598  $DIC['ilLog']->write(__METHOD__ . ": full path " . $full_path);
599  if (strcmp($_FILES["xmldoc"]["type"], "text/xml") == 0) {
600  $qti_file = $full_path;
602  } else {
603  // unzip file
604  ilFileUtils::unzip($full_path);
605 
606  // determine filenames of xml files
607  $subdir = basename($file["basename"], "." . $file["extension"]);
609  $xml_file = ilObjQuestionPool::_getImportDirectory() . '/' . $subdir . '/' . $subdir . ".xml";
610  $qti_file = ilObjQuestionPool::_getImportDirectory() . '/' . $subdir . '/' . str_replace("qpl", "qti", $subdir) . ".xml";
611  }
612  if (!file_exists($qti_file)) {
613  ilFileUtils::delDir($basedir);
614  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('cannot_find_xml'), true);
615  $cmd = $this->ctrl->getCmd() === 'upload' ? 'importQuestions' : 'create';
616  $this->ctrl->redirect($this, $cmd);
617  return false;
618  }
619  $qtiParser = new ilQTIParser($qti_file, ilQTIParser::IL_MO_VERIFY_QTI, 0, "");
620  $qtiParser->startParsing();
621  $founditems = &$qtiParser->getFoundItems();
622  if (count($founditems) == 0) {
623  // nothing found
624 
625  // delete import directory
626  ilFileUtils::delDir($basedir);
627 
628  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("qpl_import_no_items"), true);
629  if (!$questions_only) {
630  $this->ctrl->redirect($this, 'create');
631  }
632  return false;
633  }
634 
635  $complete = 0;
636  $incomplete = 0;
637  foreach ($founditems as $item) {
638  if (strlen($item["type"])) {
639  $complete++;
640  } else {
641  $incomplete++;
642  }
643  }
644 
645  if ($complete == 0) {
646  // delete import directory
647  ilFileUtils::delDir($basedir);
648 
649  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("qpl_import_non_ilias_files"), true);
650  if (!$questions_only) {
651  $this->ctrl->redirect($this, 'create');
652  }
653  return false;
654  }
655 
656  ilSession::set("qpl_import_xml_file", $xml_file);
657  ilSession::set("qpl_import_qti_file", $qti_file);
658  ilSession::set("qpl_import_subdir", $subdir);
659 
660  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.qpl_import_verification.html", "Modules/TestQuestionPool");
661  $table = new ilQuestionPoolImportVerificationTableGUI($this, 'uploadQpl');
662  $rows = array();
663 
664  foreach ($founditems as $item) {
665  $row = array(
666  'title' => $item['title'],
667  'ident' => $item['ident'],
668  );
669  switch ($item["type"]) {
671  $type = $this->lng->txt("assClozeTest");
672  break;
674  $type = $this->lng->txt("assImagemapQuestion");
675  break;
677  $type = $this->lng->txt("assMatchingQuestion");
678  break;
680  $type = $this->lng->txt("assMultipleChoice");
681  break;
683  $type = $this->lng->txt("assKprimChoice");
684  break;
686  $type = $this->lng->txt("assLongMenu");
687  break;
689  $type = $this->lng->txt("assSingleChoice");
690  break;
692  $type = $this->lng->txt("assOrderingQuestion");
693  break;
695  $type = $this->lng->txt("assTextQuestion");
696  break;
698  $type = $this->lng->txt("assNumeric");
699  break;
701  $type = $this->lng->txt("assTextSubset");
702  break;
703  default:
704  $type = $this->lng->txt($item["type"]);
705  break;
706  }
707 
708  if (strcmp($type, "-" . $item["type"] . "-") == 0) {
709  global $DIC;
710  $component_factory = $DIC['component.factory'];
711  $component_repository = $DIC["component.repository"];
712  $plugins = $component_repository->getPluginSlotById("qst")->getActivePlugins();
713  foreach ($component_factory->getActivePluginsInSlot("qst") as $pl) {
714  if (strcmp($pl->getQuestionType(), $item["type"]) == 0) {
715  $type = $pl->getQuestionTypeTranslation();
716  }
717  }
718  }
719 
720  $row['type'] = $type;
721 
722  $rows[] = $row;
723  }
724  $table->setData($rows);
725 
726  if (is_file($xml_file)
727  && !$questions_only) {
728  $this->tpl->setCurrentBlock("import_qpl");
729  // read file into a string
730  $fh = @fopen($xml_file, "r");
731  $xml = @fread($fh, filesize($xml_file));
732  @fclose($fh);
733  if (preg_match("/<ContentObject.*?MetaData.*?General.*?Title[^>]*?>([^<]*?)</", $xml, $matches)) {
734  $this->tpl->setVariable("VALUE_NEW_QUESTIONPOOL", $matches[1]);
735  }
736 
737  $this->tpl->setVariable("TEXT_CREATE_NEW_QUESTIONPOOL", $this->lng->txt("qpl_import_create_new_qpl"));
738  $this->tpl->parseCurrentBlock();
739  }
740 
741  $this->tpl->setCurrentBlock("adm_content");
742  $this->tpl->setVariable("FOUND_QUESTIONS_INTRODUCTION", $this->lng->txt("qpl_import_verify_found_questions"));
743  if ($questions_only) {
744  $this->tpl->setVariable("VERIFICATION_HEADING", $this->lng->txt("import_questions_into_qpl"));
745  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
746  } else {
747  $this->tpl->setVariable("VERIFICATION_HEADING", $this->lng->txt("import_qpl"));
748 
749  $this->ctrl->setParameter($this, "new_type", $this->type);
750  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
751  }
752 
753  $value_questions_only = 0;
754  if ($questions_only) {
755  $value_questions_only = 1;
756  }
757  $this->tpl->setVariable("VALUE_QUESTIONS_ONLY", $value_questions_only);
758  $this->tpl->setVariable("VERIFICATION_TABLE", $table->getHtml());
759  $this->tpl->setVariable("VERIFICATION_FORM_NAME", $table->getFormName());
760 
761  $this->tpl->parseCurrentBlock();
762 
763  return true;
764  }
765 
769  public function importVerifiedFileObject(): void
770  {
771  if (!$this->checkPermissionBool('create', '', $this->qplrequest->raw('new_type'))) {
772  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
773  $this->ctrl->redirect($this, 'create');
774  return;
775  }
776  $title = '';
777  $description = null;
778  if ($this->qplrequest->int('questions_only') === 1) {
779  $newObj = $this->object;
780  $title = $this->object->getTitle();
781  $description = $this->object->getDescription();
782  } else {
783  $newObj = new ilObjQuestionPool(0, true);
784  $newObj->setType($this->qplrequest->raw("new_type"));
785  $newObj->setTitle("dummy");
786  $newObj->setDescription("questionpool import");
787  $newObj->create(true);
788  $newObj->createReference();
789  $newObj->putInTree($this->qplrequest->getRefId());
790  $newObj->setPermissions($this->qplrequest->getRefId());
791 
792  $title = $this->qplrequest->raw('qpl_new');
793  }
794 
795  if (is_string(ilSession::get("qpl_import_dir")) && is_string(ilSession::get("qpl_import_subdir")) && is_file(
796  ilSession::get("qpl_import_dir") . '/' . ilSession::get("qpl_import_subdir") . "/manifest.xml"
797  )) {
798  ilSession::set("qpl_import_idents", $this->qplrequest->raw("ident"));
799 
800  $fileName = ilSession::get("qpl_import_subdir") . '.zip';
801  $fullPath = ilSession::get("qpl_import_dir") . '/' . $fileName;
802  $imp = new ilImport($this->qplrequest->getRefId());
803  $map = $imp->getMapping();
804  $map->addMapping("Modules/TestQuestionPool", "qpl", "new_id", $newObj->getId());
805  $imp->importObject($newObj, $fullPath, $fileName, "qpl", "Modules/TestQuestionPool", true);
806  } else {
807  $qtiParser = new ilQTIParser(ilSession::get("qpl_import_qti_file"), ilQTIParser::IL_MO_PARSE_QTI, $newObj->getId(), $this->qplrequest->raw("ident"));
808  $qtiParser->startParsing();
809  // import page data
810  if (strlen(ilSession::get("qpl_import_xml_file"))) {
811  $contParser = new ilQuestionPageParser($newObj, ilSession::get("qpl_import_xml_file"), ilSession::get("qpl_import_subdir"));
812  $contParser->setQuestionMapping($qtiParser->getImportMapping());
813  $contParser->startParsing();
814  // #20494
815  $newObj->fromXML(ilSession::get("qpl_import_xml_file"));
816  }
817 
818  // set another question pool name (if possible)
819  if ($title !== '') {
820  $newObj->setTitle($title);
821  }
822 
823  if ($description !== null) {
824  $newObj->setDescription($description);
825  }
826 
827  $newObj->update();
828  $newObj->saveToDb();
829  }
831 
832  if ($_POST["questions_only"] == 1) {
833  $this->ctrl->redirect($this, "questions");
834  } else {
835  $this->tpl->setOnScreenMessage('success', $this->lng->txt("object_imported"), true);
836  ilUtil::redirect("ilias.php?ref_id=" . $newObj->getRefId() .
837  "&baseClass=ilObjQuestionPoolGUI");
838  }
839  }
840 
841  public function cancelImportObject(): void
842  {
843  if ($_POST["questions_only"] == 1) {
844  $this->ctrl->redirect($this, "questions");
845  } else {
846  $this->ctrl->redirect($this, "cancel");
847  }
848  }
849 
853  public function uploadObject(): void
854  {
855  $upload_valid = true;
856  $form = $this->getImportQuestionsForm();
857  if ($form->checkInput()) {
858  if (!$this->uploadQplObject(true)) {
859  $form->setValuesByPost();
860  $this->importQuestionsObject($form);
861  }
862  } else {
863  $form->setValuesByPost();
864  $this->importQuestionsObject($form);
865  }
866  }
867 
871  public function importQuestionsObject(ilPropertyFormGUI $form = null): void
872  {
873  if (!$form instanceof ilPropertyFormGUI) {
874  $form = $this->getImportQuestionsForm();
875  }
876 
877  $this->tpl->setContent($form->getHtml());
878  }
879 
884  {
885  $form = new ilPropertyFormGUI();
886  $form->setTitle($this->lng->txt('import_question'));
887  $form->setFormAction($this->ctrl->getFormAction($this, 'upload'));
888 
889  $file = new ilFileInputGUI($this->lng->txt('select_file'), 'xmldoc');
890  $file->setRequired(true);
891  $form->addItem($file);
892 
893  $form->addCommandButton('upload', $this->lng->txt('upload'));
894  $form->addCommandButton('questions', $this->lng->txt('cancel'));
895 
896  return $form;
897  }
898 
902  public function createQuestionObject(): void
903  {
905  $addContEditMode = $_POST['add_quest_cont_edit_mode'];
906  } else {
908  }
909  $q_gui = assQuestionGUI::_getQuestionGUI($_POST["sel_question_types"]);
910  $q_gui->object->setObjId($this->object->getId());
911  $q_gui->object->setAdditionalContentEditingMode($addContEditMode);
912  $q_gui->object->createNewQuestion();
913  $this->ctrl->setParameterByClass(get_class($q_gui), "q_id", $q_gui->object->getId());
914  $this->ctrl->setParameterByClass(get_class($q_gui), "sel_question_types", $_POST["sel_question_types"]);
915  $this->ctrl->redirectByClass(get_class($q_gui), "editQuestion");
916  }
917 
921  public function &createQuestionForTestObject(): void
922  {
923  if (!$this->qplrequest->raw('q_id')) {
925  $addContEditMode = $this->qplrequest->raw('add_quest_cont_edit_mode');
926  } else {
928  }
929  $q_gui = assQuestionGUI::_getQuestionGUI($this->qplrequest->raw("sel_question_types"));
930  $q_gui->object->setObjId($this->object->getId());
931  $q_gui->object->setAdditionalContentEditingMode($addContEditMode);
932  $q_gui->object->createNewQuestion();
933 
934  $class = get_class($q_gui);
935  $qId = $q_gui->object->getId();
936  } else {
937  $class = $this->qplrequest->raw("sel_question_types") . 'gui';
938  $qId = $this->qplrequest->raw('q_id');
939  }
940 
941  $this->ctrl->setParameterByClass($class, "q_id", $qId);
942  $this->ctrl->setParameterByClass($class, "sel_question_types", $this->qplrequest->raw("sel_question_types"));
943  $this->ctrl->setParameterByClass($class, "prev_qid", $this->qplrequest->raw("prev_qid"));
944 
945  $this->ctrl->redirectByClass($class, "editQuestion");
946  }
947 
952  public function afterSave(ilObject $new_object): void
953  {
954  // always send a message
955  $this->tpl->setOnScreenMessage('success', $this->lng->txt("object_added"), true);
956 
957  ilUtil::redirect("ilias.php?ref_id=" . $new_object->getRefId() .
958  "&baseClass=ilObjQuestionPoolGUI");
959  }
960 
961  public function questionObject(): void
962  {
963  // @PHP8-CR: With this probably never working and no detectable usages, it would be a candidate for removal...
964  // but it is one of the magic command-methods ($cmd.'Object' - pattern) so I live to leave this in here for now
965  // until it can be further investigated.
966  //echo "<br>ilObjQuestionPoolGUI->questionObject()";
967  $type = $this->qplrequest->raw("sel_question_types");
968  $this->editQuestionForm($type);
969  }
970 
974  public function deleteQuestionsObject(): void
975  {
976  global $DIC;
977  $rbacsystem = $DIC['rbacsystem'];
978 
979  $questionIdsToDelete = $this->qplrequest->isset('q_id') ? (array) $this->qplrequest->raw('q_id') : array();
980  if (0 === count($questionIdsToDelete) && $this->qplrequest->isset('q_id')) {
981  $questionIdsToDelete = array($this->qplrequest->getQuestionId());
982  }
983 
984  $questionIdsToDelete = array_filter(array_map('intval', $questionIdsToDelete));
985  if (0 === count($questionIdsToDelete)) {
986  $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_delete_select_none"), true);
987  $this->ctrl->redirect($this, "questions");
988  }
989 
990  $this->tpl->setOnScreenMessage('question', $this->lng->txt("qpl_confirm_delete_questions"));
991  $deleteable_questions = &$this->object->getDeleteableQuestionDetails($questionIdsToDelete);
992  $table_gui = new ilQuestionBrowserTableGUI($this, 'questions', (($rbacsystem->checkAccess('write', $this->qplrequest->getRefId()) ? true : false)), true);
993  $table_gui->setShowRowsSelector(false);
994  $table_gui->setLimit(PHP_INT_MAX);
995  $table_gui->setEditable($rbacsystem->checkAccess('write', $this->qplrequest->getRefId()));
996  $table_gui->setData($deleteable_questions);
997  $this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
998  }
999 
1000 
1004  public function confirmDeleteQuestionsObject(): void
1005  {
1006  // delete questions after confirmation
1007  foreach ($_POST["q_id"] as $key => $value) {
1008  $this->object->deleteQuestion($value);
1009  $this->object->cleanupClipboard($value);
1010  }
1011  if (count($_POST["q_id"])) {
1012  $this->tpl->setOnScreenMessage('success', $this->lng->txt("qpl_questions_deleted"), true);
1013  }
1014 
1015  $this->ctrl->setParameter($this, 'q_id', '');
1016 
1017  $this->ctrl->redirect($this, "questions");
1018  }
1019 
1023  public function cancelDeleteQuestionsObject(): void
1024  {
1025  $this->ctrl->redirect($this, "questions");
1026  }
1027 
1031  public function exportQuestionObject(): void
1032  {
1033  // export button was pressed
1034  $post = $this->qplrequest->getParsedBody();
1035  if (array_key_exists('q_id', $post) && is_array($post['q_id']) && count($post['q_id']) > 0) {
1036  $qpl_exp = new ilQuestionpoolExport($this->object, "xml", $post["q_id"]);
1037  // @PHP8-CR: This seems to be a pointer to an issue with exports. I like to leave this open for now and
1038  // schedule a thorough examination / analysis for later, eventually involved T&A TechSquad
1039  $export_file = $qpl_exp->buildExportFile();
1040  $filename = $export_file;
1041  $filename = preg_replace("/.*\//", "", $filename);
1042  if ($export_file === '') {
1043  $export_file = "StandIn";
1044  }
1046  exit();
1047  } else {
1048  $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_export_select_none"), true);
1049  }
1050  $this->ctrl->redirect($this, "questions");
1051  }
1052 
1053  public function filterQuestionBrowserObject(): void
1054  {
1055  global $DIC; /* @var ILIAS\DI\Container $DIC */
1056  $enableComments = $DIC->rbac()->system()->checkAccess('write', $this->qplrequest->getRefId());
1057  $taxIds = ilObjTaxonomy::getUsageOfObject($this->object->getId());
1058  $table_gui = new ilQuestionBrowserTableGUI($this, 'questions', false, false, $taxIds, $enableComments);
1059  $table_gui->resetOffset();
1060  $table_gui->writeFilterToSession();
1061  $this->questionsObject();
1062  }
1063 
1064  public function resetQuestionBrowserObject(): void
1065  {
1066  $taxIds = ilObjTaxonomy::getUsageOfObject($this->object->getId());
1067 
1068  $table_gui = new ilQuestionBrowserTableGUI(
1069  $this,
1070  'questions',
1071  false,
1072  false,
1073  $taxIds
1074  );
1075 
1076  $table_gui->resetOffset();
1077  $table_gui->resetFilter();
1078  $this->questionsObject();
1079  }
1080 
1081  protected function renoveImportFailsObject(): void
1082  {
1083  $qsaImportFails = new ilAssQuestionSkillAssignmentImportFails($this->object->getId());
1084  $qsaImportFails->deleteRegisteredImportFails();
1085 
1086  $this->ctrl->redirect($this, 'infoScreen');
1087  }
1088 
1092  public function questionsObject(): void
1093  {
1094  if (!$this->access->checkAccess("read", "", $this->qplrequest->getRefId())) {
1095  $this->infoScreenForward();
1096  return;
1097  }
1098 
1099  if (get_class($this->object) == "ilObjTest") {
1100  if ($this->qplrequest->raw("calling_test") > 0) {
1101  $ref_id = $this->qplrequest->raw("calling_test");
1102  $q_id = $this->qplrequest->raw("q_id");
1103 
1104  if ($this->qplrequest->raw('test_express_mode')) {
1105  if ($q_id) {
1106  ilUtil::redirect("ilias.php?ref_id=" . $ref_id . "&q_id=" . $q_id . "&test_express_mode=1&cmd=showPage&cmdClass=iltestexpresspageobjectgui&baseClass=ilObjTestGUI");
1107  } else {
1108  ilUtil::redirect("ilias.php?ref_id=" . $ref_id . "&test_express_mode=1&cmd=showPage&cmdClass=iltestexpresspageobjectgui&baseClass=ilObjTestGUI");
1109  }
1110  } else {
1111  ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&ref_id=" . $ref_id . "&cmd=questions");
1112  }
1113  }
1114  } elseif ($this->qplrequest->isset('calling_consumer') && (int) $this->qplrequest->raw('calling_consumer')) {
1115  $ref_id = (int) $this->qplrequest->raw('calling_consumer');
1117  if ($consumer instanceof ilQuestionEditingFormConsumer) {
1118  ilUtil::redirect($consumer->getQuestionEditingFormBackTarget($this->qplrequest->raw('consumer_context')));
1119  }
1121  }
1122 
1123  $this->object->purgeQuestions();
1124  // reset test_id SESSION variable
1125  ilSession::set("test_id", "");
1126  $qsaImportFails = new ilAssQuestionSkillAssignmentImportFails($this->object->getId());
1127  if ($qsaImportFails->failedImportsRegistered()) {
1128  $button = ilLinkButton::getInstance();
1129  $button->setUrl($this->ctrl->getLinkTarget($this, 'renoveImportFails'));
1130  $button->setCaption('ass_skl_import_fails_remove_btn');
1131 
1132  $this->tpl->setOnScreenMessage('failure', $qsaImportFails->getFailedImportsMessage($this->lng) . '<br />' . $button->render());
1133  }
1134  $taxIds = ilObjTaxonomy::getUsageOfObject($this->object->getId());
1135 
1136  $table_gui = $this->buildQuestionBrowserTableGUI($taxIds);
1137  $table_gui->setPreventDoubleSubmission(false);
1138 
1139  if ($this->rbac_system->checkAccess('write', $this->qplrequest->getRefId())) {
1140  $btn = ilLinkButton::getInstance();
1141  $btn->setCaption('ass_create_question');
1142  $btn->setUrl($this->ctrl->getLinkTarget($this, 'createQuestionForm'));
1143  $btn->setPrimary(true);
1144  $this->toolbar->addButtonInstance($btn);
1145 
1146 
1147  $btnImport = ilLinkButton::getInstance();
1148  $btnImport->setCaption('import');
1149  $btnImport->setUrl($this->ctrl->getLinkTarget($this, 'importQuestions'));
1150  $this->toolbar->addButtonInstance($btnImport);
1151 
1152  if (ilSession::get("qpl_clipboard") != null && count(ilSession::get('qpl_clipboard'))) {
1153  $btnPaste = ilLinkButton::getInstance();
1154  $btnPaste->setCaption('paste');
1155  $btnPaste->setUrl($this->ctrl->getLinkTarget($this, 'paste'));
1156  $this->toolbar->addButtonInstance($btnPaste);
1157  }
1158  }
1159 
1160  $this->tpl->setContent($this->ctrl->getHTML($table_gui));
1161 
1162  if ($this->object->getShowTaxonomies()) {
1163  $this->lng->loadLanguageModule('tax');
1164 
1165  foreach ($taxIds as $taxId) {
1166  if ($taxId != $this->object->getNavTaxonomyId()) {
1167  continue;
1168  }
1169 
1170  $taxExp = new ilTaxonomyExplorerGUI(
1171  $this,
1172  'showNavTaxonomy',
1173  $taxId,
1174  'ilobjquestionpoolgui',
1175  'questions'
1176  );
1177 
1178  if (!$taxExp->handleCommand()) {
1179  $this->tpl->setLeftContent($taxExp->getHTML() . "&nbsp;");
1180  }
1181 
1182  break;
1183  }
1184  }
1185 
1186  $this->tpl->setPermanentLink($this->object->getType(), $this->object->getRefId());
1187  }
1188 
1193  {
1194  $qId = $this->qplrequest->getQuestionId();
1195 
1196  if ($this->object->checkQuestionParent($qId)) {
1197  return $qId;
1198  }
1199 
1200  throw new ilTestQuestionPoolException('question id does not relate to parent object!');
1201  }
1202 
1203  private function createQuestionFormObject(): void
1204  {
1205  global $DIC; /* @var \ILIAS\DI\Container $DIC */
1206  $ilHelp = $DIC['ilHelp']; /* @var ilHelpGUI $ilHelp */
1207 
1208  $ilHelp->setScreenId('assQuestions');
1209 
1211  $ilHelp->setSubScreenId('createQuestion_editMode');
1212  } else {
1213  $ilHelp->setSubScreenId('createQuestion');
1214  }
1215 
1216  $form = $this->buildCreateQuestionForm();
1217 
1218  $this->tpl->setContent($this->ctrl->getHTML($form));
1219  }
1220 
1222  {
1223  global $DIC;
1224  $ilUser = $DIC['ilUser'];
1225  $form = new ilPropertyFormGUI();
1226  $form->setTitle($this->lng->txt('ass_create_question'));
1227  $form->setFormAction($this->ctrl->getFormAction($this));
1228 
1229  // question type
1230 
1231  $options = array();
1232  foreach ($this->object->getQuestionTypes(false, true, false) as $translation => $data) {
1233  $options[$data['type_tag']] = $translation;
1234  }
1235  $si = new ilSelectInputGUI($this->lng->txt('question_type'), 'sel_question_types');
1236  $si->setOptions($options);
1237  //$si->setValue($ilUser->getPref("tst_lastquestiontype"));
1238 
1239  $form->addItem($si);
1240 
1241  // content editing mode
1242 
1244  $ri = new ilRadioGroupInputGUI($this->lng->txt("tst_add_quest_cont_edit_mode"), "add_quest_cont_edit_mode");
1245 
1246  $option_ipe = new ilRadioOption(
1247  $this->lng->txt('tst_add_quest_cont_edit_mode_IPE'),
1249  );
1250  $option_ipe->setInfo($this->lng->txt('tst_add_quest_cont_edit_mode_IPE_info'));
1251  $ri->addOption($option_ipe);
1252 
1253  $option_rte = new ilRadioOption(
1254  $this->lng->txt('tst_add_quest_cont_edit_mode_RTE'),
1256  );
1257  $option_rte->setInfo($this->lng->txt('tst_add_quest_cont_edit_mode_RTE_info'));
1258  $ri->addOption($option_rte);
1259 
1261 
1262  $form->addItem($ri, true);
1263  } else {
1264  $hi = new ilHiddenInputGUI("question_content_editing_type");
1266  $form->addItem($hi, true);
1267  }
1268 
1269  // commands
1270 
1271  $form->addCommandButton('createQuestion', $this->lng->txt('create'));
1272  $form->addCommandButton('questions', $this->lng->txt('cancel'));
1273 
1274  return $form;
1275  }
1276 
1280  public function printObject(): void
1281  {
1282  $this->toolbar->setFormAction($this->ctrl->getFormAction($this, 'print'));
1283 
1284  $mode = new ilSelectInputGUI($this->lng->txt('output_mode'), 'output');
1285  $mode->setOptions(array(
1286  'overview' => $this->lng->txt('overview'),
1287  'detailed' => $this->lng->txt('detailed_output_solutions'),
1288  'detailed_printview' => $this->lng->txt('detailed_output_printview')
1289  ));
1290 
1291  $output = $this->qplrequest->raw('output') ?? '';
1292 
1293  $mode->setValue(ilUtil::stripSlashes($output));
1294 
1295  $this->toolbar->setFormName('printviewOptions');
1296  $this->toolbar->addInputItem($mode, true);
1297  $this->toolbar->addFormButton($this->lng->txt('submit'), 'print');
1298  $table_gui = new ilQuestionPoolPrintViewTableGUI($this, 'print', $output);
1299  $data = $this->object->getPrintviewQuestions();
1300  $totalPoints = 0;
1301  foreach ($data as $d) {
1302  $totalPoints += $d['points'];
1303  }
1304  $table_gui->setTotalPoints($totalPoints);
1305  $table_gui->initColumns();
1306  $table_gui->setData($data);
1307  $this->tpl->setContent($table_gui->getHTML());
1308  }
1309 
1310  public function updateObject(): void
1311  {
1312  $this->object->update();
1313  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
1314  }
1315 
1319  public function pasteObject(): void
1320  {
1321  if (ilSession::get("qpl_clipboard") != null) {
1322  if ($this->object->pasteFromClipboard()) {
1323  $this->tpl->setOnScreenMessage('success', $this->lng->txt("qpl_paste_success"), true);
1324  } else {
1325  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("qpl_paste_error"), true);
1326  }
1327  } else {
1328  $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_paste_no_objects"), true);
1329  }
1330  $this->ctrl->redirect($this, "questions");
1331  }
1332 
1336  public function copyObject(): void
1337  {
1338  if (isset($_POST["q_id"]) && is_array($_POST["q_id"]) && count($_POST["q_id"]) > 0) {
1339  foreach ($_POST["q_id"] as $key => $value) {
1340  $this->object->copyToClipboard($value);
1341  }
1342  $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_copy_insert_clipboard"), true);
1343  } elseif ($this->qplrequest->isset('q_id') && $this->qplrequest->getQuestionId() > 0) {
1344  $this->object->copyToClipboard($this->qplrequest->getQuestionId());
1345  $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_copy_insert_clipboard"), true);
1346  } else {
1347  $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_copy_select_none"), true);
1348  }
1349  $this->ctrl->redirect($this, "questions");
1350  }
1351 
1355  public function moveObject(): void
1356  {
1357  if (isset($_POST["q_id"]) && is_array($_POST["q_id"]) && count($_POST["q_id"]) > 0) {
1358  foreach ($_POST["q_id"] as $key => $value) {
1359  $this->object->moveToClipboard($value);
1360  }
1361  $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_move_insert_clipboard"), true);
1362  } elseif ($this->qplrequest->isset('q_id') && $this->qplrequest->getQuestionId() > 0) {
1363  $this->object->moveToClipboard($this->qplrequest->getQuestionId());
1364  $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_copy_insert_clipboard"), true);
1365  } else {
1366  $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_move_select_none"), true);
1367  }
1368  $this->ctrl->redirect($this, "questions");
1369  }
1370 
1371  public function createExportExcel(): void
1372  {
1373  global $DIC;
1374  $rbacsystem = $DIC['rbacsystem'];
1375  if ($rbacsystem->checkAccess("write", $this->qplrequest->getRefId())) {
1376  $question_ids = &$this->object->getAllQuestionIds();
1377  $qpl_exp = new ilQuestionpoolExport($this->object, 'xls', $question_ids);
1378  $qpl_exp->buildExportFile();
1379  $this->ctrl->redirectByClass("ilquestionpoolexportgui", "");
1380  }
1381  }
1382 
1386  public function &editQuestionForTestObject(): void
1387  {
1388  global $DIC;
1389 
1390  $p_gui = new ilAssQuestionPreviewGUI(
1391  $this->ctrl,
1392  $this->rbac_system,
1393  $this->tabs_gui,
1394  $this->tpl,
1395  $this->lng,
1396  $DIC->database(),
1397  $DIC->user(),
1398  new RandomGroup(),
1399  $this->ref_id,
1400  $DIC->rbac()
1401  );
1402  $this->ctrl->redirectByClass(get_class($p_gui), "show");
1403  }
1404 
1405  protected function initImportForm(string $new_type): ilPropertyFormGUI
1406  {
1407  $form = new ilPropertyFormGUI();
1408  $form->setTarget("_top");
1409  $form->setFormAction($this->ctrl->getFormAction($this));
1410  $form->setTitle($this->lng->txt("import_qpl"));
1411 
1412  $fi = new ilFileInputGUI($this->lng->txt("import_file"), "xmldoc");
1413  $fi->setSuffixes(array("zip"));
1414  $fi->setRequired(true);
1415  $form->addItem($fi);
1416 
1417  $form->addCommandButton("importFile", $this->lng->txt("import"));
1418  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
1419 
1420  return $form;
1421  }
1422 
1426  protected function importFileObject(int $parent_id = null): void
1427  {
1428  if ($_REQUEST['new_type'] === null) {
1429  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('import_file_not_valid'), true);
1430  $this->ctrl->redirect($this, 'create');
1431  return;
1432  }
1433  if (!$this->checkPermissionBool("create", "", $_REQUEST["new_type"])) {
1434  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
1435  $this->ctrl->redirect($this, 'create');
1436  return;
1437  }
1438 
1439  $form = $this->initImportForm($this->qplrequest->raw("new_type"));
1440  if ($form->checkInput()) {
1441  $this->uploadQplObject();
1442  }
1443 
1444  // display form to correct errors
1445  $this->tpl->setContent($form->getHTML());
1446  }
1447 
1448  public function addLocatorItems(): void
1449  {
1450  global $DIC;
1451  $ilLocator = $DIC['ilLocator'];
1452 
1453  switch ($this->ctrl->getCmd()) {
1454  case "create":
1455  case "importFile":
1456  case "cancel":
1457  break;
1458  default:
1459  $this->ctrl->clearParameterByClass(self::class, 'q_id');
1460  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->qplrequest->getRefId());
1461  $this->ctrl->setParameter($this, 'q_id', $this->qplrequest->getQuestionId());
1462  break;
1463  }
1464 
1465  if (!is_array($this->qplrequest->raw("q_id")) && $this->qplrequest->raw("q_id") > 0 && $this->qplrequest->raw('cmd') !== 'questions') {
1466  $q_gui = assQuestionGUI::_getQuestionGUI("", $this->qplrequest->raw("q_id"));
1467  if ($q_gui !== null && $q_gui->object instanceof assQuestion) {
1468  $q_gui->object->setObjId($this->object->getId());
1469  $title = $q_gui->object->getTitle();
1470  if (!$title) {
1471  $title = $this->lng->txt('new') . ': ' . assQuestion::_getQuestionTypeName($q_gui->object->getQuestionType());
1472  }
1473  $ilLocator->addItem($title, $this->ctrl->getLinkTargetByClass(get_class($q_gui), "editQuestion"));
1474  } else {
1475  // Workaround for context issues: If no object was found, redirect without q_id parameter
1476  $this->ctrl->setParameter($this, 'q_id', '');
1477  $this->ctrl->redirect($this);
1478  }
1479  }
1480  }
1481 
1485  public function setTitleAndDescription(): void
1486  {
1487  parent::setTitleAndDescription();
1488 
1489  if (!is_array($this->qplrequest->raw("q_id")) && $this->qplrequest->raw("q_id") > 0 && $this->qplrequest->raw('cmd') !== 'questions') {
1490  $q_gui = assQuestionGUI::_getQuestionGUI("", $this->qplrequest->getQuestionId());
1491  if ($q_gui->object instanceof assQuestion) {
1492  $q_gui->object->setObjId($this->object->getId());
1493  $title = $this->object->getTitle() . ': ' . $q_gui->object->getTitle();
1494  if (!$title) {
1495  $title = $this->lng->txt('new') . ': ' . assQuestion::_getQuestionTypeName($q_gui->object->getQuestionType());
1496  }
1497  $this->tpl->setTitle(
1498  strip_tags(
1499  $title,
1500  self::ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
1501  )
1502  );
1503  $this->tpl->setDescription(
1504  $q_gui->object->getDescriptionForHTMLOutput()
1505  );
1506  $this->tpl->setTitleIcon(ilObject2::_getIcon($this->object->getId(), "big", $this->object->getType()));
1507  } else {
1508  // Workaround for context issues: If no object was found, redirect without q_id parameter
1509  $this->ctrl->setParameter($this, 'q_id', '');
1510  $this->ctrl->redirect($this);
1511  }
1512  } else {
1513  $this->tpl->setTitle(
1514  strip_tags(
1515  $this->object->getTitle(),
1516  self::ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
1517  )
1518  );
1519  $this->tpl->setDescription(
1520  strip_tags(
1521  $this->object->getLongDescription(),
1522  self::ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
1523  )
1524  );
1525  $this->tpl->setTitleIcon(ilObject2::_getIcon($this->object->getId(), "big", $this->object->getType()));
1526  }
1527  }
1528 
1534  public function getTabs(): void
1535  {
1536  global $DIC;
1537  $ilHelp = $DIC['ilHelp'];
1538 
1539  $currentUserHasWriteAccess = $this->access->checkAccess("write", "", $this->object->getRefId());
1540  $currentUserHasReadAccess = $this->access->checkAccess("read", "", $this->object->getRefId());
1541 
1542  $ilHelp->setScreenIdComponent("qpl");
1543 
1544  $next_class = strtolower($this->ctrl->getNextClass());
1545  switch ($next_class) {
1546  case "":
1547  case "ilpermissiongui":
1548  case "ilobjectmetadatagui":
1549  case "ilquestionpoolexportgui":
1550  case "ilquestionpoolskilladministrationgui":
1551  break;
1552 
1553  case 'ilobjtaxonomygui':
1554  case 'ilobjquestionpoolsettingsgeneralgui':
1555 
1556  if ($currentUserHasWriteAccess) {
1557  $this->addSettingsSubTabs($this->tabs_gui);
1558  }
1559 
1560  break;
1561 
1562  default:
1563  return;
1564  break;
1565  }
1566  // questions
1567  $force_active = false;
1568  //$commands = $_POST["cmd"];
1569  $commands = $this->getQueryParamString("cmd");
1570  if (is_array($commands)) {
1571  foreach ($commands as $key => $value) {
1572  if (preg_match("/^delete_.*/", $key, $matches) ||
1573  preg_match("/^addSelectGap_.*/", $key, $matches) ||
1574  preg_match("/^addTextGap_.*/", $key, $matches) ||
1575  preg_match("/^deleteImage_.*/", $key, $matches) ||
1576  preg_match("/^upload_.*/", $key, $matches) ||
1577  preg_match("/^addSuggestedSolution_.*/", $key, $matches)
1578  ) {
1579  $force_active = true;
1580  }
1581  }
1582  }
1583  if (isset($_POST['imagemap_x'])) {
1584  $force_active = true;
1585  }
1586  if (!$force_active) {
1587  $force_active = ((strtolower($this->ctrl->getCmdClass()) == strtolower(get_class($this)) || strlen($this->ctrl->getCmdClass()) == 0) &&
1588  $this->ctrl->getCmd() == "")
1589  ? true
1590  : false;
1591  }
1592  if ($currentUserHasReadAccess) {
1593  $this->tabs_gui->addTarget(
1594  "assQuestions",
1595  $this->ctrl->getLinkTarget($this, "questions"),
1596  array("questions", "filter", "resetFilter", "createQuestion",
1597  "importQuestions", "deleteQuestions", "filterQuestionBrowser",
1598  "view", "preview", "editQuestion", "exec_pg",
1599  "addItem", "upload", "save", "cancel", "addSuggestedSolution",
1600  "cancelExplorer", "linkChilds", "removeSuggestedSolution",
1601  "add", "addYesNo", "addTrueFalse", "createGaps", "saveEdit",
1602  "setMediaMode", "uploadingImage", "uploadingImagemap", "addArea",
1603  "deletearea", "saveShape", "back", "addPair", "uploadingJavaapplet",
1604  "addParameter", "assessment", "addGIT", "addST", "addPG", "delete",
1605  "toggleGraphicalAnswers", "deleteAnswer", "deleteImage", "removeJavaapplet"),
1606  "",
1607  "",
1608  $force_active
1609  );
1610  }
1611  if ($currentUserHasReadAccess) {
1612  $this->tabs_gui->addTarget(
1613  "info_short",
1614  $this->ctrl->getLinkTarget($this, "infoScreen"),
1615  array("infoScreen", "showSummary")
1616  );
1617  }
1618 
1619  if ($currentUserHasWriteAccess) {
1620  // properties
1621  $this->tabs_gui->addTarget(
1622  'settings',
1623  $this->ctrl->getLinkTargetByClass('ilObjQuestionPoolSettingsGeneralGUI'),
1624  array(),
1625  array('ilObjQuestionPoolSettingsGeneralGUI', 'ilObjTaxonomyGUI')
1626  );
1627 
1628  // skill service
1629  if ($this->isSkillsTabRequired()) {
1630  $link = $this->ctrl->getLinkTargetByClass(
1631  array('ilQuestionPoolSkillAdministrationGUI', 'ilAssQuestionSkillAssignmentsGUI'),
1633  );
1634 
1635  $this->tabs_gui->addTarget('qpl_tab_competences', $link, array(), array());
1636  }
1637  }
1638 
1639  if ($currentUserHasReadAccess) {
1640  // print view
1641  $this->tabs_gui->addTarget(
1642  "print_view",
1643  $this->ctrl->getLinkTarget($this, 'print'),
1644  array("print"),
1645  "",
1646  ""
1647  );
1648  }
1649 
1650  if ($currentUserHasWriteAccess) {
1651  $mdgui = new ilObjectMetaDataGUI($this->object);
1652  $mdtab = $mdgui->getTab();
1653  if ($mdtab) {
1654  $this->tabs_gui->addTarget(
1655  "meta_data",
1656  $mdtab,
1657  "",
1658  "ilmdeditorgui"
1659  );
1660  }
1661  }
1662 
1663  if ($currentUserHasWriteAccess) {
1664  $this->tabs_gui->addTarget(
1665  "export",
1666  $this->ctrl->getLinkTargetByClass("ilquestionpoolexportgui", ""),
1667  "",
1668  "ilquestionpoolexportgui"
1669  );
1670  }
1671 
1672  if ($this->access->checkAccess("edit_permission", "", $this->object->getRefId())) {
1673  $this->tabs_gui->addTarget(
1674  "perm_settings",
1675  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
1676  array("perm","info","owner"),
1677  'ilpermissiongui'
1678  );
1679  }
1680  }
1681 
1682  private function isSkillsTabRequired(): bool
1683  {
1684  if (!($this->object instanceof ilObjQuestionPool)) {
1685  return false;
1686  }
1687 
1688  if (!$this->object->isSkillServiceEnabled()) {
1689  return false;
1690  }
1691 
1693  return false;
1694  }
1695 
1696  return true;
1697  }
1698 
1699  private function addSettingsSubTabs(ilTabsGUI $tabs): void
1700  {
1701  $tabs->addSubTabTarget(
1702  'qpl_settings_subtab_general',
1703  $this->ctrl->getLinkTargetByClass('ilObjQuestionPoolSettingsGeneralGUI'),
1704  '',
1705  'ilObjQuestionPoolSettingsGeneralGUI'
1706  );
1707 
1708  $tabs->addSubTabTarget(
1709  'qpl_settings_subtab_taxonomies',
1710  $this->ctrl->getLinkTargetByClass('ilObjTaxonomyGUI', 'editAOTaxonomySettings'),
1711  '',
1712  'ilObjTaxonomyGUI'
1713  );
1714  }
1715 
1721  public function infoScreenObject(): void
1722  {
1723  $this->ctrl->setCmd("showSummary");
1724  $this->ctrl->setCmdClass("ilinfoscreengui");
1725  $this->infoScreenForward();
1726  }
1727 
1731  public function infoScreenForward(): void
1732  {
1733  if (!$this->access->checkAccess("visible", "", $this->ref_id)) {
1734  $this->error->raiseError($this->lng->txt("msg_no_perm_read"));
1735  }
1736  $info = new ilInfoScreenGUI($this);
1737  $info->enablePrivateNotes();
1738 
1739  // standard meta data
1740  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
1741 
1742  $this->ctrl->forwardCommand($info);
1743  }
1744 
1753  public static function _goto($a_target): void
1754  {
1755  global $DIC;
1756  $main_tpl = $DIC->ui()->mainTemplate();
1757  $ilAccess = $DIC['ilAccess'];
1758  $ilErr = $DIC['ilErr'];
1759  $lng = $DIC['lng'];
1760  $ctrl = $DIC['ilCtrl'];
1761 
1762  if ($ilAccess->checkAccess("write", "", (int) $a_target)
1763  || $ilAccess->checkAccess('read', '', (int) $a_target)
1764  ) {
1765  $target_class = ilObjQuestionPoolGUI::class;
1766  $target_cmd = 'questions';
1767  $ctrl->setParameterByClass($target_class, 'ref_id', $a_target);
1768  $ctrl->redirectByClass([ilRepositoryGUI::class, $target_class], $target_cmd);
1769  return;
1770  }
1771  if ($ilAccess->checkAccess('visible', "", $a_target)) {
1772  ilObjectGUI::_gotoRepositoryNode($a_target, 'infoScreen');
1773  return;
1774  }
1775  if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1776  $main_tpl->setOnScreenMessage(
1777  'info',
1778  sprintf(
1779  $lng->txt("msg_no_perm_read_item"),
1781  ),
1782  true
1783  );
1785  return;
1786  }
1787  $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
1788  }
1789 
1798  {
1799  global $DIC;
1800  $rbacsystem = $DIC['rbacsystem'];
1801  $ilDB = $DIC['ilDB'];
1802  $lng = $DIC['lng'];
1803  /* @var ilComponentRepository $component_repository */
1804  $component_repository = $DIC['component.repository'];
1805 
1806  $writeAccess = (bool) $rbacsystem->checkAccess('write', $this->qplrequest->getRefId());
1807  $enableCommenting = $writeAccess;
1808 
1809  $table_gui = new ilQuestionBrowserTableGUI(
1810  $this,
1811  'questions',
1812  $writeAccess,
1813  false,
1814  $taxIds,
1815  $enableCommenting
1816  );
1817 
1818  $table_gui->setEditable($writeAccess);
1819  $questionList = new ilAssQuestionList(
1820  $ilDB,
1821  $lng,
1822  $this->refinery,
1823  $component_repository
1824  );
1825  $questionList->setParentObjId($this->object->getId());
1826 
1827  foreach ($table_gui->getFilterItems() as $item) {
1828  if (substr($item->getPostVar(), 0, strlen('tax_')) == 'tax_') {
1829  $v = $item->getValue();
1830 
1831  if (is_array($v) && count($v) && !(int) $v[0]) {
1832  continue;
1833  }
1834 
1835  $taxId = substr($item->getPostVar(), strlen('tax_'));
1836 
1837  $questionList->addTaxonomyFilter(
1838  $taxId,
1839  $item->getValue(),
1840  $this->object->getId(),
1841  $this->object->getType()
1842  );
1843  } elseif ($item->getValue() != false) {
1844  $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
1845  }
1846  }
1847 
1848  if ($this->object->isNavTaxonomyActive() && (int) $this->qplrequest->raw('tax_node')) {
1849  $taxTree = new ilTaxonomyTree($this->object->getNavTaxonomyId());
1850  $rootNodeId = $taxTree->readRootId();
1851 
1852  if ((int) $this->qplrequest->raw('tax_node') != $rootNodeId) {
1853  $questionList->addTaxonomyFilter(
1854  $this->object->getNavTaxonomyId(),
1855  array((int) $this->qplrequest->raw('tax_node')),
1856  $this->object->getId(),
1857  $this->object->getType()
1858  );
1859  }
1860  }
1861 
1862  $questionList->load();
1863  $data = $questionList->getQuestionDataArray();
1864 
1865  $table_gui->setQuestionData($data);
1866 
1867  return $table_gui;
1868  }
1869 } // END class.ilObjQuestionPoolGUI
const MATCHING_QUESTION_IDENTIFIER
const MULTIPLE_CHOICE_QUESTION_IDENTIFIER
const ADDITIONAL_CONTENT_EDITING_MODE_IPE
static _goto($a_target)
Redirect script to call a test with the question pool reference id.
setEditPreview(bool $a_editpreview)
Set Display first Edit tab, then Preview tab, instead of Page and Edit.
raiseError(string $a_msg, int $a_err_obj)
wrapper for downward compability
static get(string $a_var)
& createQuestionForTestObject()
create new question
afterSave(ilObject $new_object)
save object public
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
exit
Definition: login.php:28
Class ilInfoScreenGUI.
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
copyObject()
copy one or more question objects to the clipboard
confirmDeleteQuestionsObject()
delete questions
GUI class for the workflow of copying objects.
const ROOT_FOLDER_ID
Definition: constants.php:32
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
filterObject()
set question list filter
Abstract basic class which is to be extended by the concrete assessment question type classes...
prepareOutput(bool $show_sub_objects=true)
This class represents a file property in a property form.
setInfo(string $a_info)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS TestQuestionPool InternalRequestService $qplrequest
const KPRIM_CHOICE_QUESTION_IDENTIFIER
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getQuestionTypeName($type_tag)
static _gotoRepositoryNode(int $ref_id, string $cmd="")
const LONG_MENU_QUESTION_IDENTIFIER
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const TEXTSUBSET_QUESTION_IDENTIFIER
__construct()
Constructor public.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setParameterByClass(string $a_class, string $a_parameter, $a_value)
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)
setSuffixes(array $a_suffixes)
loadLanguageModule(string $a_module)
Load language module.
getTabs()
adds tabs to tab gui object
download_paragraphObject()
download source code paragraph
static getStyleSheetLocation(string $mode="output", string $a_css_name="", string $a_css_location="")
get full style sheet file name (path inclusive) of current user
exportObject()
Gateway for exports initiated from workspace, as there is a generic forward to {objTypeMainGUI}::expo...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
importObject(?object $a_new_obj, string $a_tmp_file, string $a_filename, string $a_type, string $a_comp="", bool $a_copy_file=false)
$ilErr
Definition: raiseError.php:17
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static unzip(string $path_to_zip_file, bool $overwrite_existing=false, bool $unpack_flat=false)
addSubTabTarget(string $a_text, string $a_link, $a_cmd="", $a_cmdClass="", string $a_frame="", bool $a_activate=false, bool $a_dir_text=false)
static _lookupObjId(int $ref_id)
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
Interface ilCtrlBaseClassInterface describes ilCtrl base classes.
global $DIC
Definition: feed.php:28
ilLanguage $lng
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
& editQuestionForTestObject()
edit question
importQuestionsObject(ilPropertyFormGUI $form=null)
display the import form to import questions into the questionpool
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property in a property form.
ilGlobalTemplateInterface $tpl
deleteQuestionsObject()
delete questions confirmation screen
static _lookupTitle(int $obj_id)
const NUMERIC_QUESTION_IDENTIFIER
setContent(string $a_html)
Sets content for standard template.
setTitleAndDescription()
called by prepare output
questionsObject()
list questions of question pool
Class ilObjectGUI Basic methods of all Output classes.
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
const ORDERING_QUESTION_IDENTIFIER
uploadQplObject($questions_only=false)
imports question(s) into the questionpool
$param
Definition: xapitoken.php:46
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
createQuestionObject()
create new question
Class ilObjFile.
string $key
Consumer key/client ID value.
Definition: System.php:193
cancelDeleteQuestionsObject()
Cancel question deletion.
Legacy Content Object Parser.
static _setImportDirectory($a_import_dir=null)
set import directory
$xml
Definition: metadata.php:351
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
importVerifiedFileObject()
imports question(s) into the questionpool (after verification)
const TEXT_QUESTION_IDENTIFIER
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setRequired(bool $a_required)
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
moveObject()
mark one or more question objects for moving
$filename
Definition: buildRTE.php:78
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
static redirect(string $a_script)
$rows
Definition: xhr_table.php:10
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
fullscreenObject()
show fullscreen view
printObject()
Creates a print view for a question pool.
__construct(Container $dic, ilPlugin $plugin)
const ADDITIONAL_CONTENT_EDITING_MODE_RTE
pasteObject()
paste questios from the clipboard into the question pool
$ilUser
Definition: imgupload.php:34
initQuestion($questionId, $parentObjId)
static isAdditionalQuestionContentEditingModePageObjectEnabled()
Returns the fact wether content editing with ilias page editor is enabled for questions or not...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
infoScreenForward()
show information screen
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getImportDirectory()
get import directory of lm
$post
Definition: ltitoken.php:49
static _createImportDirectory()
creates data directory for import files (data_dir/qpl_data/qpl_<id>/import, depending on data directo...
const SINGLE_CHOICE_QUESTION_IDENTIFIER
importFileObject(int $parent_id=null)
form for new questionpool object import
static set(string $a_var, $a_val)
Set a value.
showMediaFullscreen(int $a_style_id=0)
show fullscreen view of media object
const CLOZE_TEST_IDENTIFIER
Question identifier constants.
uploadObject()
imports question(s) into the questionpool
static _setImportDirectory($a_import_dir=null)
send_paragraph(string $par_id, string $filename)
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
const IMAGEMAP_QUESTION_IDENTIFIER