24 include_once
"./classes/class.ilObjectGUI.php";
25 include_once
"./Modules/Survey/classes/inc.SurveyConstants.php";
55 $lng->loadLanguageModule(
"survey");
57 $this->ctrl->saveParameter($this, array(
"ref_id",
"calling_survey",
"new_for_survey",
"pgov",
"pgov_pos"));
67 global $ilAccess, $ilNavigationHistory;
69 if ((!$ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"])) && (!$ilAccess->checkAccess(
"visible",
"",
$_GET[
"ref_id"])))
72 $ilias->raiseError($this->lng->txt(
"permission_denied"), $ilias->error_obj->MESSAGE);
76 $ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"]))
78 $ilNavigationHistory->addItem(
$_GET[
"ref_id"],
79 "ilias.php?baseClass=ilObjSurveyQuestionPoolGUI&cmd=questions&ref_id=".
$_GET[
"ref_id"],
"spl");
84 $cmd = $this->ctrl->getCmd(
"questions");
85 $next_class = $this->ctrl->getNextClass($this);
86 $this->ctrl->setReturn($this,
"questions");
87 if (
$_GET[
"q_id"] < 1)
89 $q_type = (
$_POST[
"sel_question_types"] !=
"")
90 ?
$_POST[
"sel_question_types"]
91 :
$_GET[
"sel_question_types"];
96 include_once
"./Services/MetaData/classes/class.ilMDEditorGUI.php";
97 $md_gui =&
new ilMDEditorGUI($this->object->getId(), 0, $this->
object->getType());
98 $md_gui->
addObserver($this->
object,
'MDUpdateListener',
'General');
100 $this->ctrl->forwardCommand($md_gui);
103 case 'ilpermissiongui':
104 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
106 $ret =& $this->ctrl->forwardCommand($perm_gui);
109 case "ilsurveyphrasesgui":
110 include_once(
"./Modules/SurveyQuestionPool/classes/class.ilSurveyPhrasesGUI.php");
112 $ret =& $this->ctrl->forwardCommand($phrases_gui);
115 case 'ilobjectcopygui':
116 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
119 $this->ctrl->forwardCommand($cp);
122 case 'ilinfoscreengui':
132 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
134 $q_gui->object->setObjId($this->object->getId());
135 $q_gui->setQuestionTabs();
136 $ret =& $this->ctrl->forwardCommand($q_gui);
139 if (strtolower(
$_GET[
"baseClass"]) !=
"iladministrationgui" &&
159 $save = ((strcmp($this->ctrl->getCmd(),
"save") == 0)) ?
true :
false;
161 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
163 $form->setFormAction($this->ctrl->getFormAction($this,
'properties'));
164 $form->setTitle($this->lng->txt(
"properties"));
165 $form->setMultipart(
false);
166 $form->setId(
"properties");
170 $online->
setInfo($this->lng->txt(
"spl_online_property_description"));
171 $online->setChecked($this->object->getOnline());
172 $form->addItem($online);
174 $form->addCommandButton(
"saveProperties", $this->lng->txt(
"save"));
180 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
188 $qpl_online =
$_POST[
"online"];
189 if (strlen($qpl_online) == 0) $qpl_online =
"0";
190 $this->
object->setOnline($qpl_online);
191 $this->
object->saveToDb();
193 $this->ctrl->redirect($this,
"properties");
202 if (count(
$_POST[
"q_id"]) > 0)
204 foreach (
$_POST[
"q_id"] as $key => $value)
206 $this->
object->copyToClipboard($value);
214 $this->ctrl->redirect($this,
"questions");
222 if (count(
$_POST[
"q_id"]) > 0)
224 foreach (
$_POST[
"q_id"] as $key => $value)
226 $this->
object->moveToClipboard($value);
234 $this->ctrl->redirect($this,
"questions");
242 if (is_array(
$_POST[
'q_id']) && count(
$_POST[
'q_id']) > 0)
262 $checked_questions =
$_POST[
'q_id'];
263 if (count($checked_questions) > 0)
265 if ($rbacsystem->checkAccess(
'write', $this->ref_id))
276 elseif (count($checked_questions) == 0)
282 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_confirm_delete_questions.html",
"Modules/SurveyQuestionPool");
283 $infos = $this->
object->getQuestionInfos($checked_questions);
284 $colors = array(
"tblrow1",
"tblrow2");
286 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
287 foreach ($infos as
$data)
289 $this->tpl->setCurrentBlock(
"row");
290 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
291 $this->tpl->setVariable(
"TXT_TITLE", $data[
"title"]);
292 $this->tpl->setVariable(
"TXT_DESCRIPTION", $data[
"description"]);
294 $this->tpl->parseCurrentBlock();
297 foreach ($checked_questions as $id)
299 $this->tpl->setCurrentBlock(
"hidden");
300 $this->tpl->setVariable(
"HIDDEN_NAME",
"q_id[]");
301 $this->tpl->setVariable(
"HIDDEN_VALUE", $id);
302 $this->tpl->parseCurrentBlock();
305 $this->tpl->setCurrentBlock(
"adm_content");
306 $this->tpl->setVariable(
"TXT_TITLE", $this->lng->txt(
"title"));
307 $this->tpl->setVariable(
"TXT_DESCRIPTION", $this->lng->txt(
"description"));
308 $this->tpl->setVariable(
"TXT_TYPE", $this->lng->txt(
"question_type"));
309 $this->tpl->setVariable(
"BTN_CONFIRM", $this->lng->txt(
"confirm"));
310 $this->tpl->setVariable(
"BTN_CANCEL", $this->lng->txt(
"cancel"));
311 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
312 $this->tpl->parseCurrentBlock();
322 foreach (
$_POST[
'q_id'] as $q_id)
324 $this->
object->removeQuestion($q_id);
326 $this->ctrl->redirect($this,
"questions");
335 $this->ctrl->redirect($this,
"questions");
343 if (array_key_exists(
"spl_clipboard",
$_SESSION))
345 $this->
object->pasteFromClipboard();
351 $this->ctrl->redirect($this,
"questions");
359 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_import_question.html",
"Modules/SurveyQuestionPool");
360 $this->tpl->setCurrentBlock(
"adm_content");
361 $this->tpl->setVariable(
"TEXT_IMPORT_QUESTION", $this->lng->txt(
"import_question"));
362 $this->tpl->setVariable(
"TEXT_SELECT_FILE", $this->lng->txt(
"select_file"));
363 $this->tpl->setVariable(
"TEXT_UPLOAD", $this->lng->txt(
"upload"));
364 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
365 $this->tpl->parseCurrentBlock();
374 $source = $_FILES[
"qtidoc"][
"tmp_name"];
376 if (($source ==
'none') || (!$source) || $_FILES[
"qtidoc"][
"error"] > UPLOAD_ERR_OK)
381 if (strpos(
"xml", $_FILES[
"qtidoc"][
"type"]) !== FALSE)
389 $this->
object->createImportDirectory();
392 $full_path = $this->
object->getImportDirectory().
"/".$_FILES[
"qtidoc"][
"name"];
394 include_once
"./Services/Utilities/classes/class.ilUtil.php";
396 $_FILES[
"qtidoc"][
"name"], $full_path);
397 $source = $full_path;
398 $this->
object->importObject($source, TRUE);
401 $this->ctrl->redirect($this,
"questions");
406 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionsTableGUI.php";
408 $table_gui->writeFilterToSession();
409 $this->ctrl->redirect($this,
'questions');
414 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionsTableGUI.php";
416 $table_gui->resetFilter();
417 $this->ctrl->redirect($this,
'questions');
428 if(get_class($this->
object) ==
"ilObjSurvey")
430 if ((
$_GET[
"calling_survey"] > 0) || (
$_GET[
"new_for_survey"] > 0))
435 if (strlen(
$_GET[
"new_for_survey"]))
437 $addurl =
"&new_id=" .
$_GET[
"q_id"];
441 $addurl .=
"&pgov=".$_REQUEST[
"pgov"];
442 $addurl .=
"&pgov_pos=".$_REQUEST[
"pgov_pos"];
449 $this->
object->purgeQuestions();
452 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_questionbrowser.html",
"Modules/SurveyQuestionPool");
453 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionsTableGUI.php";
455 $table_gui->
setEditable($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']));
456 $arrFilter = array();
457 foreach ($table_gui->getFilterItems() as $item)
459 if ($item->getValue() !==
false)
461 $arrFilter[$item->getPostVar()] = $item->getValue();
464 $data = $this->
object->getQuestionsData($arrFilter);
465 $table_gui->setData(
$data);
466 $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());
468 if ($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']))
470 $this->tpl->setCurrentBlock(
"QTypes");
471 $types =& ilObjSurveyQuestionPool::_getQuestionTypes();
472 $lastquestiontype = $ilUser->getPref(
"svy_lastquestiontype");
473 foreach ($types as $translation =>
$data)
475 if (
$data[
"type_tag"] == $lastquestiontype)
477 $this->tpl->setVariable(
"QUESTION_TYPE_SELECTED",
" selected=\"selected\"");
479 $this->tpl->setVariable(
"QUESTION_TYPE_ID",
$data[
"type_tag"]);
480 $this->tpl->setVariable(
"QUESTION_TYPE", $translation);
481 $this->tpl->parseCurrentBlock();
483 $this->tpl->setVariable(
"QUESTION_ADD", $this->lng->txt(
"create"));
484 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
'questions'));
485 $this->tpl->parseCurrentBlock();
491 $this->update = $this->
object->update();
501 "&baseClass=ilObjSurveyQuestionPoolGUI");
509 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionPoolExportTableGUI.php";
511 $export_dir = $this->
object->getExportDirectory();
512 $export_files = $this->
object->getExportFiles($export_dir);
514 foreach ($export_files as $exp_file)
516 $file_arr = explode(
"__", $exp_file);
519 $table_gui->setData(
$data);
520 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
530 if ($rbacsystem->checkAccess(
"write", $this->ref_id))
532 include_once(
"./Modules/SurveyQuestionPool/classes/class.ilSurveyQuestionpoolExport.php");
534 $survey_exp->buildExportFile($questions);
535 $this->ctrl->redirect($this,
"export");
548 if(!isset(
$_POST[
"file"]))
551 $this->ctrl->redirect($this,
"export");
554 if (count(
$_POST[
"file"]) > 1)
557 $this->ctrl->redirect($this,
"export");
561 $export_dir = $this->
object->getExportDirectory();
562 include_once
"./Services/Utilities/classes/class.ilUtil.php";
574 if(!isset(
$_POST[
"file"]))
577 $this->ctrl->redirect($this,
"export");
581 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionPoolExportTableGUI.php";
583 $export_dir = $this->
object->getExportDirectory();
585 foreach (
$_POST[
'file'] as $exp_file)
587 $file_arr = explode(
"__", $exp_file);
590 $table_gui->setData(
$data);
591 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
600 session_unregister(
"ilExportFiles");
601 $this->ctrl->redirect($this,
"export");
609 $export_dir = $this->
object->getExportDirectory();
612 $file = basename($file);
614 $exp_file = $export_dir.
"/".
$file;
615 $exp_dir = $export_dir.
"/".substr($file, 0, strlen($file) - 4);
616 if (@is_file($exp_file))
620 if (@is_dir($exp_dir))
622 include_once
"./Services/Utilities/classes/class.ilUtil.php";
626 $this->ctrl->redirect($this,
"export");
632 $form->getItemByPostVar(
'importfile')->setSuffixes(array(
"zip",
"xml"));
641 $forms = array(self::CFORM_NEW => $this->
initCreateForm($a_new_type),
642 self::CFORM_IMPORT => $form);
654 $parent_id =
$_GET[
"ref_id"];
660 $ilErr->raiseError($this->lng->txt(
"no_create_permission"));
663 $this->lng->loadLanguageModule($new_type);
664 $this->ctrl->setParameter($this,
"new_type", $new_type);
667 if ($form->checkInput())
669 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
671 $newObj->setType($new_type);
672 $newObj->setTitle(
"dummy");
673 $newObj->create(
true);
676 $newObj->createImportDirectory();
679 $upload = $_FILES[
"importfile"];
680 $file = pathinfo($upload[
"name"]);
681 $full_path = $newObj->getImportDirectory().
"/".$upload[
"name"];
682 include_once
"./Services/Utilities/classes/class.ilUtil.php";
687 $qtiresult = $newObj->importObject($full_path);
691 "&baseClass=ilObjSurveyQuestionPoolGUI");
695 $form->setValuesByPost();
696 $tpl->setContent($form->getHtml());
705 $ilUser->writePref(
"svy_lastquestiontype",
$_POST[
"sel_question_types"]);
706 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
708 $q_gui->object->setObjId($this->object->getId());
709 $q_gui->object->createNewQuestion();
710 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id", $q_gui->object->getId());
711 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types",
$_POST[
"sel_question_types"]);
712 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
720 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
722 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types", $q_gui->getQuestionType());
723 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id",
$_GET[
"q_id"]);
724 $this->ctrl->setParameterByClass(get_class($q_gui),
"pgov",
$_GET[
"pgov"]);
725 $this->ctrl->setParameterByClass(get_class($q_gui),
"pgov_pos",
$_GET[
"pgov_pos"]);
726 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
734 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
736 $q_gui->object->createNewQuestion();
737 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id", $q_gui->object->getId());
738 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types", $q_gui->getQuestionType());
739 $this->ctrl->setParameterByClass(get_class($q_gui),
"pgov",
$_GET[
"pgov"]);
740 $this->ctrl->setParameterByClass(get_class($q_gui),
"pgov_pos",
$_GET[
"pgov_pos"]);
741 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
749 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
751 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types", $q_gui->getQuestionType());
752 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id",
$_GET[
"preview"]);
753 $this->ctrl->redirectByClass(get_class($q_gui),
"preview");
763 $this->ctrl->setCmd(
"showSummary");
764 $this->ctrl->setCmdClass(
"ilinfoscreengui");
775 if(!$ilAccess->checkAccess(
"visible",
"", $this->ref_id))
777 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"));
780 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
782 $info->enablePrivateNotes();
785 $info->addMetaDataSections($this->object->getId(), 0, $this->
object->getType());
787 $this->ctrl->forwardCommand($info);
793 switch ($this->ctrl->getCmd())
800 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"",
$_GET[
"ref_id"]);
803 if (
$_GET[
"q_id"] > 0)
805 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
807 $this->ctrl->setParameterByClass($q_type,
"q_id",
$_GET[
"q_id"]);
821 $next_class = $this->ctrl->getNextClass($this);
825 case "ilpermissiongui":
826 case "ilmdeditorgui":
827 case "ilsurveyphrasesgui":
833 if ((
$_GET[
"calling_survey"] > 0) || (
$_GET[
"new_for_survey"] > 0))
return;
835 $force_active = (($this->ctrl->getCmdClass() ==
"" &&
836 $this->ctrl->getCmd() !=
"properties") ||
837 $this->ctrl->getCmd() ==
"")
842 if (is_array(
$_GET[
"sort"]))
844 $force_active =
true;
847 $tabs_gui->addTarget(
"survey_questions",
848 $this->ctrl->getLinkTarget($this,
'questions'),
849 array(
"questions",
"filterQuestionBrowser",
"filter",
"reset",
"createQuestion",
850 "importQuestions",
"deleteQuestions",
"copy",
"paste",
851 "exportQuestions",
"confirmDeleteQuestions",
"cancelDeleteQuestions",
852 "confirmPasteQuestions",
"cancelPasteQuestions",
"uploadQuestions",
853 "editQuestion",
"addMaterial",
"removeMaterial",
"save",
"cancel",
854 "cancelExplorer",
"linkChilds",
"addGIT",
"addST",
"addPG",
"preview",
855 "moveCategory",
"deleteCategory",
"addPhrase",
"addCategory",
"savePhrase",
856 "addSelectedPhrase",
"cancelViewPhrase",
"confirmSavePhrase",
"cancelSavePhrase",
857 "insertBeforeCategory",
"insertAfterCategory",
"confirmDeleteCategory",
858 "cancelDeleteCategory",
"categories",
"saveCategories",
859 "savePhrase",
"addPhrase"
861 array(
"ilobjsurveyquestionpoolgui",
"ilsurveyphrasesgui"),
"", $force_active);
863 if ($ilAccess->checkAccess(
"visible",
"", $this->ref_id))
865 $tabs_gui->addTarget(
"info_short",
866 $this->ctrl->getLinkTarget($this,
"infoScreen"),
867 array(
"infoScreen",
"showSummary"));
870 if ($ilAccess->checkAccess(
'write',
'', $this->ref_id))
873 $tabs_gui->addTarget(
"settings",
874 $this->ctrl->getLinkTarget($this,
'properties'),
879 $tabs_gui->addTarget(
"manage_phrases",
880 $this->ctrl->getLinkTargetByClass(
"ilsurveyphrasesgui",
"phrases"),
881 array(
"phrases",
"deletePhrase",
"confirmDeletePhrase",
"cancelDeletePhrase",
"editPhrase",
"newPhrase",
"saveEditPhrase",
"phraseEditor"),
882 "ilsurveyphrasesgui",
"");
885 $tabs_gui->addTarget(
"meta_data",
886 $this->ctrl->getLinkTargetByClass(
'ilmdeditorgui',
'listSection'),
887 "",
"ilmdeditorgui");
890 $tabs_gui->addTarget(
"export",
891 $this->ctrl->getLinkTarget($this,
'export'),
892 array(
"export",
"createExportFile",
"confirmDeleteExportFile",
893 "downloadExportFile",
"cancelDeleteExportFile",
"deleteExportFile"),
897 if ($ilAccess->checkAccess(
"edit_permission",
"", $this->ref_id))
899 $tabs_gui->addTarget(
"perm_settings",
900 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
910 public static function _goto($a_target)
913 if ($ilAccess->checkAccess(
"write",
"", $a_target))
915 $_GET[
"baseClass"] =
"ilObjSurveyQuestionPoolGUI";
916 $_GET[
"cmd"] =
"questions";
917 $_GET[
"ref_id"] = $a_target;
918 include_once(
"ilias.php");
921 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
923 $_GET[
"cmd"] =
"frameset";
924 $_GET[
"target"] =
"";
925 $_GET[
"ref_id"] = ROOT_FOLDER_ID;
928 include(
"repository.php");
931 $ilErr->raiseError($lng->txt(
"msg_no_perm_read_lm"), $ilErr->FATAL);