46 $this->nav_history =
$DIC[
"ilNavigationHistory"];
47 $this->
toolbar = $DIC->toolbar();
48 $this->
help = $DIC[
"ilHelp"];
50 $this->edit_request =
$DIC->surveyQuestionPool()
55 $this->edit_manager =
$DIC->surveyQuestionPool()
64 $this->edit_request->getRefId(),
68 $this->
lng->loadLanguageModule(
"survey");
69 $this->
ctrl->saveParameter($this, array(
"ref_id"));
85 $ilNavigationHistory->addItem(
87 "ilias.php?baseClass=ilObjSurveyQuestionPoolGUI&cmd=questions&ref_id=" . $this->ref_id,
95 $cmd = $this->
ctrl->getCmd(
"questions");
96 $next_class = $this->
ctrl->getNextClass($this);
97 $this->
ctrl->setReturn($this,
"questions");
99 if ($this->edit_request->getQuestionId() < 1) {
100 $q_type = $this->edit_request->getSelectedQuestionTypes();
103 $this->log->debug(
"- cmd=" . $cmd .
" next_class=" . $next_class);
104 switch ($next_class) {
105 case 'ilobjectmetadatagui':
108 $this->
ctrl->forwardCommand($md_gui);
111 case 'ilpermissiongui':
113 $this->
ctrl->forwardCommand($perm_gui);
116 case "ilsurveyphrasesgui":
118 $this->
ctrl->forwardCommand($phrases_gui);
121 case 'ilobjectcopygui':
124 $this->
ctrl->forwardCommand($cp);
127 case 'ilinfoscreengui':
131 case "ilcommonactiondispatchergui":
133 $this->
ctrl->forwardCommand($gui);
144 $this->edit_request->getQuestionId()
146 $this->log->debug(
"- This is the switch/case default, going to question id =" . $this->edit_request->getQuestionId());
147 $q_gui->setQuestionTabs();
148 $this->
ctrl->forwardCommand($q_gui);
151 if ($q_gui->object->isComplete()) {
152 $this->tpl->setTitle($this->
lng->txt(
"question") .
": " . $q_gui->object->getTitle());
156 if (strtolower($this->edit_request->getBaseClass()) !==
"iladministrationgui" &&
157 $this->getCreationMode() !==
true) {
158 $this->tpl->printToStdout();
167 $form->setFormAction($this->
ctrl->getFormAction($this,
'properties'));
168 $form->setTitle($this->
lng->txt(
"properties"));
169 $form->setMultipart(
false);
170 $form->setId(
"properties");
174 $title->setSubmitFormOnEnter(
true);
175 $title->setValue($this->
object->getTitle());
178 $title->setRequired(
true);
179 $form->addItem($title);
183 $desc->setValue($this->
object->getLongDescription());
186 $form->addItem($desc);
190 $online->setInfo($this->
lng->txt(
"spl_online_property_description"));
191 $online->setChecked($this->
object->getOnline());
192 $form->addItem($online);
195 $section->setTitle($this->
lng->txt(
'obj_presentation'));
196 $form->addItem($section);
199 $obj_service->commonSettings()->legacyForm($form, $this->
object)->addTileImage();
201 $form->addCommandButton(
"saveProperties", $this->
lng->txt(
"save"));
215 $this->tpl->setVariable(
"ADM_CONTENT", $a_form->getHTML());
222 if ($form->checkInput()) {
223 $this->
object->setTitle($form->getInput(
"title"));
224 $this->
object->setDescription($form->getInput(
"desc"));
225 $this->
object->setOnline((
int) $form->getInput(
"online"));
227 $this->
object->saveToDb();
230 $obj_service->commonSettings()->legacyForm($form, $this->
object)->saveTileImage();
232 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"saved_successfully"),
true);
233 $this->
ctrl->redirect($this,
"properties");
236 $form->setValuesByPost();
246 $qids = $this->edit_request->getQuestionIds();
247 if (count($qids) > 0) {
248 foreach ($qids as
$key => $value) {
249 $this->
object->copyToClipboard($value);
251 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"spl_copy_insert_clipboard"),
true);
253 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"spl_copy_select_none"),
true);
255 $this->
ctrl->redirect($this,
"questions");
263 $qids = $this->edit_request->getQuestionIds();
264 if (count($qids) > 0) {
265 foreach ($qids as
$key => $value) {
266 $this->
object->moveToClipboard($value);
268 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"spl_move_insert_clipboard"),
true);
270 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"spl_move_select_none"),
true);
272 $this->
ctrl->redirect($this,
"questions");
280 $qids = $this->edit_request->getQuestionIds();
281 if (count($qids) > 0) {
282 $this->createExportFileObject($qids);
284 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"qpl_export_select_none"));
297 $checked_questions = $this->edit_request->getQuestionIds();
298 if (count($checked_questions) === 0) {
299 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"qpl_delete_select_none"));
305 $cgui->setHeaderText($this->
lng->txt(
"qpl_confirm_delete_questions"));
307 $cgui->setFormAction($this->
ctrl->getFormAction($this));
308 $cgui->setCancel($this->
lng->txt(
"cancel"),
"cancelDeleteQuestions");
309 $cgui->setConfirm($this->
lng->txt(
"confirm"),
"confirmDeleteQuestions");
311 $infos = $this->
object->getQuestionInfos($checked_questions);
312 foreach ($infos as
$data) {
315 if (
$data[
"description"]) {
316 $txt .=
"<div class=\"small\">" .
$data[
"description"] .
"</div>";
319 $cgui->addItem(
"q_id[]",
$data[
"id"],
$txt);
322 $this->tpl->setContent($cgui->getHTML());
328 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"qpl_questions_deleted"),
true);
329 $qids = $this->edit_request->getQuestionIds();
330 foreach ($qids as $q_id) {
331 $this->
object->removeQuestion($q_id);
333 $this->
ctrl->redirect($this,
"questions");
339 $this->
ctrl->redirect($this,
"questions");
347 $clip_questions = $this->edit_manager->getQuestionsFromClipboard();
348 if (count($clip_questions) > 0) {
349 $this->
object->pasteFromClipboard();
351 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"spl_paste_no_objects"),
true);
353 $this->
ctrl->redirect($this,
"questions");
369 $form->setFormAction($this->
ctrl->getFormAction($this,
"uploadQuestions"));
370 $form->setTitle($this->
lng->txt(
"import_question"));
373 $fi->setSuffixes(array(
"xml",
"zip"));
374 $fi->setRequired(
true);
377 $form->addCommandButton(
"uploadQuestions", $this->
lng->txt(
"import"));
378 $form->addCommandButton(
"questions", $this->
lng->txt(
"cancel"));
388 if ($form->checkInput()) {
390 $source = $_FILES[
"qtidoc"][
"tmp_name"];
392 if ((
$source ===
'none') || (!
$source) || $_FILES[
"qtidoc"][
"error"] > UPLOAD_ERR_OK) {
396 if (!
$error && strpos(
"xml", $_FILES[
"qtidoc"][
"type"]) !==
false) {
402 $this->
object->createImportDirectory();
405 $full_path = $this->
object->getImportDirectory() .
"/" . $_FILES[
"qtidoc"][
"name"];
408 $_FILES[
"qtidoc"][
"tmp_name"],
409 $_FILES[
"qtidoc"][
"name"],
413 $this->
object->importObject(
$source,
true);
416 $this->
ctrl->redirect($this,
"questions");
418 $form->setValuesByPost();
427 $table_gui->writeFilterToSession();
428 $this->
ctrl->redirect($this,
'questions');
434 $table_gui->resetFilter();
435 $this->
ctrl->redirect($this,
'questions');
446 $this->
object->purgeQuestions();
450 $qtypes->setValue(
$ilUser->getPref(
"svy_lastquestiontype"));
451 $ilToolbar->addInputItem($qtypes);
455 $options[
$data[
"type_tag"]] = $translation;
457 $qtypes->setOptions($options);
459 $ilToolbar->setFormAction($this->
ctrl->getFormAction($this));
462 $button->setCaption(
"svy_create_question");
463 $button->setCommand(
"createQuestion");
464 $ilToolbar->addButtonInstance($button);
466 $ilToolbar->addSeparator();
469 $button->setCaption(
"import");
470 $button->setCommand(
"importQuestions");
471 $ilToolbar->addButtonInstance($button);
476 $arrFilter = array();
477 foreach ($table_gui->getFilterItems() as $item) {
478 if ($item->getValue() !==
false) {
479 $arrFilter[$item->getPostVar()] = $item->getValue();
482 $table_gui->setData($this->
object->getQuestionsData($arrFilter));
483 $this->tpl->setContent($table_gui->getHTML());
488 $this->update = $this->
object->update();
489 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
495 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"object_added"),
true);
498 "&baseClass=ilObjSurveyQuestionPoolGUI");
509 $this->
lng->txt(
'create_export_file'),
510 $this->ctrl->getLinkTarget($this,
'createExportFile')
514 $export_dir = $this->
object->getExportDirectory();
515 $export_files = $this->
object->getExportFiles($export_dir);
517 foreach ($export_files as $exp_file) {
518 $file_arr = explode(
"__", $exp_file);
519 $data[] = array(
'file' => $exp_file,
521 'size' => filesize($export_dir .
"/" . $exp_file)
524 $table_gui->setData(
$data);
525 $this->tpl->setContent($table_gui->getHTML());
531 public function createExportFileObject($questions =
null): void
538 $survey_exp->buildExportFile($questions);
539 $this->
ctrl->redirect($this,
"export");
547 $files = $this->edit_request->getFiles();
548 if (count($files) === 0) {
549 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"no_checkbox"),
true);
550 $this->
ctrl->redirect($this,
"export");
553 if (count($files) > 1) {
554 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"select_max_one_item"),
true);
555 $this->
ctrl->redirect($this,
"export");
559 $export_dir = $this->
object->getExportDirectory();
561 $file = basename($files[0]);
571 $files = $this->edit_request->getFiles();
572 if (count($files) === 0) {
573 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"no_checkbox"),
true);
574 $this->
ctrl->redirect($this,
"export");
577 $this->tpl->setOnScreenMessage(
'question', $this->
lng->txt(
"info_delete_sure"));
579 $export_dir = $this->
object->getExportDirectory();
581 foreach ($files as $exp_file) {
582 $file_arr = explode(
"__", $exp_file);
583 $data[] = array(
'file' => $exp_file,
585 'size' => filesize($export_dir .
"/" . $exp_file)
588 $table_gui->setData(
$data);
589 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
595 $this->
ctrl->redirect($this,
"export");
600 $export_dir = $this->
object->getExportDirectory();
601 $files = $this->edit_request->getFiles();
602 foreach ($files as $file) {
603 $file = basename($file);
605 $exp_file = $export_dir .
"/" . $file;
606 $exp_dir = $export_dir .
"/" . substr($file, 0, -4);
607 if (is_file($exp_file)) {
610 if (is_dir($exp_dir)) {
614 $this->
ctrl->redirect($this,
"export");
619 $form = parent::initImportForm($new_type);
620 $form->getItemByPostVar(
'importfile')->setSuffixes(array(
"zip",
"xml"));
629 $forms = array(self::CFORM_NEW => $this->
initCreateForm($new_type),
630 self::CFORM_IMPORT => $form);
640 $parent_id = $this->edit_request->getRefId();
642 $new_type = $this->edit_request->getNewType();
649 $this->
lng->loadLanguageModule($new_type);
650 $this->
ctrl->setParameter($this,
"new_type", $new_type);
653 if ($form->checkInput()) {
655 $newObj->setType($new_type);
656 $newObj->setTitle(
"dummy");
657 $newObj->create(
true);
660 $newObj->createImportDirectory();
663 $upload = $_FILES[
"importfile"];
664 $file = pathinfo($upload[
"name"]);
665 $full_path = $newObj->getImportDirectory() .
"/" . $upload[
"name"];
673 $newObj->importObject($full_path);
675 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"object_imported"),
true);
677 "&baseClass=ilObjSurveyQuestionPoolGUI");
681 $form->setValuesByPost();
693 "svy_lastquestiontype",
694 $this->edit_request->getSelectedQuestionTypes()
698 $this->edit_request->getSelectedQuestionTypes()
700 $q_gui->object->setObjId($this->
object->getId());
701 $q_gui->object->createNewQuestion();
703 $this->
ctrl->setParameterByClass(get_class($q_gui),
"q_id", $q_gui->object->getId());
704 $this->
ctrl->setParameterByClass(
706 "sel_question_types",
707 $this->edit_request->getSelectedQuestionTypes()
709 $this->
ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
719 $this->edit_request->getPreview()
721 $this->
ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types", $q_gui->getQuestionType());
722 $this->
ctrl->setParameterByClass(get_class($q_gui),
"q_id", $this->edit_request->getPreview());
723 $this->
ctrl->redirectByClass(get_class($q_gui),
"preview");
731 $this->
ctrl->setCmd(
"showSummary");
732 $this->
ctrl->setCmdClass(
"ilinfoscreengui");
746 $info->enablePrivateNotes();
749 $info->addMetaDataSections($this->
object->getId(), 0, $this->object->getType());
751 $this->
ctrl->forwardCommand($info);
757 switch ($this->
ctrl->getCmd()) {
763 $ilLocator->
addItem($this->
object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"", $this->edit_request->getRefId());
766 if ($this->edit_request->getQuestionId() > 0) {
767 $q_id = $this->edit_request->getQuestionId();
772 $this->
ctrl->setParameterByClass($q_type,
"q_id", $q_id);
775 $this->
ctrl->getLinkTargetByClass($q_type,
"editQuestion")
787 $next_class = $this->
ctrl->getNextClass($this);
788 switch ($next_class) {
790 case "ilpermissiongui":
791 case "ilobjectmetadatagui":
792 case "ilsurveyphrasesgui":
799 $force_active = ($this->
ctrl->getCmdClass() ===
"" &&
800 $this->
ctrl->getCmd() !==
"properties" && $this->
ctrl->getCmd() !==
"infoScreen") ||
801 ($this->
ctrl->getCmd() ===
"" || $this->
ctrl->getCmd() ===
null);
802 if (!$force_active) {
803 $sort = $this->edit_request->getSort();
804 if (count($sort) > 0) {
805 $force_active =
true;
810 $this->tabs_gui->addTarget(
812 $this->
ctrl->getLinkTarget($this,
'questions'),
813 array(
"questions",
"filterQuestionBrowser",
"filter",
"reset",
"createQuestion",
814 "importQuestions",
"deleteQuestions",
"copy",
"paste",
815 "exportQuestions",
"confirmDeleteQuestions",
"cancelDeleteQuestions",
816 "confirmPasteQuestions",
"cancelPasteQuestions",
"uploadQuestions",
817 "editQuestion",
"addMaterial",
"removeMaterial",
"save",
"cancel",
818 "cancelExplorer",
"linkChilds",
"addGIT",
"addST",
"addPG",
"preview",
819 "moveCategory",
"deleteCategory",
"addPhrase",
"addCategory",
"savePhrase",
820 "addSelectedPhrase",
"cancelViewPhrase",
"confirmSavePhrase",
"cancelSavePhrase",
821 "insertBeforeCategory",
"insertAfterCategory",
"confirmDeleteCategory",
822 "cancelDeleteCategory",
"categories",
"saveCategories",
823 "savePhrase",
"addPhrase"
825 array(
"ilobjsurveyquestionpoolgui",
"ilsurveyphrasesgui"),
830 $this->tabs_gui->addTarget(
832 $this->
ctrl->getLinkTarget($this,
"infoScreen"),
833 array(
"infoScreen",
"showSummary")
839 $this->tabs_gui->addTarget(
841 $this->
ctrl->getLinkTarget($this,
'properties'),
842 array(
"properties",
"saveProperties"),
848 $this->tabs_gui->addTarget(
850 $this->
ctrl->getLinkTargetByClass(
"ilsurveyphrasesgui",
"phrases"),
851 array(
"phrases",
"deletePhrase",
"confirmDeletePhrase",
"cancelDeletePhrase",
"editPhrase",
"newPhrase",
"saveEditPhrase",
"phraseEditor"),
852 "ilsurveyphrasesgui",
858 $mdtab = $mdgui->getTab();
860 $this->tabs_gui->addTarget(
869 $this->tabs_gui->addTarget(
871 $this->
ctrl->getLinkTarget($this,
'export'),
872 array(
"export",
"createExportFile",
"confirmDeleteExportFile",
873 "downloadExportFile",
"cancelDeleteExportFile",
"deleteExportFile"),
880 $this->tabs_gui->addTarget(
882 $this->
ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"),
883 array(
"perm",
"info",
"owner"),
894 $obligatory = $this->edit_request->getObligatory();
895 $this->
object->setObligatoryStates($obligatory);
897 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'),
true);
898 $this->
ctrl->redirect($this,
"questions");
904 public static function _goto(
string $a_target): void
907 $main_tpl =
$DIC->ui()->mainTemplate();
910 $ilAccess =
$DIC->access();
913 if ($ilAccess->checkAccess(
"visible",
"", $a_target) ||
914 $ilAccess->checkAccess(
"read",
"", $a_target)) {
918 $main_tpl->setOnScreenMessage(
'failure', sprintf(
919 $lng->
txt(
"msg_no_perm_read_item"),
static _getQuestionGUI(?string $questiontype, int $question_id=-1)
Creates a question gui representation.
static _getTitle(int $question_id)
Returns the question title of a question with a given id.
static _getQuestionTypeName(string $type_tag)
Return the translation for a given question type.
static _getQuestionType(int $question_id)
Returns the question type of a question with a given id.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
@inheritDoc
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@inheritDoc
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
@classDescription Date and time handling
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
setScreenIdComponent(string $a_comp)
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...
addItem(string $a_title, string $a_link, string $a_frame="", int $a_ref_id=0, ?string $type=null)
static getLogger(string $a_component_id)
Get component logger.
Component logger with individual log levels by component id.
Navigation History of Repository Items.
Class ilObjSurveyQuestionPoolGUI.
uploadQuestionsObject()
imports question(s) into the questionpool
saveObligatoryObject()
Save obligatory states.
copyObject()
Copies checked questions in the questionpool to a clipboard.
ILIAS SurveyQuestionPool Editing EditManager $edit_manager
static _goto(string $a_target)
Redirect script to call a survey question pool reference id.
previewObject()
create preview of object
resetfilterQuestionBrowserObject()
afterSave(ilObject $new_object)
Post (successful) object creation hook.
downloadExportFileObject()
download export file
infoScreenObject()
this one is called from the info button in the repository
propertiesObject(ilPropertyFormGUI $a_form=null)
Edit question pool properties.
cancelDeleteExportFileObject()
infoScreenForward()
show information screen
getTabs()
@abstract overwrite in derived GUI class of your object type
pasteObject()
paste questions from the clipboard into the question pool
filterQuestionBrowserObject()
EditingGUIRequest $edit_request
createQuestionObject()
create new question
importFileObject(int $parent_id=null)
ilNavigationHistory $nav_history
importQuestionsObject()
display the import form to import questions into the question pool
exportObject()
list all export files
initCreationForms(string $new_type)
Init creation forms.
deleteQuestionsObject()
Creates a confirmation form to delete questions from the question pool.
cancelDeleteQuestionsObject()
exportQuestionObject()
export a question
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
questionsObject()
list questions of question pool
initImportForm(string $new_type)
confirmDeleteQuestionsObject()
updateObject()
updates object entry in object_data
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getQuestiontypes()
Get all available question types.
GUI class for the workflow of copying objects.
Class ilObjectGUI Basic methods of all Output classes.
ilGlobalTemplateInterface $tpl
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
ilObjectService $object_service
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
prepareOutput(bool $show_sub_objects=true)
initCreateForm(string $new_type)
putObjectInTree(ilObject $obj, int $parent_node_id=null)
Add object to tree at given position.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static clear(string $a_var)
Survey phrases GUI class The ilSurveyPhrases GUI class creates the GUI output for survey phrases (col...
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
This class represents a text property in a property form.
static getStyleSheetLocation(string $mode="output", string $a_css_name="", string $a_css_location="")
get full style sheet file name (path inclusive) of current user
static redirect(string $a_script)
Interface ilCtrlBaseClassInterface describes ilCtrl base classes.
setContent(string $a_html)
Sets content for standard template.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc