24 include_once
"./Services/Object/classes/class.ilObjectGUI.php";
55 $lng->loadLanguageModule(
"survey");
57 $this->ctrl->saveParameter($this, array(
"ref_id"));
67 global $ilAccess, $ilNavigationHistory,
$ilErr;
69 if (!$ilAccess->checkAccess(
"visible",
"", $this->ref_id) &&
70 !$ilAccess->checkAccess(
"read",
"", $this->ref_id))
73 $ilias->raiseError($this->lng->txt(
"permission_denied"), $ilias->error_obj->MESSAGE);
78 $ilAccess->checkAccess(
"read",
"", $this->ref_id))
80 $ilNavigationHistory->addItem($this->ref_id,
81 "ilias.php?baseClass=ilObjSurveyQuestionPoolGUI&cmd=questions&ref_id=".$this->ref_id,
"spl");
87 $cmd = $this->ctrl->getCmd(
"questions");
88 $next_class = $this->ctrl->getNextClass($this);
89 $this->ctrl->setReturn($this,
"questions");
90 if (
$_GET[
"q_id"] < 1)
92 $q_type = (
$_POST[
"sel_question_types"] !=
"")
93 ?
$_POST[
"sel_question_types"]
94 :
$_GET[
"sel_question_types"];
98 case 'ilobjectmetadatagui':
99 if(!$ilAccess->checkAccess(
'write',
'',$this->object->getRefId()))
101 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->WARNING);
103 include_once
'Services/Object/classes/class.ilObjectMetaDataGUI.php';
105 $this->ctrl->forwardCommand($md_gui);
108 case 'ilpermissiongui':
109 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
111 $ret =& $this->ctrl->forwardCommand($perm_gui);
114 case "ilsurveyphrasesgui":
115 include_once(
"./Modules/SurveyQuestionPool/classes/class.ilSurveyPhrasesGUI.php");
117 $ret =& $this->ctrl->forwardCommand($phrases_gui);
120 case 'ilobjectcopygui':
121 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
124 $this->ctrl->forwardCommand($cp);
127 case 'ilinfoscreengui':
131 case "ilcommonactiondispatchergui":
132 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
134 $this->ctrl->forwardCommand($gui);
143 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
146 $q_gui->setQuestionTabs();
147 $ret =& $this->ctrl->forwardCommand($q_gui);
150 if($q_gui->object->isComplete())
152 $this->tpl->setTitle($this->lng->txt(
"question").
": ".$q_gui->object->getTitle());
156 if (strtolower(
$_GET[
"baseClass"]) !=
"iladministrationgui" &&
165 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
167 $form->setFormAction($this->ctrl->getFormAction($this,
'properties'));
168 $form->setTitle($this->lng->txt(
"properties"));
169 $form->setMultipart(
false);
170 $form->setId(
"properties");
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);
194 $form->addCommandButton(
"saveProperties", $this->lng->txt(
"save"));
209 $this->tpl->setVariable(
"ADM_CONTENT", $a_form->getHTML());
218 if($form->checkInput())
220 $this->
object->setTitle($form->getInput(
"title"));
221 $this->
object->setDescription($form->getInput(
"desc"));
222 $this->
object->setOnline((
int)$form->getInput(
"online"));
224 $this->
object->saveToDb();
227 $this->ctrl->redirect($this,
"properties");
230 $form->setValuesByPost();
240 if (count(
$_POST[
"q_id"]) > 0)
242 foreach (
$_POST[
"q_id"] as $key => $value)
244 $this->
object->copyToClipboard($value);
252 $this->ctrl->redirect($this,
"questions");
260 if (count(
$_POST[
"q_id"]) > 0)
262 foreach (
$_POST[
"q_id"] as $key => $value)
264 $this->
object->moveToClipboard($value);
272 $this->ctrl->redirect($this,
"questions");
280 if (is_array(
$_POST[
'q_id']) && count(
$_POST[
'q_id']) > 0)
299 $checked_questions =
$_POST[
'q_id'];
300 if (count($checked_questions) > 0)
302 if (!$rbacsystem->checkAccess(
'write', $this->ref_id))
309 elseif (count($checked_questions) == 0)
316 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
318 $cgui->setHeaderText($this->lng->txt(
"qpl_confirm_delete_questions"));
320 $cgui->setFormAction($this->ctrl->getFormAction($this));
321 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancelDeleteQuestions");
322 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmDeleteQuestions");
324 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
325 $infos = $this->
object->getQuestionInfos($checked_questions);
326 foreach ($infos as
$data)
328 $txt = $data[
"title"].
" (".
330 if($data[
"description"])
332 $txt .=
"<div class=\"small\">".$data[
"description"].
"</div>";
335 $cgui->addItem(
"q_id[]", $data[
"id"],
$txt);
338 $this->tpl->setContent($cgui->getHTML());
348 foreach (
$_POST[
'q_id'] as $q_id)
350 $this->
object->removeQuestion($q_id);
352 $this->ctrl->redirect($this,
"questions");
361 $this->ctrl->redirect($this,
"questions");
369 if (array_key_exists(
"spl_clipboard",
$_SESSION))
371 $this->
object->pasteFromClipboard();
377 $this->ctrl->redirect($this,
"questions");
387 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
389 $form->setFormAction($this->ctrl->getFormAction($this,
"uploadQuestions"));
390 $form->setTitle($this->lng->txt(
"import_question"));
392 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
393 $fi =
new ilFileInputGUI($this->lng->txt(
"select_file"),
"qtidoc");
395 $fi->setRequired(
true);
398 $form->addCommandButton(
"uploadQuestions", $this->lng->txt(
"import"));
399 $form->addCommandButton(
"questions", $this->lng->txt(
"cancel"));
401 $tpl->setContent($form->getHTML());
410 $source = $_FILES[
"qtidoc"][
"tmp_name"];
412 if (($source ==
'none') || (!$source) || $_FILES[
"qtidoc"][
"error"] > UPLOAD_ERR_OK)
417 if (!$error && strpos(
"xml", $_FILES[
"qtidoc"][
"type"]) !== FALSE)
425 $this->
object->createImportDirectory();
428 $full_path = $this->
object->getImportDirectory().
"/".$_FILES[
"qtidoc"][
"name"];
430 include_once
"./Services/Utilities/classes/class.ilUtil.php";
432 $_FILES[
"qtidoc"][
"name"], $full_path);
433 $source = $full_path;
434 $this->
object->importObject($source, TRUE);
437 $this->ctrl->redirect($this,
"questions");
442 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionsTableGUI.php";
444 $table_gui->writeFilterToSession();
445 $this->ctrl->redirect($this,
'questions');
450 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionsTableGUI.php";
452 $table_gui->resetFilter();
453 $this->ctrl->redirect($this,
'questions');
465 $this->
object->purgeQuestions();
469 if ($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']))
471 include_once
"Services/Form/classes/class.ilSelectInputGUI.php";
473 $qtypes->setValue($ilUser->getPref(
"svy_lastquestiontype"));
474 $ilToolbar->addInputItem($qtypes);
477 foreach (ilObjSurveyQuestionPool::_getQuestionTypes() as $translation =>
$data)
483 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
485 include_once
"Services/UIComponent/Button/classes/class.ilSubmitButton.php";
487 $button->setCaption(
"svy_create_question");
488 $button->setCommand(
"createQuestion");
489 $ilToolbar->addButtonInstance($button);
491 $ilToolbar->addSeparator();
494 $button->setCaption(
"import");
495 $button->setCommand(
"importQuestions");
496 $ilToolbar->addButtonInstance($button);
499 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionsTableGUI.php";
501 $table_gui->
setEditable($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']));
502 $arrFilter = array();
503 foreach ($table_gui->getFilterItems() as $item)
505 if ($item->getValue() !==
false)
507 $arrFilter[$item->getPostVar()] = $item->getValue();
510 $table_gui->setData($this->object->getQuestionsData($arrFilter));
511 $this->tpl->setContent($table_gui->getHTML());
516 $this->update = $this->
object->update();
526 "&baseClass=ilObjSurveyQuestionPoolGUI");
536 $ilToolbar->addButton($this->lng->txt(
'create_export_file'),
537 $this->ctrl->getLinkTarget($this,
'createExportFile'));
539 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionPoolExportTableGUI.php";
541 $export_dir = $this->
object->getExportDirectory();
542 $export_files = $this->
object->getExportFiles($export_dir);
544 foreach ($export_files as $exp_file)
546 $file_arr = explode(
"__", $exp_file);
549 $table_gui->setData(
$data);
550 $this->tpl->setContent($table_gui->getHTML());
560 if ($rbacsystem->checkAccess(
"write", $this->ref_id))
562 include_once(
"./Modules/SurveyQuestionPool/classes/class.ilSurveyQuestionpoolExport.php");
564 $survey_exp->buildExportFile($questions);
565 $this->ctrl->redirect($this,
"export");
578 if(!isset(
$_POST[
"file"]))
581 $this->ctrl->redirect($this,
"export");
584 if (count(
$_POST[
"file"]) > 1)
587 $this->ctrl->redirect($this,
"export");
591 $export_dir = $this->
object->getExportDirectory();
592 include_once
"./Services/Utilities/classes/class.ilUtil.php";
604 if(!isset(
$_POST[
"file"]))
607 $this->ctrl->redirect($this,
"export");
611 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionPoolExportTableGUI.php";
613 $export_dir = $this->
object->getExportDirectory();
615 foreach (
$_POST[
'file'] as $exp_file)
617 $file_arr = explode(
"__", $exp_file);
620 $table_gui->setData(
$data);
621 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
631 $this->ctrl->redirect($this,
"export");
639 $export_dir = $this->
object->getExportDirectory();
642 $file = basename($file);
644 $exp_file = $export_dir.
"/".
$file;
645 $exp_dir = $export_dir.
"/".substr($file, 0, strlen($file) - 4);
646 if (@is_file($exp_file))
650 if (@is_dir($exp_dir))
652 include_once
"./Services/Utilities/classes/class.ilUtil.php";
656 $this->ctrl->redirect($this,
"export");
661 $form = parent::initImportForm($a_new_type);
662 $form->getItemByPostVar(
'importfile')->setSuffixes(array(
"zip",
"xml"));
671 $forms = array(self::CFORM_NEW => $this->
initCreateForm($a_new_type),
672 self::CFORM_IMPORT => $form);
684 $parent_id =
$_GET[
"ref_id"];
690 $ilErr->raiseError($this->lng->txt(
"no_create_permission"));
693 $this->lng->loadLanguageModule($new_type);
694 $this->ctrl->setParameter($this,
"new_type", $new_type);
697 if ($form->checkInput())
699 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
701 $newObj->setType($new_type);
702 $newObj->setTitle(
"dummy");
703 $newObj->create(
true);
706 $newObj->createImportDirectory();
709 $upload = $_FILES[
"importfile"];
710 $file = pathinfo($upload[
"name"]);
711 $full_path = $newObj->getImportDirectory().
"/".$upload[
"name"];
712 include_once
"./Services/Utilities/classes/class.ilUtil.php";
717 $qtiresult = $newObj->importObject($full_path);
721 "&baseClass=ilObjSurveyQuestionPoolGUI");
725 $form->setValuesByPost();
726 $tpl->setContent($form->getHtml());
736 $ilUser->writePref(
"svy_lastquestiontype",
$_POST[
"sel_question_types"]);
738 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
740 $q_gui->object->setObjId($this->object->getId());
741 $q_gui->object->createNewQuestion();
743 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id", $q_gui->object->getId());
744 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types",
$_POST[
"sel_question_types"]);
745 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
753 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
755 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types", $q_gui->getQuestionType());
756 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id",
$_GET[
"preview"]);
757 $this->ctrl->redirectByClass(get_class($q_gui),
"preview");
767 $this->ctrl->setCmd(
"showSummary");
768 $this->ctrl->setCmdClass(
"ilinfoscreengui");
779 if(!$ilAccess->checkAccess(
"visible",
"", $this->ref_id) &&
780 !$ilAccess->checkAccess(
"read",
"", $this->ref_id))
782 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"));
785 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
787 $info->enablePrivateNotes();
790 $info->addMetaDataSections($this->object->getId(), 0, $this->
object->getType());
792 $this->ctrl->forwardCommand(
$info);
798 switch ($this->ctrl->getCmd())
805 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"",
$_GET[
"ref_id"]);
808 if ((
int)
$_GET[
"q_id"])
810 $q_id = (int)
$_GET[
"q_id"];
811 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
817 $this->ctrl->setParameterByClass($q_type,
"q_id", $q_id);
818 $ilLocator->addItem($q_title,
819 $this->ctrl->getLinkTargetByClass($q_type,
"editQuestion"));
831 global $ilAccess, $ilHelp;
833 $ilHelp->setScreenIdComponent(
"spl");
835 $next_class = $this->ctrl->getNextClass($this);
839 case "ilpermissiongui":
840 case "ilobjectmetadatagui":
841 case "ilsurveyphrasesgui":
849 $force_active = (($this->ctrl->getCmdClass() ==
"" &&
850 $this->ctrl->getCmd() !=
"properties" && $this->ctrl->getCmd() !=
"infoScreen") ||
851 $this->ctrl->getCmd() ==
"")
856 if (is_array(
$_GET[
"sort"]))
858 $force_active =
true;
862 if ($ilAccess->checkAccess(
"read",
"", $this->ref_id))
864 $tabs_gui->addTarget(
"survey_questions",
865 $this->ctrl->getLinkTarget($this,
'questions'),
866 array(
"questions",
"filterQuestionBrowser",
"filter",
"reset",
"createQuestion",
867 "importQuestions",
"deleteQuestions",
"copy",
"paste",
868 "exportQuestions",
"confirmDeleteQuestions",
"cancelDeleteQuestions",
869 "confirmPasteQuestions",
"cancelPasteQuestions",
"uploadQuestions",
870 "editQuestion",
"addMaterial",
"removeMaterial",
"save",
"cancel",
871 "cancelExplorer",
"linkChilds",
"addGIT",
"addST",
"addPG",
"preview",
872 "moveCategory",
"deleteCategory",
"addPhrase",
"addCategory",
"savePhrase",
873 "addSelectedPhrase",
"cancelViewPhrase",
"confirmSavePhrase",
"cancelSavePhrase",
874 "insertBeforeCategory",
"insertAfterCategory",
"confirmDeleteCategory",
875 "cancelDeleteCategory",
"categories",
"saveCategories",
876 "savePhrase",
"addPhrase" 878 array(
"ilobjsurveyquestionpoolgui",
"ilsurveyphrasesgui"),
"", $force_active);
880 $tabs_gui->addTarget(
"info_short",
881 $this->ctrl->getLinkTarget($this,
"infoScreen"),
882 array(
"infoScreen",
"showSummary"));
885 if ($ilAccess->checkAccess(
'write',
'', $this->ref_id))
888 $tabs_gui->addTarget(
"settings",
889 $this->ctrl->getLinkTarget($this,
'properties'),
890 array(
"properties",
"saveProperties"),
894 $tabs_gui->addTarget(
"manage_phrases",
895 $this->ctrl->getLinkTargetByClass(
"ilsurveyphrasesgui",
"phrases"),
896 array(
"phrases",
"deletePhrase",
"confirmDeletePhrase",
"cancelDeletePhrase",
"editPhrase",
"newPhrase",
"saveEditPhrase",
"phraseEditor"),
897 "ilsurveyphrasesgui",
"");
900 include_once
"Services/Object/classes/class.ilObjectMetaDataGUI.php";
902 $mdtab = $mdgui->getTab();
905 $tabs_gui->addTarget(
"meta_data",
907 "",
"ilmdeditorgui");
911 $tabs_gui->addTarget(
"export",
912 $this->ctrl->getLinkTarget($this,
'export'),
913 array(
"export",
"createExportFile",
"confirmDeleteExportFile",
914 "downloadExportFile",
"cancelDeleteExportFile",
"deleteExportFile"),
918 if ($ilAccess->checkAccess(
"edit_permission",
"", $this->ref_id))
920 $tabs_gui->addTarget(
"perm_settings",
921 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
930 $obligatory = array();
931 foreach (
$_POST as $key => $value)
933 if (preg_match(
"/obligatory_(\d+)/", $key, $matches))
935 $obligatory[]= $matches[1];
938 $this->
object->setObligatoryStates($obligatory);
941 $this->ctrl->redirect($this,
"questions");
950 public static function _goto($a_target)
953 if ($ilAccess->checkAccess(
"visible",
"", $a_target) ||
954 $ilAccess->checkAccess(
"read",
"", $a_target))
956 $_GET[
"baseClass"] =
"ilObjSurveyQuestionPoolGUI";
957 $_GET[
"cmd"] =
"infoScreen";
958 $_GET[
"ref_id"] = $a_target;
959 include_once(
"ilias.php");
962 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
968 $ilErr->raiseError($lng->txt(
"msg_no_perm_read_lm"), $ilErr->FATAL);
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
setSubmitFormOnEnter($a_val)
Set submit form on enter.
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
_getTitle($question_id)
Returns the question title of a question with a given id.
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.
Class ilObject Basic functions for all objects.
importFileObject()
form for new survey object import
saveObligatoryObject()
Save obligatory states.
setValue($a_value)
Set Value.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor public.
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)
cancelDeleteExportFileObject()
cancel deletion of export files
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.
getTabs(&$tabs_gui)
adds tabs to tab gui object
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(!is_array($argv)) $options
deleteExportFileObject()
delete export files
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
Export class for survey questionpools.
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
static & _getQuestionGUI($questiontype, $question_id=-1)
Creates a question gui representation.
This class represents a text property in a property form.
static formatDate(ilDateTime $date)
Format a date public.
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.
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
executeCommand()
execute command
prepareOutput()
prepare output
propertiesObject(ilPropertyFormGUI $a_form=null)
Questionpool properties.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
& previewObject()
create preview of object
initCreationForms($a_new_type)
deleteQuestionsObject()
Creates a confirmation form to delete questions from the question pool.
infoScreenForward()
show information screen
filterQuestionBrowserObject()
ilObjSurveyQuestionPoolGUI()
Constructor public.
createExportFileObject($questions=null)
create export file
_getQuestionType($question_id)
Returns the question type of a question with a given id.
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.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
moveObject()
mark one or more question objects for moving
& createQuestionObject()
create new question
static redirect($a_script)
http redirect to other 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
Confirmation screen class.