ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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

 $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 49 of file class.SurveyQuestionGUI.php.

50 {
51 global $lng, $tpl, $ilCtrl;
52
53 $this->lng = $lng;
54 $this->tpl = $tpl;
55 $this->ctrl = $ilCtrl;
56 $this->ctrl->saveParameter($this, "q_id");
57 $this->ctrl->setParameterByClass($_GET["cmdClass"], "sel_question_types", $_GET["sel_question_types"]);
58 $this->cumulated = array();
59
60 $this->initObject();
61
62 if($a_id > 0)
63 {
64 $this->object->loadFromDb($a_id);
65 }
66 $this->log = ilLoggerFactory::getLogger('svy');
67
68 }
$_GET["client_id"]
static getLogger($a_component_id)
Get component logger.
global $ilCtrl
Definition: ilias.php:18

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

+ Here is the call graph for this function:

Member Function Documentation

◆ _getClassNameForQType()

static SurveyQuestionGUI::_getClassNameForQType (   $q_type)
static

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

120 {
121 return $q_type;
122 }

Referenced by _getGUIClassNameForId().

+ Here is the caller graph for this function:

◆ _getGUIClassNameForId()

static SurveyQuestionGUI::_getGUIClassNameForId (   $a_q_id)
static

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

111 {
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);
115 $class_name = SurveyQuestionGUI::_getClassNameForQType($q_type);
116 return $class_name;
117 }
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 97 of file class.SurveyQuestionGUI.php.

98 {
99 include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
100 if ((!$questiontype) and ($question_id > 0))
101 {
102 $questiontype = SurveyQuestion::_getQuestiontype($question_id);
103 }
104 SurveyQuestion::_includeClass($questiontype, 1);
105 $question_type_gui = $questiontype . "GUI";
106 $question = new $question_type_gui($question_id);
107 return $question;
108 }
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 285 of file class.SurveyQuestionGUI.php.

286 {
287 $a_form->addCommandButton("saveReturn", $this->lng->txt("save_return"));
288 $a_form->addCommandButton("save", $this->lng->txt("save"));
289
290 // pool question?
291 if(ilObject::_lookupType($this->object->getObjId()) == "spl")
292 {
293 if($this->object->hasCopies())
294 {
295 $a_form->addCommandButton("saveSync", $this->lng->txt("svy_save_sync"));
296 }
297 }
298 }
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 810 of file class.SurveyQuestionGUI.php.

811 {
812 $this->object->addInternalLink("il__git_" . $_GET["git"]);
813 unset($_SESSION["link_new_type"]);
814 unset($_SESSION["search_link_type"]);
815 ilUtil::sendSuccess($this->lng->txt("material_added_successfully"), true);
816 $this->ctrl->redirect($this, "material");
817 }
$_SESSION["AccountId"]
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

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

+ Here is the call graph for this function:

◆ addMaterial()

SurveyQuestionGUI::addMaterial ( )

Add materials to a question.

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

733 {
734 global $tree, $ilTabs, $ilToolbar;
735
736 $ilTabs->activateTab("material");
737
738 $ilToolbar->addButton($this->lng->txt("cancel"),
739 $this->ctrl->getLinkTarget($this, "material"));
740
741 if (strlen($_SESSION["link_new_type"]) || !$this->material(true))
742 {
743 include_once("./Modules/SurveyQuestionPool/classes/class.ilMaterialExplorer.php");
744 switch ($_POST["internalLinkType"])
745 {
746 case "lm":
747 $_SESSION["link_new_type"] = "lm";
748 $_SESSION["search_link_type"] = "lm";
749 break;
750 case "glo":
751 $_SESSION["link_new_type"] = "glo";
752 $_SESSION["search_link_type"] = "glo";
753 break;
754 case "st":
755 $_SESSION["link_new_type"] = "lm";
756 $_SESSION["search_link_type"] = "st";
757 break;
758 case "pg":
759 $_SESSION["link_new_type"] = "lm";
760 $_SESSION["search_link_type"] = "pg";
761 break;
762 }
763
764 $exp = new ilMaterialExplorer($this, 'addMaterial', $_SESSION["link_new_type"]);
765 $exp->setPathOpen((int)$_GET["ref_id"]);
766 if (!$exp->handleCommand())
767 {
768 include_once "Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
769 $panel = ilPanelGUI::getInstance();
770 $panel->setHeading($this->lng->txt("select_object_to_link"));
771 $panel->setBody($exp->getHTML());
772
773 $this->tpl->setContent($panel->getHTML());
774 }
775 }
776 }
$_POST["username"]
material($checkonly=FALSE)
Material tab of the survey questions.
static getInstance()
Get instance.

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

