24 include_once
"./Modules/Survey/classes/inc.SurveyConstants.php";
73 $this->ctrl->saveParameter($this,
"q_id");
74 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"sel_question_types",
$_GET[
"sel_question_types"]);
75 $this->cumulated = array();
76 $this->errormessages = array();
81 if (strlen($errormessage)) array_push($this->errormessages, $errormessage);
86 if (count($this->errormessages))
88 $out = implode(
"<br />", $this->errormessages);
98 $cmd = $this->ctrl->getCmd();
99 $next_class = $this->ctrl->getNextClass($this);
129 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
130 if ((!$questiontype) and ($question_id > 0))
132 $questiontype = SurveyQuestion::_getQuestiontype($question_id);
135 $question_type_gui = $questiontype .
"GUI";
136 $question =
new $question_type_gui($question_id);
142 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
143 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
144 $q_type = SurveyQuestion::_getQuestiontype($a_q_id);
157 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_qpl_sync_original.html",
"Modules/SurveyQuestionPool");
158 $this->tpl->setCurrentBlock(
"adm_content");
159 $this->tpl->setVariable(
"BUTTON_YES", $this->lng->txt(
"yes"));
160 $this->tpl->setVariable(
"BUTTON_NO", $this->lng->txt(
"no"));
161 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
162 $this->tpl->parseCurrentBlock();
167 $original_id = $this->
object->original_id;
170 $this->
object->syncWithOriginal();
173 $this->ctrl->redirect($this,
"editQuestion");
179 $this->ctrl->redirect($this,
"editQuestion");
189 $old_id =
$_GET[
"q_id"];
190 $result = $this->writePostData();
193 $ilUser->setPref(
"svy_lastquestiontype", $this->object->getQuestionType());
194 $ilUser->writePref(
"svy_lastquestiontype", $this->object->getQuestionType());
195 $this->
object->saveToDb();
196 $originalexists = $this->
object->_questionExists($this->object->original_id);
197 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
198 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
201 $this->ctrl->redirect($this,
'originalSyncForm');
206 $_GET[
"ref_id"] = $_GET[
"calling_survey"];
207 include_once
"./Services/Utilities/classes/class.ilUtil.php";
208 ilUtil::redirect(
"ilias.php?baseClass=ilObjSurveyGUI&ref_id=" . $_GET[
"calling_survey"] .
"&cmd=questions");
214 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"q_id", $this->object->getId());
215 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"sel_question_types",
$_GET[
"sel_question_types"]);
216 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"new_for_survey",
$_GET[
"new_for_survey"]);
217 $this->ctrl->redirectByClass(
$_GET[
"cmdClass"],
"editQuestion");
223 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"q_id", $this->object->getId());
224 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"sel_question_types",
$_GET[
"sel_question_types"]);
225 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"new_for_survey",
$_GET[
"new_for_survey"]);
226 $this->ctrl->redirectByClass(
$_GET[
"cmdClass"],
"editQuestion");
233 if (
$_GET[
"calling_survey"])
236 include_once
"./Services/Utilities/classes/class.ilUtil.php";
237 ilUtil::redirect(
"ilias.php?baseClass=ilObjSurveyGUI&cmd=questions&ref_id=".
$_GET[
"calling_survey"]);
242 include_once
"./Services/Utilities/classes/class.ilUtil.php";
243 ilUtil::redirect(
"ilias.php?baseClass=ilObjSurveyGUI&cmd=questions&ref_id=".
$_GET[
"new_for_survey"]);
247 $this->ctrl->redirectByClass(
"ilobjsurveyquestionpoolgui",
"questions");
258 $this->ctrl->redirect($this,
"editQuestion");
266 if (count($this->object->getMaterial()))
268 $template =
new ilTemplate(
"tpl.il_svy_qpl_material.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
269 foreach ($this->object->getMaterial() as $material)
271 $template->setCurrentBlock(
'material');
272 switch ($material->type)
276 $template->setVariable(
'MATERIAL_TYPE',
'internallink');
277 $template->setVariable(
'MATERIAL_HREF', $href);
280 $template->setVariable(
'MATERIAL_TITLE', (strlen($material->title)) ?
ilUtil::prepareFormOutput($material->title) : $this->lng->txt(
'material'));
281 $template->setVariable(
'TEXT_AVAILABLE_MATERIALS', $this->lng->txt(
'material'));
282 $template->parseCurrentBlock();
284 return $template->get();
298 if ($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']))
300 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
302 $form->setFormAction($this->ctrl->getFormAction($this));
303 $form->setTitle($this->lng->txt(
'add_material'));
304 $form->setMultipart(FALSE);
305 $form->setTableWidth(
"100%");
306 $form->setId(
"material");
311 $material->addOption(
new ilRadioOption($this->lng->txt(
'obj_lm'),
"lm"));
312 $material->addOption(
new ilRadioOption($this->lng->txt(
'obj_st'),
"st"));
313 $material->addOption(
new ilRadioOption($this->lng->txt(
'obj_pg'),
"pg"));
314 $material->addOption(
new ilRadioOption($this->lng->txt(
'glossary_term'),
"glo"));
315 $form->addItem($material);
317 $form->addCommandButton(
"addMaterial", $this->lng->txt(
"add"));
323 $form->setValuesByPost();
324 $errors = !$form->checkInput();
325 if (
$errors) $checkonly =
false;
327 $add_html = $form->getHTML();
332 if (count($this->object->getMaterial()))
334 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyMaterialsTableGUI.php";
337 foreach ($this->object->getMaterial() as $material)
339 switch ($material->type)
343 $type = $this->lng->txt(
'internal_link');
347 array_push($data, array(
'href' => $href,
'title' =>
$title,
'type' =>
$type));
349 $table_gui->setData($data);
350 $mat_html = $table_gui->getHTML();
353 if (!$checkonly) $this->tpl->setVariable(
"ADM_CONTENT", $add_html . $mat_html);
359 if (is_array(
$_POST[
'idx']))
361 $this->
object->deleteMaterials(
$_POST[
'idx']);
368 $this->ctrl->redirect($this,
'material');
380 include_once(
"./Modules/SurveyQuestionPool/classes/class.ilMaterialExplorer.php");
381 switch (
$_POST[
"internalLinkType"])
403 $exp =
new ilMaterialExplorer($this->ctrl->getLinkTarget($this,
'addMaterial'), get_class($this));
406 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,
'addMaterial'));
407 $exp->setTargetGet(
"ref_id");
408 $exp->setRefId(
$_GET[
"ref_id"]);
409 $exp->addFilter(
$_SESSION[
"link_new_type"]);
410 $exp->setSelectableType(
$_SESSION[
"link_new_type"]);
415 $this->tpl->addBlockFile(
"ADM_CONTENT",
"explorer",
"tpl.il_svy_qpl_explorer.html",
"Modules/SurveyQuestionPool");
416 $this->tpl->setVariable(
"EXPLORER_TREE",$exp->getOutput());
417 $this->tpl->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
418 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
424 $this->
object->material = array();
425 $this->
object->saveToDb();
433 $this->ctrl->redirect($this,
'material');
438 $this->
object->addInternalLink(
"il__pg_" .
$_GET[
"pg"]);
442 $this->ctrl->redirect($this,
"material");
447 $this->
object->addInternalLink(
"il__st_" .
$_GET[
"st"]);
451 $this->ctrl->redirect($this,
"material");
456 $this->
object->addInternalLink(
"il__git_" .
$_GET[
"git"]);
460 $this->ctrl->redirect($this,
"material");
468 include_once
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
469 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
471 $cont_obj = $cont_obj_gui->object;
473 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
474 $color_class = array(
"tblrow1",
"tblrow2");
476 $this->tpl->addBlockFile(
"ADM_CONTENT",
"link_selection",
"tpl.il_svy_qpl_internallink_selection.html",
"Modules/SurveyQuestionPool");
477 foreach($pages as $page)
479 if($page[
"type"] ==
$_SESSION[
"search_link_type"])
481 $this->tpl->setCurrentBlock(
"linktable_row");
482 $this->tpl->setVariable(
"TEXT_LINK", $page[
"title"]);
483 $this->tpl->setVariable(
"TEXT_ADD", $this->lng->txt(
"add"));
484 $this->tpl->setVariable(
"LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this),
"add" . strtoupper($page[
"type"])) .
"&" . $page[
"type"] .
"=" . $page[
"obj_id"]);
485 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
486 $this->tpl->parseCurrentBlock();
490 $this->tpl->setCurrentBlock(
"link_selection");
491 $this->tpl->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
492 $this->tpl->setVariable(
"TEXT_LINK_TYPE", $this->lng->txt(
"obj_" .
$_SESSION[
"search_link_type"]));
493 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
494 $this->tpl->parseCurrentBlock();
497 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
498 $color_class = array(
"tblrow1",
"tblrow2");
500 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
502 $cont_obj = $cont_obj_gui->object;
504 $ctree =& $cont_obj->getLMTree();
505 $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
506 $this->tpl->addBlockFile(
"ADM_CONTENT",
"link_selection",
"tpl.il_svy_qpl_internallink_selection.html",
"Modules/SurveyQuestionPool");
507 foreach($nodes as $node)
509 if($node[
"type"] ==
$_SESSION[
"search_link_type"])
511 $this->tpl->setCurrentBlock(
"linktable_row");
512 $this->tpl->setVariable(
"TEXT_LINK", $node[
"title"]);
513 $this->tpl->setVariable(
"TEXT_ADD", $this->lng->txt(
"add"));
514 $this->tpl->setVariable(
"LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this),
"add" . strtoupper($node[
"type"])) .
"&" . $node[
"type"] .
"=" . $node[
"obj_id"]);
515 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
516 $this->tpl->parseCurrentBlock();
520 $this->tpl->setCurrentBlock(
"link_selection");
521 $this->tpl->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
522 $this->tpl->setVariable(
"TEXT_LINK_TYPE", $this->lng->txt(
"obj_" .
$_SESSION[
"search_link_type"]));
523 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
524 $this->tpl->parseCurrentBlock();
527 $this->ctrl->setParameter($this,
"q_id", $this->object->getId());
528 $color_class = array(
"tblrow1",
"tblrow2");
530 $this->tpl->addBlockFile(
"ADM_CONTENT",
"link_selection",
"tpl.il_svy_qpl_internallink_selection.html",
"Modules/SurveyQuestionPool");
531 include_once
"./Modules/Glossary/classes/class.ilObjGlossary.php";
534 $terms = $glossary->getTermList();
535 foreach($terms as $term)
537 $this->tpl->setCurrentBlock(
"linktable_row");
538 $this->tpl->setVariable(
"TEXT_LINK", $term[
"term"]);
539 $this->tpl->setVariable(
"TEXT_ADD", $this->lng->txt(
"add"));
540 $this->tpl->setVariable(
"LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this),
"addGIT") .
"&git=" . $term[
"id"]);
541 $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
542 $this->tpl->parseCurrentBlock();
545 $this->tpl->setCurrentBlock(
"link_selection");
546 $this->tpl->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
547 $this->tpl->setVariable(
"TEXT_LINK_TYPE", $this->lng->txt(
"glossary_term"));
548 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
549 $this->tpl->parseCurrentBlock();
552 $this->
object->addInternalLink(
"il__lm_" .
$_GET[
"source_id"]);
556 $this->ctrl->redirect($this,
"material");
573 global $rbacsystem,$ilTabs;
574 $this->ctrl->setParameterByClass(
"$guiclass",
"sel_question_types", $this->
getQuestionType());
575 $this->ctrl->setParameterByClass(
"$guiclass",
"q_id",
$_GET[
"q_id"]);
577 if ((
$_GET[
"calling_survey"] > 0) || (
$_GET[
"new_for_survey"] > 0))
582 if (strlen(
$_GET[
"new_for_survey"]))
584 $addurl =
"&new_id=" .
$_GET[
"q_id"];
586 $ilTabs->setBackTarget($this->lng->txt(
"menubacktosurvey"),
"ilias.php?baseClass=ilObjSurveyGUI&ref_id=$ref_id&cmd=questions" . $addurl);
590 $this->ctrl->setParameterByClass(
"ilObjSurveyQuestionPoolGUI",
"q_id_table_nav",
$_SESSION[
'q_id_table_nav']);
591 $ilTabs->setBackTarget($this->lng->txt(
"spl"), $this->ctrl->getLinkTargetByClass(
"ilObjSurveyQuestionPoolGUI",
"questions"));
595 $ilTabs->addTarget(
"preview",
596 $this->ctrl->getLinkTargetByClass(
"$guiclass",
"preview"),
"preview",
599 if ($rbacsystem->checkAccess(
'edit',
$_GET[
"ref_id"])) {
600 $ilTabs->addTarget(
"edit_properties",
601 $this->ctrl->getLinkTargetByClass(
"$guiclass",
"editQuestion"),
602 array(
"editQuestion",
"save",
"cancel",
"originalSyncForm"),
607 $ilTabs->addTarget(
"material",
608 $this->ctrl->getLinkTargetByClass(
"$guiclass",
"material"),
609 array(
"material",
"cancelExplorer",
"linkChilds",
"addGIT",
"addST",
610 "addPG",
"addMaterial",
"removeMaterial"),
614 if ($this->object->getId() > 0)
616 $title = $this->lng->txt(
"edit") .
" "" . $this->
object->getTitle() .
""";
623 $this->tpl->setVariable(
"HEADER",
$title);
634 return $this->
object->getQuestionType();