41 include_once
"./classes/class.ilObjectGUI.php";
42 include_once
"./Modules/Survey/classes/inc.SurveyConstants.php";
55 $lng->loadLanguageModule(
"survey");
56 $lng->loadLanguageModule(
"mail");
58 $this->ctrl->saveParameter($this,
"ref_id");
65 include_once
"./Services/Utilities/classes/class.ilUtil.php";
66 $path = $this->tree->getPathFull($this->object->getRefID());
75 global $ilAccess, $ilNavigationHistory,
$ilCtrl;
77 if ((!$ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"])) && (!$ilAccess->checkAccess(
"visible",
"",
$_GET[
"ref_id"])))
80 $ilias->raiseError($this->lng->txt(
"permission_denied"), $ilias->error_obj->MESSAGE);
84 $ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"]))
86 $ilNavigationHistory->addItem(
$_GET[
"ref_id"],
87 "ilias.php?baseClass=ilObjSurveyGUI&cmd=infoScreen&ref_id=".
$_GET[
"ref_id"],
"svy");
90 $cmd = $this->ctrl->getCmd(
"properties");
93 if (
$cmd ==
"saveTags")
95 $ilCtrl->setCmdClass(
"ilinfoscreengui");
98 $next_class = $this->ctrl->getNextClass($this);
99 $this->ctrl->setReturn($this,
"properties");
105 case "ilinfoscreengui":
108 case 'ilmdeditorgui':
109 include_once
'Services/MetaData/classes/class.ilMDEditorGUI.php';
110 $md_gui =&
new ilMDEditorGUI($this->object->getId(), 0, $this->
object->getType());
111 $md_gui->
addObserver($this->
object,
'MDUpdateListener',
'General');
113 $this->ctrl->forwardCommand($md_gui);
116 case "ilsurveyevaluationgui":
117 include_once(
"./Modules/Survey/classes/class.ilSurveyEvaluationGUI.php");
119 $ret =& $this->ctrl->forwardCommand($eval_gui);
122 case 'ilrepositorysearchgui':
123 include_once(
'./Services/Search/classes/class.ilRepositorySearchGUI.php');
125 $rep_search->setCallback($this,
126 'inviteUserGroupObject',
132 $this->ctrl->setReturn($this,
'invite');
133 $ret =& $this->ctrl->forwardCommand($rep_search);
134 $this->tabs_gui->setTabActive(
'invitation');
137 case "ilsurveyexecutiongui":
138 include_once(
"./Modules/Survey/classes/class.ilSurveyExecutionGUI.php");
140 $ret =& $this->ctrl->forwardCommand($exec_gui);
143 case 'ilpermissiongui':
144 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
146 $ret =& $this->ctrl->forwardCommand($perm_gui);
149 case 'ilobjectcopygui':
150 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
153 $this->ctrl->forwardCommand($cp);
163 if (strtolower(
$_GET[
"baseClass"]) !=
"iladministrationgui" &&
178 if (!strlen(
$_POST[
'Fobject'][
'title']))
181 $this->ctrl->setParameter($this,
'new_type',
$_GET[
'new_type']);
182 $this->ctrl->redirect($this,
'create');
189 ilUtil::redirect(
"ilias.php?baseClass=ilObjSurveyGUI&ref_id=".$newObj->getRefId().
"&cmd=properties");
211 $this->ctrl->redirect($this,
"properties");
224 if (!$ilAccess->checkAccess(
"write",
"", $this->ref_id))
228 $this->ctrl->redirect($this,
"infoScreen");
244 $result = $this->
object->setStatus(
$_POST[
'online']);
245 $this->
object->setEvaluationAccess(
$_POST[
"evaluation_access"]);
246 $this->
object->setStartDateEnabled(
$_POST[
"enabled_start_date"]);
247 if ($this->object->getStartDateEnabled())
249 $this->
object->setStartDateAndTime(
$_POST[
"start_date"][
'date'],
$_POST[
"start_date"][
'time']);
253 $this->
object->setStartDate(null);
255 $this->
object->setEndDateEnabled(
$_POST[
"enabled_end_date"]);
256 if ($this->object->getEndDateEnabled())
258 $this->
object->setEndDateAndTime(
$_POST[
"end_date"][
'date'],
$_POST[
"end_date"][
'time']);
262 $this->
object->setEndDate(null);
265 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
266 $introduction =
$_POST[
"introduction"];
267 $this->
object->setIntroduction($introduction);
269 $this->
object->setOutro($outro);
271 $this->
object->setRedirectAfterSurvey(
$_POST[
"redirect_after_survey"]);
272 $redirect_only_kiosk_mode = (
$_POST[
"redirect_only_kiosk_mode"] ? 1 : 0);
273 $this->
object->setRedirectOnlyKioskMode($redirect_only_kiosk_mode);
274 $mail_confirmation = (
$_POST[
"mail_confirmation"] ? 1 : 0);
275 $this->
object->setMailConfirmation($mail_confirmation);
276 $this->
object->setMailConfirmationSubject(
$_POST[
"mail_confirmation_subject"]);
278 $mail_confirmation_body =
$_POST[
"mail_confirmation_body"];
279 $this->
object->setMailConfirmationBody($mail_confirmation_body);
281 $hasDatasets = $this->
object->_hasDatasets($this->object->getSurveyId());
284 $anonymize =
$_POST[
"anonymization"];
289 $this->
object->setAnonymize($anonymize);
291 $this->
object->setShowQuestionTitles(
$_POST[
"show_question_titles"]);
292 $this->
object->setMailNotification(
$_POST[
'mailnotification']);
293 $this->
object->setMailAddresses(
$_POST[
'mailaddresses']);
294 $this->
object->setMailParticipantData(
$_POST[
'mailparticipantdata']);
295 $this->
object->saveToDb();
304 $this->ctrl->redirect($this,
"properties");
317 $save = (strcmp($this->ctrl->getCmd(),
"saveProperties") == 0) ? TRUE : FALSE;
319 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
321 $form->setFormAction($this->ctrl->getFormAction($this));
322 $form->setTableWidth(
"100%");
323 $form->setId(
"survey_properties");
327 $header->setTitle($this->lng->txt(
"properties"));
328 $form->addItem($header);
333 $online->setChecked($this->object->isOnline());
334 $form->addItem($online);
338 $intro->
setValue($this->object->prepareTextareaOutput($this->object->getIntroduction()));
341 $intro->setUseRte(TRUE);
342 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
344 $intro->addPlugin(
"latex");
345 $intro->addButton(
"latex");
346 $intro->addPlugin(
"pastelatex");
347 $intro->setRTESupport($this->object->getId(),
"svy",
"survey");
348 $form->addItem($intro);
351 $enablestartingtime =
new ilCheckboxInputGUI($this->lng->txt(
"start_date"),
"enabled_start_date");
353 $enablestartingtime->setOptionTitle($this->lng->txt(
"enabled"));
354 $enablestartingtime->setChecked($this->object->getStartDateEnabled());
357 $startingtime->setShowDate(
true);
358 $startingtime->setShowTime(
true);
359 if ($this->object->getStartDateEnabled())
367 $enablestartingtime->addSubItem($startingtime);
368 $form->addItem($enablestartingtime);
371 $enableendingtime =
new ilCheckboxInputGUI($this->lng->txt(
"end_date"),
"enabled_end_date");
373 $enableendingtime->setOptionTitle($this->lng->txt(
"enabled"));
374 $enableendingtime->setChecked($this->object->getEndDateEnabled());
377 $endingtime->setShowDate(
true);
378 $endingtime->setShowTime(
true);
379 if ($this->object->getEndDateEnabled())
387 $enableendingtime->addSubItem($endingtime);
388 $form->addItem($enableendingtime);
391 $anonymization =
new ilCheckboxInputGUI($this->lng->txt(
"anonymization"),
"anonymization");
392 $hasDatasets = $this->
object->_hasDatasets($this->object->getSurveyId());
397 $anonymization->setOptionTitle($this->lng->txt(
"on"));
398 $anonymization->setValue(1);
399 $anonymization->setChecked($this->object->getAnonymize());
400 $anonymization->setInfo($this->lng->txt(
"anonymize_survey_description"));
405 $anonymization_options->setDisabled(
true);
407 $anonymization_options->addOption(
new ilCheckboxOption($this->lng->txt(
"anonymize_without_code"),
'anonymize_without_code',
''));
408 $anonymization_options->addOption(
new ilCheckboxOption($this->lng->txt(
"anonymize_with_code"),
'anonymize_with_code',
''));
409 $anonymization_options->setValue(($this->object->isAccessibleWithoutCode()) ?
'anonymize_without_code' :
'anonymize_with_code');
411 $anonymization->addSubItem($anonymization_options);
412 $form->addItem($anonymization);
416 $show_question_titles->setOptionTitle($this->lng->txt(
"svy_show_questiontitles"));
417 $show_question_titles->setValue(1);
418 $show_question_titles->setChecked($this->object->getShowQuestionTitles());
419 $form->addItem($show_question_titles);
423 $finalstatement->
setValue($this->object->prepareTextareaOutput($this->object->getOutro()));
424 $finalstatement->setRows(10);
425 $finalstatement->setCols(80);
426 $finalstatement->setUseRte(TRUE);
428 $finalstatement->addPlugin(
"latex");
429 $finalstatement->addButton(
"latex");
430 $finalstatement->addPlugin(
"pastelatex");
431 $finalstatement->setRTESupport($this->object->getId(),
"svy",
"survey");
432 $form->addItem($finalstatement);
436 $redirect_after_survey =
new ilTextInputGUI($this->lng->txt(
"redirect_after_survey"),
"redirect_after_survey");
437 $redirect_after_survey->
setSize(100);
438 $redirect_after_survey->setValue($this->object->getRedirectAfterSurvey());
439 $redirect_after_survey->setInfo($this->lng->txt(
"info_redirect_after_survey"));
440 $form->addItem($redirect_after_survey);
443 $redirect_only_kiosk_mode =
new ilCheckboxInputGUI($this->lng->txt(
"redirect_only_kiosk_mode"),
"redirect_only_kiosk_mode");
444 $redirect_only_kiosk_mode->
setValue(1);
445 $redirect_only_kiosk_mode->setChecked($this->object->getRedirectOnlyKioskMode());
446 $redirect_only_kiosk_mode->setInfo($this->lng->txt(
"info_redirect_only_kiosk_mode"));
447 $form->addItem($redirect_only_kiosk_mode);
450 $mail_confirmation =
new ilCheckboxInputGUI($this->lng->txt(
"mail_confirmation"),
"mail_confirmation");
452 $mail_confirmation->setChecked($this->object->getMailConfirmation());
454 $form->addItem($mail_confirmation);
456 $mail_confirmation_subject =
new ilTextInputGUI($this->lng->txt(
"mail_confirmation_subject"),
"mail_confirmation_subject");
457 $mail_confirmation_subject->
setSize(100);
458 $mail_confirmation_subject->setValue($this->object->getMailConfirmationSubject());
460 $form->addItem($mail_confirmation_subject);
462 $mail_confirmation_body =
new ilTextAreaInputGUI($this->lng->txt(
"mail_confirmation_body"),
"mail_confirmation_body");
464 $mail_confirmation_body->
setValue($this->object->getMailConfirmationBody());
465 $mail_confirmation_body->setRows(10);
466 $mail_confirmation_body->setCols(80);
467 $mail_confirmation_body->setInfo($this->lng->txt(
"info_mail_confirmation_body"));
468 $form->addItem($mail_confirmation_body);
473 $results->setTitle($this->lng->txt(
"results"));
477 $evaluation_access =
new ilRadioGroupInputGUI($this->lng->txt(
'evaluation_access'),
"evaluation_access");
478 $evaluation_access->
setInfo($this->lng->txt(
'evaluation_access_description'));
482 $evaluation_access->setValue($this->object->getEvaluationAccess());
483 $form->addItem($evaluation_access);
486 $mailnotification =
new ilCheckboxInputGUI($this->lng->txt(
"mailnotification"),
"mailnotification");
488 $mailnotification->setValue(1);
489 $mailnotification->setChecked($this->object->getMailNotification());
492 $mailaddresses =
new ilTextInputGUI($this->lng->txt(
"mailaddresses"),
"mailaddresses");
493 $mailaddresses->
setValue($this->object->getMailAddresses());
494 $mailaddresses->setSize(80);
495 $mailaddresses->setInfo($this->lng->txt(
'mailaddresses_info'));
496 $mailaddresses->setRequired(
true);
497 if (($save) && !
$_POST[
'mailnotification'])
499 $mailaddresses->setRequired(
false);
503 $participantdata =
new ilTextAreaInputGUI($this->lng->txt(
"mailparticipantdata"),
"mailparticipantdata");
504 $participantdata->
setValue($this->object->getMailParticipantData());
505 $participantdata->setRows(6);
506 $participantdata->setCols(80);
507 $participantdata->setUseRte(
false);
508 $participantdata->setInfo($this->lng->txt(
'mailparticipantdata_info'));
510 $mailnotification->addSubItem($mailaddresses);
511 $mailnotification->addSubItem($participantdata);
512 $form->addItem($mailnotification);
514 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form->addCommandButton(
"saveProperties", $this->lng->txt(
"save"));
519 $errors = !$form->checkInput();
520 $form->setValuesByPost();
523 if (($online->getChecked()) && (count($this->object->questions) == 0))
525 $online->setAlert($this->lng->txt(
"cannot_switch_to_online_no_questions"));
530 if (
$errors) $checkonly =
false;
532 $mailaddresses->setRequired(
true);
533 if (!$checkonly) $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
546 $checked_questions = array();
547 $checked_questionblocks = array();
548 foreach (
$_POST as $key => $value)
550 if (preg_match(
"/cb_(\d+)/", $key, $matches))
552 array_push($checked_questions, $matches[1]);
554 if (preg_match(
"/cb_qb_(\d+)/", $key, $matches))
556 array_push($checked_questionblocks, $matches[1]);
559 if (count($checked_questions) + count($checked_questionblocks) > 0)
567 ilUtil::sendInfo($this->lng->txt(
"no_question_selected_for_removal"),
true);
568 $this->ctrl->redirect($this,
"questions");
577 $inserted_objects = 0;
578 if (is_array(
$_POST[
'q_id']))
580 foreach (
$_POST[
'q_id'] as $question_id)
582 $this->
object->insertQuestion($question_id);
586 if ($inserted_objects)
588 $this->
object->saveCompletionStatus();
590 $this->ctrl->redirect($this,
"questions");
595 $this->ctrl->redirect($this,
'browseForQuestions');
604 $inserted_objects = 0;
605 if (is_array(
$_POST[
'cb']))
607 foreach (
$_POST[
'cb'] as $questionblock_id)
609 $this->
object->insertQuestionblock($questionblock_id);
613 if ($inserted_objects)
615 $this->
object->saveCompletionStatus();
616 ilUtil::sendSuccess(($inserted_objects == 1) ? $this->lng->txt(
"questionblock_inserted") : $this->lng->txt(
"questionblocks_inserted"),
true);
617 $this->ctrl->redirect($this,
"questions");
622 $this->ctrl->redirect($this,
'browseForQuestionblocks');
632 $ilUser->writePref(
'svy_insert_type',
$_POST[
'datatype']);
633 switch (
$_POST[
"datatype"])
636 $this->ctrl->redirect($this,
'browseForQuestionblocks');
640 $this->ctrl->redirect($this,
'browseForQuestions');
650 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
652 $table_gui->writeFilterToSession();
653 $this->ctrl->redirect($this,
'browseForQuestionblocks');
661 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
663 $table_gui->resetFilter();
664 $this->ctrl->redirect($this,
'browseForQuestionblocks');
676 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_questionbrowser.html",
"Modules/Survey");
677 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
679 $table_gui->
setEditable($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']));
680 $arrFilter = array();
681 foreach ($table_gui->getFilterItems() as $item)
683 if ($item->getValue() !==
false)
685 $arrFilter[$item->getPostVar()] = $item->getValue();
688 $data = $this->
object->getQuestionblocksTable($arrFilter);
689 $table_gui->setData(
$data);
690 $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());
692 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
'changeDatatype'));
693 $this->tpl->setVariable(
"OPTION_QUESTIONS", $this->lng->txt(
"questions"));
694 $this->tpl->setVariable(
"OPTION_QUESTIONBLOCKS", $this->lng->txt(
"questionblocks"));
695 $this->tpl->setVariable(
"SELECTED_QUESTIONBLOCKS",
" selected=\"selected\"");
696 $this->tpl->setVariable(
"TEXT_DATATYPE", $this->lng->txt(
"display_all_available"));
697 $this->tpl->setVariable(
"BTN_CHANGE", $this->lng->txt(
"change"));
705 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
707 $table_gui->writeFilterToSession();
708 $this->ctrl->redirect($this,
'browseForQuestions');
716 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
718 $table_gui->resetFilter();
719 $this->ctrl->redirect($this,
'browseForQuestions');
731 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_questionbrowser.html",
"Modules/Survey");
732 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
734 $table_gui->
setEditable($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']));
735 $arrFilter = array();
736 foreach ($table_gui->getFilterItems() as $item)
738 if ($item->getValue() !==
false)
740 $arrFilter[$item->getPostVar()] = $item->getValue();
743 $data = $this->
object->getQuestionsTable($arrFilter);
744 $table_gui->setData(
$data);
745 $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());
747 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
'changeDatatype'));
748 $this->tpl->setVariable(
"OPTION_QUESTIONS", $this->lng->txt(
"questions"));
749 $this->tpl->setVariable(
"OPTION_QUESTIONBLOCKS", $this->lng->txt(
"questionblocks"));
750 $this->tpl->setVariable(
"SELECTED_QUESTIONS",
" selected=\"selected\"");
751 $this->tpl->setVariable(
"TEXT_DATATYPE", $this->lng->txt(
"display_all_available"));
752 $this->tpl->setVariable(
"BTN_CHANGE", $this->lng->txt(
"change"));
765 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_remove_questions.html",
"Modules/Survey");
766 $colors = array(
"tblrow1",
"tblrow2");
768 $surveyquestions =& $this->
object->getSurveyQuestions();
769 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
770 foreach ($surveyquestions as $question_id =>
$data)
772 if (in_array(
$data[
"question_id"], $checked_questions) or (in_array(
$data[
"questionblock_id"], $checked_questionblocks)))
774 $this->tpl->setCurrentBlock(
"row");
775 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
776 $this->tpl->setVariable(
"TEXT_TITLE",
$data[
"title"]);
777 $this->tpl->setVariable(
"TEXT_DESCRIPTION",
$data[
"description"]);
779 $this->tpl->setVariable(
"TEXT_QUESTIONBLOCK",
$data[
"questionblock_title"]);
780 $this->tpl->parseCurrentBlock();
784 foreach ($checked_questions as $id)
786 $this->tpl->setCurrentBlock(
"hidden");
787 $this->tpl->setVariable(
"HIDDEN_NAME",
"id_$id");
788 $this->tpl->setVariable(
"HIDDEN_VALUE",
"$id");
789 $this->tpl->parseCurrentBlock();
791 foreach ($checked_questionblocks as $id)
793 $this->tpl->setCurrentBlock(
"hidden");
794 $this->tpl->setVariable(
"HIDDEN_NAME",
"id_qb_$id");
795 $this->tpl->setVariable(
"HIDDEN_VALUE",
"$id");
796 $this->tpl->parseCurrentBlock();
798 $this->tpl->setCurrentBlock(
"adm_content");
799 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"title"));
800 $this->tpl->setVariable(
"TEXT_DESCRIPTION", $this->lng->txt(
"description"));
801 $this->tpl->setVariable(
"TEXT_TYPE", $this->lng->txt(
"question_type"));
802 $this->tpl->setVariable(
"TEXT_QUESTIONBLOCK", $this->lng->txt(
"questionblock"));
803 $this->tpl->setVariable(
"BTN_CONFIRM", $this->lng->txt(
"confirm"));
804 $this->tpl->setVariable(
"BTN_CANCEL", $this->lng->txt(
"cancel"));
805 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"confirmRemoveQuestions"));
806 $this->tpl->parseCurrentBlock();
820 if ($questionblock_id)
822 $questionblock = $this->
object->getQuestionblock($questionblock_id);
824 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_define_questionblock.html",
"Modules/Survey");
825 foreach (
$_POST as $key => $value)
827 if (preg_match(
"/cb_(\d+)/", $key, $matches))
829 $this->tpl->setCurrentBlock(
"hidden");
830 $this->tpl->setVariable(
"HIDDEN_NAME",
"cb_$matches[1]");
831 $this->tpl->setVariable(
"HIDDEN_VALUE", $matches[1]);
832 $this->tpl->parseCurrentBlock();
835 if ($questionblock_id)
837 $this->tpl->setCurrentBlock(
"hidden");
838 $this->tpl->setVariable(
"HIDDEN_NAME",
"questionblock_id");
839 $this->tpl->setVariable(
"HIDDEN_VALUE", $questionblock_id);
840 $this->tpl->parseCurrentBlock();
842 $this->tpl->setCurrentBlock(
"adm_content");
843 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"title"));
844 if ($questionblock_id)
846 $this->tpl->setVariable(
"VALUE_TITLE", $questionblock[
"title"]);
848 $this->tpl->setVariable(
"TXT_QUESTIONTEXT_DESCRIPTION", $this->lng->txt(
"show_questiontext_description"));
849 $this->tpl->setVariable(
"TXT_QUESTIONTEXT", $this->lng->txt(
"show_questiontext"));
850 if (($questionblock[
"show_questiontext"]) || (strlen($questionblock_id) == 0))
852 $this->tpl->setVariable(
"CHECKED_QUESTIONTEXT",
" checked=\"checked\"");
854 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
855 $this->tpl->setVariable(
"HEADING_QUESTIONBLOCK", $this->lng->txt(
"define_questionblock"));
856 $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save"));
857 $this->tpl->setVariable(
"CANCEL", $this->lng->txt(
"cancel"));
858 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"saveDefineQuestionblock"));
859 $this->tpl->parseCurrentBlock();
871 $tpl =
new ilTemplate(
"tpl.il_svy_svy_qpl_select.html", TRUE, TRUE,
"Modules/Survey");
872 $questionpools =& $this->
object->getAvailableQuestionpools(FALSE, TRUE, TRUE,
"write");
873 if (count($questionpools))
875 foreach ($questionpools as $key => $value)
877 $tpl->setCurrentBlock(
"option");
878 $tpl->setVariable(
"VALUE_OPTION", $key);
879 $tpl->setVariable(
"TEXT_OPTION", $value);
880 $tpl->parseCurrentBlock();
882 $tpl->setCurrentBlock(
"selection");
883 $tpl->setVariable(
"TXT_QPL_SELECT", $this->lng->txt(
"select_questionpool"));
884 $tpl->parseCurrentBlock();
888 $tpl->setCurrentBlock(
"selection");
889 $tpl->setVariable(
"TXT_QPL_ENTER", $this->lng->txt(
"cat_create_spl"));
890 $tpl->parseCurrentBlock();
892 $tpl->setVariable(
"BTN_SUBMIT", $this->lng->txt(
"submit"));
893 $sel_question_types = (strlen(
$_POST[
"sel_question_types"])) ?
$_POST[
"sel_question_types"] :
$_GET[
"sel_question_types"];
894 $this->ctrl->setParameter($this,
"sel_question_types", $sel_question_types);
895 $tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"executeCreateQuestion"));
896 $tpl->setVariable(
"BTN_CANCEL", $this->lng->txt(
"cancel"));
897 $this->tpl->setVariable(
"ADM_CONTENT",
$tpl->get());
907 $this->ctrl->redirect($this,
"questions");
917 if (strlen(
$_POST[
"sel_spl"]))
919 include_once
"./Services/Utilities/classes/class.ilUtil.php";
920 ilUtil::redirect(
"ilias.php?baseClass=ilObjSurveyQuestionPoolGUI&ref_id=" .
$_POST[
"sel_spl"] .
"&cmd=createQuestionForSurvey&new_for_survey=".
$_GET[
"ref_id"].
"&sel_question_types=".
$_GET[
"sel_question_types"]);
922 elseif (strlen(
$_POST[
"name_spl"]))
925 ilUtil::redirect(
"ilias.php?baseClass=ilObjSurveyQuestionPoolGUI&ref_id=" .
$ref_id .
"&cmd=createQuestionForSurvey&new_for_survey=".
$_GET[
"ref_id"].
"&sel_question_types=".
$_GET[
"sel_question_types"]);
930 $this->ctrl->setParameter($this,
"sel_question_types",
$_GET[
"sel_question_types"]);
931 $this->ctrl->redirect($this,
"createQuestion");
944 $parent_ref = $tree->getParentId($this->object->getRefId());
945 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
947 $qpl->setType(
"spl");
948 $qpl->setTitle(
$name);
949 $qpl->setDescription(
"");
951 $qpl->createReference();
952 $qpl->putInTree($parent_ref);
953 $qpl->setPermissions($parent_ref);
956 return $qpl->getRefId();
971 $save = (strcmp($this->ctrl->getCmd(),
"saveHeading") == 0) ? TRUE : FALSE;
973 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
975 $form->setFormAction($this->ctrl->getFormAction($this));
976 $form->setTableWidth(
"100%");
977 $form->setId(
"survey_heading");
983 $header->setTitle($this->lng->txt(
"edit_heading"));
987 $header->setTitle($this->lng->txt(
"add_heading"));
989 $form->addItem($header);
991 $survey_questions =& $this->
object->getSurveyQuestions();
995 $heading->
setValue($this->object->prepareTextareaOutput(array_key_exists(
'heading',
$_POST) ?
$_POST[
'heading'] : $survey_questions[$question_id][
"heading"]));
996 $heading->setRows(10);
997 $heading->setCols(80);
998 $heading->setUseRte(TRUE);
999 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
1001 $heading->removePlugin(
"ibrowser");
1002 $heading->setRTESupport($this->object->getId(),
"svy",
"survey");
1003 $heading->setRequired(
true);
1004 $form->addItem($heading);
1006 $insertbefore =
new ilSelectInputGUI($this->lng->txt(
"insert"),
"insertbefore");
1008 foreach ($survey_questions as $key => $value)
1010 $options[$key] = $this->lng->txt(
"before") .
": \"" . $value[
"title"] .
"\"";
1013 $insertbefore->setValue((array_key_exists(
'insertbefore',
$_POST)) ?
$_POST[
'insertbefore'] : $question_id);
1014 $insertbefore->setRequired(
true);
1015 if ($question_id || array_key_exists(
'insertbefore',
$_POST))
1017 $insertbefore->setDisabled(
true);
1019 $form->addItem($insertbefore);
1021 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form->addCommandButton(
"saveHeading", $this->lng->txt(
"save"));
1022 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form->addCommandButton(
"cancelHeading", $this->lng->txt(
"cancel"));
1027 $errors = !$form->checkInput();
1028 $form->setValuesByPost();
1029 if (
$errors) $checkonly =
false;
1031 if (!$checkonly) $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
1043 foreach (
$_POST as $key => $value) {
1044 if (preg_match(
"/id_(\d+)/", $key, $matches)) {
1045 if (
$_GET[
"browsetype"] == 1)
1047 $this->
object->insertQuestion($matches[1]);
1051 $this->
object->insertQuestionBlock($matches[1]);
1055 $this->
object->saveCompletionStatus();
1057 $this->ctrl->redirect($this,
"questions");
1067 $this->ctrl->redirect($this,
"questions");
1082 $insertbefore =
$_POST[
"insertbefore"];
1085 $insertbefore =
$_POST[
"insertbefore_original"];
1087 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
1089 $this->ctrl->redirect($this,
"questions");
1102 $this->ctrl->redirect($this,
"questions");
1114 $this->
object->saveHeading(
"",
$_POST[
"removeheading"]);
1115 $this->ctrl->redirect($this,
"questions");
1127 $this->ctrl->redirect($this,
"questions");
1140 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_confirm_removeheading.html",
"Modules/Survey");
1141 $this->tpl->setCurrentBlock(
"adm_content");
1142 $this->tpl->setVariable(
"BTN_CONFIRM_REMOVE", $this->lng->txt(
"confirm"));
1143 $this->tpl->setVariable(
"BTN_CANCEL_REMOVE", $this->lng->txt(
"cancel"));
1144 $this->tpl->setVariable(
"REMOVE_HEADING",
$_GET[
"removeheading"]);
1145 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"confirmRemoveHeading"));
1146 $this->tpl->parseCurrentBlock();
1158 $checked_questions = array();
1159 $checked_questionblocks = array();
1160 foreach (
$_POST as $key => $value)
1162 if (preg_match(
"/id_(\d+)/", $key, $matches))
1164 array_push($checked_questions, $matches[1]);
1166 if (preg_match(
"/id_qb_(\d+)/", $key, $matches))
1168 array_push($checked_questionblocks, $matches[1]);
1171 $this->
object->removeQuestions($checked_questions, $checked_questionblocks);
1172 $this->
object->saveCompletionStatus();
1174 $this->ctrl->redirect($this,
"questions");
1186 $this->ctrl->redirect($this,
"questions");
1198 $questionblock = array();
1199 foreach (
$_POST as $key => $value)
1201 if (preg_match(
"/cb_(\d+)/", $key, $matches))
1203 array_push($questionblock, $value);
1206 if (count($questionblock) < 2)
1208 ilUtil::sendInfo($this->lng->txt(
"qpl_define_questionblock_select_missing"),
true);
1209 $this->ctrl->redirect($this,
"questions");
1225 $show_questiontext = (
$_POST[
"show_questiontext"]) ? 1 : 0;
1226 if (
$_POST[
"questionblock_id"])
1228 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1233 $questionblock = array();
1234 foreach (
$_POST as $key => $value)
1236 if (preg_match(
"/cb_(\d+)/", $key, $matches))
1238 array_push($questionblock, $value);
1241 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1245 $this->ctrl->redirect($this,
"questions");
1260 $unfoldblocks = array();
1261 foreach (
$_POST as $key => $value)
1263 if (preg_match(
"/cb_qb_(\d+)/", $key, $matches))
1265 array_push($unfoldblocks, $matches[1]);
1268 if (count($unfoldblocks))
1271 $this->
object->unfoldQuestionblocks($unfoldblocks);
1277 $this->ctrl->redirect($this,
"questions");
1286 $this->ctrl->redirect($this,
"questions");
1294 $move_questions = array();
1295 foreach (
$_POST as $key => $value)
1297 if (preg_match(
"/cb_(\d+)/", $key, $matches))
1299 array_push($move_questions, $matches[1]);
1301 if (preg_match(
"/cb_qb_(\d+)/", $key, $matches))
1303 $ids = $this->
object->getQuestionblockQuestionIds($matches[1]);
1304 foreach ($ids as $qkey => $qid)
1306 array_push($move_questions, $qid);
1310 if (count($move_questions) == 0)
1313 $this->ctrl->redirect($this,
"questions");
1317 $_SESSION[
"move_questions"] = $move_questions;
1318 ilUtil::sendInfo($this->lng->txt(
"select_target_position_for_move_question"));
1329 $move_questions =
$_SESSION[
"move_questions"];
1332 foreach (
$_POST as $key => $value)
1334 if (preg_match(
"/^cb_(\d+)$/", $key, $matches))
1338 $insert_id = $matches[1];
1341 if (preg_match(
"/^cb_qb_(\d+)$/", $key, $matches))
1345 $ids =& $this->
object->getQuestionblockQuestionIds($matches[1]);
1348 if ($insert_mode == 0)
1350 $insert_id = $ids[0];
1352 else if ($insert_mode == 1)
1354 $insert_id = $ids[count($ids)-1];
1360 if ($insert_id <= 0)
1367 $this->
object->moveQuestions($move_questions, $insert_id, $insert_mode);
1370 $this->ctrl->redirect($this,
"questions");
1394 $obligatory = array();
1395 foreach (
$_POST as $key => $value)
1397 if (preg_match(
"/obligatory_(\d+)/", $key, $matches))
1399 $obligatory[$matches[1]] = 1;
1402 $this->
object->setObligatoryStates($obligatory);
1404 $this->ctrl->redirect($this,
"questions");
1415 $hasDatasets = $this->
object->_hasDatasets($this->object->getSurveyId());
1416 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1417 if ((!$rbacsystem->checkAccess(
"read", $this->ref_id)) && (!$rbacsystem->checkAccess(
"write", $this->ref_id)))
1421 $path = $this->tree->getPathFull($this->object->getRefID());
1426 if (
$_GET[
"new_id"] > 0)
1429 $existing = $this->
object->getExistingQuestions();
1430 if (!in_array(
$_GET[
"new_id"], $existing))
1432 $inserted = $this->
object->insertQuestion(
$_GET[
"new_id"]);
1442 ilUtil::redirect(
"ilias.php?baseClass=ilObjSurveyQuestionPoolGUI&ref_id=" . $_GET[
"eqpl"] .
"&cmd=editQuestionForSurvey&calling_survey=".$_GET[
"ref_id"].
"&q_id=" . $_GET[
"eqid"]);
1446 $_SESSION[
"calling_survey"] = $this->
object->getRefId();
1449 if ($_GET[
"editheading"])
1455 if ($_GET[
"up"] > 0)
1457 $this->
object->moveUpQuestion($_GET[
"up"]);
1460 if ($_GET[
"down"] > 0)
1462 $this->
object->moveDownQuestion($_GET[
"down"]);
1465 if ($_GET[
"qbup"] > 0)
1467 $this->
object->moveUpQuestionblock($_GET[
"qbup"]);
1470 if ($_GET[
"qbdown"] > 0)
1472 $this->
object->moveDownQuestionblock($_GET[
"qbdown"]);
1476 if ($_GET[
"removeheading"])
1482 if ($_GET[
"editblock"])
1491 $selected_array = array();
1492 array_push($selected_array, $_GET[
"add"]);
1494 $this->insertQuestionsForm($selected_array);
1498 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_questions.html",
"Modules/Survey");
1499 $survey_questions =& $this->
object->getSurveyQuestions();
1500 $questionpools =& $this->
object->getQuestionpoolTitles();
1501 $colors = array(
"tblrow1",
"tblrow2");
1504 $last_color_class =
"";
1505 $obligatory =
"<img src=\"" .
ilUtil::getImagePath(
"obligatory.gif",
"Modules/Survey") .
"\" alt=\"" . $this->lng->txt(
"question_obligatory") .
"\" title=\"" . $this->lng->txt(
"question_obligatory") .
"\" />";
1506 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
1508 if (count($survey_questions) > 0)
1510 foreach ($survey_questions as $question_id =>
$data)
1513 if (($last_questionblock_id > 0) && (
$data[
"questionblock_id"] == 0))
1517 if (($last_questionblock_id > 0) && (
$data[
"questionblock_id"] > 0) && (
$data[
"questionblock_id"] != $last_questionblock_id))
1521 if ((
$data[
"questionblock_id"] > 0) and (
$data[
"questionblock_id"] != $last_questionblock_id))
1524 $this->tpl->setCurrentBlock(
"separator");
1525 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
1526 $this->tpl->parseCurrentBlock();
1527 $this->tpl->setCurrentBlock(
"QTab");
1528 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
1529 $this->tpl->parseCurrentBlock();
1531 $this->tpl->setCurrentBlock(
"block");
1532 $this->tpl->setVariable(
"TYPE_ICON",
"<img src=\"" .
ilUtil::getImagePath(
"questionblock.gif",
"Modules/Survey") .
"\" alt=\"".$this->lng->txt(
"questionblock_icon").
"\" />");
1533 $this->tpl->setVariable(
"TEXT_QUESTIONBLOCK", $this->lng->txt(
"questionblock") .
": " .
$data[
"questionblock_title"]);
1534 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
1535 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets)
1537 if (
$data[
"question_id"] != $this->object->questions[0])
1539 $this->tpl->setVariable(
"BUTTON_UP",
"<a href=\"" . $this->ctrl->getLinkTarget($this,
"questions") .
"&qbup=" .
$data[
"questionblock_id"] .
"\"><img src=\"" .
ilUtil::getImagePath(
"a_up.gif") .
"\" alt=\"" . $this->lng->txt(
"up") .
"\" title=\"" . $this->lng->txt(
"up") .
"\" border=\"0\" /></a>");
1541 $akeys = array_keys($survey_questions);
1542 if (
$data[
"questionblock_id"] != $survey_questions[$akeys[count($akeys)-1]][
"questionblock_id"])
1544 $this->tpl->setVariable(
"BUTTON_DOWN",
"<a href=\"" . $this->ctrl->getLinkTarget($this,
"questions") .
"&qbdown=" .
$data[
"questionblock_id"] .
"\"><img src=\"" .
ilUtil::getImagePath(
"a_down.gif") .
"\" alt=\"" . $this->lng->txt(
"down") .
"\" title=\"" . $this->lng->txt(
"down") .
"\" border=\"0\" /></a>");
1546 $this->tpl->setVariable(
"TEXT_EDIT", $this->lng->txt(
"edit"));
1547 $this->tpl->setVariable(
"HREF_EDIT", $this->ctrl->getLinkTarget($this,
"questions") .
"&editblock=" .
$data[
"questionblock_id"]);
1549 $this->tpl->parseCurrentBlock();
1550 $this->tpl->setCurrentBlock(
"QTab");
1551 $this->tpl->setVariable(
"QUESTION_ID",
"qb_" .
$data[
"questionblock_id"]);
1552 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
1553 $this->tpl->parseCurrentBlock();
1555 if (($last_questionblock_id > 0) && (
$data[
"questionblock_id"] == 0))
1558 $this->tpl->setCurrentBlock(
"separator");
1559 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
1560 $this->tpl->parseCurrentBlock();
1561 $this->tpl->setCurrentBlock(
"QTab");
1562 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
1563 $this->tpl->parseCurrentBlock();
1565 if (
$data[
"heading"])
1567 $this->tpl->setCurrentBlock(
"heading");
1568 $this->tpl->setVariable(
"TEXT_HEADING",
$data[
"heading"]);
1569 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
1570 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets)
1572 $this->tpl->setVariable(
"TEXT_EDIT", $this->lng->txt(
"edit"));
1573 $this->tpl->setVariable(
"HREF_EDIT", $this->ctrl->getLinkTarget($this,
"questions") .
"&editheading=" .
$data[
"question_id"]);
1574 $this->tpl->setVariable(
"TEXT_DELETE", $this->lng->txt(
"remove"));
1575 $this->tpl->setVariable(
"HREF_DELETE", $this->ctrl->getLinkTarget($this,
"questions") .
"&removeheading=" .
$data[
"question_id"]);
1577 $this->tpl->parseCurrentBlock();
1578 $this->tpl->setCurrentBlock(
"QTab");
1579 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
1580 $this->tpl->parseCurrentBlock();
1582 if (!
$data[
"questionblock_id"])
1584 $this->tpl->setCurrentBlock(
"checkable");
1585 $this->tpl->setVariable(
"QUESTION_ID",
$data[
"question_id"]);
1586 $this->tpl->parseCurrentBlock();
1588 $this->tpl->setCurrentBlock(
"QTab");
1589 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
1590 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets)
1592 $q_id =
$data[
"question_id"];
1594 $this->tpl->setVariable(
"QUESTION_TITLE",
"$title_counter. <a href=\"" . $this->ctrl->getLinkTarget($this,
"questions") .
"&eqid=$q_id&eqpl=$qpl_ref_id" .
"\">" .
$data[
"title"] .
"</a>");
1598 $this->tpl->setVariable(
"QUESTION_TITLE",
"$title_counter. ".
$data[
"title"]);
1600 $this->tpl->setVariable(
"TYPE_ICON",
"<img src=\"" .
ilUtil::getImagePath(
"question.gif",
"Modules/Survey") .
"\" alt=\"".$this->lng->txt(
"question_icon").
"\" />");
1601 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets)
1603 $obligatory_checked =
"";
1604 if (
$data[
"obligatory"] == 1)
1606 $obligatory_checked =
" checked=\"checked\"";
1608 $this->tpl->setVariable(
"QUESTION_OBLIGATORY",
"<input type=\"checkbox\" name=\"obligatory_" .
$data[
"question_id"] .
"\" value=\"1\"$obligatory_checked />");
1612 if (
$data[
"obligatory"] == 1)
1614 $this->tpl->setVariable(
"QUESTION_OBLIGATORY", $obligatory);
1617 $this->tpl->setVariable(
"QUESTION_COMMENT",
$data[
"description"]);
1618 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets)
1620 if (!
$data[
"questionblock_id"])
1623 if (
$data[
"question_id"] != $this->object->questions[0])
1625 $this->tpl->setVariable(
"BUTTON_UP",
"<a href=\"" . $this->ctrl->getLinkTarget($this,
"questions") .
"&up=" .
$data[
"question_id"] .
"\"><img src=\"" .
ilUtil::getImagePath(
"a_up.gif") .
"\" alt=\"".$this->lng->txt(
"up").
"\" border=\"0\" /></a>");
1627 if (
$data[
"question_id"] != $this->object->questions[count($this->object->questions)-1])
1629 $this->tpl->setVariable(
"BUTTON_DOWN",
"<a href=\"" . $this->ctrl->getLinkTarget($this,
"questions") .
"&down=" .
$data[
"question_id"] .
"\"><img src=\"" .
ilUtil::getImagePath(
"a_down.gif") .
"\" alt=\"".$this->lng->txt(
"down").
"\" border=\"0\" /></a>");
1635 if (
$data[
"questionblock_id"] == $last_questionblock_id)
1637 $this->tpl->setVariable(
"BUTTON_UP",
"<a href=\"" . $this->ctrl->getLinkTarget($this,
"questions") .
"&up=" .
$data[
"question_id"] .
"\"><img src=\"" .
ilUtil::getImagePath(
"a_up.gif") .
"\" alt=\"".$this->lng->txt(
"up").
"\" border=\"0\" /></a>");
1639 $tmp_questions = array_keys($survey_questions);
1640 $blockkey = array_search($question_id, $tmp_questions);
1641 if (($blockkey !== FALSE) && ($blockkey < count($tmp_questions)-1))
1643 if (
$data[
"questionblock_id"] == $survey_questions[$tmp_questions[$blockkey+1]][
"questionblock_id"])
1645 $this->tpl->setVariable(
"BUTTON_DOWN",
"<a href=\"" . $this->ctrl->getLinkTarget($this,
"questions") .
"&down=" .
$data[
"question_id"] .
"\"><img src=\"" .
ilUtil::getImagePath(
"a_down.gif") .
"\" alt=\"".$this->lng->txt(
"down").
"\" border=\"0\" /></a>");
1650 foreach ($questiontypes as $trans => $typedata)
1652 if (strcmp($typedata[
"type_tag"],
$data[
"type_tag"]) == 0)
1654 $this->tpl->setVariable(
"QUESTION_TYPE", $trans);
1657 $this->tpl->setVariable(
"QUESTION_AUTHOR",
$data[
"author"]);
1658 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
1659 $last_color_class = $colors[$counter % 2];
1660 if (!
$data[
"questionblock_id"])
1664 $this->tpl->parseCurrentBlock();
1665 $last_questionblock_id =
$data[
"questionblock_id"];
1668 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets)
1670 $this->tpl->setCurrentBlock(
"selectall");
1671 $this->tpl->setVariable(
"SELECT_ALL", $this->lng->txt(
"select_all"));
1672 $this->tpl->setVariable(
"COLOR_CLASS", $last_color_class);
1673 $this->tpl->parseCurrentBlock();
1674 if (array_key_exists(
"move_questions",
$_SESSION))
1676 $this->tpl->setCurrentBlock(
"move_buttons");
1677 $this->tpl->setVariable(
"INSERT_BEFORE", $this->lng->txt(
"insert_before"));
1678 $this->tpl->setVariable(
"INSERT_AFTER", $this->lng->txt(
"insert_after"));
1679 $this->tpl->parseCurrentBlock();
1681 $this->tpl->setCurrentBlock(
"QFooter");
1682 $this->tpl->setVariable(
"ARROW",
"<img src=\"" .
ilUtil::getImagePath(
"arrow_downright.gif") .
"\" alt=\"".$this->lng->txt(
"arrow_downright").
"\">");
1683 $this->tpl->setVariable(
"REMOVE", $this->lng->txt(
"remove_question"));
1684 $this->tpl->setVariable(
"MOVE", $this->lng->txt(
"move"));
1685 $this->tpl->setVariable(
"QUESTIONBLOCK", $this->lng->txt(
"define_questionblock"));
1686 $this->tpl->setVariable(
"UNFOLD", $this->lng->txt(
"unfold"));
1687 $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save_obligatory_state"));
1688 $this->tpl->parseCurrentBlock();
1693 $this->tpl->setCurrentBlock(
"Emptytable");
1694 $this->tpl->setVariable(
"TEXT_EMPTYTABLE", $this->lng->txt(
"no_questions_available"));
1695 $this->tpl->parseCurrentBlock();
1697 if (($last_questionblock_id > 0))
1700 $this->tpl->setCurrentBlock(
"separator");
1701 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
1702 $this->tpl->parseCurrentBlock();
1703 $this->tpl->setCurrentBlock(
"QTab");
1704 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
1705 $this->tpl->parseCurrentBlock();
1708 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets)
1710 $this->tpl->setCurrentBlock(
"QTypes");
1711 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
1713 foreach ($qtypes as $translation =>
$data)
1715 $this->tpl->setVariable(
"QUESTION_TYPE_ID",
$data[
"type_tag"]);
1716 $this->tpl->setVariable(
"QUESTION_TYPE", $translation);
1717 $this->tpl->parseCurrentBlock();
1719 $this->tpl->parseCurrentBlock();
1721 $this->tpl->setCurrentBlock(
"adm_content");
1722 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"questions"));
1723 $this->tpl->setVariable(
"QUESTION_TITLE", $this->lng->txt(
"title"));
1724 $this->tpl->setVariable(
"QUESTION_COMMENT", $this->lng->txt(
"description"));
1725 $this->tpl->setVariable(
"QUESTION_OBLIGATORY", $this->lng->txt(
"obligatory"));
1726 $this->tpl->setVariable(
"QUESTION_SEQUENCE", $this->lng->txt(
"sequence"));
1727 $this->tpl->setVariable(
"QUESTION_TYPE", $this->lng->txt(
"question_type"));
1728 $this->tpl->setVariable(
"QUESTION_AUTHOR", $this->lng->txt(
"author"));
1730 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets)
1732 $this->tpl->setVariable(
"BUTTON_INSERT_QUESTION", $this->lng->txt(
"browse_for_questions"));
1734 $this->tpl->setVariable(
'BROWSE_COMMAND', ($ilUser->getPref(
'svy_insert_type') == 1 || strlen($ilUser->getPref(
'svy_insert_type')) == 0) ?
'browseForQuestions' :
'browseForQuestionblocks');
1735 $this->tpl->setVariable(
"TEXT_CREATE_NEW",
" " . strtolower($this->lng->txt(
"or")) .
" " . $this->lng->txt(
"create_new"));
1736 $this->tpl->setVariable(
"BUTTON_CREATE_QUESTION", $this->lng->txt(
"create"));
1737 $this->tpl->setVariable(
"HEADING", $this->lng->txt(
"add_heading"));
1744 $this->tpl->parseCurrentBlock();
1757 include_once(
"./Modules/Survey/classes/class.ilSurveyEvaluationGUI.php");
1759 $this->ctrl->setCmdClass(get_class($eval_gui));
1760 $this->ctrl->redirect($eval_gui,
"evaluation");
1769 if (is_array(
$_POST[
"user_select"]))
1771 foreach (
$_POST[
"user_select"] as $user_id)
1773 $this->
object->disinviteUser($user_id);
1777 $this->ctrl->redirect($this,
"invite");
1787 if (is_array(
$_POST[
"user"]))
1789 foreach (
$_POST[
"user"] as $user_id)
1791 $this->
object->inviteUser($user_id);
1803 $this->ctrl->redirect($this,
"invite");
1811 $mode =
$_POST[
'invitation'];
1815 $this->
object->setInvitation(0);
1818 $this->
object->setInvitation(1);
1819 $this->
object->setInvitationMode(0);
1822 $this->
object->setInvitation(1);
1823 $this->
object->setInvitationMode(1);
1826 $this->
object->saveToDb();
1828 $this->ctrl->redirect($this,
"invite");
1841 if ((!$rbacsystem->checkAccess(
"visible,invite", $this->ref_id)) && (!$rbacsystem->checkAccess(
"write", $this->ref_id)))
1845 $path = $this->tree->getPathFull($this->object->getRefID());
1846 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1857 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1859 $form->setFormAction($this->ctrl->getFormAction($this));
1860 $form->setTableWidth(
"500");
1861 $form->setId(
"invite");
1865 $header->setTitle($this->lng->txt(
"invitation"));
1866 $form->addItem($header);
1870 $invitation->
setInfo($this->lng->txt(
'invitation_mode_desc'));
1871 $invitation->addOption(
new ilRadioOption($this->lng->txt(
"invitation_off"), 0,
''));
1872 $surveySetting =
new ilSetting(
"survey");
1873 if ($surveySetting->get(
"unlimited_invitation"))
1875 $invitation->addOption(
new ilRadioOption($this->lng->txt(
"unlimited_users"), 1,
''));
1877 $invitation->addOption(
new ilRadioOption($this->lng->txt(
"predefined_users"), 2,
''));
1879 if ($this->object->getInvitation())
1881 $inv = $this->
object->getInvitationMode() + 1;
1883 $invitation->setValue($inv);
1884 $form->addItem($invitation);
1886 $form->addCommandButton(
"saveInvitationStatus", $this->lng->txt(
"save"));
1888 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_invite.html",
"Modules/Survey");
1889 $this->tpl->setVariable(
"INVITATION_TABLE", $form->getHTML());
1891 if ($this->object->getInvitation() && $this->
object->getInvitationMode() == 1)
1894 $ilToolbar->addButton($this->lng->txt(
"svy_search_users"),
1895 $this->ctrl->getLinkTargetByClass(
'ilRepositorySearchGUI',
'start'));
1897 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
1899 $invited_users = $this->
object->getUserData($this->object->getInvitedUsers());
1900 include_once
"./Modules/Survey/classes/tables/class.ilSurveyInvitedUsersTableGUI.php";
1902 $table_gui->setData($invited_users);
1903 $this->tpl->setVariable(
'TBL_INVITED_USERS', $table_gui->getHTML());
1913 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_maintenance.html",
"Modules/Survey");
1914 $this->tpl->setCurrentBlock(
"adm_content");
1915 $this->tpl->setVariable(
"BTN_CONFIRM_DELETE_ALL", $this->lng->txt(
"confirm"));
1916 $this->tpl->setVariable(
"BTN_CANCEL_DELETE_ALL", $this->lng->txt(
"cancel"));
1917 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"deleteAllUserData"));
1918 $this->tpl->parseCurrentBlock();
1926 $this->
object->deleteAllUserData();
1928 $this->ctrl->redirect($this,
"maintenance");
1936 $this->ctrl->redirect($this,
"maintenance");
1944 $this->
object->removeSelectedSurveyResults(
$_POST[
"chbUser"]);
1946 $this->ctrl->redirect($this,
"maintenance");
1955 $this->ctrl->redirect($this,
"maintenance");
1965 if (count(
$_POST[
"chbUser"]) == 0)
1968 $this->ctrl->redirect($this,
"maintenance");
1972 include_once
"./Modules/Survey/classes/tables/class.ilSurveyMaintenanceTableGUI.php";
1974 $total =& $this->
object->getSurveyParticipants();
1976 foreach (
$total as $user_data)
1978 if (in_array($user_data[
'active_id'],
$_POST[
'chbUser']))
1980 $last_access = $this->
object->_getLastAccess($user_data[
"active_id"]);
1981 array_push(
$data, array(
1982 'id' => $user_data[
"active_id"],
1983 'name' => $user_data[
"sortname"],
1984 'login' => $user_data[
"login"],
1985 'last_access' => $last_access
1989 $table_gui->setData(
$data);
1990 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
2000 if (
$_GET[
"fill"] > 0)
2002 for ($i = 0; $i <
$_GET[
"fill"]; $i++) $this->object->fillSurveyForUser();
2004 include_once
"./Modules/Survey/classes/tables/class.ilSurveyMaintenanceTableGUI.php";
2006 $total =& $this->
object->getSurveyParticipants();
2008 foreach (
$total as $user_data)
2010 $last_access = $this->
object->_getLastAccess($user_data[
"active_id"]);
2011 array_push(
$data, array(
2012 'id' => $user_data[
"active_id"],
2013 'name' => $user_data[
"sortname"],
2014 'login' => $user_data[
"login"],
2015 'last_access' => $last_access
2018 $table_gui->setData(
$data);
2019 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
2030 $this->tpl->setCurrentBlock(
"option_qpl");
2031 include_once(
"./Modules/Survey/classes/class.ilObjSurvey.php");
2033 $questionpools =& $svy->getAvailableQuestionpools(TRUE, FALSE, TRUE);
2034 if (count($questionpools) == 0)
2039 foreach ($questionpools as $key => $value)
2041 $this->tpl->setCurrentBlock(
"option_spl");
2042 $this->tpl->setVariable(
"OPTION_VALUE", $key);
2043 $this->tpl->setVariable(
"TXT_OPTION", $value);
2044 $this->tpl->parseCurrentBlock();
2047 $this->tpl->setVariable(
"TXT_SELECT_QUESTIONPOOL", $this->lng->txt(
"select_questionpool"));
2048 $this->tpl->setVariable(
"OPTION_SELECT_QUESTIONPOOL", $this->lng->txt(
"select_questionpool_option"));
2049 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"import"));
2050 $this->tpl->setVariable(
"BTN_NAME",
"upload");
2051 $this->tpl->setVariable(
"TXT_UPLOAD", $this->lng->txt(
"upload"));
2052 $this->tpl->setVariable(
"TXT_IMPORT_TST", $this->lng->txt(
"import_tst"));
2053 $this->tpl->setVariable(
"TXT_SELECT_MODE", $this->lng->txt(
"select_mode"));
2054 $this->tpl->setVariable(
"TXT_SELECT_FILE", $this->lng->txt(
"select_file"));
2072 if (strcmp($_FILES[
"xmldoc"][
"tmp_name"],
"") == 0)
2079 include_once(
"./Modules/Survey/classes/class.ilObjSurvey.php");
2081 $newObj->setType(
$_GET[
"new_type"]);
2082 $newObj->setTitle(
"dummy");
2083 $newObj->setDescription(
"dummy");
2084 $newObj->create(
true);
2085 $newObj->createReference();
2086 $newObj->putInTree(
$_GET[
"ref_id"]);
2087 $newObj->setPermissions(
$_GET[
"ref_id"]);
2088 $newObj->notify(
"new",
$_GET[
"ref_id"],
$_GET[
"parent_non_rbac_id"],
$_GET[
"ref_id"],$newObj->getRefId());
2090 $error = $newObj->importObject($_FILES[
"xmldoc"],
$_POST[
"spl"]);
2094 $this->ilias->raiseError(
$error, $this->ilias->error_obj->MESSAGE);
2099 $ref_id = $newObj->getRefId();
2103 include_once
"./Services/Utilities/classes/class.ilUtil.php";
2116 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"], $new_type))
2118 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
2124 include_once(
"./Modules/Survey/classes/class.ilObjSurvey.php");
2128 $questionpools =& $svy->getAvailableQuestionpools($use_obj_id = TRUE, $could_be_offline = TRUE, $showPath = TRUE);
2129 if (count($questionpools) > 0)
2131 foreach ($questionpools as $key => $value)
2133 $this->tpl->setCurrentBlock(
"option_spl");
2134 $this->tpl->setVariable(
"OPTION_VALUE", $key);
2135 $this->tpl->setVariable(
"TXT_OPTION", $value);
2136 if (
$_POST[
"spl"] == $key)
2138 $this->tpl->setVariable(
"OPTION_SELECTED",
" selected=\"selected\"");
2140 $this->tpl->parseCurrentBlock();
2145 $data[
"fields"] = array();
2146 include_once
"./Services/Utilities/classes/class.ilUtil.php";
2150 foreach (
$data[
"fields"] as $key => $val)
2152 $this->tpl->setVariable(
"TXT_".strtoupper($key), $this->lng->txt($key));
2153 $this->tpl->setVariable(strtoupper($key), $val);
2155 if ($this->prepare_output)
2157 $this->tpl->parseCurrentBlock();
2161 $this->ctrl->setParameter($this,
"new_type", $this->type);
2162 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"create"));
2163 $this->tpl->setVariable(
"TXT_HEADER", $this->lng->txt($new_type.
"_new"));
2164 $this->tpl->setVariable(
"TXT_SELECT_QUESTIONPOOL", $this->lng->txt(
"select_questionpool_short"));
2165 $this->tpl->setVariable(
"OPTION_SELECT_QUESTIONPOOL", $this->lng->txt(
"select_questionpool_option"));
2166 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
2167 $this->tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt($new_type.
"_add"));
2168 $this->tpl->setVariable(
"CMD_SUBMIT",
"save");
2169 $this->tpl->setVariable(
"TARGET",
' target="'.
2171 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
2173 $this->tpl->setVariable(
"TXT_IMPORT_SVY", $this->lng->txt(
"import_svy"));
2174 $this->tpl->setVariable(
"TXT_SVY_FILE", $this->lng->txt(
"svy_upload_file"));
2175 $this->tpl->setVariable(
"TXT_IMPORT", $this->lng->txt(
"import"));
2178 $this->tpl->setVariable(
"ALT_IMG",$this->lng->txt(
"obj_svy"));
2180 $this->tpl->setVariable(
"ALT_IMG2",$this->lng->txt(
"obj_svy"));
2195 if (strcmp($_FILES[
"xmldoc"][
"tmp_name"],
"") == 0)
2201 $this->ctrl->setParameter($this,
"new_type", $this->type);
2207 "&baseClass=ilObjSurveyGUI");
2218 $export_dir = $this->
object->getExportDirectory();
2219 $export_files = $this->
object->getExportFiles($export_dir);
2221 if(count($export_files) > 0)
2223 foreach($export_files as $exp_file)
2225 $file_arr = explode(
"__", $exp_file);
2227 array_push(
$data, array(
2228 'file' => $exp_file,
2229 'size' => filesize($export_dir.
"/".$exp_file),
2235 include_once
"./Modules/Survey/classes/tables/class.ilSurveyExportTableGUI.php";
2237 $table_gui->setData(
$data);
2238 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
2247 include_once(
"./Modules/Survey/classes/class.ilSurveyExport.php");
2249 $survey_exp->buildExportFile();
2250 $this->ctrl->redirect($this,
"export");
2258 if(!isset(
$_POST[
"file"]))
2261 $this->ctrl->redirect($this,
"export");
2264 if (count(
$_POST[
"file"]) > 1)
2267 $this->ctrl->redirect($this,
"export");
2271 $export_dir = $this->
object->getExportDirectory();
2272 include_once
"./Services/Utilities/classes/class.ilUtil.php";
2284 if (!isset(
$_POST[
"file"]))
2287 $this->ctrl->redirect($this,
"export");
2292 $export_dir = $this->
object->getExportDirectory();
2293 $export_files = $this->
object->getExportFiles($export_dir);
2295 if (count(
$_POST[
"file"]) > 0)
2297 foreach (
$_POST[
"file"] as $exp_file)
2299 $file_arr = explode(
"__", $exp_file);
2301 array_push(
$data, array(
2302 'file' => $exp_file,
2303 'size' => filesize($export_dir.
"/".$exp_file),
2309 include_once
"./Modules/Survey/classes/tables/class.ilSurveyExportTableGUI.php";
2311 $table_gui->setData(
$data);
2312 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
2322 $this->ctrl->redirect($this,
"export");
2331 $export_dir = $this->
object->getExportDirectory();
2334 $exp_file = $export_dir.
"/".
$file;
2335 $exp_dir = $export_dir.
"/".substr($file, 0, strlen($file) - 4);
2336 if (@is_file($exp_file))
2340 if (@is_dir($exp_dir))
2342 include_once
"./Services/Utilities/classes/class.ilUtil.php";
2347 $this->ctrl->redirect($this,
"export");
2355 if (strcmp(
$_POST[
"lang"],
"-1") != 0)
2358 $ilUser->writePref(
"survey_code_language",
$_POST[
"lang"]);
2361 $this->ctrl->redirect($this,
'codes');
2371 global $ilUser, $ilToolbar;
2372 if ($this->object->getAnonymize() != 1)
2377 $default_lang = $ilUser->getPref(
"survey_code_language");
2380 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
2381 $languages = $this->lng->getInstalledLanguages();
2383 foreach ($languages as
$lang)
2385 $options[
$lang] = $this->lng->txt(
"lang_$lang");
2387 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
2390 $si->setValue($default_lang);
2391 $ilToolbar->addInputItem($si,
true);
2392 $ilToolbar->addFormButton($this->lng->txt(
"set"),
"setCodeLanguage");
2394 include_once
"./Modules/Survey/classes/tables/class.ilSurveyCodesTableGUI.php";
2396 $survey_codes =& $this->
object->getSurveyCodesTableData($default_lang);
2397 $table_gui->setData($survey_codes);
2398 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_codes.html",
true);
2399 $this->tpl->setCurrentBlock(
"adm_content");
2400 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"codes"));
2401 $this->tpl->setVariable(
"TEXT_CREATE", $this->lng->txt(
"create"));
2402 $this->tpl->setVariable(
"TEXT_SURVEY_CODES", $this->lng->txt(
"new_survey_codes"));
2403 $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());
2411 if (is_array(
$_POST[
"chb_code"]) && (count(
$_POST[
"chb_code"]) > 0))
2413 foreach (
$_POST[
"chb_code"] as $survey_code)
2415 $this->
object->deleteSurveyCode($survey_code);
2423 $this->ctrl->redirect($this,
'codes');
2431 if (is_array(
$_POST[
"chb_code"]) && (count(
$_POST[
"chb_code"]) > 0))
2433 $export = $this->
object->getSurveyCodesForExport(
$_POST[
"chb_code"]);
2439 $this->ctrl->redirect($this,
'codes');
2448 $export = $this->
object->getSurveyCodesForExport(array());
2457 if (preg_match(
"/\d+/",
$_POST[
"nrOfCodes"]))
2459 $this->
object->createSurveyCodes(
$_POST[
"nrOfCodes"]);
2466 $this->ctrl->redirect($this,
'codes');
2479 $savefields = (strcmp($this->ctrl->getCmd(),
"saveMailTableFields") == 0) ? TRUE : FALSE;
2481 include_once
"./Modules/Survey/classes/tables/class.ilSurveyCodesMailTableGUI.php";
2482 $data = $this->
object->getExternalCodeRecipients();
2484 $table_gui->setData(
$data);
2485 $table_gui->setTitle($this->lng->txt(
'externalRecipients'));
2486 $table_gui->completeColumns();
2487 $tabledata = $table_gui->getHTML();
2491 $this->tpl->setVariable(
'ADM_CONTENT', $tabledata);
2501 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
2503 $form_gui->setValuesByPost();
2506 if ($form_gui->getSavedMessages()->getValue() > 0)
2509 $settings = $this->
object->getUserSettings($ilUser->getId(),
'savemessage');
2510 $form_gui->getMailMessage()->setValue($settings[$form_gui->getSavedMessages()->getValue()][
'value']);
2521 $ilLog->write(
'Error: ' + $e->getMessage());
2523 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
2531 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
2533 $form_gui->setValuesByPost();
2536 if ($form_gui->getSavedMessages()->getValue() > 0)
2538 $this->
object->deleteUserSettings($form_gui->getSavedMessages()->getValue());
2540 $form_gui->setValuesByPost();
2551 $ilLog->write(
'Error: ' + $e->getMessage());
2553 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
2561 $mailData[
'm_subject'] = (array_key_exists(
'm_subject',
$_POST)) ?
$_POST[
'm_subject'] : sprintf($this->lng->txt(
'default_codes_mail_subject'), $this->
object->getTitle());
2562 $mailData[
'm_message'] = (array_key_exists(
'm_message',
$_POST)) ?
$_POST[
'm_message'] : $this->lng->txt(
'default_codes_mail_message');
2563 $mailData[
'm_notsent'] = (array_key_exists(
'm_notsent',
$_POST)) ?
$_POST[
'm_notsent'] :
'1';
2565 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
2567 $form_gui->setValuesByArray($mailData);
2568 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
2576 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
2578 if ($form_gui->checkInput())
2580 $code_exists = strpos(
$_POST[
'm_message'],
'[code]') !== FALSE;
2584 $form_gui->setValuesByPost();
2588 if (
$_POST[
'savemessage'] == 1)
2591 $title = (strlen(
$_POST[
'savemessagetitle'])) ?
$_POST[
'savemessagetitle'] : ilStr::substr(
$_POST[
'm_message'], 0, 40) .
'...';
2592 $this->
object->saveUserSettings($ilUser->getId(),
'savemessage',
$title,
$_POST[
'm_message']);
2594 $this->
object->sendCodes(
$_POST[
'm_notsent'],
$_POST[
'm_subject'],
$_POST[
'm_message']);
2596 $this->ctrl->redirect($this,
'codesMail');
2601 $form_gui->setValuesByPost();
2603 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
2608 $this->ctrl->redirect($this,
'codesMail');
2613 if (!is_array(
$_POST[
'chb_ext']) || count(is_array(
$_POST[
'chb_ext'])) == 0)
2616 $this->ctrl->redirect($this,
'codesMail');
2618 foreach (
$_POST[
'chb_ext'] as $code)
2620 $this->
object->deleteSurveyCode($code);
2623 $this->ctrl->redirect($this,
'codesMail');
2632 $existingdata = $this->
object->getExternalCodeRecipients();
2633 if (count($existingdata))
2635 $first = array_shift($existingdata);
2636 foreach ($first as $key => $value)
2638 if (strcmp($key,
'code') != 0 && strcmp($key,
'sent') != 0)
2646 $this->
object->createSurveyCodesForExternalData(array(
$data));
2649 $this->ctrl->redirect($this,
'codesMail');
2658 $data = preg_split(
"/[\n\r]/",
$_POST[
'externaltext']);
2659 $fields = preg_split(
"/;/", array_shift(
$data));
2660 if (!in_array(
'email', $fields))
2664 $this->ctrl->redirect($this,
'importExternalMailRecipients');
2666 $existingdata = $this->
object->getExternalCodeRecipients();
2667 $existingcolumns = array();
2668 if (count($existingdata))
2670 $first = array_shift($existingdata);
2671 foreach ($first as $key => $value)
2673 array_push($existingcolumns, $key);
2676 $founddata = array();
2677 foreach (
$data as $datarow)
2679 $row = preg_split(
"/;/", $datarow);
2680 if (count(
$row) == count($fields))
2683 foreach ($fields as $idx => $fieldname)
2685 if (count($existingcolumns))
2687 if (array_key_exists($idx, $existingcolumns))
2689 $dataset[$fieldname] =
$row[$idx];
2694 $dataset[$fieldname] =
$row[$idx];
2697 if (strlen($dataset[
'email']))
2699 array_push($founddata, $dataset);
2703 $this->
object->createSurveyCodesForExternalData($founddata);
2705 $this->ctrl->redirect($this,
'codesMail');
2714 include_once
"./Services/Utilities/classes/class.ilCSVReader.php";
2716 $reader->open($_FILES[
'externalmails'][
'tmp_name']);
2718 $fields = array_shift(
$data);
2719 if (!in_array(
'email', $fields))
2723 $this->ctrl->redirect($this,
'codesMail');
2725 $existingdata = $this->
object->getExternalCodeRecipients();
2726 $existingcolumns = array();
2727 if (count($existingdata))
2729 $first = array_shift($existingdata);
2730 foreach ($first as $key => $value)
2732 array_push($existingcolumns, $key);
2735 $founddata = array();
2738 if (count($row) == count($fields))
2741 foreach ($fields as $idx => $fieldname)
2743 if (count($existingcolumns))
2745 if (array_key_exists($idx, $existingcolumns))
2747 $dataset[$fieldname] = $row[$idx];
2752 $dataset[$fieldname] = $row[$idx];
2755 if (strlen($dataset[
'email']))
2757 array_push($founddata, $dataset);
2762 $this->
object->createSurveyCodesForExternalData($founddata);
2764 $this->ctrl->redirect($this,
'codesMail');
2776 strcmp($this->ctrl->getCmd(),
"importExternalRecipientsFromFile") == 0 ||
2777 strcmp($this->ctrl->getCmd(),
"importExternalRecipientsFromText") == 0 ||
2778 strcmp($this->ctrl->getCmd(),
"importExternalRecipientsFromDataset") == 0
2781 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
2783 $form_import_file->setFormAction($this->ctrl->getFormAction($this));
2784 $form_import_file->setTableWidth(
"100%");
2785 $form_import_file->setId(
"codes_import_file");
2788 $headerfile->setTitle($this->lng->txt(
"import_from_file"));
2789 $form_import_file->addItem($headerfile);
2791 $externalmails =
new ilFileInputGUI($this->lng->txt(
"externalmails"),
"externalmails");
2792 $externalmails->
setInfo($this->lng->txt(
'externalmails_info'));
2793 $externalmails->setRequired(
true);
2794 $form_import_file->addItem($externalmails);
2795 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_file->addCommandButton(
"importExternalRecipientsFromFile", $this->lng->txt(
"import"));
2796 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_file->addCommandButton(
"codesMail", $this->lng->txt(
"cancel"));
2801 $form_import_text->setFormAction($this->ctrl->getFormAction($this));
2802 $form_import_text->setTableWidth(
"100%");
2803 $form_import_text->setId(
"codes_import_text");
2806 $headertext->setTitle($this->lng->txt(
"import_from_text"));
2807 $form_import_text->addItem($headertext);
2810 if (array_key_exists(
'externaltext',
$_SESSION) && strlen(
$_SESSION[
'externaltext']))
2816 $inp->setValue($this->lng->txt(
'mail_import_example1') .
"\n" . $this->lng->txt(
'mail_import_example2') .
"\n" . $this->lng->txt(
'mail_import_example3') .
"\n");
2818 $inp->setRequired(
true);
2821 $inp->setInfo($this->lng->txt(
'externaltext_info'));
2822 $form_import_text->addItem($inp);
2825 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_text->addCommandButton(
"importExternalRecipientsFromText", $this->lng->txt(
"import"));
2826 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_text->addCommandButton(
"codesMail", $this->lng->txt(
"cancel"));
2831 $form_import_dataset->setFormAction($this->ctrl->getFormAction($this));
2832 $form_import_dataset->setTableWidth(
"100%");
2833 $form_import_dataset->setId(
"codes_import_dataset");
2836 $headerfile->setTitle($this->lng->txt(
"import_from_dataset"));
2837 $form_import_dataset->addItem($headerfile);
2839 $existingdata = $this->
object->getExternalCodeRecipients();
2840 $existingcolumns = array(
'email');
2841 if (count($existingdata))
2843 $first = array_shift($existingdata);
2844 foreach ($first as $key => $value)
2846 if (strcmp($key,
'email') != 0 && strcmp($key,
'code') != 0 && strcmp($key,
'sent') != 0)
2848 array_push($existingcolumns, $key);
2853 foreach ($existingcolumns as $column)
2857 if (strcmp($column,
'email') == 0)
2859 $inp->setRequired(
true);
2863 $inp->setRequired(
false);
2865 $form_import_dataset->addItem($inp);
2867 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_dataset->addCommandButton(
"importExternalRecipientsFromDataset", $this->lng->txt(
"import"));
2868 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_dataset->addCommandButton(
"codesMail", $this->lng->txt(
"cancel"));
2877 $errors = !$form_import_file->checkInput();
2878 $form_import_file->setValuesByPost();
2879 if (
$errors) $checkonly =
false;
2882 $errors = !$form_import_text->checkInput();
2883 $form_import_text->setValuesByPost();
2884 if (
$errors) $checkonly =
false;
2887 $errors = !$form_import_dataset->checkInput();
2888 $form_import_dataset->setValuesByPost();
2889 if (
$errors) $checkonly =
false;
2896 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_external_mail.html",
"Modules/Survey");
2897 $this->tpl->setVariable(
"HEADLINE", $this->lng->txt(
"external_mails_import"));
2898 $this->tpl->setVariable(
"FORM1", $form_import_file->getHTML());
2899 $this->tpl->setVariable(
"FORM2", $form_import_text->getHTML());
2900 $this->tpl->setVariable(
"FORM3", $form_import_dataset->getHTML());
2910 if (strlen(
$_POST[
"v"]) == 0)
2915 $survey_questions =& $this->
object->getSurveyQuestions();
2916 $structure =&
$_SESSION[
"constraintstructure"];
2917 $include_elements =
$_SESSION[
"includeElements"];
2918 foreach ($include_elements as $elementCounter)
2920 if (is_array($structure[$elementCounter]))
2922 if (strlen(
$_GET[
"precondition"]))
2929 foreach ($structure[$elementCounter] as $key => $question_id)
2931 $this->
object->addConstraintToQuestion($question_id, $constraint_id);
2934 if (count($structure[$elementCounter]) > 1)
2936 $this->
object->updateConjunctionForQuestions($structure[$elementCounter],
$_POST[
'c']);
2941 unset(
$_SESSION[
"constraintstructure"]);
2942 $this->ctrl->redirect($this,
"constraints");
2950 $survey_questions =& $this->
object->getSurveyQuestions();
2951 $structure =&
$_SESSION[
"constraintstructure"];
2952 $start =
$_GET[
"start"];
2953 $option_questions = array();
2954 for ($i = 1; $i < $start; $i++)
2956 if (is_array($structure[$i]))
2958 foreach ($structure[$i] as $key => $question_id)
2960 if ($survey_questions[$question_id][
"usableForPrecondition"])
2962 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"]));
2967 if (count($option_questions) == 0)
2970 unset(
$_SESSION[
"constraintstructure"]);
2971 ilUtil::sendInfo($this->lng->txt(
"constraints_no_nonessay_available"),
true);
2972 $this->ctrl->redirect($this,
"constraints");
2982 $survey_questions =& $this->
object->getSurveyQuestions();
2983 $option_questions = array();
2984 array_push($option_questions, array(
"question_id" =>
$_POST[
"q"],
"title" => $survey_questions[
$_POST[
"q"]][
"title"],
"type_tag" => $survey_questions[$_POST[
"q"]][
"type_tag"]));
2985 $this->
constraintForm(2, $_POST, $survey_questions, $option_questions);
2993 $survey_questions =& $this->
object->getSurveyQuestions();
2994 $option_questions = array();
2995 if (strlen(
$_GET[
"precondition"]))
2997 $pc = $this->
object->getPrecondition(
$_GET[
"precondition"]);
2998 $postvalues = array(
2999 "c" => $pc[
"conjunction"],
3000 "q" => $pc[
"question_fi"],
3001 "r" => $pc[
"relation_id"],
3004 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"]));
3005 $this->
constraintForm(3, $postvalues, $survey_questions, $option_questions);
3009 array_push($option_questions, array(
"question_id" =>
$_POST[
"q"],
"title" => $survey_questions[
$_POST[
"q"]][
"title"],
"type_tag" => $survey_questions[$_POST[
"q"]][
"type_tag"]));
3010 $this->
constraintForm(3, $_POST, $survey_questions, $option_questions);
3014 public function constraintForm($step, $postvalues, &$survey_questions, $questions = FALSE)
3016 if (strlen(
$_GET[
"start"])) $this->ctrl->setParameter($this,
"start",
$_GET[
"start"]);
3017 $this->ctrl->saveParameter($this,
"precondition");
3018 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
3020 $form->setFormAction($this->ctrl->getFormAction($this));
3021 $form->setTableWidth(
"100%");
3022 $form->setId(
"constraintsForm");
3025 if ($survey_questions[
$_SESSION[
"constraintstructure"][
$_GET[
"start"]][0]][
"questionblock_id"] > 0)
3027 $title = $this->lng->txt(
"questionblock") .
": " . $survey_questions[
$_SESSION[
"constraintstructure"][
$_GET[
"start"]][0]][
"questionblock_title"];
3031 $title = $this->lng->txt($survey_questions[
$_SESSION[
"constraintstructure"][
$_GET[
"start"]][0]][
"type_tag"]) .
": " . $survey_questions[
$_SESSION[
"constraintstructure"][$_GET[
"start"]][0]][
"title"];
3034 $header->setTitle(
$title);
3035 $form->addItem($header);
3039 $fulfilled->addOption(
new ilRadioOption($this->lng->txt(
"conjunction_or"),
'1',
''));
3040 $fulfilled->setValue((strlen($postvalues[
'c'])) ? $postvalues[
'c'] : 0);
3041 $form->addItem($fulfilled);
3043 $step1 =
new ilSelectInputGUI($this->lng->txt(
"step") .
" 1: " . $this->lng->txt(
"select_prior_question"),
"q");
3045 if (is_array($questions))
3047 foreach ($questions as $question)
3052 $step1->setOptions($options);
3053 $step1->setValue($postvalues[
"q"]);
3054 $form->addItem($step1);
3058 $relations = $this->
object->getAllRelations();
3059 $step2 =
new ilSelectInputGUI($this->lng->txt(
"step") .
" 2: " . $this->lng->txt(
"select_relation"),
"r");
3061 foreach ($relations as $rel_id => $relation)
3063 if (in_array($relation[
"short"], $survey_questions[$postvalues[
"q"]][
"availableRelations"]))
3065 $options[$rel_id] = $relation[
'short'];
3069 $step2->setValue($postvalues[
"r"]);
3070 $form->addItem($step2);
3075 $variables =& $this->
object->getVariables($postvalues[
"q"]);
3076 $question_type = $survey_questions[$postvalues[
"q"]][
"type_tag"];
3077 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
3079 $question =
new $question_type();
3080 $question->loadFromDb($postvalues[
"q"]);
3082 $step3 = $question->getPreconditionSelectValue($postvalues[
"v"], $this->lng->txt(
"step") .
" 3: " . $this->lng->txt(
"select_value"),
"v");
3083 $form->addItem($step3);
3089 $cmd_continue =
"constraintStep2";
3090 $cmd_back =
"constraints";
3093 $cmd_continue =
"constraintStep3";
3094 $cmd_back =
"constraintStep1";
3097 $cmd_continue =
"constraintsAdd";
3098 $cmd_back =
"constraintStep2";
3101 $form->addCommandButton($cmd_back, $this->lng->txt(
"back"));
3102 $form->addCommandButton($cmd_continue, $this->lng->txt(
"continue"));
3104 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
3112 $survey_questions =& $this->
object->getSurveyQuestions();
3113 $structure =&
$_SESSION[
"constraintstructure"];
3114 foreach (
$_POST as $key => $value)
3116 if (preg_match(
"/^constraint_(\d+)_(\d+)/", $key, $matches))
3118 $this->
object->deleteConstraint($matches[2]);
3122 $this->ctrl->redirect($this,
"constraints");
3127 $include_elements =
$_POST[
"includeElements"];
3128 if ((!is_array($include_elements)) || (count($include_elements) == 0))
3130 ilUtil::sendInfo($this->lng->txt(
"constraints_no_questions_or_questionblocks_selected"),
true);
3131 $this->ctrl->redirect($this,
"constraints");
3133 else if (count($include_elements) >= 1)
3135 $_SESSION[
"includeElements"] = $include_elements;
3136 sort($include_elements, SORT_NUMERIC);
3137 $_GET[
"start"] = $include_elements[0];
3145 $this->ctrl->setParameter($this,
"precondition",
$_GET[
"precondition"]);
3146 $this->ctrl->setParameter($this,
"start",
$_GET[
"start"]);
3147 $this->ctrl->redirect($this,
"constraintStep3");
3159 $hasDatasets = $this->
object->_hasDatasets($this->object->getSurveyId());
3161 if (array_key_exists(
"step",
$_GET)) $step =
$_GET[
"step"];
3176 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_constraints_list.html",
"Modules/Survey");
3177 $survey_questions =& $this->
object->getSurveyQuestions();
3178 $last_questionblock_title =
"";
3180 $hasPreconditions = FALSE;
3181 $structure = array();
3182 $colors = array(
"tblrow1",
"tblrow2");
3183 foreach ($survey_questions as $question_id =>
$data)
3187 if (
$data[
"questionblock_id"] > 0)
3190 $type = $this->lng->txt(
"questionblock");
3191 if (strcmp(
$title, $last_questionblock_title) != 0)
3193 $last_questionblock_title =
$title;
3194 $structure[$counter] = array();
3195 array_push($structure[$counter],
$data[
"question_id"]);
3199 array_push($structure[$counter-1],
$data[
"question_id"]);
3205 $structure[$counter] = array(
$data[
"question_id"]);
3206 $type = $this->lng->txt(
"question");
3212 $this->tpl->setCurrentBlock(
"description");
3213 $this->tpl->setVariable(
"DESCRIPTION", $this->lng->txt(
"constraints_first_question_description"));
3214 $this->tpl->parseCurrentBlock();
3218 $constraints =& $this->
object->getConstraints(
$data[
"question_id"]);
3220 if (count($constraints))
3222 $hasPreconditions = TRUE;
3223 foreach ($constraints as $constraint)
3225 $this->tpl->setCurrentBlock(
"constraint");
3226 $this->tpl->setVariable(
"SEQUENCE_ID", $counter);
3227 $this->tpl->setVariable(
"CONSTRAINT_ID", $constraint[
"id"]);
3228 $this->tpl->setVariable(
"CONSTRAINT_TEXT", $survey_questions[$constraint[
"question"]][
"title"] .
" " . $constraint[
"short"] .
" " . $constraint[
"valueoutput"]);
3229 $this->tpl->setVariable(
"TEXT_EDIT_PRECONDITION", $this->lng->txt(
"edit"));
3230 $this->ctrl->setParameter($this,
"precondition", $constraint[
"id"]);
3231 $this->ctrl->setParameter($this,
"start", $counter);
3232 $this->tpl->setVariable(
"EDIT_PRECONDITION", $this->ctrl->getLinkTarget($this,
"editPrecondition"));
3233 $this->ctrl->setParameter($this,
"precondition",
"");
3234 $this->ctrl->setParameter($this,
"start",
"");
3235 $this->tpl->parseCurrentBlock();
3237 if (count($constraints) > 1)
3239 $this->tpl->setCurrentBlock(
"conjunction");
3240 $this->tpl->setVariable(
"TEXT_CONJUNCTION", ($constraints[0][
'conjunction']) ? $this->lng->txt(
'conjunction_or_title') : $this->lng->txt(
'conjunction_and_title'));
3241 $this->tpl->parseCurrentBlock();
3247 $this->tpl->setCurrentBlock(
"include_elements");
3248 $this->tpl->setVariable(
"QUESTION_NR",
"$counter");
3249 $this->tpl->parseCurrentBlock();
3251 $this->tpl->setCurrentBlock(
"constraint_section");
3252 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
3253 $this->tpl->setVariable(
"QUESTION_NR",
"$counter");
3254 $this->tpl->setVariable(
"TITLE",
"$title");
3255 $icontype =
"question.gif";
3256 if (
$data[
"questionblock_id"] > 0)
3258 $icontype =
"questionblock.gif";
3260 $this->tpl->setVariable(
"TYPE",
"$type: ");
3261 include_once
"./Services/Utilities/classes/class.ilUtil.php";
3263 $this->tpl->setVariable(
"ICON_ALT",
$type);
3264 $this->tpl->parseCurrentBlock();
3268 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets)
3270 if ($hasPreconditions)
3272 $this->tpl->setCurrentBlock(
"selectall_preconditions");
3273 $this->tpl->setVariable(
"SELECT_ALL_PRECONDITIONS", $this->lng->txt(
"select_all"));
3274 $this->tpl->parseCurrentBlock();
3276 $this->tpl->setCurrentBlock(
"selectall");
3278 $this->tpl->setVariable(
"SELECT_ALL", $this->lng->txt(
"select_all"));
3279 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
3280 $this->tpl->parseCurrentBlock();
3282 if ($hasPreconditions)
3284 $this->tpl->setCurrentBlock(
"delete_button");
3285 $this->tpl->setVariable(
"BTN_DELETE", $this->lng->txt(
"delete"));
3286 include_once
"./Services/Utilities/classes/class.ilUtil.php";
3287 $this->tpl->setVariable(
"ARROW",
"<img src=\"" .
ilUtil::getImagePath(
"arrow_downright.gif") .
"\" alt=\"".$this->lng->txt(
"arrow_downright").
"\">");
3288 $this->tpl->parseCurrentBlock();
3291 $this->tpl->setCurrentBlock(
"buttons");
3292 $this->tpl->setVariable(
"ARROW",
"<img src=\"" .
ilUtil::getImagePath(
"arrow_downright.gif") .
"\" alt=\"".$this->lng->txt(
"arrow_downright").
"\">");
3293 $this->tpl->setVariable(
"BTN_CREATE_CONSTRAINTS", $this->lng->txt(
"constraint_add"));
3294 $this->tpl->parseCurrentBlock();
3296 $this->tpl->setCurrentBlock(
"adm_content");
3297 $this->tpl->setVariable(
"CONSTRAINTS_INTRODUCTION", $this->lng->txt(
"constraints_introduction"));
3298 $this->tpl->setVariable(
"DEFINED_PRECONDITIONS", $this->lng->txt(
"existing_constraints"));
3299 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"constraints"));
3300 $this->tpl->setVariable(
"CONSTRAINTS_HEADER", $this->lng->txt(
"constraints_list_of_entities"));
3301 $this->tpl->parseCurrentBlock();
3302 $_SESSION[
"constraintstructure"] = $structure;
3316 $this->ctrl->setCmd(
"showSummary");
3317 $this->ctrl->setCmdClass(
"ilinfoscreengui");
3324 $tpl =
new ilTemplate(
"tpl.il_svy_svy_main.html", TRUE, TRUE,
"Modules/Survey");
3327 $tpl->setVariable(
"LOCATION_STYLESHEET",$location_stylesheet);
3328 $tpl->setVariable(
"LOCATION_JAVASCRIPT",dirname($location_stylesheet));
3339 if (!$ilAccess->checkAccess(
"visible",
"", $this->ref_id))
3341 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
3344 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
3346 include_once
"./Modules/Survey/classes/class.ilSurveyExecutionGUI.php";
3348 $info->setFormAction($this->ctrl->getFormAction($output_gui,
"infoScreen"));
3349 $info->enablePrivateNotes();
3350 $anonymize_key = NULL;
3351 if ($this->object->getAnonymize() == 1)
3353 if (
$_SESSION[
"anonymous_id"][$this->object->getId()])
3355 $anonymize_key =
$_SESSION[
"anonymous_id"][$this->
object->getId()];
3357 else if (
$_POST[
"anonymous_id"])
3359 $anonymize_key =
$_POST[
"anonymous_id"];
3362 $canStart = $this->
object->canStartSurvey($anonymize_key);
3363 $showButtons = $canStart[
"result"];
3364 if (!$showButtons)
ilUtil::sendInfo(implode(
"<br />", $canStart[
"messages"]));
3369 if (!$this->object->getAnonymize())
3371 $survey_started = $this->
object->isSurveyStarted($ilUser->getId(),
"");
3373 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
3379 if ($survey_started === 1)
3383 elseif ($survey_started === 0)
3385 $info->addFormButton(
"resume", $this->lng->txt(
"resume_survey"));
3387 elseif ($survey_started === FALSE)
3389 $info->addFormButton(
"start", $this->lng->txt(
"start_survey"));
3394 else if ($this->object->getAnonymize() && !$this->
object->isAccessibleWithoutCode())
3396 if ((
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID) && (strlen(
$_POST[
"anonymous_id"]) == 0) && (strlen(
$_SESSION[
"anonymous_id"][$this->object->getId()]) == 0))
3398 $info->setFormAction($this->ctrl->getFormAction($this,
"infoScreen"));
3399 $info->addSection($this->lng->txt(
"anonymization"));
3400 $info->addProperty(
"", $this->lng->txt(
"anonymize_anonymous_introduction"));
3401 $info->addPropertyTextinput($this->lng->txt(
"enter_anonymous_id"),
"anonymous_id",
"", 8,
"infoScreen", $this->lng->txt(
"submit"));
3405 if (strlen(
$_POST[
"anonymous_id"]) > 0)
3407 if (!$this->object->checkSurveyCode(
$_POST[
"anonymous_id"]))
3413 $anonymize_key =
$_POST[
"anonymous_id"];
3416 else if (strlen(
$_SESSION[
"anonymous_id"][$this->object->getId()]) > 0)
3418 if (!$this->object->checkSurveyCode(
$_SESSION[
"anonymous_id"][$this->object->getId()]))
3424 $anonymize_key =
$_SESSION[
"anonymous_id"][$this->
object->getId()];
3430 $anonymize_key = $this->
object->getUserAccessCode($ilUser->getId());
3431 if (!strlen($anonymize_key))
3433 $anonymize_key = $this->
object->createNewAccessCode();
3434 $this->
object->saveUserAccessCode($ilUser->getId(), $anonymize_key);
3437 $info->addHiddenElement(
"anonymous_id", $anonymize_key);
3438 $survey_started = $this->
object->isSurveyStarted($ilUser->getId(), $anonymize_key);
3439 if ($survey_started === 1)
3443 elseif ($survey_started === 0)
3445 $info->addFormButton(
"resume", $this->lng->txt(
"resume_survey"));
3447 elseif ($survey_started === FALSE)
3449 $info->addFormButton(
"start", $this->lng->txt(
"start_survey"));
3456 $survey_started = $this->
object->isSurveyStarted($ilUser->getId(),
"");
3457 if ($survey_started === 1)
3461 elseif ($survey_started === 0)
3463 $info->addFormButton(
"resume", $this->lng->txt(
"resume_survey"));
3465 elseif ($survey_started === FALSE)
3467 $info->addFormButton(
"start", $this->lng->txt(
"start_survey"));
3472 if (strlen($this->object->getIntroduction()))
3474 $introduction = $this->
object->getIntroduction();
3475 $info->addSection($this->lng->txt(
"introduction"));
3476 $info->addProperty(
"", $this->object->prepareTextareaOutput($introduction));
3479 $info->addSection($this->lng->txt(
"svy_general_properties"));
3480 if (strlen($this->object->getAuthor()))
3482 $info->addProperty($this->lng->txt(
"author"), $this->
object->getAuthor());
3484 $info->addProperty($this->lng->txt(
"title"), $this->
object->getTitle());
3485 switch ($this->object->getAnonymize())
3488 $info->addProperty($this->lng->txt(
"anonymization"), $this->lng->txt(
"anonymize_personalized"));
3491 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
3493 $info->addProperty($this->lng->txt(
"anonymization"), $this->lng->txt(
"info_anonymize_with_code"));
3497 $info->addProperty($this->lng->txt(
"anonymization"), $this->lng->txt(
"info_anonymize_registered_user"));
3501 $info->addProperty($this->lng->txt(
"anonymization"), $this->lng->txt(
"info_anonymize_without_code"));
3504 include_once
"./Modules/Survey/classes/class.ilObjSurveyAccess.php";
3507 $info->addProperty($this->lng->txt(
"evaluation_access"), $this->lng->txt(
"evaluation_access_info"));
3509 $info->addMetaDataSections($this->object->getId(),0, $this->
object->getType());
3510 $this->ctrl->forwardCommand($info);
3523 $template =
new ilTemplate(
"tpl.il_svy_svy_printview.html", TRUE, TRUE,
"Modules/Survey");
3525 include_once
'./Services/PDF/classes/class.ilHTMLToPDFTransformer.php';
3528 $this->ctrl->setParameter($this,
"pdf",
"1");
3529 $template->setCurrentBlock(
"pdf_export");
3530 $template->setVariable(
"PDF_URL", $this->ctrl->getLinkTarget($this,
"printView"));
3531 $this->ctrl->setParameter($this,
"pdf",
"");
3532 $template->setVariable(
"PDF_TEXT", $this->lng->txt(
"pdf_export"));
3533 $template->setVariable(
"PDF_IMG_ALT", $this->lng->txt(
"pdf_export"));
3535 $template->parseCurrentBlock();
3537 $template->setVariable(
"PRINT_TEXT", $this->lng->txt(
"print"));
3538 $template->setVariable(
"PRINT_URL",
"javascript:window.print();");
3540 $pages =& $this->
object->getSurveyPages();
3541 foreach ($pages as $page)
3543 if (count($page) > 0)
3545 foreach ($page as $question)
3547 $questionGUI = $this->
object->getQuestionGUI($question[
"type_tag"], $question[
"question_id"]);
3548 if (is_object($questionGUI))
3550 if (strlen($question[
"heading"]))
3552 $template->setCurrentBlock(
"textblock");
3553 $template->setVariable(
"TEXTBLOCK", $question[
"heading"]);
3554 $template->parseCurrentBlock();
3556 $template->setCurrentBlock(
"question");
3557 $template->setVariable(
"QUESTION_DATA", $questionGUI->getPrintView($this->object->getShowQuestionTitles(), $question[
"questionblock_show_questiontext"], $this->
object->getSurveyId()));
3558 $template->parseCurrentBlock();
3561 if (count($page) > 1)
3563 $template->setCurrentBlock(
"page");
3564 $template->setVariable(
"BLOCKTITLE", $page[0][
"questionblock_title"]);
3565 $template->parseCurrentBlock();
3569 $template->setCurrentBlock(
"page");
3570 $template->parseCurrentBlock();
3574 $this->tpl->addCss(
"./Modules/Survey/templates/default/survey_print.css",
"print");
3575 if (array_key_exists(
"pdf",
$_GET) && (
$_GET[
"pdf"] == 1))
3577 $printbody =
new ilTemplate(
"tpl.il_as_tst_print_body.html", TRUE, TRUE,
"Modules/Test");
3578 $printbody->setVariable(
"TITLE", sprintf($this->lng->txt(
"tst_result_user_name"), $uname));
3579 $printbody->setVariable(
"ADM_CONTENT", $template->get());
3580 $printoutput = $printbody->get();
3581 $printoutput = preg_replace(
"/href=\".*?\"/",
"", $printoutput);
3584 include_once
"./Services/PDF/classes/class.ilHTMLtoPDF.php";
3585 $transformer = null;
3586 switch ($pdfSetting->get(
'html_to_pdf_method'))
3589 include_once
"./Services/PDF/classes/class.ilHTMLtoPDFTransformerUsingFOP.php";
3591 $transformer->xsl =
"./Modules/Survey/xml/question2fo.xsl";
3594 include_once
"./Services/PDF/classes/class.ilHTMLtoPDFTransformerUsingWebkit.php";
3595 $transformer =
new ilHTMLtoPDFTransformerUsingWebkit(
ilUtil::getASCIIFilename($this->object->getTitle()) .
".pdf");
3598 if (is_object($transformer))
3600 $generator =
new ilHTMLtoPDF($transformer);
3601 $generator->deliverPDFFromHTMLString($printoutput);
3606 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
3613 switch ($this->ctrl->getCmd())
3619 case "redirectQuestion":
3620 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
"infoScreen"),
"",
$_GET[
"ref_id"]);
3623 case "checkEvaluationAccess":
3624 case "evaluationdetails":
3625 case "evaluationuser":
3626 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluation"),
"",
$_GET[
"ref_id"]);
3635 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
"infoScreen"),
"",
$_GET[
"ref_id"]);
3638 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"",
$_GET[
"ref_id"]);
3652 $questions = ($a_cmd ==
'questions') ?
true :
false;
3653 $printview = ($a_cmd ==
'printview') ?
true :
false;
3655 $this->tabs_gui->addSubTabTarget(
"survey_question_editor", $this->ctrl->getLinkTarget($this,
"questions"),
3656 "",
"",
"", $questions);
3657 $this->tabs_gui->addSubTabTarget(
"print_view", $this->ctrl->getLinkTarget($this,
"printView"),
3658 "",
"",
"", $printview);
3671 $ilTabs->addSubTabTarget
3674 $this->ctrl->getLinkTarget($this,
'codes'),
3675 array(
"codes",
"createSurveyCodes",
"setCodeLanguage",
"deleteCodes",
"exportCodes"),
3679 $ilTabs->addSubTabTarget
3681 "participating_users",
3682 $this->ctrl->getLinkTarget($this,
"codesMail"),
3683 array(
"codesMail",
"saveMailTableFields",
"importExternalMailRecipients",
3684 'importExternalRecipientsFromFile',
'importExternalRecipientsFromText',
3685 'importExternalRecipientsFromDataset'),
3689 $data = $this->
object->getExternalCodeRecipients();
3692 $ilTabs->addSubTabTarget
3694 "mail_survey_codes",
3695 $this->ctrl->getLinkTarget($this,
"mailCodes"),
3696 array(
"mailCodes",
"sendCodesMail",
"insertSavedMessage",
"deleteSavedMessage"),
3715 $ilTabs->addSubTabTarget(
3716 "svy_eval_cumulated",
3717 $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluation"),
3718 array(
"evaluation",
"checkEvaluationAccess"),
3722 $ilTabs->addSubTabTarget(
3724 $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluationdetails"),
3725 array(
"evaluationdetails"),
3729 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
3731 $ilTabs->addSubTabTarget(
3733 $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluationuser"),
3734 array(
"evaluationuser"),
3739 if ($rbacreview->isAssigned($ilUser->getId(),2)) {
3740 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
3742 $ilTabs->addSubTabTarget(
3743 "svy_eval_participants_state",
3744 $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluationparticipantsstate"),
3745 array(
"evaluationparticipantsstate"),
3758 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
3760 $ilTabs->setBackTarget($this->lng->txt(
"menubacktosurvey"), $this->ctrl->getLinkTarget($this,
"questions"));
3761 $ilTabs->addTarget(
"browse_for_questions",
3762 $this->ctrl->getLinkTarget($this,
"browseForQuestions"),
3763 array(
"browseForQuestions",
"browseForQuestionblocks"),
3776 global $ilAccess, $ilUser;
3778 if (strcmp($this->ctrl->getNextClass(),
'ilrepositorysearchgui') != 0)
3780 switch ($this->ctrl->getCmd())
3782 case "browseForQuestions":
3783 case "browseForQuestionblocks":
3784 case "insertQuestions":
3785 case "filterQuestions":
3786 case "resetFilterQuestions":
3787 case "changeDatatype":
3793 case "redirectQuestion":
3797 case "checkEvaluationAccess":
3798 case "evaluationdetails":
3799 case "evaluationuser":
3800 case "evaluationparticipantsstate":
3807 case "redirectQuestion":
3811 case "checkEvaluationAccess":
3812 case "evaluationdetails":
3813 case "evaluationuser":
3820 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
3822 $force_active = (
$_GET[
"up"] !=
"" ||
$_GET[
"down"] !=
"")
3826 $tabs_gui->addTarget(
"survey_questions",
3827 $this->ctrl->getLinkTarget($this,
'questions'),
3828 array(
"questions",
"browseForQuestions",
"createQuestion",
3829 "filterQuestions",
"resetFilterQuestions",
"changeDatatype",
"insertQuestions",
3830 "removeQuestions",
"cancelRemoveQuestions",
"confirmRemoveQuestions",
3831 "defineQuestionblock",
"saveDefineQuestionblock",
"cancelDefineQuestionblock",
3832 "unfoldQuestionblock",
"moveQuestions",
3833 "insertQuestionsBefore",
"insertQuestionsAfter",
"saveObligatory",
3834 "addHeading",
"saveHeading",
"cancelHeading",
"editHeading",
3835 "confirmRemoveHeading",
"cancelRemoveHeading",
"printView"),
3836 "",
"", $force_active);
3839 if ($ilAccess->checkAccess(
"visible",
"", $this->ref_id))
3841 $tabs_gui->addTarget(
"info_short",
3842 $this->ctrl->getLinkTarget($this,
'infoScreen'),
3843 array(
"infoScreen",
"showSummary"));
3847 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
3849 $force_active = ($this->ctrl->getCmd() ==
"")
3852 $tabs_gui->addTarget(
"settings",
3853 $this->ctrl->getLinkTarget($this,
'properties'),
3854 array(
"properties",
"save",
"cancel",
'saveProperties'),
"",
3859 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
3862 $tabs_gui->addTarget(
"constraints",
3863 $this->ctrl->getLinkTarget($this,
"constraints"),
3864 array(
"constraints",
"constraintStep1",
"constraintStep2",
3865 "constraintStep3",
"constraintsAdd",
"createConstraints",
3866 "editPrecondition"),
3870 if (($ilAccess->checkAccess(
"write",
"", $this->ref_id)) || ($ilAccess->checkAccess(
"invite",
"", $this->ref_id)))
3873 $tabs_gui->addTarget(
"invitation",
3874 $this->ctrl->getLinkTarget($this,
'invite'),
3875 array(
"invite",
"saveInvitationStatus",
3876 "inviteUserGroup",
"disinviteUserGroup"),
3880 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
3883 $tabs_gui->addTarget(
"maintenance",
3884 $this->ctrl->getLinkTarget($this,
'maintenance'),
3885 array(
"maintenance",
"deleteAllUserData"),
3888 if ($this->object->getAnonymize() == 1)
3891 $tabs_gui->addTarget(
"codes",
3892 $this->ctrl->getLinkTarget($this,
'codes'),
3893 array(
"codes",
"exportCodes",
'codesMail',
'saveMailTableFields',
'importExternalMailRecipients',
3894 'mailCodes',
'sendCodesMail',
'importExternalRecipientsFromFile',
'importExternalRecipientsFromText',
3895 'importExternalRecipientsFromDataset',
'insertSavedMessage',
'deleteSavedMessage'),
3900 include_once
"./Modules/Survey/classes/class.ilObjSurveyAccess.php";
3904 $tabs_gui->addTarget(
"svy_evaluation",
3905 $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluation"),
3906 array(
"evaluation",
"checkEvaluationAccess",
"evaluationdetails",
3907 "evaluationuser",
"evaluationparticipantsstate"),
3911 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
3914 $tabs_gui->addTarget(
"meta_data",
3915 $this->ctrl->getLinkTargetByClass(
'ilmdeditorgui',
'listSection'),
3916 "",
"ilmdeditorgui");
3919 $tabs_gui->addTarget(
"export",
3920 $this->ctrl->getLinkTarget($this,
'export'),
3921 array(
"export",
"createExportFile",
"confirmDeleteExportFile",
3922 "downloadExportFile"),
3927 if ($ilAccess->checkAccess(
"edit_permission",
"", $this->ref_id))
3930 $tabs_gui->addTarget(
"perm_settings",
3931 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
3940 function _goto($a_target, $a_access_code =
"")
3943 if ($ilAccess->checkAccess(
"read",
"", $a_target))
3945 include_once
"./Services/Utilities/classes/class.ilUtil.php";
3946 if (strlen($a_access_code))
3949 $_GET[
"baseClass"] =
"ilObjSurveyGUI";
3950 $_GET[
"cmd"] =
"infoScreen";
3951 $_GET[
"ref_id"] = $a_target;
3952 include(
"ilias.php");
3957 $_GET[
"baseClass"] =
"ilObjSurveyGUI";
3958 $_GET[
"cmd"] =
"infoScreen";
3959 $_GET[
"ref_id"] = $a_target;
3960 include(
"ilias.php");
3964 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
3966 $_GET[
"cmd"] =
"frameset";
3967 $_GET[
"target"] =
"";
3968 $_GET[
"ref_id"] = ROOT_FOLDER_ID;
3971 include(
"repository.php");
3975 $ilErr->raiseError($lng->txt(
"msg_no_perm_read_lm"), $ilErr->FATAL);