56 $this->ctrl->saveParameter($this,
"q_id");
57 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"sel_question_types",
$_GET[
"sel_question_types"]);
58 $this->cumulated =
array();
64 $this->
object->loadFromDb($a_id);
75 $cmd = $this->ctrl->getCmd();
76 $next_class = $this->ctrl->getNextClass($this);
99 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
100 if ((!$questiontype)
and ($question_id > 0))
102 $questiontype = SurveyQuestion::_getQuestiontype($question_id);
105 $question_type_gui = $questiontype .
"GUI";
106 $question =
new $question_type_gui($question_id);
112 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
113 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
114 $q_type = SurveyQuestion::_getQuestiontype($a_q_id);
132 return $this->
object->getQuestionType();
137 $questiontext = $this->
object->getQuestiontext();
138 if (preg_match(
"/^<.[\\>]?>(.*?)<\\/.[\\>]*?>$/", $questiontext, $matches))
140 $questiontext = $matches[1];
142 $template->setVariable(
"QUESTIONTEXT", $this->
object->prepareTextareaOutput($questiontext, TRUE));
143 if ($this->
object->getObligatory($survey_id))
145 $template->setVariable(
"OBLIGATORY_TEXT",
' *');
151 $this->parent_url = $a_url;
156 global $rbacsystem,$ilTabs;
158 $this->ctrl->setParameterByClass($guiclass,
"sel_question_types", $this->
getQuestionType());
159 $this->ctrl->setParameterByClass($guiclass,
"q_id",
$_GET[
"q_id"]);
161 if ($this->parent_url)
164 if (strlen(
$_GET[
"new_for_survey"]))
166 $addurl =
"&new_id=" .
$_GET[
"q_id"];
168 $ilTabs->setBackTarget($this->lng->txt(
"menubacktosurvey"), $this->parent_url . $addurl);
172 $this->ctrl->setParameterByClass(
"ilObjSurveyQuestionPoolGUI",
"q_id_table_nav",
$_SESSION[
'q_id_table_nav']);
173 $ilTabs->setBackTarget($this->lng->txt(
"spl"), $this->ctrl->getLinkTargetByClass(
"ilObjSurveyQuestionPoolGUI",
"questions"));
177 $ilTabs->addNonTabbedLink(
"preview",
178 $this->lng->txt(
"preview"),
179 $this->ctrl->getLinkTargetByClass($guiclass,
"preview"));
182 if ($rbacsystem->checkAccess(
'edit',
$_GET[
"ref_id"]))
184 $ilTabs->addTab(
"edit_properties",
185 $this->lng->txt(
"properties"),
186 $this->ctrl->getLinkTargetByClass($guiclass,
"editQuestion"));
188 if(stristr($guiclass,
"matrix"))
190 $ilTabs->addTab(
"layout",
191 $this->lng->txt(
"layout"),
192 $this->ctrl->getLinkTargetByClass($guiclass,
"layout"));
197 $ilTabs->addTab(
"material",
198 $this->lng->txt(
"material"),
199 $this->ctrl->getLinkTargetByClass($guiclass,
"material"));
202 if ($this->
object->getId() > 0)
204 $title = $this->lng->txt(
"edit") .
" "" . $this->
object->getTitle() .
""";
211 $this->tpl->setVariable(
"HEADER",
$title);
221 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
223 $form->setFormAction($this->ctrl->getFormAction($this,
"save"));
224 $form->setTitle($this->lng->txt($this->getQuestionType()));
225 $form->setMultipart(FALSE);
226 $form->setTableWidth(
"100%");
231 $title->setRequired(TRUE);
236 $label->
setInfo($this->lng->txt(
"label_info"));
237 $label->setRequired(
false);
238 $form->addItem($label);
241 $author =
new ilTextInputGUI($this->lng->txt(
"author"),
"author");
243 $form->addItem($author);
246 $description =
new ilTextInputGUI($this->lng->txt(
"description"),
"description");
248 $form->addItem($description);
253 $question->setRows(10);
254 $question->setCols(80);
255 $question->setUseRte(TRUE);
256 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
258 $question->addPlugin(
"latex");
259 $question->addButton(
"latex");
260 $question->addButton(
"pastelatex");
261 $question->setRTESupport($this->
object->getId(),
"spl",
"survey");
262 $form->addItem($question);
267 $shuffle->setRequired(FALSE);
268 $form->addItem($shuffle);
276 $label->setValue($this->
object->label);
277 $author->setValue($this->
object->getAuthor());
278 $description->setValue($this->
object->getDescription());
279 $question->setValue($this->
object->prepareTextareaOutput($this->object->getQuestiontext()));
280 $shuffle->setChecked($this->
object->getObligatory());
287 $a_form->addCommandButton(
"saveReturn", $this->lng->txt(
"save_return"));
288 $a_form->addCommandButton(
"save", $this->lng->txt(
"save"));
293 if($this->
object->hasCopies())
295 $a_form->addCommandButton(
"saveSync", $this->lng->txt(
"svy_save_sync"));
304 $ilTabs->activateTab(
"edit_properties");
310 $this->tpl->setContent($a_form->getHTML());
315 $this->
save($_REQUEST[
"rtrn"],
true);
326 if($form->checkInput())
330 $this->
object->setTitle($form->getInput(
"title"));
331 $this->
object->label = ($form->getInput(
"label"));
332 $this->
object->setAuthor($form->getInput(
"author"));
333 $this->
object->setDescription($form->getInput(
"description"));
334 $this->
object->setQuestiontext($form->getInput(
"question"));
335 $this->
object->setObligatory($form->getInput(
"obligatory"));
340 $this->
object->saveToDb();
346 $form->setValuesByPost();
351 protected function save($a_return =
false, $a_sync =
false)
365 $ilUser->setPref(
"svy_lastquestiontype", $this->
object->getQuestionType());
366 $ilUser->writePref(
"svy_lastquestiontype", $this->
object->getQuestionType());
369 $this->ctrl->setParameter($this,
"q_id", $this->
object->getId());
370 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
376 $this->ctrl->redirect($this,
'copySyncForm');
381 if ($originalexists &&
386 $this->ctrl->setParameter($this,
'rtrn', 1);
388 $this->ctrl->redirect($this,
'originalSyncForm');
401 $ilTabs->activateTab(
"edit_properties");
403 include_once
"Modules/SurveyQuestionPool/classes/class.ilSurveySyncTableGUI.php";
406 $this->tpl->setContent(
$tbl->getHTML());
411 global
$lng, $ilAccess;
413 if(!
sizeof(
$_POST[
"qid"]))
419 foreach($this->
object->getCopyIds(
true) as $survey_id => $questions)
426 if($ilAccess->checkAccess(
"edit",
"", $ref_id))
435 foreach($questions as $qid)
437 if(in_array($qid,
$_POST[
"qid"]))
439 $id = $this->
object->getId();
441 $this->
object->setId($qid);
442 $this->
object->setOriginalId($id);
443 $this->
object->saveToDb();
445 $this->
object->setId($id);
446 $this->
object->setOriginalId(null);
463 $ilTabs->activateTab(
"edit_properties");
465 $this->ctrl->saveParameter($this,
"rtrn");
467 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
469 $cgui->setHeaderText($this->lng->txt(
"confirm_sync_questions"));
471 $cgui->setFormAction($this->ctrl->getFormAction($this,
"confirmRemoveQuestions"));
472 $cgui->setCancel($this->lng->txt(
"no"),
"cancelSync");
473 $cgui->setConfirm($this->lng->txt(
"yes"),
"sync");
475 $this->tpl->setContent($cgui->getHTML());
480 $original_id = $this->
object->original_id;
483 $this->
object->syncWithOriginal();
507 if($this->parent_url)
510 if (strlen(
$_GET[
"new_for_survey"]))
512 $addurl =
"&new_id=" .
$_GET[
"q_id"];
519 $this->ctrl->setParameterByClass(
"ilObjSurveyQuestionPoolGUI",
"q_id_table_nav",
$_SESSION[
'q_id_table_nav']);
520 $this->ctrl->redirectByClass(
"ilObjSurveyQuestionPoolGUI",
"questions");
526 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"q_id", $this->
object->getId());
527 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"sel_question_types",
$_GET[
"sel_question_types"]);
528 $this->ctrl->setParameterByClass(
$_GET[
"cmdClass"],
"new_for_survey",
$_GET[
"new_for_survey"]);
529 $this->ctrl->redirectByClass(
$_GET[
"cmdClass"],
"editQuestion");
535 if ($this->parent_url)
541 $this->ctrl->redirectByClass(
"ilobjsurveyquestionpoolgui",
"questions");
553 abstract public function getPrintView($question_title = 1, $show_questiontext = 1);
557 switch ($question_title)
569 if(trim($this->
object->getLabel()))
571 $title .=
' <span class="questionLabel">('.ilUtil::prepareFormOutput($this->
object->getLabel()).
')</span>';
587 $ilTabs->activateTab(
"preview");
589 $tpl =
new ilTemplate(
"tpl.il_svy_qpl_preview.html",
true,
true,
"Modules/SurveyQuestionPool");
591 if ($this->
object->getObligatory())
593 $tpl->setCurrentBlock(
"required");
594 $tpl->setVariable(
"TEXT_REQUIRED", $this->lng->txt(
"required_field"));
595 $tpl->parseCurrentBlock();
600 include_once
"Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
602 $panel->setBody(
$tpl->get());
604 $this->tpl->setContent($panel->getHTML());
612 abstract public function getWorkingForm($working_data =
"", $question_title = 1, $show_questiontext = 1, $error_message =
"", $survey_id = null);
619 if (count($this->
object->getMaterial()))
621 $template =
new ilTemplate(
"tpl.il_svy_qpl_material.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
622 foreach ($this->
object->getMaterial() as $material)
624 $template->setCurrentBlock(
'material');
625 switch ($material->type)
629 $template->setVariable(
'MATERIAL_TYPE',
'internallink');
630 $template->setVariable(
'MATERIAL_HREF', $href);
633 $template->setVariable(
'MATERIAL_TITLE', (strlen($material->title)) ?
ilUtil::prepareFormOutput($material->title) : $this->lng->txt(
'material'));
634 $template->setVariable(
'TEXT_AVAILABLE_MATERIALS', $this->lng->txt(
'material'));
635 $template->parseCurrentBlock();
637 return $template->get();
651 global $rbacsystem, $ilTabs;
653 $ilTabs->activateTab(
"material");
656 if ($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id']))
658 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
660 $form->setFormAction($this->ctrl->getFormAction($this));
661 $form->setTitle($this->lng->txt(
'add_material'));
662 $form->setMultipart(FALSE);
663 $form->setTableWidth(
"100%");
664 $form->setId(
"material");
669 $material->addOption(
new ilRadioOption($this->lng->txt(
'obj_lm'),
"lm"));
670 $material->addOption(
new ilRadioOption($this->lng->txt(
'obj_st'),
"st"));
671 $material->addOption(
new ilRadioOption($this->lng->txt(
'obj_pg'),
"pg"));
672 $material->addOption(
new ilRadioOption($this->lng->txt(
'glossary_term'),
"glo"));
673 $form->addItem($material);
675 $form->addCommandButton(
"addMaterial", $this->lng->txt(
"add"));
681 $form->setValuesByPost();
682 $errors = !$form->checkInput();
683 if (
$errors) $checkonly =
false;
685 $add_html = $form->getHTML();
690 if (count($this->
object->getMaterial()))
692 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyMaterialsTableGUI.php";
695 foreach ($this->
object->getMaterial() as $material)
697 switch ($material->type)
701 $type = $this->lng->txt(
'internal_link');
705 array_push($data,
array(
'href' => $href,
'title' =>
$title,
'type' => $type));
707 $table_gui->setData($data);
708 $mat_html = $table_gui->getHTML();
711 if (!$checkonly) $this->tpl->setVariable(
"ADM_CONTENT", $add_html . $mat_html);
717 if (is_array(
$_POST[
'idx']))
719 $this->
object->deleteMaterials(
$_POST[
'idx']);
726 $this->ctrl->redirect($this,
'material');
734 global $tree, $ilTabs, $ilToolbar;
736 $ilTabs->activateTab(
"material");
738 $ilToolbar->addButton($this->lng->txt(
"cancel"),
739 $this->ctrl->getLinkTarget($this,
"material"));
743 include_once(
"./Modules/SurveyQuestionPool/classes/class.ilMaterialExplorer.php");
744 switch (
$_POST[
"internalLinkType"])
765 $exp->setPathOpen((
int)
$_GET[
"ref_id"]);
766 if (!$exp->handleCommand())
768 include_once
"Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
770 $panel->setHeading($this->lng->txt(
"select_object_to_link"));
771 $panel->setBody($exp->getHTML());
773 $this->tpl->setContent($panel->getHTML());
780 $this->
object->material =
array();
781 $this->
object->saveToDb();
789 $this->ctrl->redirect($this,
'material');
794 $this->
object->addInternalLink(
"il__pg_" .
$_GET[
"pg"]);
798 $this->ctrl->redirect($this,
"material");
803 $this->
object->addInternalLink(
"il__st_" .
$_GET[
"st"]);
807 $this->ctrl->redirect($this,
"material");
812 $this->
object->addInternalLink(
"il__git_" .
$_GET[
"git"]);
816 $this->ctrl->redirect($this,
"material");
823 $selectable_items =
array();
825 $source_id =
$_GET[
"source_id"];
830 include_once
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
831 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
833 $cont_obj = $cont_obj_gui->object;
835 foreach($pages as $page)
837 if($page[
"type"] ==
$_SESSION[
"search_link_type"])
839 $selectable_items[] =
array(
840 "item_type" => $page[
"type"]
841 ,
"item_id" => $page[
"obj_id"]
842 ,
"title" => $page[
"title"]
849 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
851 $cont_obj = $cont_obj_gui->object;
853 $ctree =& $cont_obj->getLMTree();
854 $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
855 foreach($nodes as $node)
857 if($node[
"type"] ==
$_SESSION[
"search_link_type"])
859 $selectable_items[] =
array(
860 "item_type" => $node[
"type"]
861 ,
"item_id" => $node[
"obj_id"]
862 ,
"title" => $node[
"title"]
869 include_once
"./Modules/Glossary/classes/class.ilObjGlossary.php";
872 $terms = $glossary->getTermList();
873 foreach($terms as $term)
875 $selectable_items[] =
array(
877 ,
"item_id" => $term[
"id"]
878 ,
"title" => $term[
"term"]
884 $this->
object->addInternalLink(
"il__lm_" . $source_id);
888 if(
sizeof($selectable_items))
890 $ilTabs->activateTab(
"material");
891 $this->ctrl->setParameter($this,
"q_id", $this->
object->getId());
892 $this->ctrl->setParameter($this,
"source_id", $source_id);
894 include_once
"Modules/SurveyQuestionPool/classes/tables/class.SurveyMaterialsSourceTableGUI.php";
896 $tbl->setData($selectable_items);
897 $this->tpl->setContent(
$tbl->getHTML());
901 if(
$_SESSION[
"search_link_type"] ==
"lm")
907 $this->ctrl->redirect($this,
"material");
912 $this->ctrl->redirect($this,
"addMaterial");
924 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
926 $form->setFormAction($this->ctrl->getFormAction($this,
"addSelectedPhrase"));
927 $form->setTitle($this->lng->txt(
"add_phrase"));
932 $form->addItem($group);
934 include_once
"./Modules/SurveyQuestionPool/classes/class.ilSurveyPhrases.php";
939 $opt =
new ilRadioOption($phrase_array[
"title"], $phrase_id);
940 $opt->setInfo(join($categories,
","));
941 $group->addOption($opt);
943 if($phrase_array[
"org_title"] ==
"dp_standard_numbers")
948 $opt->addSubItem($min);
953 $opt->addSubItem($max);
957 $form->addCommandButton(
"addSelectedPhrase", $this->lng->txt(
"add_phrase"));
958 $form->addCommandButton(
"editQuestion", $this->lng->txt(
"cancel"));
970 $ilTabs->activateTab(
"edit_properties");
977 $this->
object->saveToDb();
983 $this->tpl->setContent($a_form->
getHTML());
989 if($form->checkInput())
991 $phrase_id = $form->getInput(
"phrases");
994 if (strcmp($this->
object->getPhrase($phrase_id),
"dp_standard_numbers") != 0)
996 $this->
object->addPhrase($phrase_id);
1000 $min = $form->getInput(
"lower_limit");
1001 $max = $form->getInput(
"upper_limit");
1005 $max_field = $form->getItemByPostVar(
"upper_limit");
1006 $max_field->setAlert($this->lng->txt(
"upper_limit_must_be_greater"));
1011 $this->
object->addStandardNumbers($min, $max);
1017 $this->
object->saveToDb();
1020 $this->ctrl->redirect($this,
'editQuestion');
1024 $form->setValuesByPost();
1035 global $ilTabs, $ilToolbar;
1037 $ilTabs->activateTab(
"edit_properties");
1044 $this->
object->saveToDb();
1048 include_once(
"./Services/Form/classes/class.ilTextInputGUI.php");
1050 $ilToolbar->addInputItem(
$txt,
true);
1051 $ilToolbar->addFormButton($this->lng->txt(
"confirm"),
"confirmSavePhrase");
1052 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
1054 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveySavePhraseTableGUI.php";
1056 $table_gui->setDescription($this->lng->txt(
"save_phrase_introduction"));
1059 if(method_exists($this->
object,
"getCategories"))
1061 $categories = $this->
object->getCategories();
1065 $categories = $this->
object->getColumns();
1069 for ($i = 0; $i < $categories->getCategoryCount(); $i++)
1071 $cat = $categories->getCategory($i);
1074 "answer" => $cat->title,
1075 "other" => $cat->other,
1076 "scale" => $cat->scale,
1077 "neutral" => $cat->neutral
1080 $table_gui->setData(
$data);
1083 $this->tpl->setContent($table_gui->getHTML());
1109 $this->
object->savePhrase(
$title);
1112 $this->ctrl->redirect($this,
"editQuestion");
1121 $html[] =
'<div class="ilTableOuter table-responsive">';
1122 $html[] =
'<table class="table table-striped">';
1124 $html[] =
"<thead>";
1126 foreach($a_head as $col)
1130 $html[] = ($col !=
"") ? $col :
" ";
1134 $html[] =
"</thead>";
1136 $html[] =
"<tbody>";
1137 foreach($a_rows as
$row)
1140 foreach($row as $col)
1144 $html[] = ($col !=
"") ? $col :
" ";
1149 $html[] =
"</tbody>";
1153 $html[] =
"<tfoot>";
1155 foreach($a_foot as $col)
1159 $html[] = ($col !=
"") ? $col :
" ";
1163 $html[] =
"</tfoot>";
1166 $html[] =
"</table>";
1168 return implode(
"\n",
$html);
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
setQuestionTabsForClass($guiclass)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
This class represents an option in a radio group.
getMaterialOutput()
Creates the HTML output of the question material(s)
static _getCategoriesForPhrase($phrase_id)
Gets the available categories for a given phrase.
Survey sync table GUI class.
redirectAfterSaving($a_return=false)
Redirect to calling survey or to edit form.
getPrintView($question_title=1, $show_questiontext=1)
outQuestionText($template)
static _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
static _isComplete($question_id)
Checks whether the question is complete or not.
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
addPhrase(ilPropertyFormGUI $a_form=null)
Creates an output for the addition of phrases.
TableGUI class for survey question source materials.
getQuestionType()
Returns the question type string.
TableGUI class for survey question materials.
static _getClassNameForQType($q_type)
renderStatisticsDetailsTable(array $a_head, array $a_rows, array $a_foot=null)
static _isWriteable($question_id, $user_id)
Returns true if the question is writeable by a certain user.
static _getQuestionGUI($questiontype, $question_id=-1)
Creates a question gui representation.
static _getAllReferences($a_id)
get all reference ids of object
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
preview()
Creates a preview of the question.
addMaterial()
Add materials to a question.
getWorkingForm($working_data="", $question_title=1, $show_questiontext=1, $error_message="", $survey_id=null)
addFieldsToEditForm(ilPropertyFormGUI $a_form)
special template class to simplify handling of ITX/PEAR
static _questionExists($question_id)
Returns true if the question already exists in the database.
validateEditForm(ilPropertyFormGUI $a_form)
This class represents a text property in a property form.
addCommandButtons($a_form)
static _getInternalLinkHref($target="", $a_parent_ref_id=null)
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
savePhrase($a_reload=false)
Creates an output to save the current answers as a phrase.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
importEditFormValues(ilPropertyFormGUI $a_form)
static getInstance()
Get instance.
static _getGUIClassNameForId($a_q_id)
save($a_return=false, $a_sync=false)
Create new PHPExcel object
obj_idprivate
This class represents a text area property in a property form.
editQuestion(ilPropertyFormGUI $a_form=null)
static _getAvailablePhrases($useronly=0)
Gets the available phrases from the database.
Class ilObjContentObjectGUI.
confirmSavePhrase()
Save a new phrase to the database.
static getLogger($a_component_id)
Get component logger.
getPrintViewQuestionTitle($question_title=1)
material($checkonly=FALSE)
Material tab of the survey questions.
static getPageList($lm_id)
static
static redirect($a_script)
http redirect to other script
Basic class for all survey question types.
Confirmation screen class.