24 include_once
"./Services/Object/classes/class.ilObjectGUI.php";
60 $lng->loadLanguageModule(
"survey");
62 $this->ctrl->saveParameter($this,
array(
"ref_id"));
64 parent::__construct(
"",
$_GET[
"ref_id"],
true,
false);
74 global $ilNavigationHistory;
86 $ilNavigationHistory->addItem($this->ref_id,
87 "ilias.php?baseClass=ilObjSurveyQuestionPoolGUI&cmd=questions&ref_id=".$this->ref_id,
"spl");
93 $cmd = $this->ctrl->getCmd(
"questions");
94 $next_class = $this->ctrl->getNextClass($this);
95 $this->ctrl->setReturn($this,
"questions");
96 if (
$_GET[
"q_id"] < 1)
98 $q_type = (
$_POST[
"sel_question_types"] !=
"")
99 ?
$_POST[
"sel_question_types"]
100 :
$_GET[
"sel_question_types"];
103 $this->log->debug(
"- cmd=".
$cmd.
" next_class=".$next_class);
106 case 'ilobjectmetadatagui':
108 include_once
'Services/Object/classes/class.ilObjectMetaDataGUI.php';
110 $this->ctrl->forwardCommand($md_gui);
113 case 'ilpermissiongui':
114 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
116 $ret =& $this->ctrl->forwardCommand($perm_gui);
119 case "ilsurveyphrasesgui":
120 include_once(
"./Modules/SurveyQuestionPool/classes/class.ilSurveyPhrasesGUI.php");
122 $ret =& $this->ctrl->forwardCommand($phrases_gui);
125 case 'ilobjectcopygui':
126 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
129 $this->ctrl->forwardCommand($cp);
132 case 'ilinfoscreengui':
136 case "ilcommonactiondispatchergui":
137 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
139 $this->ctrl->forwardCommand($gui);
148 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
150 $this->log->debug(
"- This is the switch/case default, going to question id =".
$_GET[
"q_id"]);
152 $q_gui->setQuestionTabs();
153 $ret =& $this->ctrl->forwardCommand($q_gui);
156 if($q_gui->object->isComplete())
158 $this->tpl->setTitle($this->lng->txt(
"question").
": ".$q_gui->object->getTitle());
162 if (strtolower(
$_GET[
"baseClass"]) !=
"iladministrationgui" &&
171 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
173 $form->setFormAction($this->ctrl->getFormAction($this,
'properties'));
174 $form->setTitle($this->lng->txt(
"properties"));
175 $form->setMultipart(
false);
176 $form->setId(
"properties");
180 $title->setSubmitFormOnEnter(
true);
184 $title->setRequired(
true);
192 $form->addItem($desc);
196 $online->
setInfo($this->lng->txt(
"spl_online_property_description"));
197 $online->setChecked($this->
object->getOnline());
198 $form->addItem($online);
200 $form->addCommandButton(
"saveProperties", $this->lng->txt(
"save"));
215 $this->tpl->setVariable(
"ADM_CONTENT", $a_form->getHTML());
224 if($form->checkInput())
226 $this->
object->setTitle($form->getInput(
"title"));
227 $this->
object->setDescription($form->getInput(
"desc"));
228 $this->
object->setOnline((
int)$form->getInput(
"online"));
230 $this->
object->saveToDb();
233 $this->ctrl->redirect($this,
"properties");
236 $form->setValuesByPost();
246 if (count(
$_POST[
"q_id"]) > 0)
248 foreach (
$_POST[
"q_id"] as $key => $value)
250 $this->
object->copyToClipboard($value);
258 $this->ctrl->redirect($this,
"questions");
266 if (count(
$_POST[
"q_id"]) > 0)
268 foreach (
$_POST[
"q_id"] as $key => $value)
270 $this->
object->moveToClipboard($value);
278 $this->ctrl->redirect($this,
"questions");
286 if (is_array(
$_POST[
'q_id']) && count(
$_POST[
'q_id']) > 0)
305 $checked_questions =
$_POST[
'q_id'];
306 if (count($checked_questions) == 0)
313 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
315 $cgui->setHeaderText($this->lng->txt(
"qpl_confirm_delete_questions"));
317 $cgui->setFormAction($this->ctrl->getFormAction($this));
318 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancelDeleteQuestions");
319 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmDeleteQuestions");
321 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
322 $infos = $this->
object->getQuestionInfos($checked_questions);
323 foreach ($infos as
$data)
325 $txt = $data[
"title"].
" (".
327 if($data[
"description"])
329 $txt .=
"<div class=\"small\">".$data[
"description"].
"</div>";
332 $cgui->addItem(
"q_id[]", $data[
"id"],
$txt);
335 $this->tpl->setContent($cgui->getHTML());
345 foreach (
$_POST[
'q_id'] as $q_id)
347 $this->
object->removeQuestion($q_id);
349 $this->ctrl->redirect($this,
"questions");
358 $this->ctrl->redirect($this,
"questions");
366 if (array_key_exists(
"spl_clipboard",
$_SESSION))
368 $this->
object->pasteFromClipboard();
374 $this->ctrl->redirect($this,
"questions");
384 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
386 $form->setFormAction($this->ctrl->getFormAction($this,
"uploadQuestions"));
387 $form->setTitle($this->lng->txt(
"import_question"));
389 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
390 $fi =
new ilFileInputGUI($this->lng->txt(
"select_file"),
"qtidoc");
392 $fi->setRequired(
true);
395 $form->addCommandButton(
"uploadQuestions", $this->lng->txt(
"import"));
396 $form->addCommandButton(
"questions", $this->lng->txt(
"cancel"));
398 $tpl->setContent($form->getHTML());
407 $source = $_FILES[
"qtidoc"][
"tmp_name"];
409 if (($source ==
'none') || (!$source) || $_FILES[
"qtidoc"][
"error"] > UPLOAD_ERR_OK)
414 if (!
$error && strpos(
"xml", $_FILES[
"qtidoc"][
"type"]) !== FALSE)
422 $this->
object->createImportDirectory();
425 $full_path = $this->
object->getImportDirectory().
"/".$_FILES[
"qtidoc"][
"name"];
428 $_FILES[
"qtidoc"][
"name"], $full_path);
429 $source = $full_path;
430 $this->
object->importObject($source, TRUE);
433 $this->ctrl->redirect($this,
"questions");
438 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionsTableGUI.php";
440 $table_gui->writeFilterToSession();
441 $this->ctrl->redirect($this,
'questions');
446 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionsTableGUI.php";
448 $table_gui->resetFilter();
449 $this->ctrl->redirect($this,
'questions');
459 $this->
object->purgeQuestions();
465 include_once
"Services/Form/classes/class.ilSelectInputGUI.php";
467 $qtypes->setValue($ilUser->getPref(
"svy_lastquestiontype"));
468 $ilToolbar->addInputItem($qtypes);
471 foreach (ilObjSurveyQuestionPool::_getQuestionTypes() as $translation =>
$data)
477 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
479 include_once
"Services/UIComponent/Button/classes/class.ilSubmitButton.php";
481 $button->setCaption(
"svy_create_question");
482 $button->setCommand(
"createQuestion");
483 $ilToolbar->addButtonInstance($button);
485 $ilToolbar->addSeparator();
488 $button->setCaption(
"import");
489 $button->setCommand(
"importQuestions");
490 $ilToolbar->addButtonInstance($button);
493 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionsTableGUI.php";
496 $arrFilter =
array();
497 foreach ($table_gui->getFilterItems() as $item)
499 if ($item->getValue() !==
false)
501 $arrFilter[$item->getPostVar()] = $item->getValue();
504 $table_gui->setData($this->
object->getQuestionsData($arrFilter));
505 $this->tpl->setContent($table_gui->getHTML());
510 $this->update = $this->
object->update();
520 "&baseClass=ilObjSurveyQuestionPoolGUI");
530 $ilToolbar->addButton($this->lng->txt(
'create_export_file'),
531 $this->ctrl->getLinkTarget($this,
'createExportFile'));
533 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionPoolExportTableGUI.php";
535 $export_dir = $this->
object->getExportDirectory();
536 $export_files = $this->
object->getExportFiles($export_dir);
538 foreach ($export_files as $exp_file)
540 $file_arr = explode(
"__", $exp_file);
543 $table_gui->setData(
$data);
544 $this->tpl->setContent($table_gui->getHTML());
554 include_once(
"./Modules/SurveyQuestionPool/classes/class.ilSurveyQuestionpoolExport.php");
556 $survey_exp->buildExportFile($questions);
557 $this->ctrl->redirect($this,
"export");
565 if(!isset(
$_POST[
"file"]))
568 $this->ctrl->redirect($this,
"export");
571 if (count(
$_POST[
"file"]) > 1)
574 $this->ctrl->redirect($this,
"export");
578 $export_dir = $this->
object->getExportDirectory();
590 if(!isset(
$_POST[
"file"]))
593 $this->ctrl->redirect($this,
"export");
597 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionPoolExportTableGUI.php";
599 $export_dir = $this->
object->getExportDirectory();
601 foreach (
$_POST[
'file'] as $exp_file)
603 $file_arr = explode(
"__", $exp_file);
606 $table_gui->setData(
$data);
607 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
617 $this->ctrl->redirect($this,
"export");
625 $export_dir = $this->
object->getExportDirectory();
628 $file = basename($file);
630 $exp_file = $export_dir.
"/".
$file;
631 $exp_dir = $export_dir.
"/".substr($file, 0, strlen($file) - 4);
632 if (@is_file($exp_file))
636 if (@is_dir($exp_dir))
641 $this->ctrl->redirect($this,
"export");
646 $form = parent::initImportForm($a_new_type);
647 $form->getItemByPostVar(
'importfile')->setSuffixes(
array(
"zip",
"xml"));
657 self::CFORM_IMPORT => $form);
671 $parent_id =
$_GET[
"ref_id"];
673 $new_type = $_REQUEST[
"new_type"];
678 $ilErr->raiseError($this->lng->txt(
"no_create_permission"));
681 $this->lng->loadLanguageModule($new_type);
682 $this->ctrl->setParameter($this,
"new_type", $new_type);
685 if ($form->checkInput())
687 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
689 $newObj->setType($new_type);
690 $newObj->setTitle(
"dummy");
691 $newObj->create(
true);
694 $newObj->createImportDirectory();
697 $upload = $_FILES[
"importfile"];
698 $file = pathinfo($upload[
"name"]);
699 $full_path = $newObj->getImportDirectory().
"/".$upload[
"name"];
704 $qtiresult = $newObj->importObject($full_path);
708 "&baseClass=ilObjSurveyQuestionPoolGUI");
712 $form->setValuesByPost();
713 $tpl->setContent($form->getHtml());
723 $ilUser->writePref(
"svy_lastquestiontype",
$_POST[
"sel_question_types"]);
725 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
727 $q_gui->object->setObjId($this->
object->getId());
728 $q_gui->object->createNewQuestion();
730 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id", $q_gui->object->getId());
731 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types",
$_POST[
"sel_question_types"]);
732 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
740 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
742 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types", $q_gui->getQuestionType());
743 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id",
$_GET[
"preview"]);
744 $this->ctrl->redirectByClass(get_class($q_gui),
"preview");
754 $this->ctrl->setCmd(
"showSummary");
755 $this->ctrl->setCmdClass(
"ilinfoscreengui");
769 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
771 $info->enablePrivateNotes();
774 $info->addMetaDataSections($this->
object->getId(), 0, $this->
object->getType());
776 $this->ctrl->forwardCommand(
$info);
782 switch ($this->ctrl->getCmd())
789 $ilLocator->addItem($this->
object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"",
$_GET[
"ref_id"]);
792 if ((
int)
$_GET[
"q_id"])
794 $q_id = (int)
$_GET[
"q_id"];
795 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
801 $this->ctrl->setParameterByClass($q_type,
"q_id", $q_id);
802 $ilLocator->addItem($q_title,
803 $this->ctrl->getLinkTargetByClass($q_type,
"editQuestion"));
817 $ilHelp->setScreenIdComponent(
"spl");
819 $next_class = $this->ctrl->getNextClass($this);
823 case "ilpermissiongui":
824 case "ilobjectmetadatagui":
825 case "ilsurveyphrasesgui":
833 $force_active = (($this->ctrl->getCmdClass() ==
"" &&
834 $this->ctrl->getCmd() !=
"properties" && $this->ctrl->getCmd() !=
"infoScreen") ||
835 $this->ctrl->getCmd() ==
"")
840 if (is_array(
$_GET[
"sort"]))
842 $force_active =
true;
848 $this->tabs_gui->addTarget(
"survey_questions",
849 $this->ctrl->getLinkTarget($this,
'questions'),
850 array(
"questions",
"filterQuestionBrowser",
"filter",
"reset",
"createQuestion",
851 "importQuestions",
"deleteQuestions",
"copy",
"paste",
852 "exportQuestions",
"confirmDeleteQuestions",
"cancelDeleteQuestions",
853 "confirmPasteQuestions",
"cancelPasteQuestions",
"uploadQuestions",
854 "editQuestion",
"addMaterial",
"removeMaterial",
"save",
"cancel",
855 "cancelExplorer",
"linkChilds",
"addGIT",
"addST",
"addPG",
"preview",
856 "moveCategory",
"deleteCategory",
"addPhrase",
"addCategory",
"savePhrase",
857 "addSelectedPhrase",
"cancelViewPhrase",
"confirmSavePhrase",
"cancelSavePhrase",
858 "insertBeforeCategory",
"insertAfterCategory",
"confirmDeleteCategory",
859 "cancelDeleteCategory",
"categories",
"saveCategories",
860 "savePhrase",
"addPhrase" 862 array(
"ilobjsurveyquestionpoolgui",
"ilsurveyphrasesgui"),
"", $force_active);
864 $this->tabs_gui->addTarget(
"info_short",
865 $this->ctrl->getLinkTarget($this,
"infoScreen"),
866 array(
"infoScreen",
"showSummary"));
872 $this->tabs_gui->addTarget(
"settings",
873 $this->ctrl->getLinkTarget($this,
'properties'),
874 array(
"properties",
"saveProperties"),
878 $this->tabs_gui->addTarget(
"manage_phrases",
879 $this->ctrl->getLinkTargetByClass(
"ilsurveyphrasesgui",
"phrases"),
880 array(
"phrases",
"deletePhrase",
"confirmDeletePhrase",
"cancelDeletePhrase",
"editPhrase",
"newPhrase",
"saveEditPhrase",
"phraseEditor"),
881 "ilsurveyphrasesgui",
"");
884 include_once
"Services/Object/classes/class.ilObjectMetaDataGUI.php";
886 $mdtab = $mdgui->getTab();
889 $this->tabs_gui->addTarget(
"meta_data",
891 "",
"ilmdeditorgui");
895 $this->tabs_gui->addTarget(
"export",
896 $this->ctrl->getLinkTarget($this,
'export'),
897 array(
"export",
"createExportFile",
"confirmDeleteExportFile",
898 "downloadExportFile",
"cancelDeleteExportFile",
"deleteExportFile"),
904 $this->tabs_gui->addTarget(
"perm_settings",
905 $this->ctrl->getLinkTargetByClass(
array(get_class($this),
'ilpermissiongui'),
"perm"),
array(
"perm",
"info",
"owner"),
'ilpermissiongui');
914 $obligatory =
array();
915 foreach (
$_POST as $key => $value)
917 if (preg_match(
"/obligatory_(\d+)/", $key, $matches))
919 $obligatory[]= $matches[1];
922 $this->
object->setObligatoryStates($obligatory);
925 $this->ctrl->redirect($this,
"questions");
934 public static function _goto($a_target)
936 global $ilAccess,
$lng;
938 if ($ilAccess->checkAccess(
"visible",
"", $a_target) ||
939 $ilAccess->checkAccess(
"read",
"", $a_target))
941 $_GET[
"baseClass"] =
"ilObjSurveyQuestionPoolGUI";
942 $_GET[
"cmd"] =
"infoScreen";
943 $_GET[
"ref_id"] = $a_target;
944 include_once(
"ilias.php");
947 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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.
Class ilObject Basic functions for all objects.
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 _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(!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
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.
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
Create styles array
The data for the language used.
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.
getTabs()
adds tabs to tab gui object
infoScreenForward()
show information screen
filterQuestionBrowserObject()
createExportFileObject($questions=null)
create export file
Create new PHPExcel object
obj_idprivate
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.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
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.