40 include_once
"./classes/class.ilObjectGUI.php";
41 include_once
"./Modules/Survey/classes/inc.SurveyConstants.php";
54 $lng->loadLanguageModule(
"survey");
56 $this->ctrl->saveParameter($this,
"ref_id");
63 include_once
"./Services/Utilities/classes/class.ilUtil.php";
64 $path = $this->tree->getPathFull($this->object->getRefID());
73 global $ilAccess, $ilNavigationHistory;
77 $ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"]))
79 $ilNavigationHistory->addItem(
$_GET[
"ref_id"],
80 "ilias.php?baseClass=ilObjSurveyGUI&cmd=infoScreen&ref_id=".
$_GET[
"ref_id"],
"svy");
83 $cmd = $this->ctrl->getCmd(
"properties");
84 $next_class = $this->ctrl->getNextClass($this);
85 $this->ctrl->setReturn($this,
"properties");
92 case "ilinfoscreengui":
96 include_once
'Services/MetaData/classes/class.ilMDEditorGUI.php';
97 $md_gui =&
new ilMDEditorGUI($this->object->getId(), 0, $this->
object->getType());
98 $md_gui->
addObserver($this->
object,
'MDUpdateListener',
'General');
100 $this->ctrl->forwardCommand($md_gui);
103 case "ilsurveyevaluationgui":
104 include_once(
"./Modules/Survey/classes/class.ilSurveyEvaluationGUI.php");
106 $ret =& $this->ctrl->forwardCommand($eval_gui);
109 case "ilsurveyexecutiongui":
110 include_once(
"./Modules/Survey/classes/class.ilSurveyExecutionGUI.php");
112 $ret =& $this->ctrl->forwardCommand($exec_gui);
115 case 'ilpermissiongui':
116 include_once(
"./classes/class.ilPermissionGUI.php");
118 $ret =& $this->ctrl->forwardCommand($perm_gui);
126 if (strtolower(
$_GET[
"baseClass"]) !=
"iladministrationgui" &&
145 ilUtil::redirect(
"ilias.php?baseClass=ilObjSurveyGUI&ref_id=".$newObj->getRefId().
"&cmd=properties");
169 $this->ctrl->redirect($this,
"properties");
181 include_once
"./Services/Utilities/classes/class.ilUtil.php";
183 if ($_POST[
"status"] == 1)
187 $result = $this->
object->setStatus($status);
192 $this->
object->setEvaluationAccess($_POST[
"evaluation_access"]);
193 $this->
object->setStartDate(sprintf(
"%04d-%02d-%02d", $_POST[
"start_date"][
"y"], $_POST[
"start_date"][
"m"], $_POST[
"start_date"][
"d"]));
194 $this->
object->setStartDateEnabled($_POST[
"checked_start_date"]);
195 $this->
object->setEndDate(sprintf(
"%04d-%02d-%02d", $_POST[
"end_date"][
"y"], $_POST[
"end_date"][
"m"], $_POST[
"end_date"][
"d"]));
196 $this->
object->setEndDateEnabled($_POST[
"checked_end_date"]);
198 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
200 $this->
object->setIntroduction($introduction);
202 $this->
object->setOutro($outro);
204 $hasDatasets = $this->
object->_hasDatasets($this->object->getSurveyId());
207 $anonymize = $_POST[
"anonymize"];
210 $codes = $_POST[
"codes"];
211 $anonymize += $codes;
213 $this->
object->setAnonymize($anonymize);
215 if ($_POST[
"showQuestionTitles"])
217 $this->
object->showQuestionTitles();
221 $this->
object->hideQuestionTitles();
223 $this->update = $this->
object->update();
224 $this->
object->saveToDb();
233 $this->ctrl->redirect($this,
"properties");
246 if (!$ilAccess->checkAccess(
"write",
"", $this->ref_id))
250 $this->ctrl->redirect($this,
"infoScreen");
265 if (strlen($this->ctrl->getCmdClass()) == 0) $this->ctrl->setCmdClass(
"ilobjsurveygui");
266 include_once
"./Services/Utilities/classes/class.ilUtil.php";
267 $this->lng->loadLanguageModule(
"jscalendar");
268 $this->tpl->addBlockFile(
"CALENDAR_LANG_JAVASCRIPT",
"calendar_javascript",
"tpl.calendar.html");
269 $this->tpl->setCurrentBlock(
"calendar_javascript");
270 $this->tpl->setVariable(
"FULL_SUNDAY", $this->lng->txt(
"l_su"));
271 $this->tpl->setVariable(
"FULL_MONDAY", $this->lng->txt(
"l_mo"));
272 $this->tpl->setVariable(
"FULL_TUESDAY", $this->lng->txt(
"l_tu"));
273 $this->tpl->setVariable(
"FULL_WEDNESDAY", $this->lng->txt(
"l_we"));
274 $this->tpl->setVariable(
"FULL_THURSDAY", $this->lng->txt(
"l_th"));
275 $this->tpl->setVariable(
"FULL_FRIDAY", $this->lng->txt(
"l_fr"));
276 $this->tpl->setVariable(
"FULL_SATURDAY", $this->lng->txt(
"l_sa"));
277 $this->tpl->setVariable(
"SHORT_SUNDAY", $this->lng->txt(
"s_su"));
278 $this->tpl->setVariable(
"SHORT_MONDAY", $this->lng->txt(
"s_mo"));
279 $this->tpl->setVariable(
"SHORT_TUESDAY", $this->lng->txt(
"s_tu"));
280 $this->tpl->setVariable(
"SHORT_WEDNESDAY", $this->lng->txt(
"s_we"));
281 $this->tpl->setVariable(
"SHORT_THURSDAY", $this->lng->txt(
"s_th"));
282 $this->tpl->setVariable(
"SHORT_FRIDAY", $this->lng->txt(
"s_fr"));
283 $this->tpl->setVariable(
"SHORT_SATURDAY", $this->lng->txt(
"s_sa"));
284 $this->tpl->setVariable(
"FULL_JANUARY", $this->lng->txt(
"l_01"));
285 $this->tpl->setVariable(
"FULL_FEBRUARY", $this->lng->txt(
"l_02"));
286 $this->tpl->setVariable(
"FULL_MARCH", $this->lng->txt(
"l_03"));
287 $this->tpl->setVariable(
"FULL_APRIL", $this->lng->txt(
"l_04"));
288 $this->tpl->setVariable(
"FULL_MAY", $this->lng->txt(
"l_05"));
289 $this->tpl->setVariable(
"FULL_JUNE", $this->lng->txt(
"l_06"));
290 $this->tpl->setVariable(
"FULL_JULY", $this->lng->txt(
"l_07"));
291 $this->tpl->setVariable(
"FULL_AUGUST", $this->lng->txt(
"l_08"));
292 $this->tpl->setVariable(
"FULL_SEPTEMBER", $this->lng->txt(
"l_09"));
293 $this->tpl->setVariable(
"FULL_OCTOBER", $this->lng->txt(
"l_10"));
294 $this->tpl->setVariable(
"FULL_NOVEMBER", $this->lng->txt(
"l_11"));
295 $this->tpl->setVariable(
"FULL_DECEMBER", $this->lng->txt(
"l_12"));
296 $this->tpl->setVariable(
"SHORT_JANUARY", $this->lng->txt(
"s_01"));
297 $this->tpl->setVariable(
"SHORT_FEBRUARY", $this->lng->txt(
"s_02"));
298 $this->tpl->setVariable(
"SHORT_MARCH", $this->lng->txt(
"s_03"));
299 $this->tpl->setVariable(
"SHORT_APRIL", $this->lng->txt(
"s_04"));
300 $this->tpl->setVariable(
"SHORT_MAY", $this->lng->txt(
"s_05"));
301 $this->tpl->setVariable(
"SHORT_JUNE", $this->lng->txt(
"s_06"));
302 $this->tpl->setVariable(
"SHORT_JULY", $this->lng->txt(
"s_07"));
303 $this->tpl->setVariable(
"SHORT_AUGUST", $this->lng->txt(
"s_08"));
304 $this->tpl->setVariable(
"SHORT_SEPTEMBER", $this->lng->txt(
"s_09"));
305 $this->tpl->setVariable(
"SHORT_OCTOBER", $this->lng->txt(
"s_10"));
306 $this->tpl->setVariable(
"SHORT_NOVEMBER", $this->lng->txt(
"s_11"));
307 $this->tpl->setVariable(
"SHORT_DECEMBER", $this->lng->txt(
"s_12"));
308 $this->tpl->setVariable(
"ABOUT_CALENDAR", $this->lng->txt(
"about_calendar"));
309 $this->tpl->setVariable(
"ABOUT_CALENDAR_LONG", $this->lng->txt(
"about_calendar_long"));
310 $this->tpl->setVariable(
"ABOUT_TIME_LONG", $this->lng->txt(
"about_time"));
311 $this->tpl->setVariable(
"PREV_YEAR", $this->lng->txt(
"prev_year"));
312 $this->tpl->setVariable(
"PREV_MONTH", $this->lng->txt(
"prev_month"));
313 $this->tpl->setVariable(
"GO_TODAY", $this->lng->txt(
"go_today"));
314 $this->tpl->setVariable(
"NEXT_MONTH", $this->lng->txt(
"next_month"));
315 $this->tpl->setVariable(
"NEXT_YEAR", $this->lng->txt(
"next_year"));
316 $this->tpl->setVariable(
"SEL_DATE", $this->lng->txt(
"select_date"));
317 $this->tpl->setVariable(
"DRAG_TO_MOVE", $this->lng->txt(
"drag_to_move"));
318 $this->tpl->setVariable(
"PART_TODAY", $this->lng->txt(
"part_today"));
319 $this->tpl->setVariable(
"DAY_FIRST", $this->lng->txt(
"day_first"));
320 $this->tpl->setVariable(
"CLOSE", $this->lng->txt(
"close"));
321 $this->tpl->setVariable(
"TODAY", $this->lng->txt(
"today"));
322 $this->tpl->setVariable(
"TIME_PART", $this->lng->txt(
"time_part"));
323 $this->tpl->setVariable(
"DEF_DATE_FORMAT", $this->lng->txt(
"def_date_format"));
324 $this->tpl->setVariable(
"TT_DATE_FORMAT", $this->lng->txt(
"tt_date_format"));
325 $this->tpl->setVariable(
"WK", $this->lng->txt(
"wk"));
326 $this->tpl->setVariable(
"TIME", $this->lng->txt(
"time"));
327 $this->tpl->parseCurrentBlock();
328 $this->tpl->setCurrentBlock(
"CalendarJS");
329 $this->tpl->setVariable(
"LOCATION_JAVASCRIPT_CALENDAR",
"./Modules/Survey/js/calendar/calendar.js");
330 $this->tpl->setVariable(
"LOCATION_JAVASCRIPT_CALENDAR_SETUP",
"./Modules/Survey/js/calendar/calendar-setup.js");
331 $this->tpl->setVariable(
"LOCATION_JAVASCRIPT_CALENDAR_STYLESHEET",
"./Modules/Survey/js/calendar/calendar.css");
332 $this->tpl->parseCurrentBlock();
334 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_properties.html",
"Modules/Survey");
335 $this->tpl->setCurrentBlock(
"adm_content");
336 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"properties"));
337 $this->tpl->setVariable(
"TEXT_INTRODUCTION", $this->lng->txt(
"introduction"));
338 $this->tpl->setVariable(
"VALUE_INTRODUCTION",
ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($this->object->getIntroduction())));
339 $this->tpl->setVariable(
"TEXT_OUTRO", $this->lng->txt(
"outro"));
340 $this->tpl->setVariable(
"VALUE_OUTRO",
ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($this->object->getOutro())));
341 $this->tpl->setVariable(
"TEXT_STATUS", $this->lng->txt(
"online"));
342 $this->tpl->setVariable(
"TEXT_START_DATE", $this->lng->txt(
"start_date"));
343 $this->tpl->setVariable(
"VALUE_START_DATE",
ilUtil::makeDateSelect(
"start_date", $this->object->getStartYear(), $this->
object->getStartMonth(), $this->
object->getStartDay()));
345 $this->tpl->setVariable(
"TXT_START_DATE_CALENDAR", $this->lng->txt(
"open_calendar"));
346 $this->tpl->setVariable(
"TEXT_END_DATE", $this->lng->txt(
"end_date"));
347 $this->tpl->setVariable(
"VALUE_END_DATE",
ilUtil::makeDateSelect(
"end_date", $this->object->getEndYear(), $this->
object->getEndMonth(), $this->
object->getEndDay()));
349 $this->tpl->setVariable(
"TXT_END_DATE_CALENDAR", $this->lng->txt(
"open_calendar"));
350 $this->tpl->setVariable(
"TEXT_EVALUATION_ACCESS", $this->lng->txt(
"evaluation_access"));
351 $this->tpl->setVariable(
"DESCRIPTION_EVALUATION_ACCESS", $this->lng->txt(
"evaluation_access_description"));
352 $this->tpl->setVariable(
"TEXT_ENABLED", $this->lng->txt(
"enabled"));
353 $this->tpl->setVariable(
"VALUE_OFF", $this->lng->txt(
"evaluation_access_off"));
354 $this->tpl->setVariable(
"VALUE_ALL", $this->lng->txt(
"evaluation_access_all"));
355 $this->tpl->setVariable(
"VALUE_PARTICIPANTS", $this->lng->txt(
"evaluation_access_participants"));
357 $this->tpl->setVariable(
"TEXT_ANONYMIZATION", $this->lng->txt(
"anonymization"));
359 $hasDatasets = $this->
object->_hasDatasets($this->object->getSurveyId());
362 $this->tpl->setVariable(
"DISABLED_ANONYMIZATION",
" disabled=\"disabled\"");
365 $this->tpl->setVariable(
"DESCRIPTION_ANONYMIZATION", $this->lng->txt(
"anonymize_survey_description"));
366 $this->tpl->setVariable(
"ANON_VALUE_OFF", $this->lng->txt(
"off"));
367 $this->tpl->setVariable(
"ANON_VALUE_ON", $this->lng->txt(
"on_additional"));
368 $this->tpl->setVariable(
"VALUE_NOCODES", $this->lng->txt(
"anonymize_without_code"));
369 $this->tpl->setVariable(
"VALUE_CODES", $this->lng->txt(
"anonymize_with_code"));
370 switch ($this->object->getAnonymize())
373 $this->tpl->setVariable(
"ANON_CHECKED_OFF",
" checked=\"checked\"");
374 $this->tpl->setVariable(
"CHECKED_CODES",
" checked=\"checked\"");
377 $this->tpl->setVariable(
"ANON_CHECKED_ON",
" checked=\"checked\"");
378 $this->tpl->setVariable(
"CHECKED_CODES",
" checked=\"checked\"");
381 $this->tpl->setVariable(
"ANON_CHECKED_ON",
" checked=\"checked\"");
382 $this->tpl->setVariable(
"CHECKED_NOCODES",
" checked=\"checked\"");
386 if ($this->object->getEndDateEnabled())
388 $this->tpl->setVariable(
"CHECKED_END_DATE",
" checked=\"checked\"");
390 if ($this->object->getStartDateEnabled())
392 $this->tpl->setVariable(
"CHECKED_START_DATE",
" checked=\"checked\"");
394 switch ($this->object->getEvaluationAccess())
397 $this->tpl->setVariable(
"CHECKED_OFF",
" checked=\"checked\"");
400 $this->tpl->setVariable(
"CHECKED_ALL",
" checked=\"checked\"");
403 $this->tpl->setVariable(
"CHECKED_PARTICIPANTS",
" checked=\"checked\"");
408 $this->tpl->setVariable(
"CHECKED_STATUS",
" checked=\"checked\"");
410 $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save"));
411 $this->tpl->setVariable(
"CANCEL", $this->lng->txt(
"cancel"));
412 $this->tpl->setVariable(
"TEXT_SHOW_QUESTIONTITLES", $this->lng->txt(
"svy_show_questiontitles"));
413 if ($this->object->getShowQuestionTitles())
415 $this->tpl->setVariable(
"QUESTIONTITLES_CHECKED",
" checked=\"checked\"");
417 $this->tpl->parseCurrentBlock();
419 include_once
"./Services/RTE/classes/class.ilRTE.php";
421 include_once
"./Services/RTE/classes/class.$rtestring.php";
422 $rte =
new $rtestring();
423 include_once
"./classes/class.ilObject.php";
426 $rte->addRTESupport(
$obj_id, $obj_type,
"survey");
462 $this->ctrl->setParameter($this,
"browsetype", $_POST[
"datatype"]);
463 $this->ctrl->redirect($this,
"browseForQuestions");
476 $inserted_objects = 0;
477 foreach ($_POST as $key => $value)
479 if (preg_match(
"/cb_(\d+)/", $key, $matches))
481 if (
$_GET[
"browsetype"] == 1)
483 $this->
object->insertQuestion($matches[1]);
487 $this->
object->insertQuestionBlock($matches[1]);
492 if ($inserted_objects)
494 $this->
object->saveCompletionStatus();
496 $this->ctrl->redirect($this,
"questions");
500 if (
$_GET[
"browsetype"] == 1)
521 $checked_questions = array();
522 $checked_questionblocks = array();
523 foreach ($_POST as $key => $value)
525 if (preg_match(
"/cb_(\d+)/", $key, $matches))
527 array_push($checked_questions, $matches[1]);
529 if (preg_match(
"/cb_qb_(\d+)/", $key, $matches))
531 array_push($checked_questionblocks, $matches[1]);
534 if (count($checked_questions) + count($checked_questionblocks) > 0)
542 ilUtil::sendInfo($this->lng->txt(
"no_question_selected_for_removal"),
true);
543 $this->ctrl->redirect($this,
"questions");
559 if (strcmp($this->ctrl->getCmd(),
"filterQuestions") != 0)
561 if (array_key_exists(
"sel_questionpool",
$_GET)) $filter_questionpool =
$_GET[
"sel_questionpool"];
563 $browsequestions = (array_key_exists(
"browsetype",
$_GET)) ?
$_GET[
"browsetype"] : 1;
564 $this->ctrl->setParameter($this,
"browsetype", $browsequestions);
565 if ($_POST[
"cmd"][
"back"])
567 $show_questionbrowser =
false;
570 $add_parameter =
"&insert_question=1";
572 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_questionbrowser.html",
"Modules/Survey");
573 $this->tpl->addBlockFile(
"A_BUTTONS",
"a_buttons",
"tpl.il_svy_svy_action_buttons.html",
"Modules/Survey");
574 $this->tpl->addBlockFile(
"FILTER_QUESTION_MANAGER",
"filter_questions",
"tpl.il_svy_svy_filter_questions.html",
"Modules/Survey");
576 $questionpools =& $this->
object->getQuestionpoolTitles();
577 if (count($questionpools) == 0)
582 $filter_type =
$_GET[
"sel_filter_type"];
585 $filter_type = $_POST[
"sel_filter_type"];
591 $add_parameter .=
"&sel_filter_type=$filter_type";
593 $filter_text =
$_GET[
"filter_text"];
596 $filter_text = $_POST[
"filter_text"];
602 $add_parameter .=
"&filter_text=$filter_text";
604 $filter_fields = array(
605 "title" => $this->lng->txt(
"title"),
606 "comment" => $this->lng->txt(
"description"),
607 "author" => $this->lng->txt(
"author"),
609 $this->tpl->setCurrentBlock(
"filterrow");
610 foreach ($filter_fields as $key => $value)
612 $this->tpl->setVariable(
"VALUE_FILTER_TYPE",
"$key");
613 $this->tpl->setVariable(
"NAME_FILTER_TYPE",
"$value");
616 if (strcmp($filter_type, $key) == 0)
618 $this->tpl->setVariable(
"VALUE_FILTER_SELECTED",
" selected=\"selected\"");
621 $this->tpl->parseCurrentBlock();
624 $filter_question_type = $_POST[
"sel_question_type"];
625 if (!$filter_question_type)
627 $filter_question_type =
$_GET[
"sel_question_type"];
631 $filter_question_type =
"";
633 $add_parameter .=
"&sel_question_type=$filter_question_type";
635 if ($browsequestions)
637 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
639 foreach ($questiontypes as $questiontypeTranslation => $questiontype)
641 $this->tpl->setCurrentBlock(
"questiontype_row");
642 $this->tpl->setVariable(
"VALUE_QUESTION_TYPE", $questiontype[
"type_tag"]);
643 $this->tpl->setVariable(
"TEXT_QUESTION_TYPE", $questiontypeTranslation);
644 if (strcmp($filter_question_type, $questiontype[
"type_tag"]) == 0)
646 $this->tpl->setVariable(
"SELECTED_QUESTION_TYPE",
" selected=\"selected\"");
648 $this->tpl->parseCurrentBlock();
654 $filter_questionpool =
"";
656 $add_parameter .=
"&sel_questionpool=$filter_questionpool";
658 if ($browsequestions)
660 foreach ($questionpools as $key => $value)
662 $this->tpl->setCurrentBlock(
"questionpool_row");
663 $this->tpl->setVariable(
"VALUE_QUESTIONPOOL", $key);
664 $this->tpl->setVariable(
"TEXT_QUESTIONPOOL", $value);
665 if (strcmp($filter_questionpool, $key) == 0)
667 $this->tpl->setVariable(
"SELECTED_QUESTIONPOOL",
" selected=\"selected\"");
669 $this->tpl->parseCurrentBlock();
673 if ($browsequestions)
675 $this->tpl->setCurrentBlock(
"question_filters");
676 $this->tpl->setVariable(
"SHOW_QUESTION_TYPES", $this->lng->txt(
"filter_show_question_types"));
677 $this->tpl->setVariable(
"TEXT_ALL_QUESTION_TYPES", $this->lng->txt(
"filter_all_question_types"));
678 $this->tpl->setVariable(
"SHOW_QUESTIONPOOLS", $this->lng->txt(
"filter_show_questionpools"));
679 $this->tpl->setVariable(
"TEXT_ALL_QUESTIONPOOLS", $this->lng->txt(
"filter_all_questionpools"));
680 $this->tpl->parseCurrentBlock();
683 $this->tpl->setCurrentBlock(
"filter_questions");
684 $this->tpl->setVariable(
"FILTER_TEXT", $this->lng->txt(
"filter"));
685 $this->tpl->setVariable(
"TEXT_FILTER_BY", $this->lng->txt(
"by"));
686 if (!$_POST[
"cmd"][
"reset"])
688 $this->tpl->setVariable(
"VALUE_FILTER_TEXT", $filter_text);
690 $this->tpl->setVariable(
"VALUE_SUBMIT_FILTER", $this->lng->txt(
"set_filter"));
691 $this->tpl->setVariable(
"VALUE_RESET_FILTER", $this->lng->txt(
"reset_filter"));
692 $this->tpl->setVariable(
"OPTION_QUESTIONS", $this->lng->txt(
"questions"));
693 $this->tpl->setVariable(
"OPTION_QUESTIONBLOCKS", $this->lng->txt(
"questionblocks"));
694 if ($browsequestions)
696 $this->tpl->setVariable(
"SELECTED_QUESTIONS",
" selected=\"selected\"");
700 $this->tpl->setVariable(
"SELECTED_QUESTIONBLOCKS",
" selected=\"selected\"");
702 $this->tpl->setVariable(
"TEXT_DATATYPE", $this->lng->txt(
"display_all_available"));
703 $this->tpl->setVariable(
"BTN_CHANGE", $this->lng->txt(
"change"));
704 $this->tpl->parseCurrentBlock();
706 if ($_POST[
"cmd"][
"reset"])
708 $_POST[
"filter_text"] =
"";
711 if (
$_GET[
"prevrow"])
713 $startrow =
$_GET[
"prevrow"];
715 if (
$_GET[
"nextrow"])
717 $startrow =
$_GET[
"nextrow"];
719 if (
$_GET[
"startrow"])
721 $startrow =
$_GET[
"startrow"];
723 $sort = (
$_GET[
"sort"]) ?
$_GET[
"sort"] :
"title";
724 $sortorder = (
$_GET[
"sortorder"]) ?
$_GET[
"sortorder"] :
"ASC";
725 $this->ctrl->setParameter($this,
"sort", $sort);
726 $this->ctrl->setParameter($this,
"sortorder", $sortorder);
727 if ($browsequestions)
729 $table = $this->
object->getQuestionsTable($sort, $sortorder, $filter_text, $filter_type, $startrow, 1, $filter_question_type, $filter_questionpool);
733 $table = $this->
object->getQuestionblocksTable($sort, $sortorder, $filter_text, $filter_type, $startrow);
735 $colors = array(
"tblrow1",
"tblrow2");
737 $questionblock_id = 0;
738 if ($browsequestions)
740 include_once
"./classes/class.ilFormat.php";
741 foreach ($table[
"rows"] as
$data)
743 if ($rbacsystem->checkAccess(
"write", $data[
"ref_id"]))
745 if ($data[
"complete"])
748 $this->tpl->setCurrentBlock(
"checkable");
749 $this->tpl->setVariable(
"QUESTION_ID", $data[
"question_id"]);
750 $this->tpl->setVariable(
"COUNTER", $data[
"question_id"]);
751 $this->tpl->parseCurrentBlock();
753 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
754 $this->tpl->setCurrentBlock(
"QTab");
755 $this->tpl->setVariable(
"QUESTION_TITLE",
"<strong>" . $data[
"title"] .
"</strong>");
756 $this->tpl->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
"preview"));
757 $this->tpl->setVariable(
"URL_PREVIEW",
"ilias.php?baseClass=ilObjSurveyQuestionPoolGUI&ref_id=" . $data[
"ref_id"] .
"&cmd=preview&preview=" . $data[
"question_id"]);
758 $this->tpl->setVariable(
"COUNTER", $data[
"question_id"]);
759 $this->tpl->setVariable(
"QUESTION_COMMENT", $data[
"description"]);
761 $this->tpl->setVariable(
"QUESTION_AUTHOR", $data[
"author"]);
764 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
765 $this->tpl->setVariable(
"QUESTION_POOL", $questionpools[$data[
"obj_fi"]]);
766 $this->tpl->parseCurrentBlock();
770 if ($table[
"rowcount"] > count($table[
"rows"]))
772 $nextstep = $table[
"nextrow"] + $table[
"step"];
773 if ($nextstep > $table[
"rowcount"])
775 $nextstep = $table[
"rowcount"];
778 for ($i = 0; $i < $table[
"rowcount"]; $i += $table[
"step"])
780 $this->tpl->setCurrentBlock(
"pages_questions");
781 if ($table[
"startrow"] == $i)
783 $this->tpl->setVariable(
"PAGE_NUMBER",
"<span class=\"inactivepage\">$counter</span>");
787 $this->tpl->setVariable(
"PAGE_NUMBER",
"<a href=\"" . $this->ctrl->getLinkTarget($this,
"browseForQuestions") . $add_parameter .
"&nextrow=$i" .
"\">$counter</a>");
789 $this->tpl->parseCurrentBlock();
792 $this->tpl->setCurrentBlock(
"questions_navigation_bottom");
793 $this->tpl->setVariable(
"TEXT_ITEM", $this->lng->txt(
"item"));
794 $this->tpl->setVariable(
"TEXT_ITEM_START", $table[
"startrow"] + 1);
795 $end = $table[
"startrow"] + $table[
"step"];
796 if ($end > $table[
"rowcount"])
798 $end = $table[
"rowcount"];
800 $this->tpl->setVariable(
"TEXT_ITEM_END", $end);
801 $this->tpl->setVariable(
"TEXT_OF", strtolower($this->lng->txt(
"of")));
802 $this->tpl->setVariable(
"TEXT_ITEM_COUNT", $table[
"rowcount"]);
803 $this->tpl->setVariable(
"TEXT_PREVIOUS", $this->lng->txt(
"previous"));
804 $this->tpl->setVariable(
"TEXT_NEXT", $this->lng->txt(
"next"));
805 $this->tpl->setVariable(
"HREF_PREV_ROWS", $this->ctrl->getLinkTarget($this,
"browseForQuestions") . $add_parameter .
"&prevrow=" . $table[
"prevrow"]);
806 $this->tpl->setVariable(
"HREF_NEXT_ROWS", $this->ctrl->getLinkTarget($this,
"browseForQuestions") . $add_parameter .
"&nextrow=" . $table[
"nextrow"]);
807 $this->tpl->parseCurrentBlock();
812 foreach ($table[
"rows"] as
$data)
814 $this->tpl->setCurrentBlock(
"questionblock_row");
815 $this->tpl->setVariable(
"QUESTIONBLOCK_ID", $data[
"questionblock_id"]);
816 $this->tpl->setVariable(
"QUESTIONBLOCK_TITLE",
"<strong>" . $data[
"title"] .
"</strong>");
817 $this->tpl->setVariable(
"SURVEY_TITLE", $data[
"surveytitle"]);
818 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
819 $this->tpl->setVariable(
"QUESTIONS_TITLE", $data[
"questions"]);
820 $this->tpl->parseCurrentBlock();
823 if ($table[
"rowcount"] > count($table[
"rows"]))
825 $nextstep = $table[
"nextrow"] + $table[
"step"];
826 if ($nextstep > $table[
"rowcount"])
828 $nextstep = $table[
"rowcount"];
831 for ($i = 0; $i < $table[
"rowcount"]; $i += $table[
"step"])
833 $this->tpl->setCurrentBlock(
"pages_questionblocks");
834 if ($table[
"startrow"] == $i)
836 $this->tpl->setVariable(
"PAGE_NUMBER",
"<strong>$counter</strong>");
840 $this->tpl->setVariable(
"PAGE_NUMBER",
"<a href=\"" . $this->ctrl->getLinkTarget($this,
"browseForQuestions") . $add_parameter .
"&nextrow=$i" .
"\">$counter</a>");
842 $this->tpl->parseCurrentBlock();
845 $this->tpl->setCurrentBlock(
"questionblocks_navigation_bottom");
846 $this->tpl->setVariable(
"TEXT_ITEM", $this->lng->txt(
"item"));
847 $this->tpl->setVariable(
"TEXT_ITEM_START", $table[
"startrow"] + 1);
848 $end = $table[
"startrow"] + $table[
"step"];
849 if ($end > $table[
"rowcount"])
851 $end = $table[
"rowcount"];
853 $this->tpl->setVariable(
"TEXT_ITEM_END", $end);
854 $this->tpl->setVariable(
"TEXT_OF", strtolower($this->lng->txt(
"of")));
855 $this->tpl->setVariable(
"TEXT_ITEM_COUNT", $table[
"rowcount"]);
856 $this->tpl->setVariable(
"TEXT_PREVIOUS", $this->lng->txt(
"previous"));
857 $this->tpl->setVariable(
"TEXT_NEXT", $this->lng->txt(
"next"));
858 $this->tpl->setVariable(
"HREF_PREV_ROWS", $this->ctrl->getLinkTarget($this,
"browseForQuestions") . $add_parameter .
"&prevrow=" . $table[
"prevrow"]);
859 $this->tpl->setVariable(
"HREF_NEXT_ROWS", $this->ctrl->getLinkTarget($this,
"browseForQuestions") . $add_parameter .
"&nextrow=" . $table[
"nextrow"]);
860 $this->tpl->parseCurrentBlock();
867 $this->tpl->setCurrentBlock(
"Emptytable");
868 if ($browsequestions)
870 $this->tpl->setVariable(
"TEXT_EMPTYTABLE", $this->lng->txt(
"no_questions_available"));
874 $this->tpl->setVariable(
"TEXT_EMPTYTABLE", $this->lng->txt(
"no_questionblocks_available"));
876 $this->tpl->parseCurrentBlock();
880 $this->tpl->setCurrentBlock(
"selectall");
881 $this->tpl->setVariable(
"SELECT_ALL", $this->lng->txt(
"select_all"));
883 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
884 $this->tpl->parseCurrentBlock();
886 $this->tpl->setCurrentBlock(
"selection");
887 $this->tpl->setVariable(
"INSERT", $this->lng->txt(
"insert"));
888 $this->tpl->parseCurrentBlock();
890 $this->tpl->setCurrentBlock(
"Footer");
891 include_once
"./Services/Utilities/classes/class.ilUtil.php";
892 $this->tpl->setVariable(
"ARROW",
"<img src=\"" .
ilUtil::getImagePath(
"arrow_downright.gif") .
"\" alt=\"".$this->lng->txt(
"arrow_downright").
"\">");
893 $this->tpl->parseCurrentBlock();
897 "title" => (strcmp($sort,
"title") == 0) ? $sortorder :
"",
898 "description" => (strcmp($sort,
"description") == 0) ? $sortorder :
"",
899 "type" => (strcmp($sort,
"type") == 0) ? $sortorder :
"",
900 "author" => (strcmp($sort,
"author") == 0) ? $sortorder :
"",
901 "created" => (strcmp($sort,
"created") == 0) ? $sortorder :
"",
902 "updated" => (strcmp($sort,
"updated") == 0) ? $sortorder :
"",
903 "qpl" => (strcmp($sort,
"qpl") == 0) ? $sortorder :
"",
904 "svy" => (strcmp($sort,
"svy") == 0) ? $sortorder :
""
906 foreach ($sortarray as $key => $value)
908 if (strcmp($value,
"ASC") == 0)
910 $sortarray[$key] =
"DESC";
914 $sortarray[$key] =
"ASC";
918 if ($browsequestions)
920 $this->tpl->setCurrentBlock(
"questions_header");
921 $this->ctrl->setParameter($this,
"sort",
"title");
922 $this->ctrl->setParameter($this,
"sortorder", $sortarray[
"title"]);
923 $this->tpl->setVariable(
"QUESTION_TITLE",
"<a href=\"" . $this->ctrl->getLinkTargetByClass(get_class($this),
"browseForQuestions") .
"$add_parameter&startrow=" . $table[
"startrow"] .
"\">" . $this->lng->txt(
"title") .
"</a>" . $table[
"images"][
"title"]);
924 $this->ctrl->setParameter($this,
"sort",
"description");
925 $this->ctrl->setParameter($this,
"sortorder", $sortarray[
"description"]);
926 $this->tpl->setVariable(
"QUESTION_COMMENT",
"<a href=\"" . $this->ctrl->getLinkTargetByClass(get_class($this),
"browseForQuestions") .
"$add_parameter&startrow=" . $table[
"startrow"] .
"\">" . $this->lng->txt(
"description") .
"</a>". $table[
"images"][
"description"]);
927 $this->ctrl->setParameter($this,
"sort",
"type");
928 $this->ctrl->setParameter($this,
"sortorder", $sortarray[
"type"]);
929 $this->tpl->setVariable(
"QUESTION_TYPE",
"<a href=\"" . $this->ctrl->getLinkTargetByClass(get_class($this),
"browseForQuestions") .
"$add_parameter&startrow=" . $table[
"startrow"] .
"\">" . $this->lng->txt(
"question_type") .
"</a>" . $table[
"images"][
"type"]);
930 $this->ctrl->setParameter($this,
"sort",
"author");
931 $this->ctrl->setParameter($this,
"sortorder", $sortarray[
"author"]);
932 $this->tpl->setVariable(
"QUESTION_AUTHOR",
"<a href=\"" . $this->ctrl->getLinkTargetByClass(get_class($this),
"browseForQuestions") .
"$add_parameter&startrow=" . $table[
"startrow"] .
"\">" . $this->lng->txt(
"author") .
"</a>" . $table[
"images"][
"author"]);
933 $this->ctrl->setParameter($this,
"sort",
"created");
934 $this->ctrl->setParameter($this,
"sortorder", $sortarray[
"created"]);
935 $this->tpl->setVariable(
"QUESTION_CREATED",
"<a href=\"" . $this->ctrl->getLinkTargetByClass(get_class($this),
"browseForQuestions") .
"$add_parameter&startrow=" . $table[
"startrow"] .
"\">" . $this->lng->txt(
"create_date") .
"</a>" . $table[
"images"][
"created"]);
936 $this->ctrl->setParameter($this,
"sort",
"updated");
937 $this->ctrl->setParameter($this,
"sortorder", $sortarray[
"updated"]);
938 $this->tpl->setVariable(
"QUESTION_UPDATED",
"<a href=\"" . $this->ctrl->getLinkTargetByClass(get_class($this),
"browseForQuestions") .
"$add_parameter&startrow=" . $table[
"startrow"] .
"\">" . $this->lng->txt(
"last_update") .
"</a>" . $table[
"images"][
"updated"]);
939 $this->ctrl->setParameter($this,
"sort",
"qpl");
940 $this->ctrl->setParameter($this,
"sortorder", $sortarray[
"qpl"]);
941 $this->tpl->setVariable(
"QUESTION_POOL",
"<a href=\"" . $this->ctrl->getLinkTargetByClass(get_class($this),
"browseForQuestions") .
"$add_parameter&startrow=" . $table[
"startrow"] .
"\">" . $this->lng->txt(
"obj_spl") .
"</a>" . $table[
"images"][
"qpl"]);
942 $this->tpl->parseCurrentBlock();
946 $this->tpl->setCurrentBlock(
"questionblocks_header");
947 $this->ctrl->setParameter($this,
"sort",
"title");
948 $this->ctrl->setParameter($this,
"sortorder", $sortarray[
"title"]);
949 $this->tpl->setVariable(
"QUESTIONBLOCK_TITLE",
"<a href=\"" . $this->ctrl->getLinkTargetByClass(get_class($this),
"browseForQuestions") .
"$add_parameter&startrow=" . $table[
"startrow"] .
"\">" . $this->lng->txt(
"title") .
"</a>" . $table[
"images"][
"title"]);
950 $this->ctrl->setParameter($this,
"sort",
"svy");
951 $this->ctrl->setParameter($this,
"sortorder", $sortarray[
"svy"]);
952 $this->tpl->setVariable(
"SURVEY_TITLE",
"<a href=\"" . $this->ctrl->getLinkTargetByClass(get_class($this),
"browseForQuestions") .
"$add_parameter&startrow=" . $table[
"startrow"] .
"\">" . $this->lng->txt(
"obj_svy") .
"</a>" . $table[
"images"][
"svy"]);
953 $this->tpl->setVariable(
"QUESTIONS_TITLE", $this->lng->txt(
"contains"));
954 $this->tpl->parseCurrentBlock();
956 $this->tpl->setCurrentBlock(
"adm_content");
958 $this->ctrl->setParameter($this,
"sort", $sort);
959 $this->ctrl->setParameter($this,
"sortorder", $sortorder);
960 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"browseForQuestions") . $add_parameter);
961 $this->tpl->parseCurrentBlock();
976 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_remove_questions.html",
"Modules/Survey");
977 $colors = array(
"tblrow1",
"tblrow2");
979 $surveyquestions =& $this->
object->getSurveyQuestions();
980 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
981 foreach ($surveyquestions as $question_id =>
$data)
983 if (in_array(
$data[
"question_id"], $checked_questions) or (in_array(
$data[
"questionblock_id"], $checked_questionblocks)))
985 $this->tpl->setCurrentBlock(
"row");
986 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
987 $this->tpl->setVariable(
"TEXT_TITLE",
$data[
"title"]);
988 $this->tpl->setVariable(
"TEXT_DESCRIPTION",
$data[
"description"]);
990 $this->tpl->setVariable(
"TEXT_QUESTIONBLOCK",
$data[
"questionblock_title"]);
991 $this->tpl->parseCurrentBlock();
995 foreach ($checked_questions as $id)
997 $this->tpl->setCurrentBlock(
"hidden");
998 $this->tpl->setVariable(
"HIDDEN_NAME",
"id_$id");
999 $this->tpl->setVariable(
"HIDDEN_VALUE",
"$id");
1000 $this->tpl->parseCurrentBlock();
1002 foreach ($checked_questionblocks as $id)
1004 $this->tpl->setCurrentBlock(
"hidden");
1005 $this->tpl->setVariable(
"HIDDEN_NAME",
"id_qb_$id");
1006 $this->tpl->setVariable(
"HIDDEN_VALUE",
"$id");
1007 $this->tpl->parseCurrentBlock();
1009 $this->tpl->setCurrentBlock(
"adm_content");
1010 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"title"));
1011 $this->tpl->setVariable(
"TEXT_DESCRIPTION", $this->lng->txt(
"description"));
1012 $this->tpl->setVariable(
"TEXT_TYPE", $this->lng->txt(
"question_type"));
1013 $this->tpl->setVariable(
"TEXT_QUESTIONBLOCK", $this->lng->txt(
"questionblock"));
1014 $this->tpl->setVariable(
"BTN_CONFIRM", $this->lng->txt(
"confirm"));
1015 $this->tpl->setVariable(
"BTN_CANCEL", $this->lng->txt(
"cancel"));
1016 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"confirmRemoveQuestions"));
1017 $this->tpl->parseCurrentBlock();
1033 if ($questionblock_id)
1035 $questionblock = $this->
object->getQuestionblock($questionblock_id);
1037 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_define_questionblock.html",
"Modules/Survey");
1038 foreach ($_POST as $key => $value)
1040 if (preg_match(
"/cb_(\d+)/", $key, $matches))
1042 $this->tpl->setCurrentBlock(
"hidden");
1043 $this->tpl->setVariable(
"HIDDEN_NAME",
"cb_$matches[1]");
1044 $this->tpl->setVariable(
"HIDDEN_VALUE", $matches[1]);
1045 $this->tpl->parseCurrentBlock();
1048 if ($questionblock_id)
1050 $this->tpl->setCurrentBlock(
"hidden");
1051 $this->tpl->setVariable(
"HIDDEN_NAME",
"questionblock_id");
1052 $this->tpl->setVariable(
"HIDDEN_VALUE", $questionblock_id);
1053 $this->tpl->parseCurrentBlock();
1055 $this->tpl->setCurrentBlock(
"adm_content");
1056 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"title"));
1057 if ($questionblock_id)
1059 $this->tpl->setVariable(
"VALUE_TITLE", $questionblock[
"title"]);
1061 $this->tpl->setVariable(
"TXT_QUESTIONTEXT_DESCRIPTION", $this->lng->txt(
"show_questiontext_description"));
1062 $this->tpl->setVariable(
"TXT_QUESTIONTEXT", $this->lng->txt(
"show_questiontext"));
1063 if (($questionblock[
"show_questiontext"]) || (strlen($questionblock_id) == 0))
1065 $this->tpl->setVariable(
"CHECKED_QUESTIONTEXT",
" checked=\"checked\"");
1067 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
1068 $this->tpl->setVariable(
"HEADING_QUESTIONBLOCK", $this->lng->txt(
"define_questionblock"));
1069 $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save"));
1070 $this->tpl->setVariable(
"CANCEL", $this->lng->txt(
"cancel"));
1071 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"saveDefineQuestionblock"));
1072 $this->tpl->parseCurrentBlock();
1086 $tpl =
new ilTemplate(
"tpl.il_svy_svy_qpl_select.html", TRUE, TRUE,
"Modules/Survey");
1087 $questionpools =& $this->
object->getAvailableQuestionpools(FALSE, TRUE, TRUE,
"write");
1088 if (count($questionpools))
1090 foreach ($questionpools as $key => $value)
1092 $tpl->setCurrentBlock(
"option");
1093 $tpl->setVariable(
"VALUE_OPTION", $key);
1094 $tpl->setVariable(
"TEXT_OPTION", $value);
1095 $tpl->parseCurrentBlock();
1097 $tpl->setCurrentBlock(
"selection");
1098 $tpl->setVariable(
"TXT_QPL_SELECT", $this->lng->txt(
"select_questionpool"));
1099 $tpl->parseCurrentBlock();
1103 $tpl->setCurrentBlock(
"selection");
1104 $tpl->setVariable(
"TXT_QPL_ENTER", $this->lng->txt(
"cat_create_spl"));
1105 $tpl->parseCurrentBlock();
1107 $tpl->setVariable(
"BTN_SUBMIT", $this->lng->txt(
"submit"));
1108 $sel_question_types = (strlen($_POST[
"sel_question_types"])) ? $_POST[
"sel_question_types"] :
$_GET[
"sel_question_types"];
1109 $this->ctrl->setParameter($this,
"sel_question_types", $sel_question_types);
1110 $tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"executeCreateQuestion"));
1111 $tpl->setVariable(
"BTN_CANCEL", $this->lng->txt(
"cancel"));
1112 $this->tpl->setVariable(
"ADM_CONTENT",
$tpl->get());
1124 $this->ctrl->redirect($this,
"questions");
1136 if (strlen($_POST[
"sel_spl"]))
1138 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1139 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"]);
1141 elseif (strlen($_POST[
"name_spl"]))
1144 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"]);
1149 $this->ctrl->setParameter($this,
"sel_question_types",
$_GET[
"sel_question_types"]);
1150 $this->ctrl->redirect($this,
"createQuestion");
1163 $parent_ref = $tree->getParentId($this->object->getRefId());
1164 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
1166 $qpl->setType(
"spl");
1167 $qpl->setTitle($name);
1168 $qpl->setDescription(
"");
1170 $qpl->createReference();
1171 $qpl->putInTree($parent_ref);
1172 $qpl->setPermissions($parent_ref);
1175 return $qpl->getRefId();
1189 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_heading.html",
"Modules/Survey");
1190 $survey_questions =& $this->
object->getSurveyQuestions();
1193 $_POST[
"insertbefore"] = $question_id;
1194 $_POST[
"heading"] = $survey_questions[$question_id][
"heading"];
1196 foreach ($survey_questions as $key => $value)
1198 $this->tpl->setCurrentBlock(
"insertbefore_row");
1199 $this->tpl->setVariable(
"VALUE_OPTION", $key);
1200 $option = $this->lng->txt(
"before") .
": \"" . $value[
"title"] .
"\"";
1201 if (strlen($option) > 80)
1203 $option = preg_replace(
"/^(.{40}).*(.{40})$/",
"\\1 [...] \\2", $option);
1205 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1207 if ($key == $_POST[
"insertbefore"])
1209 $this->tpl->setVariable(
"SELECTED_OPTION",
" selected=\"selected\"");
1211 $this->tpl->parseCurrentBlock();
1215 $this->tpl->setCurrentBlock(
"hidden");
1216 $this->tpl->setVariable(
"INSERTBEFORE_ORIGINAL", $question_id);
1217 $this->tpl->parseCurrentBlock();
1219 $this->tpl->setCurrentBlock(
"adm_content");
1220 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"saveHeading"));
1221 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
1224 $this->tpl->setVariable(
"TEXT_ADD_HEADING", $this->lng->txt(
"edit_heading"));
1225 $this->tpl->setVariable(
"SELECT_DISABLED",
" disabled=\"disabled\"");
1229 $this->tpl->setVariable(
"TEXT_ADD_HEADING", $this->lng->txt(
"add_heading"));
1231 $this->tpl->setVariable(
"TEXT_HEADING", $this->lng->txt(
"heading"));
1232 $this->tpl->setVariable(
"VALUE_HEADING", $_POST[
"heading"]);
1233 $this->tpl->setVariable(
"TEXT_INSERT", $this->lng->txt(
"insert"));
1234 $this->tpl->setVariable(
"CANCEL", $this->lng->txt(
"cancel"));
1235 $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save"));
1236 $this->tpl->parseCurrentBlock();
1237 include_once
"./Services/RTE/classes/class.ilRTE.php";
1239 include_once
"./Services/RTE/classes/class.$rtestring.php";
1240 $rte =
new $rtestring();
1241 $rte->removePlugin(
"ibrowser");
1242 include_once
"./classes/class.ilObject.php";
1245 $rte->addRTESupport(
$obj_id, $obj_type,
"survey");
1258 foreach ($_POST as $key => $value) {
1259 if (preg_match(
"/id_(\d+)/", $key, $matches)) {
1260 if (
$_GET[
"browsetype"] == 1)
1262 $this->
object->insertQuestion($matches[1]);
1266 $this->
object->insertQuestionBlock($matches[1]);
1270 $this->
object->saveCompletionStatus();
1272 $this->ctrl->redirect($this,
"questions");
1284 $this->ctrl->redirect($this,
"questions");
1296 if ($_POST[
"heading"])
1298 $insertbefore = $_POST[
"insertbefore"];
1301 $insertbefore = $_POST[
"insertbefore_original"];
1303 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
1305 $this->ctrl->redirect($this,
"questions");
1324 $this->ctrl->redirect($this,
"questions");
1336 $this->
object->saveHeading(
"", $_POST[
"removeheading"]);
1337 $this->ctrl->redirect($this,
"questions");
1349 $this->ctrl->redirect($this,
"questions");
1362 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_confirm_removeheading.html",
"Modules/Survey");
1363 $this->tpl->setCurrentBlock(
"adm_content");
1364 $this->tpl->setVariable(
"BTN_CONFIRM_REMOVE", $this->lng->txt(
"confirm"));
1365 $this->tpl->setVariable(
"BTN_CANCEL_REMOVE", $this->lng->txt(
"cancel"));
1366 $this->tpl->setVariable(
"REMOVE_HEADING",
$_GET[
"removeheading"]);
1367 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"confirmRemoveHeading"));
1368 $this->tpl->parseCurrentBlock();
1380 $checked_questions = array();
1381 $checked_questionblocks = array();
1382 foreach ($_POST as $key => $value)
1384 if (preg_match(
"/id_(\d+)/", $key, $matches))
1386 array_push($checked_questions, $matches[1]);
1388 if (preg_match(
"/id_qb_(\d+)/", $key, $matches))
1390 array_push($checked_questionblocks, $matches[1]);
1393 $this->
object->removeQuestions($checked_questions, $checked_questionblocks);
1394 $this->
object->saveCompletionStatus();
1396 $this->ctrl->redirect($this,
"questions");
1408 $this->ctrl->redirect($this,
"questions");
1420 $questionblock = array();
1421 foreach ($_POST as $key => $value)
1423 if (preg_match(
"/cb_(\d+)/", $key, $matches))
1425 array_push($questionblock, $value);
1428 if (count($questionblock) < 2)
1430 ilUtil::sendInfo($this->lng->txt(
"qpl_define_questionblock_select_missing"),
true);
1431 $this->ctrl->redirect($this,
"questions");
1449 if ($_POST[
"title"])
1451 $show_questiontext = ($_POST[
"show_questiontext"]) ? 1 : 0;
1452 if ($_POST[
"questionblock_id"])
1454 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1455 $this->
object->modifyQuestionblock($_POST[
"questionblock_id"],
ilUtil::stripSlashes($_POST[
"title"]), $show_questiontext);
1459 $questionblock = array();
1460 foreach ($_POST as $key => $value)
1462 if (preg_match(
"/cb_(\d+)/", $key, $matches))
1464 array_push($questionblock, $value);
1467 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1468 $this->
object->createQuestionblock(
ilUtil::stripSlashes($_POST[
"title"]), $show_questiontext, $questionblock);
1470 $this->ctrl->redirect($this,
"questions");
1489 $unfoldblocks = array();
1490 foreach ($_POST as $key => $value)
1492 if (preg_match(
"/cb_qb_(\d+)/", $key, $matches))
1494 array_push($unfoldblocks, $matches[1]);
1497 if (count($unfoldblocks))
1499 $this->
object->unfoldQuestionblocks($unfoldblocks);
1505 $this->ctrl->redirect($this,
"questions");
1517 $this->ctrl->redirect($this,
"questions");
1529 $move_questions = array();
1530 foreach ($_POST as $key => $value)
1532 if (preg_match(
"/cb_(\d+)/", $key, $matches))
1534 array_push($move_questions, $matches[1]);
1536 if (preg_match(
"/cb_qb_(\d+)/", $key, $matches))
1538 $ids = $this->
object->getQuestionblockQuestionIds($matches[1]);
1539 foreach ($ids as $qkey => $qid)
1541 array_push($move_questions, $qid);
1545 if (count($move_questions) == 0)
1548 $this->ctrl->redirect($this,
"questions");
1552 $_SESSION[
"move_questions"] = $move_questions;
1553 ilUtil::sendInfo($this->lng->txt(
"select_target_position_for_move_question"));
1568 $move_questions =
$_SESSION[
"move_questions"];
1571 foreach ($_POST as $key => $value)
1573 if (preg_match(
"/^cb_(\d+)$/", $key, $matches))
1577 $insert_id = $matches[1];
1580 if (preg_match(
"/^cb_qb_(\d+)$/", $key, $matches))
1584 $ids =& $this->
object->getQuestionblockQuestionIds($matches[1]);
1587 if ($insert_mode == 0)
1589 $insert_id = $ids[0];
1591 else if ($insert_mode == 1)
1593 $insert_id = $ids[count($ids)-1];
1599 if ($insert_id <= 0)
1605 $this->
object->moveQuestions($move_questions, $insert_id, $insert_mode);
1608 $this->ctrl->redirect($this,
"questions");
1644 $obligatory = array();
1645 foreach ($_POST as $key => $value)
1647 if (preg_match(
"/obligatory_(\d+)/", $key, $matches))
1649 $obligatory[$matches[1]] = 1;
1652 $this->
object->setObligatoryStates($obligatory);
1653 $this->ctrl->redirect($this,
"questions");
1668 $hasDatasets = $this->
object->_hasDatasets($this->object->getSurveyId());
1669 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1670 if ((!$rbacsystem->checkAccess(
"read", $this->ref_id)) && (!$rbacsystem->checkAccess(
"write", $this->ref_id)))
1674 $path = $this->tree->getPathFull($this->object->getRefID());
1679 if (
$_GET[
"new_id"] > 0)
1682 $inserted = $this->
object->insertQuestion(
$_GET[
"new_id"]);
1685 ilUtil::sendInfo($this->lng->txt(
"survey_error_insert_incomplete_question"));
1691 ilUtil::redirect(
"ilias.php?baseClass=ilObjSurveyQuestionPoolGUI&ref_id=" . $_GET[
"eqpl"] .
"&cmd=editQuestionForSurvey&calling_survey=".$_GET[
"ref_id"].
"&q_id=" . $_GET[
"eqid"]);
1695 $_SESSION[
"calling_survey"] = $this->
object->getRefId();
1698 if ($_GET[
"editheading"])
1704 if ($_GET[
"up"] > 0)
1706 $this->
object->moveUpQuestion($_GET[
"up"]);
1708 if ($_GET[
"down"] > 0)
1710 $this->
object->moveDownQuestion($_GET[
"down"]);
1712 if ($_GET[
"qbup"] > 0)
1714 $this->
object->moveUpQuestionblock($_GET[
"qbup"]);
1716 if ($_GET[
"qbdown"] > 0)
1718 $this->
object->moveDownQuestionblock($_GET[
"qbdown"]);
1721 if ($_GET[
"removeheading"])
1727 if ($_GET[
"editblock"])
1736 $selected_array = array();
1737 array_push($selected_array, $_GET[
"add"]);
1739 $this->insertQuestionsForm($selected_array);
1743 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_questions.html",
"Modules/Survey");
1745 $survey_questions =& $this->
object->getSurveyQuestions();
1746 $questionblock_titles =& $this->
object->getQuestionblockTitles();
1747 $questionpools =& $this->
object->getQuestionpoolTitles();
1748 $colors = array(
"tblrow1",
"tblrow2");
1751 $last_color_class =
"";
1752 $obligatory =
"<img src=\"" .
ilUtil::getImagePath(
"obligatory.gif",
"Modules/Survey") .
"\" alt=\"" . $this->lng->txt(
"question_obligatory") .
"\" title=\"" . $this->lng->txt(
"question_obligatory") .
"\" />";
1753 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
1755 if (count($survey_questions) > 0)
1757 foreach ($survey_questions as $question_id =>
$data)
1760 if (($last_questionblock_id > 0) && (
$data[
"questionblock_id"] == 0))
1764 if (($last_questionblock_id > 0) && (
$data[
"questionblock_id"] > 0) && (
$data[
"questionblock_id"] != $last_questionblock_id))
1768 if ((
$data[
"questionblock_id"] > 0) and (
$data[
"questionblock_id"] != $last_questionblock_id))
1771 $this->tpl->setCurrentBlock(
"separator");
1772 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
1773 $this->tpl->parseCurrentBlock();
1774 $this->tpl->setCurrentBlock(
"QTab");
1775 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
1776 $this->tpl->parseCurrentBlock();
1778 $this->tpl->setCurrentBlock(
"block");
1779 $this->tpl->setVariable(
"TYPE_ICON",
"<img src=\"" .
ilUtil::getImagePath(
"questionblock.gif",
"Modules/Survey") .
"\" alt=\"".$this->lng->txt(
"questionblock_icon").
"\" />");
1780 $this->tpl->setVariable(
"TEXT_QUESTIONBLOCK", $this->lng->txt(
"questionblock") .
": " .
$data[
"questionblock_title"]);
1781 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
1782 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets)
1784 if (
$data[
"question_id"] != $this->object->questions[0])
1786 $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>");
1788 $akeys = array_keys($survey_questions);
1789 if (
$data[
"questionblock_id"] != $survey_questions[$akeys[count($akeys)-1]][
"questionblock_id"])
1791 $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>");
1793 $this->tpl->setVariable(
"TEXT_EDIT", $this->lng->txt(
"edit"));
1794 $this->tpl->setVariable(
"HREF_EDIT", $this->ctrl->getLinkTarget($this,
"questions") .
"&editblock=" .
$data[
"questionblock_id"]);
1796 $this->tpl->parseCurrentBlock();
1797 $this->tpl->setCurrentBlock(
"QTab");
1798 $this->tpl->setVariable(
"QUESTION_ID",
"qb_" .
$data[
"questionblock_id"]);
1799 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
1800 $this->tpl->parseCurrentBlock();
1802 if (($last_questionblock_id > 0) && (
$data[
"questionblock_id"] == 0))
1805 $this->tpl->setCurrentBlock(
"separator");
1806 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
1807 $this->tpl->parseCurrentBlock();
1808 $this->tpl->setCurrentBlock(
"QTab");
1809 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
1810 $this->tpl->parseCurrentBlock();
1812 if (
$data[
"heading"])
1814 $this->tpl->setCurrentBlock(
"heading");
1815 $this->tpl->setVariable(
"TEXT_HEADING",
$data[
"heading"]);
1816 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
1817 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets)
1819 $this->tpl->setVariable(
"TEXT_EDIT", $this->lng->txt(
"edit"));
1820 $this->tpl->setVariable(
"HREF_EDIT", $this->ctrl->getLinkTarget($this,
"questions") .
"&editheading=" .
$data[
"question_id"]);
1821 $this->tpl->setVariable(
"TEXT_DELETE", $this->lng->txt(
"remove"));
1822 $this->tpl->setVariable(
"HREF_DELETE", $this->ctrl->getLinkTarget($this,
"questions") .
"&removeheading=" .
$data[
"question_id"]);
1824 $this->tpl->parseCurrentBlock();
1825 $this->tpl->setCurrentBlock(
"QTab");
1826 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
1827 $this->tpl->parseCurrentBlock();
1829 if (!
$data[
"questionblock_id"])
1831 $this->tpl->setCurrentBlock(
"checkable");
1832 $this->tpl->setVariable(
"QUESTION_ID",
$data[
"question_id"]);
1833 $this->tpl->parseCurrentBlock();
1835 $this->tpl->setCurrentBlock(
"QTab");
1836 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
1838 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets)
1840 $q_id =
$data[
"question_id"];
1841 $qpl_ref_id = $this->
object->_getRefIdFromObjId(
$data[
"obj_fi"]);
1842 $this->tpl->setVariable(
"QUESTION_TITLE",
"$title_counter. <a href=\"" . $this->ctrl->getLinkTarget($this,
"questions") .
"&eqid=$q_id&eqpl=$qpl_ref_id" .
"\">" .
$data[
"title"] .
"</a>");
1846 $this->tpl->setVariable(
"QUESTION_TITLE",
"$title_counter. ".
$data[
"title"]);
1848 $this->tpl->setVariable(
"TYPE_ICON",
"<img src=\"" .
ilUtil::getImagePath(
"question.gif",
"Modules/Survey") .
"\" alt=\"".$this->lng->txt(
"question_icon").
"\" />");
1849 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets)
1851 $obligatory_checked =
"";
1852 if (
$data[
"obligatory"] == 1)
1854 $obligatory_checked =
" checked=\"checked\"";
1856 $this->tpl->setVariable(
"QUESTION_OBLIGATORY",
"<input type=\"checkbox\" name=\"obligatory_" .
$data[
"question_id"] .
"\" value=\"1\"$obligatory_checked />");
1860 if (
$data[
"obligatory"] == 1)
1862 $this->tpl->setVariable(
"QUESTION_OBLIGATORY", $obligatory);
1865 $this->tpl->setVariable(
"QUESTION_COMMENT",
$data[
"description"]);
1866 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets)
1868 if (!
$data[
"questionblock_id"])
1871 if (
$data[
"question_id"] != $this->object->questions[0])
1873 $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>");
1875 if (
$data[
"question_id"] != $this->object->questions[count($this->object->questions)-1])
1877 $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>");
1883 if (
$data[
"questionblock_id"] == $last_questionblock_id)
1885 $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>");
1887 $tmp_questions = array_keys($survey_questions);
1888 $blockkey = array_search($question_id, $tmp_questions);
1889 if (($blockkey !== FALSE) && ($blockkey < count($tmp_questions)-1))
1891 if (
$data[
"questionblock_id"] == $survey_questions[$tmp_questions[$blockkey+1]][
"questionblock_id"])
1893 $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>");
1898 foreach ($questiontypes as $trans => $typedata)
1900 if (strcmp($typedata[
"type_tag"],
$data[
"type_tag"]) == 0)
1902 $this->tpl->setVariable(
"QUESTION_TYPE", $trans);
1905 $this->tpl->setVariable(
"QUESTION_AUTHOR",
$data[
"author"]);
1906 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
1907 $last_color_class = $colors[$counter % 2];
1908 if (!
$data[
"questionblock_id"])
1912 $this->tpl->parseCurrentBlock();
1913 $last_questionblock_id =
$data[
"questionblock_id"];
1916 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets)
1918 $this->tpl->setCurrentBlock(
"selectall");
1919 $this->tpl->setVariable(
"SELECT_ALL", $this->lng->txt(
"select_all"));
1920 $this->tpl->setVariable(
"COLOR_CLASS", $last_color_class);
1921 $this->tpl->parseCurrentBlock();
1922 if (array_key_exists(
"move_questions",
$_SESSION))
1924 $this->tpl->setCurrentBlock(
"move_buttons");
1925 $this->tpl->setVariable(
"INSERT_BEFORE", $this->lng->txt(
"insert_before"));
1926 $this->tpl->setVariable(
"INSERT_AFTER", $this->lng->txt(
"insert_after"));
1927 $this->tpl->parseCurrentBlock();
1929 $this->tpl->setCurrentBlock(
"QFooter");
1930 $this->tpl->setVariable(
"ARROW",
"<img src=\"" .
ilUtil::getImagePath(
"arrow_downright.gif") .
"\" alt=\"".$this->lng->txt(
"arrow_downright").
"\">");
1931 $this->tpl->setVariable(
"REMOVE", $this->lng->txt(
"remove_question"));
1932 $this->tpl->setVariable(
"MOVE", $this->lng->txt(
"move"));
1933 $this->tpl->setVariable(
"QUESTIONBLOCK", $this->lng->txt(
"define_questionblock"));
1934 $this->tpl->setVariable(
"UNFOLD", $this->lng->txt(
"unfold"));
1935 $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save_obligatory_state"));
1936 $this->tpl->parseCurrentBlock();
1941 $this->tpl->setCurrentBlock(
"Emptytable");
1942 $this->tpl->setVariable(
"TEXT_EMPTYTABLE", $this->lng->txt(
"no_questions_available"));
1943 $this->tpl->parseCurrentBlock();
1945 if (($last_questionblock_id > 0))
1948 $this->tpl->setCurrentBlock(
"separator");
1949 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
1950 $this->tpl->parseCurrentBlock();
1951 $this->tpl->setCurrentBlock(
"QTab");
1952 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
1953 $this->tpl->parseCurrentBlock();
1956 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets)
1958 $this->tpl->setCurrentBlock(
"QTypes");
1959 $query =
"SELECT * FROM survey_questiontype";
1960 $query_result = $this->ilias->db->query($query);
1961 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
1962 while (
$data = $query_result->fetchRow(MDB2_FETCHMODE_OBJECT))
1964 $this->tpl->setVariable(
"QUESTION_TYPE_ID",
$data->type_tag);
1966 $this->tpl->parseCurrentBlock();
1968 $this->tpl->parseCurrentBlock();
1970 $this->tpl->setCurrentBlock(
"adm_content");
1971 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"questions"));
1972 $this->tpl->setVariable(
"QUESTION_TITLE", $this->lng->txt(
"title"));
1973 $this->tpl->setVariable(
"QUESTION_COMMENT", $this->lng->txt(
"description"));
1974 $this->tpl->setVariable(
"QUESTION_OBLIGATORY", $this->lng->txt(
"obligatory"));
1975 $this->tpl->setVariable(
"QUESTION_SEQUENCE", $this->lng->txt(
"sequence"));
1976 $this->tpl->setVariable(
"QUESTION_TYPE", $this->lng->txt(
"question_type"));
1977 $this->tpl->setVariable(
"QUESTION_AUTHOR", $this->lng->txt(
"author"));
1979 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets)
1981 $this->tpl->setVariable(
"BUTTON_INSERT_QUESTION", $this->lng->txt(
"browse_for_questions"));
1982 $this->tpl->setVariable(
"TEXT_CREATE_NEW",
" " . strtolower($this->lng->txt(
"or")) .
" " . $this->lng->txt(
"create_new"));
1983 $this->tpl->setVariable(
"BUTTON_CREATE_QUESTION", $this->lng->txt(
"create"));
1984 $this->tpl->setVariable(
"HEADING", $this->lng->txt(
"add_heading"));
1991 $this->tpl->parseCurrentBlock();
2004 include_once(
"./Modules/Survey/classes/class.ilSurveyEvaluationGUI.php");
2006 $this->ctrl->setCmdClass(get_class($eval_gui));
2007 $this->ctrl->redirect($eval_gui,
"evaluation");
2021 $rowclass = array(
"tblrow1",
"tblrow2");
2025 include_once
'./Services/User/classes/class.ilObjUser.php';
2027 foreach ($id_array as $user_id)
2029 $this->tpl->setCurrentBlock($block_row);
2030 $this->tpl->setVariable(
"COLOR_CLASS", $rowclass[$counter % 2]);
2034 $this->tpl->setVariable(
"COUNTER",
$user->getId());
2035 $this->tpl->setVariable(
"VALUE_LOGIN",
$user->getLogin());
2036 $this->tpl->setVariable(
"VALUE_FIRSTNAME",
$user->getFirstname());
2037 $this->tpl->setVariable(
"VALUE_LASTNAME",
$user->getLastname());
2041 $this->tpl->setVariable(
"COUNTER", $user_id);
2042 $this->tpl->setVariable(
"VALUE_LOGIN", $this->lng->txt(
"deleted_user"));
2043 $this->tpl->setVariable(
"VALUE_FIRSTNAME", $this->lng->txt(
"unknown"));
2044 $this->tpl->setVariable(
"VALUE_LASTNAME", $this->lng->txt(
"unknown"));
2047 $this->tpl->parseCurrentBlock();
2049 if (count($id_array))
2051 $this->tpl->setCurrentBlock(
"selectall_$block_result");
2052 $this->tpl->setVariable(
"SELECT_ALL", $this->lng->txt(
"select_all"));
2054 $this->tpl->setVariable(
"COLOR_CLASS", $rowclass[$counter % 2]);
2055 $this->tpl->parseCurrentBlock();
2057 $this->tpl->setCurrentBlock($block_result);
2058 include_once
"./Services/Utilities/classes/class.ilUtil.php";
2059 $this->tpl->setVariable(
"TEXT_USER_TITLE",
"<img src=\"" .
ilUtil::getImagePath(
"icon_usr.gif") .
"\" alt=\"".$this->lng->txt(
"obj_usr").
"\" /> " . $title_text);
2060 $this->tpl->setVariable(
"TEXT_LOGIN", $this->lng->txt(
"login"));
2061 $this->tpl->setVariable(
"TEXT_FIRSTNAME", $this->lng->txt(
"firstname"));
2062 $this->tpl->setVariable(
"TEXT_LASTNAME", $this->lng->txt(
"lastname"));
2063 if ($rbacsystem->checkAccess(
'invite', $this->object->getRefId()))
2065 foreach ($buttons as $cat)
2067 $this->tpl->setVariable(
"VALUE_" . strtoupper($cat), $this->lng->txt($cat));
2069 $this->tpl->setVariable(
"ARROW",
"<img src=\"" .
ilUtil::getImagePath(
"arrow_downright.gif") .
"\" alt=\"".$this->lng->txt(
"arrow_downright").
"\">");
2071 $this->tpl->parseCurrentBlock();
2074 include_once
"./Modules/Group/classes/class.ilObjGroup.php";
2076 foreach ($id_array as $group_id)
2079 $this->tpl->setCurrentBlock($block_row);
2080 $this->tpl->setVariable(
"COLOR_CLASS", $rowclass[$counter % 2]);
2081 $this->tpl->setVariable(
"COUNTER", $group->getRefId());
2082 $this->tpl->setVariable(
"VALUE_TITLE", $group->getTitle());
2083 $this->tpl->setVariable(
"VALUE_DESCRIPTION", $group->getDescription());
2085 $this->tpl->parseCurrentBlock();
2087 if (count($id_array))
2089 $this->tpl->setCurrentBlock(
"selectall_$block_result");
2090 $this->tpl->setVariable(
"SELECT_ALL", $this->lng->txt(
"select_all"));
2092 $this->tpl->setVariable(
"COLOR_CLASS", $rowclass[$counter % 2]);
2093 $this->tpl->parseCurrentBlock();
2095 $this->tpl->setCurrentBlock($block_result);
2096 include_once
"./Services/Utilities/classes/class.ilUtil.php";
2097 $this->tpl->setVariable(
"TEXT_GROUP_TITLE",
"<img src=\"" .
ilUtil::getImagePath(
"icon_grp.gif") .
"\" alt=\"".$this->lng->txt(
"obj_grp").
"\" /> " . $title_text);
2098 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"title"));
2099 $this->tpl->setVariable(
"TEXT_DESCRIPTION", $this->lng->txt(
"description"));
2100 if ($rbacsystem->checkAccess(
'invite', $this->object->getRefId()))
2102 foreach ($buttons as $cat)
2104 $this->tpl->setVariable(
"VALUE_" . strtoupper($cat), $this->lng->txt($cat));
2106 $this->tpl->setVariable(
"ARROW",
"<img src=\"" .
ilUtil::getImagePath(
"arrow_downright.gif") .
"\" alt=\"".$this->lng->txt(
"arrow_downright").
"\">");
2108 $this->tpl->parseCurrentBlock();
2111 include_once
"./Services/AccessControl/classes/class.ilObjRole.php";
2113 foreach ($id_array as $role_id)
2116 $this->tpl->setCurrentBlock($block_row);
2117 $this->tpl->setVariable(
"COLOR_CLASS", $rowclass[$counter % 2]);
2118 $this->tpl->setVariable(
"COUNTER", $role->getId());
2119 $this->tpl->setVariable(
"VALUE_TITLE", $role->getTitle());
2120 $this->tpl->setVariable(
"VALUE_DESCRIPTION", $role->getDescription());
2122 $this->tpl->parseCurrentBlock();
2124 if (count($id_array))
2126 $this->tpl->setCurrentBlock(
"selectall_$block_result");
2127 $this->tpl->setVariable(
"SELECT_ALL", $this->lng->txt(
"select_all"));
2129 $this->tpl->setVariable(
"COLOR_CLASS", $rowclass[$counter % 2]);
2130 $this->tpl->parseCurrentBlock();
2132 $this->tpl->setCurrentBlock($block_result);
2133 include_once
"./Services/Utilities/classes/class.ilUtil.php";
2134 $this->tpl->setVariable(
"TEXT_ROLE_TITLE",
"<img src=\"" .
ilUtil::getImagePath(
"icon_role.gif") .
"\" alt=\"".$this->lng->txt(
"obj_role").
"\" /> " . $title_text);
2135 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"title"));
2136 $this->tpl->setVariable(
"TEXT_DESCRIPTION", $this->lng->txt(
"description"));
2137 if ($rbacsystem->checkAccess(
'invite', $this->object->getRefId()))
2139 foreach ($buttons as $cat)
2141 $this->tpl->setVariable(
"VALUE_" . strtoupper($cat), $this->lng->txt($cat));
2143 $this->tpl->setVariable(
"ARROW",
"<img src=\"" .
ilUtil::getImagePath(
"arrow_downright.gif") .
"\" alt=\"".$this->lng->txt(
"arrow_downright").
"\">");
2145 $this->tpl->parseCurrentBlock();
2159 include_once
"./Services/Administration/classes/class.ilSetting.php";
2160 $surveySetting =
new ilSetting(
"survey");
2161 $unlimited_invitation = $surveySetting->get(
"unlimited_invitation");
2162 $mode = $_POST[
"mode"];
2163 if (!$unlimited_invitation)
2167 $this->
object->setInvitationAndMode($_POST[
"invitation"], $_POST[
"mode"]);
2168 $this->
object->saveToDb();
2169 $this->ctrl->redirect($this,
"invite");
2194 if (is_array($_POST[
"invited_users"]))
2196 foreach ($_POST[
"invited_users"] as $user_id)
2198 $this->
object->disinviteUser($user_id);
2201 $this->ctrl->redirect($this,
"invite");
2214 if (is_array($_POST[
"user_select"]))
2216 foreach ($_POST[
"user_select"] as $user_id)
2218 $this->
object->inviteUser($user_id);
2223 if (is_array($_POST[
"group_select"]))
2226 foreach ($_POST[
"group_select"] as $group_id)
2228 $invited += $this->
object->inviteGroup($group_id);
2232 $error .= $this->lng->txt(
"no_user_of_group_invited");
2236 if (is_array($_POST[
"role_select"]))
2239 foreach ($_POST[
"role_select"] as $role_id)
2241 $invited += $this->
object->inviteRole($role_id);
2245 $error .= $this->lng->txt(
"no_user_of_group_invited");
2249 $this->ctrl->redirect($this,
"invite");
2265 if ((!$rbacsystem->checkAccess(
"visible,invite", $this->ref_id)) && (!$rbacsystem->checkAccess(
"write", $this->ref_id)))
2269 $path = $this->tree->getPathFull($this->object->getRefID());
2270 include_once
"./Services/Utilities/classes/class.ilUtil.php";
2275 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_invite.html",
"Modules/Survey");
2279 $this->tpl->setCurrentBlock(
"survey_offline");
2280 $this->tpl->setVariable(
"SURVEY_OFFLINE_MESSAGE", $this->lng->txt(
"survey_offline_message"));
2281 $this->tpl->parseCurrentBlock();
2285 $concat = ($_POST[
"concatenation"]) ? $_POST[
"concatenation"] :
"or";
2286 $searchfor = ($_POST[
"search_for"]) ? $_POST[
"search_for"] : array(
"usr");
2288 if (strcmp($this->ctrl->getCmd(),
"searchInvitation") == 0)
2290 if (is_array($_POST[
"search_for"]))
2292 if (in_array(
"usr", $_POST[
"search_for"]) or in_array(
"grp", $_POST[
"search_for"]) or in_array(
"role", $_POST[
"search_for"]))
2294 include_once
"./classes/class.ilSearch.php";
2295 $search =&
new ilSearch($ilUser->id);
2296 $search->setSearchString($_POST[
"search_term"]);
2297 $search->setCombination($concat);
2298 $search->setSearchFor($searchfor);
2299 $search->setSearchType(
"new");
2300 if($search->validate($message))
2302 $search->performSearch();
2308 if(!$search->getNumberOfResults() && $search->getSearchFor())
2312 $buttons = array(
"add");
2313 $invited_users = $this->
object->getInvitedUsers();
2314 if ($searchresult = $search->getResultByType(
"usr"))
2317 foreach ($searchresult as $result_array)
2319 if (!in_array($result_array[
"id"], $invited_users))
2321 if ($ilAccess->checkAccessOfUser($result_array[
"id"],
"read",
"", $this->object->getRefId(),
"svy", $this->
object->getId()))
2323 array_push($users, $result_array[
"id"]);
2329 $this->
outUserGroupTable(
"usr", $users,
"user_result",
"user_row", $this->lng->txt(
"found_users"), $buttons);
2336 $searchresult = array();
2337 if ($searchresult = $search->getResultByType(
"grp"))
2340 foreach ($searchresult as $result_array)
2342 array_push($groups, $result_array[
"id"]);
2344 $this->
outUserGroupTable(
"grp", $groups,
"group_result",
"group_row", $this->lng->txt(
"search_groups"), $buttons);
2346 $searchresult = array();
2347 if ($searchresult = $search->getResultByType(
"role"))
2350 foreach ($searchresult as $result_array)
2352 array_push($roles, $result_array[
"id"]);
2354 $this->
outUserGroupTable(
"role", $roles,
"role_result",
"role_row", $this->lng->txt(
"search_roles"), $buttons);
2366 if ($rbacsystem->checkAccess(
'invite', $this->ref_id))
2368 $this->tpl->setCurrentBlock(
"invitation");
2369 $this->tpl->setVariable(
"SEARCH_INVITATION", $this->lng->txt(
"search_invitation"));
2370 $this->tpl->setVariable(
"SEARCH_TERM", $this->lng->txt(
"search_term"));
2371 $this->tpl->setVariable(
"SEARCH_FOR", $this->lng->txt(
"search_for"));
2372 $this->tpl->setVariable(
"SEARCH_USERS", $this->lng->txt(
"objs_usr"));
2373 $this->tpl->setVariable(
"SEARCH_GROUPS", $this->lng->txt(
"objs_grp"));
2374 $this->tpl->setVariable(
"SEARCH_ROLES", $this->lng->txt(
"objs_role"));
2375 $this->tpl->setVariable(
"TEXT_CONCATENATION", $this->lng->txt(
"concatenation"));
2376 $this->tpl->setVariable(
"TEXT_AND", $this->lng->txt(
"and"));
2377 $this->tpl->setVariable(
"TEXT_OR", $this->lng->txt(
"or"));
2378 $this->tpl->setVariable(
"VALUE_SEARCH_TERM", $_POST[
"search_term"]);
2379 if (is_array($searchfor))
2381 if (in_array(
"usr", $searchfor))
2383 $this->tpl->setVariable(
"CHECKED_USERS",
" checked=\"checked\"");
2385 if (in_array(
"grp", $searchfor))
2387 $this->tpl->setVariable(
"CHECKED_GROUPS",
" checked=\"checked\"");
2389 if (in_array(
"role", $searchfor))
2391 $this->tpl->setVariable(
"CHECKED_ROLES",
" checked=\"checked\"");
2394 if (strcmp($concat,
"and") == 0)
2396 $this->tpl->setVariable(
"CHECKED_AND",
" checked=\"checked\"");
2398 else if (strcmp($concat,
"or") == 0)
2400 $this->tpl->setVariable(
"CHECKED_OR",
" checked=\"checked\"");
2402 $this->tpl->setVariable(
"SEARCH", $this->lng->txt(
"search"));
2403 $this->tpl->parseCurrentBlock();
2409 $invited_users = $this->
object->getInvitedUsers();
2410 $buttons = array(
"disinvite");
2411 if (count($invited_users))
2413 $this->
outUserGroupTable(
"usr", $invited_users,
"invited_user_result",
"invited_user_row", $this->lng->txt(
"invited_users"), $buttons);
2418 include_once
"./Services/Administration/classes/class.ilSetting.php";
2419 $surveySetting =
new ilSetting(
"survey");
2420 $unlimited_invitation = $surveySetting->get(
"unlimited_invitation");
2421 if (!$unlimited_invitation)
2423 $this->tpl->touchBlock(
"disabled_mode");
2425 $this->tpl->setCurrentBlock(
"invitation_mode");
2426 $this->tpl->setVariable(
"TEXT_MODE", $this->lng->txt(
"invitation_mode"));
2427 $this->tpl->setVariable(
"VALUE_UNLIMITED", $this->lng->txt(
"unlimited_users"));
2428 $this->tpl->setVariable(
"VALUE_PREDEFINED", $this->lng->txt(
"predefined_users"));
2429 if (!$unlimited_invitation)
2431 $this->tpl->setVariable(
"SELECTED_PREDEFINED",
" selected=\"selected\"");
2437 $this->tpl->setVariable(
"SELECTED_PREDEFINED",
" selected=\"selected\"");
2441 $this->tpl->setVariable(
"SELECTED_UNLIMITED",
" selected=\"selected\"");
2444 $this->tpl->parseCurrentBlock();
2447 if ($rbacsystem->checkAccess(
"write", $this->ref_id) or $rbacsystem->checkAccess(
'invite', $this->ref_id))
2449 $this->tpl->setCurrentBlock(
"command_buttons");
2450 $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save"));
2451 $this->tpl->parseCurrentBlock();
2454 $this->tpl->setCurrentBlock(
"survey_online");
2455 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"invite"));
2456 $this->tpl->setVariable(
"TEXT_INVITATION", $this->lng->txt(
"invitation"));
2457 $this->tpl->setVariable(
"VALUE_ON", $this->lng->txt(
"on"));
2458 $this->tpl->setVariable(
"VALUE_OFF", $this->lng->txt(
"off"));
2459 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
2462 $this->tpl->setVariable(
"SELECTED_ON",
" selected=\"selected\"");
2466 $this->tpl->setVariable(
"SELECTED_OFF",
" selected=\"selected\"");
2468 $this->tpl->parseCurrentBlock();
2481 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_maintenance.html",
"Modules/Survey");
2482 $this->tpl->setCurrentBlock(
"confirm_delete");
2483 $this->tpl->setVariable(
"BTN_CONFIRM_DELETE_ALL", $this->lng->txt(
"confirm"));
2484 $this->tpl->setVariable(
"BTN_CANCEL_DELETE_ALL", $this->lng->txt(
"cancel"));
2485 $this->tpl->parseCurrentBlock();
2486 $this->tpl->setCurrentBlock(
"adm_content");
2487 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"deleteAllUserData"));
2488 $this->tpl->parseCurrentBlock();
2500 $this->
object->deleteAllUserData();
2502 $this->ctrl->redirect($this,
"maintenance");
2514 $this->ctrl->redirect($this,
"maintenance");
2526 $this->
object->removeSelectedSurveyResults($_POST[
"chbUser"]);
2528 $this->ctrl->redirect($this,
"maintenance");
2540 $this->ctrl->redirect($this,
"maintenance");
2552 if (count($_POST[
"chbUser"]) == 0)
2554 $this->ctrl->redirect($this,
"maintenance");
2557 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_maintenance.html",
"Modules/Survey");
2559 $this->tpl->setCurrentBlock(
"confirm_delete_selected");
2560 $this->tpl->setVariable(
"BTN_CONFIRM_DELETE_SELECTED", $this->lng->txt(
"confirm"));
2561 $this->tpl->setVariable(
"BTN_CANCEL_DELETE_SELECTED", $this->lng->txt(
"cancel"));
2562 $this->tpl->parseCurrentBlock();
2564 foreach ($_POST[
"chbUser"] as $key => $value)
2566 $this->tpl->setCurrentBlock(
"hidden");
2567 $this->tpl->setVariable(
"USER_ID", $value);
2568 $this->tpl->parseCurrentBlock();
2571 $this->tpl->setCurrentBlock(
"adm_content");
2572 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"deleteSingleUserResults"));
2573 $this->tpl->parseCurrentBlock();
2582 if ($rbacsystem->checkAccess(
"write", $this->ref_id))
2584 if (
$_GET[
"fill"] > 0)
2586 for ($i = 0; $i <
$_GET[
"fill"]; $i++) $this->object->fillSurveyForUser();
2588 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_maintenance.html",
"Modules/Survey");
2589 $total =& $this->
object->getSurveyParticipants();
2592 $color_class = array(
"tblrow1",
"tblrow2");
2594 foreach (
$total as $user_data)
2596 $user_name = $user_data[
"sortname"];
2597 $user_login = $user_data[
"login"];
2598 $this->tpl->setCurrentBlock(
"userrow");
2599 $this->tpl->setVariable(
"ROW_CLASS", $color_class[$counter % 2]);
2600 $this->tpl->setVariable(
"USER_ID", $user_data[
"active_id"]);
2601 $this->tpl->setVariable(
"VALUE_USER_NAME", $user_name);
2602 $this->tpl->setVariable(
"VALUE_USER_LOGIN", $user_login);
2603 $last_access = $this->
object->_getLastAccess($user_data[
"active_id"]);
2605 $this->tpl->parseCurrentBlock();
2608 $this->tpl->setCurrentBlock(
"selectall");
2609 $this->tpl->setVariable(
"SELECT_ALL", $this->lng->txt(
"select_all"));
2611 $this->tpl->setVariable(
"ROW_CLASS", $color_class[$counter % 2]);
2612 $this->tpl->parseCurrentBlock();
2613 $this->tpl->setCurrentBlock(
"participanttable");
2614 $this->tpl->setVariable(
"USER_NAME", $this->lng->txt(
"name"));
2615 $this->tpl->setVariable(
"USER_LOGIN", $this->lng->txt(
"login"));
2616 $this->tpl->setVariable(
"LAST_ACCESS", $this->lng->txt(
"last_access"));
2618 $this->tpl->setVariable(
"ARROW", $this->lng->txt(
"arrow_downright"));
2619 $this->tpl->setVariable(
"DELETE", $this->lng->txt(
"delete_user_data"));
2620 $this->tpl->parseCurrentBlock();
2622 $this->tpl->setCurrentBlock(
"adm_content");
2623 $this->tpl->setVariable(
"BTN_DELETE_ALL", $this->lng->txt(
"svy_delete_all_user_data"));
2625 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"deleteSingleUserResults"));
2626 $this->tpl->parseCurrentBlock();
2630 $this->tpl->setCurrentBlock(
"maintenance_information");
2631 $this->tpl->setVariable(
"MAINTENANCE_INFORMATION", $this->lng->txt(
"svy_maintenance_information_no_results"));
2632 $this->tpl->parseCurrentBlock();
2652 $this->tpl->addBlockfile(
"BUTTONS",
"buttons",
"tpl.buttons.html");
2655 $this->tpl->setCurrentBlock(
"btn_cell");
2656 $this->tpl->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this,
"createExportFile"));
2657 $this->tpl->setVariable(
"BTN_TXT", $this->lng->txt(
"svy_create_export_file"));
2658 $this->tpl->parseCurrentBlock();
2660 $export_dir = $this->
object->getExportDirectory();
2661 $export_files = $this->
object->getExportFiles($export_dir);
2664 include_once(
"./Services/Table/classes/class.ilTableGUI.php");
2668 $this->tpl->addBlockfile(
"ADM_CONTENT",
"adm_content",
"tpl.table.html");
2671 $this->tpl->addBlockfile(
"TBL_CONTENT",
"tbl_content",
"tpl.export_file_row.html",
"Modules/Survey");
2675 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"export"));
2677 $tbl->setTitle($this->lng->txt(
"svy_export_files"));
2679 $tbl->setHeaderNames(array(
"", $this->lng->txt(
"svy_file"),
2680 $this->lng->txt(
"svy_size"), $this->lng->txt(
"date") ));
2682 $tbl->enabled[
"sort"] =
false;
2683 $tbl->setColumnWidth(array(
"1%",
"49%",
"25%",
"25%"));
2686 $tbl->setOrderColumn(
$_GET[
"sort_by"]);
2687 $tbl->setOrderDirection(
$_GET[
"sort_order"]);
2688 $tbl->setLimit(
$_GET[
"limit"]);
2689 $tbl->setOffset(
$_GET[
"offset"]);
2690 $tbl->setMaxCount($this->maxcount);
2692 $header_params = $this->ctrl->getParameterArray($this,
"export");
2693 $tbl->setHeaderVars(array(
"",
"file",
"size",
"date"), $header_params);
2696 $tbl->setFooter(
"tblfooter",$this->lng->txt(
"previous"),$this->lng->txt(
"next"));
2699 $tbl->setMaxCount(count($export_files));
2700 $export_files = array_slice($export_files,
$_GET[
"offset"],
$_GET[
"limit"]);
2703 if(count($export_files) > 0)
2705 $this->tpl->setVariable(
"COLUMN_COUNTS", 4);
2708 foreach($export_files as $exp_file)
2710 $this->tpl->setCurrentBlock(
"tbl_content");
2711 $this->tpl->setVariable(
"TXT_FILENAME", $exp_file);
2714 $this->tpl->setVariable(
"CSS_ROW", $css_row);
2716 $this->tpl->setVariable(
"TXT_SIZE", filesize($export_dir.
"/".$exp_file));
2717 $this->tpl->setVariable(
"CHECKBOX_ID", $exp_file);
2719 $file_arr = explode(
"__", $exp_file);
2720 $this->tpl->setVariable(
"TXT_DATE", date(
"Y-m-d H:i:s",$file_arr[0]));
2722 $this->tpl->parseCurrentBlock();
2724 $this->tpl->setCurrentBlock(
"selectall");
2725 $this->tpl->setVariable(
"SELECT_ALL", $this->lng->txt(
"select_all"));
2726 $this->tpl->setVariable(
"CSS_ROW", $css_row);
2727 $this->tpl->parseCurrentBlock();
2730 $this->tpl->setCurrentBlock(
"tbl_action_btn");
2731 $this->tpl->setVariable(
"BTN_NAME",
"confirmDeleteExportFile");
2732 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"delete"));
2733 $this->tpl->parseCurrentBlock();
2735 $this->tpl->setCurrentBlock(
"tbl_action_btn");
2736 $this->tpl->setVariable(
"BTN_NAME",
"downloadExportFile");
2737 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"download"));
2738 $this->tpl->parseCurrentBlock();
2742 $this->tpl->setCurrentBlock(
"notfound");
2743 $this->tpl->setVariable(
"TXT_OBJECT_NOT_FOUND", $this->lng->txt(
"obj_not_found"));
2744 $this->tpl->setVariable(
"NUM_COLS", 3);
2745 $this->tpl->parseCurrentBlock();
2748 $this->tpl->parseCurrentBlock();
2758 if ($rbacsystem->checkAccess(
"write", $this->ref_id))
2760 include_once(
"./Modules/Survey/classes/class.ilSurveyExport.php");
2762 $survey_exp->buildExportFile();
2763 $this->ctrl->redirect($this,
"export");
2779 $this->tpl->setCurrentBlock(
"option_qpl");
2780 include_once(
"./Modules/Survey/classes/class.ilObjSurvey.php");
2782 $questionpools =& $svy->getAvailableQuestionpools(TRUE, FALSE, TRUE);
2783 if (count($questionpools) == 0)
2788 foreach ($questionpools as $key => $value)
2790 $this->tpl->setCurrentBlock(
"option_spl");
2791 $this->tpl->setVariable(
"OPTION_VALUE", $key);
2792 $this->tpl->setVariable(
"TXT_OPTION", $value);
2793 $this->tpl->parseCurrentBlock();
2796 $this->tpl->setVariable(
"TXT_SELECT_QUESTIONPOOL", $this->lng->txt(
"select_questionpool"));
2797 $this->tpl->setVariable(
"OPTION_SELECT_QUESTIONPOOL", $this->lng->txt(
"select_questionpool_option"));
2798 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"import"));
2799 $this->tpl->setVariable(
"BTN_NAME",
"upload");
2800 $this->tpl->setVariable(
"TXT_UPLOAD", $this->lng->txt(
"upload"));
2801 $this->tpl->setVariable(
"TXT_IMPORT_TST", $this->lng->txt(
"import_tst"));
2802 $this->tpl->setVariable(
"TXT_SELECT_MODE", $this->lng->txt(
"select_mode"));
2803 $this->tpl->setVariable(
"TXT_SELECT_FILE", $this->lng->txt(
"select_file"));
2815 if ($_POST[
"spl"] < 1)
2821 if (strcmp($_FILES[
"xmldoc"][
"tmp_name"],
"") == 0)
2828 include_once(
"./Modules/Survey/classes/class.ilObjSurvey.php");
2830 $newObj->setType(
$_GET[
"new_type"]);
2831 $newObj->setTitle(
"dummy");
2832 $newObj->setDescription(
"dummy");
2833 $newObj->create(
true);
2834 $newObj->createReference();
2835 $newObj->putInTree(
$_GET[
"ref_id"]);
2836 $newObj->setPermissions(
$_GET[
"ref_id"]);
2837 $newObj->notify(
"new",
$_GET[
"ref_id"],
$_GET[
"parent_non_rbac_id"],
$_GET[
"ref_id"],$newObj->getRefId());
2839 $error = $newObj->importObject($_FILES[
"xmldoc"], $_POST[
"spl"]);
2843 $this->ilias->raiseError($error, $this->ilias->error_obj->MESSAGE);
2848 $ref_id = $newObj->getRefId();
2852 include_once
"./Services/Utilities/classes/class.ilUtil.php";
2864 $new_type = $_POST[
"new_type"] ? $_POST[
"new_type"] :
$_GET[
"new_type"];
2865 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"], $new_type))
2867 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
2873 include_once(
"./Modules/Survey/classes/class.ilObjSurvey.php");
2877 $questionpools =& $svy->getAvailableQuestionpools($use_obj_id = TRUE, $could_be_offline = TRUE, $showPath = TRUE);
2878 if (count($questionpools) > 0)
2880 foreach ($questionpools as $key => $value)
2882 $this->tpl->setCurrentBlock(
"option_spl");
2883 $this->tpl->setVariable(
"OPTION_VALUE", $key);
2884 $this->tpl->setVariable(
"TXT_OPTION", $value);
2885 if ($_POST[
"spl"] == $key)
2887 $this->tpl->setVariable(
"OPTION_SELECTED",
" selected=\"selected\"");
2889 $this->tpl->parseCurrentBlock();
2894 $data[
"fields"] = array();
2895 include_once
"./Services/Utilities/classes/class.ilUtil.php";
2899 foreach (
$data[
"fields"] as $key => $val)
2901 $this->tpl->setVariable(
"TXT_".strtoupper($key), $this->lng->txt($key));
2902 $this->tpl->setVariable(strtoupper($key), $val);
2904 if ($this->prepare_output)
2906 $this->tpl->parseCurrentBlock();
2910 $this->ctrl->setParameter($this,
"new_type", $this->type);
2911 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"create"));
2912 $this->tpl->setVariable(
"TXT_HEADER", $this->lng->txt($new_type.
"_new"));
2913 $this->tpl->setVariable(
"TXT_SELECT_QUESTIONPOOL", $this->lng->txt(
"select_questionpool_short"));
2914 $this->tpl->setVariable(
"OPTION_SELECT_QUESTIONPOOL", $this->lng->txt(
"select_questionpool_option"));
2915 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
2916 $this->tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt($new_type.
"_add"));
2917 $this->tpl->setVariable(
"CMD_SUBMIT",
"save");
2918 $this->tpl->setVariable(
"TARGET",
' target="'.
2920 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
2922 $this->tpl->setVariable(
"TXT_IMPORT_SVY", $this->lng->txt(
"import_svy"));
2923 $this->tpl->setVariable(
"TXT_SVY_FILE", $this->lng->txt(
"svy_upload_file"));
2924 $this->tpl->setVariable(
"TXT_IMPORT", $this->lng->txt(
"import"));
2927 $this->tpl->setVariable(
"ALT_IMG",$this->lng->txt(
"obj_svy"));
2929 $this->tpl->setVariable(
"ALT_IMG2",$this->lng->txt(
"obj_svy"));
2938 if ($_POST[
"spl"] < 1)
2944 if (strcmp($_FILES[
"xmldoc"][
"tmp_name"],
"") == 0)
2950 $this->ctrl->setParameter($this,
"new_type", $this->type);
2956 "&baseClass=ilObjSurveyGUI");
2965 if(!isset($_POST[
"file"]))
2968 $this->ctrl->redirect($this,
"export");
2971 if (count($_POST[
"file"]) > 1)
2974 $this->ctrl->redirect($this,
"export");
2978 $export_dir = $this->
object->getExportDirectory();
2979 include_once
"./Services/Utilities/classes/class.ilUtil.php";
2989 if(!isset($_POST[
"file"]))
2992 $this->ctrl->redirect($this,
"export");
2998 $_SESSION[
"ilExportFiles"] = $_POST[
"file"];
3000 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.confirm_deletion.html",
"Modules/Survey");
3004 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"deleteExportFile"));
3007 $this->tpl->setCurrentBlock(
"table_header");
3008 $this->tpl->setVariable(
"TEXT",$this->lng->txt(
"objects"));
3009 $this->tpl->parseCurrentBlock();
3013 include_once
"./Services/Utilities/classes/class.ilUtil.php";
3014 foreach($_POST[
"file"] as
$file)
3016 $this->tpl->setCurrentBlock(
"table_row");
3018 $this->tpl->setVariable(
"TEXT_IMG_OBJ", $this->lng->txt(
"file_icon"));
3020 $this->tpl->setVariable(
"TEXT_CONTENT", $file);
3021 $this->tpl->parseCurrentBlock();
3026 $buttons = array(
"deleteExportFile" => $this->lng->txt(
"confirm"),
3027 "cancelDeleteExportFile" => $this->lng->txt(
"cancel"));
3028 foreach ($buttons as $name => $value)
3030 $this->tpl->setCurrentBlock(
"operation_btn");
3031 $this->tpl->setVariable(
"BTN_NAME",$name);
3032 $this->tpl->setVariable(
"BTN_VALUE",$value);
3033 $this->tpl->parseCurrentBlock();
3043 session_unregister(
"ilExportFiles");
3044 $this->ctrl->redirect($this,
"export");
3053 $export_dir = $this->
object->getExportDirectory();
3056 $exp_file = $export_dir.
"/".
$file;
3057 $exp_dir = $export_dir.
"/".substr($file, 0, strlen($file) - 4);
3058 if (@is_file($exp_file))
3062 if (@is_dir($exp_dir))
3064 include_once
"./Services/Utilities/classes/class.ilUtil.php";
3068 $this->ctrl->redirect($this,
"export");
3073 if (strcmp($_POST[
"lang"],
"-1") != 0)
3076 $ilUser->writePref(
"survey_code_language", $_POST[
"lang"]);
3078 $this->ctrl->redirect($this,
"codes");
3092 if ($this->object->getAnonymize() != 1)
3099 $default_lang = $ilUser->getPref(
"survey_code_language");
3102 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_codes.html",
true);
3103 if ($rbacsystem->checkAccess(
"write", $this->ref_id))
3105 $codecount = $this->
object->getSurveyCodesCount();
3108 $maxentries = $ilUser->getPref(
"hits_per_page");
3109 if ($maxentries < 1)
3114 $survey_codes =& $this->
object->getSurveyCodesTableData($default_lang,
$_GET[
"offset"], $maxentries,
$_GET[
"sort_by"],
$_GET[
"sort_order"]);
3115 $headervars = array(
"",
"counter",
"date",
"used",
"url");
3117 include_once
"./Services/Table/classes/class.ilTableGUI.php";
3119 $tbl->setTitle($this->lng->txt(
"survey_code"));
3120 $header_names = array(
3122 $this->lng->txt(
"survey_code"),
3123 $this->lng->txt(
"create_date"),
3124 $this->lng->txt(
"survey_code_used"),
3125 $this->lng->txt(
"survey_code_url")
3127 $tbl->setHeaderNames($header_names);
3129 $tbl->disable(
"sort");
3130 $tbl->disable(
"auto_sort");
3131 $tbl->disable(
"title");
3132 $tbl->disable(
"form");
3133 $tbl->enable(
"action");
3134 $tbl->enable(
"select_all");
3135 $tbl->setLimit($maxentries);
3136 $tbl->setOffset(
$_GET[
"offset"]);
3137 $tbl->setData($survey_codes);
3138 $tbl->setMaxCount($codecount);
3139 $tbl->setOrderDirection(
$_GET[
"sort_order"]);
3140 $tbl->setSelectAllCheckbox(
"chb_code");
3141 $tbl->setFormName(
"form_codes");
3142 $tbl->addActionButton(
"deleteCodes", $this->lng->txt(
"delete"));
3143 $tbl->addActionButton(
"exportCodes", $this->lng->txt(
"export"));
3145 $header_params = $this->ctrl->getParameterArray($this,
"codes");
3146 $tbl->setHeaderVars($headervars, $header_params);
3149 $tbl->setFooter(
"tblfooter", $this->lng->txt(
"previous"), $this->lng->txt(
"next"));
3151 $tableoutput = $tbl->render();
3152 $this->tpl->setCurrentBlock(
"exportall");
3153 $this->tpl->setVariable(
"VALUE_EXPORT_ALL_CODES", $this->lng->txt(
"export_all_survey_codes"));
3154 $this->tpl->parseCurrentBlock();
3158 $this->tpl->setCurrentBlock(
"emptyrow");
3159 $this->tpl->setVariable(
"NO_CODES", $this->lng->txt(
"survey_code_no_codes"));
3160 $this->tpl->parseCurrentBlock();
3163 $languages = $this->lng->getInstalledLanguages();
3164 foreach ($languages as
$lang)
3166 $this->tpl->setCurrentBlock(
"option_lang");
3167 $this->tpl->setVariable(
"VALUE_LANG", $lang);
3168 $this->tpl->setVariable(
"TEXT_LANG", $this->lng->txt(
"lang_$lang"));
3169 if (strcmp($lang, $default_lang) == 0)
3171 $this->tpl->setVariable(
"SELECTED_LANG",
" selected=\"selected\"");
3173 $this->tpl->parseCurrentBlock();
3176 $this->tpl->setCurrentBlock(
"adm_content");
3177 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"codes"));
3178 $this->tpl->setVariable(
"CODES_TABLE", $tableoutput);
3179 $this->tpl->setVariable(
"TEXT_CREATE", $this->lng->txt(
"create"));
3180 $this->tpl->setVariable(
"TEXT_SURVEY_CODES", $this->lng->txt(
"new_survey_codes"));
3181 $this->tpl->setVariable(
"TEXT_SURVEY_CODES_LANG", $this->lng->txt(
"survey_codes_lang"));
3182 $this->tpl->setVariable(
"TEXT_NO_LANGUAGE_SELECTED", $this->lng->txt(
"please_select"));
3183 $this->tpl->setVariable(
"VALUE_ACTIVATE", $this->lng->txt(
"select"));
3184 $this->tpl->parseCurrentBlock();
3201 if (is_array($_POST[
"chb_code"]) && (count($_POST[
"chb_code"]) > 0))
3203 foreach ($_POST[
"chb_code"] as $survey_code)
3205 $this->
object->deleteSurveyCode($survey_code);
3220 if (is_array($_POST[
"chb_code"]) && (count($_POST[
"chb_code"]) > 0))
3222 $export = $this->
object->getSurveyCodesForExport($_POST[
"chb_code"]);
3240 $export = $this->
object->getSurveyCodesForExport(array());
3253 if (preg_match(
"/\d+/", $_POST[
"nrOfCodes"]))
3255 $this->
object->createSurveyCodes($_POST[
"nrOfCodes"]);
3261 $this->ctrl->redirect($this,
"codes");
3273 $this->ctrl->saveParameter($this,
"preid");
3274 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_add_constraint.html",
"Modules/Survey");
3275 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
3276 if (is_array($questions))
3278 foreach ($questions as $question)
3280 $this->tpl->setCurrentBlock(
"option_q");
3281 $this->tpl->setVariable(
"OPTION_VALUE", $question[
"question_id"]);
3283 if ($question[
"question_id"] == $postvalues[
"q"])
3285 $this->tpl->setVariable(
"OPTION_CHECKED",
" selected=\"selected\"");
3287 $this->tpl->parseCurrentBlock();
3292 $relations = $this->
object->getAllRelations();
3293 foreach ($relations as $rel_id => $relation)
3295 if (in_array($relation[
"short"], $survey_questions[$postvalues[
"q"]][
"availableRelations"]))
3297 $this->tpl->setCurrentBlock(
"option_r");
3298 $this->tpl->setVariable(
"OPTION_VALUE", $rel_id);
3299 $this->tpl->setVariable(
"OPTION_TEXT", $relation[
"short"]);
3300 if ($rel_id == $postvalues[
"r"])
3302 $this->tpl->setVariable(
"OPTION_CHECKED",
" selected=\"selected\"");
3304 $this->tpl->parseCurrentBlock();
3307 $this->tpl->setCurrentBlock(
"select_relation");
3308 $this->tpl->setVariable(
"SELECT_RELATION", $this->lng->txt(
"step") .
" 2: " . $this->lng->txt(
"select_relation"));
3309 $this->tpl->parseCurrentBlock();
3314 $variables =& $this->
object->getVariables($postvalues[
"q"]);
3315 $question_type = $survey_questions[$postvalues[
"q"]][
"type_tag"];
3316 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
3318 $question =
new $question_type();
3319 $question->loadFromDb($postvalues[
"q"]);
3320 $select_value = $question->getPreconditionSelectValue($postvalues[
"v"]);
3321 $this->tpl->setCurrentBlock(
"select_value");
3322 $this->tpl->setVariable(
"SELECT_VALUE", $select_value);
3323 $this->tpl->parseCurrentBlock();
3326 $this->tpl->setCurrentBlock(
"buttons");
3327 $this->tpl->setVariable(
"BTN_CONTINUE", $this->lng->txt(
"continue"));
3331 $this->tpl->setVariable(
"COMMAND",
"constraintStep2");
3332 $this->tpl->setVariable(
"COMMAND_BACK",
"constraints");
3335 $this->tpl->setVariable(
"COMMAND",
"constraintStep3");
3336 $this->tpl->setVariable(
"COMMAND_BACK",
"constraintStep1");
3339 $this->tpl->setVariable(
"COMMAND",
"constraintsAdd");
3340 $this->tpl->setVariable(
"COMMAND_BACK",
"constraintStep2");
3343 $this->tpl->setVariable(
"BTN_BACK", $this->lng->txt(
"back"));
3344 $this->tpl->parseCurrentBlock();
3345 $this->tpl->setCurrentBlock(
"adm_content");
3347 if ($survey_questions[
$_SESSION[
"constraintstructure"][
$_GET[
"start"]][0]][
"questionblock_id"] > 0)
3349 $title = $this->lng->txt(
"questionblock") .
": " . $survey_questions[
$_SESSION[
"constraintstructure"][
$_GET[
"start"]][0]][
"questionblock_title"];
3353 $title = $this->lng->txt($survey_questions[
$_SESSION[
"constraintstructure"][
$_GET[
"start"]][0]][
"type_tag"]) .
": " . $survey_questions[
$_SESSION[
"constraintstructure"][$_GET[
"start"]][0]][
"title"];
3355 $this->tpl->setVariable(
"CONSTRAINT_QUESTION_TEXT",
$title);
3356 $this->tpl->setVariable(
"SELECT_PRIOR_QUESTION", $this->lng->txt(
"step") .
" 1: " . $this->lng->txt(
"select_prior_question"));
3357 if (strlen(
$_GET[
"start"])) $this->ctrl->setParameter($this,
"start",
$_GET[
"start"]);
3358 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"constraintsAdd"));
3359 $this->tpl->parseCurrentBlock();
3371 if (strlen($_POST[
"v"]) == 0)
3376 $survey_questions =& $this->
object->getSurveyQuestions();
3377 $structure =&
$_SESSION[
"constraintstructure"];
3378 $include_elements =
$_SESSION[
"includeElements"];
3379 foreach ($include_elements as $elementCounter)
3381 if (is_array($structure[$elementCounter]))
3383 foreach ($structure[$elementCounter] as $key => $question_id)
3385 if (strlen(
$_GET[
"preid"]))
3387 $this->
object->updateConstraint($question_id, $_POST[
"q"], $_POST[
"r"], $_POST[
"v"]);
3391 $this->
object->addConstraint($question_id, $_POST[
"q"], $_POST[
"r"], $_POST[
"v"]);
3397 unset(
$_SESSION[
"constraintstructure"]);
3398 $this->ctrl->redirect($this,
"constraints");
3410 $survey_questions =& $this->
object->getSurveyQuestions();
3411 $option_questions = array();
3412 if (strlen(
$_GET[
"precondition"]))
3414 $pc = $this->
object->getPrecondition(
$_GET[
"precondition"]);
3415 $postvalues = array(
3416 "q" => $pc[
"question_fi"],
3417 "r" => $pc[
"relation_id"],
3420 $this->ctrl->setParameter($this,
"preid",
$_GET[
"precondition"]);
3421 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"]));
3426 array_push($option_questions, array(
"question_id" => $_POST[
"q"],
"title" => $survey_questions[$_POST[
"q"]][
"title"],
"type_tag" => $survey_questions[$_POST[
"q"]][
"type_tag"]));
3440 $survey_questions =& $this->
object->getSurveyQuestions();
3441 $option_questions = array();
3442 array_push($option_questions, array(
"question_id" => $_POST[
"q"],
"title" => $survey_questions[$_POST[
"q"]][
"title"],
"type_tag" => $survey_questions[$_POST[
"q"]][
"type_tag"]));
3455 $survey_questions =& $this->
object->getSurveyQuestions();
3456 $structure =&
$_SESSION[
"constraintstructure"];
3457 $start =
$_GET[
"start"];
3458 $option_questions = array();
3459 for ($i = 1; $i < $start; $i++)
3461 if (is_array($structure[$i]))
3463 foreach ($structure[$i] as $key => $question_id)
3465 if ($survey_questions[$question_id][
"usableForPrecondition"])
3467 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"]));
3472 if (count($option_questions) == 0)
3475 unset(
$_SESSION[
"constraintstructure"]);
3476 ilUtil::sendInfo($this->lng->txt(
"constraints_no_nonessay_available"),
true);
3477 $this->ctrl->redirect($this,
"constraints");
3491 $survey_questions =& $this->
object->getSurveyQuestions();
3492 $structure =&
$_SESSION[
"constraintstructure"];
3493 foreach ($_POST as $key => $value)
3495 if (preg_match(
"/^constraint_(\d+)_(\d+)/", $key, $matches))
3497 foreach ($structure[$matches[1]] as $key => $question_id)
3499 $this->
object->deleteConstraint($matches[2], $question_id);
3504 $this->ctrl->redirect($this,
"constraints");
3509 $include_elements = $_POST[
"includeElements"];
3510 if ((!is_array($include_elements)) || (count($include_elements) == 0))
3512 ilUtil::sendInfo($this->lng->txt(
"constraints_no_questions_or_questionblocks_selected"),
true);
3513 $this->ctrl->redirect($this,
"constraints");
3515 else if (count($include_elements) >= 1)
3517 $_SESSION[
"includeElements"] = $include_elements;
3518 sort($include_elements, SORT_NUMERIC);
3519 $_GET[
"start"] = $include_elements[0];
3527 $this->ctrl->setParameter($this,
"precondition",
$_GET[
"precondition"]);
3528 $this->ctrl->setParameter($this,
"start",
$_GET[
"start"]);
3529 $this->ctrl->redirect($this,
"constraintStep3");
3545 $hasDatasets = $this->
object->_hasDatasets($this->object->getSurveyId());
3547 if (array_key_exists(
"step",
$_GET)) $step =
$_GET[
"step"];
3562 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_constraints_list.html",
"Modules/Survey");
3563 $survey_questions =& $this->
object->getSurveyQuestions();
3564 $last_questionblock_title =
"";
3566 $hasPreconditions = FALSE;
3567 $structure = array();
3568 $colors = array(
"tblrow1",
"tblrow2");
3569 foreach ($survey_questions as $question_id =>
$data)
3573 if (
$data[
"questionblock_id"] > 0)
3576 $type = $this->lng->txt(
"questionblock");
3577 if (strcmp(
$title, $last_questionblock_title) != 0)
3579 $last_questionblock_title =
$title;
3580 $structure[$counter] = array();
3581 array_push($structure[$counter],
$data[
"question_id"]);
3585 array_push($structure[$counter-1],
$data[
"question_id"]);
3591 $structure[$counter] = array(
$data[
"question_id"]);
3592 $type = $this->lng->txt(
"question");
3598 $this->tpl->setCurrentBlock(
"description");
3599 $this->tpl->setVariable(
"DESCRIPTION", $this->lng->txt(
"constraints_first_question_description"));
3600 $this->tpl->parseCurrentBlock();
3604 $constraints =& $this->
object->getConstraints(
$data[
"question_id"]);
3606 if (count($constraints))
3608 $hasPreconditions = TRUE;
3609 foreach ($constraints as $constraint)
3611 $this->tpl->setCurrentBlock(
"constraint");
3612 $this->tpl->setVariable(
"SEQUENCE_ID", $counter);
3613 $this->tpl->setVariable(
"CONSTRAINT_ID", $constraint[
"id"]);
3614 $this->tpl->setVariable(
"CONSTRAINT_TEXT", $survey_questions[$constraint[
"question"]][
"title"] .
" " . $constraint[
"short"] .
" " . $constraint[
"valueoutput"]);
3615 $this->tpl->setVariable(
"TEXT_EDIT_PRECONDITION", $this->lng->txt(
"edit"));
3616 $this->ctrl->setParameter($this,
"precondition", $constraint[
"id"]);
3617 $this->ctrl->setParameter($this,
"start", $counter);
3618 $this->tpl->setVariable(
"EDIT_PRECONDITION", $this->ctrl->getLinkTarget($this,
"editPrecondition"));
3619 $this->ctrl->setParameter($this,
"precondition",
"");
3620 $this->ctrl->setParameter($this,
"start",
"");
3621 $this->tpl->parseCurrentBlock();
3627 $this->tpl->setCurrentBlock(
"include_elements");
3628 $this->tpl->setVariable(
"QUESTION_NR",
"$counter");
3629 $this->tpl->parseCurrentBlock();
3631 $this->tpl->setCurrentBlock(
"constraint_section");
3632 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
3633 $this->tpl->setVariable(
"QUESTION_NR",
"$counter");
3634 $this->tpl->setVariable(
"TITLE",
"$title");
3635 $icontype =
"question.gif";
3636 if (
$data[
"questionblock_id"] > 0)
3638 $icontype =
"questionblock.gif";
3640 $this->tpl->setVariable(
"TYPE",
"$type: ");
3641 include_once
"./Services/Utilities/classes/class.ilUtil.php";
3643 $this->tpl->setVariable(
"ICON_ALT", $type);
3644 $this->tpl->parseCurrentBlock();
3648 if ($rbacsystem->checkAccess(
"write", $this->ref_id) and !$hasDatasets)
3650 if ($hasPreconditions)
3652 $this->tpl->setCurrentBlock(
"selectall_preconditions");
3653 $this->tpl->setVariable(
"SELECT_ALL_PRECONDITIONS", $this->lng->txt(
"select_all"));
3654 $this->tpl->parseCurrentBlock();
3656 $this->tpl->setCurrentBlock(
"selectall");
3658 $this->tpl->setVariable(
"SELECT_ALL", $this->lng->txt(
"select_all"));
3659 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
3660 $this->tpl->parseCurrentBlock();
3662 if ($hasPreconditions)
3664 $this->tpl->setCurrentBlock(
"delete_button");
3665 $this->tpl->setVariable(
"BTN_DELETE", $this->lng->txt(
"delete"));
3666 include_once
"./Services/Utilities/classes/class.ilUtil.php";
3667 $this->tpl->setVariable(
"ARROW",
"<img src=\"" .
ilUtil::getImagePath(
"arrow_downright.gif") .
"\" alt=\"".$this->lng->txt(
"arrow_downright").
"\">");
3668 $this->tpl->parseCurrentBlock();
3671 $this->tpl->setCurrentBlock(
"buttons");
3672 $this->tpl->setVariable(
"ARROW",
"<img src=\"" .
ilUtil::getImagePath(
"arrow_downright.gif") .
"\" alt=\"".$this->lng->txt(
"arrow_downright").
"\">");
3673 $this->tpl->setVariable(
"BTN_CREATE_CONSTRAINTS", $this->lng->txt(
"constraint_add"));
3674 $this->tpl->parseCurrentBlock();
3676 $this->tpl->setCurrentBlock(
"adm_content");
3677 $this->tpl->setVariable(
"CONSTRAINTS_INTRODUCTION", $this->lng->txt(
"constraints_introduction"));
3678 $this->tpl->setVariable(
"DEFINED_PRECONDITIONS", $this->lng->txt(
"existing_constraints"));
3679 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"constraints"));
3680 $this->tpl->setVariable(
"CONSTRAINTS_HEADER", $this->lng->txt(
"constraints_list_of_entities"));
3681 $this->tpl->parseCurrentBlock();
3682 $_SESSION[
"constraintstructure"] = $structure;
3696 $this->ctrl->setCmd(
"showSummary");
3697 $this->ctrl->setCmdClass(
"ilinfoscreengui");
3704 $tpl =
new ilTemplate(
"tpl.il_svy_svy_main.html", TRUE, TRUE,
"Modules/Survey");
3707 $tpl->setVariable(
"LOCATION_STYLESHEET",$location_stylesheet);
3708 $tpl->setVariable(
"LOCATION_JAVASCRIPT",dirname($location_stylesheet));
3719 if (!$ilAccess->checkAccess(
"visible",
"", $this->ref_id))
3721 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
3724 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
3726 include_once
"./Modules/Survey/classes/class.ilSurveyExecutionGUI.php";
3728 $info->setFormAction($this->ctrl->getFormAction($output_gui,
"infoScreen"));
3729 $info->enablePrivateNotes();
3730 $anonymize_key = NULL;
3731 if ($this->object->getAnonymize() == 1)
3735 $anonymize_key =
$_SESSION[
"anonymous_id"];
3737 else if ($_POST[
"anonymous_id"])
3739 $anonymize_key = $_POST[
"anonymous_id"];
3742 $canStart = $this->
object->canStartSurvey($anonymize_key);
3743 $showButtons = $canStart[
"result"];
3744 if (!$showButtons)
ilUtil::sendInfo(implode(
"<br />", $canStart[
"messages"]));
3749 if (!$this->object->getAnonymize())
3751 $survey_started = $this->
object->isSurveyStarted($ilUser->getId(),
"");
3753 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
3759 if ($survey_started === 1)
3763 elseif ($survey_started === 0)
3765 $info->addFormButton(
"resume", $this->lng->txt(
"resume_survey"));
3767 elseif ($survey_started === FALSE)
3769 $info->addFormButton(
"start", $this->lng->txt(
"start_survey"));
3774 else if ($this->object->getAnonymize() && !$this->
object->isAccessibleWithoutCode())
3776 if ((
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID) && (strlen($_POST[
"anonymous_id"]) == 0) && (strlen(
$_SESSION[
"anonymous_id"]) == 0))
3778 $info->setFormAction($this->ctrl->getFormAction($this,
"infoScreen"));
3779 $info->addSection($this->lng->txt(
"anonymization"));
3780 $info->addProperty(
"", $this->lng->txt(
"anonymize_anonymous_introduction"));
3781 $info->addPropertyTextinput($this->lng->txt(
"enter_anonymous_id"),
"anonymous_id",
"", 8,
"infoScreen", $this->lng->txt(
"submit"));
3785 if (strlen($_POST[
"anonymous_id"]) > 0)
3787 if (!$this->object->checkSurveyCode($_POST[
"anonymous_id"]))
3793 $anonymize_key = $_POST[
"anonymous_id"];
3796 else if (strlen(
$_SESSION[
"anonymous_id"]) > 0)
3798 if (!$this->object->checkSurveyCode(
$_SESSION[
"anonymous_id"]))
3804 $anonymize_key =
$_SESSION[
"anonymous_id"];
3810 $anonymize_key = $this->
object->getUserAccessCode($ilUser->getId());
3811 if (!strlen($anonymize_key))
3813 $anonymize_key = $this->
object->createNewAccessCode();
3814 $this->
object->saveUserAccessCode($ilUser->getId(), $anonymize_key);
3817 $info->addHiddenElement(
"anonymous_id", $anonymize_key);
3818 $survey_started = $this->
object->isSurveyStarted($ilUser->getId(), $anonymize_key);
3819 if ($survey_started === 1)
3823 elseif ($survey_started === 0)
3825 $info->addFormButton(
"resume", $this->lng->txt(
"resume_survey"));
3827 elseif ($survey_started === FALSE)
3829 $info->addFormButton(
"start", $this->lng->txt(
"start_survey"));
3836 $survey_started = $this->
object->isSurveyStarted($ilUser->getId(),
"");
3837 if ($survey_started === 1)
3841 elseif ($survey_started === 0)
3843 $info->addFormButton(
"resume", $this->lng->txt(
"resume_survey"));
3845 elseif ($survey_started === FALSE)
3847 $info->addFormButton(
"start", $this->lng->txt(
"start_survey"));
3852 if (strlen($this->object->getIntroduction()))
3854 $introduction = $this->
object->getIntroduction();
3855 $info->addSection($this->lng->txt(
"introduction"));
3856 $info->addProperty(
"", $this->object->prepareTextareaOutput($introduction));
3859 $info->addSection($this->lng->txt(
"svy_general_properties"));
3860 $info->addProperty($this->lng->txt(
"author"), $this->
object->getAuthor());
3861 $info->addProperty($this->lng->txt(
"title"), $this->
object->getTitle());
3862 switch ($this->object->getAnonymize())
3865 $info->addProperty($this->lng->txt(
"anonymization"), $this->lng->txt(
"anonymize_personalized"));
3868 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
3870 $info->addProperty($this->lng->txt(
"anonymization"), $this->lng->txt(
"info_anonymize_with_code"));
3874 $info->addProperty($this->lng->txt(
"anonymization"), $this->lng->txt(
"info_anonymize_registered_user"));
3878 $info->addProperty($this->lng->txt(
"anonymization"), $this->lng->txt(
"info_anonymize_without_code"));
3881 include_once
"./Modules/Survey/classes/class.ilObjSurveyAccess.php";
3884 $info->addProperty($this->lng->txt(
"evaluation_access"), $this->lng->txt(
"evaluation_access_info"));
3886 $info->addMetaDataSections($this->object->getId(),0, $this->
object->getType());
3887 $this->ctrl->forwardCommand($info);
3900 $template =
new ilTemplate(
"tpl.il_svy_svy_printview.html", TRUE, TRUE,
"Modules/Survey");
3902 if ((strlen($ilias->getSetting(
"rpc_server_host"))) && (strlen($ilias->getSetting(
"rpc_server_port"))))
3904 $this->ctrl->setParameter($this,
"pdf",
"1");
3905 $template->setCurrentBlock(
"pdf_export");
3906 $template->setVariable(
"PDF_URL", $this->ctrl->getLinkTarget($this,
"printView"));
3907 $this->ctrl->setParameter($this,
"pdf",
"");
3908 $template->setVariable(
"PDF_TEXT", $this->lng->txt(
"pdf_export"));
3909 $template->setVariable(
"PDF_IMG_ALT", $this->lng->txt(
"pdf_export"));
3911 $template->parseCurrentBlock();
3913 $template->setVariable(
"PRINT_TEXT", $this->lng->txt(
"print"));
3914 $template->setVariable(
"PRINT_URL",
"javascript:window.print();");
3916 $pages =& $this->
object->getSurveyPages();
3917 foreach ($pages as $page)
3919 if (count($page) > 0)
3921 foreach ($page as $question)
3923 $questionGUI = $this->
object->getQuestionGUI($question[
"type_tag"], $question[
"question_id"]);
3924 if (is_object($questionGUI))
3926 if (strlen($question[
"heading"]))
3928 $template->setCurrentBlock(
"textblock");
3929 $template->setVariable(
"TEXTBLOCK", $question[
"heading"]);
3930 $template->parseCurrentBlock();
3932 $template->setCurrentBlock(
"question");
3933 $template->setVariable(
"QUESTION_DATA", $questionGUI->getPrintView($this->object->getShowQuestionTitles(), $question[
"questionblock_show_questiontext"], $this->
object->getSurveyId()));
3934 $template->parseCurrentBlock();
3937 if (count($page) > 1)
3939 $template->setCurrentBlock(
"page");
3940 $template->setVariable(
"BLOCKTITLE", $page[0][
"questionblock_title"]);
3941 $template->parseCurrentBlock();
3945 $template->setCurrentBlock(
"page");
3946 $template->parseCurrentBlock();
3950 $this->tpl->addCss(
"./Modules/Survey/templates/default/survey_print.css",
"print");
3951 if (array_key_exists(
"pdf",
$_GET) && (
$_GET[
"pdf"] == 1))
3953 $printbody =
new ilTemplate(
"tpl.il_as_tst_print_body.html", TRUE, TRUE,
"Modules/Test");
3954 $printbody->setVariable(
"TITLE", sprintf($this->lng->txt(
"tst_result_user_name"), $uname));
3955 $printbody->setVariable(
"ADM_CONTENT", $template->get());
3956 $printoutput = $printbody->get();
3957 $printoutput = preg_replace(
"/href=\".*?\"/",
"", $printoutput);
3958 $fo = $this->
object->processPrintoutput2FO($printoutput);
3959 $this->
object->deliverPDFfromFO($fo);
3963 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
3970 switch ($this->ctrl->getCmd())
3976 case "redirectQuestion":
3977 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
"infoScreen"),
"",
$_GET[
"ref_id"]);
3980 case "checkEvaluationAccess":
3981 case "evaluationdetails":
3982 case "evaluationuser":
3983 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluation"),
"",
$_GET[
"ref_id"]);
3992 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
"infoScreen"),
"",
$_GET[
"ref_id"]);
3995 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"",
$_GET[
"ref_id"]);
4009 $questions = ($a_cmd ==
'questions') ?
true :
false;
4010 $printview = ($a_cmd ==
'printview') ?
true :
false;
4012 $this->tabs_gui->addSubTabTarget(
"survey_question_editor", $this->ctrl->getLinkTarget($this,
"questions"),
4013 "",
"",
"", $questions);
4014 $this->tabs_gui->addSubTabTarget(
"print_view", $this->ctrl->getLinkTarget($this,
"printView"),
4015 "",
"",
"", $printview);
4029 $ilTabs->addSubTabTarget(
4030 "svy_eval_cumulated",
4031 $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluation"),
4032 array(
"evaluation",
"checkEvaluationAccess"),
4036 $ilTabs->addSubTabTarget(
4038 $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluationdetails"),
4039 array(
"evaluationdetails"),
4043 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
4045 $ilTabs->addSubTabTarget(
4047 $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluationuser"),
4048 array(
"evaluationuser"),
4059 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
4061 $ilTabs->setBackTarget($this->lng->txt(
"menubacktosurvey"), $this->ctrl->getLinkTarget($this,
"questions"));
4062 $ilTabs->addTarget(
"browse_for_questions",
4063 $this->ctrl->getLinkTarget($this,
"browseForQuestions"),
4064 array(
"browseForQuestions",
4065 "filterQuestions",
"resetFilterQuestions",
"changeDatatype",
"insertQuestions",),
4078 global $ilAccess, $ilUser;
4080 switch ($this->ctrl->getCmd())
4082 case "browseForQuestions":
4083 case "insertQuestions":
4084 case "filterQuestions":
4085 case "resetFilterQuestions":
4086 case "changeDatatype":
4092 case "redirectQuestion":
4096 case "checkEvaluationAccess":
4097 case "evaluationdetails":
4098 case "evaluationuser":
4104 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
4106 $force_active = (
$_GET[
"up"] !=
"" ||
$_GET[
"down"] !=
"")
4110 $tabs_gui->addTarget(
"survey_questions",
4111 $this->ctrl->getLinkTarget($this,
'questions'),
4112 array(
"questions",
"browseForQuestions",
"createQuestion",
4113 "filterQuestions",
"resetFilterQuestions",
"changeDatatype",
"insertQuestions",
4114 "removeQuestions",
"cancelRemoveQuestions",
"confirmRemoveQuestions",
4115 "defineQuestionblock",
"saveDefineQuestionblock",
"cancelDefineQuestionblock",
4116 "unfoldQuestionblock",
"moveQuestions",
4117 "insertQuestionsBefore",
"insertQuestionsAfter",
"saveObligatory",
4118 "addHeading",
"saveHeading",
"cancelHeading",
"editHeading",
4119 "confirmRemoveHeading",
"cancelRemoveHeading",
"printView"),
4120 "",
"", $force_active);
4123 if ($ilAccess->checkAccess(
"visible",
"", $this->ref_id))
4125 $tabs_gui->addTarget(
"info_short",
4126 $this->ctrl->getLinkTarget($this,
'infoScreen'),
4127 array(
"infoScreen",
"showSummary"));
4131 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
4133 $force_active = ($this->ctrl->getCmd() ==
"")
4136 $tabs_gui->addTarget(
"properties",
4137 $this->ctrl->getLinkTarget($this,
'properties'),
4138 array(
"properties",
"save",
"cancel"),
"",
4143 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
4146 $tabs_gui->addTarget(
"meta_data",
4147 $this->ctrl->getLinkTargetByClass(
'ilmdeditorgui',
'listSection'),
4148 "",
"ilmdeditorgui");
4151 $tabs_gui->addTarget(
"constraints",
4152 $this->ctrl->getLinkTarget($this,
"constraints"),
4153 array(
"constraints",
"constraintStep1",
"constraintStep2",
4154 "constraintStep3",
"constraintsAdd",
"createConstraints",
4155 "editPrecondition"),
4158 if (($ilAccess->checkAccess(
"write",
"", $this->ref_id)) || ($ilAccess->checkAccess(
"invite",
"", $this->ref_id)))
4161 $tabs_gui->addTarget(
"invitation",
4162 $this->ctrl->getLinkTarget($this,
"invite"),
4163 array(
"invite",
"saveInvitationStatus",
4164 "searchInvitation",
"inviteUserGroup",
4165 "disinviteUserGroup"),
4168 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
4171 $tabs_gui->addTarget(
"export",
4172 $this->ctrl->getLinkTarget($this,
'export'),
4173 array(
"export",
"createExportFile",
"confirmDeleteExportFile",
4174 "downloadExportFile"),
4179 $tabs_gui->addTarget(
"maintenance",
4180 $this->ctrl->getLinkTarget($this,
'maintenance'),
4181 array(
"maintenance",
"deleteAllUserData"),
4184 if ($this->object->getAnonymize() == 1)
4187 $tabs_gui->addTarget(
"codes",
4188 $this->ctrl->getLinkTarget($this,
'codes'),
4189 array(
"codes",
"createSurveyCodes",
"setCodeLanguage",
"deleteCodes",
"exportCodes"),
4194 include_once
"./Modules/Survey/classes/class.ilObjSurveyAccess.php";
4198 $tabs_gui->addTarget(
"svy_evaluation",
4199 $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluation"),
4200 array(
"evaluation",
"checkEvaluationAccess",
"evaluationdetails",
4205 if ($ilAccess->checkAccess(
"edit_permission",
"", $this->ref_id))
4208 $tabs_gui->addTarget(
"perm_settings",
4209 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
4218 function _goto($a_target, $a_access_code =
"")
4221 if ($ilAccess->checkAccess(
"read",
"", $a_target))
4223 include_once
"./Services/Utilities/classes/class.ilUtil.php";
4224 if (strlen($a_access_code))
4226 $_SESSION[
"anonymous_id"] = $a_access_code;
4227 $_GET[
"baseClass"] =
"ilObjSurveyGUI";
4228 $_GET[
"cmd"] =
"infoScreen";
4229 $_GET[
"ref_id"] = $a_target;
4230 include(
"ilias.php");
4235 $_GET[
"baseClass"] =
"ilObjSurveyGUI";
4236 $_GET[
"cmd"] =
"infoScreen";
4237 $_GET[
"ref_id"] = $a_target;
4238 include(
"ilias.php");
4242 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
4244 $_GET[
"cmd"] =
"frameset";
4245 $_GET[
"target"] =
"";
4246 $_GET[
"ref_id"] = ROOT_FOLDER_ID;
4249 include(
"repository.php");
4253 $ilErr->raiseError($lng->txt(
"msg_no_perm_read_lm"), $ilErr->FATAL);