ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
SurveyQuestionGUI Class Reference

Basic class for all survey question types. More...

+ Inheritance diagram for SurveyQuestionGUI:
+ Collaboration diagram for SurveyQuestionGUI:

Public Member Functions

 __construct ($a_id=-1)
 
 setQuestionTabs ()
 
executeCommand ()
 
 getQuestionType ()
 Returns the question type string. More...
 
 setBackUrl ($a_url)
 
 setQuestionTabsForClass ($guiclass)
 
 getPrintView ($question_title=1, $show_questiontext=1)
 
 preview ()
 Creates a preview of the question. More...
 
 getWorkingForm ($working_data="", $question_title=1, $show_questiontext=1, $error_message="", $survey_id=null)
 
 material ($checkonly=false)
 Material tab of the survey questions. More...
 
 deleteMaterial ()
 
 addMaterial ()
 Add materials to a question. More...
 
 removeMaterial ()
 
 cancelExplorer ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 linkChilds ()
 
 savePhrase ($a_reload=false)
 Creates an output to save the current answers as a phrase. More...
 
 confirmSavePhrase ()
 Save a new phrase to the database. More...
 

Static Public Member Functions

static _getQuestionGUI ($questiontype, $question_id=-1)
 Creates a question gui representation. More...
 
static _getGUIClassNameForId ($a_q_id)
 
static _getClassNameForQType ($q_type)
 

Data Fields

 $object
 

Protected Member Functions

 initObject ()
 
 outQuestionText ($template)
 
 initEditForm ()
 
 addCommandButtons ($a_form)
 
 editQuestion (ilPropertyFormGUI $a_form=null)
 
 saveSync ()
 
 saveReturn ()
 
 saveForm ()
 
 save ($a_return=false, $a_sync=false)
 
 copySyncForm ()
 
 syncCopies ()
 
 originalSyncForm ()
 
 sync ()
 
 cancelSync ()
 
 redirectAfterSaving ($a_return=false)
 Redirect to calling survey or to edit form. More...
 
 cancel ()
 
 validateEditForm (ilPropertyFormGUI $a_form)
 
 addFieldsToEditForm (ilPropertyFormGUI $a_form)
 
 importEditFormValues (ilPropertyFormGUI $a_form)
 
 getPrintViewQuestionTitle ($question_title=1)
 
 getMaterialOutput ()
 Creates the HTML output of the question material(s) More...
 
 initPhrasesForm ()
 
 addPhrase (ilPropertyFormGUI $a_form=null)
 Creates an output for the addition of phrases. More...
 
 addSelectedPhrase ()
 
 renderStatisticsDetailsTable (array $a_head, array $a_rows, array $a_foot=null)
 

Protected Attributes

 $rbacsystem
 
 $user
 
 $access
 
 $tree
 
 $toolbar
 
 $tabs
 
 $tpl
 
 $lng
 
 $ctrl
 
 $cumulated
 
 $parent_url
 
 $log
 

Detailed Description

Basic class for all survey question types.

The SurveyQuestionGUI class defines and encapsulates basic methods and attributes for survey question types to be used for all parent classes.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Version
$Id$

Definition at line 34 of file class.SurveyQuestionGUI.php.

Constructor & Destructor Documentation

◆ __construct()

SurveyQuestionGUI::__construct (   $a_id = -1)

Definition at line 79 of file class.SurveyQuestionGUI.php.

80 {
81 global $DIC;
82
83 $this->rbacsystem = $DIC->rbac()->system();
84 $this->user = $DIC->user();
85 $this->access = $DIC->access();
86 $this->tree = $DIC->repositoryTree();
87 $this->toolbar = $DIC->toolbar();
88 $lng = $DIC->language();
89 $tpl = $DIC["tpl"];
90 $ilCtrl = $DIC->ctrl();
91
92 $this->lng = $lng;
93 $this->tpl = $tpl;
94 $this->ctrl = $ilCtrl;
95 $this->ctrl->saveParameter($this, "q_id");
96 $this->ctrl->setParameterByClass($_GET["cmdClass"], "sel_question_types", $_GET["sel_question_types"]);
97 $this->cumulated = array();
98 $this->tabs = $DIC->tabs();
99
100 $this->initObject();
101
102 if ($a_id > 0) {
103 $this->object->loadFromDb($a_id);
104 }
105 $this->log = ilLoggerFactory::getLogger('svy');
106 }
user()
Definition: user.php:4
$_GET["client_id"]
static getLogger($a_component_id)
Get component logger.
global $ilCtrl
Definition: ilias.php:18
$DIC
Definition: xapitoken.php:46

