24 include_once
"./Services/Object/classes/class.ilObjectGUI.php";
74 $this->lng = $DIC->language();
75 $this->nav_history = $DIC[
"ilNavigationHistory"];
76 $this->tpl = $DIC[
"tpl"];
77 $this->
user = $DIC->user();
78 $this->toolbar = $DIC->toolbar();
79 $this->error = $DIC[
"ilErr"];
80 $this->locator = $DIC[
"ilLocator"];
81 $this->help = $DIC[
"ilHelp"];
82 $lng = $DIC->language();
86 $lng->loadLanguageModule(
"survey");
88 $this->ctrl->saveParameter($this, array(
"ref_id"));
90 parent::__construct(
"",
$_GET[
"ref_id"],
true,
false);
110 $ilNavigationHistory->addItem(
112 "ilias.php?baseClass=ilObjSurveyQuestionPoolGUI&cmd=questions&ref_id=" . $this->ref_id,
120 $cmd = $this->ctrl->getCmd(
"questions");
121 $next_class = $this->ctrl->getNextClass($this);
122 $this->ctrl->setReturn($this,
"questions");
123 if (
$_GET[
"q_id"] < 1) {
124 $q_type = (
$_POST[
"sel_question_types"] !=
"")
125 ?
$_POST[
"sel_question_types"]
126 :
$_GET[
"sel_question_types"];
129 $this->log->debug(
"- cmd=" . $cmd .
" next_class=" . $next_class);
130 switch ($next_class) {
131 case 'ilobjectmetadatagui':
133 include_once
'Services/Object/classes/class.ilObjectMetaDataGUI.php';
135 $this->ctrl->forwardCommand($md_gui);
138 case 'ilpermissiongui':
139 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
141 $ret = &$this->ctrl->forwardCommand($perm_gui);
144 case "ilsurveyphrasesgui":
145 include_once(
"./Modules/SurveyQuestionPool/classes/class.ilSurveyPhrasesGUI.php");
147 $ret = &$this->ctrl->forwardCommand($phrases_gui);
150 case 'ilobjectcopygui':
151 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
154 $this->ctrl->forwardCommand($cp);
157 case 'ilinfoscreengui':
161 case "ilcommonactiondispatchergui":
162 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
164 $this->ctrl->forwardCommand($gui);
169 $ret = &$this->$cmd();
173 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
175 $this->log->debug(
"- This is the switch/case default, going to question id =" .
$_GET[
"q_id"]);
177 $q_gui->setQuestionTabs();
178 $ret = &$this->ctrl->forwardCommand($q_gui);
181 if ($q_gui->object->isComplete()) {
182 $this->tpl->setTitle($this->lng->txt(
"question") .
": " . $q_gui->object->getTitle());
186 if (strtolower(
$_GET[
"baseClass"]) !=
"iladministrationgui" &&
196 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
198 $form->setFormAction($this->ctrl->getFormAction($this,
'properties'));
199 $form->setTitle($this->lng->txt(
"properties"));
200 $form->setMultipart(
false);
201 $form->setId(
"properties");
205 $title->setSubmitFormOnEnter(
true);
206 $title->setValue($this->object->getTitle());
209 $title->setRequired(
true);
214 $desc->
setValue($this->object->getLongDescription());
217 $form->addItem($desc);
221 $online->
setInfo($this->lng->txt(
"spl_online_property_description"));
222 $online->setChecked($this->object->getOnline());
223 $form->addItem($online);
226 $section->setTitle($this->lng->txt(
'obj_presentation'));
230 $obj_service->commonSettings()->legacyForm(
$form, $this->
object)->addTileImage();
233 $form->addCommandButton(
"saveProperties", $this->lng->txt(
"save"));
247 $this->tpl->setVariable(
"ADM_CONTENT", $a_form->getHTML());
257 if (
$form->checkInput()) {
258 $this->
object->setTitle(
$form->getInput(
"title"));
259 $this->
object->setDescription(
$form->getInput(
"desc"));
260 $this->
object->setOnline((
int)
$form->getInput(
"online"));
262 $this->
object->saveToDb();
265 $obj_service->commonSettings()->legacyForm(
$form, $this->
object)->saveTileImage();
268 ilUtil::sendSuccess($this->lng->txt(
"saved_successfully"),
true);
269 $this->ctrl->redirect($this,
"properties");
272 $form->setValuesByPost();
282 if (count(
$_POST[
"q_id"]) > 0) {
284 $this->
object->copyToClipboard($value);
290 $this->ctrl->redirect($this,
"questions");
298 if (count(
$_POST[
"q_id"]) > 0) {
300 $this->
object->moveToClipboard($value);
306 $this->ctrl->redirect($this,
"questions");
314 if (is_array(
$_POST[
'q_id']) && count(
$_POST[
'q_id']) > 0) {
330 $checked_questions =
$_POST[
'q_id'];
331 if (count($checked_questions) == 0) {
337 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
339 $cgui->setHeaderText($this->lng->txt(
"qpl_confirm_delete_questions"));
341 $cgui->setFormAction($this->ctrl->getFormAction($this));
342 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancelDeleteQuestions");
343 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmDeleteQuestions");
345 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
346 $infos = $this->
object->getQuestionInfos($checked_questions);
347 foreach ($infos as
$data) {
348 $txt = $data[
"title"] .
" (" .
350 if ($data[
"description"]) {
351 $txt .=
"<div class=\"small\">" . $data[
"description"] .
"</div>";
354 $cgui->addItem(
"q_id[]", $data[
"id"],
$txt);
357 $this->tpl->setContent($cgui->getHTML());
366 ilUtil::sendSuccess($this->lng->txt(
"qpl_questions_deleted"),
true);
367 foreach (
$_POST[
'q_id'] as $q_id) {
368 $this->
object->removeQuestion($q_id);
370 $this->ctrl->redirect($this,
"questions");
379 $this->ctrl->redirect($this,
"questions");
387 if (array_key_exists(
"spl_clipboard",
$_SESSION)) {
388 $this->
object->pasteFromClipboard();
392 $this->ctrl->redirect($this,
"questions");
402 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
404 $form->setFormAction($this->ctrl->getFormAction($this,
"uploadQuestions"));
405 $form->setTitle($this->lng->txt(
"import_question"));
407 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
408 $fi =
new ilFileInputGUI($this->lng->txt(
"select_file"),
"qtidoc");
410 $fi->setRequired(
true);
413 $form->addCommandButton(
"uploadQuestions", $this->lng->txt(
"import"));
414 $form->addCommandButton(
"questions", $this->lng->txt(
"cancel"));
425 $source = $_FILES[
"qtidoc"][
"tmp_name"];
427 if ((
$source ==
'none') || (!
$source) || $_FILES[
"qtidoc"][
"error"] > UPLOAD_ERR_OK) {
431 if (!
$error && strpos(
"xml", $_FILES[
"qtidoc"][
"type"]) !==
false) {
437 $this->
object->createImportDirectory();
440 $full_path = $this->
object->getImportDirectory() .
"/" . $_FILES[
"qtidoc"][
"name"];
442 ilUtil::moveUploadedFile(
443 $_FILES[
"qtidoc"][
"tmp_name"],
444 $_FILES[
"qtidoc"][
"name"],
448 $this->
object->importObject(
$source,
true);
451 $this->ctrl->redirect($this,
"questions");
456 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionsTableGUI.php";
458 $table_gui->writeFilterToSession();
459 $this->ctrl->redirect($this,
'questions');
464 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionsTableGUI.php";
466 $table_gui->resetFilter();
467 $this->ctrl->redirect($this,
'questions');
478 $this->
object->purgeQuestions();
483 include_once
"Services/Form/classes/class.ilSelectInputGUI.php";
485 $qtypes->setValue(
$ilUser->getPref(
"svy_lastquestiontype"));
486 $ilToolbar->addInputItem($qtypes);
489 foreach (ilObjSurveyQuestionPool::_getQuestionTypes() as $translation =>
$data) {
494 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
496 include_once
"Services/UIComponent/Button/classes/class.ilSubmitButton.php";
498 $button->setCaption(
"svy_create_question");
499 $button->setCommand(
"createQuestion");
500 $ilToolbar->addButtonInstance($button);
502 $ilToolbar->addSeparator();
505 $button->setCaption(
"import");
506 $button->setCommand(
"importQuestions");
507 $ilToolbar->addButtonInstance($button);
510 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionsTableGUI.php";
513 $arrFilter = array();
514 foreach ($table_gui->getFilterItems() as $item) {
515 if ($item->getValue() !==
false) {
516 $arrFilter[$item->getPostVar()] = $item->getValue();
519 $table_gui->setData($this->object->getQuestionsData($arrFilter));
520 $this->tpl->setContent($table_gui->getHTML());
525 $this->
update = $this->
object->update();
526 ilUtil::sendSuccess($this->lng->txt(
"msg_obj_modified"),
true);
532 ilUtil::sendSuccess($this->lng->txt(
"object_added"),
true);
535 "&baseClass=ilObjSurveyQuestionPoolGUI");
545 $ilToolbar->addButton(
546 $this->lng->txt(
'create_export_file'),
547 $this->ctrl->getLinkTarget($this,
'createExportFile')
550 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionPoolExportTableGUI.php";
552 $export_dir = $this->
object->getExportDirectory();
553 $export_files = $this->
object->getExportFiles($export_dir);
555 foreach ($export_files as $exp_file) {
556 $file_arr = explode(
"__", $exp_file);
559 $table_gui->setData(
$data);
560 $this->tpl->setContent($table_gui->getHTML());
570 include_once(
"./Modules/SurveyQuestionPool/classes/class.ilSurveyQuestionpoolExport.php");
572 $survey_exp->buildExportFile($questions);
573 $this->ctrl->redirect($this,
"export");
581 if (!isset(
$_POST[
"file"])) {
583 $this->ctrl->redirect($this,
"export");
586 if (count(
$_POST[
"file"]) > 1) {
588 $this->ctrl->redirect($this,
"export");
592 $export_dir = $this->
object->getExportDirectory();
594 $file = basename(
$_POST[
"file"][0]);
604 if (!isset(
$_POST[
"file"])) {
606 $this->ctrl->redirect($this,
"export");
610 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionPoolExportTableGUI.php";
612 $export_dir = $this->
object->getExportDirectory();
614 foreach (
$_POST[
'file'] as $exp_file) {
615 $file_arr = explode(
"__", $exp_file);
618 $table_gui->setData(
$data);
619 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
629 $this->ctrl->redirect($this,
"export");
637 $export_dir = $this->
object->getExportDirectory();
638 foreach (
$_POST[
'file'] as $file) {
639 $file = basename($file);
641 $exp_file = $export_dir .
"/" . $file;
642 $exp_dir = $export_dir .
"/" . substr($file, 0, strlen($file) - 4);
643 if (@is_file($exp_file)) {
646 if (@is_dir($exp_dir)) {
650 $this->ctrl->redirect($this,
"export");
655 $form = parent::initImportForm($a_new_type);
656 $form->getItemByPostVar(
'importfile')->setSuffixes(array(
"zip",
"xml"));
665 $forms = array(self::CFORM_NEW => $this->
initCreateForm($a_new_type),
666 self::CFORM_IMPORT =>
$form);
680 $parent_id =
$_GET[
"ref_id"];
682 $new_type = $_REQUEST[
"new_type"];
686 $ilErr->raiseError($this->lng->txt(
"no_create_permission"));
689 $this->lng->loadLanguageModule($new_type);
690 $this->ctrl->setParameter($this,
"new_type", $new_type);
693 if (
$form->checkInput()) {
694 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
696 $newObj->setType($new_type);
697 $newObj->setTitle(
"dummy");
698 $newObj->create(
true);
701 $newObj->createImportDirectory();
704 $upload = $_FILES[
"importfile"];
705 $file = pathinfo($upload[
"name"]);
706 $full_path = $newObj->getImportDirectory() .
"/" . $upload[
"name"];
707 ilUtil::moveUploadedFile(
714 $qtiresult = $newObj->importObject($full_path);
716 ilUtil::sendSuccess($this->lng->txt(
"object_imported"),
true);
718 "&baseClass=ilObjSurveyQuestionPoolGUI");
722 $form->setValuesByPost();
733 $ilUser->writePref(
"svy_lastquestiontype",
$_POST[
"sel_question_types"]);
735 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
737 $q_gui->object->setObjId($this->object->getId());
738 $q_gui->object->createNewQuestion();
740 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id", $q_gui->object->getId());
741 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types",
$_POST[
"sel_question_types"]);
742 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
750 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
752 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types", $q_gui->getQuestionType());
753 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id",
$_GET[
"preview"]);
754 $this->ctrl->redirectByClass(get_class($q_gui),
"preview");
764 $this->ctrl->setCmd(
"showSummary");
765 $this->ctrl->setCmdClass(
"ilinfoscreengui");
778 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
780 $info->enablePrivateNotes();
783 $info->addMetaDataSections($this->object->getId(), 0, $this->
object->getType());
785 $this->ctrl->forwardCommand(
$info);
791 switch ($this->ctrl->getCmd()) {
797 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"",
$_GET[
"ref_id"]);
800 if ((
int)
$_GET[
"q_id"]) {
801 $q_id = (int)
$_GET[
"q_id"];
802 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
807 $this->ctrl->setParameterByClass($q_type,
"q_id", $q_id);
810 $this->ctrl->getLinkTargetByClass($q_type,
"editQuestion")
825 $ilHelp->setScreenIdComponent(
"spl");
827 $next_class = $this->ctrl->getNextClass($this);
828 switch ($next_class) {
830 case "ilpermissiongui":
831 case "ilobjectmetadatagui":
832 case "ilsurveyphrasesgui":
840 $force_active = (($this->ctrl->getCmdClass() ==
"" &&
841 $this->ctrl->getCmd() !=
"properties" && $this->ctrl->getCmd() !=
"infoScreen") ||
842 $this->ctrl->getCmd() ==
"")
845 if (!$force_active) {
846 if (is_array(
$_GET[
"sort"])) {
847 $force_active =
true;
852 $this->tabs_gui->addTarget(
854 $this->ctrl->getLinkTarget($this,
'questions'),
855 array(
"questions",
"filterQuestionBrowser",
"filter",
"reset",
"createQuestion",
856 "importQuestions",
"deleteQuestions",
"copy",
"paste",
857 "exportQuestions",
"confirmDeleteQuestions",
"cancelDeleteQuestions",
858 "confirmPasteQuestions",
"cancelPasteQuestions",
"uploadQuestions",
859 "editQuestion",
"addMaterial",
"removeMaterial",
"save",
"cancel",
860 "cancelExplorer",
"linkChilds",
"addGIT",
"addST",
"addPG",
"preview",
861 "moveCategory",
"deleteCategory",
"addPhrase",
"addCategory",
"savePhrase",
862 "addSelectedPhrase",
"cancelViewPhrase",
"confirmSavePhrase",
"cancelSavePhrase",
863 "insertBeforeCategory",
"insertAfterCategory",
"confirmDeleteCategory",
864 "cancelDeleteCategory",
"categories",
"saveCategories",
865 "savePhrase",
"addPhrase" 867 array(
"ilobjsurveyquestionpoolgui",
"ilsurveyphrasesgui"),
872 $this->tabs_gui->addTarget(
874 $this->ctrl->getLinkTarget($this,
"infoScreen"),
875 array(
"infoScreen",
"showSummary")
881 $this->tabs_gui->addTarget(
883 $this->ctrl->getLinkTarget($this,
'properties'),
884 array(
"properties",
"saveProperties"),
890 $this->tabs_gui->addTarget(
892 $this->ctrl->getLinkTargetByClass(
"ilsurveyphrasesgui",
"phrases"),
893 array(
"phrases",
"deletePhrase",
"confirmDeletePhrase",
"cancelDeletePhrase",
"editPhrase",
"newPhrase",
"saveEditPhrase",
"phraseEditor"),
894 "ilsurveyphrasesgui",
899 include_once
"Services/Object/classes/class.ilObjectMetaDataGUI.php";
901 $mdtab = $mdgui->getTab();
903 $this->tabs_gui->addTarget(
912 $this->tabs_gui->addTarget(
914 $this->ctrl->getLinkTarget($this,
'export'),
915 array(
"export",
"createExportFile",
"confirmDeleteExportFile",
916 "downloadExportFile",
"cancelDeleteExportFile",
"deleteExportFile"),
923 $this->tabs_gui->addTarget(
925 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"),
926 array(
"perm",
"info",
"owner"),
937 $obligatory = array();
939 if (preg_match(
"/obligatory_(\d+)/",
$key, $matches)) {
940 $obligatory[] = $matches[1];
943 $this->
object->setObligatoryStates($obligatory);
945 ilUtil::sendSuccess($this->lng->txt(
'msg_obj_modified'),
true);
946 $this->ctrl->redirect($this,
"questions");
955 public static function _goto($a_target)
959 $ilAccess = $DIC->access();
960 $lng = $DIC->language();
962 if ($ilAccess->checkAccess(
"visible",
"", $a_target) ||
963 $ilAccess->checkAccess(
"read",
"", $a_target)) {
964 $_GET[
"baseClass"] =
"ilObjSurveyQuestionPoolGUI";
965 $_GET[
"cmd"] =
"infoScreen";
966 $_GET[
"ref_id"] = $a_target;
967 include_once(
"ilias.php");
969 } elseif ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID)) {
971 $lng->txt(
"msg_no_perm_read_item"),
Class ilObjSurveyQuestionPoolGUI.
cancelDeleteQuestionsObject()
cancel delete questions
importQuestionsObject()
display the import form to import questions into the questionpool
confirmDeleteQuestionsObject()
delete questions
resetfilterQuestionBrowserObject()
confirmDeleteExportFileObject()
confirmation screen for export file deletion
GUI class for the workflow of copying objects.
const TITLE_LENGTH
max length of object title
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
copyObject()
Copies checked questions in the questionpool to a clipboard.
static _getTitle($question_id)
Returns the question title of a question with a given id.
saveObligatoryObject()
Save obligatory states.
setValue($a_value)
Set Value.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static _getQuestionType($question_id)
Returns the question type of a question with a given id.
static _lookupTitle($a_id)
lookup object title
Survey phrases GUI class.
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
downloadExportFileObject()
download export file
initImportForm($a_new_type)
static _getQuestionGUI($questiontype, $question_id=-1)
Creates a question gui representation.
cancelDeleteExportFileObject()
cancel deletion of export files
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static _goto($a_target)
Redirect script to call a survey question pool reference id.
savePropertiesObject()
Save questionpool properties.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
prepareOutput($a_show_subobjects=true)
prepare output
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
questionsObject($arrFilter=null)
list questions of question pool
if(isset($_POST['submit'])) $form
deleteExportFileObject()
delete export files
importFileObject($parent_id=null, $a_catch_errors=true)
form for new survey object import
Export class for survey questionpools.
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
This class represents a text property in a property form.
afterSave(ilObject $a_new_object)
static clear($a_var)
Unset a value.
initCreateForm($a_new_type)
Init object creation form.
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
executeCommand()
execute command
propertiesObject(ilPropertyFormGUI $a_form=null)
Questionpool properties.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
__construct()
Constructor public.
& previewObject()
create preview of object
initCreationForms($a_new_type)
deleteQuestionsObject()
Creates a confirmation form to delete questions from the question pool.
update($pash, $contents, Config $config)
getTabs()
adds tabs to tab gui object
infoScreenForward()
show information screen
filterQuestionBrowserObject()
createExportFileObject($questions=null)
create export file
This class represents a text area property in a property form.
getCreationMode()
get creation mode
getRefId()
get reference id public
uploadQuestionsObject()
imports question(s) into the questionpool
putObjectInTree(ilObject $a_obj, $a_parent_node_id=null)
Add object to tree at given position.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static getLogger($a_component_id)
Get component logger.
moveObject()
mark one or more question objects for moving
& createQuestionObject()
create new question
static redirect($a_script)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
exportQuestionObject()
export a question
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
pasteObject()
paste questios from the clipboard into the question pool
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
Confirmation screen class.