+ Here is the call graph for this function:

◆ addPG()

SurveyQuestionGUI::addPG ( )

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

793 {
794 $this->object->addInternalLink("il__pg_" . $_GET["pg"]);
795 unset($_SESSION["link_new_type"]);
796 unset($_SESSION["search_link_type"]);
797 ilUtil::sendSuccess($this->lng->txt("material_added_successfully"), true);
798 $this->ctrl->redirect($this, "material");
799 }

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

+ Here is the call graph for this function:

◆ addPhrase()

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

Creates an output for the addition of phrases.

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

967 {
968 global $ilTabs;
969
970 $ilTabs->activateTab("edit_properties");
971
972 if(!$a_form)
973 {
974 $result = $this->saveForm();
975 if($result)
976 {
977 $this->object->saveToDb();
978 }
979
980 $a_form = $this->initPhrasesForm();
981 }
982
983 $this->tpl->setContent($a_form->getHTML());
984 }
$result

References $result, 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 986 of file class.SurveyQuestionGUI.php.

987 {
988 $form = $this->initPhrasesForm();
989 if($form->checkInput())
990 {
991 $phrase_id = $form->getInput("phrases");
992
993 $valid = true;
994 if (strcmp($this->object->getPhrase($phrase_id), "dp_standard_numbers") != 0)
995 {
996 $this->object->addPhrase($phrase_id);
997 }
998 else
999 {
1000 $min = $form->getInput("lower_limit");
1001 $max = $form->getInput("upper_limit");
1002
1003 if($max <= $min)
1004 {
1005 $max_field = $form->getItemByPostVar("upper_limit");
1006 $max_field->setAlert($this->lng->txt("upper_limit_must_be_greater"));
1007 $valid = false;
1008 }
1009 else
1010 {
1011 $this->object->addStandardNumbers($min, $max);
1012 }
1013 }
1014
1015 if($valid)
1016 {
1017 $this->object->saveToDb();
1018
1019 ilUtil::sendSuccess($this->lng->txt('phrase_added'), true);
1020 $this->ctrl->redirect($this, 'editQuestion');
1021 }
1022 }
1023
1024 $form->setValuesByPost();
1025 $this->addPhrase($form);
1026 }
addPhrase(ilPropertyFormGUI $a_form=null)
Creates an output for the addition of phrases.
$valid

