24 include_once
"./Modules/Survey/classes/inc.SurveyConstants.php";
77 $this->ctrl->saveParameter($this,
"q_id");
78 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"sel_question_types",
$_GET[
"sel_question_types"]);
79 $this->cumulated = array();
80 $this->errormessages = array();
85 if (strlen($errormessage)) array_push($this->errormessages, $errormessage);
90 if (count($this->errormessages))
92 $out = implode(
"<br />", $this->errormessages);
102 $cmd = $this->ctrl->getCmd();
103 $next_class = $this->ctrl->getNextClass($this);
133 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
134 if ((!$questiontype) and ($question_id > 0))
136 $questiontype = SurveyQuestion::_getQuestiontype($question_id);
139 $question_type_gui = $questiontype .
"GUI";
140 $question =
new $question_type_gui($question_id);
146 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
147 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
148 $q_type = SurveyQuestion::_getQuestiontype($a_q_id);
160 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_sync_original.html",
"Modules/SurveyQuestionPool");
161 $this->tpl->setCurrentBlock(
"adm_content");
162 $this->tpl->setVariable(
"BUTTON_YES", $this->lng->txt(
"yes"));
163 $this->tpl->setVariable(
"BUTTON_NO", $this->lng->txt(
"no"));
164 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
165 $this->tpl->setVariable(
"TEXT_SYNC", $this->lng->txt(
"confirm_sync_questions"));
166 $this->tpl->parseCurrentBlock();
171 $original_id = $this->
object->original_id;
174 $this->
object->syncWithOriginal();
176 $this->ctrl->redirect($this,
"editQuestion");
185 $this->ctrl->redirect($this,
"editQuestion");
198 $old_id =
$_GET[
"q_id"];
199 $result = $this->writePostData();
202 $ilUser->setPref(
"svy_lastquestiontype", $this->object->getQuestionType());
203 $ilUser->writePref(
"svy_lastquestiontype", $this->object->getQuestionType());
204 $this->
object->saveToDb();
205 $originalexists = $this->
object->_questionExists($this->object->original_id);
206 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
207 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
213 elseif (
$_GET[
"calling_survey"])
216 include_once
"./Services/Utilities/classes/class.ilUtil.php";
217 ilUtil::redirect(
"ilias.php?baseClass=ilObjSurveyGUI&ref_id=" .
$_GET[
"calling_survey"] .
"&cmd=questions");
220 elseif (
$_GET[
"new_for_survey"] > 0)
222 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"q_id", $this->object->getId());
223 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"sel_question_types",
$_GET[
"sel_question_types"]);
224 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"new_for_survey",
$_GET[
"new_for_survey"]);
225 $this->ctrl->redirectByClass(
$_GET[
"cmdClass"],
"editQuestion");
231 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"q_id", $this->object->getId());
232 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"sel_question_types",
$_GET[
"sel_question_types"]);
233 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"new_for_survey",
$_GET[
"new_for_survey"]);
234 $this->ctrl->redirectByClass(
$_GET[
"cmdClass"],
"editQuestion");
242 if (
$_GET[
"calling_survey"])
245 include_once
"./Services/Utilities/classes/class.ilUtil.php";
246 ilUtil::redirect(
"ilias.php?baseClass=ilObjSurveyGUI&cmd=questions&ref_id=".
$_GET[
"calling_survey"]);
248 elseif (
$_GET[
"new_for_survey"])
251 include_once
"./Services/Utilities/classes/class.ilUtil.php";
252 ilUtil::redirect(
"ilias.php?baseClass=ilObjSurveyGUI&cmd=questions&ref_id=".
$_GET[
"new_for_survey"]);
256 $this->ctrl->redirectByClass(
"ilobjsurveyquestionpoolgui",
"questions");
269 $this->ctrl->redirect($this,
"editQuestion");
276 if ($_POST[
"cmd"][
"addMaterial"])
278 if ($this->writePostData() == 1)
284 $this->
object->saveToDb();
285 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
288 include_once(
"./Modules/SurveyQuestionPool/classes/class.ilMaterialExplorer.php");
289 switch ($_POST[
"internalLinkType"])
317 $exp =
new ilMaterialExplorer($this->ctrl->getLinkTarget($this,
'addMaterial'), get_class($this));
320 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,
'addMaterial'));
321 $exp->setTargetGet(
"ref_id");
322 $exp->setRefId($this->cur_ref_id);
323 $exp->addFilter(
$_SESSION[
"link_new_type"]);
324 $exp->setSelectableType(
$_SESSION[
"link_new_type"]);
329 $this->tpl->addBlockFile(
"ADM_CONTENT",
"explorer",
"tpl.il_svy_qpl_explorer.html",
"Modules/SurveyQuestionPool");
330 $this->tpl->setVariable(
"EXPLORER_TREE",$exp->getOutput());
331 $this->tpl->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
332 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
333 $this->tpl->parseCurrentBlock();
338 $this->
object->material = array();
339 $this->
object->saveToDb();
351 $this->
object->setMaterial(
"il__pg_" .
$_GET[
"pg"]);
360 $this->
object->setMaterial(
"il__st_" .
$_GET[
"st"]);
369 $this->
object->setMaterial(
"il__git_" .
$_GET[
"git"]);
381 include_once
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
382 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
384 $cont_obj = $cont_obj_gui->object;
386 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
387 $color_class = array(
"tblrow1",
"tblrow2");
389 $this->tpl->addBlockFile(
"ADM_CONTENT",
"link_selection",
"tpl.il_svy_qpl_internallink_selection.html",
"Modules/SurveyQuestionPool");
390 foreach($pages as $page)
392 if($page[
"type"] ==
$_SESSION[
"search_link_type"])
394 $this->tpl->setCurrentBlock(
"linktable_row");
395 $this->tpl->setVariable(
"TEXT_LINK", $page[
"title"]);
396 $this->tpl->setVariable(
"TEXT_ADD", $this->lng->txt(
"add"));
397 $this->tpl->setVariable(
"LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this),
"add" . strtoupper($page[
"type"])) .
"&" . $page[
"type"] .
"=" . $page[
"obj_id"]);
398 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
399 $this->tpl->parseCurrentBlock();
403 $this->tpl->setCurrentBlock(
"link_selection");
404 $this->tpl->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
405 $this->tpl->setVariable(
"TEXT_LINK_TYPE", $this->lng->txt(
"obj_" .
$_SESSION[
"search_link_type"]));
406 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
407 $this->tpl->parseCurrentBlock();
410 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
411 $color_class = array(
"tblrow1",
"tblrow2");
413 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
415 $cont_obj = $cont_obj_gui->object;
417 $ctree =& $cont_obj->getLMTree();
418 $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
419 $this->tpl->addBlockFile(
"ADM_CONTENT",
"link_selection",
"tpl.il_svy_qpl_internallink_selection.html",
"Modules/SurveyQuestionPool");
420 foreach($nodes as $node)
422 if($node[
"type"] ==
$_SESSION[
"search_link_type"])
424 $this->tpl->setCurrentBlock(
"linktable_row");
425 $this->tpl->setVariable(
"TEXT_LINK", $node[
"title"]);
426 $this->tpl->setVariable(
"TEXT_ADD", $this->lng->txt(
"add"));
427 $this->tpl->setVariable(
"LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this),
"add" . strtoupper($node[
"type"])) .
"&" . $node[
"type"] .
"=" . $node[
"obj_id"]);
428 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
429 $this->tpl->parseCurrentBlock();
433 $this->tpl->setCurrentBlock(
"link_selection");
434 $this->tpl->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
435 $this->tpl->setVariable(
"TEXT_LINK_TYPE", $this->lng->txt(
"obj_" .
$_SESSION[
"search_link_type"]));
436 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
437 $this->tpl->parseCurrentBlock();
440 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
441 $color_class = array(
"tblrow1",
"tblrow2");
443 $this->tpl->addBlockFile(
"ADM_CONTENT",
"link_selection",
"tpl.il_svy_qpl_internallink_selection.html",
"Modules/SurveyQuestionPool");
444 include_once
"./Modules/Glossary/classes/class.ilObjGlossary.php";
447 $terms = $glossary->getTermList();
448 foreach($terms as $term)
450 $this->tpl->setCurrentBlock(
"linktable_row");
451 $this->tpl->setVariable(
"TEXT_LINK", $term[
"term"]);
452 $this->tpl->setVariable(
"TEXT_ADD", $this->lng->txt(
"add"));
453 $this->tpl->setVariable(
"LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this),
"addGIT") .
"&git=" . $term[
"id"]);
454 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
455 $this->tpl->parseCurrentBlock();
458 $this->tpl->setCurrentBlock(
"link_selection");
459 $this->tpl->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
460 $this->tpl->setVariable(
"TEXT_LINK_TYPE", $this->lng->txt(
"glossary_term"));
461 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
462 $this->tpl->parseCurrentBlock();
465 $this->
object->setMaterial(
"il__lm_" .
$_GET[
"source_id"]);
489 global $rbacsystem,$ilTabs;
490 $this->ctrl->setParameterByClass(
"$guiclass",
"sel_question_types", $this->
getQuestionType());
491 $this->ctrl->setParameterByClass(
"$guiclass",
"q_id",
$_GET[
"q_id"]);
493 if ((
$_GET[
"calling_survey"] > 0) || (
$_GET[
"new_for_survey"] > 0))
498 if (strlen(
$_GET[
"new_for_survey"]))
500 $addurl =
"&new_id=" .
$_GET[
"q_id"];
502 $ilTabs->setBackTarget($this->lng->txt(
"menubacktosurvey"),
"ilias.php?baseClass=ilObjSurveyGUI&ref_id=$ref_id&cmd=questions" . $addurl);
506 $ilTabs->setBackTarget($this->lng->txt(
"spl"), $this->ctrl->getLinkTargetByClass(
"ilObjSurveyQuestionPoolGUI",
"questions"));
510 $ilTabs->addTarget(
"preview",
511 $this->ctrl->getLinkTargetByClass(
"$guiclass",
"preview"),
"preview",
514 if ($rbacsystem->checkAccess(
'edit',
$_GET[
"ref_id"])) {
515 $ilTabs->addTarget(
"edit_properties",
516 $this->ctrl->getLinkTargetByClass(
"$guiclass",
"editQuestion"),
517 array(
"editQuestion",
"cancelExplorer",
"linkChilds",
"addGIT",
"addST",
519 "editQuestion",
"addMaterial",
"removeMaterial",
"save",
"cancel"
526 case "surveynominalquestiongui":
527 case "surveyordinalquestiongui":
528 if ($this->object->getId() > 0)
530 $ilTabs->addTarget(
"categories",
531 $this->ctrl->getLinkTargetByClass(
"$guiclass",
"categories"),
532 array(
"categories",
"addCategory",
"insertBeforeCategory",
533 "insertAfterCategory",
"moveCategory",
"deleteCategory",
534 "saveCategories",
"savePhrase",
"addPhrase",
535 "savePhrase",
"addSelectedPhrase",
"cancelViewPhrase",
"confirmSavePhrase",
537 "confirmDeleteCategory",
"cancelDeleteCategory"
545 if ($this->object->getId() > 0)
547 $title = $this->lng->txt(
"edit") .
" "" . $this->
object->getTitle() .
""";
554 $this->tpl->setVariable(
"HEADER",
$title);
567 return $this->
object->getQuestionType();