ILIAS  release_8 Revision v8.24
SurveyQuestionGUI Class Reference

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. 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 (string $a_url)
 
 setQuestionTabsForClass (string $guiclass)
 
 getPrintView (int $question_title=1, bool $show_questiontext=true, ?int $survey_id=null, ?array $working_data=null)
 
 preview ()
 
 getWorkingForm (array $working_data=null, int $question_title=1, bool $show_questiontext=true, string $error_message="", int $survey_id=null, bool $compress_view=false)
 
 material (bool $checkonly=false)
 Material tab of the survey questions. More...
 
 deleteMaterial ()
 
 addMaterial ()
 Add materials to a question. More...
 
 removeMaterial ()
 
 cancelExplorer ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 linkChilds ()
 
 savePhrase (bool $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 (?string $questiontype, int $question_id=-1)
 Creates a question gui representation. More...
 
static _getGUIClassNameForId (int $a_q_id)
 
static _getClassNameForQType (string $q_type)
 

Data Fields

SurveyQuestion $object = null
 

Protected Member Functions

 initObject ()
 
 outQuestionText (ilTemplate $template)
 
 initEditForm ()
 
 addCommandButtons (ilPropertyFormGUI $a_form)
 
 editQuestion (ilPropertyFormGUI $a_form=null)
 
 saveSync ()
 
 saveReturn ()
 
 saveForm ()
 
 save (bool $a_return=false, bool $a_sync=false)
 
 copySyncForm ()
 
 syncCopies ()
 
 originalSyncForm ()
 
 sync ()
 
 cancelSync ()
 
 redirectAfterSaving (bool $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 (int $question_title=1)
 
 getQuestionTitle (int $question_title_mode=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

EditingGUIRequest $request
 
EditManager $edit_manager
 
ilRbacSystem $rbacsystem
 
ilObjUser $user
 
ilAccessHandler $access
 
ilTree $tree
 
ilToolbarGUI $toolbar
 
ilTabsGUI $tabs
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilCtrl $ctrl
 
array $cumulated = []
 
string $parent_url = ""
 
ilLogger $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

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

Constructor & Destructor Documentation

◆ __construct()

SurveyQuestionGUI::__construct (   $a_id = -1)

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

47 {
48 global $DIC;
49
50 $this->rbacsystem = $DIC->rbac()->system();
51 $this->user = $DIC->user();
52 $this->access = $DIC->access();
53 $this->tree = $DIC->repositoryTree();
54 $this->toolbar = $DIC->toolbar();
55 $lng = $DIC->language();
56 $tpl = $DIC["tpl"];
57 $ilCtrl = $DIC->ctrl();
58
59
60 $this->request = $DIC->surveyQuestionPool()
61 ->internal()
62 ->gui()
63 ->editing()
64 ->request();
65
66 $this->lng = $lng;
67 $this->tpl = $tpl;
68 $this->ctrl = $ilCtrl;
69 $this->ctrl->saveParameter($this, "q_id");
70 $this->ctrl->setParameterByClass(
71 $this->ctrl->getCmdClass(),
72 "sel_question_types",
73 $this->request->getSelectedQuestionTypes()
74 );
75 $this->cumulated = array();
76 $this->tabs = $DIC->tabs();
77
78 $this->initObject();
79
80 if ($a_id > 0) {
81 $this->object->loadFromDb($a_id);
82 }
83 $this->log = ilLoggerFactory::getLogger('svy');
84
85 $this->edit_manager = $DIC->surveyQuestionPool()
86 ->internal()
87 ->domain()
88 ->editing();
89 }
ilGlobalTemplateInterface $tpl
static getLogger(string $a_component_id)
Get component logger.
global $DIC
Definition: feed.php:28

References $DIC, $lng, $tpl, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilLoggerFactory\getLogger(), initObject(), ILIAS\Repository\lng(), ILIAS\Repository\tabs(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _getClassNameForQType()

static SurveyQuestionGUI::_getClassNameForQType ( string  $q_type)
static

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

131 : string
132 {
133 return $q_type;
134 }

Referenced by _getGUIClassNameForId().

+ Here is the caller graph for this function:

◆ _getGUIClassNameForId()

static SurveyQuestionGUI::_getGUIClassNameForId ( int  $a_q_id)
static

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

124 : string
125 {
126 $q_type = SurveyQuestion::_getQuestionType($a_q_id);
127 $class_name = SurveyQuestionGUI::_getClassNameForQType($q_type);
128 return $class_name;
129 }
static _getClassNameForQType(string $q_type)
static _getQuestionType(int $question_id)
Returns the question type of a question with a given id.

References _getClassNameForQType(), and SurveyQuestion\_getQuestionType().

Referenced by ilSurveyQuestionsTableGUI\fillRow().

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

◆ _getQuestionGUI()

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

Creates a question gui representation.

Todo:
move to factory

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

115 if ((!$questiontype) and ($question_id > 0)) {
116 $questiontype = SurveyQuestion::_getQuestionType($question_id);
117 }
118 SurveyQuestion::_includeClass($questiontype, 1);
119 $question_type_gui = $questiontype . "GUI";
120 $question = new $question_type_gui($question_id);
121 return $question;
122 }
Basic class for all survey question types The SurveyQuestionGUI class defines and encapsulates basic ...
static _includeClass(string $question_type, int $gui=0)
Include the php class file for a given question type.

References SurveyQuestion\_getQuestionType().

Referenced by ilObjSurveyQuestionPoolGUI\createQuestionObject(), ilSurveyEditorGUI\executeCommand(), ilObjSurveyQuestionPoolGUI\executeCommand(), and ilObjSurveyQuestionPoolGUI\previewObject().

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

◆ addCommandButtons()

SurveyQuestionGUI::addCommandButtons ( ilPropertyFormGUI  $a_form)
protected

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

297 : void
298 {
299 $a_form->addCommandButton("saveReturn", $this->lng->txt("save_return"));
300 $a_form->addCommandButton("save", $this->lng->txt("save"));
301
302 // pool question?
303 if (ilObject::_lookupType($this->object->getObjId()) === "spl" && $this->object->hasCopies()) {
304 $a_form->addCommandButton("saveSync", $this->lng->txt("svy_save_sync"));
305 }
306 }
static _lookupType(int $id, bool $reference=false)
addCommandButton(string $a_cmd, string $a_text, string $a_id="")

References ilObject\_lookupType(), ilPropertyFormGUI\addCommandButton(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ addFieldsToEditForm()

SurveyQuestionGUI::addFieldsToEditForm ( ilPropertyFormGUI  $a_form)
abstractprotected

◆ addGIT()

SurveyQuestionGUI::addGIT ( )

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

837 : void
838 {
839 $this->object->addInternalLink("il__git_" . $this->request->getLinkItemId("git"));
840 $this->edit_manager->clearNewLinkType();
841 $this->edit_manager->clearSearchLinkType();
842 $this->tpl->setOnScreenMessage('success', $this->lng->txt("material_added_successfully"), true);
843 $this->ctrl->redirect($this, "material");
844 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ addMaterial()

SurveyQuestionGUI::addMaterial ( )

Add materials to a question.

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

757 : void
758 {
759 $ilTabs = $this->tabs;
760 $ilToolbar = $this->toolbar;
761
762 $ilTabs->activateTab("material");
763
764 $ilToolbar->addButton(
765 $this->lng->txt("cancel"),
766 $this->ctrl->getLinkTarget($this, "material")
767 );
768
769 if ($this->edit_manager->getNewLinkType() !== "" || !$this->material(true)) {
770 switch ($this->request->getNewLinkType()) {
771 case "lm":
772 $this->edit_manager->setNewLinkType("lm");
773 $this->edit_manager->setSearchLinkType("lm");
774 break;
775 case "glo":
776 $this->edit_manager->setNewLinkType("glo");
777 $this->edit_manager->setSearchLinkType("glo");
778 break;
779 case "st":
780 $this->edit_manager->setNewLinkType("lm");
781 $this->edit_manager->setSearchLinkType("st");
782 break;
783 case "pg":
784 $this->edit_manager->setNewLinkType("lm");
785 $this->edit_manager->setSearchLinkType("pg");
786 break;
787 }
788
789 $exp = new ilMaterialExplorer(
790 $this,
791 'addMaterial',
792 $this->edit_manager->getNewLinkType()
793 );
794 $exp->setPathOpen($this->request->getRefId());
795 if (!$exp->handleCommand()) {
797 $panel->setHeading($this->lng->txt("select_object_to_link"));
798 $panel->setBody($exp->getHTML());
799
800 $this->tpl->setContent($panel->getHTML());
801 }
802 }
803 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance()
addButton(string $a_txt, string $a_cmd, string $a_target="", ?int $a_acc_key=null, string $a_additional_attrs='', string $a_id="", string $a_class='submit')
if(isset($_FILES['img_file']) &&is_array($_FILES['img_file'])) $panel
Definition: imgupload.php:198

References $panel, ilPanelGUI\getInstance(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ addPG()

SurveyQuestionGUI::addPG ( )

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

819 : void
820 {
821 $this->object->addInternalLink("il__pg_" . $this->request->getLinkItemId("pg"));
822 $this->edit_manager->clearNewLinkType();
823 $this->edit_manager->clearSearchLinkType();
824 $this->tpl->setOnScreenMessage('success', $this->lng->txt("material_added_successfully"), true);
825 $this->ctrl->redirect($this, "material");
826 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

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

970 : void
971 {
972 $ilTabs = $this->tabs;
973
974 $ilTabs->activateTab("edit_properties");
975
976 if (!$a_form) {
977 $result = $this->saveForm();
978 if ($result) {
979 $this->object->saveToDb();
980 }
981
982 $a_form = $this->initPhrasesForm();
983 }
984
985 $this->tpl->setContent($a_form->getHTML());
986 }
activateTab(string $a_id)

References ilPropertyFormGUI\getHTML().

+ Here is the call graph for this function:

◆ addSelectedPhrase()

SurveyQuestionGUI::addSelectedPhrase ( )
protected

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

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

References $valid, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ addST()

SurveyQuestionGUI::addST ( )

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

828 : void
829 {
830 $this->object->addInternalLink("il__st_" . $this->request->getLinkItemId("st"));
831 $this->edit_manager->clearNewLinkType();
832 $this->edit_manager->clearSearchLinkType();
833 $this->tpl->setOnScreenMessage('success', $this->lng->txt("material_added_successfully"), true);
834 $this->ctrl->redirect($this, "material");
835 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ cancel()

SurveyQuestionGUI::cancel ( )
protected

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

527 : void
528 {
529 if ($this->parent_url) {
530 ilUtil::redirect($this->parent_url);
531 } else {
532 $this->ctrl->redirectByClass("ilobjsurveyquestionpoolgui", "questions");
533 }
534 }
static redirect(string $a_script)

References ILIAS\Repository\ctrl(), and ilUtil\redirect().

+ Here is the call graph for this function:

◆ cancelExplorer()

SurveyQuestionGUI::cancelExplorer ( )

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

812 : void
813 {
814 $this->edit_manager->clearNewLinkType();
815 $this->tpl->setOnScreenMessage('info', $this->lng->txt("msg_cancel"), true);
816 $this->ctrl->redirect($this, 'material');
817 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ cancelSync()

SurveyQuestionGUI::cancelSync ( )
protected

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

479 : void
480 {
481 $this->tpl->setOnScreenMessage('info', $this->lng->txt("question_changed_in_survey_only"), true);
482 $this->redirectAfterSaving($this->request->getReturn());
483 }
redirectAfterSaving(bool $a_return=false)
Redirect to calling survey or to edit form.

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ confirmSavePhrase()

SurveyQuestionGUI::confirmSavePhrase ( )

Save a new phrase to the database.

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

1075 : void
1076 {
1077 $title = $this->request->getPhraseTitle();
1078
1079 $valid = true;
1080 if (!trim($title)) {
1081 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("qpl_savephrase_empty"));
1082 $valid = false;
1083 } elseif ($this->object->phraseExists($title)) {
1084 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("qpl_savephrase_exists"));
1085 $valid = false;
1086 }
1087
1088 if ($valid) {
1089 $this->object->savePhrase($title);
1090
1091 $this->tpl->setOnScreenMessage('success', $this->lng->txt("phrase_saved"), true);
1092 $this->ctrl->redirect($this, "editQuestion");
1093 }
1094
1095 $this->savePhrase(true);
1096 }
savePhrase(bool $a_reload=false)
Creates an output to save the current answers as a phrase.

References $valid, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ copySyncForm()

SurveyQuestionGUI::copySyncForm ( )
protected

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

393 : void
394 {
395 $ilTabs = $this->tabs;
396
397 $ilTabs->activateTab("edit_properties");
398
399 $tbl = new ilSurveySyncTableGUI($this, "copySyncForm", $this->object);
400
401 $this->tpl->setContent($tbl->getHTML());
402 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ deleteMaterial()

SurveyQuestionGUI::deleteMaterial ( )

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

742 : void
743 {
744 $mids = $this->request->getMaterialIndexes();
745 if (count($mids) > 0) {
746 $this->object->deleteMaterials($mids);
747 $this->tpl->setOnScreenMessage('success', $this->lng->txt('materials_deleted'), true);
748 } else {
749 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('no_checkbox'), true);
750 }
751 $this->ctrl->redirect($this, 'material');
752 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ editQuestion()

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

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

308 : void
309 {
310 $ilTabs = $this->tabs;
311
312 $ilTabs->activateTab("edit_properties");
313
314 if (!$a_form) {
315 $a_form = $this->initEditForm();
316 }
317 $this->tpl->setContent($a_form->getHTML());
318 }

◆ executeCommand()

SurveyQuestionGUI::executeCommand ( )

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

95 : string
96 {
97 $cmd = $this->ctrl->getCmd();
98 $next_class = $this->ctrl->getNextClass($this);
99 switch ($next_class) {
100 default:
101 $ret = $this->$cmd();
102 break;
103 }
104 return (string) $ret;
105 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getMaterialOutput()

SurveyQuestionGUI::getMaterialOutput ( )
protected

Creates the HTML output of the question material(s)

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

638 : string
639 {
640 if (count($this->object->getMaterial())) {
641 $template = new ilTemplate("tpl.il_svy_qpl_material.html", true, true, "Modules/SurveyQuestionPool");
642 foreach ($this->object->getMaterial() as $material) {
643 $template->setCurrentBlock('material');
644 switch ($material->type) {
645 case 0:
646 $href = SurveyQuestion::_getInternalLinkHref($material->internal_link, $this->request->getRefId());
647 $template->setVariable('MATERIAL_TYPE', 'internallink');
648 $template->setVariable('MATERIAL_HREF', $href);
649 break;
650 }
651 $template->setVariable('MATERIAL_TITLE', (strlen($material->title)) ? ilLegacyFormElementsUtil::prepareFormOutput(
652 $material->title
653 ) : $this->lng->txt('material'));
654 $template->setVariable('TEXT_AVAILABLE_MATERIALS', $this->lng->txt('material'));
655 $template->parseCurrentBlock();
656 }
657 return $template->get();
658 }
659 return "";
660 }
static _getInternalLinkHref(string $target="", int $a_parent_ref_id=null)
static prepareFormOutput($a_str, bool $a_strip=false)
special template class to simplify handling of ITX/PEAR

References SurveyQuestion\_getInternalLinkHref(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilLegacyFormElementsUtil\prepareFormOutput().

+ Here is the call graph for this function:

◆ getPrintView()

SurveyQuestionGUI::getPrintView ( int  $question_title = 1,
bool  $show_questiontext = true,
?int  $survey_id = null,
?array  $working_data = null 
)
abstract

◆ getPrintViewQuestionTitle()

SurveyQuestionGUI::getPrintViewQuestionTitle ( int  $question_title = 1)
protected

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

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

References ILIAS\Repository\object(), ilLegacyFormElementsUtil\prepareFormOutput(), ilObjSurvey\PRINT_HIDE_LABELS, and ilObjSurvey\PRINT_SHOW_LABELS.

+ Here is the call graph for this function:

◆ getQuestionTitle()

SurveyQuestionGUI::getQuestionTitle ( int  $question_title_mode = 1)
protected

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

580 : string {
581 $title = "";
582 switch ($question_title_mode) {
584 $title = $this->object->getTitle();
585 break;
586
588 $title = $this->object->getTitle();
589 if (trim($this->object->getLabel())) {
590 $title .= ' <span class="questionLabel">(' .
591 $this->object->getLabel()
592 . ')</span>';
593 }
594 break;
595 }
596 return $title;
597 }

References ILIAS\Repository\object(), ilObjSurvey\PRINT_HIDE_LABELS, and ilObjSurvey\PRINT_SHOW_LABELS.

+ Here is the call graph for this function:

◆ getQuestionType()

SurveyQuestionGUI::getQuestionType ( )

Returns the question type string.

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

139 : string
140 {
141 return $this->object->getQuestionType();
142 }

◆ getWorkingForm()

SurveyQuestionGUI::getWorkingForm ( array  $working_data = null,
int  $question_title = 1,
bool  $show_questiontext = true,
string  $error_message = "",
int  $survey_id = null,
bool  $compress_view = false 
)
abstract

◆ importEditFormValues()

SurveyQuestionGUI::importEditFormValues ( ilPropertyFormGUI  $a_form)
abstractprotected

◆ initEditForm()

SurveyQuestionGUI::initEditForm ( )
protected

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

228 {
229 $form = new ilPropertyFormGUI();
230 $form->setFormAction($this->ctrl->getFormAction($this, "save"));
231 $form->setTitle($this->lng->txt($this->getQuestionType()));
232 $form->setMultipart(false);
233 $form->setTableWidth("100%");
234 // $form->setId("essay");
235
236 // title
237 $title = new ilTextInputGUI($this->lng->txt("title"), "title");
238 $title->setMaxLength(200);
239 $title->setRequired(true);
240 $form->addItem($title);
241
242 // label
243 $label = new ilTextInputGUI($this->lng->txt("label"), "label");
244 $label->setInfo($this->lng->txt("label_info"));
245 $title->setMaxLength(255);
246 $label->setRequired(false);
247 $form->addItem($label);
248
249 // author
250 $author = new ilTextInputGUI($this->lng->txt("author"), "author");
251 $author->setRequired(true);
252 $title->setMaxLength(100);
253 $form->addItem($author);
254
255 // description
256 $description = new ilTextInputGUI($this->lng->txt("description"), "description");
257 $description->setRequired(false);
258 $title->setMaxLength(200);
259 $form->addItem($description);
260
261 // questiontext
262 $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
263 $question->setRequired(true);
264 $question->setRows(10);
265 $question->setCols(80);
266 if (ilObjAdvancedEditing::_getRichTextEditor() === "tinymce") {
267 $question->setUseRte(true);
268 $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
269 $question->addPlugin("latex");
270 $question->addButton("latex");
271 $question->addButton("pastelatex");
272 $question->setRTESupport($this->object->getId(), "spl", "survey");
273 }
274 $form->addItem($question);
275
276 // obligatory
277 $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory");
278 $shuffle->setValue(1);
279 $shuffle->setRequired(false);
280 $form->addItem($shuffle);
281
282 $this->addFieldsToEditForm($form);
283
284 $this->addCommandButtons($form);
285
286 // values
287 $title->setValue($this->object->getTitle());
288 $label->setValue($this->object->label);
289 $author->setValue($this->object->getAuthor());
290 $description->setValue($this->object->getDescription());
291 $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext()));
292 $shuffle->setChecked($this->object->getObligatory());
293
294 return $form;
295 }
addFieldsToEditForm(ilPropertyFormGUI $a_form)
addCommandButtons(ilPropertyFormGUI $a_form)
This class represents a checkbox property in a property form.
static _getRichTextEditor()
Returns the identifier for the Rich Text Editor.
static _getUsedHTMLTags(string $a_module="")
Returns an array of all allowed HTML tags for text editing.
This class represents a property form user interface.
This class represents a text area property in a property form.
This class represents a text property in a property form.

References ilObjAdvancedEditing\_getRichTextEditor(), ilObjAdvancedEditing\_getUsedHTMLTags(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ initObject()

SurveyQuestionGUI::initObject ( )
abstractprotected

◆ initPhrasesForm()

SurveyQuestionGUI::initPhrasesForm ( )
protected

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

931 {
932 $form = new ilPropertyFormGUI();
933 $form->setFormAction($this->ctrl->getFormAction($this, "addSelectedPhrase"));
934 $form->setTitle($this->lng->txt("add_phrase"));
935 // $form->setDescription($this->lng->txt("add_phrase_introduction"));
936
937 $group = new ilRadioGroupInputGUI($this->lng->txt("phrase"), "phrases");
938 $group->setRequired(true);
939 $form->addItem($group);
940
941 foreach (ilSurveyPhrases::_getAvailablePhrases() as $phrase_id => $phrase_array) {
942 $categories = ilSurveyPhrases::_getCategoriesForPhrase($phrase_id);
943
944 $opt = new ilRadioOption($phrase_array["title"], $phrase_id);
945 $opt->setInfo(implode(",", $categories));
946 $group->addOption($opt);
947
948 if (($phrase_array["org_title"] ?? "") === "dp_standard_numbers") {
949 $min = new ilNumberInputGUI($this->lng->txt("lower_limit"), "lower_limit");
950 $min->setRequired(true);
951 $min->setSize(5);
952 $opt->addSubItem($min);
953
954 $max = new ilNumberInputGUI($this->lng->txt("upper_limit"), "upper_limit");
955 $max->setRequired(true);
956 $max->setSize(5);
957 $opt->addSubItem($max);
958 }
959 }
960
961 $form->addCommandButton("addSelectedPhrase", $this->lng->txt("add_phrase"));
962 $form->addCommandButton("editQuestion", $this->lng->txt("cancel"));
963
964 return $form;
965 }
This class represents a number property in a property form.
This class represents a property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getAvailablePhrases(bool $useronly=false)
Gets the available phrases from the database.
static _getCategoriesForPhrase(int $phrase_id)
Gets the available categories for a given phrase.

References ilSurveyPhrases\_getAvailablePhrases(), ilSurveyPhrases\_getCategoriesForPhrase(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ linkChilds()

SurveyQuestionGUI::linkChilds ( )

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

846 : void
847 {
848 $ilTabs = $this->tabs;
849
850 $selectable_items = array();
851
852 $source_id = $this->request->getLinkSourceId();
853
854 switch ($this->edit_manager->getSearchLinkType()) {
855 case "pg":
856 $cont_obj_gui = new ilObjContentObjectGUI("", $source_id, true);
857 $cont_obj = $cont_obj_gui->getObject();
858 $pages = ilLMPageObject::getPageList($cont_obj->getId());
859 foreach ($pages as $page) {
860 if ($page["type"] === $this->edit_manager->getSearchLinkType()) {
861 $selectable_items[] = array(
862 "item_type" => $page["type"]
863 ,"item_id" => $page["obj_id"]
864 ,"title" => $page["title"]
865 );
866 }
867 }
868 break;
869
870 case "st":
871 $cont_obj_gui = new ilObjContentObjectGUI("", $source_id, true);
872 $cont_obj = $cont_obj_gui->getObject();
873 // get all chapters
874 $ctree = $cont_obj->getLMTree();
875 $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
876 foreach ($nodes as $node) {
877 if ($node["type"] === $this->edit_manager->getSearchLinkType()) {
878 $selectable_items[] = array(
879 "item_type" => $node["type"]
880 ,"item_id" => $node["obj_id"]
881 ,"title" => $node["title"]
882 );
883 }
884 }
885 break;
886
887 case "glo":
888 $glossary = new ilObjGlossary($source_id, true);
889 // get all glossary items
890 $terms = $glossary->getTermList();
891 foreach ($terms as $term) {
892 $selectable_items[] = array(
893 "item_type" => "GIT"
894 ,"item_id" => $term["id"]
895 ,"title" => $term["term"]
896 );
897 }
898 break;
899
900 case "lm":
901 $this->object->addInternalLink("il__lm_" . $source_id);
902 break;
903 }
904
905 if (count($selectable_items)) {
906 $ilTabs->activateTab("material");
907 $this->ctrl->setParameter($this, "q_id", $this->object->getId());
908 $this->ctrl->setParameter($this, "source_id", $source_id);
909
910 $tbl = new SurveyMaterialsSourceTableGUI($this, "linkChilds", "addMaterial");
911 $tbl->setData($selectable_items);
912 $this->tpl->setContent($tbl->getHTML());
913 } elseif ($this->edit_manager->getSearchLinkType() === "lm") {
914 $this->tpl->setOnScreenMessage('success', $this->lng->txt("material_added_successfully"), true);
915
916 $this->edit_manager->clearSearchLinkType();
917 $this->edit_manager->clearNewLinkType();
918 $this->ctrl->redirect($this, "material");
919 } else {
920 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("material_added_empty"), true);
921 $this->ctrl->redirect($this, "addMaterial");
922 }
923 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getPageList(int $lm_id)
Class ilObjContentObjectGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\ctrl(), ilLMPageObject\getPageList(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ material()

SurveyQuestionGUI::material ( bool  $checkonly = false)

Material tab of the survey questions.

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

671 : bool {
673
674 $ilTabs = $this->tabs;
675 $ilTabs->activateTab("material");
676
677 $href = "";
678 $type = "";
679 $add_html = '';
680 $errors = false;
681
682 if ($rbacsystem->checkAccess('write', $this->request->getRefId())) {
683 $form = new ilPropertyFormGUI();
684 $form->setFormAction($this->ctrl->getFormAction($this));
685 $form->setTitle($this->lng->txt('add_material'));
686 $form->setMultipart(false);
687 $form->setTableWidth("100%");
688 $form->setId("material");
689
690 // material
691 $material = new ilRadioGroupInputGUI($this->lng->txt("material"), "internalLinkType");
692 $material->setRequired(true);
693 $material->addOption(new ilRadioOption($this->lng->txt('obj_lm'), "lm"));
694 $material->addOption(new ilRadioOption($this->lng->txt('obj_st'), "st"));
695 $material->addOption(new ilRadioOption($this->lng->txt('obj_pg'), "pg"));
696 $material->addOption(new ilRadioOption($this->lng->txt('glossary_term'), "glo"));
697 $form->addItem($material);
698
699 $form->addCommandButton("addMaterial", $this->lng->txt("add"));
700
701 if ($checkonly) {
702 $form->setValuesByPost();
703 $errors = !$form->checkInput();
704 if ($errors) {
705 $checkonly = false;
706 }
707 }
708 $add_html = $form->getHTML();
709 }
710
711
712 $mat_html = "";
713 if (count($this->object->getMaterial())) {
714 $table_gui = new ilSurveyMaterialsTableGUI(
715 $this,
716 'material',
717 $rbacsystem->checkAccess('write', $this->request->getRefId())
718 );
719 $data = array();
720 foreach ($this->object->getMaterial() as $material) {
721 switch ($material->type) {
722 case 0:
723 $href = SurveyQuestion::_getInternalLinkHref($material->internal_link, $this->request->getRefId());
724 $type = $this->lng->txt('internal_link');
725 break;
726 }
727 $title = (strlen($material->title)) ? ilLegacyFormElementsUtil::prepareFormOutput(
728 $material->title
729 ) : $this->lng->txt('material');
730 $data[] = array('href' => $href, 'title' => $title, 'type' => $type);
731 }
732 $table_gui->setData($data);
733 $mat_html = $table_gui->getHTML();
734 }
735
736 if (!$checkonly) {
737 $this->tpl->setVariable("ADM_CONTENT", $add_html . $mat_html);
738 }
739 return $errors;
740 }
checkAccess(string $a_operations, int $a_ref_id, string $a_type="")
checkAccess represents the main method of the RBAC-system in ILIAS3 developers want to use With this ...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$errors
Definition: imgupload.php:65
$type

References $errors, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ originalSyncForm()

SurveyQuestionGUI::originalSyncForm ( )
protected

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

450 : void
451 {
452 $ilTabs = $this->tabs;
453
454 $ilTabs->activateTab("edit_properties");
455
456 $this->ctrl->saveParameter($this, "rtrn");
457
458 $cgui = new ilConfirmationGUI();
459 $cgui->setHeaderText($this->lng->txt("confirm_sync_questions"));
460
461 $cgui->setFormAction($this->ctrl->getFormAction($this, "confirmRemoveQuestions"));
462 $cgui->setCancel($this->lng->txt("no"), "cancelSync");
463 $cgui->setConfirm($this->lng->txt("yes"), "sync");
464
465 $this->tpl->setContent($cgui->getHTML());
466 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ outQuestionText()

SurveyQuestionGUI::outQuestionText ( ilTemplate  $template)
protected

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

144 : void
145 {
146 $questiontext = $this->object->getQuestiontext();
147 if (preg_match("/^<.[\\>]?>(.*?)<\\/.[\\>]*?>$/", $questiontext, $matches)) {
148 $questiontext = $matches[1];
149 }
150 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
151 if ($this->object->getObligatory()) {
152 $template->setVariable("OBLIGATORY_TEXT", ' *');
153 }
154 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514

References ILIAS\Repository\object(), and HTML_Template_IT\setVariable().

+ Here is the call graph for this function:

◆ preview()

SurveyQuestionGUI::preview ( )

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

599 : void
600 {
601 $ilTabs = $this->tabs;
602
603 $ilTabs->activateTab("preview");
604
605 $tpl = new ilTemplate("tpl.il_svy_qpl_preview.html", true, true, "Modules/SurveyQuestionPool");
606
607 if ($this->object->getObligatory()) {
608 $tpl->setCurrentBlock("required");
609 $tpl->setVariable("TEXT_REQUIRED", $this->lng->txt("required_field"));
611 }
612
613 $tpl->setVariable("QUESTION_OUTPUT", $this->getWorkingForm());
614
616 $panel->setBody($tpl->get());
617
618 $this->tpl->setContent($panel->getHTML());
619 }
getWorkingForm(array $working_data=null, int $question_title=1, bool $show_questiontext=true, string $error_message="", int $survey_id=null, bool $compress_view=false)
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.

References $panel, $tpl, ilPanelGUI\getInstance(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilGlobalTemplateInterface\parseCurrentBlock(), and ilGlobalTemplateInterface\setCurrentBlock().

+ Here is the call graph for this function:

◆ redirectAfterSaving()

SurveyQuestionGUI::redirectAfterSaving ( bool  $a_return = false)
protected

Redirect to calling survey or to edit form.

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

490 : void {
491 // return?
492 if ($a_return) {
493 // to calling survey
494 if ($this->parent_url) {
495 $addurl = "";
496 if ($this->request->getNewForSurvey() > 0) {
497 $addurl = "&new_id=" . $this->request->getQuestionId();
498 }
499 ilUtil::redirect(str_replace("&amp;", "&", $this->parent_url) . $addurl);
500 }
501 // to pool
502 else {
503 $this->ctrl->redirectByClass("ilObjSurveyQuestionPoolGUI", "questions");
504 }
505 }
506 // stay in form
507 else {
508 $this->ctrl->setParameterByClass(
509 $this->ctrl->getCmdClass(),
510 "q_id",
511 $this->object->getId()
512 );
513 $this->ctrl->setParameterByClass(
514 $this->ctrl->getCmdClass(),
515 "sel_question_types",
516 $this->request->getSelectedQuestionTypes()
517 );
518 $this->ctrl->setParameterByClass(
519 $this->ctrl->getCmdClass(),
520 "new_for_survey",
521 $this->request->getNewForSurvey()
522 );
523 $this->ctrl->redirectByClass($this->ctrl->getCmdClass(), "editQuestion");
524 }
525 }

References ILIAS\Repository\ctrl(), and ilUtil\redirect().

+ Here is the call graph for this function:

◆ removeMaterial()

SurveyQuestionGUI::removeMaterial ( )

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

805 : void
806 {
807 $this->object->material = array();
808 $this->object->saveToDb();
809 $this->editQuestion();
810 }
editQuestion(ilPropertyFormGUI $a_form=null)

◆ renderStatisticsDetailsTable()

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

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

1102 : string {
1103 $html = array();
1104 $html[] = '<div class="ilTableOuter table-responsive">';
1105 $html[] = '<table class="table table-striped">';
1106
1107 $html[] = "<thead>";
1108 $html[] = "<tr>";
1109 foreach ($a_head as $col) {
1110 $col = trim($col);
1111 $html[] = "<th>";
1112 $html[] = ($col != "") ? $col : "&nbsp;";
1113 $html[] = "</th>";
1114 }
1115 $html[] = "</tr>";
1116 $html[] = "</thead>";
1117
1118 $html[] = "<tbody>";
1119 foreach ($a_rows as $row) {
1120 $html[] = "<tr>";
1121 foreach ($row as $col) {
1122 $col = trim($col);
1123 $html[] = "<td>";
1124 $html[] = ($col != "") ? $col : "&nbsp;";
1125 $html[] = "</td>";
1126 }
1127 $html[] = "</tr>";
1128 }
1129 $html[] = "</tbody>";
1130
1131 if ($a_foot) {
1132 $html[] = "<tfoot>";
1133 $html[] = "<tr>";
1134 foreach ($a_foot as $col) {
1135 $col = trim($col);
1136 $html[] = "<td>";
1137 $html[] = ($col != "") ? $col : "&nbsp;";
1138 $html[] = "</td>";
1139 }
1140 $html[] = "</tr>";
1141 $html[] = "</tfoot>";
1142 }
1143
1144 $html[] = "</table>";
1145 $html[] = "</div>";
1146 return implode("\n", $html);
1147 }

◆ save()

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

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

357 : void {
359
360 if ($this->saveForm()) {
361 // #13784
362 if ($a_return &&
363 !SurveyQuestion::_isComplete($this->object->getId())) {
364 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("survey_error_insert_incomplete_question"));
365 $this->editQuestion();
366 return;
367 }
368
369 $ilUser->setPref("svy_lastquestiontype", $this->object->getQuestionType());
370 $ilUser->writePref("svy_lastquestiontype", $this->object->getQuestionType());
371
372 $originalexists = SurveyQuestion::_questionExists((int) $this->object->original_id);
373 $this->ctrl->setParameter($this, "q_id", $this->object->getId());
374
375 // pool question?
376 if ($a_sync) {
377 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
378 $this->ctrl->redirect($this, 'copySyncForm');
379 } elseif ($originalexists &&
380 SurveyQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) {
381 // form: update original pool question, too?
382 if ($a_return) {
383 $this->ctrl->setParameter($this, 'rtrn', 1);
384 }
385 $this->ctrl->redirect($this, 'originalSyncForm');
386 }
387
388 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
389 $this->redirectAfterSaving($a_return);
390 }
391 }
static _isWriteable(int $question_id, int $user_id)
is question writeable by a certain user
static _questionExists(int $question_id)
static _isComplete(int $question_id)
Checks whether the question is complete or not.
$ilUser
Definition: imgupload.php:34

References $ilUser, SurveyQuestion\_isComplete(), SurveyQuestion\_isWriteable(), SurveyQuestion\_questionExists(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ saveForm()

SurveyQuestionGUI::saveForm ( )
protected

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

330 : bool
331 {
332 $form = $this->initEditForm();
333 if ($form->checkInput() && $this->validateEditForm($form)) {
334 $this->object->setTitle($form->getInput("title"));
335 $this->object->label = ($form->getInput("label"));
336 $this->object->setAuthor($form->getInput("author"));
337 $this->object->setDescription($form->getInput("description"));
338 $this->object->setQuestiontext($form->getInput("question"));
339 $this->object->setObligatory($form->getInput("obligatory"));
340
341 $this->importEditFormValues($form);
342
343 // will save both core and extended data
344 $this->object->saveToDb();
345
346 return true;
347 }
348
349 $form->setValuesByPost();
350 $this->editQuestion($form);
351 return false;
352 }
importEditFormValues(ilPropertyFormGUI $a_form)

◆ savePhrase()

SurveyQuestionGUI::savePhrase ( bool  $a_reload = false)

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

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

1027 : void {
1028 $ilTabs = $this->tabs;
1029 $ilToolbar = $this->toolbar;
1030
1031 $ilTabs->activateTab("edit_properties");
1032
1033 if (!$a_reload) {
1034 $result = $this->saveForm();
1035 if ($result) {
1036 $this->object->saveToDb();
1037 }
1038 }
1039
1040 $txt = new ilTextInputGUI($this->lng->txt("enter_phrase_title"), "phrase_title");
1041 $ilToolbar->addInputItem($txt, true);
1042 $ilToolbar->addFormButton($this->lng->txt("confirm"), "confirmSavePhrase");
1043 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
1044
1045 $table_gui = new ilSurveySavePhraseTableGUI($this, 'editQuestion');
1046 $table_gui->setDescription($this->lng->txt("save_phrase_introduction"));
1047
1048 // matrix?
1049 if (method_exists($this->object, "getCategories")) {
1050 $categories = $this->object->getCategories();
1051 } else {
1052 $categories = $this->object->getColumns();
1053 }
1054
1055 $data = array();
1056 for ($i = 0; $i < $categories->getCategoryCount(); $i++) {
1057 $cat = $categories->getCategory($i);
1058
1059 $data[] = array(
1060 "answer" => $cat->title,
1061 "other" => $cat->other,
1062 "scale" => $cat->scale,
1063 "neutral" => $cat->neutral
1064 );
1065 }
1066 $table_gui->setData($data);
1067 $this->edit_manager->setPhraseData($data);
1068
1069 $this->tpl->setContent($table_gui->getHTML());
1070 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$txt
Definition: error.php:13
$i
Definition: metadata.php:41

◆ saveReturn()

SurveyQuestionGUI::saveReturn ( )
protected

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

325 : void
326 {
327 $this->save(true);
328 }
save(bool $a_return=false, bool $a_sync=false)

◆ saveSync()

SurveyQuestionGUI::saveSync ( )
protected

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

320 : void
321 {
322 $this->save($this->request->getReturn(), true);
323 }

◆ setBackUrl()

SurveyQuestionGUI::setBackUrl ( string  $a_url)

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

156 : void
157 {
158 $this->parent_url = $a_url;
159 }

◆ setQuestionTabs()

◆ setQuestionTabsForClass()

SurveyQuestionGUI::setQuestionTabsForClass ( string  $guiclass)

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

161 : void
162 {
164 $ilTabs = $this->tabs;
165
166 $this->ctrl->setParameterByClass($guiclass, "sel_question_types", $this->getQuestionType());
167 $this->ctrl->setParameterByClass(
168 $guiclass,
169 "q_id",
170 $this->request->getQuestionId()
171 );
172
173 if ($this->parent_url) {
174 $addurl = "";
175 if ($this->request->getNewForSurvey() > 0) {
176 $addurl = "&new_id=" . $this->request->getQuestionId();
177 }
178 $ilTabs->setBackTarget($this->lng->txt("menubacktosurvey"), $this->parent_url . $addurl);
179 } else {
180 $ilTabs->setBackTarget($this->lng->txt("spl"), $this->ctrl->getLinkTargetByClass("ilObjSurveyQuestionPoolGUI", "questions"));
181 }
182 if ($this->request->getQuestionId()) {
183 $ilTabs->addNonTabbedLink(
184 "preview",
185 $this->lng->txt("preview"),
186 $this->ctrl->getLinkTargetByClass($guiclass, "preview")
187 );
188 }
189
190 if ($rbacsystem->checkAccess('edit', $this->request->getRefId())) {
191 $ilTabs->addTab(
192 "edit_properties",
193 $this->lng->txt("properties"),
194 $this->ctrl->getLinkTargetByClass($guiclass, "editQuestion")
195 );
196
197 if (stripos($guiclass, "matrix") !== false) {
198 $ilTabs->addTab(
199 "layout",
200 $this->lng->txt("layout"),
201 $this->ctrl->getLinkTargetByClass($guiclass, "layout")
202 );
203 }
204 }
205 if ($this->request->getQuestionId() > 0) {
206 $ilTabs->addTab(
207 "material",
208 $this->lng->txt("material"),
209 $this->ctrl->getLinkTargetByClass($guiclass, "material")
210 );
211 }
212
213 if ($this->object->getId() > 0) {
214 $title = $this->lng->txt("edit") . " &quot;" . $this->object->getTitle() . "&quot";
215 } else {
216 $title = $this->lng->txt("create_new") . " " . $this->lng->txt($this->getQuestionType());
217 }
218
219 $this->tpl->setVariable("HEADER", $title);
220 }
getQuestionType()
Returns the question type string.

References ilRbacSystem\checkAccess(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

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

468 : void
469 {
470 $original_id = $this->object->original_id;
471 if ($original_id) {
472 $this->object->syncWithOriginal();
473 }
474
475 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
476 $this->redirectAfterSaving($this->request->getReturn());
477 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ syncCopies()

SurveyQuestionGUI::syncCopies ( )
protected

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

404 : void
405 {
407 $ilAccess = $this->access;
408
409 $qids = $this->request->getQuestionIds();
410 if (count($qids) === 0) {
411 $this->tpl->setOnScreenMessage('failure', $lng->txt("select_one"));
412 $this->copySyncForm();
413 return;
414 }
415
416 foreach ($this->object->getCopyIds(true) as $survey_id => $questions) {
417 // check permissions for "parent" survey
418 $can_write = false;
419 $ref_ids = ilObject::_getAllReferences($survey_id);
420 foreach ($ref_ids as $ref_id) {
421 if ($ilAccess->checkAccess("edit", "", $ref_id)) {
422 $can_write = true;
423 break;
424 }
425 }
426
427 if ($can_write) {
428 foreach ($questions as $qid) {
429 if (in_array($qid, $qids)) {
430 $id = $this->object->getId();
431
432 $this->object->setId($qid);
433 $this->object->setOriginalId($id);
434 $this->object->saveToDb();
435
436 $this->object->setId($id);
437 $this->object->setOriginalId(null);
438
439 // see: SurveyQuestion::syncWithOriginal()
440 // what about material?
441 }
442 }
443 }
444 }
445
446 $this->tpl->setOnScreenMessage('success', $lng->txt("survey_sync_success"), true);
447 $this->redirectAfterSaving($this->request->getReturn());
448 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _getAllReferences(int $id)
get all reference ids for object ID
$ref_id
Definition: ltiauth.php:67

References $id, $lng, $ref_id, ilObject\_getAllReferences(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ validateEditForm()

SurveyQuestionGUI::validateEditForm ( ilPropertyFormGUI  $a_form)
protected

Reimplemented in SurveyMultipleChoiceQuestionGUI.

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

536 : bool
537 {
538 return true;
539 }

Field Documentation

◆ $access

ilAccessHandler SurveyQuestionGUI::$access
protected

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

◆ $ctrl

ilCtrl SurveyQuestionGUI::$ctrl
protected

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

◆ $cumulated

array SurveyQuestionGUI::$cumulated = []
protected

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

◆ $edit_manager

EditManager SurveyQuestionGUI::$edit_manager
protected

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

◆ $lng

ilLanguage SurveyQuestionGUI::$lng
protected

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

Referenced by __construct().

◆ $log

ilLogger SurveyQuestionGUI::$log
protected

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

◆ $object

SurveyQuestion SurveyQuestionGUI::$object = null

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

◆ $parent_url

string SurveyQuestionGUI::$parent_url = ""
protected

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

◆ $rbacsystem

ilRbacSystem SurveyQuestionGUI::$rbacsystem
protected

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

◆ $request

EditingGUIRequest SurveyQuestionGUI::$request
protected

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

◆ $tabs

ilTabsGUI SurveyQuestionGUI::$tabs
protected

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

◆ $toolbar

ilToolbarGUI SurveyQuestionGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface SurveyQuestionGUI::$tpl
protected

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

Referenced by __construct().

◆ $tree

ilTree SurveyQuestionGUI::$tree
protected

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

◆ $user

ilObjUser SurveyQuestionGUI::$user
protected

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


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