41 include_once 
"./classes/class.ilObjectGUI.php";
 
   42 include_once 
"./Modules/Survey/classes/inc.SurveyConstants.php";
 
   55                 $lng->loadLanguageModule(
"survey");
 
   57                 $this->ctrl->saveParameter($this, 
"ref_id");
 
   64                 include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
   65                 $path = $this->tree->getPathFull($this->object->getRefID());
 
   74                 global $ilAccess, $ilNavigationHistory,
$ilCtrl;
 
   76                 if ((!$ilAccess->checkAccess(
"read", 
"", 
$_GET[
"ref_id"])) && (!$ilAccess->checkAccess(
"visible", 
"", 
$_GET[
"ref_id"])))
 
   79                         $ilias->raiseError($this->lng->txt(
"permission_denied"), $ilias->error_obj->MESSAGE);
 
   83                         $ilAccess->checkAccess(
"read", 
"", 
$_GET[
"ref_id"]))
 
   85                         $ilNavigationHistory->addItem(
$_GET[
"ref_id"],
 
   86                                 "ilias.php?baseClass=ilObjSurveyGUI&cmd=infoScreen&ref_id=".
$_GET[
"ref_id"], 
"svy");
 
   89                 $cmd = $this->ctrl->getCmd(
"properties");
 
   92                 if (
$cmd == 
"saveTags")
 
   94                         $ilCtrl->setCmdClass(
"ilinfoscreengui");
 
   97                 $next_class = $this->ctrl->getNextClass($this);
 
   98                 $this->ctrl->setReturn($this, 
"properties");
 
  104                         case "ilinfoscreengui":
 
  107                         case 'ilmdeditorgui':
 
  108                                 include_once 
'Services/MetaData/classes/class.ilMDEditorGUI.php';
 
  109                                 $md_gui =& 
new ilMDEditorGUI($this->object->getId(), 0, $this->
object->getType());
 
  110                                 $md_gui->
addObserver($this->
object,
'MDUpdateListener',
'General');
 
  112                                 $this->ctrl->forwardCommand($md_gui);
 
  115                         case "ilsurveyevaluationgui":
 
  116                                 include_once(
"./Modules/Survey/classes/class.ilSurveyEvaluationGUI.php");
 
  118                                 $ret =& $this->ctrl->forwardCommand($eval_gui);
 
  121                         case 'ilrepositorysearchgui':
 
  122                                 include_once(
'./Services/Search/classes/class.ilRepositorySearchGUI.php');
 
  124                                 $rep_search->setCallback($this,
 
  125                                         'inviteUserGroupObject',
 
  131                                 $this->ctrl->setReturn($this, 
'invite');
 
  132                                 $ret =& $this->ctrl->forwardCommand($rep_search);
 
  133                                 $this->tabs_gui->setTabActive(
'invitation');
 
  136                         case "ilsurveyexecutiongui":
 
  137                                 include_once(
"./Modules/Survey/classes/class.ilSurveyExecutionGUI.php");
 
  139                                 $ret =& $this->ctrl->forwardCommand($exec_gui);
 
  142                         case 'ilpermissiongui':
 
  143                                 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
 
  145                                 $ret =& $this->ctrl->forwardCommand($perm_gui);
 
  148                         case 'ilobjectcopygui':
 
  149                                 include_once 
'./Services/Object/classes/class.ilObjectCopyGUI.php';
 
  152                                 $this->ctrl->forwardCommand($cp);
 
  162                 if (strtolower(
$_GET[
"baseClass"]) != 
"iladministrationgui" &&
 
  177                 if (!strlen(
$_POST[
'Fobject'][
'title']))
 
  180                         $this->ctrl->setParameter($this, 
'new_type', 
$_GET[
'new_type']);
 
  181                         $this->ctrl->redirect($this, 
'create');
 
  188                 ilUtil::redirect(
"ilias.php?baseClass=ilObjSurveyGUI&ref_id=".$newObj->getRefId().
"&cmd=properties");
 
  210                 $this->ctrl->redirect($this, 
"properties");
 
  223                 if (!$ilAccess->checkAccess(
"write", 
"", $this->ref_id)) 
 
  227                         $this->ctrl->redirect($this, 
"infoScreen");
 
  244                         $this->
object->setEvaluationAccess(
$_POST[
"evaluation_access"]);
 
  245                         $this->
object->setStartDateEnabled(
$_POST[
"enabled_start_date"]);
 
  246                         if ($this->object->getStartDateEnabled())
 
  248                                 $this->
object->setStartDateAndTime(
$_POST[
"start_date"][
'date'], 
$_POST[
"start_date"][
'time']);
 
  252                                 $this->
object->setStartDate(null);
 
  254                         $this->
object->setEndDateEnabled(
$_POST[
"enabled_end_date"]);
 
  255                         if ($this->object->getEndDateEnabled())
 
  257                                 $this->
object->setEndDateAndTime(
$_POST[
"end_date"][
'date'], 
$_POST[
"end_date"][
'time']);
 
  261                                 $this->
object->setEndDate(null);
 
  264                         include_once 
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
 
  265                         $introduction = 
$_POST[
"introduction"];
 
  266                         $this->
object->setIntroduction($introduction);
 
  268                         $this->
object->setOutro($outro);
 
  270                         $hasDatasets = $this->
object->_hasDatasets($this->object->getSurveyId());
 
  273                                 $anonymize = 
$_POST[
"anonymization"];
 
  278                                 $this->
object->setAnonymize($anonymize);
 
  280                         $this->
object->setShowQuestionTitles(
$_POST[
"show_question_titles"]);
 
  281                         $this->
object->setMailNotification(
$_POST[
'mailnotification']);
 
  282                         $this->
object->setMailAddresses(
$_POST[
'mailaddresses']);
 
  283                         $this->
object->setMailParticipantData(
$_POST[
'mailparticipantdata']);
 
  284                         $this->
object->saveToDb();
 
  293                         $this->ctrl->redirect($this, 
"properties");
 
  306                 $save = (strcmp($this->ctrl->getCmd(), 
"saveProperties") == 0) ? TRUE : FALSE;
 
  308                 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
  310                 $form->setFormAction($this->ctrl->getFormAction($this));
 
  311                 $form->setTableWidth(
"100%");
 
  312                 $form->setId(
"survey_properties");
 
  316                 $header->setTitle($this->lng->txt(
"properties"));
 
  317                 $form->addItem($header);
 
  322                 $online->setChecked($this->object->isOnline());
 
  323                 $form->addItem($online);
 
  327                 $intro->
setValue($this->object->prepareTextareaOutput($this->object->getIntroduction()));
 
  330                 $intro->setUseRte(TRUE);
 
  331                 include_once 
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
 
  333                 $intro->addPlugin(
"latex");
 
  334                 $intro->addButton(
"latex");
 
  335                 $intro->addPlugin(
"pastelatex");
 
  336                 $intro->setRTESupport($this->object->getId(), 
"svy", 
"survey");
 
  337                 $form->addItem($intro);
 
  340                 $enablestartingtime = 
new ilCheckboxInputGUI($this->lng->txt(
"start_date"), 
"enabled_start_date");
 
  342                 $enablestartingtime->setOptionTitle($this->lng->txt(
"enabled"));
 
  343                 $enablestartingtime->setChecked($this->object->getStartDateEnabled());
 
  346                 $startingtime->setShowDate(
true);
 
  347                 $startingtime->setShowTime(
true);
 
  348                 if ($this->object->getStartDateEnabled())
 
  356                 $enablestartingtime->addSubItem($startingtime);
 
  357                 $form->addItem($enablestartingtime);
 
  360                 $enableendingtime = 
new ilCheckboxInputGUI($this->lng->txt(
"end_date"), 
"enabled_end_date");
 
  362                 $enableendingtime->setOptionTitle($this->lng->txt(
"enabled"));
 
  363                 $enableendingtime->setChecked($this->object->getEndDateEnabled());
 
  366                 $endingtime->setShowDate(
true);
 
  367                 $endingtime->setShowTime(
true);
 
  368                 if ($this->object->getEndDateEnabled())
 
  376                 $enableendingtime->addSubItem($endingtime);
 
  377                 $form->addItem($enableendingtime);
 
  380                 $anonymization = 
new ilCheckboxInputGUI($this->lng->txt(
"anonymization"), 
"anonymization");
 
  381                 $hasDatasets = $this->
object->_hasDatasets($this->object->getSurveyId());
 
  386                 $anonymization->setOptionTitle($this->lng->txt(
"on"));
 
  387                 $anonymization->setValue(1);
 
  388                 $anonymization->setChecked($this->object->getAnonymize());
 
  389                 $anonymization->setInfo($this->lng->txt(
"anonymize_survey_description"));
 
  394                         $anonymization_options->setDisabled(
true);
 
  396                 $anonymization_options->addOption(
new ilCheckboxOption($this->lng->txt(
"anonymize_without_code"), 
'anonymize_without_code', 
''));
 
  397                 $anonymization_options->addOption(
new ilCheckboxOption($this->lng->txt(
"anonymize_with_code"), 
'anonymize_with_code', 
''));
 
  398                 $anonymization_options->setValue(($this->object->isAccessibleWithoutCode()) ? 
'anonymize_without_code' : 
'anonymize_with_code');
 
  400                 $anonymization->addSubItem($anonymization_options);
 
  401                 $form->addItem($anonymization);
 
  405                 $show_question_titles->setOptionTitle($this->lng->txt(
"svy_show_questiontitles"));
 
  406                 $show_question_titles->setValue(1);
 
  407                 $show_question_titles->setChecked($this->object->getShowQuestionTitles());
 
  408                 $form->addItem($show_question_titles);
 
  412                 $finalstatement->
setValue($this->object->prepareTextareaOutput($this->object->getOutro()));
 
  413                 $finalstatement->setRows(10);
 
  414                 $finalstatement->setCols(80);
 
  415                 $finalstatement->setUseRte(TRUE);
 
  417                 $finalstatement->addPlugin(
"latex");
 
  418                 $finalstatement->addButton(
"latex");
 
  419                 $finalstatement->addPlugin(
"pastelatex");
 
  420                 $finalstatement->setRTESupport($this->object->getId(), 
"svy", 
"survey");
 
  421                 $form->addItem($finalstatement);
 
  425                 $results->setTitle($this->lng->txt(
"results"));
 
  429                 $evaluation_access = 
new ilRadioGroupInputGUI($this->lng->txt(
'evaluation_access'), 
"evaluation_access");
 
  430                 $evaluation_access->
setInfo($this->lng->txt(
'evaluation_access_description'));
 
  434                 $evaluation_access->setValue($this->object->getEvaluationAccess());
 
  435                 $form->addItem($evaluation_access);
 
  438                 $mailnotification = 
new ilCheckboxInputGUI($this->lng->txt(
"mailnotification"), 
"mailnotification");
 
  440                 $mailnotification->setValue(1);
 
  441                 $mailnotification->setChecked($this->object->getMailNotification());
 
  444                 $mailaddresses = 
new ilTextInputGUI($this->lng->txt(
"mailaddresses"), 
"mailaddresses");
 
  445                 $mailaddresses->
setValue($this->object->getMailAddresses());
 
  446                 $mailaddresses->setSize(80);
 
  447                 $mailaddresses->setInfo($this->lng->txt(
'mailaddresses_info'));
 
  448                 $mailaddresses->setRequired(
true);
 
  449                 if (($save) && !
$_POST[
'mailnotification'])
 
  451                         $mailaddresses->setRequired(
false);
 
  455                 $participantdata = 
new ilTextAreaInputGUI($this->lng->txt(
"mailparticipantdata"), 
"mailparticipantdata");
 
  456                 $participantdata->
setValue($this->object->getMailParticipantData());
 
  457                 $participantdata->setRows(6);
 
  458                 $participantdata->setCols(80);
 
  459                 $participantdata->setUseRte(
false);
 
  460                 $participantdata->setInfo($this->lng->txt(
'mailparticipantdata_info'));
 
  462                 $mailnotification->addSubItem($mailaddresses);
 
  463                 $mailnotification->addSubItem($participantdata);
 
  464                 $form->addItem($mailnotification);
 
  466                 if ($ilAccess->checkAccess(
"write", 
"", 
$_GET[
"ref_id"])) $form->addCommandButton(
"saveProperties", $this->lng->txt(
"save"));
 
  471                         $errors = !$form->checkInput();
 
  472                         $form->setValuesByPost();
 
  475                                 if (($online->getChecked()) && (count($this->object->questions) == 0))
 
  477                                         $online->setAlert($this->lng->txt(
"cannot_switch_to_online_no_questions"));
 
  482                         if (
$errors) $checkonly = 
false;
 
  484                 $mailaddresses->setRequired(
true);
 
  485                 if (!$checkonly) $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
 
  498                 $checked_questions = array();
 
  499                 $checked_questionblocks = array();
 
  500                 foreach (
$_POST as $key => $value) 
 
  502                         if (preg_match(
"/cb_(\d+)/", $key, $matches)) 
 
  504                                 array_push($checked_questions, $matches[1]);
 
  506                         if (preg_match(
"/cb_qb_(\d+)/", $key, $matches))
 
  508                                 array_push($checked_questionblocks, $matches[1]);
 
  511                 if (count($checked_questions) + count($checked_questionblocks) > 0) 
 
  519                         ilUtil::sendInfo($this->lng->txt(
"no_question_selected_for_removal"), 
true);
 
  520                         $this->ctrl->redirect($this, 
"questions");
 
  529                 $inserted_objects = 0;
 
  530                 if (is_array(
$_POST[
'q_id']))
 
  532                         foreach (
$_POST[
'q_id'] as $question_id)
 
  534                                 $this->
object->insertQuestion($question_id);
 
  538                 if ($inserted_objects)
 
  540                         $this->
object->saveCompletionStatus();
 
  542                         $this->ctrl->redirect($this, 
"questions");
 
  547                         $this->ctrl->redirect($this, 
'browseForQuestions');
 
  556                 $inserted_objects = 0;
 
  557                 if (is_array(
$_POST[
'cb']))
 
  559                         foreach (
$_POST[
'cb'] as $questionblock_id)
 
  561                                 $this->
object->insertQuestionblock($questionblock_id);
 
  565                 if ($inserted_objects)
 
  567                         $this->
object->saveCompletionStatus();
 
  568                         ilUtil::sendSuccess(($inserted_objects == 1) ? $this->lng->txt(
"questionblock_inserted") : $this->lng->txt(
"questionblocks_inserted"), 
true);
 
  569                         $this->ctrl->redirect($this, 
"questions");
 
  574                         $this->ctrl->redirect($this, 
'browseForQuestionblocks');
 
  584                 $ilUser->writePref(
'svy_insert_type', 
$_POST[
'datatype']);
 
  585                 switch (
$_POST[
"datatype"])
 
  588                                 $this->ctrl->redirect($this, 
'browseForQuestionblocks');
 
  592                                 $this->ctrl->redirect($this, 
'browseForQuestions');
 
  602                 include_once 
"./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
 
  604                 $table_gui->writeFilterToSession();
 
  605                 $this->ctrl->redirect($this, 
'browseForQuestionblocks');
 
  613                 include_once 
"./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
 
  615                 $table_gui->resetFilter();
 
  616                 $this->ctrl->redirect($this, 
'browseForQuestionblocks');
 
  628                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_svy_questionbrowser.html", 
"Modules/Survey");
 
  629                 include_once 
"./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
 
  631                 $table_gui->
setEditable($rbacsystem->checkAccess(
'write', 
$_GET[
'ref_id']));
 
  632                 $arrFilter = array();
 
  633                 foreach ($table_gui->getFilterItems() as $item)
 
  635                         if ($item->getValue() !== 
false)
 
  637                                 $arrFilter[$item->getPostVar()] = $item->getValue();
 
  640                 $data = $this->
object->getQuestionblocksTable($arrFilter);
 
  641                 $table_gui->setData(
$data);
 
  642                 $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());        
 
  644                 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this, 
