24include_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");
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);
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)
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");
394 $fi->setSuffixes(array(
"xml",
"zip"));
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();
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))
static & _getQuestionGUI($questiontype, $question_id=-1)
Creates a question gui representation.
_getQuestionType($question_id)
Returns the question type of a question with a given id.
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
_getTitle($question_id)
Returns the question title of a question with a given id.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Confirmation screen class.
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
Class ilObjSurveyQuestionPoolGUI.
uploadQuestionsObject()
imports question(s) into the questionpool
saveObligatoryObject()
Save obligatory states.
deleteExportFileObject()
delete export files
copyObject()
Copies checked questions in the questionpool to a clipboard.
createExportFileObject($questions=null)
create export file
initEditForm()
Init object edit form.
resetfilterQuestionBrowserObject()
savePropertiesObject()
Save questionpool properties.
downloadExportFileObject()
download export file
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
infoScreenForward()
show information screen
getTabs(&$tabs_gui)
adds tabs to tab gui object
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.
filterQuestionBrowserObject()
executeCommand()
execute command
& previewObject()
create preview of object
& createQuestionObject()
create new question
importQuestionsObject()
display the import form to import questions into the questionpool
ilObjSurveyQuestionPoolGUI()
Constructor @access public.
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.
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
static _goto($a_target)
Redirect script to call a survey question pool reference id.
initImportForm($a_new_type)
Init object import form.
importFileObject()
form for new survey object import
confirmDeleteQuestionsObject()
delete questions
updateObject()
updates object entry in object_data
GUI class for the workflow of copying objects.
Class ilObjectGUI Basic methods of all Output classes.
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor @access public.
putObjectInTree(ilObject $a_obj, $a_parent_node_id=null)
Add object to tree at given position.
initCreateForm($a_new_type)
Init object creation form.
prepareOutput()
prepare output
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 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.
static clear($a_var)
Unset a value.
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 sendSuccess($a_info="", $a_keep=false)
Send Success Message 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)
http redirect to other script
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info 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.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
if(!is_array($argv)) $options