References $_GET, $DIC, $ilCtrl, $lng, $tpl, ilLoggerFactory\getLogger(), initObject(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _getClassNameForQType()

static SurveyQuestionGUI::_getClassNameForQType (   $q_type)
static

Definition at line 152 of file class.SurveyQuestionGUI.php.

153 {
154 return $q_type;
155 }

Referenced by _getGUIClassNameForId().

+ Here is the caller graph for this function:

◆ _getGUIClassNameForId()

static SurveyQuestionGUI::_getGUIClassNameForId (   $a_q_id)
static

Definition at line 145 of file class.SurveyQuestionGUI.php.

146 {
147 $q_type = SurveyQuestion::_getQuestiontype($a_q_id);
148 $class_name = SurveyQuestionGUI::_getClassNameForQType($q_type);
149 return $class_name;
150 }
static _getClassNameForQType($q_type)

References _getClassNameForQType().

Referenced by ilSurveyQuestionsTableGUI\fillRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getQuestionGUI()

static SurveyQuestionGUI::_getQuestionGUI (   $questiontype,
  $question_id = -1 
)
static

Creates a question gui representation.

Creates a question gui representation and returns the alias to the question gui note: please do not use $this inside this method to allow static calls

Parameters
string$question_typeThe question type as it is used in the language database
integer$question_idThe database ID of an existing question to load it into ASS_QuestionGUI
Returns
object The alias to the question object @access public

Definition at line 134 of file class.SurveyQuestionGUI.php.

135 {
136 if ((!$questiontype) and ($question_id > 0)) {
137 $questiontype = SurveyQuestion::_getQuestiontype($question_id);
138 }
139 SurveyQuestion::_includeClass($questiontype, 1);
140 $question_type_gui = $questiontype . "GUI";
141 $question = new $question_type_gui($question_id);
142 return $question;
143 }
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.

References SurveyQuestion\_includeClass().

Referenced by ilSurveyPageGUI\addQuestion(), ilObjSurveyQuestionPoolGUI\createQuestionObject(), ilSurveyEditorGUI\executeCommand(), ilObjSurveyQuestionPoolGUI\executeCommand(), ilSurveyEditorGUI\executeCreateQuestionObject(), ilObjSurvey\getQuestionGUI(), and ilObjSurveyQuestionPoolGUI\previewObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addCommandButtons()

SurveyQuestionGUI::addCommandButtons (   $a_form)
protected

Definition at line 314 of file class.SurveyQuestionGUI.php.

315 {
316 $a_form->addCommandButton("saveReturn", $this->lng->txt("save_return"));
317 $a_form->addCommandButton("save", $this->lng->txt("save"));
318
319 // pool question?
320 if (ilObject::_lookupType($this->object->getObjId()) == "spl") {
321 if ($this->object->hasCopies()) {
322 $a_form->addCommandButton("saveSync", $this->lng->txt("svy_save_sync"));
323 }
324 }
325 }
static _lookupType($a_id, $a_reference=false)
lookup object type

References ilObject\_lookupType().

Referenced by initEditForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addFieldsToEditForm()

SurveyQuestionGUI::addFieldsToEditForm ( ilPropertyFormGUI  $a_form)
abstractprotected

◆ addGIT()

SurveyQuestionGUI::addGIT ( )

Definition at line 797 of file class.SurveyQuestionGUI.php.

798 {
799 $this->object->addInternalLink("il__git_" . $_GET["git"]);
800 unset($_SESSION["link_new_type"]);
801 unset($_SESSION["search_link_type"]);
802 ilUtil::sendSuccess($this->lng->txt("material_added_successfully"), true);
803 $this->ctrl->redirect($this, "material");
804 }
$_SESSION["AccountId"]

References $_GET, and $_SESSION.

◆ addMaterial()

SurveyQuestionGUI::addMaterial ( )

Add materials to a question.

Definition at line 720 of file class.SurveyQuestionGUI.php.

721 {
723 $ilTabs = $this->tabs;
724 $ilToolbar = $this->toolbar;
725
726 $ilTabs->activateTab("material");
727
728 $ilToolbar->addButton(
729 $this->lng->txt("cancel"),
730 $this->ctrl->getLinkTarget($this, "material")
731 );
732
733 if (strlen($_SESSION["link_new_type"]) || !$this->material(true)) {
734 switch ($_POST["internalLinkType"]) {
735 case "lm":
736 $_SESSION["link_new_type"] = "lm";
737 $_SESSION["search_link_type"] = "lm";
738 break;
739 case "glo":
740 $_SESSION["link_new_type"] = "glo";
741 $_SESSION["search_link_type"] = "glo";
742 break;
743 case "st":
744 $_SESSION["link_new_type"] = "lm";
745 $_SESSION["search_link_type"] = "st";
746 break;
747 case "pg":
748 $_SESSION["link_new_type"] = "lm";
749 $_SESSION["search_link_type"] = "pg";
750 break;
751 }
752
753 $exp = new ilMaterialExplorer($this, 'addMaterial', $_SESSION["link_new_type"]);
754 $exp->setPathOpen((int) $_GET["ref_id"]);
755 if (!$exp->handleCommand()) {
756 $panel = ilPanelGUI::getInstance();
757 $panel->setHeading($this->lng->txt("select_object_to_link"));
758 $panel->setBody($exp->getHTML());
759
760 $this->tpl->setContent($panel->getHTML());
761 }
762 }
763 }
$_POST["username"]
material($checkonly=false)
Material tab of the survey questions.
static getInstance()
Get instance.

References $_GET, $_POST, $_SESSION, $tabs, $toolbar, $tree, ilPanelGUI\getInstance(), and material().

+ Here is the call graph for this function:

◆ addPG()

SurveyQuestionGUI::addPG ( )

Definition at line 779 of file class.SurveyQuestionGUI.php.

780 {
781 $this->object->addInternalLink("il__pg_" . $_GET["pg"]);
782 unset($_SESSION["link_new_type"]);
783 unset($_SESSION["search_link_type"]);
784 ilUtil::sendSuccess($this->lng->txt("material_added_successfully"), true);
785 $this->ctrl->redirect($this, "material");
786 }

References $_GET, and $_SESSION.

◆ addPhrase()

SurveyQuestionGUI::addPhrase ( ilPropertyFormGUI  $a_form = null)
protected

Creates an output for the addition of phrases.

Definition at line 932 of file class.SurveyQuestionGUI.php.

933 {
934 $ilTabs = $this->tabs;
935
936 $ilTabs->activateTab("edit_properties");
937
938 if (!$a_form) {
939 $result = $this->saveForm();
940 if ($result) {
941 $this->object->saveToDb();
942 }
943
944 $a_form = $this->initPhrasesForm();
945 }
946
947 $this->tpl->setContent($a_form->getHTML());
948 }
$result

References $result, $tabs, initPhrasesForm(), and saveForm().

Referenced by addSelectedPhrase().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addSelectedPhrase()

SurveyQuestionGUI::addSelectedPhrase ( )
protected

Definition at line 950 of file class.SurveyQuestionGUI.php.

951 {
952 $form = $this->initPhrasesForm();
953 if ($form->checkInput()) {
954 $phrase_id = $form->getInput("phrases");
955
956 $valid = true;
957 if (strcmp($this->object->getPhrase($phrase_id), "dp_standard_numbers") != 0) {
958 $this->object->addPhrase($phrase_id);
959 } else {
960 $min = $form->getInput("lower_limit");
961 $max = $form->getInput("upper_limit");
962
963 if ($max <= $min) {
964 $max_field = $form->getItemByPostVar("upper_limit");
965 $max_field->setAlert($this->lng->txt("upper_limit_must_be_greater"));
966 $valid = false;
967 } else {
968 $this->object->addStandardNumbers($min, $max);
969 }
970 }
971
972 if ($valid) {
973 $this->object->saveToDb();
974
975 ilUtil::sendSuccess($this->lng->txt('phrase_added'), true);
976 $this->ctrl->redirect($this, 'editQuestion');
977 }
978 }
979
980 $form->setValuesByPost();
981 $this->addPhrase($form);
982 }
addPhrase(ilPropertyFormGUI $a_form=null)
Creates an output for the addition of phrases.
$valid

References $valid, addPhrase(), and initPhrasesForm().

+ Here is the call graph for this function:

◆ addST()

SurveyQuestionGUI::addST ( )

Definition at line 788 of file class.SurveyQuestionGUI.php.

789 {
790 $this->object->addInternalLink("il__st_" . $_GET["st"]);
791 unset($_SESSION["link_new_type"]);
792 unset($_SESSION["search_link_type"]);
793 ilUtil::sendSuccess($this->lng->txt("material_added_successfully"), true);
794 $this->ctrl->redirect($this, "material");
795 }

References $_GET, and $_SESSION.

◆ cancel()

SurveyQuestionGUI::cancel ( )
protected

Definition at line 535 of file class.SurveyQuestionGUI.php.

536 {
537 if ($this->parent_url) {
538 ilUtil::redirect($this->parent_url);
539 } else {
540 $this->ctrl->redirectByClass("ilobjsurveyquestionpoolgui", "questions");
541 }
542 }
static redirect($a_script)

References ilUtil\redirect().

+ Here is the call graph for this function:

◆ cancelExplorer()

SurveyQuestionGUI::cancelExplorer ( )

Definition at line 772 of file class.SurveyQuestionGUI.php.

773 {
774 unset($_SESSION["link_new_type"]);
775 ilUtil::sendInfo($this->lng->txt("msg_cancel"), true);
776 $this->ctrl->redirect($this, 'material');
777 }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $_SESSION, and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ cancelSync()

SurveyQuestionGUI::cancelSync ( )
protected

Definition at line 497 of file class.SurveyQuestionGUI.php.

498 {
499 ilUtil::sendInfo($this->lng->txt("question_changed_in_survey_only"), true);
500 $this->redirectAfterSaving($_REQUEST["rtrn"]);
501 }
redirectAfterSaving($a_return=false)
Redirect to calling survey or to edit form.

References redirectAfterSaving(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ confirmSavePhrase()

SurveyQuestionGUI::confirmSavePhrase ( )

Save a new phrase to the database.

@access public

Definition at line 1040 of file class.SurveyQuestionGUI.php.

1041 {
1042 $title = $_POST["phrase_title"];
1043
1044 $valid = true;
1045 if (!trim($title)) {
1046 ilUtil::sendFailure($this->lng->txt("qpl_savephrase_empty"));
1047 $valid = false;
1048 } elseif ($this->object->phraseExists($title)) {
1049 ilUtil::sendFailure($this->lng->txt("qpl_savephrase_exists"));
1050 $valid = false;
1051 }
1052
1053 if ($valid) {
1054 $this->object->savePhrase($title);
1055
1056 ilUtil::sendSuccess($this->lng->txt("phrase_saved"), true);
1057 $this->ctrl->redirect($this, "editQuestion");
1058 }
1059
1060 $this->savePhrase(true);
1061 }
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.

References $_POST, $valid, savePhrase(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ copySyncForm()

SurveyQuestionGUI::copySyncForm ( )
protected

Definition at line 413 of file class.SurveyQuestionGUI.php.

414 {
415 $ilTabs = $this->tabs;
416
417 $ilTabs->activateTab("edit_properties");
418
419 $tbl = new ilSurveySyncTableGUI($this, "copySyncForm", $this->object);
420
421 $this->tpl->setContent($tbl->getHTML());
422 }
Survey sync table GUI class.

References $tabs.

Referenced by syncCopies().

+ Here is the caller graph for this function:

◆ deleteMaterial()

SurveyQuestionGUI::deleteMaterial ( )

Definition at line 706 of file class.SurveyQuestionGUI.php.

707 {
708 if (is_array($_POST['idx'])) {
709 $this->object->deleteMaterials($_POST['idx']);
710 ilUtil::sendSuccess($this->lng->txt('materials_deleted'), true);
711 } else {
712 ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
713 }
714 $this->ctrl->redirect($this, 'material');
715 }

References $_POST, and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ editQuestion()

SurveyQuestionGUI::editQuestion ( ilPropertyFormGUI  $a_form = null)
protected

Definition at line 327 of file class.SurveyQuestionGUI.php.

328 {
329 $ilTabs = $this->tabs;
330
331 $ilTabs->activateTab("edit_properties");
332
333 if (!$a_form) {
334 $a_form = $this->initEditForm();
335 }
336 $this->tpl->setContent($a_form->getHTML());
337 }

References $tabs, and initEditForm().

Referenced by removeMaterial(), save(), and saveForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

& SurveyQuestionGUI::executeCommand ( )

Definition at line 111 of file class.SurveyQuestionGUI.php.

112 {
113 $cmd = $this->ctrl->getCmd();
114 $next_class = $this->ctrl->getNextClass($this);
115 switch ($next_class) {
116 default:
117 $ret = &$this->$cmd();
118 break;
119 }
120 return $ret;
121 }
$ret
Definition: parser.php:6

References $ret.

◆ getMaterialOutput()

SurveyQuestionGUI::getMaterialOutput ( )
protected

Creates the HTML output of the question material(s)

Definition at line 613 of file class.SurveyQuestionGUI.php.

614 {
615 if (count($this->object->getMaterial())) {
616 $template = new ilTemplate("tpl.il_svy_qpl_material.html", true, true, "Modules/SurveyQuestionPool");
617 foreach ($this->object->getMaterial() as $material) {
618 $template->setCurrentBlock('material');
619 switch ($material->type) {
620 case 0:
621 $href = SurveyQuestion::_getInternalLinkHref($material->internal_link, $_GET['ref_id']);
622 $template->setVariable('MATERIAL_TYPE', 'internallink');
623 $template->setVariable('MATERIAL_HREF', $href);
624 break;
625 }
626 $template->setVariable('MATERIAL_TITLE', (strlen($material->title)) ? ilUtil::prepareFormOutput($material->title) : $this->lng->txt('material'));
627 $template->setVariable('TEXT_AVAILABLE_MATERIALS', $this->lng->txt('material'));
628 $template->parseCurrentBlock();
629 }
630 return $template->get();
631 }
632 return "";
633 }
static _getInternalLinkHref($target="", $a_parent_ref_id=null)
special template class to simplify handling of ITX/PEAR
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public

References $_GET, SurveyQuestion\_getInternalLinkHref(), and ilUtil\prepareFormOutput().

Referenced by SurveyMatrixQuestionGUI\getWorkingForm(), SurveyMetricQuestionGUI\getWorkingForm(), SurveyMultipleChoiceQuestionGUI\getWorkingForm(), SurveySingleChoiceQuestionGUI\getWorkingForm(), and SurveyTextQuestionGUI\getWorkingForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPrintView()

SurveyQuestionGUI::getPrintView (   $question_title = 1,
  $show_questiontext = 1 
)
abstract

◆ getPrintViewQuestionTitle()

SurveyQuestionGUI::getPrintViewQuestionTitle (   $question_title = 1)
protected

Definition at line 554 of file class.SurveyQuestionGUI.php.

555 {
556 switch ($question_title) {
558 $title = ilUtil::prepareFormOutput($this->object->getTitle());
559 break;
560
561 #19448 get rid of showing only the label without title
562 //case 2:
563 // $title = ilUtil::prepareFormOutput($this->object->getLabel());
564 // break;
565
567 $title = ilUtil::prepareFormOutput($this->object->getTitle());
568 if (trim($this->object->getLabel())) {
569 $title .= ' <span class="questionLabel">(' . ilUtil::prepareFormOutput($this->object->getLabel()) . ')</span>';
570 }
571 break;
572 }
573 return $title;
574 }

References ilUtil\prepareFormOutput(), ilObjSurvey\PRINT_HIDE_LABELS, and ilObjSurvey\PRINT_SHOW_LABELS.

Referenced by SurveyMatrixQuestionGUI\getPrintView(), SurveyMetricQuestionGUI\getPrintView(), SurveyMultipleChoiceQuestionGUI\getPrintView(), SurveySingleChoiceQuestionGUI\getPrintView(), and SurveyTextQuestionGUI\getPrintView().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionType()

SurveyQuestionGUI::getQuestionType ( )

Returns the question type string.

Returns
string The question type string @access public

Definition at line 163 of file class.SurveyQuestionGUI.php.

164 {
165 return $this->object->getQuestionType();
166 }

Referenced by setQuestionTabsForClass().

+ Here is the caller graph for this function:

◆ getWorkingForm()

SurveyQuestionGUI::getWorkingForm (   $working_data = "",
  $question_title = 1,
  $show_questiontext = 1,
  $error_message = "",
  $survey_id = null 
)
abstract

Reimplemented in SurveyMatrixQuestionGUI, SurveyMetricQuestionGUI, SurveyMultipleChoiceQuestionGUI, SurveySingleChoiceQuestionGUI, and SurveyTextQuestionGUI.

Referenced by preview().

+ Here is the caller graph for this function:

◆ importEditFormValues()

SurveyQuestionGUI::importEditFormValues ( ilPropertyFormGUI  $a_form)
abstractprotected

Reimplemented in SurveyMatrixQuestionGUI, SurveyMetricQuestionGUI, SurveyMultipleChoiceQuestionGUI, SurveySingleChoiceQuestionGUI, and SurveyTextQuestionGUI.

Referenced by saveForm().

+ Here is the caller graph for this function:

◆ initEditForm()

SurveyQuestionGUI::initEditForm ( )
protected

Definition at line 248 of file class.SurveyQuestionGUI.php.

249 {
250 $form = new ilPropertyFormGUI();
251 $form->setFormAction($this->ctrl->getFormAction($this, "save"));
252 $form->setTitle($this->lng->txt($this->getQuestionType()));
253 $form->setMultipart(false);
254 $form->setTableWidth("100%");
255 // $form->setId("essay");
256
257 // title
258 $title = new ilTextInputGUI($this->lng->txt("title"), "title");
259 $title->setRequired(true);
260 $form->addItem($title);
261
262 // label
263 $label = new ilTextInputGUI($this->lng->txt("label"), "label");
264 $label->setInfo($this->lng->txt("label_info"));
265 $label->setRequired(false);
266 $form->addItem($label);
267
268 // author
269 $author = new ilTextInputGUI($this->lng->txt("author"), "author");
270 $author->setRequired(true);
271 $form->addItem($author);
272
273 // description
274 $description = new ilTextInputGUI($this->lng->txt("description"), "description");
275 $description->setRequired(false);
276 $form->addItem($description);
277
278 // questiontext
279 $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
280 $question->setRequired(true);
281 $question->setRows(10);
282 $question->setCols(80);
283 if (ilObjAdvancedEditing::_getRichTextEditor() === "tinymce") {
284 $question->setUseRte(true);
285 $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
286 $question->addPlugin("latex");
287 $question->addButton("latex");
288 $question->addButton("pastelatex");
289 $question->setRTESupport($this->object->getId(), "spl", "survey");
290 }
291 $form->addItem($question);
292
293 // obligatory
294 $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory");
295 $shuffle->setValue(1);
296 $shuffle->setRequired(false);
297 $form->addItem($shuffle);
298
299 $this->addFieldsToEditForm($form);
300
301 $this->addCommandButtons($form);
302
303 // values
304 $title->setValue($this->object->getTitle());
305 $label->setValue($this->object->label);
306 $author->setValue($this->object->getAuthor());
307 $description->setValue($this->object->getDescription());
308 $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext()));
309 $shuffle->setChecked($this->object->getObligatory());
310
311 return $form;
312 }
addFieldsToEditForm(ilPropertyFormGUI $a_form)
This class represents a checkbox property in a property form.
static _getRichTextEditor()
Returns the identifier for the Rich Text Editor.
static _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
This class represents a property form user interface.
This class represents a text area property in a property form.
This class represents a text property in a property form.

References ilObjAdvancedEditing\_getRichTextEditor(), ilObjAdvancedEditing\_getUsedHTMLTags(), addCommandButtons(), and addFieldsToEditForm().

Referenced by editQuestion(), and saveForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initObject()

SurveyQuestionGUI::initObject ( )
abstractprotected

◆ initPhrasesForm()

SurveyQuestionGUI::initPhrasesForm ( )
protected

Definition at line 892 of file class.SurveyQuestionGUI.php.

893 {
894 $form = new ilPropertyFormGUI();
895 $form->setFormAction($this->ctrl->getFormAction($this, "addSelectedPhrase"));
896 $form->setTitle($this->lng->txt("add_phrase"));
897 // $form->setDescription($this->lng->txt("add_phrase_introduction"));
898
899 $group = new ilRadioGroupInputGUI($this->lng->txt("phrase"), "phrases");
900 $group->setRequired(true);
901 $form->addItem($group);
902
903 foreach (ilSurveyPhrases::_getAvailablePhrases() as $phrase_id => $phrase_array) {
904 $categories = ilSurveyPhrases::_getCategoriesForPhrase($phrase_id);
905
906 $opt = new ilRadioOption($phrase_array["title"], $phrase_id);
907 $opt->setInfo(join(",", $categories));
908 $group->addOption($opt);
909
910 if ($phrase_array["org_title"] == "dp_standard_numbers") {
911 $min = new ilNumberInputGUI($this->lng->txt("lower_limit"), "lower_limit");
912 $min->setRequired(true);
913 $min->setSize(5);
914 $opt->addSubItem($min);
915
916 $max = new ilNumberInputGUI($this->lng->txt("upper_limit"), "upper_limit");
917 $max->setRequired(true);
918 $max->setSize(5);
919 $opt->addSubItem($max);
920 }
921 }
922
923 $form->addCommandButton("addSelectedPhrase", $this->lng->txt("add_phrase"));
924 $form->addCommandButton("editQuestion", $this->lng->txt("cancel"));
925
926 return $form;
927 }
This class represents a number property in a property form.
This class represents a property in a property form.
This class represents an option in a radio group.
static _getAvailablePhrases($useronly=0)
Gets the available phrases from the database.
static _getCategoriesForPhrase($phrase_id)
Gets the available categories for a given phrase.

References ilSurveyPhrases\_getAvailablePhrases(), and ilSurveyPhrases\_getCategoriesForPhrase().

Referenced by addPhrase(), and addSelectedPhrase().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ linkChilds()

SurveyQuestionGUI::linkChilds ( )

Definition at line 806 of file class.SurveyQuestionGUI.php.

807 {
808 $ilTabs = $this->tabs;
809
810 $selectable_items = array();
811
812 $source_id = $_GET["source_id"];
813
814 switch ($_SESSION["search_link_type"]) {
815 case "pg":
816 $cont_obj_gui = new ilObjContentObjectGUI("", $source_id, true);
817 $cont_obj = $cont_obj_gui->object;
818 $pages = ilLMPageObject::getPageList($cont_obj->getId());
819 foreach ($pages as $page) {
820 if ($page["type"] == $_SESSION["search_link_type"]) {
821 $selectable_items[] = array(
822 "item_type" => $page["type"]
823 ,"item_id" => $page["obj_id"]
824 ,"title" => $page["title"]
825 );
826 }
827 }
828 break;
829
830 case "st":
831 $cont_obj_gui = new ilObjContentObjectGUI("", $source_id, true);
832 $cont_obj = $cont_obj_gui->object;
833 // get all chapters
834 $ctree = &$cont_obj->getLMTree();
835 $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
836 foreach ($nodes as $node) {
837 if ($node["type"] == $_SESSION["search_link_type"]) {
838 $selectable_items[] = array(
839 "item_type" => $node["type"]
840 ,"item_id" => $node["obj_id"]
841 ,"title" => $node["title"]
842 );
843 }
844 }
845 break;
846
847 case "glo":
848 $glossary = new ilObjGlossary($source_id, true);
849 // get all glossary items
850 $terms = $glossary->getTermList();
851 foreach ($terms as $term) {
852 $selectable_items[] = array(
853 "item_type" => "GIT"
854 ,"item_id" => $term["id"]
855 ,"title" => $term["term"]
856 );
857 }
858 break;
859
860 case "lm":
861 $this->object->addInternalLink("il__lm_" . $source_id);
862 break;
863 }
864
865 if (sizeof($selectable_items)) {
866 $ilTabs->activateTab("material");
867 $this->ctrl->setParameter($this, "q_id", $this->object->getId());
868 $this->ctrl->setParameter($this, "source_id", $source_id);
869
870 $tbl = new SurveyMaterialsSourceTableGUI($this, "linkChilds", "addMaterial");
871 $tbl->setData($selectable_items);
872 $this->tpl->setContent($tbl->getHTML());
873 } else {
874 if ($_SESSION["search_link_type"] == "lm") {
875 ilUtil::sendSuccess($this->lng->txt("material_added_successfully"), true);
876
877 unset($_SESSION["link_new_type"]);
878 unset($_SESSION["search_link_type"]);
879 $this->ctrl->redirect($this, "material");
880 } else {
881 ilUtil::sendFailure($this->lng->txt("material_added_empty"), true);
882 $this->ctrl->redirect($this, "addMaterial");
883 }
884 }
885 }
TableGUI class for survey question source materials.
static getPageList($lm_id)
static
Class ilObjContentObjectGUI.
Class ilObjGlossary.

References $_GET, $_SESSION, $tabs, ilLMPageObject\getPageList(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ material()

SurveyQuestionGUI::material (   $checkonly = false)

Material tab of the survey questions.

Definition at line 642 of file class.SurveyQuestionGUI.php.

643 {
645 $ilTabs = $this->tabs;
646
647 $ilTabs->activateTab("material");
648
649 $add_html = '';
650 if ($rbacsystem->checkAccess('write', $_GET['ref_id'])) {
651 $form = new ilPropertyFormGUI();
652 $form->setFormAction($this->ctrl->getFormAction($this));
653 $form->setTitle($this->lng->txt('add_material'));
654 $form->setMultipart(false);
655 $form->setTableWidth("100%");
656 $form->setId("material");
657
658 // material
659 $material = new ilRadioGroupInputGUI($this->lng->txt("material"), "internalLinkType");
660 $material->setRequired(true);
661 $material->addOption(new ilRadioOption($this->lng->txt('obj_lm'), "lm"));
662 $material->addOption(new ilRadioOption($this->lng->txt('obj_st'), "st"));
663 $material->addOption(new ilRadioOption($this->lng->txt('obj_pg'), "pg"));
664 $material->addOption(new ilRadioOption($this->lng->txt('glossary_term'), "glo"));
665 $form->addItem($material);
666
667 $form->addCommandButton("addMaterial", $this->lng->txt("add"));
668
669 $errors = false;
670
671 if ($checkonly) {
672 $form->setValuesByPost();
673 $errors = !$form->checkInput();
674 if ($errors) {
675 $checkonly = false;
676 }
677 }
678 $add_html = $form->getHTML();
679 }
680
681
682 $mat_html = "";
683 if (count($this->object->getMaterial())) {
684 $table_gui = new ilSurveyMaterialsTableGUI($this, 'material', (($rbacsystem->checkAccess('write', $_GET['ref_id']) ? true : false)));
685 $data = array();
686 foreach ($this->object->getMaterial() as $material) {
687 switch ($material->type) {
688 case 0:
689 $href = SurveyQuestion::_getInternalLinkHref($material->internal_link, $_GET['ref_id']);
690 $type = $this->lng->txt('internal_link');
691 break;
692 }
693 $title = (strlen($material->title)) ? ilUtil::prepareFormOutput($material->title) : $this->lng->txt('material');
694 array_push($data, array('href' => $href, 'title' => $title, 'type' => $type));
695 }
696 $table_gui->setData($data);
697 $mat_html = $table_gui->getHTML();
698 }
699
700 if (!$checkonly) {
701 $this->tpl->setVariable("ADM_CONTENT", $add_html . $mat_html);
702 }
703 return $errors;
704 }
TableGUI class for survey question materials.
$type
$data
Definition: storeScorm.php:23
$errors

References $_GET, $data, $errors, $rbacsystem, $tabs, $type, SurveyQuestion\_getInternalLinkHref(), and ilUtil\prepareFormOutput().

Referenced by addMaterial().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ originalSyncForm()

SurveyQuestionGUI::originalSyncForm ( )
protected

Definition at line 468 of file class.SurveyQuestionGUI.php.

469 {
470 $ilTabs = $this->tabs;
471
472 $ilTabs->activateTab("edit_properties");
473
474 $this->ctrl->saveParameter($this, "rtrn");
475
476 $cgui = new ilConfirmationGUI();
477 $cgui->setHeaderText($this->lng->txt("confirm_sync_questions"));
478
479 $cgui->setFormAction($this->ctrl->getFormAction($this, "confirmRemoveQuestions"));
480 $cgui->setCancel($this->lng->txt("no"), "cancelSync");
481 $cgui->setConfirm($this->lng->txt("yes"), "sync");
482
483 $this->tpl->setContent($cgui->getHTML());
484 }
Confirmation screen class.

References $tabs.

◆ outQuestionText()

SurveyQuestionGUI::outQuestionText (   $template)
protected

Definition at line 168 of file class.SurveyQuestionGUI.php.

169 {
170 $questiontext = $this->object->getQuestiontext();
171 if (preg_match("/^<.[\\>]?>(.*?)<\\/.[\\>]*?>$/", $questiontext, $matches)) {
172 $questiontext = $matches[1];
173 }
174 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
175 if ($this->object->getObligatory($survey_id)) {
176 $template->setVariable("OBLIGATORY_TEXT", ' *');
177 }
178 }

Referenced by SurveyMatrixQuestionGUI\getPrintView(), SurveyMetricQuestionGUI\getPrintView(), SurveyMultipleChoiceQuestionGUI\getPrintView(), SurveySingleChoiceQuestionGUI\getPrintView(), SurveyTextQuestionGUI\getPrintView(), SurveyMatrixQuestionGUI\getWorkingForm(), SurveyMetricQuestionGUI\getWorkingForm(), SurveyMultipleChoiceQuestionGUI\getWorkingForm(), SurveySingleChoiceQuestionGUI\getWorkingForm(), and SurveyTextQuestionGUI\getWorkingForm().

+ Here is the caller graph for this function:

◆ preview()

SurveyQuestionGUI::preview ( )

Creates a preview of the question.

@access private

Definition at line 581 of file class.SurveyQuestionGUI.php.

582 {
583 $ilTabs = $this->tabs;
584
585 $ilTabs->activateTab("preview");
586
587 $tpl = new ilTemplate("tpl.il_svy_qpl_preview.html", true, true, "Modules/SurveyQuestionPool");
588
589 if ($this->object->getObligatory()) {
590 $tpl->setCurrentBlock("required");
591 $tpl->setVariable("TEXT_REQUIRED", $this->lng->txt("required_field"));
592 $tpl->parseCurrentBlock();
593 }
594
595 $tpl->setVariable("QUESTION_OUTPUT", $this->getWorkingForm());
596
597 $panel = ilPanelGUI::getInstance();
598 $panel->setBody($tpl->get());
599
600 $this->tpl->setContent($panel->getHTML());
601 }
getWorkingForm($working_data="", $question_title=1, $show_questiontext=1, $error_message="", $survey_id=null)

References $tabs, $tpl, ilPanelGUI\getInstance(), and getWorkingForm().

+ Here is the call graph for this function:

◆ redirectAfterSaving()

SurveyQuestionGUI::redirectAfterSaving (   $a_return = false)
protected

Redirect to calling survey or to edit form.

Parameters
bool$a_return

Definition at line 508 of file class.SurveyQuestionGUI.php.

509 {
510 // return?
511 if ($a_return) {
512 // to calling survey
513 if ($this->parent_url) {
514 $addurl = "";
515 if (strlen($_GET["new_for_survey"])) {
516 $addurl = "&new_id=" . $_GET["q_id"];
517 }
518 ilUtil::redirect(str_replace("&amp;", "&", $this->parent_url) . $addurl);
519 }
520 // to pool
521 else {
522 $this->ctrl->setParameterByClass("ilObjSurveyQuestionPoolGUI", "q_id_table_nav", $_SESSION['q_id_table_nav']);
523 $this->ctrl->redirectByClass("ilObjSurveyQuestionPoolGUI", "questions");
524 }
525 }
526 // stay in form
527 else {
528 $this->ctrl->setParameterByClass($_GET["cmdClass"], "q_id", $this->object->getId());
529 $this->ctrl->setParameterByClass($_GET["cmdClass"], "sel_question_types", $_GET["sel_question_types"]);
530 $this->ctrl->setParameterByClass($_GET["cmdClass"], "new_for_survey", $_GET["new_for_survey"]);
531 $this->ctrl->redirectByClass($_GET["cmdClass"], "editQuestion");
532 }
533 }

References $_GET, $_SESSION, and ilUtil\redirect().

Referenced by cancelSync(), save(), sync(), and syncCopies().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeMaterial()

SurveyQuestionGUI::removeMaterial ( )

Definition at line 765 of file class.SurveyQuestionGUI.php.

766 {
767 $this->object->material = array();
768 $this->object->saveToDb();
769 $this->editQuestion();
770 }
editQuestion(ilPropertyFormGUI $a_form=null)

References editQuestion().

+ Here is the call graph for this function:

◆ renderStatisticsDetailsTable()

SurveyQuestionGUI::renderStatisticsDetailsTable ( array  $a_head,
array  $a_rows,
array  $a_foot = null 
)
protected

Definition at line 1063 of file class.SurveyQuestionGUI.php.

1064 {
1065 $html = array();
1066 $html[] = '<div class="ilTableOuter table-responsive">';
1067 $html[] = '<table class="table table-striped">';
1068
1069 $html[] = "<thead>";
1070 $html[] = "<tr>";
1071 foreach ($a_head as $col) {
1072 $col = trim($col);
1073 $html[] = "<th>";
1074 $html[] = ($col != "") ? $col : "&nbsp;";
1075 $html[] = "</th>";
1076 }
1077 $html[] = "</tr>";
1078 $html[] = "</thead>";
1079
1080 $html[] = "<tbody>";
1081 foreach ($a_rows as $row) {
1082 $html[] = "<tr>";
1083 foreach ($row as $col) {
1084 $col = trim($col);
1085 $html[] = "<td>";
1086 $html[] = ($col != "") ? $col : "&nbsp;";
1087 $html[] = "</td>";
1088 }
1089 $html[] = "</tr>";
1090 }
1091 $html[] = "</tbody>";
1092
1093 if ($a_foot) {
1094 $html[] = "<tfoot>";
1095 $html[] = "<tr>";
1096 foreach ($a_foot as $col) {
1097 $col = trim($col);
1098 $html[] = "<td>";
1099 $html[] = ($col != "") ? $col : "&nbsp;";
1100 $html[] = "</td>";
1101 }
1102 $html[] = "</tr>";
1103 $html[] = "</tfoot>";
1104 }
1105
1106 $html[] = "</table>";
1107 $html[] = "</div>";
1108 return implode("\n", $html);
1109 }

◆ save()

SurveyQuestionGUI::save (   $a_return = false,
  $a_sync = false 
)
protected

Definition at line 375 of file class.SurveyQuestionGUI.php.

376 {
378
379 if ($this->saveForm()) {
380 // #13784
381 if ($a_return &&
382 !SurveyQuestion::_isComplete($this->object->getId())) {
383 ilUtil::sendFailure($this->lng->txt("survey_error_insert_incomplete_question"));
384 return $this->editQuestion();
385 }
386
387 $ilUser->setPref("svy_lastquestiontype", $this->object->getQuestionType());
388 $ilUser->writePref("svy_lastquestiontype", $this->object->getQuestionType());
389
390 $originalexists = SurveyQuestion::_questionExists($this->object->original_id);
391 $this->ctrl->setParameter($this, "q_id", $this->object->getId());
392
393 // pool question?
394 if ($a_sync) {
395 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
396 $this->ctrl->redirect($this, 'copySyncForm');
397 } else {
398 // form: update original pool question, too?
399 if ($originalexists &&
400 SurveyQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) {
401 if ($a_return) {
402 $this->ctrl->setParameter($this, 'rtrn', 1);
403 }
404 $this->ctrl->redirect($this, 'originalSyncForm');
405 }
406 }
407
408 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
409 $this->redirectAfterSaving($a_return);
410 }
411 }
static _questionExists($question_id)
Returns true if the question already exists in the database.
static _isWriteable($question_id, $user_id)
Returns true if the question is writeable by a certain user.
static _isComplete($question_id)
Checks whether the question is complete or not.
$ilUser
Definition: imgupload.php:18

References $ilUser, $user, SurveyQuestion\_isComplete(), SurveyQuestion\_isWriteable(), SurveyQuestion\_questionExists(), editQuestion(), redirectAfterSaving(), saveForm(), and ilUtil\sendFailure().

Referenced by saveReturn(), and saveSync().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveForm()

SurveyQuestionGUI::saveForm ( )
protected

Definition at line 349 of file class.SurveyQuestionGUI.php.

350 {
351 $form = $this->initEditForm();
352 if ($form->checkInput()) {
353 if ($this->validateEditForm($form)) {
354 $this->object->setTitle($form->getInput("title"));
355 $this->object->label = ($form->getInput("label"));
356 $this->object->setAuthor($form->getInput("author"));
357 $this->object->setDescription($form->getInput("description"));
358 $this->object->setQuestiontext($form->getInput("question"));
359 $this->object->setObligatory($form->getInput("obligatory"));
360
361 $this->importEditFormValues($form);
362
363 // will save both core and extended data
364 $this->object->saveToDb();
365
366 return true;
367 }
368 }
369
370 $form->setValuesByPost();
371 $this->editQuestion($form);
372 return false;
373 }
validateEditForm(ilPropertyFormGUI $a_form)
importEditFormValues(ilPropertyFormGUI $a_form)

References editQuestion(), importEditFormValues(), initEditForm(), and validateEditForm().

Referenced by addPhrase(), save(), and savePhrase().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ savePhrase()

SurveyQuestionGUI::savePhrase (   $a_reload = false)

Creates an output to save the current answers as a phrase.

@access public

Definition at line 989 of file class.SurveyQuestionGUI.php.

990 {
991 $ilTabs = $this->tabs;
992 $ilToolbar = $this->toolbar;
993
994 $ilTabs->activateTab("edit_properties");
995
996 if (!$a_reload) {
997 $result = $this->saveForm();
998 if ($result) {
999 $this->object->saveToDb();
1000 }
1001 }
1002
1003 $txt = new ilTextInputGUI($this->lng->txt("enter_phrase_title"), "phrase_title");
1004 $ilToolbar->addInputItem($txt, true);
1005 $ilToolbar->addFormButton($this->lng->txt("confirm"), "confirmSavePhrase");
1006 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
1007
1008 $table_gui = new ilSurveySavePhraseTableGUI($this, 'editQuestion');
1009 $table_gui->setDescription($this->lng->txt("save_phrase_introduction"));
1010
1011 // matrix?
1012 if (method_exists($this->object, "getCategories")) {
1013 $categories = $this->object->getCategories();
1014 } else {
1015 $categories = $this->object->getColumns();
1016 }
1017
1018 $data = array();
1019 for ($i = 0; $i < $categories->getCategoryCount(); $i++) {
1020 $cat = $categories->getCategory($i);
1021
1022 $data[] = array(
1023 "answer" => $cat->title,
1024 "other" => $cat->other,
1025 "scale" => $cat->scale,
1026 "neutral" => $cat->neutral
1027 );
1028 }
1029 $table_gui->setData($data);
1030 $_SESSION['save_phrase_data'] = $data; // :TODO: see savePhrase()
1031
1032 $this->tpl->setContent($table_gui->getHTML());
1033 }
$txt
Definition: error.php:13
$i
Definition: metadata.php:24

References $_SESSION, $data, $i, $result, $tabs, $toolbar, $txt, and saveForm().

Referenced by confirmSavePhrase().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveReturn()

SurveyQuestionGUI::saveReturn ( )
protected

Definition at line 344 of file class.SurveyQuestionGUI.php.

345 {
346 $this->save(true);
347 }
save($a_return=false, $a_sync=false)

References save().

+ Here is the call graph for this function:

◆ saveSync()

SurveyQuestionGUI::saveSync ( )
protected

Definition at line 339 of file class.SurveyQuestionGUI.php.

340 {
341 $this->save($_REQUEST["rtrn"], true);
342 }

References save().

+ Here is the call graph for this function:

◆ setBackUrl()

SurveyQuestionGUI::setBackUrl (   $a_url)

Definition at line 180 of file class.SurveyQuestionGUI.php.

181 {
182 $this->parent_url = $a_url;
183 }

◆ setQuestionTabs()

◆ setQuestionTabsForClass()

SurveyQuestionGUI::setQuestionTabsForClass (   $guiclass)

Definition at line 185 of file class.SurveyQuestionGUI.php.

186 {
188 $ilTabs = $this->tabs;
189
190 $this->ctrl->setParameterByClass($guiclass, "sel_question_types", $this->getQuestionType());
191 $this->ctrl->setParameterByClass($guiclass, "q_id", $_GET["q_id"]);
192
193 if ($this->parent_url) {
194 $addurl = "";
195 if (strlen($_GET["new_for_survey"])) {
196 $addurl = "&new_id=" . $_GET["q_id"];
197 }
198 $ilTabs->setBackTarget($this->lng->txt("menubacktosurvey"), $this->parent_url . $addurl);
199 } else {
200 $this->ctrl->setParameterByClass("ilObjSurveyQuestionPoolGUI", "q_id_table_nav", $_SESSION['q_id_table_nav']);
201 $ilTabs->setBackTarget($this->lng->txt("spl"), $this->ctrl->getLinkTargetByClass("ilObjSurveyQuestionPoolGUI", "questions"));
202 }
203 if ($_GET["q_id"]) {
204 $ilTabs->addNonTabbedLink(
205 "preview",
206 $this->lng->txt("preview"),
207 $this->ctrl->getLinkTargetByClass($guiclass, "preview")
208 );
209 }
210
211 if ($rbacsystem->checkAccess('edit', $_GET["ref_id"])) {
212 $ilTabs->addTab(
213 "edit_properties",
214 $this->lng->txt("properties"),
215 $this->ctrl->getLinkTargetByClass($guiclass, "editQuestion")
216 );
217
218 if (stristr($guiclass, "matrix")) {
219 $ilTabs->addTab(
220 "layout",
221 $this->lng->txt("layout"),
222 $this->ctrl->getLinkTargetByClass($guiclass, "layout")
223 );
224 }
225 }
226 if ($_GET["q_id"]) {
227 $ilTabs->addTab(
228 "material",
229 $this->lng->txt("material"),
230 $this->ctrl->getLinkTargetByClass($guiclass, "material")
231 );
232 }
233
234 if ($this->object->getId() > 0) {
235 $title = $this->lng->txt("edit") . " &quot;" . $this->object->getTitle() . "&quot";
236 } else {
237 $title = $this->lng->txt("create_new") . " " . $this->lng->txt($this->getQuestionType());
238 }
239
240 $this->tpl->setVariable("HEADER", $title);
241 }
getQuestionType()
Returns the question type string.

References $_GET, $_SESSION, $rbacsystem, $tabs, and getQuestionType().

Referenced by SurveyMatrixQuestionGUI\setQuestionTabs(), SurveyMetricQuestionGUI\setQuestionTabs(), SurveyMultipleChoiceQuestionGUI\setQuestionTabs(), SurveySingleChoiceQuestionGUI\setQuestionTabs(), and SurveyTextQuestionGUI\setQuestionTabs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sync()

SurveyQuestionGUI::sync ( )
protected

Definition at line 486 of file class.SurveyQuestionGUI.php.

487 {
488 $original_id = $this->object->original_id;
489 if ($original_id) {
490 $this->object->syncWithOriginal();
491 }
492
493 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
494 $this->redirectAfterSaving($_REQUEST["rtrn"]);
495 }

References redirectAfterSaving().

+ Here is the call graph for this function:

◆ syncCopies()

SurveyQuestionGUI::syncCopies ( )
protected

Definition at line 424 of file class.SurveyQuestionGUI.php.

425 {
427 $ilAccess = $this->access;
428
429 if (!sizeof($_POST["qid"])) {
430 ilUtil::sendFailure($lng->txt("select_one"));
431 return $this->copySyncForm();
432 }
433
434 foreach ($this->object->getCopyIds(true) as $survey_id => $questions) {
435 // check permissions for "parent" survey
436 $can_write = false;
437 $ref_ids = ilObject::_getAllReferences($survey_id);
438 foreach ($ref_ids as $ref_id) {
439 if ($ilAccess->checkAccess("edit", "", $ref_id)) {
440 $can_write = true;
441 break;
442 }
443 }
444
445 if ($can_write) {
446 foreach ($questions as $qid) {
447 if (in_array($qid, $_POST["qid"])) {
448 $id = $this->object->getId();
449
450 $this->object->setId($qid);
451 $this->object->setOriginalId($id);
452 $this->object->saveToDb();
453
454 $this->object->setId($id);
455 $this->object->setOriginalId(null);
456
457 // see: SurveyQuestion::syncWithOriginal()
458 // what about material?
459 }
460 }
461 }
462 }
463
464 ilUtil::sendSuccess($lng->txt("survey_sync_success"), true);
465 $this->redirectAfterSaving($_REQUEST["rtrn"]);
466 }
static _getAllReferences($a_id)
get all reference ids of object

References $_POST, $access, $lng, ilObject\_getAllReferences(), copySyncForm(), redirectAfterSaving(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ validateEditForm()

SurveyQuestionGUI::validateEditForm ( ilPropertyFormGUI  $a_form)
protected

Reimplemented in SurveyMultipleChoiceQuestionGUI.

Definition at line 544 of file class.SurveyQuestionGUI.php.

545 {
546 return true;
547 }

Referenced by saveForm().

+ Here is the caller graph for this function:

Field Documentation

◆ $access

SurveyQuestionGUI::$access
protected

Definition at line 49 of file class.SurveyQuestionGUI.php.

Referenced by syncCopies().

◆ $ctrl

SurveyQuestionGUI::$ctrl
protected

Definition at line 68 of file class.SurveyQuestionGUI.php.

◆ $cumulated

SurveyQuestionGUI::$cumulated
protected

Definition at line 69 of file class.SurveyQuestionGUI.php.

◆ $lng

SurveyQuestionGUI::$lng
protected

Definition at line 67 of file class.SurveyQuestionGUI.php.

Referenced by __construct(), and syncCopies().

◆ $log

SurveyQuestionGUI::$log
protected

Definition at line 75 of file class.SurveyQuestionGUI.php.

◆ $object

SurveyQuestionGUI::$object

Definition at line 77 of file class.SurveyQuestionGUI.php.

◆ $parent_url

SurveyQuestionGUI::$parent_url
protected

Definition at line 70 of file class.SurveyQuestionGUI.php.

◆ $rbacsystem

SurveyQuestionGUI::$rbacsystem
protected

Definition at line 39 of file class.SurveyQuestionGUI.php.

Referenced by material(), and setQuestionTabsForClass().

◆ $tabs

◆ $toolbar

SurveyQuestionGUI::$toolbar
protected

Definition at line 59 of file class.SurveyQuestionGUI.php.

Referenced by addMaterial(), and savePhrase().

◆ $tpl

SurveyQuestionGUI::$tpl
protected

Definition at line 66 of file class.SurveyQuestionGUI.php.

Referenced by __construct(), and preview().

◆ $tree

SurveyQuestionGUI::$tree
protected

Definition at line 54 of file class.SurveyQuestionGUI.php.

Referenced by addMaterial().

◆ $user

SurveyQuestionGUI::$user
protected

Definition at line 44 of file class.SurveyQuestionGUI.php.

Referenced by save().


The documentation for this class was generated from the following file: