41 include_once
"./Services/Object/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());
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':
133 if(!$ilAccess->checkAccess(
'write',
'',$this->object->getRefId()))
135 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->WARNING);
139 include_once
'Services/MetaData/classes/class.ilMDEditorGUI.php';
140 $md_gui =&
new ilMDEditorGUI($this->object->getId(), 0, $this->
object->getType());
141 $md_gui->
addObserver($this->
object,
'MDUpdateListener',
'General');
143 $this->ctrl->forwardCommand($md_gui);
146 case "ilsurveyevaluationgui":
148 include_once(
"./Modules/Survey/classes/class.ilSurveyEvaluationGUI.php");
150 $ret =& $this->ctrl->forwardCommand($eval_gui);
153 case 'ilrepositorysearchgui':
154 include_once(
'./Services/Search/classes/class.ilRepositorySearchGUI.php');
156 $rep_search->setCallback($this,
157 'inviteUserGroupObject',
163 $this->ctrl->setReturn($this,
'invite');
164 $ret =& $this->ctrl->forwardCommand($rep_search);
165 $this->tabs_gui->setTabActive(
'invitation');
168 case "ilsurveyexecutiongui":
169 include_once(
"./Modules/Survey/classes/class.ilSurveyExecutionGUI.php");
171 $ret =& $this->ctrl->forwardCommand($exec_gui);
174 case 'ilpermissiongui':
176 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
178 $ret =& $this->ctrl->forwardCommand($perm_gui);
181 case 'ilobjectcopygui':
182 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
185 $this->ctrl->forwardCommand($cp);
188 case 'ilsurveypagegui':
190 include_once
'./Modules/Survey/classes/class.ilSurveyPageGUI.php';
192 $this->ctrl->forwardCommand($pg);
195 case "ilcommonactiondispatchergui":
196 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
198 $this->ctrl->forwardCommand($gui);
208 if (strtolower(
$_GET[
"baseClass"]) !=
"iladministrationgui" &&
217 include_once
"Services/Administration/classes/class.ilSettingsTemplate.php";
221 foreach($templates as $item)
223 $a_options[
"svytpl_".$item[
"id"]] = array($item[
"title"],
224 nl2br(trim($item[
"description"])));
238 $a_new_object->applySettingsTemplate(
$tpl);
244 $a_new_object->
getRefId().
"&cmd=properties");
256 $this->ctrl->redirect($this,
"properties");
269 if (!$ilAccess->checkAccess(
"write",
"", $this->ref_id))
273 $this->ctrl->redirect($this,
"infoScreen");
287 if ($form->checkInput())
290 if (
$_POST[
'online'] && count($this->object->questions) == 0)
296 $template_settings = null;
297 $template = $this->
object->getTemplate();
300 include_once
"Services/Administration/classes/class.ilSettingsTemplate.php";
302 $template_settings = $template->getSettings();
305 include_once
'Services/MetaData/classes/class.ilMD.php';
306 $md_obj =&
new ilMD($this->object->getId(), 0,
"svy");
314 $md_desc_ids = $md_section->getDescriptionIds();
317 $md_desc = $md_section->getDescription(array_pop($md_desc_ids));
325 $this->
object->update();
327 $this->
object->setStatus(
$_POST[
'online']);
328 $this->
object->setEvaluationAccess(
$_POST[
"evaluation_access"]);
333 $this->
object->setActivationLimited(
true);
334 $this->
object->setActivationVisibility(
$_POST[
"access_visiblity"]);
337 $this->
object->setActivationStartDate($date->get(
IL_CAL_UNIX));
340 $this->
object->setActivationEndDate($date->get(
IL_CAL_UNIX));
344 $this->
object->setActivationLimited(
false);
348 if(!$template_settings[
"enabled_start_date"][
"hide"])
350 if (
$_POST[
"enabled_start_date"])
352 $this->
object->setStartDateAndTime(
$_POST[
"start_date"][
'date'],
$_POST[
"start_date"][
'time']);
356 $this->
object->setStartDate(null);
360 if(!$template_settings[
"enabled_end_date"][
"hide"])
362 if (
$_POST[
"enabled_end_date"])
364 $this->
object->setEndDateAndTime(
$_POST[
"end_date"][
'date'],
$_POST[
"end_date"][
'time']);
368 $this->
object->setEndDate(null);
373 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
374 $introduction =
$_POST[
"introduction"];
375 $this->
object->setIntroduction($introduction);
377 $this->
object->setOutro($outro);
379 $hasDatasets = $this->
object->_hasDatasets($this->object->getSurveyId());
385 if(array_key_exists(
$_POST[
"anonymization_options"], $anon_map))
387 $this->
object->setAnonymize($anon_map[
$_POST[
"anonymization_options"]]);
388 if (strcmp($_POST[
'anonymization_options'],
'anonymize_with_code') == 0) $anonymize =
ANONYMIZE_ON;
389 if (strcmp($_POST[
'anonymization_options'],
'anonymize_with_code_all') == 0) $anonymize =
ANONYMIZE_CODE_ALL;
393 if(!$template_settings[
"show_question_titles"][
"hide"])
395 $this->
object->setShowQuestionTitles(
$_POST[
"show_question_titles"]);
398 if(!$template_settings[
"use_pool"][
"hide"])
400 $this->
object->setPoolUsage(
$_POST[
"use_pool"]);
403 $this->
object->setMailNotification(
$_POST[
'mailnotification']);
404 $this->
object->setMailAddresses(
$_POST[
'mailaddresses']);
405 $this->
object->setMailParticipantData(
$_POST[
'mailparticipantdata']);
406 $this->
object->saveToDb();
416 $this->ctrl->redirect($this,
"properties");
419 $form->setValuesByPost();
430 $template_settings = $hide_rte_switch = null;
431 $template = $this->
object->getTemplate();
434 include_once
"Services/Administration/classes/class.ilSettingsTemplate.php";
437 $template_settings = $template->getSettings();
438 $hide_rte_switch = $template_settings[
"rte_switch"][
"hide"];
441 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
443 $form->setFormAction($this->ctrl->getFormAction($this));
444 $form->setTableWidth(
"100%");
445 $form->setId(
"survey_properties");
449 $header->setTitle($this->lng->txt(
"settings"));
450 $form->addItem($header);
454 include_once
'Services/MetaData/classes/class.ilMD.php';
455 $md_obj =
new ilMD($this->object->getId(), 0,
"svy");
459 $title->setRequired(
true);
460 $title->setValue($md_section->getTitle());
463 $ids = $md_section->getDescriptionIds();
466 $desc_obj = $md_section->getDescription(array_pop($ids));
471 $desc->setValue($desc_obj->getDescription());
472 $form->addItem($desc);
476 $anonymization_options =
new ilRadioGroupInputGUI($this->lng->txt(
"survey_auth_mode"),
"anonymization_options");
477 $hasDatasets = $this->
object->_hasDatasets($this->object->getSurveyId());
482 $anonymization_options->addOption(
new ilCheckboxOption($this->lng->txt(
"anonymize_personalized"),
483 'personalized',
''));
485 $this->lng->txt(
"anonymize_without_code"),
'anonymize_without_code',
''));
487 $this->lng->txt(
"anonymize_with_code"),
'anonymize_with_code',
''));
488 if(!$this->object->getAnonymize())
490 $anonymization_options->setValue(
'personalized');
494 $anonymization_options->setValue(($this->object->isAccessibleWithoutCode()) ?
495 'anonymize_without_code' :
'anonymize_with_code');
497 $anonymization_options->setInfo($this->lng->txt(
"anonymize_survey_description"));
498 $form->addItem($anonymization_options);
501 $pool_usage =
new ilRadioGroupInputGUI($this->lng->txt(
"survey_question_pool_usage"),
"use_pool");
502 $opt =
new ilRadioOption($this->lng->txt(
"survey_question_pool_usage_active"), 1);
503 $opt->
setInfo($this->lng->txt(
"survey_question_pool_usage_active_info"));
504 $pool_usage->addOption($opt);
505 $opt =
new ilRadioOption($this->lng->txt(
"survey_question_pool_usage_inactive"), 0);
506 $opt->
setInfo($this->lng->txt(
"survey_question_pool_usage_inactive_info"));
507 $pool_usage->addOption($opt);
508 $pool_usage->setValue($this->object->getPoolUsage());
509 $form->addItem($pool_usage);
514 include_once
"Services/Object/classes/class.ilObjectActivation.php";
515 $this->lng->loadLanguageModule(
'rep');
518 $section->setTitle($this->lng->txt(
'rep_activation_availability'));
522 $act_obj_info = $act_ref_info =
"";
525 $act_obj_info =
' '.$this->lng->txt(
'rep_activation_online_object_info');
526 $act_ref_info = $this->lng->txt(
'rep_activation_access_ref_info');
530 $online->
setInfo($this->lng->txt(
'svy_activation_online_info').$act_obj_info);
531 $online->setChecked($this->object->isOnline());
532 $form->addItem($online);
535 $act_type->
setInfo($act_ref_info);
536 $act_type->setValue($this->object->isActivationLimited() ?
540 $opt->
setInfo($this->lng->txt(
'svy_availability_limitless_info'));
541 $act_type->addOption($opt);
544 $opt->
setInfo($this->lng->txt(
'svy_availability_until_info'));
546 $date = $this->
object->getActivationStartDate();
548 $start =
new ilDateTimeInputGUI($this->lng->txt(
'rep_activation_limited_start'),
'access_begin');
553 $date = $this->
object->getActivationEndDate();
555 $end =
new ilDateTimeInputGUI($this->lng->txt(
'rep_activation_limited_end'),
'access_end');
560 $visible =
new ilCheckboxInputGUI($this->lng->txt(
'rep_activation_limited_visibility'),
'access_visiblity');
561 $visible->
setInfo($this->lng->txt(
'svy_activation_limited_visibility_info'));
562 $visible->setChecked($this->object->getActivationVisibility());
565 $act_type->addOption($opt);
567 $form->addItem($act_type);
571 $start = $this->
object->getStartDate();
572 $enablestartingtime =
new ilCheckboxInputGUI($this->lng->txt(
"start_date"),
"enabled_start_date");
575 $enablestartingtime->setChecked($start);
578 $startingtime->setShowDate(
true);
579 $startingtime->setShowTime(
true);
584 $enablestartingtime->addSubItem($startingtime);
585 $form->addItem($enablestartingtime);
588 $end = $this->
object->getEndDate();
589 $enableendingtime =
new ilCheckboxInputGUI($this->lng->txt(
"end_date"),
"enabled_end_date");
592 $enableendingtime->setChecked($end);
595 $endingtime->setShowDate(
true);
596 $endingtime->setShowTime(
true);
601 $enableendingtime->addSubItem($endingtime);
602 $form->addItem($enableendingtime);
607 $info->setTitle($this->lng->txt(
"svy_presentation_properties"));
608 $form->addItem($info);
611 $show_question_titles =
new ilCheckboxInputGUI($this->lng->txt(
"svy_show_questiontitles"),
"show_question_titles");
613 $show_question_titles->setChecked($this->object->getShowQuestionTitles());
614 $form->addItem($show_question_titles);
618 $intro->
setValue($this->object->prepareTextareaOutput($this->object->getIntroduction()));
621 $intro->setUseRte(TRUE);
622 $intro->setInfo($this->lng->txt(
"survey_introduction_info"));
623 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
625 $intro->addPlugin(
"latex");
626 $intro->addButton(
"latex");
627 $intro->addButton(
"pastelatex");
628 $intro->setRTESupport($this->object->getId(),
"svy",
"survey", null, $hide_rte_switch,
"3.4.7");
629 $form->addItem($intro);
633 $finalstatement->
setValue($this->object->prepareTextareaOutput($this->object->getOutro()));
634 $finalstatement->setRows(10);
635 $finalstatement->setCols(80);
636 $finalstatement->setUseRte(TRUE);
638 $finalstatement->addPlugin(
"latex");
639 $finalstatement->addButton(
"latex");
640 $finalstatement->addButton(
"pastelatex");
641 $finalstatement->setRTESupport($this->object->getId(),
"svy",
"survey", null, $hide_rte_switch,
"3.4.7");
642 $form->addItem($finalstatement);
647 $results->setTitle($this->lng->txt(
"results"));
651 $evaluation_access =
new ilRadioGroupInputGUI($this->lng->txt(
'evaluation_access'),
"evaluation_access");
652 $evaluation_access->
setInfo($this->lng->txt(
'evaluation_access_description'));
656 $evaluation_access->setValue($this->object->getEvaluationAccess());
657 $form->addItem($evaluation_access);
660 $mailnotification =
new ilCheckboxInputGUI($this->lng->txt(
"mailnotification"),
"mailnotification");
663 $mailnotification->setChecked($this->object->getMailNotification());
666 $mailaddresses =
new ilTextInputGUI($this->lng->txt(
"mailaddresses"),
"mailaddresses");
667 $mailaddresses->
setValue($this->object->getMailAddresses());
668 $mailaddresses->setSize(80);
669 $mailaddresses->setInfo($this->lng->txt(
'mailaddresses_info'));
670 $mailaddresses->setRequired(
true);
673 $participantdata =
new ilTextAreaInputGUI($this->lng->txt(
"mailparticipantdata"),
"mailparticipantdata");
674 $participantdata->
setValue($this->object->getMailParticipantData());
675 $participantdata->setRows(6);
676 $participantdata->setCols(80);
677 $participantdata->setUseRte(
false);
678 $participantdata->setInfo($this->lng->txt(
'mailparticipantdata_info'));
681 $placeholders = array(
682 "FIRST_NAME" =>
"firstname",
683 "LAST_NAME" =>
"lastname",
687 foreach($placeholders as $placeholder => $caption)
689 $txt[] =
"[".strtoupper($placeholder).
"]: ".$this->lng->txt($caption);
691 $txt = implode(
"<br />", $txt);
692 $participantdatainfo =
new ilNonEditableValueGUI($this->lng->txt(
"mailparticipantdata_placeholder"),
"",
true);
693 $participantdatainfo->
setValue($txt);
695 $mailnotification->addSubItem($mailaddresses);
696 $mailnotification->addSubItem($participantdata);
697 $mailnotification->addSubItem($participantdatainfo);
698 $form->addItem($mailnotification);
700 $form->addCommandButton(
"saveProperties", $this->lng->txt(
"save"));
703 if($template_settings)
705 foreach($template_settings as $id => $item)
709 $form->removeItemByPostVar($id);
726 if (!$ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"]))
728 $this->ctrl->redirect($this,
"");
738 if($this->object->getTemplate())
740 $link = $this->ctrl->getLinkTarget($this,
"confirmResetTemplate");
741 $link =
"<a href=\"".$link.
"\">".$this->lng->txt(
"survey_using_template_link").
"</a>";
742 $message =
"<div style=\"margin-top:10px\">".
743 $this->tpl->getMessageHTML(sprintf($this->lng->txt(
"survey_using_template"),
748 $this->tpl->setContent($a_form->getHTML().$message);
761 if (count($items[
"blocks"]) + count($items[
"questions"]) + count($items[
"headings"]) > 0)
769 ilUtil::sendInfo($this->lng->txt(
"no_question_selected_for_removal"),
true);
770 $this->ctrl->redirect($this,
"questions");
779 $inserted_objects = 0;
780 if (is_array(
$_POST[
'q_id']))
784 include_once
"Modules/Survey/classes/class.ilSurveyPageGUI.php";
786 $page_gui->determineCurrentPage();
791 foreach (
$_POST[
'q_id'] as $question_id)
795 $this->
object->insertQuestion($question_id);
800 $page_gui->insertNewQuestion($question_id);
805 if ($inserted_objects)
807 $this->
object->saveCompletionStatus();
811 $this->ctrl->redirect($this,
"questions");
816 if(substr(
$_REQUEST[
"pgov_pos"], -1) ==
"c")
828 $this->ctrl->setParameterByClass(
"ilsurveypagegui",
"pgov", $target_page);
829 $this->ctrl->redirectByClass(
"ilsurveypagegui",
"renderpage");
835 $this->ctrl->setParameter($this,
"pgov",
$_REQUEST[
"pgov"]);
836 $this->ctrl->setParameter($this,
"pgov_pos",
$_REQUEST[
"pgov_pos"]);
837 $this->ctrl->redirect($this,
'browseForQuestions');
846 $inserted_objects = 0;
847 if (is_array(
$_POST[
'cb']))
851 include_once
"Modules/Survey/classes/class.ilSurveyPageGUI.php";
853 $page_gui->determineCurrentPage();
858 foreach (
$_POST[
'cb'] as $questionblock_id)
862 $this->
object->insertQuestionblock($questionblock_id);
866 $page_gui->insertQuestionblock($questionblock_id);
871 if ($inserted_objects)
873 $this->
object->saveCompletionStatus();
874 ilUtil::sendSuccess(($inserted_objects == 1) ? $this->lng->txt(
"questionblock_inserted") : $this->lng->txt(
"questionblocks_inserted"),
true);
877 $this->ctrl->redirect($this,
"questions");
882 if(substr(
$_REQUEST[
"pgov_pos"], -1) ==
"c")
886 $this->ctrl->setParameterByClass(
"ilsurveypagegui",
"pgov", $target_page);
887 $this->ctrl->redirectByClass(
"ilsurveypagegui",
"renderpage");
893 $this->ctrl->setParameter($this,
"pgov",
$_REQUEST[
"pgov"]);
894 $this->ctrl->setParameter($this,
"pgov_pos",
$_REQUEST[
"pgov_pos"]);
895 $this->ctrl->redirect($this,
'browseForQuestionblocks');
905 $ilUser->writePref(
'svy_insert_type',
$_POST[
'datatype']);
906 $this->ctrl->setParameter($this,
"pgov",
$_REQUEST[
"pgov"]);
907 $this->ctrl->setParameter($this,
"pgov_pos",
$_REQUEST[
"pgov_pos"]);
908 switch (
$_POST[
"datatype"])
911 $this->ctrl->redirect($this,
'browseForQuestionblocks');
915 $this->ctrl->redirect($this,
'browseForQuestions');
925 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
927 $table_gui->writeFilterToSession();
928 $this->ctrl->setParameter($this,
"pgov",
$_REQUEST[
"pgov"]);
929 $this->ctrl->setParameter($this,
"pgov_pos",
$_REQUEST[
"pgov_pos"]);
930 $this->ctrl->redirect($this,
'browseForQuestionblocks');
938 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
940 $table_gui->resetFilter();
941 $this->ctrl->setParameter($this,
"pgov",
$_REQUEST[
"pgov"]);
942 $this->ctrl->setParameter($this,
"pgov_pos",
$_REQUEST[
"pgov_pos"]);
943 $this->ctrl->redirect($this,
'browseForQuestionblocks');
954 $this->ctrl->setParameter($this,
"pgov",
$_REQUEST[
"pgov"]);
955 $this->ctrl->setParameter($this,
"pgov_pos",
$_REQUEST[
"pgov_pos"]);
958 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_questionbrowser.html",
"Modules/Survey");
959 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
961 $table_gui->
setEditable($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']));
962 $arrFilter = array();
963 foreach ($table_gui->getFilterItems() as $item)
965 if ($item->getValue() !==
false)
967 $arrFilter[$item->getPostVar()] = $item->getValue();
970 $data = $this->
object->getQuestionblocksTable($arrFilter);
971 $table_gui->setData(
$data);
972 $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());
974 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
'changeDatatype'));
975 $this->tpl->setVariable(
"OPTION_QUESTIONS", $this->lng->txt(
"questions"));
976 $this->tpl->setVariable(
"OPTION_QUESTIONBLOCKS", $this->lng->txt(
"questionblocks"));
977 $this->tpl->setVariable(
"SELECTED_QUESTIONBLOCKS",
" selected=\"selected\"");
978 $this->tpl->setVariable(
"TEXT_DATATYPE", $this->lng->txt(
"display_all_available"));
979 $this->tpl->setVariable(
"BTN_CHANGE", $this->lng->txt(
"change"));
987 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
989 $table_gui->writeFilterToSession();
990 $this->ctrl->setParameter($this,
"pgov",
$_REQUEST[
"pgov"]);
991 $this->ctrl->setParameter($this,
"pgov_pos",
$_REQUEST[
"pgov_pos"]);
992 $this->ctrl->redirect($this,
'browseForQuestions');
1000 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
1002 $table_gui->resetFilter();
1003 $this->ctrl->setParameter($this,
"pgov",
$_REQUEST[
"pgov"]);
1004 $this->ctrl->setParameter($this,
"pgov_pos",
$_REQUEST[
"pgov_pos"]);
1005 $this->ctrl->redirect($this,
'browseForQuestions');
1016 $this->ctrl->setParameter($this,
"pgov",
$_REQUEST[
"pgov"]);
1017 $this->ctrl->setParameter($this,
"pgov_pos",
$_REQUEST[
"pgov_pos"]);
1020 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_questionbrowser.html",
"Modules/Survey");
1021 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
1023 $table_gui->
setEditable($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']));
1024 $arrFilter = array();
1025 foreach ($table_gui->getFilterItems() as $item)
1027 if ($item->getValue() !==
false)
1029 $arrFilter[$item->getPostVar()] = $item->getValue();
1032 $data = $this->
object->getQuestionsTable($arrFilter);
1037 $pools = $table_gui->getQuestionPools();
1040 $data[$idx][
"spl"] = $pools[
$row[
"obj_fi"]];
1044 $table_gui->setData(
$data);
1045 $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());
1047 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
'changeDatatype'));
1048 $this->tpl->setVariable(
"OPTION_QUESTIONS", $this->lng->txt(
"questions"));
1049 $this->tpl->setVariable(
"OPTION_QUESTIONBLOCKS", $this->lng->txt(
"questionblocks"));
1050 $this->tpl->setVariable(
"SELECTED_QUESTIONS",
" selected=\"selected\"");
1051 $this->tpl->setVariable(
"TEXT_DATATYPE", $this->lng->txt(
"display_all_available"));
1052 $this->tpl->setVariable(
"BTN_CHANGE", $this->lng->txt(
"change"));
1064 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1066 $cgui->setHeaderText($this->lng->txt(
"survey_sure_delete_questions"));
1068 $cgui->setFormAction($this->ctrl->getFormAction($this,
"confirmRemoveQuestions"));
1069 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancelRemoveQuestions");
1070 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmRemoveQuestions");
1074 $surveyquestions =& $this->
object->getSurveyQuestions();
1075 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
1076 foreach ($surveyquestions as $question_id =>
$data)
1078 if (in_array(
$data[
"question_id"], $checked_questions))
1082 $cgui->addItem(
"id_".
$data[
"question_id"],
$data[
"question_id"],
1083 $type.
": ".
$data[
"title"]);
1085 else if((in_array(
$data[
"questionblock_id"], $checked_questionblocks)))
1089 $cgui->addItem(
"id_qb_".
$data[
"questionblock_id"],
$data[
"questionblock_id"],
1090 $data[
"questionblock_title"].
" - ".$type.
": ".
$data[
"title"]);
1097 else if (in_array(
$data[
"question_id"], $checked_headings))
1099 $cgui->addItem(
"id_tb_".
$data[
"question_id"],
$data[
"question_id"],
1104 $this->tpl->setContent($cgui->getHTML());
1117 if ($questionblock_id)
1119 $questionblock = $this->
object->getQuestionblock($questionblock_id);
1122 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1124 $form->setFormAction($this->ctrl->getFormAction($this,
"saveDefineQuestionblock"));
1125 $form->setTableWidth(
"100%");
1126 $form->setId(
"survey_questionblock");
1127 $form->setTitle($this->lng->txt(
"define_questionblock"));
1130 $title->setRequired(
true);
1131 if ($questionblock_id)
1133 $title->setValue($questionblock[
"title"]);
1137 $toggle_blocktitle =
new ilCheckboxInputGUI($this->lng->txt(
"survey_show_blocktitle"),
"show_blocktitle");
1138 $toggle_blocktitle->
setInfo($this->lng->txt(
"survey_show_blocktitle_description"));
1139 if (($questionblock[
"show_blocktitle"]) || (strlen($questionblock_id) == 0))
1141 $toggle_blocktitle->setChecked(
true);
1143 $form->addItem($toggle_blocktitle);
1145 $toggle_questiontitle =
new ilCheckboxInputGUI($this->lng->txt(
"show_questiontext"),
"show_questiontext");
1146 $toggle_questiontitle->
setInfo($this->lng->txt(
"show_questiontext_description"));
1147 if (($questionblock[
"show_questiontext"]) || (strlen($questionblock_id) == 0))
1149 $toggle_questiontitle->setChecked(
true);
1151 $form->addItem($toggle_questiontitle);
1153 $form->addCommandButton(
"saveDefineQuestionblock", $this->lng->txt(
"save"));
1154 $form->addCommandButton(
"cancelDefineQuestionblock", $this->lng->txt(
"cancel"));
1158 foreach ($question_ids as $q_id)
1161 $hidden->setValue($q_id);
1162 $form->addItem($hidden);
1165 if ($questionblock_id)
1168 $hidden->setValue($questionblock_id);
1169 $form->addItem($hidden);
1172 $this->tpl->setContent($form->getHTML());
1184 if(!$this->object->isPoolActive())
1187 $_GET[
"sel_question_types"] =
$_POST[
"sel_question_types"];
1202 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
1205 $sel_question_types = (strlen(
$_POST[
"sel_question_types"])) ?
$_POST[
"sel_question_types"] :
$_GET[
"sel_question_types"];
1206 $this->ctrl->setParameter($this,
"sel_question_types", $sel_question_types);
1207 $form->setFormAction($this->ctrl->getFormAction($this,
"executeCreateQuestion"));
1216 $no_pool =
new ilRadioOption($this->lng->txt(
"survey_no_pool"), 1);
1217 $usage->addOption($no_pool);
1218 $existing_pool =
new ilRadioOption($this->lng->txt(
"survey_existing_pool"), 3);
1219 $usage->addOption($existing_pool);
1220 $new_pool =
new ilRadioOption($this->lng->txt(
"survey_new_pool"), 2);
1221 $usage->addOption($new_pool);
1222 $form->addItem($usage);
1224 if(isset(
$_SESSION[
"svy_qpool_choice"]))
1231 $usage->setValue(1);
1234 $questionpools =& $this->
object->getAvailableQuestionpools(FALSE, TRUE, TRUE,
"write");
1235 $pools =
new ilSelectInputGUI($this->lng->txt(
"select_questionpool"),
"sel_spl");
1237 $existing_pool->addSubItem($pools);
1239 $name =
new ilTextInputGUI($this->lng->txt(
"spl_new"),
"name_spl");
1241 $name->setMaxLength(50);
1242 $new_pool->addSubItem($name);
1249 $form->addCommandButton(
"executeCreateQuestion", $this->lng->txt(
"submit"));
1250 $form->addCommandButton(
"cancelCreateQuestion", $this->lng->txt(
"cancel"));
1252 return $this->tpl->setContent($form->getHTML());
1262 $this->ctrl->redirect($this,
"questions");
1275 $addurl .=
"&pgov=".$_REQUEST[
"pgov"].
"&pgov_pos=".
$_REQUEST[
"pgov_pos"];
1278 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1283 if (
$_POST[
"usage"] == 1)
1286 $_GET[
"ref_id"].
"&cmd=createQuestionForSurvey&new_for_survey=".
1287 $_GET[
"ref_id"].
"&sel_question_types=".
$_GET[
"sel_question_types"].$addurl);
1290 else if (
$_POST[
"usage"] == 3 && strlen(
$_POST[
"sel_spl"]))
1293 $_POST[
"sel_spl"].
"&cmd=createQuestionForSurvey&new_for_survey=".
$_GET[
"ref_id"].
1294 "&sel_question_types=".
$_GET[
"sel_question_types"].$addurl);
1297 elseif (
$_POST[
"usage"] == 2 && strlen(
$_POST[
"name_spl"]))
1301 "&cmd=createQuestionForSurvey&new_for_survey=".$_GET[
"ref_id"].
1302 "&sel_question_types=".$_GET[
"sel_question_types"].$addurl);
1314 $this->ctrl->setParameter($this,
"sel_question_types",
$_GET[
"sel_question_types"]);
1315 $this->ctrl->redirect($this,
"createQuestion");
1328 $parent_ref = $tree->getParentId($this->object->getRefId());
1329 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
1331 $qpl->setType(
"spl");
1332 $qpl->setTitle($name);
1333 $qpl->setDescription(
"");
1335 $qpl->createReference();
1336 $qpl->putInTree($parent_ref);
1337 $qpl->setPermissions($parent_ref);
1340 return $qpl->getRefId();
1355 $save = (strcmp($this->ctrl->getCmd(),
"saveHeading") == 0) ? TRUE : FALSE;
1357 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1359 $form->setFormAction($this->ctrl->getFormAction($this));
1360 $form->setTableWidth(
"100%");
1361 $form->setId(
"survey_heading");
1367 $header->setTitle($this->lng->txt(
"edit_heading"));
1371 $header->setTitle($this->lng->txt(
"add_heading"));
1373 $form->addItem($header);
1375 $survey_questions =& $this->
object->getSurveyQuestions();
1379 $heading->
setValue($this->object->prepareTextareaOutput(array_key_exists(
'heading',
$_POST) ?
$_POST[
'heading'] : $survey_questions[$question_id][
"heading"]));
1380 $heading->setRows(10);
1381 $heading->setCols(80);
1382 $heading->setUseRte(TRUE);
1383 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
1386 $heading->setRTESupport($this->object->getId(),
"svy",
"survey", null,
false,
"3.4.7");
1387 $heading->setRequired(
true);
1388 $form->addItem($heading);
1390 $insertbefore =
new ilSelectInputGUI($this->lng->txt(
"insert"),
"insertbefore");
1392 foreach ($survey_questions as $key => $value)
1394 $options[$key] = $this->lng->txt(
"before") .
": \"" . $value[
"title"] .
"\"";
1397 $insertbefore->setValue((array_key_exists(
'insertbefore',
$_REQUEST)) ?
$_REQUEST[
'insertbefore'] : $question_id);
1398 $insertbefore->setRequired(
true);
1399 if ($question_id || array_key_exists(
'insertbefore',
$_REQUEST))
1401 $insertbefore->setDisabled(
true);
1403 $form->addItem($insertbefore);
1405 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form->addCommandButton(
"saveHeading", $this->lng->txt(
"save"));
1406 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form->addCommandButton(
"cancelHeading", $this->lng->txt(
"cancel"));
1411 $errors = !$form->checkInput();
1412 $form->setValuesByPost();
1413 if (
$errors) $checkonly =
false;
1415 if (!$checkonly) $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
1427 foreach (
$_POST as $key => $value) {
1428 if (preg_match(
"/id_(\d+)/", $key, $matches)) {
1429 if (
$_GET[
"browsetype"] == 1)
1431 $this->
object->insertQuestion($matches[1]);
1435 $this->
object->insertQuestionBlock($matches[1]);
1439 $this->
object->saveCompletionStatus();
1441 $this->ctrl->redirect($this,
"questions");
1451 $this->ctrl->redirect($this,
"questions");
1466 $insertbefore =
$_POST[
"insertbefore"];
1469 $insertbefore =
$_POST[
"insertbefore_original"];
1471 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
1473 $this->ctrl->redirect($this,
"questions");
1486 $this->ctrl->redirect($this,
"questions");
1498 $this->
object->saveHeading(
"",
$_POST[
"removeheading"]);
1499 $this->ctrl->redirect($this,
"questions");
1511 $this->ctrl->redirect($this,
"questions");
1524 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_confirm_removeheading.html",
"Modules/Survey");
1525 $this->tpl->setCurrentBlock(
"adm_content");
1526 $this->tpl->setVariable(
"BTN_CONFIRM_REMOVE", $this->lng->txt(
"confirm"));
1527 $this->tpl->setVariable(
"BTN_CANCEL_REMOVE", $this->lng->txt(
"cancel"));
1528 $this->tpl->setVariable(
"REMOVE_HEADING",
$_GET[
"removeheading"]);
1529 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"confirmRemoveHeading"));
1530 $this->tpl->parseCurrentBlock();
1542 $checked_questions = array();
1543 $checked_questionblocks = array();
1544 $checked_headings = array();
1545 foreach (
$_POST as $key => $value)
1547 if (preg_match(
"/id_(\d+)/", $key, $matches))
1549 array_push($checked_questions, $matches[1]);
1551 if (preg_match(
"/id_qb_(\d+)/", $key, $matches))
1553 array_push($checked_questionblocks, $matches[1]);
1555 if (preg_match(
"/id_tb_(\d+)/", $key, $matches))
1557 array_push($checked_headings, $matches[1]);
1561 if(
sizeof($checked_questions) ||
sizeof($checked_questionblocks))
1563 $this->
object->removeQuestions($checked_questions, $checked_questionblocks);
1565 if($checked_headings)
1567 foreach($checked_headings as $q_id)
1569 $this->
object->saveHeading(
"", $q_id);
1572 $this->
object->saveCompletionStatus();
1574 $this->ctrl->redirect($this,
"questions");
1586 $this->ctrl->redirect($this,
"questions");
1598 protected function gatherSelectedTableItems($allow_blocks =
true, $allow_questions =
true, $allow_headings =
false, $allow_questions_in_blocks =
false)
1600 $block_map = array();
1601 foreach($this->object->getSurveyQuestions() as $item)
1603 $block_map[$item[
"question_id"]] = $item[
"questionblock_id"];
1606 $questions = $blocks = $headings = array();
1609 foreach (
$_POST[
"id"] as $key)
1612 if ($allow_questions && preg_match(
"/cb_(\d+)/", $key, $matches))
1614 if(($allow_questions_in_blocks || !$block_map[$matches[1]]) &&
1615 !in_array($block_map[$matches[1]], $blocks))
1617 array_push($questions, $matches[1]);
1621 if ($allow_blocks && preg_match(
"/cb_qb_(\d+)/", $key, $matches))
1623 array_push($blocks, $matches[1]);
1626 if ($allow_headings && preg_match(
"/cb_tb_(\d+)/", $key, $matches))
1628 array_push($headings, $matches[1]);
1633 return array(
"questions" => $questions,
1634 "blocks" => $blocks,
1635 "headings" => $headings);
1648 if(
sizeof(
$_POST[
"qids"]))
1650 $items[
"questions"] =
$_POST[
"qids"];
1652 if (count($items[
"questions"]) < 2)
1654 ilUtil::sendInfo($this->lng->txt(
"qpl_define_questionblock_select_missing"),
true);
1655 $this->ctrl->redirect($this,
"questions");
1671 $show_questiontext = (
$_POST[
"show_questiontext"]) ? 1 : 0;
1672 $show_blocktitle = (
$_POST[
"show_blocktitle"]) ? 1 : 0;
1673 if (
$_POST[
"questionblock_id"])
1675 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1680 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1684 $this->ctrl->setParameter($this,
"pgov",
$_REQUEST[
"pgov"]);
1685 $this->ctrl->redirect($this,
"questions");
1692 if(!
$_POST[
"questionblock_id"])
1710 if (count($items[
"blocks"]))
1713 $this->
object->unfoldQuestionblocks($items[
"blocks"]);
1719 $this->ctrl->redirect($this,
"questions");
1728 $this->ctrl->redirect($this,
"questions");
1738 $move_questions = $items[
"questions"];
1739 foreach ($items[
"blocks"] as $block_id)
1741 foreach ($this->object->getQuestionblockQuestionIds($block_id) as $qid)
1743 array_push($move_questions, $qid);
1746 if (count($move_questions) == 0)
1749 $this->ctrl->redirect($this,
"questions");
1753 $_SESSION[
"move_questions"] = $move_questions;
1754 ilUtil::sendInfo($this->lng->txt(
"select_target_position_for_move_question"));
1770 while(!$insert_id &&
sizeof(
$_POST[
"id"]))
1772 $target = array_shift(
$_POST[
"id"]);
1773 if (preg_match(
"/^cb_(\d+)$/", $target, $matches))
1776 if(in_array($matches[1], $items[
"questions"]))
1778 $insert_id = $matches[1];
1781 if (!$insert_id && preg_match(
"/^cb_qb_(\d+)$/", $target, $matches))
1783 $ids = $this->
object->getQuestionblockQuestionIds($matches[1]);
1786 if ($insert_mode == 0)
1788 $insert_id = $ids[0];
1790 else if ($insert_mode == 1)
1792 $insert_id = $ids[count($ids)-1];
1806 $this->
object->moveQuestions(
$_SESSION[
"move_questions"], $insert_id, $insert_mode);
1810 $this->ctrl->redirect($this,
"questions");
1834 if(isset(
$_POST[
"order"]))
1839 foreach(array_keys(
$_POST[
"order"]) as $id)
1842 if(substr($id, 0, 3) ==
"qb_")
1844 $block_id = substr($id, 3);
1845 $block =
$_POST[
"block_order"][$block_id];
1847 foreach(array_keys($block) as $question_id)
1850 $order[$question_id] = $position;
1855 $question_id = substr($id, 2);
1857 $order[$question_id] = $position;
1860 $this->
object->updateOrder($order);
1863 $obligatory = array();
1864 foreach (
$_POST as $key => $value)
1866 if (preg_match(
"/obligatory_(\d+)/", $key, $matches))
1868 $obligatory[$matches[1]] = 1;
1871 $this->
object->setObligatoryStates($obligatory);
1873 $this->ctrl->redirect($this,
"questions");
1881 global $rbacsystem, $ilToolbar,
$ilUser;
1885 $hasDatasets = $this->
object->_hasDatasets($this->object->getSurveyId());
1886 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1887 if ((!$rbacsystem->checkAccess(
"read", $this->ref_id)) && (!$rbacsystem->checkAccess(
"write", $this->ref_id)))
1891 $path = $this->tree->getPathFull($this->object->getRefID());
1896 if (
$_GET[
"new_id"] > 0)
1899 $existing = $this->
object->getExistingQuestions();
1900 if (!in_array(
$_GET[
"new_id"], $existing))
1902 $inserted = $this->
object->insertQuestion(
$_GET[
"new_id"]);
1912 ilUtil::redirect(
"ilias.php?baseClass=ilObjSurveyQuestionPoolGUI&ref_id=" . $_GET[
"eqpl"] .
"&cmd=editQuestionForSurvey&calling_survey=".$_GET[
"ref_id"].
"&q_id=" . $_GET[
"eqid"]);
1916 $_SESSION[
"calling_survey"] = $this->
object->getRefId();
1919 if ($_GET[
"editheading"])
1948 if ($_GET[
"removeheading"])
1954 if ($_GET[
"editblock"])
1963 $selected_array = array();
1964 array_push($selected_array, $_GET[
"add"]);
1966 $this->insertQuestionsForm($selected_array);
1973 $read_only = (!$rbacsystem->checkAccess(
"write", $this->ref_id) || $hasDatasets);
1981 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
1984 $qtypes[
$data[
"type_tag"]] = $translation;
1987 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
1988 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
1989 $types =
new ilSelectInputGUI($this->lng->txt(
"create_new"),
"sel_question_types");
1991 $ilToolbar->addInputItem($types,
"");
1992 $ilToolbar->addFormButton($this->lng->txt(
"svy_create_question"),
"createQuestion");
1994 if($this->object->isPoolActive())
1996 $ilToolbar->addSeparator();
1998 $cmd = ($ilUser->getPref(
'svy_insert_type') == 1 || strlen($ilUser->getPref(
'svy_insert_type')) == 0) ?
'browseForQuestions' :
'browseForQuestionblocks';
1999 $ilToolbar->addButton($this->lng->txt(
"browse_for_questions"),
2000 $this->ctrl->getLinkTarget($this,
$cmd));
2003 $ilToolbar->addSeparator();
2005 $ilToolbar->addButton($this->lng->txt(
"add_heading"),
2006 $this->ctrl->getLinkTarget($this,
"addHeading"));
2011 $link = $this->ctrl->getLinkTarget($this,
"maintenance");
2012 $link =
"<a href=\"".$link.
"\">".$this->lng->txt(
"survey_has_datasets_warning_page_view_link").
"</a>";
2013 ilUtil::sendInfo($this->lng->txt(
"survey_has_datasets_warning_page_view").
" ".$link);
2019 include_once
"Modules/Survey/classes/class.ilSurveyQuestionTableGUI.php";
2022 $this->tpl->setContent($table->getHTML());
2034 include_once(
"./Modules/Survey/classes/class.ilSurveyEvaluationGUI.php");
2036 $this->ctrl->setCmdClass(get_class($eval_gui));
2037 $this->ctrl->redirect($eval_gui,
"evaluation");
2046 if (is_array(
$_POST[
"user_select"]))
2048 foreach (
$_POST[
"user_select"] as $user_id)
2050 $this->
object->disinviteUser($user_id);
2054 $this->ctrl->redirect($this,
"invite");
2064 if (is_array($a_user_ids))
2066 foreach ($a_user_ids as $user_id)
2068 $this->
object->inviteUser($user_id);
2082 $this->ctrl->redirect($this,
"invite");
2090 $mode =
$_POST[
'invitation'];
2094 $this->
object->setInvitation(0);
2097 $this->
object->setInvitation(1);
2098 $this->
object->setInvitationMode(0);
2101 $this->
object->setInvitation(1);
2102 $this->
object->setInvitationMode(1);
2105 $this->
object->saveToDb();
2107 $this->ctrl->redirect($this,
"invite");
2121 if (!$rbacsystem->checkAccess(
"visible,invite", $this->ref_id))
2125 $path = $this->tree->getPathFull($this->object->getRefID());
2126 include_once
"./Services/Utilities/classes/class.ilUtil.php";
2137 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
2139 $form->setFormAction($this->ctrl->getFormAction($this));
2140 $form->setTableWidth(
"500");
2141 $form->setId(
"invite");
2145 $header->setTitle($this->lng->txt(
"invitation"));
2146 $form->addItem($header);
2150 $invitation->
setInfo($this->lng->txt(
'invitation_mode_desc'));
2151 $invitation->addOption(
new ilRadioOption($this->lng->txt(
"invitation_off"), 0,
''));
2152 $surveySetting =
new ilSetting(
"survey");
2153 if ($surveySetting->get(
"unlimited_invitation"))
2155 $invitation->addOption(
new ilRadioOption($this->lng->txt(
"unlimited_users"), 1,
''));
2157 $invitation->addOption(
new ilRadioOption($this->lng->txt(
"predefined_users"), 2,
''));
2159 if ($this->object->getInvitation())
2161 $inv = $this->
object->getInvitationMode() + 1;
2163 $invitation->setValue($inv);
2164 $form->addItem($invitation);
2166 $form->addCommandButton(
"saveInvitationStatus", $this->lng->txt(
"save"));
2168 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_invite.html",
"Modules/Survey");
2169 $this->tpl->setVariable(
"INVITATION_TABLE", $form->getHTML());
2171 if ($this->object->getInvitation() && $this->
object->getInvitationMode() == 1)
2174 include_once
'./Services/Search/classes/class.ilRepositorySearchGUI.php';
2179 'auto_complete_name' => $lng->txt(
'user'),
2180 'submit_name' => $lng->txt(
'svy_invite_action')
2184 $ilToolbar->addSpacer();
2186 $ilToolbar->addButton($this->lng->txt(
"svy_search_users"),
2187 $this->ctrl->getLinkTargetByClass(
'ilRepositorySearchGUI',
''));
2189 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
2191 $invited_users = $this->
object->getUserData($this->object->getInvitedUsers());
2192 include_once
"./Modules/Survey/classes/tables/class.ilSurveyInvitedUsersTableGUI.php";
2194 $table_gui->setData($invited_users);
2195 $this->tpl->setVariable(
'TBL_INVITED_USERS', $table_gui->getHTML());
2204 include_once
"Services/Utilities/classes/class.ilConfirmationGUI.php";
2206 $cgui->setHeaderText($this->lng->txt(
"confirm_delete_all_user_data"));
2207 $cgui->setFormAction($this->ctrl->getFormAction($this,
"deleteAllUserData"));
2208 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancelDeleteAllUserData");
2209 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmDeleteAllUserData");
2210 $this->tpl->setContent($cgui->getHTML());
2218 $this->
object->deleteAllUserData();
2220 $this->ctrl->redirect($this,
"maintenance");
2228 $this->ctrl->redirect($this,
"maintenance");
2236 $this->
object->removeSelectedSurveyResults(
$_POST[
"chbUser"]);
2238 $this->ctrl->redirect($this,
"maintenance");
2247 $this->ctrl->redirect($this,
"maintenance");
2257 if (count(
$_POST[
"chbUser"]) == 0)
2260 $this->ctrl->redirect($this,
"maintenance");
2264 include_once
"./Modules/Survey/classes/tables/class.ilSurveyMaintenanceTableGUI.php";
2266 $total =& $this->
object->getSurveyParticipants();
2268 foreach (
$total as $user_data)
2270 if (in_array($user_data[
'active_id'],
$_POST[
'chbUser']))
2272 $last_access = $this->
object->_getLastAccess($user_data[
"active_id"]);
2273 array_push(
$data, array(
2274 'id' => $user_data[
"active_id"],
2275 'name' => $user_data[
"sortname"],
2276 'login' => $user_data[
"login"],
2277 'last_access' => $last_access
2281 $table_gui->setData(
$data);
2282 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
2292 if (
$_GET[
"fill"] > 0)
2294 for ($i = 0; $i <
$_GET[
"fill"]; $i++) $this->object->fillSurveyForUser();
2296 include_once
"./Modules/Survey/classes/tables/class.ilSurveyMaintenanceTableGUI.php";
2298 $total =& $this->
object->getSurveyParticipants();
2300 foreach (
$total as $user_data)
2302 $last_access = $this->
object->_getLastAccess($user_data[
"active_id"]);
2303 array_push(
$data, array(
2304 'id' => $user_data[
"active_id"],
2305 'name' => $user_data[
"sortname"],
2306 'login' => $user_data[
"login"],
2307 'last_access' => $last_access
2310 $table_gui->setData(
$data);
2311 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
2316 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
2318 $form->setTarget(
"_top");
2319 $form->setFormAction($this->ctrl->getFormAction($this));
2320 $form->setTitle($this->lng->txt(
"import_svy"));
2322 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
2323 $fi =
new ilFileInputGUI($this->lng->txt(
"import_file"),
"importfile");
2325 $fi->setRequired(
true);
2326 $form->addItem($fi);
2328 include_once(
"./Modules/Survey/classes/class.ilObjSurvey.php");
2330 $questionspools = $svy->getAvailableQuestionpools(
true,
true,
true);
2332 $pools =
new ilSelectInputGUI($this->lng->txt(
"select_questionpool_short"),
"spl");
2333 $pools->
setOptions(array(
""=>$this->lng->txt(
"dont_use_questionpool")) + $questionspools);
2334 $pools->setRequired(
false);
2335 $form->addItem($pools);
2337 $form->addCommandButton(
"importFile", $this->lng->txt(
"import"));
2338 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
2350 $parent_id =
$_GET[
"ref_id"];
2356 $ilErr->raiseError($this->lng->txt(
"no_create_permission"));
2359 $this->lng->loadLanguageModule($new_type);
2360 $this->ctrl->setParameter($this,
"new_type", $new_type);
2363 if ($form->checkInput())
2365 include_once(
"./Modules/Survey/classes/class.ilObjSurvey.php");
2367 $newObj->setType($new_type);
2368 $newObj->setTitle(
"dummy");
2369 $newObj->setDescription(
"dummy");
2370 $newObj->create(
true);
2374 $error = $newObj->importObject($_FILES[
"importfile"], $form->getInput(
"spl"));
2378 $this->ilias->raiseError($error, $this->ilias->error_obj->MESSAGE);
2384 "&baseClass=ilObjSurveyGUI");
2387 include_once
"Services/Administration/classes/class.ilSettingsTemplate.php";
2392 $tpl->addJavaScript(
"./Modules/Scorm2004/scripts/questions/jquery.js");
2395 $this->tpl->setCurrentBlock(
"template_option");
2396 $this->tpl->setVariable(
"VAL_TEMPLATE_OPTION",
"");
2397 $this->tpl->setVariable(
"TXT_TEMPLATE_OPTION", $this->lng->txt(
"none"));
2398 $this->tpl->parseCurrentBlock();
2400 foreach($templates as $item)
2402 $this->tpl->setCurrentBlock(
"template_option");
2403 $this->tpl->setVariable(
"VAL_TEMPLATE_OPTION", $item[
"id"]);
2404 $this->tpl->setVariable(
"TXT_TEMPLATE_OPTION", $item[
"title"]);
2405 $this->tpl->parseCurrentBlock();
2407 $desc = str_replace(
"\n",
"", nl2br($item[
"description"]));
2408 $desc = str_replace(
"\r",
"", $desc);
2410 $this->tpl->setCurrentBlock(
"js_data");
2411 $this->tpl->setVariable(
"JS_DATA_ID", $item[
"id"]);
2412 $this->tpl->setVariable(
"JS_DATA_TEXT", $desc);
2413 $this->tpl->parseCurrentBlock();
2416 $this->tpl->setCurrentBlock(
"templates");
2417 $this->tpl->setVariable(
"TXT_TEMPLATE", $this->lng->txt(
"svy_settings_template"));
2418 $this->tpl->parseCurrentBlock();
2423 $form->setValuesByPost();
2424 $tpl->setContent($form->getHtml());
2434 $export_dir = $this->
object->getExportDirectory();
2435 $export_files = $this->
object->getExportFiles($export_dir);
2437 if(count($export_files) > 0)
2439 foreach($export_files as $exp_file)
2441 $file_arr = explode(
"__", $exp_file);
2443 array_push(
$data, array(
2444 'file' => $exp_file,
2445 'size' => filesize($export_dir.
"/".$exp_file),
2451 include_once
"./Modules/Survey/classes/tables/class.ilSurveyExportTableGUI.php";
2453 $table_gui->setData(
$data);
2454 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
2463 include_once(
"./Modules/Survey/classes/class.ilSurveyExport.php");
2465 $survey_exp->buildExportFile();
2466 $this->ctrl->redirect($this,
"export");
2474 if(!isset(
$_POST[
"file"]))
2477 $this->ctrl->redirect($this,
"export");
2480 if (count(
$_POST[
"file"]) > 1)
2483 $this->ctrl->redirect($this,
"export");
2488 $export_dir = $this->
object->getExportDirectory();
2489 include_once
"./Services/Utilities/classes/class.ilUtil.php";
2500 if (!isset(
$_POST[
"file"]))
2503 $this->ctrl->redirect($this,
"export");
2508 $export_dir = $this->
object->getExportDirectory();
2509 $export_files = $this->
object->getExportFiles($export_dir);
2511 if (count(
$_POST[
"file"]) > 0)
2513 foreach (
$_POST[
"file"] as $exp_file)
2515 $file_arr = explode(
"__", $exp_file);
2517 array_push(
$data, array(
2518 'file' => $exp_file,
2519 'size' => filesize($export_dir.
"/".$exp_file),
2525 include_once
"./Modules/Survey/classes/tables/class.ilSurveyExportTableGUI.php";
2527 $table_gui->setData(
$data);
2528 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
2538 $this->ctrl->redirect($this,
"export");
2547 $export_dir = $this->
object->getExportDirectory();
2550 $file = basename($file);
2552 $exp_file = $export_dir.
"/".
$file;
2553 $exp_dir = $export_dir.
"/".substr($file, 0, strlen($file) - 4);
2554 if (@is_file($exp_file))
2558 if (@is_dir($exp_dir))
2560 include_once
"./Services/Utilities/classes/class.ilUtil.php";
2565 $this->ctrl->redirect($this,
"export");
2573 if (strcmp(
$_POST[
"lang"],
"-1") != 0)
2576 $ilUser->writePref(
"survey_code_language",
$_POST[
"lang"]);
2579 $this->ctrl->redirect($this,
'codes');
2590 if ($this->object->getAnonymize() != 1 && !$this->
object->isAccessibleWithCodeForAll())
2595 $default_lang = $ilUser->getPref(
"survey_code_language");
2598 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
2599 $languages = $this->lng->getInstalledLanguages();
2601 $this->lng->loadLanguageModule(
"meta");
2602 foreach ($languages as
$lang)
2604 $options[
$lang] = $this->lng->txt(
"meta_l_".$lang);
2606 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
2608 $si->setOptions($options);
2609 $si->setValue($default_lang);
2610 $ilToolbar->addInputItem(
$si,
true);
2611 $ilToolbar->addFormButton($this->lng->txt(
"set"),
"setCodeLanguage");
2613 include_once
"./Modules/Survey/classes/tables/class.ilSurveyCodesTableGUI.php";
2615 $survey_codes =& $this->
object->getSurveyCodesTableData($default_lang);
2616 $table_gui->setData($survey_codes);
2617 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_codes.html",
true);
2618 $this->tpl->setCurrentBlock(
"adm_content");
2619 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"codes"));
2620 $this->tpl->setVariable(
"TEXT_CREATE", $this->lng->txt(
"create"));
2621 $this->tpl->setVariable(
"TEXT_SURVEY_CODES", $this->lng->txt(
"new_survey_codes"));
2622 $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());
2630 if (is_array(
$_POST[
"chb_code"]) && (count(
$_POST[
"chb_code"]) > 0))
2632 foreach (
$_POST[
"chb_code"] as $survey_code)
2634 $this->
object->deleteSurveyCode($survey_code);
2642 $this->ctrl->redirect($this,
'codes');
2650 if (is_array(
$_POST[
"chb_code"]) && (count(
$_POST[
"chb_code"]) > 0))
2652 $export = $this->
object->getSurveyCodesForExport(
$_POST[
"chb_code"]);
2658 $this->ctrl->redirect($this,
'codes');
2667 $export = $this->
object->getSurveyCodesForExport(array());
2676 if (preg_match(
"/\d+/",
$_POST[
"nrOfCodes"]))
2678 $this->
object->createSurveyCodes(
$_POST[
"nrOfCodes"]);
2685 $this->ctrl->redirect($this,
'codes');
2698 $savefields = (strcmp($this->ctrl->getCmd(),
"saveMailTableFields") == 0) ? TRUE : FALSE;
2700 include_once
"./Modules/Survey/classes/tables/class.ilSurveyCodesMailTableGUI.php";
2701 $data = $this->
object->getExternalCodeRecipients();
2703 $table_gui->setData(
$data);
2704 $table_gui->setTitle($this->lng->txt(
'externalRecipients'));
2705 $table_gui->completeColumns();
2706 $tabledata = $table_gui->getHTML();
2710 $this->tpl->setVariable(
'ADM_CONTENT', $tabledata);
2720 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
2722 $form_gui->setValuesByPost();
2725 if ($form_gui->getSavedMessages()->getValue() > 0)
2728 $settings = $this->
object->getUserSettings($ilUser->getId(),
'savemessage');
2729 $form_gui->getMailMessage()->setValue($settings[$form_gui->getSavedMessages()->getValue()][
'value']);
2740 $ilLog->write(
'Error: ' + $e->getMessage());
2742 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
2750 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
2752 $form_gui->setValuesByPost();
2755 if ($form_gui->getSavedMessages()->getValue() > 0)
2757 $this->
object->deleteUserSettings($form_gui->getSavedMessages()->getValue());
2759 $form_gui->setValuesByPost();
2770 $ilLog->write(
'Error: ' + $e->getMessage());
2772 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
2780 $mailData[
'm_subject'] = (array_key_exists(
'm_subject',
$_POST)) ?
$_POST[
'm_subject'] : sprintf($this->lng->txt(
'default_codes_mail_subject'), $this->
object->getTitle());
2781 $mailData[
'm_message'] = (array_key_exists(
'm_message',
$_POST)) ?
$_POST[
'm_message'] : $this->lng->txt(
'default_codes_mail_message');
2782 $mailData[
'm_notsent'] = (array_key_exists(
'm_notsent',
$_POST)) ?
$_POST[
'm_notsent'] :
'1';
2784 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
2786 $form_gui->setValuesByArray($mailData);
2787 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
2797 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
2799 if ($form_gui->checkInput())
2801 $code_exists = strpos(
$_POST[
'm_message'],
'[code]') !== FALSE;
2805 $form_gui->setValuesByPost();
2809 if (
$_POST[
'savemessage'] == 1)
2812 $title = (strlen(
$_POST[
'savemessagetitle'])) ?
$_POST[
'savemessagetitle'] : ilStr::substr(
$_POST[
'm_message'], 0, 40) .
'...';
2813 $this->
object->saveUserSettings($ilUser->getId(),
'savemessage',
$title,
$_POST[
'm_message']);
2816 $lang = $ilUser->getPref(
"survey_code_language");
2823 $this->ctrl->redirect($this,
'codesMail');
2828 $form_gui->setValuesByPost();
2830 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
2835 $this->ctrl->redirect($this,
'codesMail');
2840 if (!is_array(
$_POST[
'chb_ext']) || count(is_array(
$_POST[
'chb_ext'])) == 0)
2843 $this->ctrl->redirect($this,
'codesMail');
2845 foreach (
$_POST[
'chb_ext'] as $code)
2847 $this->
object->deleteSurveyCode($code);
2850 $this->ctrl->redirect($this,
'codesMail');
2859 $existingdata = $this->
object->getExternalCodeRecipients();
2860 $existingcolumns = array(
'email',
'firstname',
'lastname');
2861 if (count($existingdata))
2863 $existingcolumns = array_unique(array_merge($existingcolumns, array_keys(array_shift($existingdata))));
2865 foreach ($existingcolumns as $key)
2867 if (strcmp($key,
'code') != 0 && strcmp($key,
'sent') != 0)
2874 $this->
object->createSurveyCodesForExternalData(array(
$data));
2877 $this->ctrl->redirect($this,
'codesMail');
2886 $data = preg_split(
"/[\n\r]/",
$_POST[
'externaltext']);
2887 $fields = preg_split(
"/;/", array_shift(
$data));
2888 if (!in_array(
'email', $fields))
2892 $this->ctrl->redirect($this,
'importExternalMailRecipients');
2894 $existingdata = $this->
object->getExternalCodeRecipients();
2895 $existingcolumns = array();
2896 if (count($existingdata))
2898 $first = array_shift($existingdata);
2899 foreach ($first as $key => $value)
2901 array_push($existingcolumns, $key);
2904 $founddata = array();
2905 foreach (
$data as $datarow)
2907 $row = preg_split(
"/;/", $datarow);
2908 if (count(
$row) == count($fields))
2911 foreach ($fields as $idx => $fieldname)
2913 if (count($existingcolumns))
2915 if (array_key_exists($idx, $existingcolumns))
2917 $dataset[$fieldname] =
$row[$idx];
2922 $dataset[$fieldname] =
$row[$idx];
2925 if (strlen($dataset[
'email']))
2927 array_push($founddata, $dataset);
2931 $this->
object->createSurveyCodesForExternalData($founddata);
2933 $this->ctrl->redirect($this,
'codesMail');
2942 include_once
"./Services/Utilities/classes/class.ilCSVReader.php";
2944 $reader->open($_FILES[
'externalmails'][
'tmp_name']);
2946 $fields = array_shift(
$data);
2947 if (!in_array(
'email', $fields))
2951 $this->ctrl->redirect($this,
'codesMail');
2953 $existingdata = $this->
object->getExternalCodeRecipients();
2954 $existingcolumns = array();
2955 if (count($existingdata))
2957 $first = array_shift($existingdata);
2958 foreach ($first as $key => $value)
2960 array_push($existingcolumns, $key);
2963 $founddata = array();
2966 if (count($row) == count($fields))
2969 foreach ($fields as $idx => $fieldname)
2971 if (count($existingcolumns))
2973 if (array_key_exists($idx, $existingcolumns))
2975 $dataset[$fieldname] = $row[$idx];
2980 $dataset[$fieldname] = $row[$idx];
2983 if (strlen($dataset[
'email']))
2985 array_push($founddata, $dataset);
2990 $this->
object->createSurveyCodesForExternalData($founddata);
2992 $this->ctrl->redirect($this,
'codesMail');
3004 strcmp($this->ctrl->getCmd(),
"importExternalRecipientsFromFile") == 0 ||
3005 strcmp($this->ctrl->getCmd(),
"importExternalRecipientsFromText") == 0 ||
3006 strcmp($this->ctrl->getCmd(),
"importExternalRecipientsFromDataset") == 0
3009 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
3011 $form_import_file->setFormAction($this->ctrl->getFormAction($this));
3012 $form_import_file->setTableWidth(
"100%");
3013 $form_import_file->setId(
"codes_import_file");
3016 $headerfile->setTitle($this->lng->txt(
"import_from_file"));
3017 $form_import_file->addItem($headerfile);
3019 $externalmails =
new ilFileInputGUI($this->lng->txt(
"externalmails"),
"externalmails");
3020 $externalmails->
setInfo($this->lng->txt(
'externalmails_info'));
3021 $externalmails->setRequired(
true);
3022 $form_import_file->addItem($externalmails);
3023 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_file->addCommandButton(
"importExternalRecipientsFromFile", $this->lng->txt(
"import"));
3024 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_file->addCommandButton(
"codesMail", $this->lng->txt(
"cancel"));
3029 $form_import_text->setFormAction($this->ctrl->getFormAction($this));
3030 $form_import_text->setTableWidth(
"100%");
3031 $form_import_text->setId(
"codes_import_text");
3034 $headertext->setTitle($this->lng->txt(
"import_from_text"));
3035 $form_import_text->addItem($headertext);
3038 if (array_key_exists(
'externaltext',
$_SESSION) && strlen(
$_SESSION[
'externaltext']))
3044 $inp->setValue($this->lng->txt(
'mail_import_example1') .
"\n" . $this->lng->txt(
'mail_import_example2') .
"\n" . $this->lng->txt(
'mail_import_example3') .
"\n");
3046 $inp->setRequired(
true);
3049 $inp->setInfo($this->lng->txt(
'externaltext_info'));
3050 $form_import_text->addItem($inp);
3053 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_text->addCommandButton(
"importExternalRecipientsFromText", $this->lng->txt(
"import"));
3054 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_text->addCommandButton(
"codesMail", $this->lng->txt(
"cancel"));
3059 $form_import_dataset->setFormAction($this->ctrl->getFormAction($this));
3060 $form_import_dataset->setTableWidth(
"100%");
3061 $form_import_dataset->setId(
"codes_import_dataset");
3064 $headerfile->setTitle($this->lng->txt(
"import_from_dataset"));
3065 $form_import_dataset->addItem($headerfile);
3067 $existingdata = $this->
object->getExternalCodeRecipients();
3068 $existingcolumns = array(
'email',
'firstname',
'lastname');
3069 if (count($existingdata))
3071 $first = array_keys(array_shift($existingdata));
3072 foreach ($first as $key)
3074 if (strcmp($key,
'code') != 0 && strcmp($key,
'sent') != 0)
3076 array_push($existingcolumns, $key);
3079 $existingcolumns = array_unique($existingcolumns);
3082 foreach ($existingcolumns as $column)
3086 if (strcmp($column,
'email') == 0)
3088 $inp->setRequired(
true);
3092 $inp->setRequired(
false);
3094 $form_import_dataset->addItem($inp);
3096 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_dataset->addCommandButton(
"importExternalRecipientsFromDataset", $this->lng->txt(
"import"));
3097 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_dataset->addCommandButton(
"codesMail", $this->lng->txt(
"cancel"));
3106 $errors = !$form_import_file->checkInput();
3107 $form_import_file->setValuesByPost();
3108 if (
$errors) $checkonly =
false;
3111 $errors = !$form_import_text->checkInput();
3112 $form_import_text->setValuesByPost();
3113 if (
$errors) $checkonly =
false;
3116 $errors = !$form_import_dataset->checkInput();
3117 $form_import_dataset->setValuesByPost();
3118 if (
$errors) $checkonly =
false;
3125 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_external_mail.html",
"Modules/Survey");
3126 $this->tpl->setVariable(
"HEADLINE", $this->lng->txt(
"external_mails_import"));
3127 $this->tpl->setVariable(
"FORM1", $form_import_file->getHTML());
3128 $this->tpl->setVariable(
"FORM2", $form_import_text->getHTML());
3129 $this->tpl->setVariable(
"FORM3", $form_import_dataset->getHTML());
3139 if (strlen(
$_POST[
"v"]) == 0)
3144 $survey_questions =& $this->
object->getSurveyQuestions();
3145 $structure =&
$_SESSION[
"constraintstructure"];
3146 $include_elements =
$_SESSION[
"includeElements"];
3147 foreach ($include_elements as $elementCounter)
3149 if (is_array($structure[$elementCounter]))
3151 if (strlen(
$_GET[
"precondition"]))
3158 foreach ($structure[$elementCounter] as $key => $question_id)
3160 $this->
object->addConstraintToQuestion($question_id, $constraint_id);
3163 if (count($structure[$elementCounter]) > 1)
3165 $this->
object->updateConjunctionForQuestions($structure[$elementCounter],
$_POST[
'c']);
3170 unset(
$_SESSION[
"constraintstructure"]);
3171 $this->ctrl->redirect($this,
"constraints");
3179 $survey_questions =& $this->
object->getSurveyQuestions();
3180 $structure =&
$_SESSION[
"constraintstructure"];
3181 $start =
$_GET[
"start"];
3182 $option_questions = array();
3183 for ($i = 1; $i < $start; $i++)
3185 if (is_array($structure[$i]))
3187 foreach ($structure[$i] as $key => $question_id)
3189 if ($survey_questions[$question_id][
"usableForPrecondition"])
3191 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"]));
3196 if (count($option_questions) == 0)
3199 unset(
$_SESSION[
"constraintstructure"]);
3200 ilUtil::sendInfo($this->lng->txt(
"constraints_no_nonessay_available"),
true);
3201 $this->ctrl->redirect($this,
"constraints");
3211 $survey_questions =& $this->
object->getSurveyQuestions();
3212 $option_questions = array();
3213 array_push($option_questions, array(
"question_id" =>
$_POST[
"q"],
"title" => $survey_questions[
$_POST[
"q"]][
"title"],
"type_tag" => $survey_questions[$_POST[
"q"]][
"type_tag"]));
3214 $this->
constraintForm(2, $_POST, $survey_questions, $option_questions);
3222 $survey_questions =& $this->
object->getSurveyQuestions();
3223 $option_questions = array();
3224 if (strlen(
$_GET[
"precondition"]))
3226 $pc = $this->
object->getPrecondition(
$_GET[
"precondition"]);
3227 $postvalues = array(
3228 "c" => $pc[
"conjunction"],
3229 "q" => $pc[
"question_fi"],
3230 "r" => $pc[
"relation_id"],
3233 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"]));
3234 $this->
constraintForm(3, $postvalues, $survey_questions, $option_questions);
3238 array_push($option_questions, array(
"question_id" =>
$_POST[
"q"],
"title" => $survey_questions[
$_POST[
"q"]][
"title"],
"type_tag" => $survey_questions[$_POST[
"q"]][
"type_tag"]));
3239 $this->
constraintForm(3, $_POST, $survey_questions, $option_questions);
3243 public function constraintForm($step, $postvalues, &$survey_questions, $questions = FALSE)
3245 if (strlen(
$_GET[
"start"])) $this->ctrl->setParameter($this,
"start",
$_GET[
"start"]);
3246 $this->ctrl->saveParameter($this,
"precondition");
3247 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
3249 $form->setFormAction($this->ctrl->getFormAction($this));
3250 $form->setTableWidth(
"100%");
3251 $form->setId(
"constraintsForm");
3255 $title_ids =
$_SESSION[
"includeElements"];
3258 $title_ids = array(
$_GET[
"start"]);
3260 foreach($title_ids as $title_id)
3263 if ($survey_questions[
$_SESSION[
"constraintstructure"][$title_id][0]][
"questionblock_id"] > 0)
3265 $title[] = $this->lng->txt(
"questionblock") .
": " . $survey_questions[
$_SESSION[
"constraintstructure"][$title_id][0]][
"questionblock_title"];
3270 $title[] = $this->lng->txt($survey_questions[
$_SESSION[
"constraintstructure"][$title_id][0]][
"type_tag"]) .
": " .
3271 $survey_questions[
$_SESSION[
"constraintstructure"][$title_id][0]][
"title"];
3275 $header->setTitle(implode(
"<br/>",
$title));
3276 $form->addItem($header);
3280 $fulfilled->addOption(
new ilRadioOption($this->lng->txt(
"conjunction_or"),
'1',
''));
3281 $fulfilled->setValue((strlen($postvalues[
'c'])) ? $postvalues[
'c'] : 0);
3282 $form->addItem($fulfilled);
3284 $step1 =
new ilSelectInputGUI($this->lng->txt(
"step") .
" 1: " . $this->lng->txt(
"select_prior_question"),
"q");
3286 if (is_array($questions))
3288 foreach ($questions as $question)
3293 $step1->setOptions($options);
3294 $step1->setValue($postvalues[
"q"]);
3295 $form->addItem($step1);
3299 $relations = $this->
object->getAllRelations();
3300 $step2 =
new ilSelectInputGUI($this->lng->txt(
"step") .
" 2: " . $this->lng->txt(
"select_relation"),
"r");
3302 foreach ($relations as $rel_id => $relation)
3304 if (in_array($relation[
"short"], $survey_questions[$postvalues[
"q"]][
"availableRelations"]))
3306 $options[$rel_id] = $relation[
'short'];
3310 $step2->setValue($postvalues[
"r"]);
3311 $form->addItem($step2);
3316 $variables =& $this->
object->getVariables($postvalues[
"q"]);
3317 $question_type = $survey_questions[$postvalues[
"q"]][
"type_tag"];
3318 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
3320 $question =
new $question_type();
3321 $question->loadFromDb($postvalues[
"q"]);
3323 $step3 = $question->getPreconditionSelectValue($postvalues[
"v"], $this->lng->txt(
"step") .
" 3: " . $this->lng->txt(
"select_value"),
"v");
3324 $form->addItem($step3);
3330 $cmd_continue =
"constraintStep2";
3331 $cmd_back =
"constraints";
3334 $cmd_continue =
"constraintStep3";
3335 $cmd_back =
"constraintStep1";
3338 $cmd_continue =
"constraintsAdd";
3339 $cmd_back =
"constraintStep2";
3342 $form->addCommandButton($cmd_back, $this->lng->txt(
"back"));
3343 $form->addCommandButton($cmd_continue, $this->lng->txt(
"continue"));
3345 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
3353 $survey_questions =& $this->
object->getSurveyQuestions();
3354 $structure =&
$_SESSION[
"constraintstructure"];
3355 foreach (
$_POST as $key => $value)
3357 if (preg_match(
"/^constraint_(\d+)_(\d+)/", $key, $matches))
3359 $this->
object->deleteConstraint($matches[2]);
3363 $this->ctrl->redirect($this,
"constraints");
3368 $include_elements =
$_POST[
"includeElements"];
3369 if ((!is_array($include_elements)) || (count($include_elements) == 0))
3371 ilUtil::sendInfo($this->lng->txt(
"constraints_no_questions_or_questionblocks_selected"),
true);
3372 $this->ctrl->redirect($this,
"constraints");
3374 else if (count($include_elements) >= 1)
3376 $_SESSION[
"includeElements"] = $include_elements;
3377 sort($include_elements, SORT_NUMERIC);
3378 $_GET[
"start"] = $include_elements[0];
3386 $this->ctrl->setParameter($this,
"precondition",
$_GET[
"precondition"]);
3387 $this->ctrl->setParameter($this,
"start",
$_GET[
"start"]);
3388 $this->ctrl->redirect($this,
"constraintStep3");
3400 $hasDatasets = $this->
object->_hasDatasets($this->object->getSurveyId());
3402 if (array_key_exists(
"step",
$_GET)) $step =
$_GET[
"step"];
3417 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_constraints_list.html",
"Modules/Survey");
3418 $survey_questions =& $this->
object->getSurveyQuestions();
3419 $last_questionblock_id = 0;
3421 $hasPreconditions = FALSE;
3422 $structure = array();
3423 $colors = array(
"tblrow1",
"tblrow2");
3424 foreach ($survey_questions as $question_id =>
$data)
3428 if (
$data[
"questionblock_id"] > 0)
3431 $type = $this->lng->txt(
"questionblock");
3432 if (
$data[
"questionblock_id"] != $last_questionblock_id)
3434 $last_questionblock_id =
$data[
"questionblock_id"];
3435 $structure[$counter] = array();
3436 array_push($structure[$counter],
$data[
"question_id"]);
3440 array_push($structure[$counter-1],
$data[
"question_id"]);
3446 $structure[$counter] = array(
$data[
"question_id"]);
3447 $type = $this->lng->txt(
"question");
3453 $this->tpl->setCurrentBlock(
"description");
3454 $this->tpl->setVariable(
"DESCRIPTION", $this->lng->txt(
"constraints_first_question_description"));
3455 $this->tpl->parseCurrentBlock();
3459 $constraints =& $this->
object->getConstraints(
$data[
"question_id"]);
3461 if (count($constraints))
3463 $hasPreconditions = TRUE;
3464 foreach ($constraints as $constraint)
3466 $this->tpl->setCurrentBlock(
"constraint");
3467 $this->tpl->setVariable(
"SEQUENCE_ID", $counter);
3468 $this->tpl->setVariable(
"CONSTRAINT_ID", $constraint[
"id"]);
3469 $this->tpl->setVariable(
"CONSTRAINT_TEXT", $survey_questions[$constraint[
"question"]][
"title"] .
" " . $constraint[
"short"] .
" " . $constraint[
"valueoutput"]);
3470 $this->tpl->setVariable(
"TEXT_EDIT_PRECONDITION", $this->lng->txt(
"edit"));
3471 $this->ctrl->setParameter($this,
"precondition", $constraint[
"id"]);
3472 $this->ctrl->setParameter($this,
"start", $counter);
3473 $this->tpl->setVariable(
"EDIT_PRECONDITION", $this->ctrl->getLinkTarget($this,
"editPrecondition"));
3474 $this->ctrl->setParameter($this,
"precondition",
"");
3475 $this->ctrl->setParameter($this,
"start",
"");
3476 $this->tpl->parseCurrentBlock();
3478 if (count($constraints) > 1)
3480 $this->tpl->setCurrentBlock(
"conjunction");
3481 $this->tpl->setVariable(
"TEXT_CONJUNCTION", ($constraints[0][
'conjunction']) ? $this->lng->txt(
'conjunction_or_title') : $this->lng->txt(
'conjunction_and_title'));
3482 $this->tpl->parseCurrentBlock();
3488 $this->tpl->setCurrentBlock(
"include_elements");
3489 $this->tpl->setVariable(
"QUESTION_NR",
"$counter");
3490 $this->tpl->parseCurrentBlock();
3492 $this->tpl->setCurrentBlock(
"constraint_section");
3493 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
3494 $this->tpl->setVariable(
"QUESTION_NR",
"$counter");
3495 $this->tpl->setVariable(
"TITLE",
"$title");
3496 $icontype =
"question.png";
3497 if (
$data[
"questionblock_id"] > 0)
3499 $icontype =
"questionblock.png";
3501 $this->tpl->setVariable(
"TYPE",
"$type: ");
3502 include_once
"./Services/Utilities/classes/class.ilUtil.php";
3504 $this->tpl->setVariable(
"ICON_ALT", $type);
3505 $this->tpl->parseCurrentBlock();
3509 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets)
3511 if ($hasPreconditions)
3513 $this->tpl->setCurrentBlock(
"selectall_preconditions");
3514 $this->tpl->setVariable(
"SELECT_ALL_PRECONDITIONS", $this->lng->txt(
"select_all"));
3515 $this->tpl->parseCurrentBlock();
3517 $this->tpl->setCurrentBlock(
"selectall");
3519 $this->tpl->setVariable(
"SELECT_ALL", $this->lng->txt(
"select_all"));
3520 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
3521 $this->tpl->parseCurrentBlock();
3523 if ($hasPreconditions)
3525 $this->tpl->setCurrentBlock(
"delete_button");
3526 $this->tpl->setVariable(
"BTN_DELETE", $this->lng->txt(
"delete"));
3527 include_once
"./Services/Utilities/classes/class.ilUtil.php";
3528 $this->tpl->setVariable(
"ARROW",
"<img src=\"" .
ilUtil::getImagePath(
"arrow_downright.png") .
"\" alt=\"".$this->lng->txt(
"arrow_downright").
"\">");
3529 $this->tpl->parseCurrentBlock();
3532 $this->tpl->setCurrentBlock(
"buttons");
3533 $this->tpl->setVariable(
"ARROW",
"<img src=\"" .
ilUtil::getImagePath(
"arrow_downright.png") .
"\" alt=\"".$this->lng->txt(
"arrow_downright").
"\">");
3534 $this->tpl->setVariable(
"BTN_CREATE_CONSTRAINTS", $this->lng->txt(
"constraint_add"));
3535 $this->tpl->parseCurrentBlock();
3537 $this->tpl->setCurrentBlock(
"adm_content");
3538 $this->tpl->setVariable(
"CONSTRAINTS_INTRODUCTION", $this->lng->txt(
"constraints_introduction"));
3539 $this->tpl->setVariable(
"DEFINED_PRECONDITIONS", $this->lng->txt(
"existing_constraints"));
3540 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"constraints"));
3541 $this->tpl->setVariable(
"CONSTRAINTS_HEADER", $this->lng->txt(
"constraints_list_of_entities"));
3542 $this->tpl->parseCurrentBlock();
3543 $_SESSION[
"constraintstructure"] = $structure;
3547 $link = $this->ctrl->getLinkTarget($this,
"maintenance");
3548 $link =
"<a href=\"".$link.
"\">".$this->lng->txt(
"survey_has_datasets_warning_page_view_link").
"</a>";
3549 ilUtil::sendInfo($this->lng->txt(
"survey_has_datasets_warning_page_view").
" ".$link);
3560 $this->ctrl->setCmd(
"showSummary");
3561 $this->ctrl->setCmdClass(
"ilinfoscreengui");
3573 if (!$ilAccess->checkAccess(
"visible",
"", $this->ref_id))
3575 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
3578 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
3580 include_once
"./Modules/Survey/classes/class.ilSurveyExecutionGUI.php";
3582 $info->setFormAction($this->ctrl->getFormAction($output_gui,
"infoScreen"));
3583 $info->enablePrivateNotes();
3584 $anonymize_key = NULL;
3585 if ($this->object->getAnonymize() == 1)
3587 if (
$_SESSION[
"anonymous_id"][$this->object->getId()])
3589 $anonymize_key =
$_SESSION[
"anonymous_id"][$this->
object->getId()];
3591 else if (
$_POST[
"anonymous_id"])
3593 $anonymize_key =
$_POST[
"anonymous_id"];
3596 $canStart = $this->
object->canStartSurvey($anonymize_key);
3597 $showButtons = $canStart[
"result"];
3600 if($canStart[
"edit_settings"] &&
3601 $ilAccess->checkAccess(
"write",
"", $this->ref_id))
3603 $canStart[
"messages"][] =
"<a href=\"".$this->ctrl->getLinkTarget($this,
"properties").
"\">» ".
3604 $this->lng->txt(
"survey_edit_settings").
"</a>";
3609 $big_button =
false;
3613 if (!$this->object->getAnonymize())
3615 $survey_started = $this->
object->isSurveyStarted($ilUser->getId(),
"");
3617 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
3623 if ($survey_started === 1)
3627 elseif ($survey_started === 0)
3629 $big_button = array(
"resume", $this->lng->txt(
"resume_survey"));
3631 elseif ($survey_started === FALSE)
3633 $big_button = array(
"start", $this->lng->txt(
"start_survey"));
3638 else if ($this->object->getAnonymize() && !$this->
object->isAccessibleWithoutCode())
3640 if ((
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID || $this->object->isAccessibleWithCodeForAll()) && (strlen(
$_POST[
"anonymous_id"]) == 0) && (strlen(
$_SESSION[
"anonymous_id"][$this->object->getId()]) == 0))
3642 $info->setFormAction($this->ctrl->getFormAction($this,
"infoScreen"));
3643 $info->addSection($this->lng->txt(
"anonymization"));
3644 $info->addProperty(
"", $this->lng->txt(
"anonymize_anonymous_introduction"));
3645 $info->addPropertyTextinput($this->lng->txt(
"enter_anonymous_id"),
"anonymous_id",
"", 8,
"infoScreen", $this->lng->txt(
"submit"));
3649 if (strlen(
$_POST[
"anonymous_id"]) > 0)
3651 if (!$this->object->checkSurveyCode(
$_POST[
"anonymous_id"]))
3657 $anonymize_key =
$_POST[
"anonymous_id"];
3660 else if (strlen(
$_SESSION[
"anonymous_id"][$this->object->getId()]) > 0)
3662 if (!$this->object->checkSurveyCode(
$_SESSION[
"anonymous_id"][$this->object->getId()]))
3668 $anonymize_key =
$_SESSION[
"anonymous_id"][$this->
object->getId()];
3674 $anonymize_key = $this->
object->getUserAccessCode($ilUser->getId());
3675 if (!strlen($anonymize_key))
3677 $anonymize_key = $this->
object->createNewAccessCode();
3678 $this->
object->saveUserAccessCode($ilUser->getId(), $anonymize_key);
3681 $info->addHiddenElement(
"anonymous_id", $anonymize_key);
3682 $survey_started = $this->
object->isSurveyStarted($ilUser->getId(), $anonymize_key);
3683 if ($survey_started === 1)
3687 elseif ($survey_started === 0)
3689 $big_button = array(
"resume", $this->lng->txt(
"resume_survey"));
3691 elseif ($survey_started === FALSE)
3693 $big_button = array(
"start", $this->lng->txt(
"start_survey"));
3700 $survey_started = $this->
object->isSurveyStarted($ilUser->getId(),
"");
3701 if ($survey_started === 1)
3705 elseif ($survey_started === 0)
3707 $big_button = array(
"resume", $this->lng->txt(
"resume_survey"));
3709 elseif ($survey_started === FALSE)
3711 $big_button = array(
"start", $this->lng->txt(
"start_survey"));
3718 $big_button =
'<div class="il_ButtonGroup il_BigButton">'.
3719 '<input type="submit" class="submit il_BigButton" name="cmd['.$big_button[0].
']" value="'.
3720 $big_button[1].
'" /></div>';
3723 if (strlen($this->object->getIntroduction()))
3725 $introduction = $this->
object->getIntroduction();
3726 $info->addSection($this->lng->txt(
"introduction"));
3727 $info->addProperty(
"", $this->object->prepareTextareaOutput($introduction).
3728 $big_button.
"<br />".$info->getHiddenToggleButton());
3732 $info->addSection(
"");
3733 $info->addProperty(
"", $big_button.$info->getHiddenToggleButton());
3736 $info->hideFurtherSections(
false);
3738 $info->addSection($this->lng->txt(
"svy_general_properties"));
3739 if (strlen($this->object->getAuthor()))
3741 $info->addProperty($this->lng->txt(
"author"), $this->
object->getAuthor());
3743 $info->addProperty($this->lng->txt(
"title"), $this->
object->getTitle());
3744 switch ($this->object->getAnonymize())
3747 $info->addProperty($this->lng->txt(
"anonymization"), $this->lng->txt(
"anonymize_personalized"));
3750 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
3752 $info->addProperty($this->lng->txt(
"anonymization"), $this->lng->txt(
"info_anonymize_with_code"));
3756 $info->addProperty($this->lng->txt(
"anonymization"), $this->lng->txt(
"info_anonymize_registered_user"));
3760 $info->addProperty($this->lng->txt(
"anonymization"), $this->lng->txt(
"info_anonymize_without_code"));
3763 include_once
"./Modules/Survey/classes/class.ilObjSurveyAccess.php";
3766 $info->addProperty($this->lng->txt(
"evaluation_access"), $this->lng->txt(
"evaluation_access_info"));
3768 $info->addMetaDataSections($this->object->getId(),0, $this->
object->getType());
3769 $this->ctrl->forwardCommand($info);
3782 $template =
new ilTemplate(
"tpl.il_svy_svy_printview.html", TRUE, TRUE,
"Modules/Survey");
3784 include_once
'./Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
3787 $this->ctrl->setParameter($this,
"pdf",
"1");
3788 $template->setCurrentBlock(
"pdf_export");
3789 $template->setVariable(
"PDF_URL", $this->ctrl->getLinkTarget($this,
"printView"));
3790 $this->ctrl->setParameter($this,
"pdf",
"");
3791 $template->setVariable(
"PDF_TEXT", $this->lng->txt(
"pdf_export"));
3792 $template->setVariable(
"PDF_IMG_ALT", $this->lng->txt(
"pdf_export"));
3794 $template->parseCurrentBlock();
3796 $template->setVariable(
"PRINT_TEXT", $this->lng->txt(
"print"));
3797 $template->setVariable(
"PRINT_URL",
"javascript:window.print();");
3799 $pages =& $this->
object->getSurveyPages();
3800 foreach ($pages as $page)
3802 if (count($page) > 0)
3804 foreach ($page as $question)
3806 $questionGUI = $this->
object->getQuestionGUI($question[
"type_tag"], $question[
"question_id"]);
3807 if (is_object($questionGUI))
3809 if (strlen($question[
"heading"]))
3811 $template->setCurrentBlock(
"textblock");
3812 $template->setVariable(
"TEXTBLOCK", $question[
"heading"]);
3813 $template->parseCurrentBlock();
3815 $template->setCurrentBlock(
"question");
3816 $template->setVariable(
"QUESTION_DATA", $questionGUI->getPrintView($this->object->getShowQuestionTitles(), $question[
"questionblock_show_questiontext"], $this->
object->getSurveyId()));
3817 $template->parseCurrentBlock();
3820 if (count($page) > 1)
3822 $template->setCurrentBlock(
"page");
3823 $template->setVariable(
"BLOCKTITLE", $page[0][
"questionblock_title"]);
3824 $template->parseCurrentBlock();
3828 $template->setCurrentBlock(
"page");
3829 $template->parseCurrentBlock();
3833 $this->tpl->addCss(
"./Modules/Survey/templates/default/survey_print.css",
"print");
3834 if (array_key_exists(
"pdf",
$_GET) && (
$_GET[
"pdf"] == 1))
3836 $printbody =
new ilTemplate(
"tpl.il_as_tst_print_body.html", TRUE, TRUE,
"Modules/Test");
3837 $printbody->setVariable(
"TITLE", sprintf($this->lng->txt(
"tst_result_user_name"), $uname));
3838 $printbody->setVariable(
"ADM_CONTENT", $template->get());
3839 $printoutput = $printbody->get();
3840 $printoutput = preg_replace(
"/href=\".*?\"/",
"", $printoutput);
3841 $fo = $this->
object->processPrintoutput2FO($printoutput);
3844 $this->
object->deliverPDFfromFO($fo);
3849 $this->ctrl->redirect($this,
"printView");
3854 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
3861 switch ($this->ctrl->getCmd())
3867 case "redirectQuestion":
3868 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
"infoScreen"),
"",
$_GET[
"ref_id"]);
3871 case "checkEvaluationAccess":
3872 case "evaluationdetails":
3873 case "evaluationuser":
3874 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluation"),
"",
$_GET[
"ref_id"]);
3883 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
"infoScreen"),
"",
$_GET[
"ref_id"]);
3886 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"",
$_GET[
"ref_id"]);
3900 $questions_per_page = ($a_cmd ==
'questions_per_page') ?
true :
false;
3901 $questions = ($a_cmd ==
'questions') ?
true :
false;
3902 $printview = ($a_cmd ==
'printview') ?
true :
false;
3904 $hidden_tabs = array();
3905 $template = $this->
object->getTemplate();
3908 include_once
"Services/Administration/classes/class.ilSettingsTemplate.php";
3910 $hidden_tabs = $template->getHiddenTabs();
3913 $this->tabs_gui->addSubTabTarget(
"survey_per_page_view", $this->ctrl->getLinkTargetByClass(
"ilsurveypagegui",
"renderPage"),
3914 "",
"",
"", $questions_per_page);
3916 if(!in_array(
"survey_question_editor", $hidden_tabs))
3918 $this->ctrl->setParameter($this,
"pgov",
"");
3919 $this->tabs_gui->addSubTabTarget(
"survey_question_editor", $this->ctrl->getLinkTarget($this,
"questions"),
3920 "",
"",
"", $questions);
3921 $this->ctrl->setParameter($this,
"pgov",
$_REQUEST[
"pgov"]);
3924 $this->tabs_gui->addSubTabTarget(
"print_view", $this->ctrl->getLinkTarget($this,
"printView"),
3925 "",
"",
"", $printview);
3927 if($this->object->getSurveyPages())
3929 if($questions_per_page)
3931 $this->ctrl->setParameterByClass(
"ilsurveyexecutiongui",
"pgov", max(1,
$_REQUEST[
"pg"]));
3933 $this->ctrl->setParameterByClass(
"ilsurveyexecutiongui",
"prvw", 1);
3934 $this->tabs_gui->addSubTabTarget(
"preview", $this->ctrl->getLinkTargetByClass(
"ilsurveyexecutiongui",
"preview"),
3949 $ilTabs->addSubTabTarget
3952 $this->ctrl->getLinkTarget($this,
'codes'),
3953 array(
"codes",
"createSurveyCodes",
"setCodeLanguage",
"deleteCodes",
"exportCodes"),
3957 $ilTabs->addSubTabTarget
3959 "participating_users",
3960 $this->ctrl->getLinkTarget($this,
"codesMail"),
3961 array(
"codesMail",
"saveMailTableFields",
"importExternalMailRecipients",
3962 'importExternalRecipientsFromFile',
'importExternalRecipientsFromText',
3963 'importExternalRecipientsFromDataset'),
3967 $data = $this->
object->getExternalCodeRecipients();
3970 $ilTabs->addSubTabTarget
3972 "mail_survey_codes",
3973 $this->ctrl->getLinkTarget($this,
"mailCodes"),
3974 array(
"mailCodes",
"sendCodesMail",
"insertSavedMessage",
"deleteSavedMessage"),
3990 $ilTabs->addSubTabTarget(
3991 "svy_eval_cumulated",
3992 $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluation"),
3993 array(
"evaluation",
"checkEvaluationAccess"),
3997 $ilTabs->addSubTabTarget(
3999 $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluationdetails"),
4000 array(
"evaluationdetails"),
4004 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
4006 $ilTabs->addSubTabTarget(
4008 $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluationuser"),
4009 array(
"evaluationuser"),
4020 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
4024 $link = $this->ctrl->getLinkTarget($this,
"questions");
4028 $link = $this->ctrl->getLinkTargetByClass(
"ilsurveypagegui",
"renderpage");
4030 $ilTabs->setBackTarget($this->lng->txt(
"menubacktosurvey"), $link);
4031 $ilTabs->addTarget(
"browse_for_questions",
4032 $this->ctrl->getLinkTarget($this,
"browseForQuestions"),
4033 array(
"browseForQuestions",
"browseForQuestionblocks"),
4046 global $ilAccess,
$ilUser, $ilHelp;
4048 $ilHelp->setScreenIdComponent(
"svy");
4050 if (strcmp($this->ctrl->getNextClass(),
'ilrepositorysearchgui') != 0)
4052 switch ($this->ctrl->getCmd())
4054 case "browseForQuestions":
4055 case "browseForQuestionblocks":
4056 case "insertQuestions":
4057 case "filterQuestions":
4058 case "resetFilterQuestions":
4059 case "changeDatatype":
4064 case "redirectQuestion":
4069 case "checkEvaluationAccess":
4070 case "evaluationdetails":
4071 case "evaluationuser":
4077 $hidden_tabs = array();
4078 $template = $this->
object->getTemplate();
4081 include_once
"Services/Administration/classes/class.ilSettingsTemplate.php";
4083 $hidden_tabs = $template->getHiddenTabs();
4087 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
4089 $force_active = (
$_GET[
"up"] !=
"" ||
$_GET[
"down"] !=
"")
4093 $cmd = $this->ctrl->getLinkTargetByClass(
"ilsurveypagegui",
"renderPage");
4096 $tabs_gui->addTarget(
"survey_questions",
4098 array(
"questions",
"browseForQuestions",
"createQuestion",
4099 "filterQuestions",
"resetFilterQuestions",
"changeDatatype",
"insertQuestions",
4100 "removeQuestions",
"cancelRemoveQuestions",
"confirmRemoveQuestions",
4101 "defineQuestionblock",
"saveDefineQuestionblock",
"cancelDefineQuestionblock",
4102 "unfoldQuestionblock",
"moveQuestions",
4103 "insertQuestionsBefore",
"insertQuestionsAfter",
"saveObligatory",
4104 "addHeading",
"saveHeading",
"cancelHeading",
"editHeading",
4105 "confirmRemoveHeading",
"cancelRemoveHeading",
"printView",
"renderPage",
4106 "addQuestionToolbarForm",
"deleteBlock",
"movePageForm",
"copyQuestionsToPool"),
4107 "",
"", $force_active);
4110 if ($ilAccess->checkAccess(
"visible",
"", $this->ref_id))
4112 $tabs_gui->addTarget(
"info_short",
4113 $this->ctrl->getLinkTarget($this,
'infoScreen'),
4114 array(
"infoScreen",
"showSummary"));
4118 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
4120 $force_active = ($this->ctrl->getCmd() ==
"")
4123 $tabs_gui->addTarget(
"settings",
4124 $this->ctrl->getLinkTarget($this,
'properties'),
4125 array(
"properties",
"save",
"cancel",
'saveProperties'),
"",
4130 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id) &&
4131 !in_array(
"constraints", $hidden_tabs))
4134 $tabs_gui->addTarget(
"constraints",
4135 $this->ctrl->getLinkTarget($this,
"constraints"),
4136 array(
"constraints",
"constraintStep1",
"constraintStep2",
4137 "constraintStep3",
"constraintsAdd",
"createConstraints",
4138 "editPrecondition"),
4143 if ($ilAccess->checkAccess(
"invite",
"", $this->ref_id) &&
4144 !in_array(
"invitation", $hidden_tabs))
4147 $tabs_gui->addTarget(
"invitation",
4148 $this->ctrl->getLinkTarget($this,
'invite'),
4149 array(
"invite",
"saveInvitationStatus",
4150 "inviteUserGroup",
"disinviteUserGroup"),
4154 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
4157 $tabs_gui->addTarget(
"maintenance",
4158 $this->ctrl->getLinkTarget($this,
'maintenance'),
4159 array(
"maintenance",
"deleteAllUserData"),
4162 if ($this->object->getAnonymize() == 1 || $this->
object->isAccessibleWithCodeForAll())
4165 $tabs_gui->addTarget(
"codes",
4166 $this->ctrl->getLinkTarget($this,
'codes'),
4167 array(
"codes",
"exportCodes",
'codesMail',
'saveMailTableFields',
'importExternalMailRecipients',
4168 'mailCodes',
'sendCodesMail',
'importExternalRecipientsFromFile',
'importExternalRecipientsFromText',
4169 'importExternalRecipientsFromDataset',
'insertSavedMessage',
'deleteSavedMessage'),
4174 include_once
"./Modules/Survey/classes/class.ilObjSurveyAccess.php";
4178 $tabs_gui->addTarget(
"svy_evaluation",
4179 $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluation"),
4180 array(
"evaluation",
"checkEvaluationAccess",
"evaluationdetails",
4185 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
4187 if(!in_array(
"meta_data", $hidden_tabs))
4190 $tabs_gui->addTarget(
"meta_data",
4191 $this->ctrl->getLinkTargetByClass(
'ilmdeditorgui',
'listSection'),
4192 "",
"ilmdeditorgui");
4195 if(!in_array(
"export", $hidden_tabs))
4198 $tabs_gui->addTarget(
"export",
4199 $this->ctrl->getLinkTarget($this,
'export'),
4200 array(
"export",
"createExportFile",
"confirmDeleteExportFile",
4201 "downloadExportFile"),
4207 if ($ilAccess->checkAccess(
"edit_permission",
"", $this->ref_id))
4210 $tabs_gui->addTarget(
"perm_settings",
4211 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
4220 function _goto($a_target, $a_access_code =
"")
4223 if ($ilAccess->checkAccess(
"read",
"", $a_target))
4225 include_once
"./Services/Utilities/classes/class.ilUtil.php";
4226 if (strlen($a_access_code))
4229 $_GET[
"baseClass"] =
"ilObjSurveyGUI";
4230 $_GET[
"cmd"] =
"infoScreen";
4231 $_GET[
"ref_id"] = $a_target;
4232 include(
"ilias.php");
4237 $_GET[
"baseClass"] =
"ilObjSurveyGUI";
4238 $_GET[
"cmd"] =
"infoScreen";
4239 $_GET[
"ref_id"] = $a_target;
4240 include(
"ilias.php");
4244 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
4251 $ilErr->raiseError($lng->txt(
"msg_no_perm_read_lm"), $ilErr->FATAL);
4260 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_confirm_resettemplate.html",
"Modules/Survey");
4261 $this->tpl->setCurrentBlock(
"adm_content");
4262 $this->tpl->setVariable(
"BTN_CONFIRM_REMOVE", $this->lng->txt(
"confirm"));
4263 $this->tpl->setVariable(
"BTN_CANCEL_REMOVE", $this->lng->txt(
"cancel"));
4264 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"resetTemplateObject"));
4265 $this->tpl->parseCurrentBlock();
4273 $this->
object->setTemplate(null);
4274 $this->
object->saveToDB();
4277 $this->ctrl->redirect($this,
"properties");
4289 $copy_questions = $items[
"questions"];
4290 foreach ($items[
"blocks"] as $block_id)
4292 foreach ($this->object->getQuestionblockQuestionIds($block_id) as $qid)
4294 array_push($copy_questions, $qid);
4297 $copy_questions = array_unique($copy_questions);
4300 if (count($copy_questions))
4302 foreach($copy_questions as $idx => $question_id)
4305 if($question->getOriginalId())
4307 unset($copy_questions[$idx]);
4312 if (count($copy_questions) == 0)
4314 ilUtil::sendInfo($this->lng->txt(
"no_question_selected_for_copy_to_pool"),
true);
4315 $this->ctrl->redirect($this,
"questions");
4321 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
4324 $form->setFormAction($this->ctrl->getFormAction($this,
"executeCreateQuestion"));
4327 $ids->setValue(implode(
";", $copy_questions));
4328 $form->addItem($ids);
4330 $questionpools =& $this->
object->getAvailableQuestionpools(
false,
false,
true,
"write");
4331 $pools =
new ilSelectInputGUI($this->lng->txt(
"survey_copy_select_questionpool"),
"sel_spl");
4333 $form->addItem($pools);
4335 $form->addCommandButton(
"executeCopyQuestionsToPool", $this->lng->txt(
"submit"));
4336 $form->addCommandButton(
"questions", $this->lng->txt(
"cancel"));
4338 return $this->tpl->setContent($form->getHTML());
4347 $question_ids = explode(
";",
$_POST[
"question_ids"]);
4350 foreach($question_ids as $qid)
4354 $new_question->setId();
4355 $new_question->setObjId($pool_id);
4356 $new_question->saveToDb();
4363 $this->ctrl->redirect($this,
"questions");