24include_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"];
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" &&
194 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
196 $form->setFormAction($this->ctrl->getFormAction($this,
'properties'));
197 $form->setTitle($this->lng->txt(
"properties"));
198 $form->setMultipart(
false);
199 $form->setId(
"properties");
203 $title->setSubmitFormOnEnter(
true);
204 $title->setValue($this->object->getTitle());
207 $title->setRequired(
true);
212 $desc->setValue($this->object->getLongDescription());
215 $form->addItem($desc);
219 $online->setInfo($this->lng->txt(
"spl_online_property_description"));
220 $online->setChecked($this->object->getOnline());
221 $form->addItem($online);
223 $form->addCommandButton(
"saveProperties", $this->lng->txt(
"save"));
237 $this->tpl->setVariable(
"ADM_CONTENT", $a_form->getHTML());
246 if (
$form->checkInput()) {
247 $this->
object->setTitle(
$form->getInput(
"title"));
248 $this->
object->setDescription(
$form->getInput(
"desc"));
249 $this->
object->setOnline((
int)
$form->getInput(
"online"));
251 $this->
object->saveToDb();
254 $this->ctrl->redirect($this,
"properties");
257 $form->setValuesByPost();
267 if (count(
$_POST[
"q_id"]) > 0) {
269 $this->
object->copyToClipboard($value);
275 $this->ctrl->redirect($this,
"questions");
283 if (count(
$_POST[
"q_id"]) > 0) {
285 $this->
object->moveToClipboard($value);
291 $this->ctrl->redirect($this,
"questions");
299 if (is_array(
$_POST[
'q_id']) && count(
$_POST[
'q_id']) > 0) {
315 $checked_questions =
$_POST[
'q_id'];
316 if (count($checked_questions) == 0) {
322 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
324 $cgui->setHeaderText($this->lng->txt(
"qpl_confirm_delete_questions"));
326 $cgui->setFormAction($this->ctrl->getFormAction($this));
327 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancelDeleteQuestions");
328 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmDeleteQuestions");
330 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
331 $infos = $this->
object->getQuestionInfos($checked_questions);
332 foreach ($infos as
$data) {
335 if (
$data[
"description"]) {
336 $txt .=
"<div class=\"small\">" .
$data[
"description"] .
"</div>";
339 $cgui->addItem(
"q_id[]",
$data[
"id"],
$txt);
342 $this->tpl->setContent($cgui->getHTML());
352 foreach (
$_POST[
'q_id'] as $q_id) {
353 $this->
object->removeQuestion($q_id);
355 $this->ctrl->redirect($this,
"questions");
364 $this->ctrl->redirect($this,
"questions");
372 if (array_key_exists(
"spl_clipboard",
$_SESSION)) {
373 $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"));
410 $source = $_FILES[
"qtidoc"][
"tmp_name"];
412 if ((
$source ==
'none') || (!
$source) || $_FILES[
"qtidoc"][
"error"] > UPLOAD_ERR_OK) {
416 if (!
$error && strpos(
"xml", $_FILES[
"qtidoc"][
"type"]) !==
false) {
422 $this->
object->createImportDirectory();
425 $full_path = $this->
object->getImportDirectory() .
"/" . $_FILES[
"qtidoc"][
"name"];
427 ilUtil::moveUploadedFile(
428 $_FILES[
"qtidoc"][
"tmp_name"],
429 $_FILES[
"qtidoc"][
"name"],
433 $this->
object->importObject(
$source,
true);
436 $this->ctrl->redirect($this,
"questions");
441 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionsTableGUI.php";
443 $table_gui->writeFilterToSession();
444 $this->ctrl->redirect($this,
'questions');
449 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionsTableGUI.php";
451 $table_gui->resetFilter();
452 $this->ctrl->redirect($this,
'questions');
463 $this->
object->purgeQuestions();
468 include_once
"Services/Form/classes/class.ilSelectInputGUI.php";
470 $qtypes->setValue(
$ilUser->getPref(
"svy_lastquestiontype"));
471 $ilToolbar->addInputItem($qtypes);
474 foreach (ilObjSurveyQuestionPool::_getQuestionTypes() as $translation =>
$data) {
479 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
481 include_once
"Services/UIComponent/Button/classes/class.ilSubmitButton.php";
483 $button->setCaption(
"svy_create_question");
484 $button->setCommand(
"createQuestion");
485 $ilToolbar->addButtonInstance($button);
487 $ilToolbar->addSeparator();
490 $button->setCaption(
"import");
491 $button->setCommand(
"importQuestions");
492 $ilToolbar->addButtonInstance($button);
495 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionsTableGUI.php";
498 $arrFilter = array();
499 foreach ($table_gui->getFilterItems() as $item) {
500 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(
531 $this->lng->txt(
'create_export_file'),
532 $this->ctrl->getLinkTarget($this,
'createExportFile')
535 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionPoolExportTableGUI.php";
537 $export_dir = $this->
object->getExportDirectory();
538 $export_files = $this->
object->getExportFiles($export_dir);
540 foreach ($export_files as $exp_file) {
541 $file_arr = explode(
"__", $exp_file);
544 $table_gui->setData(
$data);
545 $this->tpl->setContent($table_gui->getHTML());
555 include_once(
"./Modules/SurveyQuestionPool/classes/class.ilSurveyQuestionpoolExport.php");
557 $survey_exp->buildExportFile($questions);
558 $this->ctrl->redirect($this,
"export");
566 if (!isset(
$_POST[
"file"])) {
568 $this->ctrl->redirect($this,
"export");
571 if (count(
$_POST[
"file"]) > 1) {
573 $this->ctrl->redirect($this,
"export");
577 $export_dir = $this->
object->getExportDirectory();
589 if (!isset(
$_POST[
"file"])) {
591 $this->ctrl->redirect($this,
"export");
595 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionPoolExportTableGUI.php";
597 $export_dir = $this->
object->getExportDirectory();
599 foreach (
$_POST[
'file'] as $exp_file) {
600 $file_arr = explode(
"__", $exp_file);
603 $table_gui->setData(
$data);
604 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
614 $this->ctrl->redirect($this,
"export");
622 $export_dir = $this->
object->getExportDirectory();
626 $exp_file = $export_dir .
"/" .
$file;
627 $exp_dir = $export_dir .
"/" . substr(
$file, 0, strlen(
$file) - 4);
628 if (@is_file($exp_file)) {
631 if (@is_dir($exp_dir)) {
635 $this->ctrl->redirect($this,
"export");
640 $form = parent::initImportForm($a_new_type);
641 $form->getItemByPostVar(
'importfile')->setSuffixes(array(
"zip",
"xml"));
650 $forms = array(self::CFORM_NEW => $this->
initCreateForm($a_new_type),
651 self::CFORM_IMPORT =>
$form);
665 $parent_id =
$_GET[
"ref_id"];
667 $new_type = $_REQUEST[
"new_type"];
671 $ilErr->raiseError($this->lng->txt(
"no_create_permission"));
674 $this->lng->loadLanguageModule($new_type);
675 $this->ctrl->setParameter($this,
"new_type", $new_type);
678 if (
$form->checkInput()) {
679 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
681 $newObj->setType($new_type);
682 $newObj->setTitle(
"dummy");
683 $newObj->create(
true);
686 $newObj->createImportDirectory();
689 $upload = $_FILES[
"importfile"];
690 $file = pathinfo($upload[
"name"]);
691 $full_path = $newObj->getImportDirectory() .
"/" . $upload[
"name"];
692 ilUtil::moveUploadedFile(
699 $qtiresult = $newObj->importObject($full_path);
703 "&baseClass=ilObjSurveyQuestionPoolGUI");
707 $form->setValuesByPost();
718 $ilUser->writePref(
"svy_lastquestiontype",
$_POST[
"sel_question_types"]);
720 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
722 $q_gui->object->setObjId($this->object->getId());
723 $q_gui->object->createNewQuestion();
725 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id", $q_gui->object->getId());
726 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types",
$_POST[
"sel_question_types"]);
727 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
735 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
737 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types", $q_gui->getQuestionType());
738 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id",
$_GET[
"preview"]);
739 $this->ctrl->redirectByClass(get_class($q_gui),
"preview");
749 $this->ctrl->setCmd(
"showSummary");
750 $this->ctrl->setCmdClass(
"ilinfoscreengui");
763 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
765 $info->enablePrivateNotes();
768 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
770 $this->ctrl->forwardCommand(
$info);
776 switch ($this->ctrl->getCmd()) {
782 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"",
$_GET[
"ref_id"]);
785 if ((
int)
$_GET[
"q_id"]) {
786 $q_id = (int)
$_GET[
"q_id"];
787 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
792 $this->ctrl->setParameterByClass($q_type,
"q_id", $q_id);
795 $this->ctrl->getLinkTargetByClass($q_type,
"editQuestion")
810 $ilHelp->setScreenIdComponent(
"spl");
812 $next_class = $this->ctrl->getNextClass($this);
813 switch ($next_class) {
815 case "ilpermissiongui":
816 case "ilobjectmetadatagui":
817 case "ilsurveyphrasesgui":
825 $force_active = (($this->ctrl->getCmdClass() ==
"" &&
826 $this->ctrl->getCmd() !=
"properties" && $this->ctrl->getCmd() !=
"infoScreen") ||
827 $this->ctrl->getCmd() ==
"")
830 if (!$force_active) {
831 if (is_array(
$_GET[
"sort"])) {
832 $force_active =
true;
837 $this->tabs_gui->addTarget(
839 $this->ctrl->getLinkTarget($this,
'questions'),
840 array(
"questions",
"filterQuestionBrowser",
"filter",
"reset",
"createQuestion",
841 "importQuestions",
"deleteQuestions",
"copy",
"paste",
842 "exportQuestions",
"confirmDeleteQuestions",
"cancelDeleteQuestions",
843 "confirmPasteQuestions",
"cancelPasteQuestions",
"uploadQuestions",
844 "editQuestion",
"addMaterial",
"removeMaterial",
"save",
"cancel",
845 "cancelExplorer",
"linkChilds",
"addGIT",
"addST",
"addPG",
"preview",
846 "moveCategory",
"deleteCategory",
"addPhrase",
"addCategory",
"savePhrase",
847 "addSelectedPhrase",
"cancelViewPhrase",
"confirmSavePhrase",
"cancelSavePhrase",
848 "insertBeforeCategory",
"insertAfterCategory",
"confirmDeleteCategory",
849 "cancelDeleteCategory",
"categories",
"saveCategories",
850 "savePhrase",
"addPhrase"
852 array(
"ilobjsurveyquestionpoolgui",
"ilsurveyphrasesgui"),
857 $this->tabs_gui->addTarget(
859 $this->ctrl->getLinkTarget($this,
"infoScreen"),
860 array(
"infoScreen",
"showSummary")
866 $this->tabs_gui->addTarget(
868 $this->ctrl->getLinkTarget($this,
'properties'),
869 array(
"properties",
"saveProperties"),
875 $this->tabs_gui->addTarget(
877 $this->ctrl->getLinkTargetByClass(
"ilsurveyphrasesgui",
"phrases"),
878 array(
"phrases",
"deletePhrase",
"confirmDeletePhrase",
"cancelDeletePhrase",
"editPhrase",
"newPhrase",
"saveEditPhrase",
"phraseEditor"),
879 "ilsurveyphrasesgui",
884 include_once
"Services/Object/classes/class.ilObjectMetaDataGUI.php";
886 $mdtab = $mdgui->getTab();
888 $this->tabs_gui->addTarget(
897 $this->tabs_gui->addTarget(
899 $this->ctrl->getLinkTarget($this,
'export'),
900 array(
"export",
"createExportFile",
"confirmDeleteExportFile",
901 "downloadExportFile",
"cancelDeleteExportFile",
"deleteExportFile"),
908 $this->tabs_gui->addTarget(
910 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"),
911 array(
"perm",
"info",
"owner"),
922 $obligatory = array();
924 if (preg_match(
"/obligatory_(\d+)/",
$key, $matches)) {
925 $obligatory[]= $matches[1];
928 $this->
object->setObligatoryStates($obligatory);
931 $this->ctrl->redirect($this,
"questions");
940 public static function _goto($a_target)
944 $ilAccess =
$DIC->access();
947 if ($ilAccess->checkAccess(
"visible",
"", $a_target) ||
948 $ilAccess->checkAccess(
"read",
"", $a_target)) {
949 $_GET[
"baseClass"] =
"ilObjSurveyQuestionPoolGUI";
950 $_GET[
"cmd"] =
"infoScreen";
951 $_GET[
"ref_id"] = $a_target;
952 include_once(
"ilias.php");
954 } elseif ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID)) {
956 $lng->txt(
"msg_no_perm_read_item"),
sprintf('%.4f', $callTime)
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
An exception for terminatinating execution or to throw for unit testing.
static _getQuestionGUI($questiontype, $question_id=-1)
Creates a question gui representation.
static _getTitle($question_id)
Returns the question title of a question with a given id.
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
static _getQuestionType($question_id)
Returns the question type of a question with a given id.
error($a_errmsg)
set error message @access public
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Confirmation screen class.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
@classDescription Date and time handling
static getLogger($a_component_id)
Get component logger.
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.
__construct()
Constructor @access public.
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()
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
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.
importFileObject($parent_id=null, $a_catch_errors=true)
form for new survey object import
initImportForm($a_new_type)
Init object import form.
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.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
putObjectInTree(ilObject $a_obj, $a_parent_node_id=null)
Add object to tree at given position.
prepareOutput($a_show_subobjects=true)
prepare output
initCreateForm($a_new_type)
Init object creation form.
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 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)
static sendFailure($a_info="", $a_keep=false)
Send Failure 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.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
update($pash, $contents, Config $config)
if(isset($_POST['submit'])) $form
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file