'changeDatatype'));
 
  645                 $this->tpl->setVariable(
"OPTION_QUESTIONS", $this->lng->txt(
"questions"));
 
  646                 $this->tpl->setVariable(
"OPTION_QUESTIONBLOCKS", $this->lng->txt(
"questionblocks"));
 
  647                 $this->tpl->setVariable(
"SELECTED_QUESTIONBLOCKS", 
" selected=\"selected\"");
 
  648                 $this->tpl->setVariable(
"TEXT_DATATYPE", $this->lng->txt(
"display_all_available"));
 
  649                 $this->tpl->setVariable(
"BTN_CHANGE", $this->lng->txt(
"change"));
 
  657                 include_once 
"./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
 
  659                 $table_gui->writeFilterToSession();
 
  660                 $this->ctrl->redirect($this, 
'browseForQuestions');
 
  668                 include_once 
"./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
 
  670                 $table_gui->resetFilter();
 
  671                 $this->ctrl->redirect($this, 
'browseForQuestions');
 
  683                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_svy_questionbrowser.html", 
"Modules/Survey");
 
  684                 include_once 
"./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
 
  686                 $table_gui->
setEditable($rbacsystem->checkAccess(
'write', 
$_GET[
'ref_id']));
 
  687                 $arrFilter = array();
 
  688                 foreach ($table_gui->getFilterItems() as $item)
 
  690                         if ($item->getValue() !== 
false)
 
  692                                 $arrFilter[$item->getPostVar()] = $item->getValue();
 
  695                 $data = $this->
object->getQuestionsTable($arrFilter);
 
  696                 $table_gui->setData(
$data);
 
  697                 $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());        
 
  699                 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this, 
'changeDatatype'));
 
  700                 $this->tpl->setVariable(
"OPTION_QUESTIONS", $this->lng->txt(
"questions"));
 
  701                 $this->tpl->setVariable(
"OPTION_QUESTIONBLOCKS", $this->lng->txt(
"questionblocks"));
 
  702                 $this->tpl->setVariable(
"SELECTED_QUESTIONS", 
" selected=\"selected\"");
 
  703                 $this->tpl->setVariable(
"TEXT_DATATYPE", $this->lng->txt(
"display_all_available"));
 
  704                 $this->tpl->setVariable(
"BTN_CHANGE", $this->lng->txt(
"change"));
 
  717                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_svy_remove_questions.html", 
"Modules/Survey");
 
  718                 $colors = array(
"tblrow1", 
"tblrow2");
 
  720                 $surveyquestions =& $this->
object->getSurveyQuestions();
 
  721                 include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
 
  722                 foreach ($surveyquestions as $question_id => 
$data)
 
  724                         if (in_array(
$data[
"question_id"], $checked_questions) or (in_array(
$data[
"questionblock_id"], $checked_questionblocks)))
 
  726                                 $this->tpl->setCurrentBlock(
"row");
 
  727                                 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
 
  728                                 $this->tpl->setVariable(
"TEXT_TITLE", 
$data[
"title"]);
 
  729                                 $this->tpl->setVariable(
"TEXT_DESCRIPTION", 
$data[
"description"]);
 
  731                                 $this->tpl->setVariable(
"TEXT_QUESTIONBLOCK", 
$data[
"questionblock_title"]);
 
  732                                 $this->tpl->parseCurrentBlock();
 
  736                 foreach ($checked_questions as $id)
 
  738                         $this->tpl->setCurrentBlock(
"hidden");
 
  739                         $this->tpl->setVariable(
"HIDDEN_NAME", 
"id_$id");
 
  740                         $this->tpl->setVariable(
"HIDDEN_VALUE", 
"$id");
 
  741                         $this->tpl->parseCurrentBlock();
 
  743                 foreach ($checked_questionblocks as $id)
 
  745                         $this->tpl->setCurrentBlock(
"hidden");
 
  746                         $this->tpl->setVariable(
"HIDDEN_NAME", 
"id_qb_$id");
 
  747                         $this->tpl->setVariable(
"HIDDEN_VALUE", 
"$id");
 
  748                         $this->tpl->parseCurrentBlock();
 
  750                 $this->tpl->setCurrentBlock(
"adm_content");
 
  751                 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"title"));
 
  752                 $this->tpl->setVariable(
"TEXT_DESCRIPTION", $this->lng->txt(
"description"));
 
  753                 $this->tpl->setVariable(
"TEXT_TYPE", $this->lng->txt(
"question_type"));
 
  754                 $this->tpl->setVariable(
"TEXT_QUESTIONBLOCK", $this->lng->txt(
"questionblock"));
 
  755                 $this->tpl->setVariable(
"BTN_CONFIRM", $this->lng->txt(
"confirm"));
 
  756                 $this->tpl->setVariable(
"BTN_CANCEL", $this->lng->txt(
"cancel"));
 
  757                 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this, 
"confirmRemoveQuestions"));
 
  758                 $this->tpl->parseCurrentBlock();
 
  772                 if ($questionblock_id)
 
  774                         $questionblock = $this->
object->getQuestionblock($questionblock_id);
 
  776                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_define_questionblock.html", 
"Modules/Survey");
 
  777                 foreach (
$_POST as $key => $value)
 
  779                         if (preg_match(
"/cb_(\d+)/", $key, $matches))
 
  781                                 $this->tpl->setCurrentBlock(
"hidden");
 
  782                                 $this->tpl->setVariable(
"HIDDEN_NAME", 
"cb_$matches[1]");
 
  783                                 $this->tpl->setVariable(
"HIDDEN_VALUE", $matches[1]);
 
  784                                 $this->tpl->parseCurrentBlock();
 
  787                 if ($questionblock_id)
 
  789                         $this->tpl->setCurrentBlock(
"hidden");
 
  790                         $this->tpl->setVariable(
"HIDDEN_NAME", 
"questionblock_id");
 
  791                         $this->tpl->setVariable(
"HIDDEN_VALUE", $questionblock_id);
 
  792                         $this->tpl->parseCurrentBlock();
 
  794                 $this->tpl->setCurrentBlock(
"adm_content");
 
  795                 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"title"));
 
  796                 if ($questionblock_id)
 
  798                         $this->tpl->setVariable(
"VALUE_TITLE", $questionblock[
"title"]);
 
  800                 $this->tpl->setVariable(
"TXT_QUESTIONTEXT_DESCRIPTION", $this->lng->txt(
"show_questiontext_description"));
 
  801                 $this->tpl->setVariable(
"TXT_QUESTIONTEXT", $this->lng->txt(
"show_questiontext"));
 
  802                 if (($questionblock[
"show_questiontext"]) || (strlen($questionblock_id) == 0))
 
  804                         $this->tpl->setVariable(
"CHECKED_QUESTIONTEXT", 
" checked=\"checked\"");
 
  806                 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
 
  807                 $this->tpl->setVariable(
"HEADING_QUESTIONBLOCK", $this->lng->txt(
"define_questionblock"));
 
  808                 $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save"));
 
  809                 $this->tpl->setVariable(
"CANCEL", $this->lng->txt(
"cancel"));
 
  810                 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this, 
"saveDefineQuestionblock"));
 
  811                 $this->tpl->parseCurrentBlock();
 
  823                 $tpl = 
new ilTemplate(
"tpl.il_svy_svy_qpl_select.html", TRUE, TRUE, 
"Modules/Survey");
 
  824                 $questionpools =& $this->
object->getAvailableQuestionpools(FALSE, TRUE, TRUE, 
"write");
 
  825                 if (count($questionpools))
 
  827                         foreach ($questionpools as $key => $value)
 
  829                                 $tpl->setCurrentBlock(
"option");
 
  830                                 $tpl->setVariable(
"VALUE_OPTION", $key);
 
  831                                 $tpl->setVariable(
"TEXT_OPTION", $value);
 
  832                                 $tpl->parseCurrentBlock();
 
  834                         $tpl->setCurrentBlock(
"selection");
 
  835                         $tpl->setVariable(
"TXT_QPL_SELECT", $this->lng->txt(
"select_questionpool"));
 
  836                         $tpl->parseCurrentBlock();
 
  840                         $tpl->setCurrentBlock(
"selection");
 
  841                         $tpl->setVariable(
"TXT_QPL_ENTER", $this->lng->txt(
"cat_create_spl"));
 
  842                         $tpl->parseCurrentBlock();
 
  844                 $tpl->setVariable(
"BTN_SUBMIT", $this->lng->txt(
"submit"));
 
  845                 $sel_question_types = (strlen(
$_POST[
"sel_question_types"])) ? 
$_POST[
"sel_question_types"] : 
$_GET[
"sel_question_types"];
 
  846                 $this->ctrl->setParameter($this, 
"sel_question_types", $sel_question_types);
 
  847                 $tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this, 
"executeCreateQuestion"));
 
  848                 $tpl->setVariable(
"BTN_CANCEL", $this->lng->txt(
"cancel"));
 
  849                 $this->tpl->setVariable(
"ADM_CONTENT", 
$tpl->get());
 
  859                 $this->ctrl->redirect($this, 
"questions");
 
  869                 if (strlen(
$_POST[
"sel_spl"]))
 
  871                         include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  872                         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"]);
 
  874                 elseif (strlen(
$_POST[
"name_spl"]))
 
  877                         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"]);
 
  882                         $this->ctrl->setParameter($this, 
"sel_question_types", 
$_GET[
"sel_question_types"]);
 
  883                         $this->ctrl->redirect($this, 
"createQuestion");
 
  896                 $parent_ref = $tree->getParentId($this->object->getRefId());
 
  897                 include_once 
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
 
  899                 $qpl->setType(
"spl");
 
  900                 $qpl->setTitle($name);
 
  901                 $qpl->setDescription(
"");
 
  903                 $qpl->createReference();
 
  904                 $qpl->putInTree($parent_ref);
 
  905                 $qpl->setPermissions($parent_ref);
 
  908                 return $qpl->getRefId();
 
  923                 $save = (strcmp($this->ctrl->getCmd(), 
"saveHeading") == 0) ? TRUE : FALSE;
 
  925                 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
  927                 $form->setFormAction($this->ctrl->getFormAction($this));
 
  928                 $form->setTableWidth(
"100%");
 
  929                 $form->setId(
"survey_heading");
 
  935                         $header->setTitle($this->lng->txt(
"edit_heading"));
 
  939                         $header->setTitle($this->lng->txt(
"add_heading"));
 
  941                 $form->addItem($header);
 
  943                 $survey_questions =& $this->
object->getSurveyQuestions();
 
  947                 $heading->
setValue($this->object->prepareTextareaOutput(array_key_exists(
'heading', 
$_POST) ? 
$_POST[
'heading'] : $survey_questions[$question_id][
"heading"]));
 
  948                 $heading->setRows(10);
 
  949                 $heading->setCols(80);
 
  950                 $heading->setUseRte(TRUE);
 
  951                 include_once 
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
 
  953                 $heading->removePlugin(
"ibrowser");
 
  954                 $heading->setRTESupport($this->object->getId(), 
"svy", 
"survey");
 
  955                 $heading->setRequired(
true);
 
  956                 $form->addItem($heading);
 
  958                 $insertbefore = 
new ilSelectInputGUI($this->lng->txt(
"insert"), 
"insertbefore");
 
  960                 foreach ($survey_questions as $key => $value)
 
  962                         $options[$key] = $this->lng->txt(
"before") . 
": \"" . $value[
"title"] . 
"\"";
 
  965                 $insertbefore->setValue((array_key_exists(
'insertbefore', 
$_POST)) ? 
$_POST[
'insertbefore'] : $question_id);
 
  966                 $insertbefore->setRequired(
true);
 
  967                 if ($question_id || array_key_exists(
'insertbefore', 
$_POST))
 
  969                         $insertbefore->setDisabled(
true);
 
  971                 $form->addItem($insertbefore);
 
  973                 if ($ilAccess->checkAccess(
"write", 
"", 
$_GET[
"ref_id"])) $form->addCommandButton(
"saveHeading", $this->lng->txt(
"save"));
 
  974                 if ($ilAccess->checkAccess(
"write", 
"", 
$_GET[
"ref_id"])) $form->addCommandButton(
"cancelHeading", $this->lng->txt(
"cancel"));
 
  979                         $errors = !$form->checkInput();
 
  980                         $form->setValuesByPost();
 
  981                         if (
$errors) $checkonly = 
false;
 
  983                 if (!$checkonly) $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
 
  995                 foreach (
$_POST as $key => $value) {
 
  996                         if (preg_match(
"/id_(\d+)/", $key, $matches)) {
 
  997                                 if (
$_GET[
"browsetype"] == 1)
 
  999                                         $this->
object->insertQuestion($matches[1]);
 
 1003                                         $this->
object->insertQuestionBlock($matches[1]);
 
 1007                 $this->
object->saveCompletionStatus();
 
 1009                 $this->ctrl->redirect($this, 
"questions");
 
 1019                 $this->ctrl->redirect($this, 
"questions");
 
 1034                         $insertbefore = 
$_POST[
"insertbefore"];
 
 1037                                 $insertbefore = 
$_POST[
"insertbefore_original"];
 
 1039                         include_once 
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
 
 1041                         $this->ctrl->redirect($this, 
"questions");
 
 1054                 $this->ctrl->redirect($this, 
"questions");
 
 1066                 $this->
object->saveHeading(
"", 
$_POST[
"removeheading"]);
 
 1067                 $this->ctrl->redirect($this, 
"questions");
 
 1079                 $this->ctrl->redirect($this, 
"questions");
 
 1092                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_svy_confirm_removeheading.html", 
"Modules/Survey");
 
 1093                 $this->tpl->setCurrentBlock(
"adm_content");
 
 1094                 $this->tpl->setVariable(
"BTN_CONFIRM_REMOVE", $this->lng->txt(
"confirm"));
 
 1095                 $this->tpl->setVariable(
"BTN_CANCEL_REMOVE", $this->lng->txt(
"cancel"));
 
 1096                 $this->tpl->setVariable(
"REMOVE_HEADING", 
$_GET[
"removeheading"]);
 
 1097                 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this, 
"confirmRemoveHeading"));
 
 1098                 $this->tpl->parseCurrentBlock();
 
 1110                 $checked_questions = array();
 
 1111                 $checked_questionblocks = array();
 
 1112                 foreach (
$_POST as $key => $value) 
 
 1114                         if (preg_match(
"/id_(\d+)/", $key, $matches)) 
 
 1116                                 array_push($checked_questions, $matches[1]);
 
 1118                         if (preg_match(
"/id_qb_(\d+)/", $key, $matches)) 
 
 1120                                 array_push($checked_questionblocks, $matches[1]);
 
 1123                 $this->
