ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
global $DIC
Definition: saml.php:7

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

156 {
157 return $q_type;
158 }

Referenced by _getGUIClassNameForId().

+ Here is the caller graph for this function:

◆ _getGUIClassNameForId()

static SurveyQuestionGUI::_getGUIClassNameForId (   $a_q_id)
static

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

147 {
148 include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
149 include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
150 $q_type = SurveyQuestion::_getQuestiontype($a_q_id);
151 $class_name = SurveyQuestionGUI::_getClassNameForQType($q_type);
152 return $class_name;
153 }
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 include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
137 if ((!$questiontype) and ($question_id > 0)) {
138 $questiontype = SurveyQuestion::_getQuestiontype($question_id);
139 }
140 SurveyQuestion::_includeClass($questiontype, 1);
141 $question_type_gui = $questiontype . "GUI";
142 $question = new $question_type_gui($question_id);
143 return $question;
144 }
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 317 of file class.SurveyQuestionGUI.php.

318 {
319 $a_form->addCommandButton("saveReturn", $this->lng->txt("save_return"));
320 $a_form->addCommandButton("save", $this->lng->txt("save"));
321
322 // pool question?
323 if (ilObject::_lookupType($this->object->getObjId()) == "spl") {
324 if ($this->object->hasCopies()) {
325 $a_form->addCommandButton("saveSync", $this->lng->txt("svy_save_sync"));
326 }
327 }
328 }
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 808 of file class.SurveyQuestionGUI.php.

809 {
810 $this->object->addInternalLink("il__git_" . $_GET["git"]);
811 unset($_SESSION["link_new_type"]);
812 unset($_SESSION["search_link_type"]);
813 ilUtil::sendSuccess($this->lng->txt("material_added_successfully"), true);
814 $this->ctrl->redirect($this, "material");
815 }
$_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 729 of file class.SurveyQuestionGUI.php.

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

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

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

951 {
952 $ilTabs = $this->tabs;
953
954 $ilTabs->activateTab("edit_properties");
955
956 if (!$a_form) {
957 $result = $this->saveForm();
958 if ($result) {
959 $this->object->saveToDb();
960 }
961
962 $a_form = $this->initPhrasesForm();
963 }
964
965 $this->tpl->setContent($a_form->getHTML());
966 }
$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 968 of file class.SurveyQuestionGUI.php.

969 {
970 $form = $this->initPhrasesForm();
971 if ($form->checkInput()) {
972 $phrase_id = $form->getInput("phrases");
973
974 $valid = true;
975 if (strcmp($this->object->getPhrase($phrase_id), "dp_standard_numbers") != 0) {
976 $this->object->addPhrase($phrase_id);
977 } else {
978 $min = $form->getInput("lower_limit");
979 $max = $form->getInput("upper_limit");
980
981 if ($max <= $min) {
982 $max_field = $form->getItemByPostVar("upper_limit");
983 $max_field->setAlert($this->lng->txt("upper_limit_must_be_greater"));
984 $valid = false;
985 } else {
986 $this->object->addStandardNumbers($min, $max);
987 }
988 }
989
990 if ($valid) {
991 $this->object->saveToDb();
992
993 ilUtil::sendSuccess($this->lng->txt('phrase_added'), true);
994 $this->ctrl->redirect($this, 'editQuestion');
995 }
996 }
997
998 $form->setValuesByPost();
999 $this->addPhrase($form);
1000 }
addPhrase(ilPropertyFormGUI $a_form=null)
Creates an output for the addition of phrases.
$valid
if(isset($_POST['submit'])) $form

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

+ Here is the call graph for this function:

◆ addST()

SurveyQuestionGUI::addST ( )

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

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

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

+ Here is the call graph for this function:

◆ cancel()

SurveyQuestionGUI::cancel ( )
protected

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

542 {
543 if ($this->parent_url) {
544 ilUtil::redirect($this->parent_url);
545 } else {
546 $this->ctrl->redirectByClass("ilobjsurveyquestionpoolgui", "questions");
547 }
548 }
static redirect($a_script)