References $valid, addPhrase(), initPhrasesForm(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ addST()

SurveyQuestionGUI::addST ( )

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

802 {
803 $this->object->addInternalLink("il__st_" . $_GET["st"]);
804 unset($_SESSION["link_new_type"]);
805 unset($_SESSION["search_link_type"]);
806 ilUtil::sendSuccess($this->lng->txt("material_added_successfully"), true);
807 $this->ctrl->redirect($this, "material");
808 }

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

+ Here is the call graph for this function:

◆ cancel()

SurveyQuestionGUI::cancel ( )
protected

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

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

References ilUtil\redirect().

+ Here is the call graph for this function:

◆ cancelExplorer()

SurveyQuestionGUI::cancelExplorer ( )

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

786 {
787 unset($_SESSION["link_new_type"]);
788 ilUtil::sendInfo($this->lng->txt("msg_cancel"), true);
789 $this->ctrl->redirect($this, 'material');
790 }
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 490 of file class.SurveyQuestionGUI.php.

491 {
492 ilUtil::sendInfo($this->lng->txt("question_changed_in_survey_only"), true);
493 $this->redirectAfterSaving($_REQUEST["rtrn"]);
494 }
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 1091 of file class.SurveyQuestionGUI.php.

1092 {
1093 $title = $_POST["phrase_title"];
1094
1095 $valid = true;
1096 if (!trim($title))
1097 {
1098 ilUtil::sendFailure($this->lng->txt("qpl_savephrase_empty"));
1099 $valid = false;
1100 }
1101 else if ($this->object->phraseExists($title))
1102 {
1103 ilUtil::sendFailure($this->lng->txt("qpl_savephrase_exists"));
1104 $valid = false;
1105 }
1106
1107 if($valid)
1108 {
1109 $this->object->savePhrase($title);
1110
1111 ilUtil::sendSuccess($this->lng->txt("phrase_saved"), true);
1112 $this->ctrl->redirect($this, "editQuestion");
1113 }
1114
1115 $this->savePhrase(true);
1116 }
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, $title, $valid, savePhrase(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ copySyncForm()

SurveyQuestionGUI::copySyncForm ( )
protected

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

398 {
399 global $ilTabs;
400
401 $ilTabs->activateTab("edit_properties");
402
403 include_once "Modules/SurveyQuestionPool/classes/class.ilSurveySyncTableGUI.php";
404 $tbl = new ilSurveySyncTableGUI($this, "copySyncForm", $this->object);
405
406 $this->tpl->setContent($tbl->getHTML());
407 }
Survey sync table GUI class.
$tbl
Definition: example_048.php:81

References $tbl.

Referenced by syncCopies().

+ Here is the caller graph for this function:

◆ deleteMaterial()

SurveyQuestionGUI::deleteMaterial ( )

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

716 {
717 if (is_array($_POST['idx']))
718 {
719 $this->object->deleteMaterials($_POST['idx']);
720 ilUtil::sendSuccess($this->lng->txt('materials_deleted'), true);
721 }
722 else
723 {
724 ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
725 }
726 $this->ctrl->redirect($this, 'material');
727 }

References $_POST, ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ editQuestion()

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

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

301 {
302 global $ilTabs;
303
304 $ilTabs->activateTab("edit_properties");
305
306 if(!$a_form)
307 {
308 $a_form = $this->initEditForm();
309 }
310 $this->tpl->setContent($a_form->getHTML());
311 }

References 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 73 of file class.SurveyQuestionGUI.php.

74 {
75 $cmd = $this->ctrl->getCmd();
76 $next_class = $this->ctrl->getNextClass($this);
77 switch($next_class)
78 {
79 default:
80 $ret =& $this->$cmd();
81 break;
82 }
83 return $ret;
84 }
$ret
Definition: parser.php:6
$cmd
Definition: sahs_server.php:35

References $cmd, and $ret.

◆ getMaterialOutput()

SurveyQuestionGUI::getMaterialOutput ( )
protected

Creates the HTML output of the question material(s)

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

618 {
619 if (count($this->object->getMaterial()))
620 {
621 $template = new ilTemplate("tpl.il_svy_qpl_material.html", TRUE, TRUE, "Modules/SurveyQuestionPool");
622 foreach ($this->object->getMaterial() as $material)
623 {
624 $template->setCurrentBlock('material');
625 switch ($material->type)
626 {
627 case 0:
628 $href = SurveyQuestion::_getInternalLinkHref($material->internal_link, $_GET['ref_id']);
629 $template->setVariable('MATERIAL_TYPE', 'internallink');
630 $template->setVariable('MATERIAL_HREF', $href);
631 break;
632 }
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();
636 }
637 return $template->get();
638 }
639 return "";
640 }
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 555 of file class.SurveyQuestionGUI.php.

556 {
557 switch ($question_title)
558 {
559 case 1:
560 $title = ilUtil::prepareFormOutput($this->object->getTitle());
561 break;
562
563 case 2:
564 $title = ilUtil::prepareFormOutput($this->object->getLabel());
565 break;
566
567 case 3:
568 $title = ilUtil::prepareFormOutput($this->object->getTitle());
569 if(trim($this->object->getLabel()))
570 {
571 $title .= ' <span class="questionLabel">('.ilUtil::prepareFormOutput($this->object->getLabel()).')</span>';
572 }
573 break;
574 }
575 return $title;
576 }

References $title, and ilUtil\prepareFormOutput().

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 130 of file class.SurveyQuestionGUI.php.

131 {
132 return $this->object->getQuestionType();
133 }

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 219 of file class.SurveyQuestionGUI.php.

220 {
221 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
222 $form = new ilPropertyFormGUI();
223 $form->setFormAction($this->ctrl->getFormAction($this, "save"));
224 $form->setTitle($this->lng->txt($this->getQuestionType()));
225 $form->setMultipart(FALSE);
226 $form->setTableWidth("100%");
227 // $form->setId("essay");
228
229 // title
230 $title = new ilTextInputGUI($this->lng->txt("title"), "title");
231 $title->setRequired(TRUE);
232 $form->addItem($title);
233
234 // label
235 $label = new ilTextInputGUI($this->lng->txt("label"), "label");
236 $label->setInfo($this->lng->txt("label_info"));
237 $label->setRequired(false);
238 $form->addItem($label);
239
240 // author
241 $author = new ilTextInputGUI($this->lng->txt("author"), "author");
242 $author->setRequired(TRUE);
243 $form->addItem($author);
244
245 // description
246 $description = new ilTextInputGUI($this->lng->txt("description"), "description");
247 $description->setRequired(FALSE);
248 $form->addItem($description);
249
250 // questiontext
251 $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
252 $question->setRequired(TRUE);
253 $question->setRows(10);
254 $question->setCols(80);
255 $question->setUseRte(TRUE);
256 include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
257 $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
258 $question->addPlugin("latex");
259 $question->addButton("latex");
260 $question->addButton("pastelatex");
261 $question->setRTESupport($this->object->getId(), "spl", "survey");
262 $form->addItem($question);
263
264 // obligatory
265 $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory");
266 $shuffle->setValue(1);
267 $shuffle->setRequired(FALSE);
268 $form->addItem($shuffle);
269
270 $this->addFieldsToEditForm($form);
271
272 $this->addCommandButtons($form);
273
274 // values
275 $title->setValue($this->object->getTitle());
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());
281
282 return $form;
283 }
addFieldsToEditForm(ilPropertyFormGUI $a_form)
This class represents a checkbox property in a property form.
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 $title, 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 922 of file class.SurveyQuestionGUI.php.

923 {
924 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
925 $form = new ilPropertyFormGUI();
926 $form->setFormAction($this->ctrl->getFormAction($this, "addSelectedPhrase"));
927 $form->setTitle($this->lng->txt("add_phrase"));
928 // $form->setDescription($this->lng->txt("add_phrase_introduction"));
929
930 $group = new ilRadioGroupInputGUI($this->lng->txt("phrase"), "phrases");
931 $group->setRequired(true);
932 $form->addItem($group);
933
934 include_once "./Modules/SurveyQuestionPool/classes/class.ilSurveyPhrases.php";
935 foreach (ilSurveyPhrases::_getAvailablePhrases() as $phrase_id => $phrase_array)
936 {
937 $categories = ilSurveyPhrases::_getCategoriesForPhrase($phrase_id);
938
939 $opt = new ilRadioOption($phrase_array["title"], $phrase_id);
940 $opt->setInfo(join($categories, ","));
941 $group->addOption($opt);
942
943 if($phrase_array["org_title"] == "dp_standard_numbers")
944 {
945 $min = new ilNumberInputGUI($this->lng->txt("lower_limit"), "lower_limit");
946 $min->setRequired(true);
947 $min->setSize(5);
948 $opt->addSubItem($min);
949
950 $max = new ilNumberInputGUI($this->lng->txt("upper_limit"), "upper_limit");
951 $max->setRequired(true);
952 $max->setSize(5);
953 $opt->addSubItem($max);
954 }
955 }
956
957 $form->addCommandButton("addSelectedPhrase", $this->lng->txt("add_phrase"));
958 $form->addCommandButton("editQuestion", $this->lng->txt("cancel"));
959
960 return $form;
961 }
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 819 of file class.SurveyQuestionGUI.php.

820 {
821 global $ilTabs;
822
823 $selectable_items = array();
824
825 $source_id = $_GET["source_id"];
826
827 switch ($_SESSION["search_link_type"])
828 {
829 case "pg":
830 include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
831 include_once("./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
832 $cont_obj_gui = new ilObjContentObjectGUI("", $source_id, true);
833 $cont_obj = $cont_obj_gui->object;
834 $pages = ilLMPageObject::getPageList($cont_obj->getId());
835 foreach($pages as $page)
836 {
837 if($page["type"] == $_SESSION["search_link_type"])
838 {
839 $selectable_items[] = array(
840 "item_type" => $page["type"]
841 ,"item_id" => $page["obj_id"]
842 ,"title" => $page["title"]
843 );
844 }
845 }
846 break;
847
848 case "st":
849 include_once("./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
850 $cont_obj_gui = new ilObjContentObjectGUI("", $source_id, true);
851 $cont_obj = $cont_obj_gui->object;
852 // get all chapters
853 $ctree =& $cont_obj->getLMTree();
854 $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
855 foreach($nodes as $node)
856 {
857 if($node["type"] == $_SESSION["search_link_type"])
858 {
859 $selectable_items[] = array(
860 "item_type" => $node["type"]
861 ,"item_id" => $node["obj_id"]
862 ,"title" => $node["title"]
863 );
864 }
865 }
866 break;
867
868 case "glo":
869 include_once "./Modules/Glossary/classes/class.ilObjGlossary.php";
870 $glossary = new ilObjGlossary($source_id, true);
871 // get all glossary items
872 $terms = $glossary->getTermList();
873 foreach($terms as $term)
874 {
875 $selectable_items[] = array(
876 "item_type" => "GIT"
877 ,"item_id" => $term["id"]
878 ,"title" => $term["term"]
879 );
880 }
881 break;
882
883 case "lm":
884 $this->object->addInternalLink("il__lm_" . $source_id);
885 break;
886 }
887
888 if(sizeof($selectable_items))
889 {
890 $ilTabs->activateTab("material");
891 $this->ctrl->setParameter($this, "q_id", $this->object->getId());
892 $this->ctrl->setParameter($this, "source_id", $source_id);
893
894 include_once "Modules/SurveyQuestionPool/classes/tables/class.SurveyMaterialsSourceTableGUI.php";
895 $tbl = new SurveyMaterialsSourceTableGUI($this, "linkChilds", "addMaterial");
896 $tbl->setData($selectable_items);
897 $this->tpl->setContent($tbl->getHTML());
898 }
899 else
900 {
901 if($_SESSION["search_link_type"] == "lm")
902 {
903 ilUtil::sendSuccess($this->lng->txt("material_added_successfully"), true);
904
905 unset($_SESSION["link_new_type"]);
906 unset($_SESSION["search_link_type"]);
907 $this->ctrl->redirect($this, "material");
908 }
909 else
910 {
911 ilUtil::sendFailure($this->lng->txt("material_added_empty"), true);
912 $this->ctrl->redirect($this, "addMaterial");
913 }
914 }
915 }
TableGUI class for survey question source materials.
static getPageList($lm_id)
static
Class ilObjContentObjectGUI.
Class ilObjGlossary.

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

+ Here is the call graph for this function:

◆ material()

SurveyQuestionGUI::material (   $checkonly = FALSE)

Material tab of the survey questions.

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

650 {
651 global $rbacsystem, $ilTabs;
652
653 $ilTabs->activateTab("material");
654
655 $add_html = '';
656 if ($rbacsystem->checkAccess('write', $_GET['ref_id']))
657 {
658 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
659 $form = new ilPropertyFormGUI();
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");
665
666 // material
667 $material = new ilRadioGroupInputGUI($this->lng->txt("material"), "internalLinkType");
668 $material->setRequired(true);
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);
674
675 $form->addCommandButton("addMaterial", $this->lng->txt("add"));
676
677 $errors = false;
678
679 if ($checkonly)
680 {
681 $form->setValuesByPost();
682 $errors = !$form->checkInput();
683 if ($errors) $checkonly = false;
684 }
685 $add_html = $form->getHTML();
686 }
687
688
689 $mat_html = "";
690 if (count($this->object->getMaterial()))
691 {
692 include_once "./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyMaterialsTableGUI.php";
693 $table_gui = new ilSurveyMaterialsTableGUI($this, 'material', (($rbacsystem->checkAccess('write', $_GET['ref_id']) ? true : false)));
694 $data = array();
695 foreach ($this->object->getMaterial() as $material)
696 {
697 switch ($material->type)
698 {
699 case 0:
700 $href = SurveyQuestion::_getInternalLinkHref($material->internal_link, $_GET['ref_id']);
701 $type = $this->lng->txt('internal_link');
702 break;
703 }
704 $title = (strlen($material->title)) ? ilUtil::prepareFormOutput($material->title) : $this->lng->txt('material');
705 array_push($data, array('href' => $href, 'title' => $title, 'type' => $type));
706 }
707 $table_gui->setData($data);
708 $mat_html = $table_gui->getHTML();
709 }
710
711 if (!$checkonly) $this->tpl->setVariable("ADM_CONTENT", $add_html . $mat_html);
712 return $errors;
713 }
TableGUI class for survey question materials.
$errors

References $_GET, $data, $errors, $title, 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 459 of file class.SurveyQuestionGUI.php.

460 {
461 global $ilTabs;
462
463 $ilTabs->activateTab("edit_properties");
464
465 $this->ctrl->saveParameter($this, "rtrn");
466
467 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
468 $cgui = new ilConfirmationGUI();
469 $cgui->setHeaderText($this->lng->txt("confirm_sync_questions"));
470
471 $cgui->setFormAction($this->ctrl->getFormAction($this, "confirmRemoveQuestions"));
472 $cgui->setCancel($this->lng->txt("no"), "cancelSync");
473 $cgui->setConfirm($this->lng->txt("yes"), "sync");
474
475 $this->tpl->setContent($cgui->getHTML());
476 }
Confirmation screen class.

◆ outQuestionText()

SurveyQuestionGUI::outQuestionText (   $template)
protected

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

136 {
137 $questiontext = $this->object->getQuestiontext();
138 if (preg_match("/^<.[\\>]?>(.*?)<\\/.[\\>]*?>$/", $questiontext, $matches))
139 {
140 $questiontext = $matches[1];
141 }
142 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
143 if ($this->object->getObligatory($survey_id))
144 {
145 $template->setVariable("OBLIGATORY_TEXT", ' *');
146 }
147 }

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 583 of file class.SurveyQuestionGUI.php.

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

References $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 501 of file class.SurveyQuestionGUI.php.

502 {
503 // return?
504 if($a_return)
505 {
506 // to calling survey
507 if($this->parent_url)
508 {
509 $addurl = "";
510 if (strlen($_GET["new_for_survey"]))
511 {
512 $addurl = "&new_id=" . $_GET["q_id"];
513 }
514 ilUtil::redirect(str_replace("&amp;", "&", $this->parent_url) . $addurl);
515 }
516 // to pool
517 else
518 {
519 $this->ctrl->setParameterByClass("ilObjSurveyQuestionPoolGUI", "q_id_table_nav", $_SESSION['q_id_table_nav']);
520 $this->ctrl->redirectByClass("ilObjSurveyQuestionPoolGUI", "questions");
521 }
522 }
523 // stay in form
524 else
525 {
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");
530 }
531 }

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 778 of file class.SurveyQuestionGUI.php.

779 {
780 $this->object->material = array();
781 $this->object->saveToDb();
782 $this->editQuestion();
783 }
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 1118 of file class.SurveyQuestionGUI.php.

1119 {
1120 $html = array();
1121 $html[] = '<div class="ilTableOuter table-responsive">';
1122 $html[] = '<table class="table table-striped">';
1123
1124 $html[] = "<thead>";
1125 $html[] = "<tr>";
1126 foreach($a_head as $col)
1127 {
1128 $col = trim($col);
1129 $html[] = "<th>";
1130 $html[] = ($col != "") ? $col : "&nbsp;";
1131 $html[] = "</th>";
1132 }
1133 $html[] = "</tr>";
1134 $html[] = "</thead>";
1135
1136 $html[] = "<tbody>";
1137 foreach($a_rows as $row)
1138 {
1139 $html[] = "<tr>";
1140 foreach($row as $col)
1141 {
1142 $col = trim($col);
1143 $html[] = "<td>";
1144 $html[] = ($col != "") ? $col : "&nbsp;";
1145 $html[] = "</td>";
1146 }
1147 $html[] = "</tr>";
1148 }
1149 $html[] = "</tbody>";
1150
1151 if($a_foot)
1152 {
1153 $html[] = "<tfoot>";
1154 $html[] = "<tr>";
1155 foreach($a_foot as $col)
1156 {
1157 $col = trim($col);
1158 $html[] = "<td>";
1159 $html[] = ($col != "") ? $col : "&nbsp;";
1160 $html[] = "</td>";
1161 }
1162 $html[] = "</tr>";
1163 $html[] = "</tfoot>";
1164 }
1165
1166 $html[] = "</table>";
1167 $html[] = "</div>";
1168 return implode("\n", $html);
1169 }
$html
Definition: example_001.php:87

References $html, and $row.

◆ save()

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

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

352 {
353 global $ilUser;
354
355 if($this->saveForm())
356 {
357 // #13784
358 if ($a_return &&
359 !SurveyQuestion::_isComplete($this->object->getId()))
360 {
361 ilUtil::sendFailure($this->lng->txt("survey_error_insert_incomplete_question"));
362 return $this->editQuestion();
363 }
364
365 $ilUser->setPref("svy_lastquestiontype", $this->object->getQuestionType());
366 $ilUser->writePref("svy_lastquestiontype", $this->object->getQuestionType());
367
368 $originalexists = SurveyQuestion::_questionExists($this->object->original_id);
369 $this->ctrl->setParameter($this, "q_id", $this->object->getId());
370 include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
371
372 // pool question?
373 if($a_sync)
374 {
375 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
376 $this->ctrl->redirect($this, 'copySyncForm');
377 }
378 else
379 {
380 // form: update original pool question, too?
381 if ($originalexists &&
382 SurveyQuestion::_isWriteable($this->object->original_id, $ilUser->getId()))
383 {
384 if($a_return)
385 {
386 $this->ctrl->setParameter($this, 'rtrn', 1);
387 }
388 $this->ctrl->redirect($this, 'originalSyncForm');
389 }
390 }
391
392 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
393 $this->redirectAfterSaving($a_return);
394 }
395 }
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, SurveyQuestion\_isComplete(), SurveyQuestion\_isWriteable(), SurveyQuestion\_questionExists(), editQuestion(), redirectAfterSaving(), saveForm(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

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 323 of file class.SurveyQuestionGUI.php.

324 {
325 $form = $this->initEditForm();
326 if($form->checkInput())
327 {
328 if ($this->validateEditForm($form))
329 {
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"));
336
337 $this->importEditFormValues($form);
338
339 // will save both core and extended data
340 $this->object->saveToDb();
341
342 return true;
343 }
344 }
345
346 $form->setValuesByPost();
347 $this->editQuestion($form);
348 return false;
349 }
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 1033 of file class.SurveyQuestionGUI.php.

1034 {
1035 global $ilTabs, $ilToolbar;
1036
1037 $ilTabs->activateTab("edit_properties");
1038
1039 if (!$a_reload)
1040 {
1041 $result = $this->saveForm();
1042 if ($result)
1043 {
1044 $this->object->saveToDb();
1045 }
1046 }
1047
1048 include_once("./Services/Form/classes/class.ilTextInputGUI.php");
1049 $txt = new ilTextInputGUI($this->lng->txt("enter_phrase_title"), "phrase_title");
1050 $ilToolbar->addInputItem($txt, true);
1051 $ilToolbar->addFormButton($this->lng->txt("confirm"), "confirmSavePhrase");
1052 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
1053
1054 include_once "./Modules/SurveyQuestionPool/classes/tables/class.ilSurveySavePhraseTableGUI.php";
1055 $table_gui = new ilSurveySavePhraseTableGUI($this, 'editQuestion');
1056 $table_gui->setDescription($this->lng->txt("save_phrase_introduction"));
1057
1058 // matrix?
1059 if(method_exists($this->object, "getCategories"))
1060 {
1061 $categories = $this->object->getCategories();
1062 }
1063 else
1064 {
1065 $categories = $this->object->getColumns();
1066 }
1067
1068 $data = array();
1069 for ($i = 0; $i < $categories->getCategoryCount(); $i++)
1070 {
1071 $cat = $categories->getCategory($i);
1072
1073 $data[] = array(
1074 "answer" => $cat->title,
1075 "other" => $cat->other,
1076 "scale" => $cat->scale,
1077 "neutral" => $cat->neutral
1078 );
1079 }
1080 $table_gui->setData($data);
1081 $_SESSION['save_phrase_data'] = $data; // :TODO: see savePhrase()
1082
1083 $this->tpl->setContent($table_gui->getHTML());
1084 }
$txt
Definition: error.php:12

References $_SESSION, $data, $result, $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 318 of file class.SurveyQuestionGUI.php.

319 {
320 $this->save(true);
321 }
save($a_return=false, $a_sync=false)

References save().

+ Here is the call graph for this function:

◆ saveSync()

SurveyQuestionGUI::saveSync ( )
protected

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

314 {
315 $this->save($_REQUEST["rtrn"], true);
316 }

References save().

+ Here is the call graph for this function:

◆ setBackUrl()

SurveyQuestionGUI::setBackUrl (   $a_url)

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

150 {
151 $this->parent_url = $a_url;
152 }

◆ setQuestionTabs()

◆ setQuestionTabsForClass()

SurveyQuestionGUI::setQuestionTabsForClass (   $guiclass)

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

155 {
156 global $rbacsystem,$ilTabs;
157
158 $this->ctrl->setParameterByClass($guiclass, "sel_question_types", $this->getQuestionType());
159 $this->ctrl->setParameterByClass($guiclass, "q_id", $_GET["q_id"]);
160
161 if ($this->parent_url)
162 {
163 $addurl = "";
164 if (strlen($_GET["new_for_survey"]))
165 {
166 $addurl = "&new_id=" . $_GET["q_id"];
167 }
168 $ilTabs->setBackTarget($this->lng->txt("menubacktosurvey"), $this->parent_url . $addurl);
169 }
170 else
171 {
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"));
174 }
175 if ($_GET["q_id"])
176 {
177 $ilTabs->addNonTabbedLink("preview",
178 $this->lng->txt("preview"),
179 $this->ctrl->getLinkTargetByClass($guiclass, "preview"));
180 }
181
182 if ($rbacsystem->checkAccess('edit', $_GET["ref_id"]))
183 {
184 $ilTabs->addTab("edit_properties",
185 $this->lng->txt("properties"),
186 $this->ctrl->getLinkTargetByClass($guiclass, "editQuestion"));
187
188 if(stristr($guiclass, "matrix"))
189 {
190 $ilTabs->addTab("layout",
191 $this->lng->txt("layout"),
192 $this->ctrl->getLinkTargetByClass($guiclass, "layout"));
193 }
194 }
195 if ($_GET["q_id"])
196 {
197 $ilTabs->addTab("material",
198 $this->lng->txt("material"),
199 $this->ctrl->getLinkTargetByClass($guiclass, "material"));
200 }
201
202 if ($this->object->getId() > 0)
203 {
204 $title = $this->lng->txt("edit") . " &quot;" . $this->object->getTitle() . "&quot";
205 }
206 else
207 {
208 $title = $this->lng->txt("create_new") . " " . $this->lng->txt($this->getQuestionType());
209 }
210
211 $this->tpl->setVariable("HEADER", $title);
212 }
getQuestionType()
Returns the question type string.

References $_GET, $_SESSION, $title, 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 478 of file class.SurveyQuestionGUI.php.

479 {
480 $original_id = $this->object->original_id;
481 if ($original_id)
482 {
483 $this->object->syncWithOriginal();
484 }
485
486 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
487 $this->redirectAfterSaving($_REQUEST["rtrn"]);
488 }

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

+ Here is the call graph for this function:

◆ syncCopies()

SurveyQuestionGUI::syncCopies ( )
protected

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

410 {
411 global $lng, $ilAccess;
412
413 if(!sizeof($_POST["qid"]))
414 {
415 ilUtil::sendFailure($lng->txt("select_one"));
416 return $this->copySyncForm();
417 }
418
419 foreach($this->object->getCopyIds(true) as $survey_id => $questions)
420 {
421 // check permissions for "parent" survey
422 $can_write = false;
423 $ref_ids = ilObject::_getAllReferences($survey_id);
424 foreach($ref_ids as $ref_id)
425 {
426 if($ilAccess->checkAccess("edit", "", $ref_id))
427 {
428 $can_write = true;
429 break;
430 }
431 }
432
433 if($can_write)
434 {
435 foreach($questions as $qid)
436 {
437 if(in_array($qid, $_POST["qid"]))
438 {
439 $id = $this->object->getId();
440
441 $this->object->setId($qid);
442 $this->object->setOriginalId($id);
443 $this->object->saveToDb();
444
445 $this->object->setId($id);
446 $this->object->setOriginalId(null);
447
448 // see: SurveyQuestion::syncWithOriginal()
449 // what about material?
450 }
451 }
452 }
453 }
454
455 ilUtil::sendSuccess($lng->txt("survey_sync_success"), true);
456 $this->redirectAfterSaving($_REQUEST["rtrn"]);
457 }
static _getAllReferences($a_id)
get all reference ids of object
$ref_id
Definition: sahs_server.php:39

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

+ Here is the call graph for this function:

◆ validateEditForm()

SurveyQuestionGUI::validateEditForm ( ilPropertyFormGUI  $a_form)
protected

Reimplemented in SurveyMultipleChoiceQuestionGUI.

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

546 {
547 return true;
548 }

Referenced by saveForm().

+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

SurveyQuestionGUI::$ctrl
protected

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

◆ $cumulated

SurveyQuestionGUI::$cumulated
protected

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

◆ $lng

SurveyQuestionGUI::$lng
protected

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

Referenced by __construct(), and syncCopies().

◆ $log

SurveyQuestionGUI::$log
protected

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

◆ $object

SurveyQuestionGUI::$object

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

◆ $parent_url

SurveyQuestionGUI::$parent_url
protected

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

◆ $tpl

SurveyQuestionGUI::$tpl
protected

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

Referenced by __construct(), and preview().


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