object->removeQuestions($checked_questions, $checked_questionblocks);
 
 1124                 $this->
object->saveCompletionStatus();
 
 1126                 $this->ctrl->redirect($this, 
"questions");
 
 1138                 $this->ctrl->redirect($this, 
"questions");
 
 1150                 $questionblock = array();
 
 1151                 foreach (
$_POST as $key => $value)
 
 1153                         if (preg_match(
"/cb_(\d+)/", $key, $matches))
 
 1155                                 array_push($questionblock, $value);
 
 1158                 if (count($questionblock) < 2)
 
 1160                         ilUtil::sendInfo($this->lng->txt(
"qpl_define_questionblock_select_missing"), 
true);
 
 1161                         $this->ctrl->redirect($this, 
"questions");
 
 1177                         $show_questiontext = (
$_POST[
"show_questiontext"]) ? 1 : 0;
 
 1178                         if (
$_POST[
"questionblock_id"])
 
 1180                                 include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 1185                                 $questionblock = array();
 
 1186                                 foreach (
$_POST as $key => $value)
 
 1188                                         if (preg_match(
"/cb_(\d+)/", $key, $matches))
 
 1190                                                 array_push($questionblock, $value);
 
 1193                                 include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 1197                         $this->ctrl->redirect($this, 
"questions");
 
 1212                 $unfoldblocks = array();
 
 1213                 foreach (
$_POST as $key => $value)
 
 1215                         if (preg_match(
"/cb_qb_(\d+)/", $key, $matches))
 
 1217                                 array_push($unfoldblocks, $matches[1]);
 
 1220                 if (count($unfoldblocks))
 
 1223                         $this->
object->unfoldQuestionblocks($unfoldblocks);
 
 1229                 $this->ctrl->redirect($this, 
"questions");
 
 1238                 $this->ctrl->redirect($this, 
"questions");
 
 1246                 $move_questions = array();
 
 1247                 foreach (
$_POST as $key => $value)
 
 1249                         if (preg_match(
"/cb_(\d+)/", $key, $matches))
 
 1251                                 array_push($move_questions, $matches[1]);
 
 1253                         if (preg_match(
"/cb_qb_(\d+)/", $key, $matches))
 
 1255                                 $ids = $this->
object->getQuestionblockQuestionIds($matches[1]);
 
 1256                                 foreach ($ids as $qkey => $qid)
 
 1258                                         array_push($move_questions, $qid);
 
 1262                 if (count($move_questions) == 0)
 
 1265                         $this->ctrl->redirect($this, 
"questions");
 
 1269                         $_SESSION[
"move_questions"] = $move_questions;
 
 1270                         ilUtil::sendInfo($this->lng->txt(
"select_target_position_for_move_question"));
 
 1281                 $move_questions = 
$_SESSION[
"move_questions"];
 
 1284                 foreach (
$_POST as $key => $value)
 
 1286                         if (preg_match(
"/^cb_(\d+)$/", $key, $matches))
 
 1290                                         $insert_id = $matches[1];
 
 1293                         if (preg_match(
"/^cb_qb_(\d+)$/", $key, $matches))
 
 1297                                         $ids =& $this->
object->getQuestionblockQuestionIds($matches[1]);
 
 1300                                                 if ($insert_mode == 0)
 
 1302                                                         $insert_id = $ids[0];
 
 1304                                                 else if ($insert_mode == 1)
 
 1306                                                         $insert_id = $ids[count($ids)-1];
 
 1312                 if ($insert_id <= 0)
 
 1319                         $this->
object->moveQuestions($move_questions, $insert_id, $insert_mode);
 
 1322                 $this->ctrl->redirect($this, 
"questions");
 
 1346                 $obligatory = array();
 
 1347                 foreach (
$_POST as $key => $value)
 
 1349                         if (preg_match(
"/obligatory_(\d+)/", $key, $matches))
 
 1351                                 $obligatory[$matches[1]] = 1;
 
 1354                 $this->
object->setObligatoryStates($obligatory);
 
 1356                 $this->ctrl->redirect($this, 
"questions");
 
 1367                 $hasDatasets = $this->
object->_hasDatasets($this->object->getSurveyId());
 
 1368                 include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 1369                 if ((!$rbacsystem->checkAccess(
"read", $this->ref_id)) && (!$rbacsystem->checkAccess(
"write", $this->ref_id))) 
 
 1373                         $path = $this->tree->getPathFull($this->object->getRefID());
 
 1378                 if (
$_GET[
"new_id"] > 0)
 
 1381                         $existing = $this->
object->getExistingQuestions();
 
 1382                         if (!in_array(
$_GET[
"new_id"], $existing))
 
 1384                                 $inserted = $this->
object->insertQuestion(
$_GET[
"new_id"]);
 
 1394                         ilUtil::redirect(
"ilias.php?baseClass=ilObjSurveyQuestionPoolGUI&ref_id=" . $_GET[
"eqpl"] . 
"&cmd=editQuestionForSurvey&calling_survey=".$_GET[
"ref_id"].
"&q_id=" . $_GET[
"eqid"]);
 
 1398                 $_SESSION[
"calling_survey"] = $this->
object->getRefId();
 
 1401                 if ($_GET[
"editheading"])
 
 1407                 if ($_GET[
"up"] > 0)
 
 1409                         $this->
object->moveUpQuestion($_GET[
"up"]);
 
 1412                 if ($_GET[
"down"] > 0)
 
 1414                         $this->
object->moveDownQuestion($_GET[
"down"]);
 
 1417                 if ($_GET[
"qbup"] > 0)
 
 1419                         $this->
object->moveUpQuestionblock($_GET[
"qbup"]);
 
 1422                 if ($_GET[
"qbdown"] > 0)
 
 1424                         $this->
object->moveDownQuestionblock($_GET[
"qbdown"]);
 
 1428                 if ($_GET[
"removeheading"])
 
 1434                 if ($_GET[
"editblock"])
 
 1443                         $selected_array = array();
 
 1444                         array_push($selected_array, $_GET[
"add"]);
 
 1446                         $this->insertQuestionsForm($selected_array);
 
 1450                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_svy_questions.html", 
"Modules/Survey");
 
 1451                 $survey_questions =& $this->
object->getSurveyQuestions();
 
 1452                 $questionpools =& $this->
object->getQuestionpoolTitles();
 
 1453                 $colors = array(
"tblrow1", 
"tblrow2");
 
 1456                 $last_color_class = 
"";
 
 1457                 $obligatory = 
"<img src=\"" . 
ilUtil::getImagePath(
"obligatory.gif", 
"Modules/Survey") . 
"\" alt=\"" . $this->lng->txt(
"question_obligatory") . 
"\" title=\"" . $this->lng->txt(
"question_obligatory") . 
"\" />";
 
 1458                 include_once 
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
 
 1460                 if (count($survey_questions) > 0)
 
 1462                         foreach ($survey_questions as $question_id => 
$data)
 
 1465                                 if (($last_questionblock_id > 0) && (
$data[
"questionblock_id"] == 0))
 
 1469                                 if (($last_questionblock_id > 0) && (
$data[
"questionblock_id"] > 0) && (
$data[
"questionblock_id"] != $last_questionblock_id))
 
 1473                                 if ((
$data[
"questionblock_id"] > 0) and (
$data[
"questionblock_id"] != $last_questionblock_id))
 
 1476                                         $this->tpl->setCurrentBlock(
"separator");
 
 1477                                         $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
 
 1478                                         $this->tpl->parseCurrentBlock();
 
 1479                                         $this->tpl->setCurrentBlock(
"QTab");
 
 1480                                         $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
 
 1481                                         $this->tpl->parseCurrentBlock();
 
 1483                                         $this->tpl->setCurrentBlock(
"block");
 
 1484                                         $this->tpl->setVariable(
"TYPE_ICON", 
"<img src=\"" . 
ilUtil::getImagePath(
"questionblock.gif", 
"Modules/Survey") . 
"\" alt=\"".$this->lng->txt(
"questionblock_icon").
"\" />");
 
 1485                                         $this->tpl->setVariable(
"TEXT_QUESTIONBLOCK", $this->lng->txt(
"questionblock") . 
": " . 
$data[
"questionblock_title"]);
 
 1486                                         $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
 
 1487                                         if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets) 
 
 1489                                                 if (
$data[
"question_id"] != $this->object->questions[0])
 
 1491                                                         $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>");
 
 1493                                                 $akeys = array_keys($survey_questions);
 
 1494                                                 if (
$data[
"questionblock_id"] != $survey_questions[$akeys[count($akeys)-1]][
"questionblock_id"])
 
 1496                                                         $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>");
 
 1498                                                 $this->tpl->setVariable(
"TEXT_EDIT", $this->lng->txt(
"edit"));
 
 1499                                                 $this->tpl->setVariable(
"HREF_EDIT", $this->ctrl->getLinkTarget($this, 
"questions") . 
"&editblock=" . 
$data[
"questionblock_id"]);
 
 1501                                         $this->tpl->parseCurrentBlock();
 
 1502                                         $this->tpl->setCurrentBlock(
"QTab");
 
 1503                                         $this->tpl->setVariable(
"QUESTION_ID", 
"qb_" . 
$data[
"questionblock_id"]);
 
 1504                                         $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
 
 1505                                         $this->tpl->parseCurrentBlock();
 
 1507                                 if (($last_questionblock_id > 0) && (
$data[
"questionblock_id"] == 0))
 
 1510                                         $this->tpl->setCurrentBlock(
"separator");
 
 1511                                         $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
 
 1512                                         $this->tpl->parseCurrentBlock();
 
 1513                                         $this->tpl->setCurrentBlock(
"QTab");
 
 1514                                         $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
 
 1515                                         $this->tpl->parseCurrentBlock();
 
 1517                                 if (
$data[
"heading"])
 
 1519                                         $this->tpl->setCurrentBlock(
"heading");
 
 1520                                         $this->tpl->setVariable(
"TEXT_HEADING", 
$data[
"heading"]);
 
 1521                                         $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
 
 1522                                         if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets) 
 
 1524                                                 $this->tpl->setVariable(
"TEXT_EDIT", $this->lng->txt(
"edit"));
 
 1525                                                 $this->tpl->setVariable(
"HREF_EDIT", $this->ctrl->getLinkTarget($this, 
"questions") . 
"&editheading=" . 
$data[
"question_id"]);
 
 1526                                                 $this->tpl->setVariable(
"TEXT_DELETE", $this->lng->txt(
"remove"));
 
 1527                                                 $this->tpl->setVariable(
"HREF_DELETE", $this->ctrl->getLinkTarget($this, 
"questions") . 
"&removeheading=" . 
$data[
"question_id"]);
 
 1529                                         $this->tpl->parseCurrentBlock();
 
 1530                                         $this->tpl->setCurrentBlock(
"QTab");
 
 1531                                         $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
 
 1532                                         $this->tpl->parseCurrentBlock();
 
 1534                                 if (!
$data[
"questionblock_id"])
 
 1536                                         $this->tpl->setCurrentBlock(
"checkable");
 
 1537                                         $this->tpl->setVariable(
"QUESTION_ID", 
$data[
"question_id"]);
 
 1538                                         $this->tpl->parseCurrentBlock();
 
 1540                                 $this->tpl->setCurrentBlock(
"QTab");
 
 1541                                 include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
 
 1542                                 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets) 
 
 1544                                         $q_id = 
$data[
"question_id"];
 
 1546                                         $this->tpl->setVariable(
"QUESTION_TITLE", 
"$title_counter. <a href=\"" . $this->ctrl->getLinkTarget($this, 
"questions") . 
"&eqid=$q_id&eqpl=$qpl_ref_id" . 
"\">" . 
$data[
"title"] . 
"</a>");
 
 1550                                         $this->tpl->setVariable(
"QUESTION_TITLE", 
"$title_counter. ". 
$data[
"title"]);
 
 1552                                 $this->tpl->setVariable(
"TYPE_ICON", 
"<img src=\"" . 
ilUtil::getImagePath(
"question.gif", 
"Modules/Survey") . 
"\" alt=\"".$this->lng->txt(
"question_icon").
"\" />");
 
 1553                                 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets) 
 
 1555                                         $obligatory_checked = 
"";
 
 1556                                         if (
$data[
"obligatory"] == 1)
 
 1558                                                 $obligatory_checked = 
