41 include_once
"./classes/class.ilObjectGUI.php";
42 include_once
"./Modules/Survey/classes/inc.SurveyConstants.php";
55 $lng->loadLanguageModule(
"survey");
57 $this->ctrl->saveParameter($this,
"ref_id",
"pgov",
"pgov_pos");
64 include_once
"./Services/Utilities/classes/class.ilUtil.php";
65 $path = $this->tree->getPathFull($this->object->getRefID());
74 global $ilAccess, $ilNavigationHistory,
$ilCtrl;
76 if ((!$ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"])) && (!$ilAccess->checkAccess(
"visible",
"",
$_GET[
"ref_id"])))
79 $ilias->raiseError($this->lng->txt(
"permission_denied"), $ilias->error_obj->MESSAGE);
83 $ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"]))
85 $ilNavigationHistory->addItem(
$_GET[
"ref_id"],
86 "ilias.php?baseClass=ilObjSurveyGUI&cmd=infoScreen&ref_id=".
$_GET[
"ref_id"],
"svy");
89 $cmd = $this->ctrl->getCmd(
"properties");
92 if (
$cmd ==
"saveTags")
94 $ilCtrl->setCmdClass(
"ilinfoscreengui");
98 if(!$this->ctrl->getCmdClass() &&
$cmd ==
"questionsrepo")
102 $ilCtrl->setCmd(
$cmd);
106 if(in_array(
$cmd, array(
"cancelRemoveQuestions",
"questions",
"confirmRemoveQuestions",
107 "cancelDeleteAllUserData",
"confirmDeleteAllUserData",
"cancelCreateQuestion",
108 "cancelHeading",
"cancelRemoveHeading",
"confirmRemoveHeading",
"cancelRemoveQuestions",
109 "cancelDefineQuestionblock"))
112 $ilCtrl->setCmdClass(
"ilsurveypagegui");
113 if(!in_array(
$cmd, array(
"confirmRemoveQuestions",
"confirmDeleteAllUserData",
114 "confirmRemoveHeading")))
116 $ilCtrl->setCmd(
"renderPage");
120 $next_class = $this->ctrl->getNextClass($this);
121 $this->ctrl->setReturn($this,
"properties");
127 case "ilinfoscreengui":
132 case 'ilmdeditorgui':
134 include_once
'Services/MetaData/classes/class.ilMDEditorGUI.php';
135 $md_gui =&
new ilMDEditorGUI($this->object->getId(), 0, $this->
object->getType());
136 $md_gui->
addObserver($this->
object,
'MDUpdateListener',
'General');
138 $this->ctrl->forwardCommand($md_gui);
141 case "ilsurveyevaluationgui":
143 include_once(
"./Modules/Survey/classes/class.ilSurveyEvaluationGUI.php");
145 $ret =& $this->ctrl->forwardCommand($eval_gui);
148 case 'ilrepositorysearchgui':
149 include_once(
'./Services/Search/classes/class.ilRepositorySearchGUI.php');
151 $rep_search->setCallback($this,
152 'inviteUserGroupObject',
158 $this->ctrl->setReturn($this,
'invite');
159 $ret =& $this->ctrl->forwardCommand($rep_search);
160 $this->tabs_gui->setTabActive(
'invitation');
163 case "ilsurveyexecutiongui":
164 include_once(
"./Modules/Survey/classes/class.ilSurveyExecutionGUI.php");
166 $ret =& $this->ctrl->forwardCommand($exec_gui);
169 case 'ilpermissiongui':
171 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
173 $ret =& $this->ctrl->forwardCommand($perm_gui);
176 case 'ilobjectcopygui':
177 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
180 $this->ctrl->forwardCommand($cp);
183 case 'ilsurveypagegui':
185 include_once
'./Modules/Survey/classes/class.ilSurveyPageGUI.php';
187 $this->ctrl->forwardCommand($pg);
190 case "ilcommonactiondispatchergui":
191 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
193 $this->ctrl->forwardCommand($gui);
203 if (strtolower(
$_GET[
"baseClass"]) !=
"iladministrationgui" &&
212 include_once
"Services/Administration/classes/class.ilSettingsTemplate.php";
216 foreach($templates as $item)
218 $a_options[
"svytpl_".$item[
"id"]] = array($item[
"title"],
219 nl2br(trim($item[
"description"])));
233 $a_new_object->applySettingsTemplate(
$tpl);
239 $a_new_object->
getRefId().
"&cmd=properties");
261 $this->ctrl->redirect($this,
"properties");
274 if (!$ilAccess->checkAccess(
"write",
"", $this->ref_id))
278 $this->ctrl->redirect($this,
"infoScreen");
292 if ($form->checkInput())
295 if (
$_POST[
'online'] && count($this->object->questions) == 0)
301 $template_settings = null;
302 $template = $this->
object->getTemplate();
305 include_once
"Services/Administration/classes/class.ilSettingsTemplate.php";
307 $template_settings = $template->getSettings();
311 include_once
'Services/MetaData/classes/class.ilMD.php';
312 $md_obj =&
new ilMD($this->object->getId(), 0,
"svy");
320 $md_desc_ids = $md_section->getDescriptionIds();
323 $md_desc = $md_section->getDescription(array_pop($md_desc_ids));
331 $this->
object->update();
333 $this->
object->setStatus(
$_POST[
'online']);
334 $this->
object->setEvaluationAccess(
$_POST[
"evaluation_access"]);
336 if(!$template_settings[
"enabled_start_date"][
"hide"])
338 $this->
object->setStartDateEnabled(
$_POST[
"enabled_start_date"]);
339 if ($this->object->getStartDateEnabled())
341 $this->
object->setStartDateAndTime(
$_POST[
"start_date"][
'date'],
$_POST[
"start_date"][
'time']);
345 $this->
object->setStartDate(null);
349 if(!$template_settings[
"enabled_end_date"][
"hide"])
351 $this->
object->setEndDateEnabled(
$_POST[
"enabled_end_date"]);
352 if ($this->object->getEndDateEnabled())
354 $this->
object->setEndDateAndTime(
$_POST[
"end_date"][
'date'],
$_POST[
"end_date"][
'time']);
358 $this->
object->setEndDate(null);
362 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
363 $introduction =
$_POST[
"introduction"];
364 $this->
object->setIntroduction($introduction);
366 $this->
object->setOutro($outro);
368 $hasDatasets = $this->
object->_hasDatasets($this->object->getSurveyId());
374 if(array_key_exists(
$_POST[
"anonymization_options"], $anon_map))
376 $this->
object->setAnonymize($anon_map[
$_POST[
"anonymization_options"]]);
377 if (strcmp($_POST[
'anonymization_options'],
'anonymize_with_code') == 0) $anonymize =
ANONYMIZE_ON;
378 if (strcmp($_POST[
'anonymization_options'],
'anonymize_with_code_all') == 0) $anonymize =
ANONYMIZE_CODE_ALL;
382 if(!$template_settings[
"show_question_titles"][
"hide"])
384 $this->
object->setShowQuestionTitles(
$_POST[
"show_question_titles"]);
387 if(!$template_settings[
"use_pool"][
"hide"])
389 $this->
object->setPoolUsage(
$_POST[
"use_pool"]);
392 $this->
object->setMailNotification(
$_POST[
'mailnotification']);
393 $this->
object->setMailAddresses(
$_POST[
'mailaddresses']);
394 $this->
object->setMailParticipantData(
$_POST[
'mailparticipantdata']);
395 $this->
object->saveToDb();
405 $this->ctrl->redirect($this,
"properties");
408 $form->setValuesByPost();
419 $template_settings = $hide_rte_switch = null;
420 $template = $this->
object->getTemplate();
423 include_once
"Services/Administration/classes/class.ilSettingsTemplate.php";
426 $template_settings = $template->getSettings();
427 $hide_rte_switch = $template_settings[
"rte_switch"][
"hide"];
430 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
432 $form->setFormAction($this->ctrl->getFormAction($this));
433 $form->setTableWidth(
"100%");
434 $form->setId(
"survey_properties");
438 $header->setTitle($this->lng->txt(
"settings"));
439 $form->addItem($header);
444 $online->setChecked($this->object->isOnline());
445 $form->addItem($online);
450 include_once
'Services/MetaData/classes/class.ilMD.php';
451 $md_obj =
new ilMD($this->object->getId(), 0,
"svy");
455 $title->setRequired(
true);
456 $title->setValue($md_section->getTitle());
459 $ids = $md_section->getDescriptionIds();
462 $desc_obj = $md_section->getDescription(array_pop($ids));
467 $desc->setValue($desc_obj->getDescription());
468 $form->addItem($desc);
472 $pool_usage =
new ilCheckboxInputGUI($this->lng->txt(
"survey_question_pool_usage"),
"use_pool");
474 $pool_usage->setChecked($this->object->getPoolUsage());
475 $form->addItem($pool_usage);
477 if(!$template_settings[
"anonymization_options"][
"hide"] ||
478 !$template_settings[
"enabled_start_date"][
"hide"] ||
479 !$template_settings[
"enabled_end_date"][
"hide"])
483 $acc->setTitle($this->lng->txt(
"access"));
484 $form->addItem($acc);
488 $anonymization_options =
new ilRadioGroupInputGUI($this->lng->txt(
"survey_auth_mode"),
"anonymization_options");
489 $hasDatasets = $this->
object->_hasDatasets($this->object->getSurveyId());
494 $anonymization_options->addOption(
new ilCheckboxOption($this->lng->txt(
"anonymize_personalized"),
495 'personalized',
''));
497 $this->lng->txt(
"anonymize_without_code"),
'anonymize_without_code',
''));
499 $this->lng->txt(
"anonymize_with_code"),
'anonymize_with_code',
''));
500 if(!$this->object->getAnonymize())
502 $anonymization_options->setValue(
'personalized');
506 $anonymization_options->setValue(($this->object->isAccessibleWithoutCode()) ?
507 'anonymize_without_code' :
'anonymize_with_code');
509 $anonymization_options->setInfo($this->lng->txt(
"anonymize_survey_description"));
510 $form->addItem($anonymization_options);
513 $enablestartingtime =
new ilCheckboxInputGUI($this->lng->txt(
"start_date"),
"enabled_start_date");
516 $enablestartingtime->setChecked($this->object->getStartDateEnabled());
519 $startingtime->setShowDate(
true);
520 $startingtime->setShowTime(
true);
521 if ($this->object->getStartDateEnabled())
529 $enablestartingtime->addSubItem($startingtime);
530 $form->addItem($enablestartingtime);
533 $enableendingtime =
new ilCheckboxInputGUI($this->lng->txt(
"end_date"),
"enabled_end_date");
536 $enableendingtime->setChecked($this->object->getEndDateEnabled());
539 $endingtime->setShowDate(
true);
540 $endingtime->setShowTime(
true);
541 if ($this->object->getEndDateEnabled())
549 $enableendingtime->addSubItem($endingtime);
550 $form->addItem($enableendingtime);
555 $info->setTitle($this->lng->txt(
"svy_presentation_properties"));
556 $form->addItem($info);
559 $show_question_titles =
new ilCheckboxInputGUI($this->lng->txt(
"svy_show_questiontitles"),
"show_question_titles");
561 $show_question_titles->setChecked($this->object->getShowQuestionTitles());
562 $form->addItem($show_question_titles);
566 $intro->
setValue($this->object->prepareTextareaOutput($this->object->getIntroduction()));
569 $intro->setUseRte(TRUE);
570 $intro->setInfo($this->lng->txt(
"survey_introduction_info"));
571 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
573 $intro->addPlugin(
"latex");
574 $intro->addButton(
"latex");
575 $intro->addButton(
"pastelatex");
576 $intro->setRTESupport($this->object->getId(),
"svy",
"survey", null, $hide_rte_switch,
"3.4.7");
577 $form->addItem($intro);
581 $finalstatement->
setValue($this->object->prepareTextareaOutput($this->object->getOutro()));
582 $finalstatement->setRows(10);
583 $finalstatement->setCols(80);
584 $finalstatement->setUseRte(TRUE);
586 $finalstatement->addPlugin(
"latex");
587 $finalstatement->addButton(
"latex");
588 $finalstatement->addButton(
"pastelatex");
589 $finalstatement->setRTESupport($this->object->getId(),
"svy",
"survey", null, $hide_rte_switch,
"3.4.7");
590 $form->addItem($finalstatement);
595 $results->setTitle($this->lng->txt(
"results"));
599 $evaluation_access =
new ilRadioGroupInputGUI($this->lng->txt(
'evaluation_access'),
"evaluation_access");
600 $evaluation_access->
setInfo($this->lng->txt(
'evaluation_access_description'));
604 $evaluation_access->setValue($this->object->getEvaluationAccess());
605 $form->addItem($evaluation_access);
608 $mailnotification =
new ilCheckboxInputGUI($this->lng->txt(
"mailnotification"),
"mailnotification");
611 $mailnotification->setChecked($this->object->getMailNotification());
614 $mailaddresses =
new ilTextInputGUI($this->lng->txt(
"mailaddresses"),
"mailaddresses");
615 $mailaddresses->
setValue($this->object->getMailAddresses());
616 $mailaddresses->setSize(80);
617 $mailaddresses->setInfo($this->lng->txt(
'mailaddresses_info'));
618 $mailaddresses->setRequired(
true);
621 $participantdata =
new ilTextAreaInputGUI($this->lng->txt(
"mailparticipantdata"),
"mailparticipantdata");
622 $participantdata->
setValue($this->object->getMailParticipantData());
623 $participantdata->setRows(6);
624 $participantdata->setCols(80);
625 $participantdata->setUseRte(
false);
626 $participantdata->setInfo($this->lng->txt(
'mailparticipantdata_info'));
629 $placeholders = array(
630 "FIRST_NAME" =>
"firstname",
631 "LAST_NAME" =>
"lastname",
634 $txt = array($this->lng->txt(
"mailparticipantdata_placeholder"));
635 foreach($placeholders as $placeholder => $caption)
637 $txt[] =
"[".strtoupper($placeholder).
"]: ".$this->lng->txt($caption);
639 $txt = implode(
"<br />", $txt);
641 $participantdatainfo->setValue($txt);
643 $mailnotification->addSubItem($mailaddresses);
644 $mailnotification->addSubItem($participantdata);
645 $mailnotification->addSubItem($participantdatainfo);
646 $form->addItem($mailnotification);
648 $form->addCommandButton(
"saveProperties", $this->lng->txt(
"save"));
651 if($template_settings)
653 foreach($template_settings as $id => $item)
657 $form->removeItemByPostVar($id);
674 if (!$ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"]))
676 $this->ctrl->redirect($this,
"");
686 if($this->object->getTemplate())
688 $link = $this->ctrl->getLinkTarget($this,
"confirmResetTemplate");
689 $link =
"<a href=\"".$link.
"\">".$this->lng->txt(
"survey_using_template_link").
"</a>";
690 $message =
"<div style=\"margin-top:10px\">".
691 $tpl->getMessageHTML(sprintf($this->lng->txt(
"survey_using_template"),
696 $this->tpl->setContent($a_form->getHTML().$message);
709 if (count($items[
"blocks"]) + count($items[
"questions"]) + count($items[
"headings"]) > 0)
717 ilUtil::sendInfo($this->lng->txt(
"no_question_selected_for_removal"),
true);
718 $this->ctrl->redirect($this,
"questions");
727 $inserted_objects = 0;
728 if (is_array(
$_POST[
'q_id']))
732 include_once
"Modules/Survey/classes/class.ilSurveyPageGUI.php";
734 $page_gui->determineCurrentPage();
739 foreach (
$_POST[
'q_id'] as $question_id)
743 $this->
object->insertQuestion($question_id);
748 $page_gui->insertNewQuestion($question_id);
753 if ($inserted_objects)
755 $this->
object->saveCompletionStatus();
759 $this->ctrl->redirect($this,
"questions");
764 if(substr(
$_REQUEST[
"pgov_pos"], -1) ==
"c")
776 $this->ctrl->setParameterByClass(
"ilsurveypagegui",
"pgov", $target_page);
777 $this->ctrl->redirectByClass(
"ilsurveypagegui",
"renderpage");
783 $this->ctrl->setParameter($this,
"pgov",
$_REQUEST[
"pgov"]);
784 $this->ctrl->setParameter($this,
"pgov_pos",
$_REQUEST[
"pgov_pos"]);
785 $this->ctrl->redirect($this,
'browseForQuestions');
794 $inserted_objects = 0;
795 if (is_array(
$_POST[
'cb']))
799 include_once
"Modules/Survey/classes/class.ilSurveyPageGUI.php";
801 $page_gui->determineCurrentPage();
806 foreach (
$_POST[
'cb'] as $questionblock_id)
810 $this->
object->insertQuestionblock($questionblock_id);
814 $page_gui->insertQuestionblock($questionblock_id);
819 if ($inserted_objects)
821 $this->
object->saveCompletionStatus();
822 ilUtil::sendSuccess(($inserted_objects == 1) ? $this->lng->txt(
"questionblock_inserted") : $this->lng->txt(
"questionblocks_inserted"),
true);
825 $this->ctrl->redirect($this,
"questions");
830 if(substr(
$_REQUEST[
"pgov_pos"], -1) ==
"c")
834 $this->ctrl->setParameterByClass(
"ilsurveypagegui",
"pgov", $target_page);
835 $this->ctrl->redirectByClass(
"ilsurveypagegui",
"renderpage");
841 $this->ctrl->setParameter($this,
"pgov",
$_REQUEST[
"pgov"]);
842 $this->ctrl->setParameter($this,
"pgov_pos",
$_REQUEST[
"pgov_pos"]);
843 $this->ctrl->redirect($this,
'browseForQuestionblocks');
853 $ilUser->writePref(
'svy_insert_type',
$_POST[
'datatype']);
854 $this->ctrl->setParameter($this,
"pgov",
$_REQUEST[
"pgov"]);
855 $this->ctrl->setParameter($this,
"pgov_pos",
$_REQUEST[
"pgov_pos"]);
856 switch (
$_POST[
"datatype"])
859 $this->ctrl->redirect($this,
'browseForQuestionblocks');
863 $this->ctrl->redirect($this,
'browseForQuestions');
873 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
875 $table_gui->writeFilterToSession();
876 $this->ctrl->setParameter($this,
"pgov",
$_REQUEST[
"pgov"]);
877 $this->ctrl->setParameter($this,
"pgov_pos",
$_REQUEST[
"pgov_pos"]);
878 $this->ctrl->redirect($this,
'browseForQuestionblocks');
886 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
888 $table_gui->resetFilter();
889 $this->ctrl->setParameter($this,
"pgov",
$_REQUEST[
"pgov"]);
890 $this->ctrl->setParameter($this,
"pgov_pos",
$_REQUEST[
"pgov_pos"]);
891 $this->ctrl->redirect($this,
'browseForQuestionblocks');
902 $this->ctrl->setParameter($this,
"pgov",
$_REQUEST[
"pgov"]);
903 $this->ctrl->setParameter($this,
"pgov_pos",
$_REQUEST[
"pgov_pos"]);
906 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_questionbrowser.html",
"Modules/Survey");
907 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
909 $table_gui->
setEditable($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']));
910 $arrFilter = array();
911 foreach ($table_gui->getFilterItems() as $item)
913 if ($item->getValue() !==
false)
915 $arrFilter[$item->getPostVar()] = $item->getValue();
918 $data = $this->
object->getQuestionblocksTable($arrFilter);
919 $table_gui->setData(
$data);
920 $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());
922 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
'changeDatatype'));
923 $this->tpl->setVariable(
"OPTION_QUESTIONS", $this->lng->txt(
"questions"));
924 $this->tpl->setVariable(
"OPTION_QUESTIONBLOCKS", $this->lng->txt(
"questionblocks"));
925 $this->tpl->setVariable(
"SELECTED_QUESTIONBLOCKS",
" selected=\"selected\"");
926 $this->tpl->setVariable(
"TEXT_DATATYPE", $this->lng->txt(
"display_all_available"));
927 $this->tpl->setVariable(
"BTN_CHANGE", $this->lng->txt(
"change"));
935 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
937 $table_gui->writeFilterToSession();
938 $this->ctrl->setParameter($this,
"pgov",
$_REQUEST[
"pgov"]);
939 $this->ctrl->setParameter($this,
"pgov_pos",
$_REQUEST[
"pgov_pos"]);
940 $this->ctrl->redirect($this,
'browseForQuestions');
948 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
950 $table_gui->resetFilter();
951 $this->ctrl->setParameter($this,
"pgov",
$_REQUEST[
"pgov"]);
952 $this->ctrl->setParameter($this,
"pgov_pos",
$_REQUEST[
"pgov_pos"]);
953 $this->ctrl->redirect($this,
'browseForQuestions');
964 $this->ctrl->setParameter($this,
"pgov",
$_REQUEST[
"pgov"]);
965 $this->ctrl->setParameter($this,
"pgov_pos",
$_REQUEST[
"pgov_pos"]);
968 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_questionbrowser.html",
"Modules/Survey");
969 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
971 $table_gui->
setEditable($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']));
972 $arrFilter = array();
973 foreach ($table_gui->getFilterItems() as $item)
975 if ($item->getValue() !==
false)
977 $arrFilter[$item->getPostVar()] = $item->getValue();
980 $data = $this->
object->getQuestionsTable($arrFilter);
985 $pools = $table_gui->getQuestionPools();
988 $data[$idx][
"spl"] = $pools[
$row[
"obj_fi"]];
992 $table_gui->setData(
$data);
993 $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());
995 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
'changeDatatype'));
996 $this->tpl->setVariable(
"OPTION_QUESTIONS", $this->lng->txt(
"questions"));
997 $this->tpl->setVariable(
"OPTION_QUESTIONBLOCKS", $this->lng->txt(
"questionblocks"));
998 $this->tpl->setVariable(
"SELECTED_QUESTIONS",
" selected=\"selected\"");
999 $this->tpl->setVariable(
"TEXT_DATATYPE", $this->lng->txt(
"display_all_available"));
1000 $this->tpl->setVariable(
"BTN_CHANGE", $this->lng->txt(
"change"));
1012 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1014 $cgui->setHeaderText($this->lng->txt(
"survey_sure_delete_questions"));
1016 $cgui->setFormAction($this->ctrl->getFormAction($this,
"confirmRemoveQuestions"));
1017 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancelRemoveQuestions");
1018 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmRemoveQuestions");
1022 $surveyquestions =& $this->
object->getSurveyQuestions();
1023 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
1024 foreach ($surveyquestions as $question_id =>
$data)
1026 if (in_array(
$data[
"question_id"], $checked_questions))
1030 $cgui->addItem(
"id_".
$data[
"question_id"],
$data[
"question_id"],
1031 $type.
": ".
$data[
"title"]);
1033 else if((in_array(
$data[
"questionblock_id"], $checked_questionblocks)))
1037 $cgui->addItem(
"id_qb_".
$data[
"questionblock_id"],
$data[
"questionblock_id"],
1038 $data[
"questionblock_title"].
" - ".$type.
": ".
$data[
"title"]);
1045 else if (in_array(
$data[
"question_id"], $checked_headings))
1047 $cgui->addItem(
"id_tb_".
$data[
"question_id"],
$data[
"question_id"],
1052 $this->tpl->setContent($cgui->getHTML());
1065 if ($questionblock_id)
1067 $questionblock = $this->
object->getQuestionblock($questionblock_id);
1070 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1072 $form->setFormAction($this->ctrl->getFormAction($this,
"saveDefineQuestionblock"));
1073 $form->setTableWidth(
"100%");
1074 $form->setId(
"survey_questionblock");
1075 $form->setTitle($this->lng->txt(
"define_questionblock"));
1078 $title->setRequired(
true);
1079 if ($questionblock_id)
1081 $title->setValue($questionblock[
"title"]);
1085 $toggle_blocktitle =
new ilCheckboxInputGUI($this->lng->txt(
"survey_show_blocktitle"),
"show_blocktitle");
1086 $toggle_blocktitle->
setInfo($this->lng->txt(
"survey_show_blocktitle_description"));
1087 if (($questionblock[
"show_blocktitle"]) || (strlen($questionblock_id) == 0))
1089 $toggle_blocktitle->setChecked(
true);
1091 $form->addItem($toggle_blocktitle);
1093 $toggle_questiontitle =
new ilCheckboxInputGUI($this->lng->txt(
"show_questiontext"),
"show_questiontext");
1094 $toggle_questiontitle->
setInfo($this->lng->txt(
"show_questiontext_description"));
1095 if (($questionblock[
"show_questiontext"]) || (strlen($questionblock_id) == 0))
1097 $toggle_questiontitle->setChecked(
true);
1099 $form->addItem($toggle_questiontitle);
1101 $form->addCommandButton(
"saveDefineQuestionblock", $this->lng->txt(
"save"));
1102 $form->addCommandButton(
"cancelDefineQuestionblock", $this->lng->txt(
"cancel"));
1106 foreach ($question_ids as $q_id)
1109 $hidden->setValue($q_id);
1110 $form->addItem($hidden);
1113 if ($questionblock_id)
1116 $hidden->setValue($questionblock_id);
1117 $form->addItem($hidden);
1120 $this->tpl->setContent($form->getHTML());
1132 if(!$this->object->isPoolActive())
1135 $_GET[
"sel_question_types"] =
$_POST[
"sel_question_types"];
1150 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
1153 $sel_question_types = (strlen(
$_POST[
"sel_question_types"])) ?
$_POST[
"sel_question_types"] :
$_GET[
"sel_question_types"];
1154 $this->ctrl->setParameter($this,
"sel_question_types", $sel_question_types);
1155 $form->setFormAction($this->ctrl->getFormAction($this,
"executeCreateQuestion"));
1164 $no_pool =
new ilRadioOption($this->lng->txt(
"survey_no_pool"), 1);
1165 $usage->addOption($no_pool);
1166 $existing_pool =
new ilRadioOption($this->lng->txt(
"survey_existing_pool"), 3);
1167 $usage->addOption($existing_pool);
1168 $new_pool =
new ilRadioOption($this->lng->txt(
"survey_new_pool"), 2);
1169 $usage->addOption($new_pool);
1170 $form->addItem($usage);
1172 if(isset(
$_SESSION[
"svy_qpool_choice"]))
1179 $usage->setValue(1);
1182 $questionpools =& $this->
object->getAvailableQuestionpools(FALSE, TRUE, TRUE,
"write");
1183 $pools =
new ilSelectInputGUI($this->lng->txt(
"select_questionpool"),
"sel_spl");
1185 $existing_pool->addSubItem($pools);
1187 $name =
new ilTextInputGUI($this->lng->txt(
"cat_create_spl"),
"name_spl");
1189 $name->setMaxLength(50);
1190 $new_pool->addSubItem($name);
1197 $form->addCommandButton(
"executeCreateQuestion", $this->lng->txt(
"submit"));
1198 $form->addCommandButton(
"cancelCreateQuestion", $this->lng->txt(
"cancel"));
1200 return $this->tpl->setContent($form->getHTML());
1210 $this->ctrl->redirect($this,
"questions");
1223 $addurl .=
"&pgov=".$_REQUEST[
"pgov"].
"&pgov_pos=".
$_REQUEST[
"pgov_pos"];
1226 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1231 if (
$_POST[
"usage"] == 1)
1234 $_GET[
"ref_id"].
"&cmd=createQuestionForSurvey&new_for_survey=".
1235 $_GET[
"ref_id"].
"&sel_question_types=".
$_GET[
"sel_question_types"].$addurl);
1238 else if (
$_POST[
"usage"] == 3 && strlen(
$_POST[
"sel_spl"]))
1241 $_POST[
"sel_spl"].
"&cmd=createQuestionForSurvey&new_for_survey=".
$_GET[
"ref_id"].
1242 "&sel_question_types=".
$_GET[
"sel_question_types"].$addurl);
1245 elseif (
$_POST[
"usage"] == 2 && strlen(
$_POST[
"name_spl"]))
1249 "&cmd=createQuestionForSurvey&new_for_survey=".$_GET[
"ref_id"].
1250 "&sel_question_types=".$_GET[
"sel_question_types"].$addurl);
1262 $this->ctrl->setParameter($this,
"sel_question_types",
$_GET[
"sel_question_types"]);
1263 $this->ctrl->redirect($this,
"createQuestion");
1276 $parent_ref = $tree->getParentId($this->object->getRefId());
1277 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
1279 $qpl->setType(
"spl");
1280 $qpl->setTitle($name);
1281 $qpl->setDescription(
"");
1283 $qpl->createReference();
1284 $qpl->putInTree($parent_ref);
1285 $qpl->setPermissions($parent_ref);
1288 return $qpl->getRefId();
1303 $save = (strcmp($this->ctrl->getCmd(),
"saveHeading") == 0) ? TRUE : FALSE;
1305 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1307 $form->setFormAction($this->ctrl->getFormAction($this));
1308 $form->setTableWidth(
"100%");
1309 $form->setId(
"survey_heading");
1315 $header->setTitle($this->lng->txt(
"edit_heading"));
1319 $header->setTitle($this->lng->txt(
"add_heading"));
1321 $form->addItem($header);
1323 $survey_questions =& $this->
object->getSurveyQuestions();
1327 $heading->
setValue($this->object->prepareTextareaOutput(array_key_exists(
'heading',
$_POST) ?
$_POST[
'heading'] : $survey_questions[$question_id][
"heading"]));
1328 $heading->setRows(10);
1329 $heading->setCols(80);
1330 $heading->setUseRte(TRUE);
1331 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
1333 $heading->removePlugin(
"ibrowser");
1334 $heading->setRTESupport($this->object->getId(),
"svy",
"survey", null,
false,
"3.4.7");
1335 $heading->setRequired(
true);
1336 $form->addItem($heading);
1338 $insertbefore =
new ilSelectInputGUI($this->lng->txt(
"insert"),
"insertbefore");
1340 foreach ($survey_questions as $key => $value)
1342 $options[$key] = $this->lng->txt(
"before") .
": \"" . $value[
"title"] .
"\"";
1345 $insertbefore->setValue((array_key_exists(
'insertbefore',
$_REQUEST)) ?
$_REQUEST[
'insertbefore'] : $question_id);
1346 $insertbefore->setRequired(
true);
1347 if ($question_id || array_key_exists(
'insertbefore',
$_REQUEST))
1349 $insertbefore->setDisabled(
true);
1351 $form->addItem($insertbefore);
1353 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form->addCommandButton(
"saveHeading", $this->lng->txt(
"save"));
1354 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form->addCommandButton(
"cancelHeading", $this->lng->txt(
"cancel"));
1359 $errors = !$form->checkInput();
1360 $form->setValuesByPost();
1361 if (
$errors) $checkonly =
false;
1363 if (!$checkonly) $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
1375 foreach (
$_POST as $key => $value) {
1376 if (preg_match(
"/id_(\d+)/", $key, $matches)) {
1377 if (
$_GET[
"browsetype"] == 1)
1379 $this->
object->insertQuestion($matches[1]);
1383 $this->
object->insertQuestionBlock($matches[1]);
1387 $this->
object->saveCompletionStatus();
1389 $this->ctrl->redirect($this,
"questions");
1399 $this->ctrl->redirect($this,
"questions");
1414 $insertbefore =
$_POST[
"insertbefore"];
1417 $insertbefore =
$_POST[
"insertbefore_original"];
1419 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
1421 $this->ctrl->redirect($this,
"questions");
1434 $this->ctrl->redirect($this,
"questions");
1446 $this->
object->saveHeading(
"",
$_POST[
"removeheading"]);
1447 $this->ctrl->redirect($this,
"questions");
1459 $this->ctrl->redirect($this,
"questions");
1472 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_confirm_removeheading.html",
"Modules/Survey");
1473 $this->tpl->setCurrentBlock(
"adm_content");
1474 $this->tpl->setVariable(
"BTN_CONFIRM_REMOVE", $this->lng->txt(
"confirm"));
1475 $this->tpl->setVariable(
"BTN_CANCEL_REMOVE", $this->lng->txt(
"cancel"));
1476 $this->tpl->setVariable(
"REMOVE_HEADING",
$_GET[
"removeheading"]);
1477 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"confirmRemoveHeading"));
1478 $this->tpl->parseCurrentBlock();
1490 $checked_questions = array();
1491 $checked_questionblocks = array();
1492 $checked_headings = array();
1493 foreach (
$_POST as $key => $value)
1495 if (preg_match(
"/id_(\d+)/", $key, $matches))
1497 array_push($checked_questions, $matches[1]);
1499 if (preg_match(
"/id_qb_(\d+)/", $key, $matches))
1501 array_push($checked_questionblocks, $matches[1]);
1503 if (preg_match(
"/id_tb_(\d+)/", $key, $matches))
1505 array_push($checked_headings, $matches[1]);
1509 if(
sizeof($checked_questions) ||
sizeof($checked_questionblocks))
1511 $this->
object->removeQuestions($checked_questions, $checked_questionblocks);
1513 if($checked_headings)
1515 foreach($checked_headings as $q_id)
1517 $this->
object->saveHeading(
"", $q_id);
1520 $this->
object->saveCompletionStatus();
1522 $this->ctrl->redirect($this,
"questions");
1534 $this->ctrl->redirect($this,
"questions");
1546 protected function gatherSelectedTableItems($allow_blocks =
true, $allow_questions =
true, $allow_headings =
false, $allow_questions_in_blocks =
false)
1548 $block_map = array();
1549 foreach($this->object->getSurveyQuestions() as $item)
1551 $block_map[$item[
"question_id"]] = $item[
"questionblock_id"];
1554 $questions = $blocks = $headings = array();
1557 foreach (
$_POST[
"id"] as $key)
1560 if ($allow_questions && preg_match(
"/cb_(\d+)/", $key, $matches))
1562 if(($allow_questions_in_blocks || !$block_map[$matches[1]]) &&
1563 !in_array($block_map[$matches[1]], $blocks))
1565 array_push($questions, $matches[1]);
1569 if ($allow_blocks && preg_match(
"/cb_qb_(\d+)/", $key, $matches))
1571 array_push($blocks, $matches[1]);
1574 if ($allow_headings && preg_match(
"/cb_tb_(\d+)/", $key, $matches))
1576 array_push($headings, $matches[1]);
1581 return array(
"questions" => $questions,
1582 "blocks" => $blocks,
1583 "headings" => $headings);
1596 if(
sizeof(
$_POST[
"qids"]))
1598 $items[
"questions"] =
$_POST[
"qids"];
1600 if (count($items[
"questions"]) < 2)
1602 ilUtil::sendInfo($this->lng->txt(
"qpl_define_questionblock_select_missing"),
true);
1603 $this->ctrl->redirect($this,
"questions");
1619 $show_questiontext = (
$_POST[
"show_questiontext"]) ? 1 : 0;
1620 $show_blocktitle = (
$_POST[
"show_blocktitle"]) ? 1 : 0;
1621 if (
$_POST[
"questionblock_id"])
1623 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1628 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1632 $this->ctrl->setParameter($this,
"pgov",
$_REQUEST[
"pgov"]);
1633 $this->ctrl->redirect($this,
"questions");
1649 if (count($items[
"blocks"]))
1652 $this->
object->unfoldQuestionblocks($items[
"blocks"]);
1658 $this->ctrl->redirect($this,
"questions");
1667 $this->ctrl->redirect($this,
"questions");
1677 $move_questions = $items[
"questions"];
1678 foreach ($items[
"blocks"] as $block_id)
1680 foreach ($this->object->getQuestionblockQuestionIds($block_id) as $qid)
1682 array_push($move_questions, $qid);
1685 if (count($move_questions) == 0)
1688 $this->ctrl->redirect($this,
"questions");
1692 $_SESSION[
"move_questions"] = $move_questions;
1693 ilUtil::sendInfo($this->lng->txt(
"select_target_position_for_move_question"));
1709 while(!$insert_id &&
sizeof(
$_POST[
"id"]))
1711 $target = array_shift(
$_POST[
"id"]);
1712 if (preg_match(
"/^cb_(\d+)$/", $target, $matches))
1715 if(in_array($matches[1], $items[
"questions"]))
1717 $insert_id = $matches[1];
1720 if (!$insert_id && preg_match(
"/^cb_qb_(\d+)$/", $target, $matches))
1722 $ids = $this->
object->getQuestionblockQuestionIds($matches[1]);
1725 if ($insert_mode == 0)
1727 $insert_id = $ids[0];
1729 else if ($insert_mode == 1)
1731 $insert_id = $ids[count($ids)-1];
1745 $this->
object->moveQuestions(
$_SESSION[
"move_questions"], $insert_id, $insert_mode);
1749 $this->ctrl->redirect($this,
"questions");
1773 if(isset(
$_POST[
"order"]))
1778 foreach(array_keys(
$_POST[
"order"]) as $id)
1781 if(substr($id, 0, 3) ==
"qb_")
1783 $block_id = substr($id, 3);
1784 $block =
$_POST[
"block_order"][$block_id];
1786 foreach(array_keys($block) as $question_id)
1789 $order[$question_id] = $position;
1794 $question_id = substr($id, 2);
1796 $order[$question_id] = $position;
1799 $this->
object->updateOrder($order);
1802 $obligatory = array();
1803 foreach (
$_POST as $key => $value)
1805 if (preg_match(
"/obligatory_(\d+)/", $key, $matches))
1807 $obligatory[$matches[1]] = 1;
1810 $this->
object->setObligatoryStates($obligatory);
1812 $this->ctrl->redirect($this,
"questions");
1820 global $rbacsystem, $ilToolbar, $ilUser;
1824 $hasDatasets = $this->
object->_hasDatasets($this->object->getSurveyId());
1825 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1826 if ((!$rbacsystem->checkAccess(
"read", $this->ref_id)) && (!$rbacsystem->checkAccess(
"write", $this->ref_id)))
1830 $path = $this->tree->getPathFull($this->object->getRefID());
1835 if (
$_GET[
"new_id"] > 0)
1838 $existing = $this->
object->getExistingQuestions();
1839 if (!in_array(
$_GET[
"new_id"], $existing))
1841 $inserted = $this->
object->insertQuestion(
$_GET[
"new_id"]);
1851 ilUtil::redirect(
"ilias.php?baseClass=ilObjSurveyQuestionPoolGUI&ref_id=" . $_GET[
"eqpl"] .
"&cmd=editQuestionForSurvey&calling_survey=".$_GET[
"ref_id"].
"&q_id=" . $_GET[
"eqid"]);
1855 $_SESSION[
"calling_survey"] = $this->
object->getRefId();
1858 if ($_GET[
"editheading"])
1887 if ($_GET[
"removeheading"])
1893 if ($_GET[
"editblock"])
1902 $selected_array = array();
1903 array_push($selected_array, $_GET[
"add"]);
1905 $this->insertQuestionsForm($selected_array);
1912 $read_only = (!$rbacsystem->checkAccess(
"write", $this->ref_id) || $hasDatasets);
1920 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
1923 $qtypes[
$data[
"type_tag"]] = $translation;
1926 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
1927 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
1928 $types =
new ilSelectInputGUI($this->lng->txt(
"create_new"),
"sel_question_types");
1930 $ilToolbar->addInputItem($types,
"");
1931 $ilToolbar->addFormButton($this->lng->txt(
"svy_create_question"),
"createQuestion");
1933 if($this->object->isPoolActive())
1935 $ilToolbar->addSeparator();
1937 $cmd = ($ilUser->getPref(
'svy_insert_type') == 1 || strlen($ilUser->getPref(
'svy_insert_type')) == 0) ?
'browseForQuestions' :
'browseForQuestionblocks';
1938 $ilToolbar->addButton($this->lng->txt(
"browse_for_questions"),
1939 $this->ctrl->getLinkTarget($this,
$cmd));
1942 $ilToolbar->addSeparator();
1944 $ilToolbar->addButton($this->lng->txt(
"add_heading"),
1945 $this->ctrl->getLinkTarget($this,
"addHeading"));
1950 $link = $this->ctrl->getLinkTarget($this,
"maintenance");
1951 $link =
"<a href=\"".$link.
"\">".$this->lng->txt(
"survey_has_datasets_warning_page_view_link").
"</a>";
1952 ilUtil::sendInfo($this->lng->txt(
"survey_has_datasets_warning_page_view").
" ".$link);
1958 include_once
"Modules/Survey/classes/class.ilSurveyQuestionTableGUI.php";
1961 $this->tpl->setContent($table->getHTML());
1973 include_once(
"./Modules/Survey/classes/class.ilSurveyEvaluationGUI.php");
1975 $this->ctrl->setCmdClass(get_class($eval_gui));
1976 $this->ctrl->redirect($eval_gui,
"evaluation");
1985 if (is_array(
$_POST[
"user_select"]))
1987 foreach (
$_POST[
"user_select"] as $user_id)
1989 $this->
object->disinviteUser($user_id);
1993 $this->ctrl->redirect($this,
"invite");
2003 if (is_array($a_user_ids))
2005 foreach ($a_user_ids as $user_id)
2007 $this->
object->inviteUser($user_id);
2021 $this->ctrl->redirect($this,
"invite");
2029 $mode =
$_POST[
'invitation'];
2033 $this->
object->setInvitation(0);
2036 $this->
object->setInvitation(1);
2037 $this->
object->setInvitationMode(0);
2040 $this->
object->setInvitation(1);
2041 $this->
object->setInvitationMode(1);
2044 $this->
object->saveToDb();
2046 $this->ctrl->redirect($this,
"invite");
2060 if ((!$rbacsystem->checkAccess(
"visible,invite", $this->ref_id)) && (!$rbacsystem->checkAccess(
"write", $this->ref_id)))
2064 $path = $this->tree->getPathFull($this->object->getRefID());
2065 include_once
"./Services/Utilities/classes/class.ilUtil.php";
2076 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
2078 $form->setFormAction($this->ctrl->getFormAction($this));
2079 $form->setTableWidth(
"500");
2080 $form->setId(
"invite");
2084 $header->setTitle($this->lng->txt(
"invitation"));
2085 $form->addItem($header);
2089 $invitation->
setInfo($this->lng->txt(
'invitation_mode_desc'));
2090 $invitation->addOption(
new ilRadioOption($this->lng->txt(
"invitation_off"), 0,
''));
2091 $surveySetting =
new ilSetting(
"survey");
2092 if ($surveySetting->get(
"unlimited_invitation"))
2094 $invitation->addOption(
new ilRadioOption($this->lng->txt(
"unlimited_users"), 1,
''));
2096 $invitation->addOption(
new ilRadioOption($this->lng->txt(
"predefined_users"), 2,
''));
2098 if ($this->object->getInvitation())
2100 $inv = $this->
object->getInvitationMode() + 1;
2102 $invitation->setValue($inv);
2103 $form->addItem($invitation);
2105 $form->addCommandButton(
"saveInvitationStatus", $this->lng->txt(
"save"));
2107 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_invite.html",
"Modules/Survey");
2108 $this->tpl->setVariable(
"INVITATION_TABLE", $form->getHTML());
2110 if ($this->object->getInvitation() && $this->
object->getInvitationMode() == 1)
2113 include_once
'./Services/Search/classes/class.ilRepositorySearchGUI.php';
2118 'auto_complete_name' => $lng->txt(
'user'),
2119 'submit_name' => $lng->txt(
'svy_invite')
2123 $ilToolbar->addSpacer();
2125 $ilToolbar->addButton($this->lng->txt(
"svy_search_users"),
2126 $this->ctrl->getLinkTargetByClass(
'ilRepositorySearchGUI',
''));
2128 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
2130 $invited_users = $this->
object->getUserData($this->object->getInvitedUsers());
2131 include_once
"./Modules/Survey/classes/tables/class.ilSurveyInvitedUsersTableGUI.php";
2133 $table_gui->setData($invited_users);
2134 $this->tpl->setVariable(
'TBL_INVITED_USERS', $table_gui->getHTML());
2144 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_maintenance.html",
"Modules/Survey");
2145 $this->tpl->setCurrentBlock(
"adm_content");
2146 $this->tpl->setVariable(
"BTN_CONFIRM_DELETE_ALL", $this->lng->txt(
"confirm"));
2147 $this->tpl->setVariable(
"BTN_CANCEL_DELETE_ALL", $this->lng->txt(
"cancel"));
2148 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"deleteAllUserData"));
2149 $this->tpl->parseCurrentBlock();
2157 $this->
object->deleteAllUserData();
2159 $this->ctrl->redirect($this,
"maintenance");
2167 $this->ctrl->redirect($this,
"maintenance");
2175 $this->
object->removeSelectedSurveyResults(
$_POST[
"chbUser"]);
2177 $this->ctrl->redirect($this,
"maintenance");
2186 $this->ctrl->redirect($this,
"maintenance");
2196 if (count(
$_POST[
"chbUser"]) == 0)
2199 $this->ctrl->redirect($this,
"maintenance");
2203 include_once
"./Modules/Survey/classes/tables/class.ilSurveyMaintenanceTableGUI.php";
2205 $total =& $this->
object->getSurveyParticipants();
2207 foreach (
$total as $user_data)
2209 if (in_array($user_data[
'active_id'],
$_POST[
'chbUser']))
2211 $last_access = $this->
object->_getLastAccess($user_data[
"active_id"]);
2212 array_push(
$data, array(
2213 'id' => $user_data[
"active_id"],
2214 'name' => $user_data[
"sortname"],
2215 'login' => $user_data[
"login"],
2216 'last_access' => $last_access
2220 $table_gui->setData(
$data);
2221 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
2231 if (
$_GET[
"fill"] > 0)
2233 for ($i = 0; $i <
$_GET[
"fill"]; $i++) $this->object->fillSurveyForUser();
2235 include_once
"./Modules/Survey/classes/tables/class.ilSurveyMaintenanceTableGUI.php";
2237 $total =& $this->
object->getSurveyParticipants();
2239 foreach (
$total as $user_data)
2241 $last_access = $this->
object->_getLastAccess($user_data[
"active_id"]);
2242 array_push(
$data, array(
2243 'id' => $user_data[
"active_id"],
2244 'name' => $user_data[
"sortname"],
2245 'login' => $user_data[
"login"],
2246 'last_access' => $last_access
2249 $table_gui->setData(
$data);
2250 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
2255 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
2257 $form->setTarget(
"_top");
2258 $form->setFormAction($this->ctrl->getFormAction($this));
2259 $form->setTitle($this->lng->txt(
"import"));
2261 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
2262 $fi =
new ilFileInputGUI($this->lng->txt(
"import_file"),
"importfile");
2264 $fi->setRequired(
true);
2265 $form->addItem($fi);
2267 include_once(
"./Modules/Survey/classes/class.ilObjSurvey.php");
2269 $questionspools = $svy->getAvailableQuestionpools(
true,
true,
true);
2271 $pools =
new ilSelectInputGUI($this->lng->txt(
"select_questionpool_short"),
"spl");
2272 $pools->
setOptions(array(
""=>$this->lng->txt(
"dont_use_questionpool")) + $questionspools);
2273 $pools->setRequired(
false);
2274 $form->addItem($pools);
2276 $form->addCommandButton(
"importFile", $this->lng->txt(
"import"));
2277 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
2289 $parent_id =
$_GET[
"ref_id"];
2295 $ilErr->raiseError($this->lng->txt(
"no_create_permission"));
2298 $this->lng->loadLanguageModule($new_type);
2299 $this->ctrl->setParameter($this,
"new_type", $new_type);
2302 if ($form->checkInput())
2304 include_once(
"./Modules/Survey/classes/class.ilObjSurvey.php");
2306 $newObj->setType($new_type);
2307 $newObj->setTitle(
"dummy");
2308 $newObj->setDescription(
"dummy");
2309 $newObj->create(
true);
2313 $error = $newObj->importObject($_FILES[
"importfile"], $form->getInput(
"spl"));
2317 $this->ilias->raiseError($error, $this->ilias->error_obj->MESSAGE);
2323 "&baseClass=ilObjSurveyGUI");
2326 include_once
"Services/Administration/classes/class.ilSettingsTemplate.php";
2331 $tpl->addJavaScript(
"./Modules/Scorm2004/scripts/questions/jquery.js");
2334 $this->tpl->setCurrentBlock(
"template_option");
2335 $this->tpl->setVariable(
"VAL_TEMPLATE_OPTION",
"");
2336 $this->tpl->setVariable(
"TXT_TEMPLATE_OPTION", $this->lng->txt(
"none"));
2337 $this->tpl->parseCurrentBlock();
2339 foreach($templates as $item)
2341 $this->tpl->setCurrentBlock(
"template_option");
2342 $this->tpl->setVariable(
"VAL_TEMPLATE_OPTION", $item[
"id"]);
2343 $this->tpl->setVariable(
"TXT_TEMPLATE_OPTION", $item[
"title"]);
2344 $this->tpl->parseCurrentBlock();
2346 $desc = str_replace(
"\n",
"", nl2br($item[
"description"]));
2347 $desc = str_replace(
"\r",
"", $desc);
2349 $this->tpl->setCurrentBlock(
"js_data");
2350 $this->tpl->setVariable(
"JS_DATA_ID", $item[
"id"]);
2351 $this->tpl->setVariable(
"JS_DATA_TEXT", $desc);
2352 $this->tpl->parseCurrentBlock();
2355 $this->tpl->setCurrentBlock(
"templates");
2356 $this->tpl->setVariable(
"TXT_TEMPLATE", $this->lng->txt(
"svy_settings_template"));
2357 $this->tpl->parseCurrentBlock();
2362 $form->setValuesByPost();
2363 $tpl->setContent($form->getHtml());
2373 $export_dir = $this->
object->getExportDirectory();
2374 $export_files = $this->
object->getExportFiles($export_dir);
2376 if(count($export_files) > 0)
2378 foreach($export_files as $exp_file)
2380 $file_arr = explode(
"__", $exp_file);
2382 array_push(
$data, array(
2383 'file' => $exp_file,
2384 'size' => filesize($export_dir.
"/".$exp_file),
2390 include_once
"./Modules/Survey/classes/tables/class.ilSurveyExportTableGUI.php";
2392 $table_gui->setData(
$data);
2393 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
2402 include_once(
"./Modules/Survey/classes/class.ilSurveyExport.php");
2404 $survey_exp->buildExportFile();
2405 $this->ctrl->redirect($this,
"export");
2413 if(!isset(
$_POST[
"file"]))
2416 $this->ctrl->redirect($this,
"export");
2419 if (count(
$_POST[
"file"]) > 1)
2422 $this->ctrl->redirect($this,
"export");
2427 $export_dir = $this->
object->getExportDirectory();
2428 include_once
"./Services/Utilities/classes/class.ilUtil.php";
2439 if (!isset(
$_POST[
"file"]))
2442 $this->ctrl->redirect($this,
"export");
2447 $export_dir = $this->
object->getExportDirectory();
2448 $export_files = $this->
object->getExportFiles($export_dir);
2450 if (count(
$_POST[
"file"]) > 0)
2452 foreach (
$_POST[
"file"] as $exp_file)
2454 $file_arr = explode(
"__", $exp_file);
2456 array_push(
$data, array(
2457 'file' => $exp_file,
2458 'size' => filesize($export_dir.
"/".$exp_file),
2464 include_once
"./Modules/Survey/classes/tables/class.ilSurveyExportTableGUI.php";
2466 $table_gui->setData(
$data);
2467 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
2477 $this->ctrl->redirect($this,
"export");
2486 $export_dir = $this->
object->getExportDirectory();
2489 $file = basename($file);
2491 $exp_file = $export_dir.
"/".
$file;
2492 $exp_dir = $export_dir.
"/".substr($file, 0, strlen($file) - 4);
2493 if (@is_file($exp_file))
2497 if (@is_dir($exp_dir))
2499 include_once
"./Services/Utilities/classes/class.ilUtil.php";
2504 $this->ctrl->redirect($this,
"export");
2512 if (strcmp(
$_POST[
"lang"],
"-1") != 0)
2515 $ilUser->writePref(
"survey_code_language",
$_POST[
"lang"]);
2518 $this->ctrl->redirect($this,
'codes');
2528 global $ilUser, $ilToolbar;
2529 if ($this->object->getAnonymize() != 1 && !$this->
object->isAccessibleWithCodeForAll())
2534 $default_lang = $ilUser->getPref(
"survey_code_language");
2537 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
2538 $languages = $this->lng->getInstalledLanguages();
2540 foreach ($languages as
$lang)
2542 $options[
$lang] = $this->lng->txt(
"lang_$lang");
2544 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
2547 $si->setValue($default_lang);
2548 $ilToolbar->addInputItem($si,
true);
2549 $ilToolbar->addFormButton($this->lng->txt(
"set"),
"setCodeLanguage");
2551 include_once
"./Modules/Survey/classes/tables/class.ilSurveyCodesTableGUI.php";
2553 $survey_codes =& $this->
object->getSurveyCodesTableData($default_lang);
2554 $table_gui->setData($survey_codes);
2555 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_codes.html",
true);
2556 $this->tpl->setCurrentBlock(
"adm_content");
2557 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"codes"));
2558 $this->tpl->setVariable(
"TEXT_CREATE", $this->lng->txt(
"create"));
2559 $this->tpl->setVariable(
"TEXT_SURVEY_CODES", $this->lng->txt(
"new_survey_codes"));
2560 $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());
2568 if (is_array(
$_POST[
"chb_code"]) && (count(
$_POST[
"chb_code"]) > 0))
2570 foreach (
$_POST[
"chb_code"] as $survey_code)
2572 $this->
object->deleteSurveyCode($survey_code);
2580 $this->ctrl->redirect($this,
'codes');
2588 if (is_array(
$_POST[
"chb_code"]) && (count(
$_POST[
"chb_code"]) > 0))
2590 $export = $this->
object->getSurveyCodesForExport(
$_POST[
"chb_code"]);
2596 $this->ctrl->redirect($this,
'codes');
2605 $export = $this->
object->getSurveyCodesForExport(array());
2614 if (preg_match(
"/\d+/",
$_POST[
"nrOfCodes"]))
2616 $this->
object->createSurveyCodes(
$_POST[
"nrOfCodes"]);
2623 $this->ctrl->redirect($this,
'codes');
2636 $savefields = (strcmp($this->ctrl->getCmd(),
"saveMailTableFields") == 0) ? TRUE : FALSE;
2638 include_once
"./Modules/Survey/classes/tables/class.ilSurveyCodesMailTableGUI.php";
2639 $data = $this->
object->getExternalCodeRecipients();
2641 $table_gui->setData(
$data);
2642 $table_gui->setTitle($this->lng->txt(
'externalRecipients'));
2643 $table_gui->completeColumns();
2644 $tabledata = $table_gui->getHTML();
2648 $this->tpl->setVariable(
'ADM_CONTENT', $tabledata);
2658 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
2660 $form_gui->setValuesByPost();
2663 if ($form_gui->getSavedMessages()->getValue() > 0)
2666 $settings = $this->
object->getUserSettings($ilUser->getId(),
'savemessage');
2667 $form_gui->getMailMessage()->setValue($settings[$form_gui->getSavedMessages()->getValue()][
'value']);
2678 $ilLog->write(
'Error: ' + $e->getMessage());
2680 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
2688 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
2690 $form_gui->setValuesByPost();
2693 if ($form_gui->getSavedMessages()->getValue() > 0)
2695 $this->
object->deleteUserSettings($form_gui->getSavedMessages()->getValue());
2697 $form_gui->setValuesByPost();
2708 $ilLog->write(
'Error: ' + $e->getMessage());
2710 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
2718 $mailData[
'm_subject'] = (array_key_exists(
'm_subject',
$_POST)) ?
$_POST[
'm_subject'] : sprintf($this->lng->txt(
'default_codes_mail_subject'), $this->
object->getTitle());
2719 $mailData[
'm_message'] = (array_key_exists(
'm_message',
$_POST)) ?
$_POST[
'm_message'] : $this->lng->txt(
'default_codes_mail_message');
2720 $mailData[
'm_notsent'] = (array_key_exists(
'm_notsent',
$_POST)) ?
$_POST[
'm_notsent'] :
'1';
2722 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
2724 $form_gui->setValuesByArray($mailData);
2725 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
2735 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
2737 if ($form_gui->checkInput())
2739 $code_exists = strpos(
$_POST[
'm_message'],
'[code]') !== FALSE;
2743 $form_gui->setValuesByPost();
2747 if (
$_POST[
'savemessage'] == 1)
2750 $title = (strlen(
$_POST[
'savemessagetitle'])) ?
$_POST[
'savemessagetitle'] : ilStr::substr(
$_POST[
'm_message'], 0, 40) .
'...';
2751 $this->
object->saveUserSettings($ilUser->getId(),
'savemessage',
$title,
$_POST[
'm_message']);
2754 $lang = $ilUser->getPref(
"survey_code_language");
2762 $this->ctrl->redirect($this,
'codesMail');
2767 $form_gui->setValuesByPost();
2769 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
2774 $this->ctrl->redirect($this,
'codesMail');
2779 if (!is_array(
$_POST[
'chb_ext']) || count(is_array(
$_POST[
'chb_ext'])) == 0)
2782 $this->ctrl->redirect($this,
'codesMail');
2784 foreach (
$_POST[
'chb_ext'] as $code)
2786 $this->
object->deleteSurveyCode($code);
2789 $this->ctrl->redirect($this,
'codesMail');
2798 $existingdata = $this->
object->getExternalCodeRecipients();
2799 if (count($existingdata))
2801 $first = array_shift($existingdata);
2802 foreach ($first as $key => $value)
2804 if (strcmp($key,
'code') != 0 && strcmp($key,
'sent') != 0)
2812 $this->
object->createSurveyCodesForExternalData(array(
$data));
2815 $this->ctrl->redirect($this,
'codesMail');
2824 $data = preg_split(
"/[\n\r]/",
$_POST[
'externaltext']);
2825 $fields = preg_split(
"/;/", array_shift(
$data));
2826 if (!in_array(
'email', $fields))
2830 $this->ctrl->redirect($this,
'importExternalMailRecipients');
2832 $existingdata = $this->
object->getExternalCodeRecipients();
2833 $existingcolumns = array();
2834 if (count($existingdata))
2836 $first = array_shift($existingdata);
2837 foreach ($first as $key => $value)
2839 array_push($existingcolumns, $key);
2842 $founddata = array();
2843 foreach (
$data as $datarow)
2845 $row = preg_split(
"/;/", $datarow);
2846 if (count(
$row) == count($fields))
2849 foreach ($fields as $idx => $fieldname)
2851 if (count($existingcolumns))
2853 if (array_key_exists($idx, $existingcolumns))
2855 $dataset[$fieldname] =
$row[$idx];
2860 $dataset[$fieldname] =
$row[$idx];
2863 if (strlen($dataset[
'email']))
2865 array_push($founddata, $dataset);
2869 $this->
object->createSurveyCodesForExternalData($founddata);
2871 $this->ctrl->redirect($this,
'codesMail');
2880 include_once
"./Services/Utilities/classes/class.ilCSVReader.php";
2882 $reader->open($_FILES[
'externalmails'][
'tmp_name']);
2884 $fields = array_shift(
$data);
2885 if (!in_array(
'email', $fields))
2889 $this->ctrl->redirect($this,
'codesMail');
2891 $existingdata = $this->
object->getExternalCodeRecipients();
2892 $existingcolumns = array();
2893 if (count($existingdata))
2895 $first = array_shift($existingdata);
2896 foreach ($first as $key => $value)
2898 array_push($existingcolumns, $key);
2901 $founddata = array();
2904 if (count($row) == count($fields))
2907 foreach ($fields as $idx => $fieldname)
2909 if (count($existingcolumns))
2911 if (array_key_exists($idx, $existingcolumns))
2913 $dataset[$fieldname] = $row[$idx];
2918 $dataset[$fieldname] = $row[$idx];
2921 if (strlen($dataset[
'email']))
2923 array_push($founddata, $dataset);
2928 $this->
object->createSurveyCodesForExternalData($founddata);
2930 $this->ctrl->redirect($this,
'codesMail');
2942 strcmp($this->ctrl->getCmd(),
"importExternalRecipientsFromFile") == 0 ||
2943 strcmp($this->ctrl->getCmd(),
"importExternalRecipientsFromText") == 0 ||
2944 strcmp($this->ctrl->getCmd(),
"importExternalRecipientsFromDataset") == 0
2947 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
2949 $form_import_file->setFormAction($this->ctrl->getFormAction($this));
2950 $form_import_file->setTableWidth(
"100%");
2951 $form_import_file->setId(
"codes_import_file");
2954 $headerfile->setTitle($this->lng->txt(
"import_from_file"));
2955 $form_import_file->addItem($headerfile);
2957 $externalmails =
new ilFileInputGUI($this->lng->txt(
"externalmails"),
"externalmails");
2958 $externalmails->
setInfo($this->lng->txt(
'externalmails_info'));
2959 $externalmails->setRequired(
true);
2960 $form_import_file->addItem($externalmails);
2961 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_file->addCommandButton(
"importExternalRecipientsFromFile", $this->lng->txt(
"import"));
2962 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_file->addCommandButton(
"codesMail", $this->lng->txt(
"cancel"));
2967 $form_import_text->setFormAction($this->ctrl->getFormAction($this));
2968 $form_import_text->setTableWidth(
"100%");
2969 $form_import_text->setId(
"codes_import_text");
2972 $headertext->setTitle($this->lng->txt(
"import_from_text"));
2973 $form_import_text->addItem($headertext);
2976 if (array_key_exists(
'externaltext',
$_SESSION) && strlen(
$_SESSION[
'externaltext']))
2982 $inp->setValue($this->lng->txt(
'mail_import_example1') .
"\n" . $this->lng->txt(
'mail_import_example2') .
"\n" . $this->lng->txt(
'mail_import_example3') .
"\n");
2984 $inp->setRequired(
true);
2987 $inp->setInfo($this->lng->txt(
'externaltext_info'));
2988 $form_import_text->addItem($inp);
2991 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_text->addCommandButton(
"importExternalRecipientsFromText", $this->lng->txt(
"import"));
2992 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_text->addCommandButton(
"codesMail", $this->lng->txt(
"cancel"));
2997 $form_import_dataset->setFormAction($this->ctrl->getFormAction($this));
2998 $form_import_dataset->setTableWidth(
"100%");
2999 $form_import_dataset->setId(
"codes_import_dataset");
3002 $headerfile->setTitle($this->lng->txt(
"import_from_dataset"));
3003 $form_import_dataset->addItem($headerfile);
3005 $existingdata = $this->
object->getExternalCodeRecipients();
3006 $existingcolumns = array(
'email');
3007 if (count($existingdata))
3009 $first = array_shift($existingdata);
3010 foreach ($first as $key => $value)
3012 if (strcmp($key,
'email') != 0 && strcmp($key,
'code') != 0 && strcmp($key,
'sent') != 0)
3014 array_push($existingcolumns, $key);
3019 foreach ($existingcolumns as $column)
3023 if (strcmp($column,
'email') == 0)
3025 $inp->setRequired(
true);
3029 $inp->setRequired(
false);
3031 $form_import_dataset->addItem($inp);
3033 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_dataset->addCommandButton(
"importExternalRecipientsFromDataset", $this->lng->txt(
"import"));
3034 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_dataset->addCommandButton(
"codesMail", $this->lng->txt(
"cancel"));
3043 $errors = !$form_import_file->checkInput();
3044 $form_import_file->setValuesByPost();
3045 if (
$errors) $checkonly =
false;
3048 $errors = !$form_import_text->checkInput();
3049 $form_import_text->setValuesByPost();
3050 if (
$errors) $checkonly =
false;
3053 $errors = !$form_import_dataset->checkInput();
3054 $form_import_dataset->setValuesByPost();
3055 if (
$errors) $checkonly =
false;
3062 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_external_mail.html",
"Modules/Survey");
3063 $this->tpl->setVariable(
"HEADLINE", $this->lng->txt(
"external_mails_import"));
3064 $this->tpl->setVariable(
"FORM1", $form_import_file->getHTML());
3065 $this->tpl->setVariable(
"FORM2", $form_import_text->getHTML());
3066 $this->tpl->setVariable(
"FORM3", $form_import_dataset->getHTML());
3076 if (strlen(
$_POST[
"v"]) == 0)
3081 $survey_questions =& $this->
object->getSurveyQuestions();
3082 $structure =&
$_SESSION[
"constraintstructure"];
3083 $include_elements =
$_SESSION[
"includeElements"];
3084 foreach ($include_elements as $elementCounter)
3086 if (is_array($structure[$elementCounter]))
3088 if (strlen(
$_GET[
"precondition"]))
3095 foreach ($structure[$elementCounter] as $key => $question_id)
3097 $this->
object->addConstraintToQuestion($question_id, $constraint_id);
3100 if (count($structure[$elementCounter]) > 1)
3102 $this->
object->updateConjunctionForQuestions($structure[$elementCounter],
$_POST[
'c']);
3107 unset(
$_SESSION[
"constraintstructure"]);
3108 $this->ctrl->redirect($this,
"constraints");
3116 $survey_questions =& $this->
object->getSurveyQuestions();
3117 $structure =&
$_SESSION[
"constraintstructure"];
3118 $start =
$_GET[
"start"];
3119 $option_questions = array();
3120 for ($i = 1; $i < $start; $i++)
3122 if (is_array($structure[$i]))
3124 foreach ($structure[$i] as $key => $question_id)
3126 if ($survey_questions[$question_id][
"usableForPrecondition"])
3128 array_push($option_questions, array(
"question_id" => $survey_questions[$question_id][
"question_id"],
"title" => $survey_questions[$question_id][
"title"],
"type_tag" => $survey_questions[$question_id][
"type_tag"]));
3133 if (count($option_questions) == 0)
3136 unset(
$_SESSION[
"constraintstructure"]);
3137 ilUtil::sendInfo($this->lng->txt(
"constraints_no_nonessay_available"),
true);
3138 $this->ctrl->redirect($this,
"constraints");
3148 $survey_questions =& $this->
object->getSurveyQuestions();
3149 $option_questions = array();
3150 array_push($option_questions, array(
"question_id" =>
$_POST[
"q"],
"title" => $survey_questions[
$_POST[
"q"]][
"title"],
"type_tag" => $survey_questions[$_POST[
"q"]][
"type_tag"]));
3151 $this->
constraintForm(2, $_POST, $survey_questions, $option_questions);
3159 $survey_questions =& $this->
object->getSurveyQuestions();
3160 $option_questions = array();
3161 if (strlen(
$_GET[
"precondition"]))
3163 $pc = $this->
object->getPrecondition(
$_GET[
"precondition"]);
3164 $postvalues = array(
3165 "c" => $pc[
"conjunction"],
3166 "q" => $pc[
"question_fi"],
3167 "r" => $pc[
"relation_id"],
3170 array_push($option_questions, array(
"question_id" => $pc[
"question_fi"],
"title" => $survey_questions[$pc[
"question_fi"]][
"title"],
"type_tag" => $survey_questions[$pc[
"question_fi"]][
"type_tag"]));
3171 $this->
constraintForm(3, $postvalues, $survey_questions, $option_questions);
3175 array_push($option_questions, array(
"question_id" =>
$_POST[
"q"],
"title" => $survey_questions[
$_POST[
"q"]][
"title"],
"type_tag" => $survey_questions[$_POST[
"q"]][
"type_tag"]));
3176 $this->
constraintForm(3, $_POST, $survey_questions, $option_questions);
3180 public function constraintForm($step, $postvalues, &$survey_questions, $questions = FALSE)
3182 if (strlen(
$_GET[
"start"])) $this->ctrl->setParameter($this,
"start",
$_GET[
"start"]);
3183 $this->ctrl->saveParameter($this,
"precondition");
3184 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
3186 $form->setFormAction($this->ctrl->getFormAction($this));
3187 $form->setTableWidth(
"100%");
3188 $form->setId(
"constraintsForm");
3191 if ($survey_questions[
$_SESSION[
"constraintstructure"][
$_GET[
"start"]][0]][
"questionblock_id"] > 0)
3193 $title = $this->lng->txt(
"questionblock") .
": " . $survey_questions[
$_SESSION[
"constraintstructure"][
$_GET[
"start"]][0]][
"questionblock_title"];
3197 $title = $this->lng->txt($survey_questions[
$_SESSION[
"constraintstructure"][
$_GET[
"start"]][0]][
"type_tag"]) .
": " . $survey_questions[
$_SESSION[
"constraintstructure"][$_GET[
"start"]][0]][
"title"];
3200 $header->setTitle(
$title);
3201 $form->addItem($header);
3205 $fulfilled->addOption(
new ilRadioOption($this->lng->txt(
"conjunction_or"),
'1',
''));
3206 $fulfilled->setValue((strlen($postvalues[
'c'])) ? $postvalues[
'c'] : 0);
3207 $form->addItem($fulfilled);
3209 $step1 =
new ilSelectInputGUI($this->lng->txt(
"step") .
" 1: " . $this->lng->txt(
"select_prior_question"),
"q");
3211 if (is_array($questions))
3213 foreach ($questions as $question)
3218 $step1->setOptions($options);
3219 $step1->setValue($postvalues[
"q"]);
3220 $form->addItem($step1);
3224 $relations = $this->
object->getAllRelations();
3225 $step2 =
new ilSelectInputGUI($this->lng->txt(
"step") .
" 2: " . $this->lng->txt(
"select_relation"),
"r");
3227 foreach ($relations as $rel_id => $relation)
3229 if (in_array($relation[
"short"], $survey_questions[$postvalues[
"q"]][
"availableRelations"]))
3231 $options[$rel_id] = $relation[
'short'];
3235 $step2->setValue($postvalues[
"r"]);
3236 $form->addItem($step2);
3241 $variables =& $this->
object->getVariables($postvalues[
"q"]);
3242 $question_type = $survey_questions[$postvalues[
"q"]][
"type_tag"];
3243 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
3245 $question =
new $question_type();
3246 $question->loadFromDb($postvalues[
"q"]);
3248 $step3 = $question->getPreconditionSelectValue($postvalues[
"v"], $this->lng->txt(
"step") .
" 3: " . $this->lng->txt(
"select_value"),
"v");
3249 $form->addItem($step3);
3255 $cmd_continue =
"constraintStep2";
3256 $cmd_back =
"constraints";
3259 $cmd_continue =
"constraintStep3";
3260 $cmd_back =
"constraintStep1";
3263 $cmd_continue =
"constraintsAdd";
3264 $cmd_back =
"constraintStep2";
3267 $form->addCommandButton($cmd_back, $this->lng->txt(
"back"));
3268 $form->addCommandButton($cmd_continue, $this->lng->txt(
"continue"));
3270 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
3278 $survey_questions =& $this->
object->getSurveyQuestions();
3279 $structure =&
$_SESSION[
"constraintstructure"];
3280 foreach (
$_POST as $key => $value)
3282 if (preg_match(
"/^constraint_(\d+)_(\d+)/", $key, $matches))
3284 $this->
object->deleteConstraint($matches[2]);
3288 $this->ctrl->redirect($this,
"constraints");
3293 $include_elements =
$_POST[
"includeElements"];
3294 if ((!is_array($include_elements)) || (count($include_elements) == 0))
3296 ilUtil::sendInfo($this->lng->txt(
"constraints_no_questions_or_questionblocks_selected"),
true);
3297 $this->ctrl->redirect($this,
"constraints");
3299 else if (count($include_elements) >= 1)
3301 $_SESSION[
"includeElements"] = $include_elements;
3302 sort($include_elements, SORT_NUMERIC);
3303 $_GET[
"start"] = $include_elements[0];
3311 $this->ctrl->setParameter($this,
"precondition",
$_GET[
"precondition"]);
3312 $this->ctrl->setParameter($this,
"start",
$_GET[
"start"]);
3313 $this->ctrl->redirect($this,
"constraintStep3");
3325 $hasDatasets = $this->
object->_hasDatasets($this->object->getSurveyId());
3327 if (array_key_exists(
"step",
$_GET)) $step =
$_GET[
"step"];
3342 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_constraints_list.html",
"Modules/Survey");
3343 $survey_questions =& $this->
object->getSurveyQuestions();
3344 $last_questionblock_id = 0;
3346 $hasPreconditions = FALSE;
3347 $structure = array();
3348 $colors = array(
"tblrow1",
"tblrow2");
3349 foreach ($survey_questions as $question_id =>
$data)
3353 if (
$data[
"questionblock_id"] > 0)
3356 $type = $this->lng->txt(
"questionblock");
3357 if (
$data[
"questionblock_id"] != $last_questionblock_id)
3359 $last_questionblock_id =
$data[
"questionblock_id"];
3360 $structure[$counter] = array();
3361 array_push($structure[$counter],
$data[
"question_id"]);
3365 array_push($structure[$counter-1],
$data[
"question_id"]);
3371 $structure[$counter] = array(
$data[
"question_id"]);
3372 $type = $this->lng->txt(
"question");
3378 $this->tpl->setCurrentBlock(
"description");
3379 $this->tpl->setVariable(
"DESCRIPTION", $this->lng->txt(
"constraints_first_question_description"));
3380 $this->tpl->parseCurrentBlock();
3384 $constraints =& $this->
object->getConstraints(
$data[
"question_id"]);
3386 if (count($constraints))
3388 $hasPreconditions = TRUE;
3389 foreach ($constraints as $constraint)
3391 $this->tpl->setCurrentBlock(
"constraint");
3392 $this->tpl->setVariable(
"SEQUENCE_ID", $counter);
3393 $this->tpl->setVariable(
"CONSTRAINT_ID", $constraint[
"id"]);
3394 $this->tpl->setVariable(
"CONSTRAINT_TEXT", $survey_questions[$constraint[
"question"]][
"title"] .
" " . $constraint[
"short"] .
" " . $constraint[
"valueoutput"]);
3395 $this->tpl->setVariable(
"TEXT_EDIT_PRECONDITION", $this->lng->txt(
"edit"));
3396 $this->ctrl->setParameter($this,
"precondition", $constraint[
"id"]);
3397 $this->ctrl->setParameter($this,
"start", $counter);
3398 $this->tpl->setVariable(
"EDIT_PRECONDITION", $this->ctrl->getLinkTarget($this,
"editPrecondition"));
3399 $this->ctrl->setParameter($this,
"precondition",
"");
3400 $this->ctrl->setParameter($this,
"start",
"");
3401 $this->tpl->parseCurrentBlock();
3403 if (count($constraints) > 1)
3405 $this->tpl->setCurrentBlock(
"conjunction");
3406 $this->tpl->setVariable(
"TEXT_CONJUNCTION", ($constraints[0][
'conjunction']) ? $this->lng->txt(
'conjunction_or_title') : $this->lng->txt(
'conjunction_and_title'));
3407 $this->tpl->parseCurrentBlock();
3413 $this->tpl->setCurrentBlock(
"include_elements");
3414 $this->tpl->setVariable(
"QUESTION_NR",
"$counter");
3415 $this->tpl->parseCurrentBlock();
3417 $this->tpl->setCurrentBlock(
"constraint_section");
3418 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
3419 $this->tpl->setVariable(
"QUESTION_NR",
"$counter");
3420 $this->tpl->setVariable(
"TITLE",
"$title");
3421 $icontype =
"question.gif";
3422 if (
$data[
"questionblock_id"] > 0)
3424 $icontype =
"questionblock.gif";
3426 $this->tpl->setVariable(
"TYPE",
"$type: ");
3427 include_once
"./Services/Utilities/classes/class.ilUtil.php";
3429 $this->tpl->setVariable(
"ICON_ALT", $type);
3430 $this->tpl->parseCurrentBlock();
3434 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets)
3436 if ($hasPreconditions)
3438 $this->tpl->setCurrentBlock(
"selectall_preconditions");
3439 $this->tpl->setVariable(
"SELECT_ALL_PRECONDITIONS", $this->lng->txt(
"select_all"));
3440 $this->tpl->parseCurrentBlock();
3442 $this->tpl->setCurrentBlock(
"selectall");
3444 $this->tpl->setVariable(
"SELECT_ALL", $this->lng->txt(
"select_all"));
3445 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
3446 $this->tpl->parseCurrentBlock();
3448 if ($hasPreconditions)
3450 $this->tpl->setCurrentBlock(
"delete_button");
3451 $this->tpl->setVariable(
"BTN_DELETE", $this->lng->txt(
"delete"));
3452 include_once
"./Services/Utilities/classes/class.ilUtil.php";
3453 $this->tpl->setVariable(
"ARROW",
"<img src=\"" .
ilUtil::getImagePath(
"arrow_downright.gif") .
"\" alt=\"".$this->lng->txt(
"arrow_downright").
"\">");
3454 $this->tpl->parseCurrentBlock();
3457 $this->tpl->setCurrentBlock(
"buttons");
3458 $this->tpl->setVariable(
"ARROW",
"<img src=\"" .
ilUtil::getImagePath(
"arrow_downright.gif") .
"\" alt=\"".$this->lng->txt(
"arrow_downright").
"\">");
3459 $this->tpl->setVariable(
"BTN_CREATE_CONSTRAINTS", $this->lng->txt(
"constraint_add"));
3460 $this->tpl->parseCurrentBlock();
3462 $this->tpl->setCurrentBlock(
"adm_content");
3463 $this->tpl->setVariable(
"CONSTRAINTS_INTRODUCTION", $this->lng->txt(
"constraints_introduction"));
3464 $this->tpl->setVariable(
"DEFINED_PRECONDITIONS", $this->lng->txt(
"existing_constraints"));
3465 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"constraints"));
3466 $this->tpl->setVariable(
"CONSTRAINTS_HEADER", $this->lng->txt(
"constraints_list_of_entities"));
3467 $this->tpl->parseCurrentBlock();
3468 $_SESSION[
"constraintstructure"] = $structure;
3472 $link = $this->ctrl->getLinkTarget($this,
"maintenance");
3473 $link =
"<a href=\"".$link.
"\">".$this->lng->txt(
"survey_has_datasets_warning_page_view_link").
"</a>";
3474 ilUtil::sendInfo($this->lng->txt(
"survey_has_datasets_warning_page_view").
" ".$link);
3485 $this->ctrl->setCmd(
"showSummary");
3486 $this->ctrl->setCmdClass(
"ilinfoscreengui");
3493 $tpl =
new ilTemplate(
"tpl.il_svy_svy_main.html", TRUE, TRUE,
"Modules/Survey");
3496 $tpl->setVariable(
"LOCATION_STYLESHEET",$location_stylesheet);
3497 $tpl->setVariable(
"LOCATION_JAVASCRIPT",dirname($location_stylesheet));
3508 if (!$ilAccess->checkAccess(
"visible",
"", $this->ref_id))
3510 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
3513 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
3515 include_once
"./Modules/Survey/classes/class.ilSurveyExecutionGUI.php";
3517 $info->setFormAction($this->ctrl->getFormAction($output_gui,
"infoScreen"));
3518 $info->enablePrivateNotes();
3519 $anonymize_key = NULL;
3520 if ($this->object->getAnonymize() == 1)
3522 if (
$_SESSION[
"anonymous_id"][$this->object->getId()])
3524 $anonymize_key =
$_SESSION[
"anonymous_id"][$this->
object->getId()];
3526 else if (
$_POST[
"anonymous_id"])
3528 $anonymize_key =
$_POST[
"anonymous_id"];
3531 $canStart = $this->
object->canStartSurvey($anonymize_key);
3532 $showButtons = $canStart[
"result"];
3535 if($canStart[
"edit_settings"] &&
3536 $ilAccess->checkAccess(
"write",
"", $this->ref_id))
3538 $canStart[
"messages"][] =
"<a href=\"".$this->ctrl->getLinkTarget($this,
"properties").
"\">» ".
3539 $this->lng->txt(
"survey_edit_settings").
"</a>";
3544 $big_button =
false;
3548 if (!$this->object->getAnonymize())
3550 $survey_started = $this->
object->isSurveyStarted($ilUser->getId(),
"");
3552 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
3558 if ($survey_started === 1)
3562 elseif ($survey_started === 0)
3564 $big_button = array(
"resume", $this->lng->txt(
"resume_survey"));
3566 elseif ($survey_started === FALSE)
3568 $big_button = array(
"start", $this->lng->txt(
"start_survey"));
3573 else if ($this->object->getAnonymize() && !$this->
object->isAccessibleWithoutCode())
3575 if ((
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID || $this->object->isAccessibleWithCodeForAll()) && (strlen(
$_POST[
"anonymous_id"]) == 0) && (strlen(
$_SESSION[
"anonymous_id"][$this->object->getId()]) == 0))
3577 $info->setFormAction($this->ctrl->getFormAction($this,
"infoScreen"));
3578 $info->addSection($this->lng->txt(
"anonymization"));
3579 $info->addProperty(
"", $this->lng->txt(
"anonymize_anonymous_introduction"));
3580 $info->addPropertyTextinput($this->lng->txt(
"enter_anonymous_id"),
"anonymous_id",
"", 8,
"infoScreen", $this->lng->txt(
"submit"));
3584 if (strlen(
$_POST[
"anonymous_id"]) > 0)
3586 if (!$this->object->checkSurveyCode(
$_POST[
"anonymous_id"]))
3592 $anonymize_key =
$_POST[
"anonymous_id"];
3595 else if (strlen(
$_SESSION[
"anonymous_id"][$this->object->getId()]) > 0)
3597 if (!$this->object->checkSurveyCode(
$_SESSION[
"anonymous_id"][$this->object->getId()]))
3603 $anonymize_key =
$_SESSION[
"anonymous_id"][$this->
object->getId()];
3609 $anonymize_key = $this->
object->getUserAccessCode($ilUser->getId());
3610 if (!strlen($anonymize_key))
3612 $anonymize_key = $this->
object->createNewAccessCode();
3613 $this->
object->saveUserAccessCode($ilUser->getId(), $anonymize_key);
3616 $info->addHiddenElement(
"anonymous_id", $anonymize_key);
3617 $survey_started = $this->
object->isSurveyStarted($ilUser->getId(), $anonymize_key);
3618 if ($survey_started === 1)
3622 elseif ($survey_started === 0)
3624 $big_button = array(
"resume", $this->lng->txt(
"resume_survey"));
3626 elseif ($survey_started === FALSE)
3628 $big_button = array(
"start", $this->lng->txt(
"start_survey"));
3635 $survey_started = $this->
object->isSurveyStarted($ilUser->getId(),
"");
3636 if ($survey_started === 1)
3640 elseif ($survey_started === 0)
3642 $big_button = array(
"resume", $this->lng->txt(
"resume_survey"));
3644 elseif ($survey_started === FALSE)
3646 $big_button = array(
"start", $this->lng->txt(
"start_survey"));
3653 $big_button =
'<div class="il_ButtonGroup" style="margin:25px; text-align:center; font-size:25px;">'.
3654 '<input type="submit" class="submit" name="cmd['.$big_button[0].
']" value="'.
3655 $big_button[1].
'" style="padding:10px;" /></div>';
3658 if (strlen($this->object->getIntroduction()))
3660 $introduction = $this->
object->getIntroduction();
3661 $info->addSection($this->lng->txt(
"introduction"));
3662 $info->addProperty(
"", $this->object->prepareTextareaOutput($introduction).
3663 $big_button.
"<br />".$info->getHiddenToggleButton());
3667 $info->addSection(
"");
3668 $info->addProperty(
"", $big_button.$info->getHiddenToggleButton());
3671 $info->hideFurtherSections(
false);
3673 $info->addSection($this->lng->txt(
"svy_general_properties"));
3674 if (strlen($this->object->getAuthor()))
3676 $info->addProperty($this->lng->txt(
"author"), $this->
object->getAuthor());
3678 $info->addProperty($this->lng->txt(
"title"), $this->
object->getTitle());
3679 switch ($this->object->getAnonymize())
3682 $info->addProperty($this->lng->txt(
"anonymization"), $this->lng->txt(
"anonymize_personalized"));
3685 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
3687 $info->addProperty($this->lng->txt(
"anonymization"), $this->lng->txt(
"info_anonymize_with_code"));
3691 $info->addProperty($this->lng->txt(
"anonymization"), $this->lng->txt(
"info_anonymize_registered_user"));
3695 $info->addProperty($this->lng->txt(
"anonymization"), $this->lng->txt(
"info_anonymize_without_code"));
3698 include_once
"./Modules/Survey/classes/class.ilObjSurveyAccess.php";
3701 $info->addProperty($this->lng->txt(
"evaluation_access"), $this->lng->txt(
"evaluation_access_info"));
3703 $info->addMetaDataSections($this->object->getId(),0, $this->
object->getType());
3704 $this->ctrl->forwardCommand($info);
3717 $template =
new ilTemplate(
"tpl.il_svy_svy_printview.html", TRUE, TRUE,
"Modules/Survey");
3719 include_once
'./Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
3722 $this->ctrl->setParameter($this,
"pdf",
"1");
3723 $template->setCurrentBlock(
"pdf_export");
3724 $template->setVariable(
"PDF_URL", $this->ctrl->getLinkTarget($this,
"printView"));
3725 $this->ctrl->setParameter($this,
"pdf",
"");
3726 $template->setVariable(
"PDF_TEXT", $this->lng->txt(
"pdf_export"));
3727 $template->setVariable(
"PDF_IMG_ALT", $this->lng->txt(
"pdf_export"));
3729 $template->parseCurrentBlock();
3731 $template->setVariable(
"PRINT_TEXT", $this->lng->txt(
"print"));
3732 $template->setVariable(
"PRINT_URL",
"javascript:window.print();");
3734 $pages =& $this->
object->getSurveyPages();
3735 foreach ($pages as $page)
3737 if (count($page) > 0)
3739 foreach ($page as $question)
3741 $questionGUI = $this->
object->getQuestionGUI($question[
"type_tag"], $question[
"question_id"]);
3742 if (is_object($questionGUI))
3744 if (strlen($question[
"heading"]))
3746 $template->setCurrentBlock(
"textblock");
3747 $template->setVariable(
"TEXTBLOCK", $question[
"heading"]);
3748 $template->parseCurrentBlock();
3750 $template->setCurrentBlock(
"question");
3751 $template->setVariable(
"QUESTION_DATA", $questionGUI->getPrintView($this->object->getShowQuestionTitles(), $question[
"questionblock_show_questiontext"], $this->
object->getSurveyId()));
3752 $template->parseCurrentBlock();
3755 if (count($page) > 1)
3757 $template->setCurrentBlock(
"page");
3758 $template->setVariable(
"BLOCKTITLE", $page[0][
"questionblock_title"]);
3759 $template->parseCurrentBlock();
3763 $template->setCurrentBlock(
"page");
3764 $template->parseCurrentBlock();
3768 $this->tpl->addCss(
"./Modules/Survey/templates/default/survey_print.css",
"print");
3769 if (array_key_exists(
"pdf",
$_GET) && (
$_GET[
"pdf"] == 1))
3771 $printbody =
new ilTemplate(
"tpl.il_as_tst_print_body.html", TRUE, TRUE,
"Modules/Test");
3772 $printbody->setVariable(
"TITLE", sprintf($this->lng->txt(
"tst_result_user_name"), $uname));
3773 $printbody->setVariable(
"ADM_CONTENT", $template->get());
3774 $printoutput = $printbody->get();
3775 $printoutput = preg_replace(
"/href=\".*?\"/",
"", $printoutput);
3776 $fo = $this->
object->processPrintoutput2FO($printoutput);
3777 $this->
object->deliverPDFfromFO($fo);
3781 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
3788 switch ($this->ctrl->getCmd())
3794 case "redirectQuestion":
3795 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
"infoScreen"),
"",
$_GET[
"ref_id"]);
3798 case "checkEvaluationAccess":
3799 case "evaluationdetails":
3800 case "evaluationuser":
3801 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluation"),
"",
$_GET[
"ref_id"]);
3810 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
"infoScreen"),
"",
$_GET[
"ref_id"]);
3813 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"",
$_GET[
"ref_id"]);
3827 $questions_per_page = ($a_cmd ==
'questions_per_page') ?
true :
false;
3828 $questions = ($a_cmd ==
'questions') ?
true :
false;
3829 $printview = ($a_cmd ==
'printview') ?
true :
false;
3831 $hidden_tabs = array();
3832 $template = $this->
object->getTemplate();
3835 include_once
"Services/Administration/classes/class.ilSettingsTemplate.php";
3837 $hidden_tabs = $template->getHiddenTabs();
3840 $this->tabs_gui->addSubTabTarget(
"survey_per_page_view", $this->ctrl->getLinkTargetByClass(
"ilsurveypagegui",
"renderPage"),
3841 "",
"",
"", $questions_per_page);
3843 if(!in_array(
"survey_question_editor", $hidden_tabs))
3845 $this->ctrl->setParameter($this,
"pgov",
"");
3846 $this->tabs_gui->addSubTabTarget(
"survey_question_editor", $this->ctrl->getLinkTarget($this,
"questions"),
3847 "",
"",
"", $questions);
3848 $this->ctrl->setParameter($this,
"pgov",
$_REQUEST[
"pgov"]);
3851 $this->tabs_gui->addSubTabTarget(
"print_view", $this->ctrl->getLinkTarget($this,
"printView"),
3852 "",
"",
"", $printview);
3854 if($this->object->getSurveyPages())
3856 if($questions_per_page)
3858 $this->ctrl->setParameterByClass(
"ilsurveyexecutiongui",
"pgov", max(1,
$_REQUEST[
"pg"]));
3860 $this->ctrl->setParameterByClass(
"ilsurveyexecutiongui",
"prvw", 1);
3861 $this->tabs_gui->addSubTabTarget(
"preview", $this->ctrl->getLinkTargetByClass(
"ilsurveyexecutiongui",
"preview"),
3876 $ilTabs->addSubTabTarget
3879 $this->ctrl->getLinkTarget($this,
'codes'),
3880 array(
"codes",
"createSurveyCodes",
"setCodeLanguage",
"deleteCodes",
"exportCodes"),
3884 $ilTabs->addSubTabTarget
3886 "participating_users",
3887 $this->ctrl->getLinkTarget($this,
"codesMail"),
3888 array(
"codesMail",
"saveMailTableFields",
"importExternalMailRecipients",
3889 'importExternalRecipientsFromFile',
'importExternalRecipientsFromText',
3890 'importExternalRecipientsFromDataset'),
3894 $data = $this->
object->getExternalCodeRecipients();
3897 $ilTabs->addSubTabTarget
3899 "mail_survey_codes",
3900 $this->ctrl->getLinkTarget($this,
"mailCodes"),
3901 array(
"mailCodes",
"sendCodesMail",
"insertSavedMessage",
"deleteSavedMessage"),
3917 $ilTabs->addSubTabTarget(
3918 "svy_eval_cumulated",
3919 $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluation"),
3920 array(
"evaluation",
"checkEvaluationAccess"),
3924 $ilTabs->addSubTabTarget(
3926 $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluationdetails"),
3927 array(
"evaluationdetails"),
3931 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
3933 $ilTabs->addSubTabTarget(
3935 $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluationuser"),
3936 array(
"evaluationuser"),
3947 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
3951 $link = $this->ctrl->getLinkTarget($this,
"questions");
3955 $link = $this->ctrl->getLinkTargetByClass(
"ilsurveypagegui",
"renderpage");
3957 $ilTabs->setBackTarget($this->lng->txt(
"menubacktosurvey"), $link);
3958 $ilTabs->addTarget(
"browse_for_questions",
3959 $this->ctrl->getLinkTarget($this,
"browseForQuestions"),
3960 array(
"browseForQuestions",
"browseForQuestionblocks"),
3973 global $ilAccess, $ilUser;
3975 if (strcmp($this->ctrl->getNextClass(),
'ilrepositorysearchgui') != 0)
3977 switch ($this->ctrl->getCmd())
3979 case "browseForQuestions":
3980 case "browseForQuestionblocks":
3981 case "insertQuestions":
3982 case "filterQuestions":
3983 case "resetFilterQuestions":
3984 case "changeDatatype":
3989 case "redirectQuestion":
3994 case "checkEvaluationAccess":
3995 case "evaluationdetails":
3996 case "evaluationuser":
4002 $hidden_tabs = array();
4003 $template = $this->
object->getTemplate();
4006 include_once
"Services/Administration/classes/class.ilSettingsTemplate.php";
4008 $hidden_tabs = $template->getHiddenTabs();
4012 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
4014 $force_active = (
$_GET[
"up"] !=
"" ||
$_GET[
"down"] !=
"")
4018 $cmd = $this->ctrl->getLinkTargetByClass(
"ilsurveypagegui",
"renderPage");
4021 $tabs_gui->addTarget(
"survey_questions",
4023 array(
"questions",
"browseForQuestions",
"createQuestion",
4024 "filterQuestions",
"resetFilterQuestions",
"changeDatatype",
"insertQuestions",
4025 "removeQuestions",
"cancelRemoveQuestions",
"confirmRemoveQuestions",
4026 "defineQuestionblock",
"saveDefineQuestionblock",
"cancelDefineQuestionblock",
4027 "unfoldQuestionblock",
"moveQuestions",
4028 "insertQuestionsBefore",
"insertQuestionsAfter",
"saveObligatory",
4029 "addHeading",
"saveHeading",
"cancelHeading",
"editHeading",
4030 "confirmRemoveHeading",
"cancelRemoveHeading",
"printView",
"renderPage",
4031 "addQuestionToolbarForm",
"deleteBlock",
"movePageForm",
"copyQuestionsToPool"),
4032 "",
"", $force_active);
4035 if ($ilAccess->checkAccess(
"visible",
"", $this->ref_id))
4037 $tabs_gui->addTarget(
"info_short",
4038 $this->ctrl->getLinkTarget($this,
'infoScreen'),
4039 array(
"infoScreen",
"showSummary"));
4043 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
4045 $force_active = ($this->ctrl->getCmd() ==
"")
4048 $tabs_gui->addTarget(
"settings",
4049 $this->ctrl->getLinkTarget($this,
'properties'),
4050 array(
"properties",
"save",
"cancel",
'saveProperties'),
"",
4055 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id) &&
4056 !in_array(
"constraints", $hidden_tabs))
4059 $tabs_gui->addTarget(
"constraints",
4060 $this->ctrl->getLinkTarget($this,
"constraints"),
4061 array(
"constraints",
"constraintStep1",
"constraintStep2",
4062 "constraintStep3",
"constraintsAdd",
"createConstraints",
4063 "editPrecondition"),
4067 if (($ilAccess->checkAccess(
"write",
"", $this->ref_id) || $ilAccess->checkAccess(
"invite",
"", $this->ref_id)) &&
4068 !in_array(
"invitation", $hidden_tabs))
4071 $tabs_gui->addTarget(
"invitation",
4072 $this->ctrl->getLinkTarget($this,
'invite'),
4073 array(
"invite",
"saveInvitationStatus",
4074 "inviteUserGroup",
"disinviteUserGroup"),
4078 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
4081 $tabs_gui->addTarget(
"maintenance",
4082 $this->ctrl->getLinkTarget($this,
'maintenance'),
4083 array(
"maintenance",
"deleteAllUserData"),
4086 if ($this->object->getAnonymize() == 1 || $this->
object->isAccessibleWithCodeForAll())
4089 $tabs_gui->addTarget(
"codes",
4090 $this->ctrl->getLinkTarget($this,
'codes'),
4091 array(
"codes",
"exportCodes",
'codesMail',
'saveMailTableFields',
'importExternalMailRecipients',
4092 'mailCodes',
'sendCodesMail',
'importExternalRecipientsFromFile',
'importExternalRecipientsFromText',
4093 'importExternalRecipientsFromDataset',
'insertSavedMessage',
'deleteSavedMessage'),
4098 include_once
"./Modules/Survey/classes/class.ilObjSurveyAccess.php";
4102 $tabs_gui->addTarget(
"svy_evaluation",
4103 $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluation"),
4104 array(
"evaluation",
"checkEvaluationAccess",
"evaluationdetails",
4109 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
4111 if(!in_array(
"meta_data", $hidden_tabs))
4114 $tabs_gui->addTarget(
"meta_data",
4115 $this->ctrl->getLinkTargetByClass(
'ilmdeditorgui',
'listSection'),
4116 "",
"ilmdeditorgui");
4119 if(!in_array(
"export", $hidden_tabs))
4122 $tabs_gui->addTarget(
"export",
4123 $this->ctrl->getLinkTarget($this,
'export'),
4124 array(
"export",
"createExportFile",
"confirmDeleteExportFile",
4125 "downloadExportFile"),
4131 if ($ilAccess->checkAccess(
"edit_permission",
"", $this->ref_id))
4134 $tabs_gui->addTarget(
"perm_settings",
4135 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
4144 function _goto($a_target, $a_access_code =
"")
4147 if ($ilAccess->checkAccess(
"read",
"", $a_target))
4149 include_once
"./Services/Utilities/classes/class.ilUtil.php";
4150 if (strlen($a_access_code))
4153 $_GET[
"baseClass"] =
"ilObjSurveyGUI";
4154 $_GET[
"cmd"] =
"infoScreen";
4155 $_GET[
"ref_id"] = $a_target;
4156 include(
"ilias.php");
4161 $_GET[
"baseClass"] =
"ilObjSurveyGUI";
4162 $_GET[
"cmd"] =
"infoScreen";
4163 $_GET[
"ref_id"] = $a_target;
4164 include(
"ilias.php");
4168 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
4170 $_GET[
"cmd"] =
"frameset";
4171 $_GET[
"target"] =
"";
4172 $_GET[
"ref_id"] = ROOT_FOLDER_ID;
4175 include(
"repository.php");
4179 $ilErr->raiseError($lng->txt(
"msg_no_perm_read_lm"), $ilErr->FATAL);
4188 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_confirm_resettemplate.html",
"Modules/Survey");
4189 $this->tpl->setCurrentBlock(
"adm_content");
4190 $this->tpl->setVariable(
"BTN_CONFIRM_REMOVE", $this->lng->txt(
"confirm"));
4191 $this->tpl->setVariable(
"BTN_CANCEL_REMOVE", $this->lng->txt(
"cancel"));
4192 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"resetTemplateObject"));
4193 $this->tpl->parseCurrentBlock();
4201 $this->
object->setTemplate(null);
4202 $this->
object->saveToDB();
4205 $this->ctrl->redirect($this,
"properties");
4217 $copy_questions = $items[
"questions"];
4218 foreach ($items[
"blocks"] as $block_id)
4220 foreach ($this->object->getQuestionblockQuestionIds($block_id) as $qid)
4222 array_push($copy_questions, $qid);
4225 $copy_questions = array_unique($copy_questions);
4228 if (count($copy_questions))
4230 foreach($copy_questions as $idx => $question_id)
4233 if($question->getOriginalId())
4235 unset($copy_questions[$idx]);
4240 if (count($copy_questions) == 0)
4242 ilUtil::sendInfo($this->lng->txt(
"no_question_selected_for_copy_to_pool"),
true);
4243 $this->ctrl->redirect($this,
"questions");
4249 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
4252 $form->setFormAction($this->ctrl->getFormAction($this,
"executeCreateQuestion"));
4255 $ids->setValue(implode(
";", $copy_questions));
4256 $form->addItem($ids);
4258 $questionpools =& $this->
object->getAvailableQuestionpools(
false,
false,
true,
"write");
4259 $pools =
new ilSelectInputGUI($this->lng->txt(
"survey_copy_select_questionpool"),
"sel_spl");
4261 $form->addItem($pools);
4263 $form->addCommandButton(
"executeCopyQuestionsToPool", $this->lng->txt(
"submit"));
4264 $form->addCommandButton(
"questions", $this->lng->txt(
"cancel"));
4266 return $this->tpl->setContent($form->getHTML());
4275 $question_ids = explode(
";",
$_POST[
"question_ids"]);
4278 foreach($question_ids as $qid)
4282 $new_question->setId();
4283 $new_question->setObjId($pool_id);
4284 $new_question->saveToDb();
4291 $this->ctrl->redirect($this,
"questions");