References ilUtil\redirect().

+ Here is the call graph for this function:

◆ cancelExplorer()

SurveyQuestionGUI::cancelExplorer ( )

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

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

504 {
505 ilUtil::sendInfo($this->lng->txt("question_changed_in_survey_only"), true);
506 $this->redirectAfterSaving($_REQUEST["rtrn"]);
507 }
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 1060 of file class.SurveyQuestionGUI.php.

1061 {
1062 $title = $_POST["phrase_title"];
1063
1064 $valid = true;
1065 if (!trim($title)) {
1066 ilUtil::sendFailure($this->lng->txt("qpl_savephrase_empty"));
1067 $valid = false;
1068 } elseif ($this->object->phraseExists($title)) {
1069 ilUtil::sendFailure($this->lng->txt("qpl_savephrase_exists"));
1070 $valid = false;
1071 }
1072
1073 if ($valid) {
1074 $this->object->savePhrase($title);
1075
1076 ilUtil::sendSuccess($this->lng->txt("phrase_saved"), true);
1077 $this->ctrl->redirect($this, "editQuestion");
1078 }
1079
1080 $this->savePhrase(true);
1081 }
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 417 of file class.SurveyQuestionGUI.php.

418 {
419 $ilTabs = $this->tabs;
420
421 $ilTabs->activateTab("edit_properties");
422
423 include_once "Modules/SurveyQuestionPool/classes/class.ilSurveySyncTableGUI.php";
424 $tbl = new ilSurveySyncTableGUI($this, "copySyncForm", $this->object);
425
426 $this->tpl->setContent($tbl->getHTML());
427 }
Survey sync table GUI class.
$tbl
Definition: example_048.php:81

References $tabs, and $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 $this->object->deleteMaterials($_POST['idx']);
719 ilUtil::sendSuccess($this->lng->txt('materials_deleted'), true);
720 } else {
721 ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
722 }
723 $this->ctrl->redirect($this, 'material');
724 }

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

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

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