" checked=\"checked\"";
 
 1560                                         $this->tpl->setVariable(
"QUESTION_OBLIGATORY", 
"<input type=\"checkbox\" name=\"obligatory_" . 
$data[
"question_id"] . 
"\" value=\"1\"$obligatory_checked />");
 
 1564                                         if (
$data[
"obligatory"] == 1)
 
 1566                                                 $this->tpl->setVariable(
"QUESTION_OBLIGATORY", $obligatory);
 
 1569                                 $this->tpl->setVariable(
"QUESTION_COMMENT", 
$data[
"description"]);
 
 1570                                 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets) 
 
 1572                                         if (!
$data[
"questionblock_id"])
 
 1575                                                 if (
$data[
"question_id"] != $this->object->questions[0])
 
 1577                                                         $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>");
 
 1579                                                 if (
$data[
"question_id"] != $this->object->questions[count($this->object->questions)-1])
 
 1581                                                         $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>");
 
 1587                                                 if (
$data[
"questionblock_id"] == $last_questionblock_id)
 
 1589                                                         $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>");
 
 1591                                                 $tmp_questions = array_keys($survey_questions);
 
 1592                                                 $blockkey = array_search($question_id, $tmp_questions);
 
 1593                                                 if (($blockkey !== FALSE) && ($blockkey < count($tmp_questions)-1))
 
 1595                                                         if (
$data[
"questionblock_id"] == $survey_questions[$tmp_questions[$blockkey+1]][
"questionblock_id"])
 
 1597                                                                 $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>");
 
 1602                                 foreach ($questiontypes as $trans => $typedata)
 
 1604                                         if (strcmp($typedata[
"type_tag"], 
$data[
"type_tag"]) == 0)
 
 1606                                                 $this->tpl->setVariable(
"QUESTION_TYPE", $trans);
 
 1609                                 $this->tpl->setVariable(
"QUESTION_AUTHOR", 
$data[
"author"]);
 
 1610                                 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
 
 1611                                 $last_color_class = $colors[$counter % 2];
 
 1612                                 if (!
$data[
"questionblock_id"])
 
 1616                                 $this->tpl->parseCurrentBlock();
 
 1617                                 $last_questionblock_id = 
$data[
"questionblock_id"];
 
 1620                         if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets) 
 
 1622                                 $this->tpl->setCurrentBlock(
"selectall");
 
 1623                                 $this->tpl->setVariable(
"SELECT_ALL", $this->lng->txt(
"select_all"));
 
 1624                                 $this->tpl->setVariable(
"COLOR_CLASS", $last_color_class);
 
 1625                                 $this->tpl->parseCurrentBlock();
 
 1626                                 if (array_key_exists(
"move_questions", 
$_SESSION))
 
 1628                                         $this->tpl->setCurrentBlock(
"move_buttons");
 
 1629                                         $this->tpl->setVariable(
"INSERT_BEFORE", $this->lng->txt(
"insert_before"));
 
 1630                                         $this->tpl->setVariable(
"INSERT_AFTER", $this->lng->txt(
"insert_after"));
 
 1631                                         $this->tpl->parseCurrentBlock();
 
 1633                                 $this->tpl->setCurrentBlock(
"QFooter");
 
 1634                                 $this->tpl->setVariable(
"ARROW", 
"<img src=\"" . 
ilUtil::getImagePath(
"arrow_downright.gif") . 
"\" alt=\"".$this->lng->txt(
"arrow_downright").
"\">");
 
 1635                                 $this->tpl->setVariable(
"REMOVE", $this->lng->txt(
"remove_question"));
 
 1636                                 $this->tpl->setVariable(
"MOVE", $this->lng->txt(
"move"));
 
 1637                                 $this->tpl->setVariable(
"QUESTIONBLOCK", $this->lng->txt(
"define_questionblock"));
 
 1638                                 $this->tpl->setVariable(
"UNFOLD", $this->lng->txt(
"unfold"));
 
 1639                                 $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save_obligatory_state"));
 
 1640                                 $this->tpl->parseCurrentBlock();
 
 1645                         $this->tpl->setCurrentBlock(
"Emptytable");
 
 1646                         $this->tpl->setVariable(
"TEXT_EMPTYTABLE", $this->lng->txt(
"no_questions_available"));
 
 1647                         $this->tpl->parseCurrentBlock();
 
 1649                 if (($last_questionblock_id > 0))
 
 1652                         $this->tpl->setCurrentBlock(
"separator");
 
 1653                         $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
 
 1654                         $this->tpl->parseCurrentBlock();
 
 1655                         $this->tpl->setCurrentBlock(
"QTab");
 
 1656                         $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
 
 1657                         $this->tpl->parseCurrentBlock();
 
 1660                 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets) 
 
 1662                         $this->tpl->setCurrentBlock(
"QTypes");
 
 1663                         include_once 
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
 
 1665                         foreach ($qtypes as $translation => 
$data)
 
 1667                                 $this->tpl->setVariable(
"QUESTION_TYPE_ID", 
$data[
"type_tag"]);
 
 1668                                 $this->tpl->setVariable(
"QUESTION_TYPE", $translation);
 
 1669                                 $this->tpl->parseCurrentBlock();
 
 1671                         $this->tpl->parseCurrentBlock();
 
 1673                 $this->tpl->setCurrentBlock(
"adm_content");
 
 1674                 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this, 
"questions"));
 
 1675                 $this->tpl->setVariable(
"QUESTION_TITLE", $this->lng->txt(
"title"));
 
 1676                 $this->tpl->setVariable(
"QUESTION_COMMENT", $this->lng->txt(
"description"));
 
 1677                 $this->tpl->setVariable(
"QUESTION_OBLIGATORY", $this->lng->txt(
"obligatory"));
 
 1678                 $this->tpl->setVariable(
"QUESTION_SEQUENCE", $this->lng->txt(
"sequence"));
 
 1679                 $this->tpl->setVariable(
"QUESTION_TYPE", $this->lng->txt(
"question_type"));
 
 1680                 $this->tpl->setVariable(
"QUESTION_AUTHOR", $this->lng->txt(
"author"));
 
 1682                 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets)
 
 1684                         $this->tpl->setVariable(
"BUTTON_INSERT_QUESTION", $this->lng->txt(
"browse_for_questions"));
 
 1686                         $this->tpl->setVariable(
'BROWSE_COMMAND', ($ilUser->getPref(
'svy_insert_type') == 1 || strlen($ilUser->getPref(
'svy_insert_type')) == 0) ? 
'browseForQuestions' : 
'browseForQuestionblocks');
 
 1687                         $this->tpl->setVariable(
"TEXT_CREATE_NEW", 
" " . strtolower($this->lng->txt(
"or")) . 
" " . $this->lng->txt(
"create_new"));
 
 1688                         $this->tpl->setVariable(
"BUTTON_CREATE_QUESTION", $this->lng->txt(
"create"));
 
 1689                         $this->tpl->setVariable(
"HEADING", $this->lng->txt(
"add_heading"));
 
 1696                 $this->tpl->parseCurrentBlock();
 
 1709                 include_once(
"./Modules/Survey/classes/class.ilSurveyEvaluationGUI.php");
 
 1711                 $this->ctrl->setCmdClass(get_class($eval_gui));
 
 1712                 $this->ctrl->redirect($eval_gui, 
"evaluation");
 
 1721                 if (is_array(
$_POST[
"user_select"]))
 
 1723                         foreach (
$_POST[
"user_select"] as $user_id)
 
 1725                                 $this->
object->disinviteUser($user_id);
 
 1729                 $this->ctrl->redirect($this, 
"invite");
 
 1739                 if (is_array(
$_POST[
"user"]))
 
 1741                         foreach (
$_POST[
"user"] as $user_id)
 
 1743                                 $this->
object->inviteUser($user_id);
 
 1755                 $this->ctrl->redirect($this, 
"invite");
 
 1763                 $mode = 
$_POST[
'invitation'];
 
 1767                                 $this->
object->setInvitation(0);
 
 1770                                 $this->
object->setInvitation(1);
 
 1771                                 $this->
object->setInvitationMode(0);
 
 1774                                 $this->
object->setInvitation(1);
 
 1775                                 $this->
object->setInvitationMode(1);
 
 1778                 $this->
object->saveToDb();
 
 1780                 $this->ctrl->redirect($this, 
"invite");
 
 1793                 if ((!$rbacsystem->checkAccess(
"visible,invite", $this->ref_id)) && (!$rbacsystem->checkAccess(
"write", $this->ref_id))) 
 
 1797                         $path = $this->tree->getPathFull($this->object->getRefID());
 
 1798                         include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 1809                 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
 1811                 $form->setFormAction($this->ctrl->getFormAction($this));
 
 1812                 $form->setTableWidth(
"500");
 
 1813                 $form->setId(
"invite");
 
 1817                 $header->setTitle($this->lng->txt(
"invitation"));
 
 1818                 $form->addItem($header);
 
 1822                 $invitation->
setInfo($this->lng->txt(
'invitation_mode_desc'));
 
 1823                 $invitation->addOption(
new ilRadioOption($this->lng->txt(
"invitation_off"), 0, 
''));
 
 1824                 $surveySetting = 
new ilSetting(
"survey");
 
 1825                 if ($surveySetting->get(
"unlimited_invitation"))
 
 1827                         $invitation->addOption(
new ilRadioOption($this->lng->txt(
"unlimited_users"), 1, 
''));
 
 1829                 $invitation->addOption(
new ilRadioOption($this->lng->txt(
"predefined_users"), 2, 
''));
 
 1831                 if ($this->object->getInvitation())
 
 1833                         $inv = $this->
object->getInvitationMode() + 1;
 
 1835                 $invitation->setValue($inv);
 
 1836                 $form->addItem($invitation);
 
 1838                 $form->addCommandButton(
"saveInvitationStatus", $this->lng->txt(
"save"));
 
 1840                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_svy_invite.html", 
"Modules/Survey");
 
 1841                 $this->tpl->setVariable(
"INVITATION_TABLE", $form->getHTML());
 
 1843                 if ($this->object->getInvitation() && $this->
object->getInvitationMode() == 1)
 
 1846                         $ilToolbar->addButton($this->lng->txt(
"svy_search_users"),
 
 1847                                 $this->ctrl->getLinkTargetByClass(
'ilRepositorySearchGUI',
'start'));
 
 1849                         $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
 
 1851                         $invited_users = $this->
object->getUserData($this->object->getInvitedUsers());
 
 1852                         include_once 
"./Modules/Survey/classes/tables/class.ilSurveyInvitedUsersTableGUI.php";
 
 1854                         $table_gui->setData($invited_users);
 
 1855                         $this->tpl->setVariable(
'TBL_INVITED_USERS', $table_gui->getHTML());    
 
 1865                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_svy_maintenance.html", 
"Modules/Survey");
 
 1866                 $this->tpl->setCurrentBlock(
"adm_content");
 
 1867                 $this->tpl->setVariable(
"BTN_CONFIRM_DELETE_ALL", $this->lng->txt(
"confirm"));
 
 1868                 $this->tpl->setVariable(
"BTN_CANCEL_DELETE_ALL", $this->lng->txt(
"cancel"));
 
 1869                 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this, 
"deleteAllUserData"));
 
 1870                 $this->tpl->parseCurrentBlock();
 
 1878                 $this->
object->deleteAllUserData();
 
 1880                 $this->ctrl->redirect($this, 
"maintenance");
 
 1888                 $this->ctrl->redirect($this, 
"maintenance");
 
 1896                 $this->
object->removeSelectedSurveyResults(
$_POST[
"chbUser"]);
 
 1898                 $this->ctrl->redirect($this, 
"maintenance");
 
 1907                 $this->ctrl->redirect($this, 
"maintenance");
 
 1917                 if (count(
$_POST[
"chbUser"]) == 0)
 
 1920                         $this->ctrl->redirect($this, 
"maintenance");
 
 1924                 include_once 
"./Modules/Survey/classes/tables/class.ilSurveyMaintenanceTableGUI.php";
 
 1926                 $total =& $this->
object->getSurveyParticipants();
 
 1928                 foreach (
$total as $user_data)
 
 1930                         if (in_array($user_data[
'active_id'], 
$_POST[
'chbUser']))
 
 1932                                 $last_access = $this->
object->_getLastAccess($user_data[
"active_id"]);
 
 1933                                 array_push(
$data, array(
 
 1934                                         'id' => $user_data[
"active_id"],
 
 1935                                         'name' => $user_data[
"sortname"],
 
 1936                                         'login' => $user_data[
"login"],
 
 1937                                         'last_access' => $last_access
 
 1941                 $table_gui->setData(
$data);
 
 1942                 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());  
 
 1952                 if (
$_GET[
"fill"] > 0) 
 
 1954                         for ($i = 0; $i < 
$_GET[
"fill"]; $i++) $this->object->fillSurveyForUser();
 
 1956                 include_once 
"./Modules/Survey/classes/tables/class.ilSurveyMaintenanceTableGUI.php";
 
 1958                 $total =& $this->
object->getSurveyParticipants();
 
 1960                 foreach (
$total as $user_data)
 
 1962                         $last_access = $this->
object->_getLastAccess($user_data[
"active_id"]);
 
 1963                         array_push(
$data, array(
 
 1964                                 'id' => $user_data[
"active_id"],
 
 1965                                 'name' => $user_data[
"sortname"],
 
 1966                                 'login' => $user_data[
"login"],
 
 1967                                 'last_access' => $last_access
 
 1970                 $table_gui->setData(
$data);
 
 1971                 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());  
 
 1982                 $this->tpl->setCurrentBlock(
"option_qpl");
 
 1983                 include_once(
"./Modules/Survey/classes/class.ilObjSurvey.php");
 
 1985                 $questionpools =& $svy->getAvailableQuestionpools(TRUE, FALSE, TRUE);
 
 1986                 if (count($questionpools) == 0)
 
 1991                         foreach ($questionpools as $key => $value)
 
 1993                                 $this->tpl->setCurrentBlock(
"option_spl");
 
 1994                                 $this->tpl->setVariable(
"OPTION_VALUE", $key);
 
 1995                                 $this->tpl->setVariable(
"TXT_OPTION", $value);
 
 1996                                 $this->tpl->parseCurrentBlock();
 
 1999                 $this->tpl->setVariable(
"TXT_SELECT_QUESTIONPOOL", $this->lng->txt(
"select_questionpool"));
 
 2000                 $this->tpl->setVariable(
"OPTION_SELECT_QUESTIONPOOL", $this->lng->txt(
"select_questionpool_option"));
 
 2001                 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this, 
"import"));
 
 2002                 $this->tpl->setVariable(
"BTN_NAME", 
"upload");
 
 2003                 $this->tpl->setVariable(
"TXT_UPLOAD", $this->lng->txt(
"upload"));
 
 2004                 $this->tpl->setVariable(
"TXT_IMPORT_TST", $this->lng->txt(
"import_tst"));
 
 2005                 $this->tpl->setVariable(
"TXT_SELECT_MODE", $this->lng->txt(
"select_mode"));
 
 2006                 $this->tpl->setVariable(
"TXT_SELECT_FILE", $this->lng->txt(
"select_file"));
 
 2024                 if (strcmp($_FILES[
"xmldoc"][
"tmp_name"], 
"") == 0)
 
 2031                 include_once(
"./Modules/Survey/classes/class.ilObjSurvey.php");
 
 2033                 $newObj->setType(
$_GET[
"new_type"]);
 
 2034                 $newObj->setTitle(
"dummy");
 
 2035                 $newObj->setDescription(
"dummy");
 
 2036                 $newObj->create(
true);
 
 2037                 $newObj->createReference();
 
 2038                 $newObj->putInTree(
$_GET[
"ref_id"]);
 
 2039                 $newObj->setPermissions(
$_GET[
"ref_id"]);
 
 2040                 $newObj->notify(
"new",
$_GET[
"ref_id"],
$_GET[
"parent_non_rbac_id"],
$_GET[
"ref_id"],$newObj->getRefId());
 
 2042                 $error = $newObj->importObject($_FILES[
"xmldoc"], 
$_POST[
"spl"]);
 
 2046                         $this->ilias->raiseError($error, $this->ilias->error_obj->MESSAGE);
 
 2051                         $ref_id = $newObj->getRefId();
 
 2055                         include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 2068                 if (!$rbacsystem->checkAccess(
"create", 
$_GET[
"ref_id"], $new_type))
 
 2070                         $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
 
 2076                         include_once(
"./Modules/Survey/classes/class.ilObjSurvey.php");
 
 2080                         $questionpools =& $svy->getAvailableQuestionpools($use_obj_id = TRUE, $could_be_offline = TRUE, $showPath = TRUE);
 
 2081                         if (count($questionpools) > 0)
 
 2083                                 foreach ($questionpools as $key => $value)
 
 2085                                         $this->tpl->setCurrentBlock(
"option_spl");
 
 2086                                         $this->tpl->setVariable(
"OPTION_VALUE", $key);
 
 2087                                         $this->tpl->setVariable(
"TXT_OPTION", $value);
 
 2088                                         if (
$_POST[
"spl"] == $key)
 
 2090                                                 $this->tpl->setVariable(
"OPTION_SELECTED", 
" selected=\"selected\"");                           
 
 2092                                         $this->tpl->parseCurrentBlock();
 
 2097                         $data[
"fields"] = array();
 
 2098                         include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 2102                         foreach (
$data[
"fields"] as $key => $val)
 
 2104                                 $this->tpl->setVariable(
"TXT_".strtoupper($key), $this->lng->txt($key));
 
 2105                                 $this->tpl->setVariable(strtoupper($key), $val);
 
 2107                                 if ($this->prepare_output)
 
 2109                                         $this->tpl->parseCurrentBlock();
 
 2113                         $this->ctrl->setParameter($this, 
"new_type", $this->type);
 
 2114                         $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this, 
"create"));
 
 2115                         $this->tpl->setVariable(
"TXT_HEADER", $this->lng->txt($new_type.
"_new"));
 
 2116                         $this->tpl->setVariable(
"TXT_SELECT_QUESTIONPOOL", $this->lng->txt(
"select_questionpool_short"));
 
 2117                         $this->tpl->setVariable(
"OPTION_SELECT_QUESTIONPOOL", $this->lng->txt(
"select_questionpool_option"));
 
 2118                         $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
 
 2119                         $this->tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt($new_type.
"_add"));
 
 2120                         $this->tpl->setVariable(
"CMD_SUBMIT", 
"save");
 
 2121                         $this->tpl->setVariable(
"TARGET", 
' target="'.
 
 2123                         $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
 
 2125                         $this->tpl->setVariable(
"TXT_IMPORT_SVY", $this->lng->txt(
"import_svy"));
 
 2126                         $this->tpl->setVariable(
"TXT_SVY_FILE", $this->lng->txt(
"svy_upload_file"));
 
 2127                         $this->tpl->setVariable(
"TXT_IMPORT", $this->lng->txt(
"import"));
 
 2130                         $this->tpl->setVariable(
"ALT_IMG",$this->lng->txt(
"obj_svy"));
 
 2132                         $this->tpl->setVariable(
"ALT_IMG2",$this->lng->txt(
"obj_svy"));
 
 2147                 if (strcmp($_FILES[
"xmldoc"][
"tmp_name"], 
"") == 0)
 
 2153                 $this->ctrl->setParameter($this, 
"new_type", $this->type);
 
 2159                         "&baseClass=ilObjSurveyGUI");
 
 2170                 $export_dir = $this->
object->getExportDirectory();
 
 2171                 $export_files = $this->
object->getExportFiles($export_dir);
 
 2173                 if(count($export_files) > 0)
 
 2175                         foreach($export_files as $exp_file)
 
 2177                                 $file_arr = explode(
"__", $exp_file);
 
 2179                                 array_push(
$data, array(
 
 2180                                         'file' => $exp_file,
 
 2181                                         'size' => filesize($export_dir.
"/".$exp_file),
 
 2187                 include_once 
"./Modules/Survey/classes/tables/class.ilSurveyExportTableGUI.php";
 
 2189                 $table_gui->setData(
$data);
 
 2190                 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());  
 
 2199                 include_once(
"./Modules/Survey/classes/class.ilSurveyExport.php");
 
 2201                 $survey_exp->buildExportFile();
 
 2202                 $this->ctrl->redirect($this, 
"export");
 
 2210                 if(!isset(
$_POST[
"file"]))
 
 2213                         $this->ctrl->redirect($this, 
"export");
 
 2216                 if (count(
$_POST[
"file"]) > 1)
 
 2219                         $this->ctrl->redirect($this, 
"export");
 
 2223                 $export_dir = $this->
object->getExportDirectory();
 
 2224                 include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 2236                 if (!isset(
$_POST[
"file"]))
 
 2239                         $this->ctrl->redirect($this, 
"export");
 
 2244                 $export_dir = $this->
object->getExportDirectory();
 
 2245                 $export_files = $this->
object->getExportFiles($export_dir);
 
 2247                 if (count(
$_POST[
"file"]) > 0)
 
 2249                         foreach (
$_POST[
"file"] as $exp_file)
 
 2251                                 $file_arr = explode(
"__", $exp_file);
 
 2253                                 array_push(
$data, array(
 
 2254                                         'file' => $exp_file,
 
 2255                                         'size' => filesize($export_dir.
"/".$exp_file),
 
 2261                 include_once 
"./Modules/Survey/classes/tables/class.ilSurveyExportTableGUI.php";
 
 2263                 $table_gui->setData(
$data);
 
 2264                 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());  
 
 2274                 $this->ctrl->redirect($this, 
"export");
 
 2283                 $export_dir = $this->
object->getExportDirectory();
 
 2286                         $exp_file = $export_dir.
"/".
$file;
 
 2287                         $exp_dir = $export_dir.
"/".substr($file, 0, strlen($file) - 4);
 
 2288                         if (@is_file($exp_file))
 
 2292                         if (@is_dir($exp_dir))
 
 2294                                 include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 2299                 $this->ctrl->redirect($this, 
"export");
 
 2307                 if (strcmp(
$_POST[
"lang"], 
"-1") != 0)
 
 2310                         $ilUser->writePref(
"survey_code_language", 
$_POST[
"lang"]);
 
 2313                 $this->ctrl->redirect($this, 
'codes');
 
 2323                 global $ilUser, $ilToolbar;
 
 2324                 if ($this->object->getAnonymize() != 1)
 
 2329                 $default_lang = $ilUser->getPref(
"survey_code_language");
 
 2332                 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
 
 2333                 $languages = $this->lng->getInstalledLanguages();
 
 2335                 foreach ($languages as 
$lang)
 
 2337                         $options[
$lang] = $this->lng->txt(
"lang_$lang");
 
 2339                 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
 
 2342                 $si->setValue($default_lang);
 
 2343                 $ilToolbar->addInputItem($si, 
true);
 
 2344                 $ilToolbar->addFormButton($this->lng->txt(
"set"), 
"setCodeLanguage");
 
 2346                 include_once 
"./Modules/Survey/classes/tables/class.ilSurveyCodesTableGUI.php";
 
 2348                 $survey_codes =& $this->
object->getSurveyCodesTableData($default_lang);
 
 2349                 $table_gui->setData($survey_codes);
 
 2350                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_svy_codes.html", 
true);
 
 2351                 $this->tpl->setCurrentBlock(
"adm_content");
 
 2352                 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this, 
"codes"));
 
 2353                 $this->tpl->setVariable(
"TEXT_CREATE", $this->lng->txt(
"create"));
 
 2354                 $this->tpl->setVariable(
"TEXT_SURVEY_CODES", $this->lng->txt(
"new_survey_codes"));
 
 2355                 $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());        
 
 2363                 if (is_array(
$_POST[
"chb_code"]) && (count(
$_POST[
"chb_code"]) > 0))
 
 2365                         foreach (
$_POST[
"chb_code"] as $survey_code)
 
 2367                                 $this->
object->deleteSurveyCode($survey_code);
 
 2375                 $this->ctrl->redirect($this, 
'codes');
 
 2383                 if (is_array(
$_POST[
"chb_code"]) && (count(
$_POST[
"chb_code"]) > 0))
 
 2385                         $export = $this->
object->getSurveyCodesForExport(
$_POST[
"chb_code"]);
 
 2391                         $this->ctrl->redirect($this, 
'codes');
 
 2400                 $export = $this->
object->getSurveyCodesForExport(array());
 
 2409                 if (preg_match(
"/\d+/", 
$_POST[
"nrOfCodes"]))
 
 2411                         $this->
object->createSurveyCodes(
$_POST[
"nrOfCodes"]);
 
 2418                 $this->ctrl->redirect($this, 
'codes');
 
 2431                 $savefields = (strcmp($this->ctrl->getCmd(), 
"saveMailTableFields") == 0) ? TRUE : FALSE;
 
 2433                 include_once 
"./Modules/Survey/classes/tables/class.ilSurveyCodesMailTableGUI.php";
 
 2434                 $data = $this->
object->getExternalCodeRecipients();
 
 2436                 $table_gui->setData(
$data);
 
 2437                 $table_gui->setTitle($this->lng->txt(
'externalRecipients'));
 
 2438                 $table_gui->completeColumns();
 
 2439                 $tabledata = $table_gui->getHTML();     
 
 2443                         $this->tpl->setVariable(
'ADM_CONTENT', $tabledata);     
 
 2453                 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
 
 2455                 $form_gui->setValuesByPost();
 
 2458                         if ($form_gui->getSavedMessages()->getValue() > 0)
 
 2461                                 $settings = $this->
object->getUserSettings($ilUser->getId(), 
'savemessage');
 
 2462                                 $form_gui->getMailMessage()->setValue($settings[$form_gui->getSavedMessages()->getValue()][
'value']);
 
 2473                         $ilLog->write(
'Error: ' + $e->getMessage());
 
 2475                 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
 
 2483                 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
 
 2485                 $form_gui->setValuesByPost();
 
 2488                         if ($form_gui->getSavedMessages()->getValue() > 0)
 
 2490                                 $this->
object->deleteUserSettings($form_gui->getSavedMessages()->getValue());
 
 2492                                 $form_gui->setValuesByPost();
 
 2503                         $ilLog->write(
'Error: ' + $e->getMessage());
 
 2505                 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
 
 2513                 $mailData[
'm_subject'] = (array_key_exists(
'm_subject', 
$_POST)) ? 
$_POST[
'm_subject'] : sprintf($this->lng->txt(
'default_codes_mail_subject'), $this->
object->getTitle());
 
 2514                 $mailData[
'm_message'] = (array_key_exists(
'm_message', 
$_POST)) ? 
$_POST[
'm_message'] : $this->lng->txt(
'default_codes_mail_message');
 
 2515                 $mailData[
'm_notsent'] = (array_key_exists(
'm_notsent', 
$_POST)) ? 
$_POST[
'm_notsent'] : 
'1';
 
 2517                 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
 
 2519                 $form_gui->setValuesByArray($mailData);
 
 2520                 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
 
 2528                 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
 
 2530                 if ($form_gui->checkInput())
 
 2532                         $code_exists = strpos(
$_POST[
'm_message'], 
'[code]') !== FALSE;
 
 2536                                 $form_gui->setValuesByPost();
 
 2540                                 if (
$_POST[
'savemessage'] == 1)
 
 2543                                         $title = (strlen(
$_POST[
'savemessagetitle'])) ? 
$_POST[
'savemessagetitle'] : ilStr::substr(
$_POST[
'm_message'], 0, 40) . 
'...';
 
 2544                                         $this->
object->saveUserSettings($ilUser->getId(), 
'savemessage', 
$title, 
$_POST[
'm_message']);
 
 2546                                 $this->
object->sendCodes(
$_POST[
'm_notsent'], 
$_POST[
'm_subject'], 
$_POST[
'm_message']);
 
 2548                                 $this->ctrl->redirect($this, 
'codesMail');
 
 2553                         $form_gui->setValuesByPost();
 
 2555                 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
 
 2560                 $this->ctrl->redirect($this, 
'codesMail');
 
 2565                 if (!is_array(
$_POST[
'chb_ext']) || count(is_array(
$_POST[
'chb_ext'])) == 0)
 
 2568                         $this->ctrl->redirect($this, 
'codesMail');
 
 2570                 foreach (
$_POST[
'chb_ext'] as $code)
 
 2572                         $this->
object->deleteSurveyCode($code);
 
 2575                 $this->ctrl->redirect($this, 
'codesMail');
 
 2584                         $existingdata = $this->
object->getExternalCodeRecipients();
 
 2585                         if (count($existingdata))
 
 2587                                 $first = array_shift($existingdata);
 
 2588                                 foreach ($first as $key => $value)
 
 2590                                         if (strcmp($key, 
'code') != 0 && strcmp($key, 
'sent') != 0)
 
 2598                                 $this->
object->createSurveyCodesForExternalData(array(
$data));
 
 2601                         $this->ctrl->redirect($this, 
'codesMail');
 
 2610                         $data = preg_split(
"/[\n\r]/", 
$_POST[
'externaltext']);
 
 2611                         $fields = preg_split(
"/;/", array_shift(
$data));
 
 2612                         if (!in_array(
'email', $fields))
 
 2616                                 $this->ctrl->redirect($this, 
'importExternalMailRecipients');
 
 2618                         $existingdata = $this->
object->getExternalCodeRecipients();
 
 2619                         $existingcolumns = array();
 
 2620                         if (count($existingdata))
 
 2622                                 $first = array_shift($existingdata);
 
 2623                                 foreach ($first as $key => $value)
 
 2625                                         array_push($existingcolumns, $key);
 
 2628                         $founddata = array();
 
 2629                         foreach (
$data as $datarow)
 
 2631                                 $row = preg_split(
"/;/", $datarow);
 
 2632                                 if (count(
$row) == count($fields))
 
 2635                                         foreach ($fields as $idx => $fieldname)
 
 2637                                                 if (count($existingcolumns))
 
 2639                                                         if (array_key_exists($idx, $existingcolumns))
 
 2641                                                                 $dataset[$fieldname] = 
$row[$idx];
 
 2646                                                         $dataset[$fieldname] = 
$row[$idx];
 
 2649                                         if (strlen($dataset[
'email']))
 
 2651                                                 array_push($founddata, $dataset);
 
 2655                         $this->
object->createSurveyCodesForExternalData($founddata);
 
 2657                         $this->ctrl->redirect($this, 
'codesMail');
 
 2666                         include_once 
"./Services/Utilities/classes/class.ilCSVReader.php";
 
 2668                         $reader->open($_FILES[
'externalmails'][
'tmp_name']);
 
 2670                         $fields = array_shift(
$data);
 
 2671                         if (!in_array(
'email', $fields))
 
 2675                                 $this->ctrl->redirect($this, 
'codesMail');
 
 2677                         $existingdata = $this->
object->getExternalCodeRecipients();
 
 2678                         $existingcolumns = array();
 
 2679                         if (count($existingdata))
 
 2681                                 $first = array_shift($existingdata);
 
 2682                                 foreach ($first as $key => $value)
 
 2684                                         array_push($existingcolumns, $key);
 
 2687                         $founddata = array();
 
 2690                                 if (count($row) == count($fields))
 
 2693                                         foreach ($fields as $idx => $fieldname)
 
 2695                                                 if (count($existingcolumns))
 
 2697                                                         if (array_key_exists($idx, $existingcolumns))
 
 2699                                                                 $dataset[$fieldname] = $row[$idx];
 
 2704                                                         $dataset[$fieldname] = $row[$idx];
 
 2707                                         if (strlen($dataset[
'email']))
 
 2709                                                 array_push($founddata, $dataset);
 
 2714                         $this->
object->createSurveyCodesForExternalData($founddata);
 
 2716                         $this->ctrl->redirect($this, 
'codesMail');
 
 2728                         strcmp($this->ctrl->getCmd(), 
"importExternalRecipientsFromFile") == 0 || 
 
 2729                         strcmp($this->ctrl->getCmd(), 
"importExternalRecipientsFromText") == 0 ||
 
 2730                         strcmp($this->ctrl->getCmd(), 
"importExternalRecipientsFromDataset") == 0
 
 2733                 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
 2735                 $form_import_file->setFormAction($this->ctrl->getFormAction($this));
 
 2736                 $form_import_file->setTableWidth(
"100%");
 
 2737                 $form_import_file->setId(
"codes_import_file");
 
 2740                 $headerfile->setTitle($this->lng->txt(
"import_from_file"));
 
 2741                 $form_import_file->addItem($headerfile);
 
 2743                 $externalmails = 
new ilFileInputGUI($this->lng->txt(
"externalmails"), 
"externalmails");
 
 2744                 $externalmails->
setInfo($this->lng->txt(
'externalmails_info'));
 
 2745                 $externalmails->setRequired(
true);
 
 2746                 $form_import_file->addItem($externalmails);
 
 2747                 if ($ilAccess->checkAccess(
"write", 
"", 
$_GET[
"ref_id"])) $form_import_file->addCommandButton(
"importExternalRecipientsFromFile", $this->lng->txt(
"import"));
 
 2748                 if ($ilAccess->checkAccess(
"write", 
"", 
$_GET[
"ref_id"])) $form_import_file->addCommandButton(
"codesMail", $this->lng->txt(
"cancel"));
 
 2753                 $form_import_text->setFormAction($this->ctrl->getFormAction($this));
 
 2754                 $form_import_text->setTableWidth(
"100%");
 
 2755                 $form_import_text->setId(
"codes_import_text");
 
 2758                 $headertext->setTitle($this->lng->txt(
"import_from_text"));
 
 2759                 $form_import_text->addItem($headertext);
 
 2762                 if (array_key_exists(
'externaltext', 
$_SESSION) && strlen(
$_SESSION[
'externaltext']))
 
 2768                         $inp->setValue($this->lng->txt(
'mail_import_example1') . 
"\n" . $this->lng->txt(
'mail_import_example2') . 
"\n" . $this->lng->txt(
'mail_import_example3') . 
"\n");
 
 2770                 $inp->setRequired(
true);
 
 2773                 $inp->setInfo($this->lng->txt(
'externaltext_info'));
 
 2774                 $form_import_text->addItem($inp);
 
 2777                 if ($ilAccess->checkAccess(
"write", 
"", 
$_GET[
"ref_id"])) $form_import_text->addCommandButton(
"importExternalRecipientsFromText", $this->lng->txt(
"import"));
 
 2778                 if ($ilAccess->checkAccess(
"write", 
"", 
$_GET[
"ref_id"])) $form_import_text->addCommandButton(
"codesMail", $this->lng->txt(
"cancel"));
 
 2783                 $form_import_dataset->setFormAction($this->ctrl->getFormAction($this));
 
 2784                 $form_import_dataset->setTableWidth(
"100%");
 
 2785                 $form_import_dataset->setId(
"codes_import_dataset");
 
 2788                 $headerfile->setTitle($this->lng->txt(
"import_from_dataset"));
 
 2789                 $form_import_dataset->addItem($headerfile);
 
 2791                 $existingdata = $this->
object->getExternalCodeRecipients();
 
 2792                 $existingcolumns = array(
'email');
 
 2793                 if (count($existingdata))
 
 2795                         $first = array_shift($existingdata);
 
 2796                         foreach ($first as $key => $value)
 
 2798                                 if (strcmp($key, 
'email') != 0 && strcmp($key, 
'code') != 0 && strcmp($key, 
'sent') != 0)
 
 2800                                         array_push($existingcolumns, $key);
 
 2805                 foreach ($existingcolumns as $column)
 
 2809                         if (strcmp($column, 
'email') == 0)
 
 2811                                 $inp->setRequired(
true);
 
 2815                                 $inp->setRequired(
false);
 
 2817                         $form_import_dataset->addItem($inp);
 
 2819                 if ($ilAccess->checkAccess(
"write", 
"", 
$_GET[
"ref_id"])) $form_import_dataset->addCommandButton(
"importExternalRecipientsFromDataset", $this->lng->txt(
"import"));
 
 2820                 if ($ilAccess->checkAccess(
"write", 
"", 
$_GET[
"ref_id"])) $form_import_dataset->addCommandButton(
"codesMail", $this->lng->txt(
"cancel"));
 
 2829                                         $errors = !$form_import_file->checkInput();
 
 2830                                         $form_import_file->setValuesByPost();
 
 2831                                         if (
$errors) $checkonly = 
false;
 
 2834                                         $errors = !$form_import_text->checkInput();
 
 2835                                         $form_import_text->setValuesByPost();
 
 2836                                         if (
$errors) $checkonly = 
false;
 
 2839                                         $errors = !$form_import_dataset->checkInput();
 
 2840                                         $form_import_dataset->setValuesByPost();
 
 2841                                         if (
$errors) $checkonly = 
false;
 
 2848                         $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_external_mail.html", 
"Modules/Survey");
 
 2849                         $this->tpl->setVariable(
"HEADLINE", $this->lng->txt(
"external_mails_import"));
 
 2850                         $this->tpl->setVariable(
"FORM1", $form_import_file->getHTML());
 
 2851                         $this->tpl->setVariable(
"FORM2", $form_import_text->getHTML());
 
 2852                         $this->tpl->setVariable(
"FORM3", $form_import_dataset->getHTML());
 
 2862                 if (strlen(
$_POST[
"v"]) == 0)
 
 2867                 $survey_questions =& $this->
object->getSurveyQuestions();
 
 2868                 $structure =& 
$_SESSION[
"constraintstructure"];
 
 2869                 $include_elements = 
$_SESSION[
"includeElements"];
 
 2870                 foreach ($include_elements as $elementCounter)
 
 2872                         if (is_array($structure[$elementCounter]))
 
 2874                                 if (strlen(
$_GET[
"precondition"]))
 
 2881                                         foreach ($structure[$elementCounter] as $key => $question_id)
 
 2883                                                 $this->
object->addConstraintToQuestion($question_id, $constraint_id);
 
 2886                                 if (count($structure[$elementCounter]) > 1)
 
 2888                                         $this->
object->updateConjunctionForQuestions($structure[$elementCounter], 
$_POST[
'c']);
 
 2893                 unset(
$_SESSION[
"constraintstructure"]);
 
 2894                 $this->ctrl->redirect($this, 
"constraints");
 
 2902                 $survey_questions =& $this->
object->getSurveyQuestions();
 
 2903                 $structure =& 
$_SESSION[
"constraintstructure"];
 
 2904                 $start = 
$_GET[
"start"];
 
 2905                 $option_questions = array();
 
 2906                 for ($i = 1; $i < $start; $i++)
 
 2908                         if (is_array($structure[$i]))
 
 2910                                 foreach ($structure[$i] as $key => $question_id)
 
 2912                                         if ($survey_questions[$question_id][
"usableForPrecondition"])
 
 2914                                                 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"]));
 
 2919                 if (count($option_questions) == 0)
 
 2922                         unset(
$_SESSION[
"constraintstructure"]);
 
 2923                         ilUtil::sendInfo($this->lng->txt(
"constraints_no_nonessay_available"), 
true);
 
 2924                         $this->ctrl->redirect($this, 
"constraints");
 
 2934                 $survey_questions =& $this->
object->getSurveyQuestions();
 
 2935                 $option_questions = array();
 
 2936                 array_push($option_questions, array(
"question_id" => 
$_POST[
"q"], 
"title" => $survey_questions[
$_POST[
"q"]][
"title"], 
"type_tag" => $survey_questions[$_POST[
"q"]][
"type_tag"]));
 
 2937                 $this->
constraintForm(2, $_POST, $survey_questions, $option_questions);
 
 2945                 $survey_questions =& $this->
object->getSurveyQuestions();
 
 2946                 $option_questions = array();
 
 2947                 if (strlen(
$_GET[
"precondition"]))
 
 2949                         $pc = $this->
object->getPrecondition(
$_GET[
"precondition"]);
 
 2950                         $postvalues = array(
 
 2951                                 "c" => $pc[
"conjunction"],
 
 2952                                 "q" => $pc[
"question_fi"],
 
 2953                                 "r" => $pc[
"relation_id"],
 
 2956                         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"]));
 
 2957                         $this->
constraintForm(3, $postvalues, $survey_questions, $option_questions);
 
 2961                         array_push($option_questions, array(
"question_id" => 
$_POST[
"q"], 
"title" => $survey_questions[
$_POST[
"q"]][
"title"], 
"type_tag" => $survey_questions[$_POST[
"q"]][
"type_tag"]));
 
 2962                         $this->
constraintForm(3, $_POST, $survey_questions, $option_questions);
 
 2966         public function constraintForm($step, $postvalues, &$survey_questions, $questions = FALSE)
 
 2968                 if (strlen(
$_GET[
"start"])) $this->ctrl->setParameter($this, 
"start", 
$_GET[
"start"]);
 
 2969                 $this->ctrl->saveParameter($this, 
"precondition");
 
 2970                 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
 2972                 $form->setFormAction($this->ctrl->getFormAction($this));
 
 2973                 $form->setTableWidth(
"100%");
 
 2974                 $form->setId(
"constraintsForm");
 
 2977                 if ($survey_questions[
$_SESSION[
"constraintstructure"][
$_GET[
"start"]][0]][
"questionblock_id"] > 0)
 
 2979                         $title = $this->lng->txt(
"questionblock") . 
": " . $survey_questions[
$_SESSION[
"constraintstructure"][
$_GET[
"start"]][0]][
"questionblock_title"];
 
 2983                         $title = $this->lng->txt($survey_questions[
$_SESSION[
"constraintstructure"][
$_GET[
"start"]][0]][
"type_tag"]) . 
": " . $survey_questions[
$_SESSION[
"constraintstructure"][$_GET[
"start"]][0]][
"title"];
 
 2986                 $header->setTitle(
$title);
 
 2987                 $form->addItem($header);
 
 2991                 $fulfilled->addOption(
new ilRadioOption($this->lng->txt(
"conjunction_or"), 
'1', 
''));
 
 2992                 $fulfilled->setValue((strlen($postvalues[
'c'])) ? $postvalues[
'c'] : 0);
 
 2993                 $form->addItem($fulfilled);
 
 2995                 $step1 = 
new ilSelectInputGUI($this->lng->txt(
"step") . 
" 1: " . $this->lng->txt(
"select_prior_question"), 
"q");
 
 2997                 if (is_array($questions))
 
 2999                         foreach ($questions as $question)
 
 3004                 $step1->setOptions($options);
 
 3005                 $step1->setValue($postvalues[
"q"]);
 
 3006                 $form->addItem($step1);
 
 3010                         $relations = $this->
object->getAllRelations();
 
 3011                         $step2 = 
new ilSelectInputGUI($this->lng->txt(
"step") . 
" 2: " . $this->lng->txt(
"select_relation"), 
"r");
 
 3013                         foreach ($relations as $rel_id => $relation)
 
 3015                                 if (in_array($relation[
"short"], $survey_questions[$postvalues[
"q"]][
"availableRelations"]))
 
 3017                                         $options[$rel_id] = $relation[
'short'];
 
 3021                         $step2->setValue($postvalues[
"r"]);
 
 3022                         $form->addItem($step2);
 
 3027                         $variables =& $this->
object->getVariables($postvalues[
"q"]);
 
 3028                         $question_type = $survey_questions[$postvalues[
"q"]][
"type_tag"];
 
 3029                         include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
 
 3031                         $question = 
new $question_type();
 
 3032                         $question->loadFromDb($postvalues[
"q"]);
 
 3034                         $step3 = $question->getPreconditionSelectValue($postvalues[
"v"], $this->lng->txt(
"step") . 
" 3: " . $this->lng->txt(
"select_value"), 
"v");
 
 3035                         $form->addItem($step3);
 
 3041                                 $cmd_continue = 
"constraintStep2";
 
 3042                                 $cmd_back = 
"constraints";
 
 3045                                 $cmd_continue = 
"constraintStep3";
 
 3046                                 $cmd_back = 
"constraintStep1";
 
 3049                                 $cmd_continue = 
"constraintsAdd";
 
 3050                                 $cmd_back = 
"constraintStep2";
 
 3053                 $form->addCommandButton($cmd_back, $this->lng->txt(
"back"));
 
 3054                 $form->addCommandButton($cmd_continue, $this->lng->txt(
"continue"));
 
 3056                 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
 
 3064                 $survey_questions =& $this->
object->getSurveyQuestions();
 
 3065                 $structure =& 
$_SESSION[
"constraintstructure"];
 
 3066                 foreach (
$_POST as $key => $value)
 
 3068                         if (preg_match(
"/^constraint_(\d+)_(\d+)/", $key, $matches)) 
 
 3070                                 $this->
object->deleteConstraint($matches[2]);
 
 3074                 $this->ctrl->redirect($this, 
"constraints");
 
 3079                 $include_elements = 
$_POST[
"includeElements"];
 
 3080                 if ((!is_array($include_elements)) || (count($include_elements) == 0))
 
 3082                         ilUtil::sendInfo($this->lng->txt(
"constraints_no_questions_or_questionblocks_selected"), 
true);
 
 3083                         $this->ctrl->redirect($this, 
"constraints");
 
 3085                 else if (count($include_elements) >= 1)
 
 3087                         $_SESSION[
"includeElements"] = $include_elements;
 
 3088                         sort($include_elements, SORT_NUMERIC);
 
 3089                         $_GET[
"start"] = $include_elements[0];
 
 3097                 $this->ctrl->setParameter($this, 
"precondition", 
$_GET[
"precondition"]);
 
 3098                 $this->ctrl->setParameter($this, 
"start", 
$_GET[
"start"]);
 
 3099                 $this->ctrl->redirect($this, 
"constraintStep3");
 
 3111                 $hasDatasets = $this->
object->_hasDatasets($this->object->getSurveyId());
 
 3113                 if (array_key_exists(
"step", 
$_GET))    $step = 
$_GET[
"step"];
 
 3128                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_svy_constraints_list.html", 
"Modules/Survey");
 
 3129                 $survey_questions =& $this->
object->getSurveyQuestions();
 
 3130                 $last_questionblock_title = 
"";
 
 3132                 $hasPreconditions = FALSE;
 
 3133                 $structure = array();
 
 3134                 $colors = array(
"tblrow1", 
"tblrow2");
 
 3135                 foreach ($survey_questions as $question_id => 
$data)
 
 3139                         if (
$data[
"questionblock_id"] > 0)
 
 3142                                 $type = $this->lng->txt(
"questionblock");
 
 3143                                 if (strcmp(
$title, $last_questionblock_title) != 0) 
 
 3145                                         $last_questionblock_title = 
$title;
 
 3146                                         $structure[$counter] = array();
 
 3147                                         array_push($structure[$counter], 
$data[
"question_id"]);
 
 3151                                         array_push($structure[$counter-1], 
$data[
"question_id"]);
 
 3157                                 $structure[$counter] = array(
$data[
"question_id"]);
 
 3158                                 $type = $this->lng->txt(
"question");
 
 3164                                         $this->tpl->setCurrentBlock(
"description");
 
 3165                                         $this->tpl->setVariable(
"DESCRIPTION", $this->lng->txt(
"constraints_first_question_description"));
 
 3166                                         $this->tpl->parseCurrentBlock();
 
 3170                                         $constraints =& $this->
object->getConstraints(
$data[
"question_id"]);
 
 3172                                         if (count($constraints))
 
 3174                                                 $hasPreconditions = TRUE;
 
 3175                                                 foreach ($constraints as $constraint)
 
 3177                                                         $this->tpl->setCurrentBlock(
"constraint");
 
 3178                                                         $this->tpl->setVariable(
"SEQUENCE_ID", $counter);
 
 3179                                                         $this->tpl->setVariable(
"CONSTRAINT_ID", $constraint[
"id"]);
 
 3180                                                         $this->tpl->setVariable(
"CONSTRAINT_TEXT", $survey_questions[$constraint[
"question"]][
"title"] . 
" " . $constraint[
"short"] . 
" " . $constraint[
"valueoutput"]);
 
 3181                                                         $this->tpl->setVariable(
"TEXT_EDIT_PRECONDITION", $this->lng->txt(
"edit"));
 
 3182                                                         $this->ctrl->setParameter($this, 
"precondition", $constraint[
"id"]);
 
 3183                                                         $this->ctrl->setParameter($this, 
"start", $counter);
 
 3184                                                         $this->tpl->setVariable(
"EDIT_PRECONDITION", $this->ctrl->getLinkTarget($this, 
"editPrecondition"));
 
 3185                                                         $this->ctrl->setParameter($this, 
"precondition", 
"");
 
 3186                                                         $this->ctrl->setParameter($this, 
"start", 
"");
 
 3187                                                         $this->tpl->parseCurrentBlock();
 
 3189                                                 if (count($constraints) > 1)
 
 3191                                                         $this->tpl->setCurrentBlock(
"conjunction");
 
 3192                                                         $this->tpl->setVariable(
"TEXT_CONJUNCTION", ($constraints[0][
'conjunction']) ? $this->lng->txt(
'conjunction_or_title') : $this->lng->txt(
'conjunction_and_title'));
 
 3193                                                         $this->tpl->parseCurrentBlock();
 
 3199                                         $this->tpl->setCurrentBlock(
"include_elements");
 
 3200                                         $this->tpl->setVariable(
"QUESTION_NR", 
"$counter");
 
 3201                                         $this->tpl->parseCurrentBlock();
 
 3203                                 $this->tpl->setCurrentBlock(
"constraint_section");
 
 3204                                 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
 
 3205                                 $this->tpl->setVariable(
"QUESTION_NR", 
"$counter");
 
 3206                                 $this->tpl->setVariable(
"TITLE", 
"$title");
 
 3207                                 $icontype = 
"question.gif";
 
 3208                                 if (
$data[
"questionblock_id"] > 0)
 
 3210                                         $icontype = 
"questionblock.gif";
 
 3212                                 $this->tpl->setVariable(
"TYPE", 
"$type: ");
 
 3213                                 include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 3215                                 $this->tpl->setVariable(
"ICON_ALT", $type);
 
 3216                                 $this->tpl->parseCurrentBlock();
 
 3220                 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets)
 
 3222                         if ($hasPreconditions)
 
 3224                                 $this->tpl->setCurrentBlock(
"selectall_preconditions");
 
 3225                                 $this->tpl->setVariable(
"SELECT_ALL_PRECONDITIONS", $this->lng->txt(
"select_all"));
 
 3226                                 $this->tpl->parseCurrentBlock();
 
 3228                         $this->tpl->setCurrentBlock(
"selectall");
 
 3230                         $this->tpl->setVariable(
"SELECT_ALL", $this->lng->txt(
"select_all"));
 
 3231                         $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
 
 3232                         $this->tpl->parseCurrentBlock();
 
 3234                         if ($hasPreconditions)
 
 3236                                 $this->tpl->setCurrentBlock(
"delete_button");
 
 3237                                 $this->tpl->setVariable(
"BTN_DELETE", $this->lng->txt(
"delete"));
 
 3238                                 include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 3239                                 $this->tpl->setVariable(
"ARROW", 
"<img src=\"" . 
ilUtil::getImagePath(
"arrow_downright.gif") . 
"\" alt=\"".$this->lng->txt(
"arrow_downright").
"\">");
 
 3240                                 $this->tpl->parseCurrentBlock();
 
 3243                         $this->tpl->setCurrentBlock(
"buttons");
 
 3244                         $this->tpl->setVariable(
"ARROW", 
"<img src=\"" . 
ilUtil::getImagePath(
"arrow_downright.gif") . 
"\" alt=\"".$this->lng->txt(
"arrow_downright").
"\">");
 
 3245                         $this->tpl->setVariable(
"BTN_CREATE_CONSTRAINTS", $this->lng->txt(
"constraint_add"));
 
 3246                         $this->tpl->parseCurrentBlock();
 
 3248                 $this->tpl->setCurrentBlock(
"adm_content");
 
 3249                 $this->tpl->setVariable(
"CONSTRAINTS_INTRODUCTION", $this->lng->txt(
"constraints_introduction"));
 
 3250                 $this->tpl->setVariable(
"DEFINED_PRECONDITIONS", $this->lng->txt(
"existing_constraints"));
 
 3251                 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this, 
"constraints"));
 
 3252                 $this->tpl->setVariable(
"CONSTRAINTS_HEADER", $this->lng->txt(
"constraints_list_of_entities"));
 
 3253                 $this->tpl->parseCurrentBlock();
 
 3254                 $_SESSION[
"constraintstructure"] = $structure;
 
 3268                 $this->ctrl->setCmd(
"showSummary");
 
 3269                 $this->ctrl->setCmdClass(
"ilinfoscreengui");
 
 3276                 $tpl = 
new ilTemplate(
"tpl.il_svy_svy_main.html", TRUE, TRUE, 
"Modules/Survey");
 
 3279                 $tpl->setVariable(
"LOCATION_STYLESHEET",$location_stylesheet);
 
 3280                 $tpl->setVariable(
"LOCATION_JAVASCRIPT",dirname($location_stylesheet));
 
 3291                 if (!$ilAccess->checkAccess(
"visible", 
"", $this->ref_id))
 
 3293                         $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
 
 3296                 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
 
 3298                 include_once 
"./Modules/Survey/classes/class.ilSurveyExecutionGUI.php";
 
 3300                 $info->setFormAction($this->ctrl->getFormAction($output_gui, 
"infoScreen"));
 
 3301                 $info->enablePrivateNotes();
 
 3302                 $anonymize_key = NULL;
 
 3303                 if ($this->object->getAnonymize() == 1)
 
 3305                         if (
$_SESSION[
"anonymous_id"][$this->object->getId()])
 
 3307                                 $anonymize_key = 
$_SESSION[
"anonymous_id"][$this->
object->getId()];
 
 3309                         else if (
$_POST[
"anonymous_id"])
 
 3311                                 $anonymize_key = 
$_POST[
"anonymous_id"];
 
 3314                 $canStart = $this->
object->canStartSurvey($anonymize_key);
 
 3315                 $showButtons = $canStart[
"result"];
 
 3316                 if (!$showButtons) 
ilUtil::sendInfo(implode(
"<br />", $canStart[
"messages"]));
 
 3321                         if (!$this->object->getAnonymize())
 
 3323                                 $survey_started = $this->
object->isSurveyStarted($ilUser->getId(), 
"");
 
 3325                                 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
 
 3331                                         if ($survey_started === 1)
 
 3335                                         elseif ($survey_started === 0)
 
 3337                                                 $info->addFormButton(
"resume", $this->lng->txt(
"resume_survey"));
 
 3339                                         elseif ($survey_started === FALSE)
 
 3341                                                 $info->addFormButton(
"start", $this->lng->txt(
"start_survey"));
 
 3346                         else if ($this->object->getAnonymize() && !$this->
object->isAccessibleWithoutCode())
 
 3348                                 if ((
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID) && (strlen(
$_POST[
"anonymous_id"]) == 0) && (strlen(
$_SESSION[
"anonymous_id"][$this->object->getId()]) == 0))
 
 3350                                         $info->setFormAction($this->ctrl->getFormAction($this, 
"infoScreen"));
 
 3351                                         $info->addSection($this->lng->txt(
"anonymization"));
 
 3352                                         $info->addProperty(
"", $this->lng->txt(
"anonymize_anonymous_introduction"));
 
 3353                                         $info->addPropertyTextinput($this->lng->txt(
"enter_anonymous_id"), 
"anonymous_id", 
"", 8, 
"infoScreen", $this->lng->txt(
"submit"));
 
 3357                                         if (strlen(
$_POST[
"anonymous_id"]) > 0)
 
 3359                                                 if (!$this->object->checkSurveyCode(
$_POST[
"anonymous_id"]))
 
 3365                                                         $anonymize_key = 
$_POST[
"anonymous_id"];
 
 3368                                         else if (strlen(
$_SESSION[
"anonymous_id"][$this->object->getId()]) > 0)
 
 3370                                                 if (!$this->object->checkSurveyCode(
$_SESSION[
"anonymous_id"][$this->object->getId()]))
 
 3376                                                         $anonymize_key = 
$_SESSION[
"anonymous_id"][$this->
object->getId()];
 
 3382                                                 $anonymize_key = $this->
object->getUserAccessCode($ilUser->getId());
 
 3383                                                 if (!strlen($anonymize_key))
 
 3385                                                         $anonymize_key = $this->
object->createNewAccessCode();
 
 3386                                                         $this->
object->saveUserAccessCode($ilUser->getId(), $anonymize_key);
 
 3389                                         $info->addHiddenElement(
"anonymous_id", $anonymize_key);
 
 3390                                         $survey_started = $this->
object->isSurveyStarted($ilUser->getId(), $anonymize_key);
 
 3391                                         if ($survey_started === 1)
 
 3395                                         elseif ($survey_started === 0)
 
 3397                                                 $info->addFormButton(
"resume", $this->lng->txt(
"resume_survey"));
 
 3399                                         elseif ($survey_started === FALSE)
 
 3401                                                 $info->addFormButton(
"start", $this->lng->txt(
"start_survey"));
 
 3408                                 $survey_started = $this->
object->isSurveyStarted($ilUser->getId(), 
"");
 
 3409                                 if ($survey_started === 1)
 
 3413                                 elseif ($survey_started === 0)
 
 3415                                         $info->addFormButton(
"resume", $this->lng->txt(
"resume_survey"));
 
 3417                                 elseif ($survey_started === FALSE)
 
 3419                                         $info->addFormButton(
"start", $this->lng->txt(
"start_survey"));
 
 3424                 if (strlen($this->object->getIntroduction()))
 
 3426                         $introduction = $this->
object->getIntroduction();
 
 3427                         $info->addSection($this->lng->txt(
"introduction"));
 
 3428                         $info->addProperty(
"", $this->object->prepareTextareaOutput($introduction));
 
 3431                 $info->addSection($this->lng->txt(
"svy_general_properties"));
 
 3432                 if (strlen($this->object->getAuthor()))
 
 3434                         $info->addProperty($this->lng->txt(
"author"), $this->
object->getAuthor());
 
 3436                 $info->addProperty($this->lng->txt(
"title"), $this->
object->getTitle());
 
 3437                 switch ($this->object->getAnonymize())
 
 3440                                 $info->addProperty($this->lng->txt(
"anonymization"), $this->lng->txt(
"anonymize_personalized"));
 
 3443                                 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
 
 3445                                         $info->addProperty($this->lng->txt(
"anonymization"), $this->lng->txt(
"info_anonymize_with_code"));
 
 3449                                         $info->addProperty($this->lng->txt(
"anonymization"), $this->lng->txt(
"info_anonymize_registered_user"));
 
 3453                                 $info->addProperty($this->lng->txt(
"anonymization"), $this->lng->txt(
"info_anonymize_without_code"));
 
 3456                 include_once 
"./Modules/Survey/classes/class.ilObjSurveyAccess.php";
 
 3459                         $info->addProperty($this->lng->txt(
"evaluation_access"), $this->lng->txt(
"evaluation_access_info"));
 
 3461                 $info->addMetaDataSections($this->object->getId(),0, $this->
object->getType());
 
 3462                 $this->ctrl->forwardCommand($info);
 
 3475                 $template = 
new ilTemplate(
"tpl.il_svy_svy_printview.html", TRUE, TRUE, 
"Modules/Survey");
 
 3477                 include_once 
'./Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
 
 3480                         $this->ctrl->setParameter($this, 
"pdf", 
"1");
 
 3481                         $template->setCurrentBlock(
"pdf_export");
 
 3482                         $template->setVariable(
"PDF_URL", $this->ctrl->getLinkTarget($this, 
"printView"));
 
 3483                         $this->ctrl->setParameter($this, 
"pdf", 
"");
 
 3484                         $template->setVariable(
"PDF_TEXT", $this->lng->txt(
"pdf_export"));
 
 3485                         $template->setVariable(
"PDF_IMG_ALT", $this->lng->txt(
"pdf_export"));
 
 3487                         $template->parseCurrentBlock();
 
 3489                 $template->setVariable(
"PRINT_TEXT", $this->lng->txt(
"print"));
 
 3490                 $template->setVariable(
"PRINT_URL", 
"javascript:window.print();");
 
 3492                 $pages =& $this->
object->getSurveyPages();
 
 3493                 foreach ($pages as $page)
 
 3495                         if (count($page) > 0)
 
 3497                                 foreach ($page as $question)
 
 3499                                         $questionGUI = $this->
object->getQuestionGUI($question[
"type_tag"], $question[
"question_id"]);
 
 3500                                         if (is_object($questionGUI))
 
 3502                                                 if (strlen($question[
"heading"]))
 
 3504                                                         $template->setCurrentBlock(
"textblock");
 
 3505                                                         $template->setVariable(
"TEXTBLOCK", $question[
"heading"]);
 
 3506                                                         $template->parseCurrentBlock();
 
 3508                                                 $template->setCurrentBlock(
"question");
 
 3509                                                 $template->setVariable(
"QUESTION_DATA", $questionGUI->getPrintView($this->object->getShowQuestionTitles(), $question[
"questionblock_show_questiontext"], $this->
object->getSurveyId()));
 
 3510                                                 $template->parseCurrentBlock();
 
 3513                                 if (count($page) > 1)
 
 3515                                         $template->setCurrentBlock(
"page");
 
 3516                                         $template->setVariable(
"BLOCKTITLE", $page[0][
"questionblock_title"]);
 
 3517                                         $template->parseCurrentBlock();
 
 3521                                         $template->setCurrentBlock(
"page");
 
 3522                                         $template->parseCurrentBlock();
 
 3526                 $this->tpl->addCss(
"./Modules/Survey/templates/default/survey_print.css", 
"print");
 
 3527                 if (array_key_exists(
"pdf", 
$_GET) && (
$_GET[
"pdf"] == 1))
 
 3529                         $printbody = 
new ilTemplate(
"tpl.il_as_tst_print_body.html", TRUE, TRUE, 
"Modules/Test");
 
 3530                         $printbody->setVariable(
"TITLE", sprintf($this->lng->txt(
"tst_result_user_name"), $uname));
 
 3531                         $printbody->setVariable(
"ADM_CONTENT", $template->get());
 
 3532                         $printoutput = $printbody->get();
 
 3533                         $printoutput = preg_replace(
"/href=\".*?\"/", 
"", $printoutput);
 
 3534                         $fo = $this->
object->processPrintoutput2FO($printoutput);
 
 3535                         $this->
object->deliverPDFfromFO($fo);
 
 3539                         $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
 
 3546                 switch ($this->ctrl->getCmd())
 
 3552                         case "redirectQuestion":
 
 3553                                 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, 
"infoScreen"), 
"", 
$_GET[
"ref_id"]);
 
 3556                         case "checkEvaluationAccess":
 
 3557                         case "evaluationdetails":
 
 3558                         case "evaluationuser":
 
 3559                                 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui", 
"evaluation"), 
"", 
$_GET[
"ref_id"]);
 
 3568                                 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, 
"infoScreen"), 
"", 
$_GET[
"ref_id"]);
 
 3571                                 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, 
""), 
"", 
$_GET[
"ref_id"]);
 
 3585                 $questions = ($a_cmd == 
'questions') ? 
true : 
false;
 
 3586                 $printview = ($a_cmd == 
'printview') ? 
true : 
false;
 
 3588                 $this->tabs_gui->addSubTabTarget(
"survey_question_editor", $this->ctrl->getLinkTarget($this, 
"questions"),
 
 3589                                                                                  "", 
"", 
"", $questions);
 
 3590                 $this->tabs_gui->addSubTabTarget(
"print_view", $this->ctrl->getLinkTarget($this, 
"printView"),
 
 3591                                                                                         "", 
"", 
"", $printview);
 
 3604                 $ilTabs->addSubTabTarget
 
 3607                         $this->ctrl->getLinkTarget($this,
'codes'),
 
 3608                         array(
"codes", 
"createSurveyCodes", 
"setCodeLanguage", 
"deleteCodes", 
"exportCodes"),
 
 3612                 $ilTabs->addSubTabTarget
 
 3614                         "participating_users", 
 
 3615                         $this->ctrl->getLinkTarget($this, 
"codesMail"), 
 
 3616                         array(
"codesMail", 
"saveMailTableFields", 
"importExternalMailRecipients", 
 
 3617                         'importExternalRecipientsFromFile', 
'importExternalRecipientsFromText',
 
 3618                         'importExternalRecipientsFromDataset'), 
 
 3622                 $data = $this->
object->getExternalCodeRecipients();
 
 3625                         $ilTabs->addSubTabTarget
 
 3627                                 "mail_survey_codes", 
 
 3628                                 $this->ctrl->getLinkTarget($this, 
"mailCodes"), 
 
 3629                                 array(
"mailCodes", 
"sendCodesMail", 
"insertSavedMessage", 
"deleteSavedMessage"),        
 
 3645                 $ilTabs->addSubTabTarget(
 
 3646                         "svy_eval_cumulated", 
 
 3647                         $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui", 
"evaluation"), 
 
 3648                         array(
"evaluation", 
"checkEvaluationAccess"),   
 
 3652                 $ilTabs->addSubTabTarget(
 
 3654                         $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui", 
"evaluationdetails"), 
 
 3655                         array(
"evaluationdetails"),     
 
 3659                 if ($ilAccess->checkAccess(
"write", 
"", $this->object->getRefId()))
 
 3661                         $ilTabs->addSubTabTarget(
 
 3663                                 $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui", 
"evaluationuser"), 
 
 3664                                 array(
"evaluationuser"),        
 
 3675                 if ($ilAccess->checkAccess(
"write", 
"", $this->ref_id))
 
 3677                         $ilTabs->setBackTarget($this->lng->txt(
"menubacktosurvey"), $this->ctrl->getLinkTarget($this, 
"questions"));
 
 3678                         $ilTabs->addTarget(
"browse_for_questions",
 
 3679                                 $this->ctrl->getLinkTarget($this, 
"browseForQuestions"),
 
 3680                                  array(
"browseForQuestions", 
"browseForQuestionblocks"),
 
 3693                 global $ilAccess, $ilUser;
 
 3695                 if (strcmp($this->ctrl->getNextClass(), 
'ilrepositorysearchgui') != 0)
 
 3697                         switch ($this->ctrl->getCmd())
 
 3699                                 case "browseForQuestions":
 
 3700                                 case "browseForQuestionblocks":
 
 3701                                 case "insertQuestions":
 
 3702                                 case "filterQuestions":
 
 3703                                 case "resetFilterQuestions":
 
 3704                                 case "changeDatatype":
 
 3710                                 case "redirectQuestion":
 
 3714                                 case "checkEvaluationAccess":
 
 3715                                 case "evaluationdetails":
 
 3716                                 case "evaluationuser":
 
 3723                 if ($ilAccess->checkAccess(
"write", 
"", $this->ref_id))
 
 3725                         $force_active = (
$_GET[
"up"] != 
"" || 
$_GET[
"down"] != 
"")
 
 3729                         $tabs_gui->addTarget(
"survey_questions",
 
 3730                                  $this->ctrl->getLinkTarget($this,
'questions'),
 
 3731                                  array(
"questions", 
"browseForQuestions", 
"createQuestion",
 
 3732                                  "filterQuestions", 
"resetFilterQuestions", 
"changeDatatype", 
"insertQuestions",
 
 3733                                  "removeQuestions", 
"cancelRemoveQuestions", 
"confirmRemoveQuestions",
 
 3734                                  "defineQuestionblock", 
"saveDefineQuestionblock", 
"cancelDefineQuestionblock",
 
 3735                                  "unfoldQuestionblock", 
"moveQuestions",
 
 3736                                  "insertQuestionsBefore", 
"insertQuestionsAfter", 
"saveObligatory",
 
 3737                                  "addHeading", 
"saveHeading", 
"cancelHeading", 
"editHeading",
 
 3738                                  "confirmRemoveHeading", 
"cancelRemoveHeading", 
"printView"),
 
 3739                                  "", 
"", $force_active);
 
 3742                 if ($ilAccess->checkAccess(
"visible", 
"", $this->ref_id))
 
 3744                         $tabs_gui->addTarget(
"info_short",
 
 3745                                  $this->ctrl->getLinkTarget($this,
'infoScreen'),
 
 3746                                  array(
"infoScreen", 
"showSummary"));
 
 3750                 if ($ilAccess->checkAccess(
"write", 
"", $this->ref_id))
 
 3752                         $force_active = ($this->ctrl->getCmd() == 
"")
 
 3755                         $tabs_gui->addTarget(
"settings",
 
 3756                                  $this->ctrl->getLinkTarget($this,
'properties'),
 
 3757                                  array(
"properties", 
"save", 
"cancel", 
'saveProperties'), 
"",
 
 3762                 if ($ilAccess->checkAccess(
"write", 
"", $this->ref_id))
 
 3765                         $tabs_gui->addTarget(
"constraints",
 
 3766                                  $this->ctrl->getLinkTarget($this, 
"constraints"),
 
 3767                                  array(
"constraints", 
"constraintStep1", 
"constraintStep2",
 
 3768                                  "constraintStep3", 
"constraintsAdd", 
"createConstraints",
 
 3769                                 "editPrecondition"),
 
 3773                 if (($ilAccess->checkAccess(
"write", 
"", $this->ref_id)) || ($ilAccess->checkAccess(
"invite", 
"", $this->ref_id)))
 
 3776                         $tabs_gui->addTarget(
"invitation",
 
 3777                                  $this->ctrl->getLinkTarget($this, 
'invite'),
 
 3778                                  array(
"invite", 
"saveInvitationStatus",
 
 3779                                  "inviteUserGroup", 
"disinviteUserGroup"),
 
 3783                 if ($ilAccess->checkAccess(
"write", 
"", $this->ref_id))
 
 3786                         $tabs_gui->addTarget(
"maintenance",
 
 3787                                  $this->ctrl->getLinkTarget($this,
'maintenance'),
 
 3788                                  array(
"maintenance", 
"deleteAllUserData"),
 
 3791                         if ($this->object->getAnonymize() == 1)
 
 3794                                 $tabs_gui->addTarget(
"codes",
 
 3795                                          $this->ctrl->getLinkTarget($this,
'codes'),
 
 3796                                          array(
"codes", 
"exportCodes", 
'codesMail', 
'saveMailTableFields', 
'importExternalMailRecipients',
 
 3797                                                 'mailCodes', 
'sendCodesMail', 
'importExternalRecipientsFromFile', 
'importExternalRecipientsFromText',
 
 3798                                                 'importExternalRecipientsFromDataset', 
'insertSavedMessage', 
'deleteSavedMessage'),
 
 3803                 include_once 
"./Modules/Survey/classes/class.ilObjSurveyAccess.php";
 
 3807                         $tabs_gui->addTarget(
"svy_evaluation",
 
 3808                                  $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui", 
"evaluation"),
 
 3809                                  array(
"evaluation", 
"checkEvaluationAccess", 
"evaluationdetails",
 
 3814                 if ($ilAccess->checkAccess(
"write", 
"", $this->ref_id))
 
 3817                         $tabs_gui->addTarget(
"meta_data",
 
 3818                                  $this->ctrl->getLinkTargetByClass(
'ilmdeditorgui',
'listSection'),
 
 3819                                  "", 
"ilmdeditorgui");
 
 3822                         $tabs_gui->addTarget(
"export",
 
 3823                                  $this->ctrl->getLinkTarget($this,
'export'),
 
 3824                                  array(
"export", 
"createExportFile", 
"confirmDeleteExportFile",
 
 3825                                  "downloadExportFile"), 
 
 3830                 if ($ilAccess->checkAccess(
"edit_permission", 
"", $this->ref_id))
 
 3833                         $tabs_gui->addTarget(
"perm_settings",
 
 3834                                 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'), 
"perm"), array(
"perm",
"info",
"owner"), 
'ilpermissiongui');
 
 3843         function _goto($a_target, $a_access_code = 
"")
 
 3846                 if ($ilAccess->checkAccess(
"read", 
"", $a_target))
 
 3848                         include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 3849                         if (strlen($a_access_code))
 
 3852                                 $_GET[
"baseClass"] = 
"ilObjSurveyGUI";
 
 3853                                 $_GET[
"cmd"] = 
"infoScreen";
 
 3854                                 $_GET[
"ref_id"] = $a_target;
 
 3855                                 include(
"ilias.php");
 
 3860                                 $_GET[
"baseClass"] = 
"ilObjSurveyGUI";
 
 3861                                 $_GET[
"cmd"] = 
"infoScreen";
 
 3862                                 $_GET[
"ref_id"] = $a_target;
 
 3863                                 include(
"ilias.php");
 
 3867                 else if ($ilAccess->checkAccess(
"read", 
"", ROOT_FOLDER_ID))
 
 3869                         $_GET[
"cmd"] = 
"frameset";
 
 3870                         $_GET[
"target"] = 
"";
 
 3871                         $_GET[
"ref_id"] = ROOT_FOLDER_ID;
 
 3874                         include(
"repository.php");
 
 3878                 $ilErr->raiseError($lng->txt(
"msg_no_perm_read_lm"), $ilErr->FATAL);