24 include_once
"./classes/class.ilObjectGUI.php";
25 include_once
"./Modules/Survey/classes/inc.SurveyConstants.php";
55 $lng->loadLanguageModule(
"survey");
57 $this->ctrl->saveParameter($this, array(
"ref_id",
"calling_survey",
"new_for_survey"));
67 global $ilAccess, $ilNavigationHistory;
71 $ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"]))
73 $ilNavigationHistory->addItem(
$_GET[
"ref_id"],
74 "ilias.php?baseClass=ilObjSurveyQuestionPoolGUI&cmd=questions&ref_id=".
$_GET[
"ref_id"],
"spl");
79 $cmd = $this->ctrl->getCmd(
"questions");
80 $next_class = $this->ctrl->getNextClass($this);
81 $this->ctrl->setReturn($this,
"questions");
82 if (
$_GET[
"q_id"] < 1)
84 $q_type = ($_POST[
"sel_question_types"] !=
"")
85 ? $_POST[
"sel_question_types"]
86 :
$_GET[
"sel_question_types"];
91 include_once
"./Services/MetaData/classes/class.ilMDEditorGUI.php";
92 $md_gui =&
new ilMDEditorGUI($this->object->getId(), 0, $this->
object->getType());
93 $md_gui->
addObserver($this->
object,
'MDUpdateListener',
'General');
95 $this->ctrl->forwardCommand($md_gui);
98 case 'ilpermissiongui':
99 include_once(
"./classes/class.ilPermissionGUI.php");
101 $ret =& $this->ctrl->forwardCommand($perm_gui);
104 case "ilsurveyphrasesgui":
105 include_once(
"./Modules/SurveyQuestionPool/classes/class.ilSurveyPhrasesGUI.php");
107 $ret =& $this->ctrl->forwardCommand($phrases_gui);
116 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
118 $q_gui->object->setObjId($this->object->getId());
119 $q_gui->setQuestionTabs();
120 $ret =& $this->ctrl->forwardCommand($q_gui);
123 if (strtolower(
$_GET[
"baseClass"]) !=
"iladministrationgui" &&
157 "&baseClass=ilObjSurveyQuestionPoolGUI");
170 $this->ctrl->redirect($this,
"questions");
180 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_properties.html",
"Modules/SurveyQuestionPool");
181 $this->tpl->setCurrentBlock(
"adm_content");
182 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
183 $this->tpl->setVariable(
"HEADING_GENERAL", $this->lng->txt(
"spl_general_properties"));
184 $this->tpl->setVariable(
"PROPERTY_ONLINE", $this->lng->txt(
"spl_online_property"));
185 $this->tpl->setVariable(
"PROPERTY_ONLINE_DESCRIPTION", $this->lng->txt(
"spl_online_property_description"));
186 if ($this->object->getOnline() == 1)
188 $this->tpl->setVariable(
"PROPERTY_ONLINE_CHECKED",
" checked=\"checked\"");
190 if ($rbacsystem->checkAccess(
'write', $this->ref_id))
192 $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save"));
196 $this->tpl->setVariable(
"PROPERTY_ONLINE_DISABLED",
" disabled=\"disabled\"");
198 $this->tpl->parseCurrentBlock();
206 $qpl_online = $_POST[
"online"];
207 if (strlen($qpl_online) == 0) $qpl_online =
"0";
208 $this->
object->setOnline($qpl_online);
209 $this->
object->saveToDb();
211 $this->ctrl->redirect($this,
"properties");
225 $checked_questions = array();
226 foreach ($_POST as $key => $value)
228 if (preg_match(
"/cb_(\d+)/", $key, $matches))
230 array_push($checked_questions, $matches[1]);
234 if (count($checked_questions) > 0)
236 $_SESSION[
"spl_copied_questions"] = $checked_questions;
238 else if (count($checked_questions) == 0)
241 $_SESSION[
"spl_copied_questions"] = array();
252 $checked_questions = array();
253 foreach ($_POST as $key => $value) {
254 if (preg_match(
"/cb_(\d+)/", $key, $matches)) {
255 array_push($checked_questions, $matches[1]);
260 if (count($checked_questions) > 0)
284 $checked_questions = array();
285 foreach ($_POST as $key => $value)
287 if (preg_match(
"/cb_(\d+)/", $key, $matches))
289 array_push($checked_questions, $matches[1]);
293 if (count($checked_questions) > 0)
295 if ($rbacsystem->checkAccess(
'write', $this->ref_id))
306 elseif (count($checked_questions) == 0)
312 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_confirm_delete_questions.html",
"Modules/SurveyQuestionPool");
313 $whereclause = join($checked_questions,
" OR survey_question.question_id = ");
314 $whereclause =
" AND (survey_question.question_id = " . $whereclause .
")";
315 $query =
"SELECT survey_question.*, survey_questiontype.type_tag FROM survey_question, survey_questiontype WHERE survey_question.questiontype_fi = survey_questiontype.questiontype_id$whereclause ORDER BY survey_question.title";
316 $query_result = $this->ilias->db->query($query);
317 $colors = array(
"tblrow1",
"tblrow2");
319 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
320 if ($query_result->numRows() > 0)
322 while (
$data = $query_result->fetchRow(MDB2_FETCHMODE_OBJECT))
324 if (in_array(
$data->question_id, $checked_questions))
326 $this->tpl->setCurrentBlock(
"row");
327 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
328 $this->tpl->setVariable(
"TXT_TITLE",
$data->title);
329 $this->tpl->setVariable(
"TXT_DESCRIPTION",
$data->description);
331 $this->tpl->parseCurrentBlock();
336 foreach ($checked_questions as $id)
338 $this->tpl->setCurrentBlock(
"hidden");
339 $this->tpl->setVariable(
"HIDDEN_NAME",
"id_$id");
340 $this->tpl->setVariable(
"HIDDEN_VALUE",
"1");
341 $this->tpl->parseCurrentBlock();
344 $this->tpl->setCurrentBlock(
"adm_content");
345 $this->tpl->setVariable(
"TXT_TITLE", $this->lng->txt(
"title"));
346 $this->tpl->setVariable(
"TXT_DESCRIPTION", $this->lng->txt(
"description"));
347 $this->tpl->setVariable(
"TXT_TYPE", $this->lng->txt(
"question_type"));
348 $this->tpl->setVariable(
"BTN_CONFIRM", $this->lng->txt(
"confirm"));
349 $this->tpl->setVariable(
"BTN_CANCEL", $this->lng->txt(
"cancel"));
350 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
351 $this->tpl->parseCurrentBlock();
361 $checked_questions = array();
362 foreach ($_POST as $key => $value) {
363 if (preg_match(
"/id_(\d+)/", $key, $matches)) {
364 array_push($checked_questions, $matches[1]);
368 foreach ($checked_questions as $key => $value) {
369 $this->
object->removeQuestion($value);
371 $this->ctrl->redirect($this,
"questions");
380 $this->ctrl->redirect($this,
"questions");
395 if (count(
$_SESSION[
"spl_copied_questions"]) == 0)
399 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_confirm_paste_questions.html",
"Modules/SurveyQuestionPool");
400 $questions_info =& $this->
object->getQuestionsInfo(
$_SESSION[
"spl_copied_questions"]);
401 $colors = array(
"tblrow1",
"tblrow2");
403 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
404 foreach ($questions_info as
$data)
406 $this->tpl->setCurrentBlock(
"row");
407 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
408 $this->tpl->setVariable(
"TXT_TITLE", $data[
"title"]);
409 $this->tpl->setVariable(
"TXT_DESCRIPTION", $data[
"description"]);
411 $this->tpl->parseCurrentBlock();
414 foreach ($questions_info as $data)
416 $this->tpl->setCurrentBlock(
"hidden");
417 $this->tpl->setVariable(
"HIDDEN_NAME",
"id_" . $data[
"question_id"]);
418 $this->tpl->setVariable(
"HIDDEN_VALUE", $data[
"question_id"]);
419 $this->tpl->parseCurrentBlock();
422 $this->tpl->setCurrentBlock(
"adm_content");
423 $this->tpl->setVariable(
"TXT_TITLE", $this->lng->txt(
"title"));
424 $this->tpl->setVariable(
"TXT_DESCRIPTION", $this->lng->txt(
"description"));
425 $this->tpl->setVariable(
"TXT_TYPE", $this->lng->txt(
"question_type"));
426 $this->tpl->setVariable(
"BTN_CONFIRM", $this->lng->txt(
"confirm"));
427 $this->tpl->setVariable(
"BTN_CANCEL", $this->lng->txt(
"cancel"));
428 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
429 $this->tpl->parseCurrentBlock();
439 $checked_questions = array();
440 foreach ($_POST as $key => $value) {
441 if (preg_match(
"/id_(\d+)/", $key, $matches)) {
442 array_push($checked_questions, $matches[1]);
445 foreach ($checked_questions as $key => $value) {
446 $this->
object->paste($value);
449 $this->ctrl->redirect($this,
"questions");
458 $this->ctrl->redirect($this,
"questions");
466 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_import_question.html",
"Modules/SurveyQuestionPool");
467 $this->tpl->setCurrentBlock(
"adm_content");
468 $this->tpl->setVariable(
"TEXT_IMPORT_QUESTION", $this->lng->txt(
"import_question"));
469 $this->tpl->setVariable(
"TEXT_SELECT_FILE", $this->lng->txt(
"select_file"));
470 $this->tpl->setVariable(
"TEXT_UPLOAD", $this->lng->txt(
"upload"));
471 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
472 $this->tpl->parseCurrentBlock();
481 $source = $_FILES[
"qtidoc"][
"tmp_name"];
483 if (($source ==
'none') || (!$source) || $_FILES[
"qtidoc"][
"error"] > UPLOAD_ERR_OK)
489 if (strpos(
"xml", $_FILES[
"qtidoc"][
"type"]) !== FALSE)
498 $this->
object->createImportDirectory();
501 $full_path = $this->
object->getImportDirectory().
"/".$_FILES[
"qtidoc"][
"name"];
503 include_once
"./Services/Utilities/classes/class.ilUtil.php";
505 $_FILES[
"qtidoc"][
"name"], $full_path);
507 $source = $full_path;
508 $this->
object->importObject($source, TRUE);
511 $this->ctrl->redirect($this,
"questions");
533 $lastquestiontype = $ilUser->getPref(
"svy_lastquestiontype");
538 $filter_text = $_POST[
"filter_text"];
539 $filter_type = $_POST[
"sel_filter_type"];
543 $filter_text =
$_GET[
"filter_text"];
544 $filter_type =
$_GET[
"sel_filter_type"];
547 if (strcmp($this->ctrl->getCmd(),
"reset") == 0)
554 $this->ctrl->setParameter($this,
"filter_text", $filter_text);
555 $this->ctrl->setParameter($this,
"sel_filter_type", $filter_type);
558 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_questions.html",
"Modules/SurveyQuestionPool");
559 if ($rbacsystem->checkAccess(
"write", $this->ref_id))
561 $this->tpl->addBlockFile(
"CREATE_QUESTION",
"create_question",
"tpl.il_svy_qpl_create_new_question.html",
"Modules/SurveyQuestionPool");
563 $this->tpl->addBlockFile(
"A_BUTTONS",
"a_buttons",
"tpl.il_svy_qpl_action_buttons.html",
"Modules/SurveyQuestionPool");
564 $this->tpl->addBlockFile(
"FILTER_QUESTION_MANAGER",
"filter_questions",
"tpl.il_svy_qpl_filter_questions.html",
"Modules/SurveyQuestionPool");
567 $filter_fields = array(
568 "title" => $this->lng->txt(
"title"),
569 "description" => $this->lng->txt(
"description"),
570 "author" => $this->lng->txt(
"author"),
572 $this->tpl->setCurrentBlock(
"filterrow");
573 foreach ($filter_fields as $key => $value)
575 $this->tpl->setVariable(
"VALUE_FILTER_TYPE",
"$key");
576 $this->tpl->setVariable(
"NAME_FILTER_TYPE",
"$value");
577 if (!$_POST[
"cmd"][
"reset"])
579 if (strcmp($filter_type, $key) == 0)
581 $this->tpl->setVariable(
"VALUE_FILTER_SELECTED",
" selected=\"selected\"");
584 $this->tpl->parseCurrentBlock();
587 $this->tpl->setCurrentBlock(
"filter_questions");
588 $this->tpl->setVariable(
"FILTER_TEXT", $this->lng->txt(
"filter"));
589 $this->tpl->setVariable(
"TEXT_FILTER_BY", $this->lng->txt(
"by"));
590 if (strcmp($this->ctrl->getCmd(),
"reset") != 0)
592 $this->tpl->setVariable(
"VALUE_FILTER_TEXT", $filter_text);
594 $this->tpl->setVariable(
"VALUE_SUBMIT_FILTER", $this->lng->txt(
"set_filter"));
595 $this->tpl->setVariable(
"VALUE_RESET_FILTER", $this->lng->txt(
"reset_filter"));
596 $this->tpl->parseCurrentBlock();
599 if (
$_GET[
"prevrow"])
601 $startrow =
$_GET[
"prevrow"];
603 if (
$_GET[
"nextrow"])
605 $startrow =
$_GET[
"nextrow"];
607 if (
$_GET[
"startrow"])
609 $startrow =
$_GET[
"startrow"];
614 $_GET[
"sort"] =
"title";
620 $this->ctrl->setParameter($this,
"sort", $sort);
621 $this->ctrl->setParameter($this,
"sortorder", $sortorder);
622 $table = $this->
object->getQuestionsTable($sort, $sortorder, $filter_text, $filter_type, $startrow);
623 $colors = array(
"tblrow1",
"tblrow2");
625 $last_questionblock_id = 0;
626 $editable = $rbacsystem->checkAccess(
'write', $this->ref_id);
627 foreach ($table[
"rows"] as
$data)
629 $this->tpl->setCurrentBlock(
"checkable");
630 $this->tpl->setVariable(
"QUESTION_ID", $data[
"question_id"]);
631 $this->tpl->parseCurrentBlock();
632 if ($data[
"complete"] == 0)
634 $this->tpl->setCurrentBlock(
"qpl_warning");
635 include_once
"./Services/Utilities/classes/class.ilUtil.php";
637 $this->tpl->setVariable(
"ALT_WARNING", $this->lng->txt(
"warning_question_not_complete"));
638 $this->tpl->setVariable(
"TITLE_WARNING", $this->lng->txt(
"warning_question_not_complete"));
639 $this->tpl->parseCurrentBlock();
641 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
643 $classnamegui = $classname .
"GUI";
644 $sel_question_types = $classname;
645 $this->ctrl->setParameterByClass(strtolower($classnamegui),
"q_id", $data[
"question_id"]);
646 $this->ctrl->setParameterByClass(strtolower($classnamegui),
"sel_question_types", $sel_question_types);
649 $this->tpl->setCurrentBlock(
"url_edit");
650 $this->tpl->setVariable(
"URL_EDIT", $this->ctrl->getLinkTargetByClass(strtolower($classnamegui),
"editQuestion"));
651 $this->tpl->setVariable(
"TEXT_EDIT", $this->lng->txt(
"edit"));
652 $this->tpl->parseCurrentBlock();
654 $this->tpl->setCurrentBlock(
"QTab");
655 $this->tpl->setVariable(
"QUESTION_TITLE",
"<strong>" . $data[
"title"] .
"</strong>");
656 $this->tpl->setVariable(
"URL_PREVIEW", $this->ctrl->getLinkTargetByClass(strtolower($classnamegui),
"preview"));
657 $this->tpl->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
"preview"));
658 $this->tpl->setVariable(
"QUESTION_DESCRIPTION", $data[
"description"]);
660 $this->tpl->setVariable(
"QUESTION_AUTHOR", $data[
"author"]);
661 include_once
"./classes/class.ilFormat.php";
664 $this->tpl->setVariable(
"QUESTION_ID", $data[
"question_id"]);
665 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
666 $this->tpl->parseCurrentBlock();
670 if ($table[
"rowcount"] > count($table[
"rows"]))
672 $nextstep = $table[
"nextrow"] + $table[
"step"];
673 if ($nextstep > $table[
"rowcount"])
675 $nextstep = $table[
"rowcount"];
678 for ($i = 0; $i < $table[
"rowcount"]; $i += $table[
"step"])
680 $this->tpl->setCurrentBlock(
"pages");
681 if ($table[
"startrow"] == $i)
683 $this->tpl->setVariable(
"PAGE_NUMBER",
"<span class=\"inactivepage\">$counter</span>");
687 $this->tpl->setVariable(
"PAGE_NUMBER",
"<a href=\"" . $this->ctrl->getLinkTarget($this,
"questions") .
"&nextrow=$i" .
"\">$counter</a>");
689 $this->tpl->parseCurrentBlock();
692 $this->tpl->setCurrentBlock(
"navigation_bottom");
693 $this->tpl->setVariable(
"TEXT_ITEM", $this->lng->txt(
"item"));
694 $this->tpl->setVariable(
"TEXT_ITEM_START", $table[
"startrow"] + 1);
695 $end = $table[
"startrow"] + $table[
"step"];
696 if ($end > $table[
"rowcount"])
698 $end = $table[
"rowcount"];
700 $this->tpl->setVariable(
"TEXT_ITEM_END", $end);
701 $this->tpl->setVariable(
"TEXT_OF", strtolower($this->lng->txt(
"of")));
702 $this->tpl->setVariable(
"TEXT_ITEM_COUNT", $table[
"rowcount"]);
703 $this->tpl->setVariable(
"TEXT_PREVIOUS", $this->lng->txt(
"previous"));
704 $this->tpl->setVariable(
"TEXT_NEXT", $this->lng->txt(
"next"));
705 $this->tpl->setVariable(
"HREF_PREV_ROWS", $this->ctrl->getLinkTarget($this,
"questions") .
"&prevrow=" . $table[
"prevrow"]);
706 $this->tpl->setVariable(
"HREF_NEXT_ROWS", $this->ctrl->getLinkTarget($this,
"questions") .
"&nextrow=" . $table[
"nextrow"]);
707 $this->tpl->parseCurrentBlock();
713 $this->tpl->setCurrentBlock(
"Emptytable");
714 $this->tpl->setVariable(
"TEXT_EMPTYTABLE", $this->lng->txt(
"no_questions_available"));
715 $this->tpl->parseCurrentBlock();
719 $this->tpl->setCurrentBlock(
"selectall");
720 $this->tpl->setVariable(
"SELECT_ALL", $this->lng->txt(
"select_all"));
722 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter % 2]);
723 $this->tpl->parseCurrentBlock();
726 include_once
"./Services/Utilities/classes/class.ilUtil.php";
727 $this->tpl->setVariable(
"ARROW",
"<img src=\"" .
ilUtil::getImagePath(
"arrow_downright.gif") .
"\" alt=\"".$this->lng->txt(
"arrow_downright").
"\">");
728 $this->tpl->setCurrentBlock(
"copy");
729 $this->tpl->setVariable(
"COPY", $this->lng->txt(
"copy"));
730 $this->tpl->parseCurrentBlock();
731 $this->tpl->setCurrentBlock(
"exportquestions");
732 $this->tpl->setVariable(
"EXPORT", $this->lng->txt(
"export"));
733 $this->tpl->parseCurrentBlock();
736 if ($rbacsystem->checkAccess(
"write", $this->ref_id))
738 $this->tpl->setVariable(
"DELETE", $this->lng->txt(
"delete"));
739 $this->tpl->setVariable(
"PASTE", $this->lng->txt(
"paste"));
740 if ((!array_key_exists(
"spl_copied_questions",
$_SESSION)) || (count(
$_SESSION[
"spl_copied_questions"]) == 0))
742 $this->tpl->setVariable(
"PASTE_DISABLED",
" disabled=\"disabled\"");
746 if ($rbacsystem->checkAccess(
"write", $this->ref_id))
749 $questiontypes =& $this->
object->_getQuestiontypes();
750 $this->tpl->setCurrentBlock(
"QTypes");
751 foreach ($questiontypes as $questiontypeTranslation => $questiontype)
753 if (strcmp($lastquestiontype, $questiontype[
"type_tag"]) == 0)
755 $this->tpl->setVariable(
"QUESTION_TYPE_SELECTED",
" selected=\"selected\"");
757 $this->tpl->setVariable(
"QUESTION_TYPE_ID", $questiontype[
"type_tag"]);
758 $this->tpl->setVariable(
"QUESTION_TYPE", $questiontypeTranslation);
759 $this->tpl->parseCurrentBlock();
761 $this->tpl->setCurrentBlock(
"CreateQuestion");
762 $this->tpl->setVariable(
"QUESTION_ADD", $this->lng->txt(
"create"));
763 $this->tpl->setVariable(
"QUESTION_IMPORT", $this->lng->txt(
"import"));
764 $this->tpl->setVariable(
"ACTION_QUESTION_ADD", $this->ctrl->getFormAction($this));
765 $this->tpl->parseCurrentBlock();
769 "title" => (strcmp($sort,
"title") == 0) ? $sortorder :
"",
770 "description" => (strcmp($sort,
"description") == 0) ? $sortorder :
"",
771 "type" => (strcmp($sort,
"type") == 0) ? $sortorder :
"",
772 "author" => (strcmp($sort,
"author") == 0) ? $sortorder :
"",
773 "created" => (strcmp($sort,
"created") == 0) ? $sortorder :
"",
774 "updated" => (strcmp($sort,
"updated") == 0) ? $sortorder :
""
776 foreach ($sortarray as $key => $value)
778 if (strcmp($value,
"ASC") == 0)
780 $sortarray[$key] =
"DESC";
784 $sortarray[$key] =
"ASC";
788 $this->tpl->setCurrentBlock(
"adm_content");
790 $this->ctrl->setParameterByClass(get_class($this),
"startrow", $table[
"startrow"]);
791 $this->ctrl->setParameter($this,
"sort",
"title");
792 $this->ctrl->setParameter($this,
"sortorder", $sortarray[
"title"]);
793 $this->tpl->setVariable(
"QUESTION_TITLE",
"<a href=\"" . $this->ctrl->getLinkTarget($this,
"questions") .
"\">" . $this->lng->txt(
"title") .
"</a>" . $table[
"images"][
"title"]);
794 $this->ctrl->setParameter($this,
"sort",
"description");
795 $this->ctrl->setParameter($this,
"sortorder", $sortarray[
"description"]);
796 $this->tpl->setVariable(
"QUESTION_DESCRIPTION",
"<a href=\"" . $this->ctrl->getLinkTarget($this,
"questions") .
"\">" . $this->lng->txt(
"description") .
"</a>". $table[
"images"][
"description"]);
797 $this->ctrl->setParameter($this,
"sort",
"type");
798 $this->ctrl->setParameter($this,
"sortorder", $sortarray[
"type"]);
799 $this->tpl->setVariable(
"QUESTION_TYPE",
"<a href=\"" . $this->ctrl->getLinkTarget($this,
"questions") .
"\">" . $this->lng->txt(
"question_type") .
"</a>" . $table[
"images"][
"type"]);
800 $this->ctrl->setParameter($this,
"sort",
"author");
801 $this->ctrl->setParameter($this,
"sortorder", $sortarray[
"author"]);
802 $this->tpl->setVariable(
"QUESTION_AUTHOR",
"<a href=\"" . $this->ctrl->getLinkTarget($this,
"questions") .
"\">" . $this->lng->txt(
"author") .
"</a>" . $table[
"images"][
"author"]);
803 $this->ctrl->setParameter($this,
"sort",
"created");
804 $this->ctrl->setParameter($this,
"sortorder", $sortarray[
"created"]);
805 $this->tpl->setVariable(
"QUESTION_CREATED",
"<a href=\"" . $this->ctrl->getLinkTarget($this,
"questions") .
"\">" . $this->lng->txt(
"create_date") .
"</a>" . $table[
"images"][
"created"]);
806 $this->ctrl->setParameter($this,
"sort",
"updated");
807 $this->ctrl->setParameter($this,
"sortorder", $sortarray[
"updated"]);
808 $this->tpl->setVariable(
"QUESTION_UPDATED",
"<a href=\"" . $this->ctrl->getLinkTarget($this,
"questions") .
"\">" . $this->lng->txt(
"last_update") .
"</a>" . $table[
"images"][
"updated"]);
809 $this->tpl->setVariable(
"BUTTON_CANCEL", $this->lng->txt(
"cancel"));
810 $this->ctrl->setParameter($this,
"sort", $sort);
811 $this->ctrl->setParameter($this,
"sortorder", $sortorder);
812 $this->tpl->setVariable(
"ACTION_QUESTION_FORM", $this->ctrl->getFormAction($this));
813 $this->tpl->parseCurrentBlock();
820 $this->update = $this->
object->update();
834 $this->tpl->addBlockfile(
"BUTTONS",
"buttons",
"tpl.buttons.html");
837 $this->tpl->setCurrentBlock(
"btn_cell");
838 $this->tpl->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this,
"createExportFile"));
839 $this->tpl->setVariable(
"BTN_TXT", $this->lng->txt(
"svy_create_export_file"));
840 $this->tpl->parseCurrentBlock();
842 $export_dir = $this->
object->getExportDirectory();
843 $export_files = $this->
object->getExportFiles($export_dir);
846 include_once(
"./Services/Table/classes/class.ilTableGUI.php");
850 $this->tpl->addBlockfile(
"ADM_CONTENT",
"adm_content",
"tpl.table.html");
853 $this->tpl->addBlockfile(
"TBL_CONTENT",
"tbl_content",
"tpl.export_file_row.html",
"Modules/SurveyQuestionPool");
857 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
859 $tbl->setTitle($this->lng->txt(
"svy_export_files"));
861 $tbl->setHeaderNames(array(
"", $this->lng->txt(
"svy_file"),
862 $this->lng->txt(
"svy_size"), $this->lng->txt(
"date") ));
864 $tbl->enabled[
"sort"] =
false;
865 $tbl->setColumnWidth(array(
"1%",
"49%",
"25%",
"25%"));
868 $tbl->setOrderColumn(
$_GET[
"sort_by"]);
869 $tbl->setOrderDirection(
$_GET[
"sort_order"]);
870 $tbl->setLimit(
$_GET[
"limit"]);
871 $tbl->setOffset(
$_GET[
"offset"]);
872 $tbl->setMaxCount($this->maxcount);
873 $header_params = $this->ctrl->getParameterArray($this,
"export");
874 $tbl->setHeaderVars(array(
"",
"file",
"size",
"date"), $header_params);
877 include_once
"./Services/Utilities/classes/class.ilUtil.php";
880 $tbl->setFooter(
"tblfooter",$this->lng->txt(
"previous"),$this->lng->txt(
"next"));
883 $tbl->setMaxCount(count($export_files));
884 $export_files = array_slice($export_files,
$_GET[
"offset"],
$_GET[
"limit"]);
887 if(count($export_files) > 0)
889 $this->tpl->setVariable(
"COLUMN_COUNTS", 4);
892 foreach($export_files as $exp_file)
894 $this->tpl->setCurrentBlock(
"tbl_content");
895 $this->tpl->setVariable(
"TXT_FILENAME", $exp_file);
898 $this->tpl->setVariable(
"CSS_ROW", $css_row);
900 $this->tpl->setVariable(
"TXT_SIZE", filesize($export_dir.
"/".$exp_file));
901 $this->tpl->setVariable(
"CHECKBOX_ID", $exp_file);
903 $file_arr = explode(
"__", $exp_file);
904 $this->tpl->setVariable(
"TXT_DATE", date(
"Y-m-d H:i:s",$file_arr[0]));
906 $this->tpl->parseCurrentBlock();
908 $this->tpl->setCurrentBlock(
"selectall");
909 $this->tpl->setVariable(
"SELECT_ALL", $this->lng->txt(
"select_all"));
910 $this->tpl->setVariable(
"CSS_ROW", $css_row);
911 $this->tpl->parseCurrentBlock();
913 $this->tpl->setCurrentBlock(
"tbl_action_btn");
914 $this->tpl->setVariable(
"BTN_NAME",
"confirmDeleteExportFile");
915 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"delete"));
916 $this->tpl->parseCurrentBlock();
918 $this->tpl->setCurrentBlock(
"tbl_action_btn");
919 $this->tpl->setVariable(
"BTN_NAME",
"downloadExportFile");
920 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"download"));
921 $this->tpl->parseCurrentBlock();
925 $this->tpl->setCurrentBlock(
"notfound");
926 $this->tpl->setVariable(
"TXT_OBJECT_NOT_FOUND", $this->lng->txt(
"obj_not_found"));
927 $this->tpl->setVariable(
"NUM_COLS", 3);
928 $this->tpl->parseCurrentBlock();
931 $this->tpl->parseCurrentBlock();
941 if ($rbacsystem->checkAccess(
"write", $this->ref_id))
943 include_once(
"./Modules/SurveyQuestionPool/classes/class.ilSurveyQuestionpoolExport.php");
945 $survey_exp->buildExportFile($questions);
946 $this->ctrl->redirect($this,
"export");
959 if(!isset($_POST[
"file"]))
962 $this->ctrl->redirect($this,
"export");
965 if (count($_POST[
"file"]) > 1)
968 $this->ctrl->redirect($this,
"export");
972 $export_dir = $this->
object->getExportDirectory();
973 include_once
"./Services/Utilities/classes/class.ilUtil.php";
983 if(!isset($_POST[
"file"]))
986 $this->ctrl->redirect($this,
"export");
992 $_SESSION[
"ilExportFiles"] = $_POST[
"file"];
994 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.confirm_deletion.html",
"Modules/SurveyQuestionPool");
998 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1001 $this->tpl->setCurrentBlock(
"table_header");
1002 $this->tpl->setVariable(
"TEXT",$this->lng->txt(
"objects"));
1003 $this->tpl->parseCurrentBlock();
1007 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1008 foreach($_POST[
"file"] as
$file)
1010 $this->tpl->setCurrentBlock(
"table_row");
1012 $this->tpl->setVariable(
"TEXT_IMG_OBJ", $this->lng->txt(
"file_icon"));
1014 $this->tpl->setVariable(
"TEXT_CONTENT", $file);
1015 $this->tpl->parseCurrentBlock();
1021 "deleteExportFile" => $this->lng->txt(
"confirm"),
1022 "cancelDeleteExportFile" => $this->lng->txt(
"cancel")
1024 foreach ($buttons as $name => $value)
1026 $this->tpl->setCurrentBlock(
"operation_btn");
1027 $this->tpl->setVariable(
"BTN_NAME",$name);
1028 $this->tpl->setVariable(
"BTN_VALUE",$value);
1029 $this->tpl->parseCurrentBlock();
1039 session_unregister(
"ilExportFiles");
1040 $this->ctrl->redirect($this,
"export");
1049 $export_dir = $this->
object->getExportDirectory();
1052 $exp_file = $export_dir.
"/".
$file;
1053 $exp_dir = $export_dir.
"/".substr($file, 0, strlen($file) - 4);
1054 if (@is_file($exp_file))
1058 if (@is_dir($exp_dir))
1060 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1064 $this->ctrl->redirect($this,
"export");
1075 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"]))
1077 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
1080 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1081 $this->tpl->setVariable(
"BTN_NAME",
"uploadSpl");
1082 $this->tpl->setVariable(
"TXT_UPLOAD", $this->lng->txt(
"upload"));
1083 $this->tpl->setVariable(
"TXT_IMPORT_SPL", $this->lng->txt(
"import_spl"));
1084 $this->tpl->setVariable(
"TXT_SELECT_MODE", $this->lng->txt(
"select_mode"));
1085 $this->tpl->setVariable(
"TXT_SELECT_FILE", $this->lng->txt(
"select_file"));
1093 if ($_FILES[
"xmldoc"][
"error"] > UPLOAD_ERR_OK)
1099 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
1103 $newObj->setType(
$_GET[
"new_type"]);
1105 $newObj->setTitle(
"dummy");
1109 $newObj->create(
true);
1111 $newObj->createReference();
1113 $newObj->putInTree(
$_GET[
"ref_id"]);
1115 $newObj->setPermissions(
$_GET[
"ref_id"]);
1117 $newObj->notify(
"new",
$_GET[
"ref_id"],
$_GET[
"parent_non_rbac_id"],
$_GET[
"ref_id"],$newObj->getRefId());
1120 $newObj->createImportDirectory();
1123 $file = pathinfo($_FILES[
"xmldoc"][
"name"]);
1124 $full_path = $newObj->getImportDirectory().
"/".$_FILES[
"xmldoc"][
"name"];
1125 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1127 $_FILES[
"xmldoc"][
"name"], $full_path);
1131 $qtiresult = $newObj->importObject($full_path);
1135 $this->ctrl->redirect($this,
"cancel");
1138 return $newObj->getRefId();
1147 $new_type = $_POST[
"new_type"] ? $_POST[
"new_type"] :
$_GET[
"new_type"];
1148 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"], $new_type))
1150 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
1156 include_once(
"./Modules/Survey/classes/class.ilObjSurvey.php");
1158 $this->tpl->setCurrentBlock(
"adm_content");
1162 $data[
"fields"] = array();
1163 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1167 foreach (
$data[
"fields"] as $key => $val)
1169 $this->tpl->setVariable(
"TXT_".strtoupper($key), $this->lng->txt($key));
1170 $this->tpl->setVariable(strtoupper($key), $val);
1172 if ($this->prepare_output)
1174 $this->tpl->parseCurrentBlock();
1178 $this->ctrl->setParameter($this,
"new_type", $this->type);
1179 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1180 $this->tpl->setVariable(
"TXT_HEADER", $this->lng->txt($new_type.
"_new"));
1181 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
1182 $this->tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt($new_type.
"_add"));
1183 $this->tpl->setVariable(
"CMD_SUBMIT",
"save");
1184 $this->tpl->setVariable(
"TARGET",
' target="'.
1186 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
1188 $this->tpl->setVariable(
"TXT_IMPORT_SPL", $this->lng->txt(
"import_spl"));
1189 $this->tpl->setVariable(
"TXT_SPL_FILE", $this->lng->txt(
"spl_upload_file"));
1190 $this->tpl->setVariable(
"NEW_TYPE", $this->type);
1191 $this->tpl->setVariable(
"TXT_IMPORT", $this->lng->txt(
"import"));
1194 $this->tpl->setVariable(
"ALT_IMG",$this->lng->txt(
"obj_spl"));
1196 $this->tpl->setVariable(
"ALT_IMG2",$this->lng->txt(
"obj_spl"));
1198 $this->tpl->parseCurrentBlock();
1207 if (strcmp($_FILES[
"xmldoc"][
"tmp_name"],
"") == 0)
1213 $this->ctrl->setParameter($this,
"new_type", $this->type);
1219 "&baseClass=ilObjSurveyQuestionPoolGUI");
1228 $ilUser->writePref(
"svy_lastquestiontype", $_POST[
"sel_question_types"]);
1229 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
1231 $q_gui->object->setObjId($this->object->getId());
1232 $this->ctrl->setParameter($this,
"sel_question_types", $_POST[
"sel_question_types"]);
1233 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
1241 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
1243 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types", $q_gui->getQuestionType());
1244 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id",
$_GET[
"q_id"]);
1245 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
1253 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
1255 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types", $q_gui->getQuestionType());
1256 $this->ctrl->redirectByClass(get_class($q_gui),
"editQuestion");
1264 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
1266 $this->ctrl->setParameterByClass(get_class($q_gui),
"sel_question_types", $q_gui->getQuestionType());
1267 $this->ctrl->setParameterByClass(get_class($q_gui),
"q_id",
$_GET[
"preview"]);
1268 $this->ctrl->redirectByClass(get_class($q_gui),
"preview");
1274 switch ($this->ctrl->getCmd())
1281 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"",
$_GET[
"ref_id"]);
1284 if (
$_GET[
"q_id"] > 0)
1286 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
1288 $this->ctrl->setParameterByClass($q_type,
"q_id",
$_GET[
"q_id"]);
1300 $next_class = $this->ctrl->getNextClass($this);
1301 switch ($next_class)
1304 case "ilpermissiongui":
1305 case "ilmdeditorgui":
1306 case "ilsurveyphrasesgui":
1312 if ((
$_GET[
"calling_survey"] > 0) || (
$_GET[
"new_for_survey"] > 0))
return;
1314 $tabs_gui->addTarget(
"properties",
1315 $this->ctrl->getLinkTarget($this,
'properties'),
1319 $force_active = ($this->ctrl->getCmdClass() ==
"" ||
1320 $this->ctrl->getCmd() ==
"")
1325 if (is_array(
$_GET[
"sort"]))
1327 $force_active =
true;
1330 $tabs_gui->addTarget(
"survey_questions",
1331 $this->ctrl->getLinkTarget($this,
'questions'),
1332 array(
"questions",
"filter",
"reset",
"createQuestion",
1333 "importQuestions",
"deleteQuestions",
"copy",
"paste",
1334 "exportQuestions",
"confirmDeleteQuestions",
"cancelDeleteQuestions",
1335 "confirmPasteQuestions",
"cancelPasteQuestions",
"uploadQuestions",
1336 "editQuestion",
"addMaterial",
"removeMaterial",
"save",
"cancel",
1337 "cancelExplorer",
"linkChilds",
"addGIT",
"addST",
"addPG",
"preview",
1338 "moveCategory",
"deleteCategory",
"addPhrase",
"addCategory",
"savePhrase",
1339 "addSelectedPhrase",
"cancelViewPhrase",
"confirmSavePhrase",
"cancelSavePhrase",
1340 "insertBeforeCategory",
"insertAfterCategory",
"confirmDeleteCategory",
1341 "cancelDeleteCategory",
"categories",
"saveCategories",
1342 "savePhrase",
"addPhrase"
1344 array(
"ilobjsurveyquestionpoolgui",
"ilsurveyphrasesgui"),
"", $force_active);
1348 if ($rbacsystem->checkAccess(
'write', $this->ref_id))
1351 $tabs_gui->addTarget(
"meta_data",
1352 $this->ctrl->getLinkTargetByClass(
'ilmdeditorgui',
'listSection'),
1353 "",
"ilmdeditorgui");
1356 $tabs_gui->addTarget(
"manage_phrases",
1357 $this->ctrl->getLinkTargetByClass(
"ilsurveyphrasesgui",
"phrases"),
1358 array(
"phrases",
"deletePhrase",
"confirmDeletePhrase",
"cancelDeletePhrase"),
1359 "ilsurveyphrasesgui",
"");
1363 $tabs_gui->addTarget(
"export",
1364 $this->ctrl->getLinkTarget($this,
'export'),
1365 array(
"export",
"createExportFile",
"confirmDeleteExportFile",
1366 "downloadExportFile",
"cancelDeleteExportFile",
"deleteExportFile"),
1369 if ($ilAccess->checkAccess(
"edit_permission",
"", $this->ref_id))
1371 $tabs_gui->addTarget(
"perm_settings",
1372 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
1387 if ($ilAccess->checkAccess(
"write",
"", $a_target))
1389 $_GET[
"baseClass"] =
"ilObjSurveyQuestionPoolGUI";
1390 $_GET[
"cmd"] =
"questions";
1391 $_GET[
"ref_id"] = $a_target;
1392 include_once(
"ilias.php");
1395 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
1397 $_GET[
"cmd"] =
"frameset";
1398 $_GET[
"target"] =
"";
1399 $_GET[
"ref_id"] = ROOT_FOLDER_ID;
1402 include(
"repository.php");
1405 $ilErr->raiseError($lng->txt(
"msg_no_perm_read_lm"), $ilErr->FATAL);