621 {
622 if (count($this->object->getMaterial())) {
623 $template = new ilTemplate("tpl.il_svy_qpl_material.html", true, true, "Modules/SurveyQuestionPool");
624 foreach ($this->object->getMaterial() as $material) {
625 $template->setCurrentBlock('material');
626 switch ($material->type) {
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
$template

References $_GET, $template, 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 560 of file class.SurveyQuestionGUI.php.

561 {
562 switch ($question_title) {
564 $title = ilUtil::prepareFormOutput($this->object->getTitle());
565 break;
566
567 #19448 get rid of showing only the label without title
568 //case 2:
569 // $title = ilUtil::prepareFormOutput($this->object->getLabel());
570 // break;
571
573 $title = ilUtil::prepareFormOutput($this->object->getTitle());
574 if (trim($this->object->getLabel())) {
575 $title .= ' <span class="questionLabel">(' . ilUtil::prepareFormOutput($this->object->getLabel()) . ')</span>';
576 }
577 break;
578 }
579 return $title;
580 }

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

167 {
168 return $this->object->getQuestionType();
169 }

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

252 {
253 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
254 $form = new ilPropertyFormGUI();
255 $form->setFormAction($this->ctrl->getFormAction($this, "save"));
256 $form->setTitle($this->lng->txt($this->getQuestionType()));
257 $form->setMultipart(false);
258 $form->setTableWidth("100%");
259 // $form->setId("essay");
260
261 // title
262 $title = new ilTextInputGUI($this->lng->txt("title"), "title");
263 $title->setRequired(true);
264 $form->addItem($title);
265
266 // label
267 $label = new ilTextInputGUI($this->lng->txt("label"), "label");
268 $label->setInfo($this->lng->txt("label_info"));
269 $label->setRequired(false);
270 $form->addItem($label);
271
272 // author
273 $author = new ilTextInputGUI($this->lng->txt("author"), "author");
274 $author->setRequired(true);
275 $form->addItem($author);
276
277 // description
278 $description = new ilTextInputGUI($this->lng->txt("description"), "description");
279 $description->setRequired(false);
280 $form->addItem($description);
281
282 // questiontext
283 $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
284 $question->setRequired(true);
285 $question->setRows(10);
286 $question->setCols(80);
287 $question->setUseRte(true);
288 include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
289 $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
290 $question->addPlugin("latex");
291 $question->addButton("latex");
292 $question->addButton("pastelatex");
293 $question->setRTESupport($this->object->getId(), "spl", "survey");
294 $form->addItem($question);
295
296 // obligatory
297 $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory");
298 $shuffle->setValue(1);
299 $shuffle->setRequired(false);
300 $form->addItem($shuffle);
301
303
304 $this->addCommandButtons($form);
305
306 // values
307 $title->setValue($this->object->getTitle());
308 $label->setValue($this->object->label);
309 $author->setValue($this->object->getAuthor());
310 $description->setValue($this->object->getDescription());
311 $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext()));
312 $shuffle->setChecked($this->object->getObligatory());
313
314 return $form;
315 }
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 $description, $form, $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 908 of file class.SurveyQuestionGUI.php.

909 {
910 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
911 $form = new ilPropertyFormGUI();
912 $form->setFormAction($this->ctrl->getFormAction($this, "addSelectedPhrase"));
913 $form->setTitle($this->lng->txt("add_phrase"));
914 // $form->setDescription($this->lng->txt("add_phrase_introduction"));
915
916 $group = new ilRadioGroupInputGUI($this->lng->txt("phrase"), "phrases");
917 $group->setRequired(true);
918 $form->addItem($group);
919
920 include_once "./Modules/SurveyQuestionPool/classes/class.ilSurveyPhrases.php";
921 foreach (ilSurveyPhrases::_getAvailablePhrases() as $phrase_id => $phrase_array) {
922 $categories = ilSurveyPhrases::_getCategoriesForPhrase($phrase_id);
923
924 $opt = new ilRadioOption($phrase_array["title"], $phrase_id);
925 $opt->setInfo(join($categories, ","));
926 $group->addOption($opt);
927
928 if ($phrase_array["org_title"] == "dp_standard_numbers") {
929 $min = new ilNumberInputGUI($this->lng->txt("lower_limit"), "lower_limit");
930 $min->setRequired(true);
931 $min->setSize(5);
932 $opt->addSubItem($min);
933
934 $max = new ilNumberInputGUI($this->lng->txt("upper_limit"), "upper_limit");
935 $max->setRequired(true);
936 $max->setSize(5);
937 $opt->addSubItem($max);
938 }
939 }
940
941 $form->addCommandButton("addSelectedPhrase", $this->lng->txt("add_phrase"));
942 $form->addCommandButton("editQuestion", $this->lng->txt("cancel"));
943
944 return $form;
945 }
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 $form, 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 817 of file class.SurveyQuestionGUI.php.

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

References $_GET, $_SESSION, $tabs, $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 {
652 $ilTabs = $this->tabs;
653
654 $ilTabs->activateTab("material");
655
656 $add_html = '';
657 if ($rbacsystem->checkAccess('write', $_GET['ref_id'])) {
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 $form->setValuesByPost();
681 $errors = !$form->checkInput();
682 if ($errors) {
683 $checkonly = false;
684 }
685 }
686 $add_html = $form->getHTML();
687 }
688
689
690 $mat_html = "";
691 if (count($this->object->getMaterial())) {
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 switch ($material->type) {
697 case 0:
698 $href = SurveyQuestion::_getInternalLinkHref($material->internal_link, $_GET['ref_id']);
699 $type = $this->lng->txt('internal_link');
700 break;
701 }
702 $title = (strlen($material->title)) ? ilUtil::prepareFormOutput($material->title) : $this->lng->txt('material');
703 array_push($data, array('href' => $href, 'title' => $title, 'type' => $type));
704 }
705 $table_gui->setData($data);
706 $mat_html = $table_gui->getHTML();
707 }
708
709 if (!$checkonly) {
710 $this->tpl->setVariable("ADM_CONTENT", $add_html . $mat_html);
711 }
712 return $errors;
713 }
TableGUI class for survey question materials.
$errors
Definition: index.php:6
$type

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

