ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObjSurveyQuestionPoolGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
17{
21 protected $nav_history;
22
26 protected $error;
27
31 protected $help;
32
36 protected $log;
37
39
44 public function __construct()
45 {
46 global $DIC;
47
48 $this->lng = $DIC->language();
49 $this->nav_history = $DIC["ilNavigationHistory"];
50 $this->tpl = $DIC["tpl"];
51 $this->user = $DIC->user();
52 $this->toolbar = $DIC->toolbar();
53 $this->error = $DIC["ilErr"];
54 $this->locator = $DIC["ilLocator"];
55 $this->help = $DIC["ilHelp"];
56 $lng = $DIC->language();
57 $ilCtrl = $DIC->ctrl();
58
59 $this->type = "spl";
60 $lng->loadLanguageModule("survey");
61 $this->ctrl = $ilCtrl;
62 $this->ctrl->saveParameter($this, array("ref_id"));
63
64 parent::__construct("", $_GET["ref_id"], true, false);
65
66 $this->log = ilLoggerFactory::getLogger('svy');
67 }
68
72 public function executeCommand()
73 {
74 $ilNavigationHistory = $this->nav_history;
75
76 if (!$this->checkPermissionBool("visible") &&
77 !$this->checkPermissionBool("read")) {
78 $this->checkPermission("read");
79 }
80
81 // add entry to navigation history
82 if (!$this->getCreationMode() &&
83 $this->checkPermissionBool("read")) {
84 $ilNavigationHistory->addItem(
85 $this->ref_id,
86 "ilias.php?baseClass=ilObjSurveyQuestionPoolGUI&cmd=questions&ref_id=" . $this->ref_id,
87 "spl"
88 );
89 }
90
91 $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "survey.css", "Modules/Survey"), "screen");
92 $this->prepareOutput();
93
94 $cmd = $this->ctrl->getCmd("questions");
95 $next_class = $this->ctrl->getNextClass($this);
96 $this->ctrl->setReturn($this, "questions");
97 if ($_GET["q_id"] < 1) {
98 $q_type = ($_POST["sel_question_types"] != "")
99 ? $_POST["sel_question_types"]
100 : $_GET["sel_question_types"];
101 }
102
103 $this->log->debug("- cmd=" . $cmd . " next_class=" . $next_class);
104 switch ($next_class) {
105 case 'ilobjectmetadatagui':
106 $this->checkPermission('write');
107 $md_gui = new ilObjectMetaDataGUI($this->object);
108 $this->ctrl->forwardCommand($md_gui);
109 break;
110
111 case 'ilpermissiongui':
112 $perm_gui = new ilPermissionGUI($this);
113 $ret = &$this->ctrl->forwardCommand($perm_gui);
114 break;
115
116 case "ilsurveyphrasesgui":
117 $phrases_gui = new ilSurveyPhrasesGUI($this);
118 $ret = &$this->ctrl->forwardCommand($phrases_gui);
119 break;
120
121 case 'ilobjectcopygui':
122 $cp = new ilObjectCopyGUI($this);
123 $cp->setType('spl');
124 $this->ctrl->forwardCommand($cp);
125 break;
126
127 case 'ilinfoscreengui':
128 $this->infoScreenForward();
129 break;
130
131 case "ilcommonactiondispatchergui":
133 $this->ctrl->forwardCommand($gui);
134 break;
135
136 case "":
137 $cmd .= "Object";
138 $ret = &$this->$cmd();
139 break;
140
141 default:
142 $q_gui = SurveyQuestionGUI::_getQuestionGUI($q_type, $_GET["q_id"]);
143 $this->log->debug("- This is the switch/case default, going to question id =" . $_GET["q_id"]);
144 // $q_gui->object->setObjId($this->object->getId());
145 $q_gui->setQuestionTabs();
146 $ret = &$this->ctrl->forwardCommand($q_gui);
147
148 // not on create
149 if ($q_gui->object->isComplete()) {
150 $this->tpl->setTitle($this->lng->txt("question") . ": " . $q_gui->object->getTitle());
151 }
152 break;
153 }
154 if (strtolower($_GET["baseClass"]) != "iladministrationgui" &&
155 $this->getCreationMode() != true) {
156 $this->tpl->printToStdout();
157 }
158 }
159
160 protected function initEditForm()
161 {
162 $obj_service = $this->object_service;
163
164 $form = new ilPropertyFormGUI();
165 $form->setFormAction($this->ctrl->getFormAction($this, 'properties'));
166 $form->setTitle($this->lng->txt("properties"));
167 $form->setMultipart(false);
168 $form->setId("properties");
169
170 // title
171 $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
172 $title->setSubmitFormOnEnter(true);
173 $title->setValue($this->object->getTitle());
174 $title->setSize(min(40, ilObject::TITLE_LENGTH));
175 $title->setMaxLength(ilObject::TITLE_LENGTH);
176 $title->setRequired(true);
177 $form->addItem($title);
178
179 // desc
180 $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'desc');
181 $desc->setValue($this->object->getLongDescription());
182 $desc->setRows(2);
183 $desc->setCols(40);
184 $form->addItem($desc);
185
186 // online
187 $online = new ilCheckboxInputGUI($this->lng->txt("spl_online_property"), "online");
188 $online->setInfo($this->lng->txt("spl_online_property_description"));
189 $online->setChecked($this->object->getOnline());
190 $form->addItem($online);
191
193 $section->setTitle($this->lng->txt('obj_presentation'));
194 $form->addItem($section);
195
196 // tile image
197 $obj_service->commonSettings()->legacyForm($form, $this->object)->addTileImage();
198
199
200 $form->addCommandButton("saveProperties", $this->lng->txt("save"));
201
202 return $form;
203 }
204
208 public function propertiesObject(ilPropertyFormGUI $a_form = null)
209 {
210 if (!$a_form) {
211 $a_form = $this->initEditForm();
212 }
213
214 $this->tpl->setVariable("ADM_CONTENT", $a_form->getHTML());
215 }
216
220 public function savePropertiesObject()
221 {
222 $obj_service = $this->object_service;
223 $form = $this->initEditForm();
224 if ($form->checkInput()) {
225 $this->object->setTitle($form->getInput("title"));
226 $this->object->setDescription($form->getInput("desc"));
227 $this->object->setOnline((int) $form->getInput("online"));
228
229 $this->object->saveToDb();
230
231 // tile image
232 $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTileImage();
233
234
235 ilUtil::sendSuccess($this->lng->txt("saved_successfully"), true);
236 $this->ctrl->redirect($this, "properties");
237 }
238
239 $form->setValuesByPost();
240 $this->propertiesObject($form);
241 }
242
243
247 public function copyObject()
248 {
249 if (count($_POST["q_id"]) > 0) {
250 foreach ($_POST["q_id"] as $key => $value) {
251 $this->object->copyToClipboard($value);
252 }
253 ilUtil::sendInfo($this->lng->txt("spl_copy_insert_clipboard"), true);
254 } else {
255 ilUtil::sendInfo($this->lng->txt("spl_copy_select_none"), true);
256 }
257 $this->ctrl->redirect($this, "questions");
258 }
259
263 public function moveObject()
264 {
265 if (count($_POST["q_id"]) > 0) {
266 foreach ($_POST["q_id"] as $key => $value) {
267 $this->object->moveToClipboard($value);
268 }
269 ilUtil::sendInfo($this->lng->txt("spl_move_insert_clipboard"), true);
270 } else {
271 ilUtil::sendInfo($this->lng->txt("spl_move_select_none"), true);
272 }
273 $this->ctrl->redirect($this, "questions");
274 }
275
279 public function exportQuestionObject()
280 {
281 if (is_array($_POST['q_id']) && count($_POST['q_id']) > 0) {
282 $this->createExportFileObject($_POST['q_id']);
283 } else {
284 ilUtil::sendInfo($this->lng->txt("qpl_export_select_none"));
285 $this->questionsObject();
286 }
287 }
288
292 public function deleteQuestionsObject()
293 {
294 $this->checkPermission('write');
295
296 // create an array of all checked checkboxes
297 $checked_questions = $_POST['q_id'];
298 if (count($checked_questions) == 0) {
299 ilUtil::sendInfo($this->lng->txt("qpl_delete_select_none"));
300 $this->questionsObject();
301 return;
302 }
303
304 $cgui = new ilConfirmationGUI();
305 $cgui->setHeaderText($this->lng->txt("qpl_confirm_delete_questions"));
306
307 $cgui->setFormAction($this->ctrl->getFormAction($this));
308 $cgui->setCancel($this->lng->txt("cancel"), "cancelDeleteQuestions");
309 $cgui->setConfirm($this->lng->txt("confirm"), "confirmDeleteQuestions");
310
311 $infos = $this->object->getQuestionInfos($checked_questions);
312 foreach ($infos as $data) {
313 $txt = $data["title"] . " (" .
315 if ($data["description"]) {
316 $txt .= "<div class=\"small\">" . $data["description"] . "</div>";
317 }
318
319 $cgui->addItem("q_id[]", $data["id"], $txt);
320 }
321
322 $this->tpl->setContent($cgui->getHTML());
323 }
324
329 {
330 // delete questions after confirmation
331 ilUtil::sendSuccess($this->lng->txt("qpl_questions_deleted"), true);
332 foreach ($_POST['q_id'] as $q_id) {
333 $this->object->removeQuestion($q_id);
334 }
335 $this->ctrl->redirect($this, "questions");
336 }
337
342 {
343 // delete questions after confirmation
344 $this->ctrl->redirect($this, "questions");
345 }
346
350 public function pasteObject()
351 {
352 if (array_key_exists("spl_clipboard", $_SESSION)) {
353 $this->object->pasteFromClipboard();
354 } else {
355 ilUtil::sendInfo($this->lng->txt("spl_paste_no_objects"), true);
356 }
357 $this->ctrl->redirect($this, "questions");
358 }
359
363 public function importQuestionsObject()
364 {
366
367 $form = new ilPropertyFormGUI();
368 $form->setFormAction($this->ctrl->getFormAction($this, "uploadQuestions"));
369 $form->setTitle($this->lng->txt("import_question"));
370
371 $fi = new ilFileInputGUI($this->lng->txt("select_file"), "qtidoc");
372 $fi->setSuffixes(array("xml", "zip"));
373 $fi->setRequired(true);
374 $form->addItem($fi);
375
376 $form->addCommandButton("uploadQuestions", $this->lng->txt("import"));
377 $form->addCommandButton("questions", $this->lng->txt("cancel"));
378
379 $tpl->setContent($form->getHTML());
380 }
381
385 public function uploadQuestionsObject()
386 {
387 // check if file was uploaded
388 $source = $_FILES["qtidoc"]["tmp_name"];
389 $error = 0;
390 if (($source == 'none') || (!$source) || $_FILES["qtidoc"]["error"] > UPLOAD_ERR_OK) {
391 $error = 1;
392 }
393 // check correct file type
394 if (!$error && strpos("xml", $_FILES["qtidoc"]["type"]) !== false) {
395 $error = 1;
396 }
397 if (!$error) {
398 // import file into questionpool
399 // create import directory
400 $this->object->createImportDirectory();
401
402 // copy uploaded file to import directory
403 $full_path = $this->object->getImportDirectory() . "/" . $_FILES["qtidoc"]["name"];
404
406 $_FILES["qtidoc"]["tmp_name"],
407 $_FILES["qtidoc"]["name"],
408 $full_path
409 );
410 $source = $full_path;
411 $this->object->importObject($source, true);
412 unlink($source);
413 }
414 $this->ctrl->redirect($this, "questions");
415 }
416
418 {
419 $table_gui = new ilSurveyQuestionsTableGUI($this, 'questions');
420 $table_gui->writeFilterToSession();
421 $this->ctrl->redirect($this, 'questions');
422 }
423
425 {
426 $table_gui = new ilSurveyQuestionsTableGUI($this, 'questions');
427 $table_gui->resetFilter();
428 $this->ctrl->redirect($this, 'questions');
429 }
430
434 public function questionsObject($arrFilter = null)
435 {
437 $ilToolbar = $this->toolbar;
438
439 $this->object->purgeQuestions();
440
441 $_SESSION['q_id_table_nav'] = $_GET['q_id_table_nav'];
442
443 if ($this->checkPermissionBool('write')) {
444 $qtypes = new ilSelectInputGUI("", "sel_question_types");
445 $qtypes->setValue($ilUser->getPref("svy_lastquestiontype"));
446 $ilToolbar->addInputItem($qtypes);
447
448 $options = array();
449 foreach (ilObjSurveyQuestionPool::_getQuestionTypes() as $translation => $data) {
450 $options[$data["type_tag"]] = $translation;
451 }
452 $qtypes->setOptions($options);
453
454 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
455
456 $button = ilSubmitButton::getInstance();
457 $button->setCaption("svy_create_question");
458 $button->setCommand("createQuestion");
459 $ilToolbar->addButtonInstance($button);
460
461 $ilToolbar->addSeparator();
462
463 $button = ilSubmitButton::getInstance();
464 $button->setCaption("import");
465 $button->setCommand("importQuestions");
466 $ilToolbar->addButtonInstance($button);
467 }
468
469 $table_gui = new ilSurveyQuestionsTableGUI($this, 'questions', (($this->checkPermissionBool('write') ? true : false)));
470 $table_gui->setEditable($this->checkPermissionBool('write'));
471 $arrFilter = array();
472 foreach ($table_gui->getFilterItems() as $item) {
473 if ($item->getValue() !== false) {
474 $arrFilter[$item->getPostVar()] = $item->getValue();
475 }
476 }
477 $table_gui->setData($this->object->getQuestionsData($arrFilter));
478 $this->tpl->setContent($table_gui->getHTML());
479 }
480
481 public function updateObject()
482 {
483 $this->update = $this->object->update();
484 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
485 }
486
487 public function afterSave(ilObject $a_new_object)
488 {
489 // always send a message
490 ilUtil::sendSuccess($this->lng->txt("object_added"), true);
491
492 ilUtil::redirect("ilias.php?ref_id=" . $a_new_object->getRefId() .
493 "&baseClass=ilObjSurveyQuestionPoolGUI");
494 }
495
496 /*
497 * list all export files
498 */
499 public function exportObject()
500 {
501 $ilToolbar = $this->toolbar;
502
503 $ilToolbar->addButton(
504 $this->lng->txt('create_export_file'),
505 $this->ctrl->getLinkTarget($this, 'createExportFile')
506 );
507
508 $table_gui = new ilSurveyQuestionPoolExportTableGUI($this, 'export');
509 $export_dir = $this->object->getExportDirectory();
510 $export_files = $this->object->getExportFiles($export_dir);
511 $data = array();
512 foreach ($export_files as $exp_file) {
513 $file_arr = explode("__", $exp_file);
514 array_push($data, array('file' => $exp_file, 'date' => ilDatePresentation::formatDate(new ilDateTime($file_arr[0], IL_CAL_UNIX)), 'size' => filesize($export_dir . "/" . $exp_file)));
515 }
516 $table_gui->setData($data);
517 $this->tpl->setContent($table_gui->getHTML());
518 }
519
523 public function createExportFileObject($questions = null)
524 {
525 $this->checkPermission("write");
526
527 $survey_exp = new ilSurveyQuestionpoolExport($this->object);
528 $survey_exp->buildExportFile($questions);
529 $this->ctrl->redirect($this, "export");
530 }
531
535 public function downloadExportFileObject()
536 {
537 if (!isset($_POST["file"])) {
538 ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
539 $this->ctrl->redirect($this, "export");
540 }
541
542 if (count($_POST["file"]) > 1) {
543 ilUtil::sendInfo($this->lng->txt("select_max_one_item"), true);
544 $this->ctrl->redirect($this, "export");
545 }
546
547
548 $export_dir = $this->object->getExportDirectory();
549
550 $file = basename($_POST["file"][0]);
551
552 ilUtil::deliverFile($export_dir . "/" . $file, $file);
553 }
554
559 {
560 if (!isset($_POST["file"])) {
561 ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
562 $this->ctrl->redirect($this, "export");
563 }
564
565 ilUtil::sendQuestion($this->lng->txt("info_delete_sure"));
566 $table_gui = new ilSurveyQuestionPoolExportTableGUI($this, 'export', true);
567 $export_dir = $this->object->getExportDirectory();
568 $data = array();
569 foreach ($_POST['file'] as $exp_file) {
570 $file_arr = explode("__", $exp_file);
571 array_push($data, array('file' => $exp_file, 'date' => ilDatePresentation::formatDate(new ilDateTime($file_arr[0], IL_CAL_UNIX)), 'size' => filesize($export_dir . "/" . $exp_file)));
572 }
573 $table_gui->setData($data);
574 $this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
575 }
576
577
582 {
583 ilSession::clear("ilExportFiles");
584 $this->ctrl->redirect($this, "export");
585 }
586
590 public function deleteExportFileObject()
591 {
592 $export_dir = $this->object->getExportDirectory();
593 foreach ($_POST['file'] as $file) {
594 $file = basename($file);
595
596 $exp_file = $export_dir . "/" . $file;
597 $exp_dir = $export_dir . "/" . substr($file, 0, strlen($file) - 4);
598 if (@is_file($exp_file)) {
599 unlink($exp_file);
600 }
601 if (@is_dir($exp_dir)) {
602 ilUtil::delDir($exp_dir);
603 }
604 }
605 $this->ctrl->redirect($this, "export");
606 }
607
608 protected function initImportForm($a_new_type)
609 {
610 $form = parent::initImportForm($a_new_type);
611 $form->getItemByPostVar('importfile')->setSuffixes(array("zip", "xml"));
612
613 return $form;
614 }
615
616 protected function initCreationForms($a_new_type)
617 {
618 $form = $this->initImportForm($a_new_type);
619
620 $forms = array(self::CFORM_NEW => $this->initCreateForm($a_new_type),
621 self::CFORM_IMPORT => $form);
622
623 return $forms;
624 }
625
629 public function importFileObject($parent_id = null, $a_catch_errors = true)
630 {
633
634 if (!$parent_id) {
635 $parent_id = $_GET["ref_id"];
636 }
637 $new_type = $_REQUEST["new_type"];
638
639 // create permission is already checked in createObject. This check here is done to prevent hacking attempts
640 if (!$this->checkPermissionBool("create", "", $new_type)) {
641 $ilErr->raiseError($this->lng->txt("no_create_permission"));
642 }
643
644 $this->lng->loadLanguageModule($new_type);
645 $this->ctrl->setParameter($this, "new_type", $new_type);
646
647 $form = $this->initImportForm($new_type);
648 if ($form->checkInput()) {
649 $newObj = new ilObjSurveyQuestionPool();
650 $newObj->setType($new_type);
651 $newObj->setTitle("dummy");
652 $newObj->create(true);
653 $this->putObjectInTree($newObj);
654
655 $newObj->createImportDirectory();
656
657 // copy uploaded file to import directory
658 $upload = $_FILES["importfile"];
659 $file = pathinfo($upload["name"]);
660 $full_path = $newObj->getImportDirectory() . "/" . $upload["name"];
662 $upload["tmp_name"],
663 $upload["name"],
664 $full_path
665 );
666
667 // import qti data
668 $qtiresult = $newObj->importObject($full_path);
669
670 ilUtil::sendSuccess($this->lng->txt("object_imported"), true);
671 ilUtil::redirect("ilias.php?ref_id=" . $newObj->getRefId() .
672 "&baseClass=ilObjSurveyQuestionPoolGUI");
673 }
674
675 // display form to correct errors
676 $form->setValuesByPost();
677 $tpl->setContent($form->getHtml());
678 }
679
683 public function &createQuestionObject()
684 {
686
687 $ilUser->writePref("svy_lastquestiontype", $_POST["sel_question_types"]);
688
689 $q_gui = &SurveyQuestionGUI::_getQuestionGUI($_POST["sel_question_types"]);
690 $q_gui->object->setObjId($this->object->getId());
691 $q_gui->object->createNewQuestion();
692
693 $this->ctrl->setParameterByClass(get_class($q_gui), "q_id", $q_gui->object->getId());
694 $this->ctrl->setParameterByClass(get_class($q_gui), "sel_question_types", $_POST["sel_question_types"]);
695 $this->ctrl->redirectByClass(get_class($q_gui), "editQuestion");
696 }
697
701 public function &previewObject()
702 {
703 $q_gui = &SurveyQuestionGUI::_getQuestionGUI("", $_GET["preview"]);
704 $this->ctrl->setParameterByClass(get_class($q_gui), "sel_question_types", $q_gui->getQuestionType());
705 $this->ctrl->setParameterByClass(get_class($q_gui), "q_id", $_GET["preview"]);
706 $this->ctrl->redirectByClass(get_class($q_gui), "preview");
707 }
708
714 public function infoScreenObject()
715 {
716 $this->ctrl->setCmd("showSummary");
717 $this->ctrl->setCmdClass("ilinfoscreengui");
718 $this->infoScreenForward();
719 }
720
724 public function infoScreenForward()
725 {
726 if (!$this->checkPermissionBool("read")) {
727 $this->checkPermission("visible");
728 }
729
730 $info = new ilInfoScreenGUI($this);
731 $info->enablePrivateNotes();
732
733 // standard meta data
734 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
735
736 $this->ctrl->forwardCommand($info);
737 }
738
739 public function addLocatorItems()
740 {
741 $ilLocator = $this->locator;
742 switch ($this->ctrl->getCmd()) {
743 case "create":
744 case "importFile":
745 case "cancel":
746 break;
747 default:
748 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $_GET["ref_id"]);
749 break;
750 }
751 if ((int) $_GET["q_id"]) {
752 $q_id = (int) $_GET["q_id"];
753 $q_type = SurveyQuestion::_getQuestionType($q_id) . "GUI";
754 $q_title = SurveyQuestion::_getTitle($q_id);
755 if ($q_title) {
756 // not on create
757 $this->ctrl->setParameterByClass($q_type, "q_id", $q_id);
758 $ilLocator->addItem(
759 $q_title,
760 $this->ctrl->getLinkTargetByClass($q_type, "editQuestion")
761 );
762 }
763 }
764 }
765
771 public function getTabs()
772 {
773 $ilHelp = $this->help;
774
775 $ilHelp->setScreenIdComponent("spl");
776
777 $next_class = $this->ctrl->getNextClass($this);
778 switch ($next_class) {
779 case "":
780 case "ilpermissiongui":
781 case "ilobjectmetadatagui":
782 case "ilsurveyphrasesgui":
783 break;
784 default:
785 return;
786 break;
787 }
788
789 // questions
790 $force_active = (($this->ctrl->getCmdClass() == "" &&
791 $this->ctrl->getCmd() != "properties" && $this->ctrl->getCmd() != "infoScreen") ||
792 $this->ctrl->getCmd() == "")
793 ? true
794 : false;
795 if (!$force_active) {
796 if (is_array($_GET["sort"])) {
797 $force_active = true;
798 }
799 }
800
801 if ($this->checkPermissionBool("read")) {
802 $this->tabs_gui->addTarget(
803 "survey_questions",
804 $this->ctrl->getLinkTarget($this, 'questions'),
805 array("questions", "filterQuestionBrowser", "filter", "reset", "createQuestion",
806 "importQuestions", "deleteQuestions", "copy", "paste",
807 "exportQuestions", "confirmDeleteQuestions", "cancelDeleteQuestions",
808 "confirmPasteQuestions", "cancelPasteQuestions", "uploadQuestions",
809 "editQuestion", "addMaterial", "removeMaterial", "save", "cancel",
810 "cancelExplorer", "linkChilds", "addGIT", "addST", "addPG", "preview",
811 "moveCategory", "deleteCategory", "addPhrase", "addCategory", "savePhrase",
812 "addSelectedPhrase", "cancelViewPhrase", "confirmSavePhrase", "cancelSavePhrase",
813 "insertBeforeCategory", "insertAfterCategory", "confirmDeleteCategory",
814 "cancelDeleteCategory", "categories", "saveCategories",
815 "savePhrase", "addPhrase"
816 ),
817 array("ilobjsurveyquestionpoolgui", "ilsurveyphrasesgui"),
818 "",
819 $force_active
820 );
821
822 $this->tabs_gui->addTarget(
823 "info_short",
824 $this->ctrl->getLinkTarget($this, "infoScreen"),
825 array("infoScreen", "showSummary")
826 );
827 }
828
829 if ($this->checkPermissionBool('write')) {
830 // properties
831 $this->tabs_gui->addTarget(
832 "settings",
833 $this->ctrl->getLinkTarget($this, 'properties'),
834 array("properties", "saveProperties"),
835 "",
836 ""
837 );
838
839 // manage phrases
840 $this->tabs_gui->addTarget(
841 "manage_phrases",
842 $this->ctrl->getLinkTargetByClass("ilsurveyphrasesgui", "phrases"),
843 array("phrases", "deletePhrase", "confirmDeletePhrase", "cancelDeletePhrase", "editPhrase", "newPhrase", "saveEditPhrase", "phraseEditor"),
844 "ilsurveyphrasesgui",
845 ""
846 );
847
848 // meta data
849 $mdgui = new ilObjectMetaDataGUI($this->object);
850 $mdtab = $mdgui->getTab();
851 if ($mdtab) {
852 $this->tabs_gui->addTarget(
853 "meta_data",
854 $mdtab,
855 "",
856 "ilmdeditorgui"
857 );
858 }
859
860 // export
861 $this->tabs_gui->addTarget(
862 "export",
863 $this->ctrl->getLinkTarget($this, 'export'),
864 array("export", "createExportFile", "confirmDeleteExportFile",
865 "downloadExportFile", "cancelDeleteExportFile", "deleteExportFile"),
866 "",
867 ""
868 );
869 }
870
871 if ($this->checkPermissionBool("edit_permission")) {
872 $this->tabs_gui->addTarget(
873 "perm_settings",
874 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
875 array("perm","info","owner"),
876 'ilpermissiongui'
877 );
878 }
879 }
880
884 public function saveObligatoryObject()
885 {
886 $obligatory = array();
887 foreach ($_POST as $key => $value) {
888 if (preg_match("/obligatory_(\d+)/", $key, $matches)) {
889 $obligatory[] = $matches[1];
890 }
891 }
892 $this->object->setObligatoryStates($obligatory);
893
894 ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
895 $this->ctrl->redirect($this, "questions");
896 }
897
904 public static function _goto($a_target)
905 {
906 global $DIC;
907
908 $ilAccess = $DIC->access();
909 $lng = $DIC->language();
910
911 if ($ilAccess->checkAccess("visible", "", $a_target) ||
912 $ilAccess->checkAccess("read", "", $a_target)) {
913 $_GET["baseClass"] = "ilObjSurveyQuestionPoolGUI";
914 $_GET["cmd"] = "infoScreen";
915 $_GET["ref_id"] = $a_target;
916 include_once("ilias.php");
917 exit;
918 } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
919 ilUtil::sendFailure(sprintf(
920 $lng->txt("msg_no_perm_read_item"),
922 ), true);
924 }
925 }
926} // END class.ilObjSurveyQuestionPoolGUI
user()
Definition: user.php:4
$section
Definition: Utf8Test.php:83
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
static _getQuestionGUI($questiontype, $question_id=-1)
Creates a question gui representation.
static _getTitle($question_id)
Returns the question title of a question with a given id.
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
static _getQuestionType($question_id)
Returns the question type of a question with a given id.
const IL_CAL_UNIX
error($a_errmsg)
set error message @access public
This class represents a checkbox property in a property form.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Confirmation screen class.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
This class represents a file property in a property form.
This class represents a section header in a property form.
Class ilInfoScreenGUI.
static getLogger($a_component_id)
Get component logger.
Class ilObjSurveyQuestionPoolGUI.
uploadQuestionsObject()
imports question(s) into the questionpool
copyObject()
Copies checked questions in the questionpool to a clipboard.
createExportFileObject($questions=null)
create export file
__construct()
Constructor @access public.
savePropertiesObject()
Save questionpool properties.
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
propertiesObject(ilPropertyFormGUI $a_form=null)
Questionpool properties.
cancelDeleteExportFileObject()
cancel deletion of export files
pasteObject()
paste questios from the clipboard into the question pool
questionsObject($arrFilter=null)
list questions of question pool
initCreationForms($a_new_type)
Init creation froms.
importQuestionsObject()
display the import form to import questions into the questionpool
deleteQuestionsObject()
Creates a confirmation form to delete questions from the question pool.
cancelDeleteQuestionsObject()
cancel delete questions
afterSave(ilObject $a_new_object)
Post (successful) object creation hook.
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
moveObject()
mark one or more question objects for moving
confirmDeleteExportFileObject()
confirmation screen for export file deletion
static _goto($a_target)
Redirect script to call a survey question pool reference id.
importFileObject($parent_id=null, $a_catch_errors=true)
form for new survey object import
initImportForm($a_new_type)
Init object import form.
updateObject()
updates object entry in object_data
Class ilObjSurveyQuestionPool.
GUI class for the workflow of copying objects.
Class ilObjectGUI Basic methods of all Output classes.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
putObjectInTree(ilObject $a_obj, $a_parent_node_id=null)
Add object to tree at given position.
prepareOutput($a_show_subobjects=true)
prepare output
initCreateForm($a_new_type)
Init object creation form.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
getCreationMode()
get creation mode
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
Class ilObjectMetaDataGUI.
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
const TITLE_LENGTH
max length of object title
static _lookupTitle($a_id)
lookup object title
getRefId()
get reference id @access public
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
This class represents a selection list property in a property form.
static clear($a_var)
Unset a value.
static getInstance()
Factory.
Survey phrases GUI class.
Export class for survey questionpools.
This class represents a text area property in a property form.
This class represents a text property in a property form.
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 getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static redirect($a_script)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
const ROOT_FOLDER_ID
Definition: constants.php:30
$txt
Definition: error.php:13
global $DIC
Definition: goto.php:24
help()
Definition: help.php:2
$ilUser
Definition: imgupload.php:18
exit
Definition: login.php:29
$source
Definition: metadata.php:76
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6