474 {
475 $ilTabs = $this->tabs;
476
477 $ilTabs->activateTab("edit_properties");
478
479 $this->ctrl->saveParameter($this, "rtrn");
480
481 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
482 $cgui = new ilConfirmationGUI();
483 $cgui->setHeaderText($this->lng->txt("confirm_sync_questions"));
484
485 $cgui->setFormAction($this->ctrl->getFormAction($this, "confirmRemoveQuestions"));
486 $cgui->setCancel($this->lng->txt("no"), "cancelSync");
487 $cgui->setConfirm($this->lng->txt("yes"), "sync");
488
489 $this->tpl->setContent($cgui->getHTML());
490 }
Confirmation screen class.

References $tabs.

◆ outQuestionText()

SurveyQuestionGUI::outQuestionText (   $template)
protected

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

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

References $template.

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

588 {
589 $ilTabs = $this->tabs;
590
591 $ilTabs->activateTab("preview");
592
593 $tpl = new ilTemplate("tpl.il_svy_qpl_preview.html", true, true, "Modules/SurveyQuestionPool");
594
595 if ($this->object->getObligatory()) {
596 $tpl->setCurrentBlock("required");
597 $tpl->setVariable("TEXT_REQUIRED", $this->lng->txt("required_field"));
598 $tpl->parseCurrentBlock();
599 }
600
601 $tpl->setVariable("QUESTION_OUTPUT", $this->getWorkingForm());
602
603 include_once "Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
604 $panel = ilPanelGUI::getInstance();
605 $panel->setBody($tpl->get());
606
607 $this->tpl->setContent($panel->getHTML());
608 }
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 514 of file class.SurveyQuestionGUI.php.

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

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

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

1084 {
1085 $html = array();
1086 $html[] = '<div class="ilTableOuter table-responsive">';
1087 $html[] = '<table class="table table-striped">';
1088
1089 $html[] = "<thead>";
1090 $html[] = "<tr>";
1091 foreach ($a_head as $col) {
1092 $col = trim($col);
1093 $html[] = "<th>";
1094 $html[] = ($col != "") ? $col : "&nbsp;";
1095 $html[] = "</th>";
1096 }
1097 $html[] = "</tr>";
1098 $html[] = "</thead>";
1099
1100 $html[] = "<tbody>";
1101 foreach ($a_rows as $row) {
1102 $html[] = "<tr>";
1103 foreach ($row as $col) {
1104 $col = trim($col);
1105 $html[] = "<td>";
1106 $html[] = ($col != "") ? $col : "&nbsp;";
1107 $html[] = "</td>";
1108 }
1109 $html[] = "</tr>";
1110 }
1111 $html[] = "</tbody>";
1112
1113 if ($a_foot) {
1114 $html[] = "<tfoot>";
1115 $html[] = "<tr>";
1116 foreach ($a_foot as $col) {
1117 $col = trim($col);
1118 $html[] = "<td>";
1119 $html[] = ($col != "") ? $col : "&nbsp;";
1120 $html[] = "</td>";
1121 }
1122 $html[] = "</tr>";
1123 $html[] = "</tfoot>";
1124 }
1125
1126 $html[] = "</table>";
1127 $html[] = "</div>";
1128 return implode("\n", $html);
1129 }
$html
Definition: example_001.php:87

References $html, and $row.

◆ save()

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

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

379 {
381
382 if ($this->saveForm()) {
383 // #13784
384 if ($a_return &&
385 !SurveyQuestion::_isComplete($this->object->getId())) {
386 ilUtil::sendFailure($this->lng->txt("survey_error_insert_incomplete_question"));
387 return $this->editQuestion();
388 }
389
390 $ilUser->setPref("svy_lastquestiontype", $this->object->getQuestionType());
391 $ilUser->writePref("svy_lastquestiontype", $this->object->getQuestionType());
392
393 $originalexists = SurveyQuestion::_questionExists($this->object->original_id);
394 $this->ctrl->setParameter($this, "q_id", $this->object->getId());
395 include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
396
397 // pool question?
398 if ($a_sync) {
399 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
400 $this->ctrl->redirect($this, 'copySyncForm');
401 } else {
402 // form: update original pool question, too?
403 if ($originalexists &&
404 SurveyQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) {
405 if ($a_return) {
406 $this->ctrl->setParameter($this, 'rtrn', 1);
407 }
408 $this->ctrl->redirect($this, 'originalSyncForm');
409 }
410 }
411
412 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
413 $this->redirectAfterSaving($a_return);
414 }
415 }
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(), 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 352 of file class.SurveyQuestionGUI.php.

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

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

1008 {
1009 $ilTabs = $this->tabs;
1010 $ilToolbar = $this->toolbar;
1011
1012 $ilTabs->activateTab("edit_properties");
1013
1014 if (!$a_reload) {
1015 $result = $this->saveForm();
1016 if ($result) {
1017 $this->object->saveToDb();
1018 }
1019 }
1020
1021 include_once("./Services/Form/classes/class.ilTextInputGUI.php");
1022 $txt = new ilTextInputGUI($this->lng->txt("enter_phrase_title"), "phrase_title");
1023 $ilToolbar->addInputItem($txt, true);
1024 $ilToolbar->addFormButton($this->lng->txt("confirm"), "confirmSavePhrase");
1025 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
1026
1027 include_once "./Modules/SurveyQuestionPool/classes/tables/class.ilSurveySavePhraseTableGUI.php";
1028 $table_gui = new ilSurveySavePhraseTableGUI($this, 'editQuestion');
1029 $table_gui->setDescription($this->lng->txt("save_phrase_introduction"));
1030
1031 // matrix?
1032 if (method_exists($this->object, "getCategories")) {
1033 $categories = $this->object->getCategories();
1034 } else {
1035 $categories = $this->object->getColumns();
1036 }
1037
1038 $data = array();
1039 for ($i = 0; $i < $categories->getCategoryCount(); $i++) {
1040 $cat = $categories->getCategory($i);
1041
1042 $data[] = array(
1043 "answer" => $cat->title,
1044 "other" => $cat->other,
1045 "scale" => $cat->scale,
1046 "neutral" => $cat->neutral
1047 );
1048 }
1049 $table_gui->setData($data);
1050 $_SESSION['save_phrase_data'] = $data; // :TODO: see savePhrase()
1051
1052 $this->tpl->setContent($table_gui->getHTML());
1053 }
$i
Definition: disco.tpl.php:19
$txt
Definition: error.php:11

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

348 {
349 $this->save(true);
350 }
save($a_return=false, $a_sync=false)

References save().

+ Here is the call graph for this function:

◆ saveSync()

SurveyQuestionGUI::saveSync ( )
protected

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

343 {
344 $this->save($_REQUEST["rtrn"], true);
345 }

References save().

+ Here is the call graph for this function:

◆ setBackUrl()

SurveyQuestionGUI::setBackUrl (   $a_url)

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

184 {
185 $this->parent_url = $a_url;
186 }

◆ setQuestionTabs()

◆ setQuestionTabsForClass()

SurveyQuestionGUI::setQuestionTabsForClass (   $guiclass)

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

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

References $_GET, $_SESSION, $rbacsystem, $tabs, $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 492 of file class.SurveyQuestionGUI.php.

493 {
494 $original_id = $this->object->original_id;
495 if ($original_id) {
496 $this->object->syncWithOriginal();
497 }
498
499 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
500 $this->redirectAfterSaving($_REQUEST["rtrn"]);
501 }

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

+ Here is the call graph for this function:

◆ syncCopies()

SurveyQuestionGUI::syncCopies ( )
protected

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

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

References $_POST, $access, $id, $lng, 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 550 of file class.SurveyQuestionGUI.php.

551 {
552 return true;
553 }

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: