ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilObjQuestionPoolSettingsGeneralGUI Class Reference
+ Collaboration diagram for ilObjQuestionPoolSettingsGeneralGUI:

Public Member Functions

 __construct (private readonly ilCtrl $ctrl, private readonly ilAccessHandler $access, private readonly ilLanguage $lng, private readonly ilGlobalTemplateInterface $tpl, private readonly ilTabsGUI $tabs, private readonly ilObjQuestionPoolGUI $poolGUI, private readonly Refinery $refinery, private readonly UIFactory $ui_factory, private readonly UIRenderer $ui_renderer, private readonly HttpRequest $http_request,)
 
 executeCommand ()
 Command Execution. More...
 

Data Fields

const CMD_SHOW_GENERAL_FORM = 'showForm'
 
const CMD_SAVE_GENERAL_FORM = 'saveForm'
 
const TAB_COMMON_SETTINGS = 'settings'
 

Protected Attributes

ilObjQuestionPool ilObject $poolOBJ
 

Private Member Functions

 showFormCmd (?Form $form=null)
 
 saveFormCmd ()
 
 performSaveForm ($data)
 
 buildForm ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjQuestionPoolSettingsGeneralGUI::__construct ( private readonly ilCtrl  $ctrl,
private readonly ilAccessHandler  $access,
private readonly ilLanguage  $lng,
private readonly ilGlobalTemplateInterface  $tpl,
private readonly ilTabsGUI  $tabs,
private readonly ilObjQuestionPoolGUI  $poolGUI,
private readonly Refinery  $refinery,
private readonly UIFactory  $ui_factory,
private readonly UIRenderer  $ui_renderer,
private readonly HttpRequest  $http_request 
)

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

58 {
59 $this->poolOBJ = $poolGUI->getObject();
60 }

Member Function Documentation

◆ buildForm()

ilObjQuestionPoolSettingsGeneralGUI::buildForm ( )
private

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

144 : Form
145 {
146 $items = [];
147
148 $title_and_description = $this->poolOBJ->getObjectProperties()->getPropertyTitleAndDescription()->toForm(
149 $this->lng,
150 $this->ui_factory->input()->field(),
151 $this->refinery
152 );
153
154 $items['general_settings'] = $this->ui_factory->input()->field()->section(
155 [
156 'title_and_description' => $title_and_description
157 ],
158 $this->lng->txt('qpl_form_general_settings')
159 );
160
161 $online = $this->poolOBJ->getObjectProperties()->getPropertyIsOnline()->toForm(
162 $this->lng,
163 $this->ui_factory->input()->field(),
164 $this->refinery
165 );
166 $availability = $this->ui_factory->input()->field()->section(
167 ['online' => $online],
168 $this->lng->txt('qpl_settings_availability')
169 );
170 $items['availability'] = $availability;
171
172 $timg = $this->poolOBJ->getObjectProperties()->getPropertyTileImage()->toForm(
173 $this->lng,
174 $this->ui_factory->input()->field(),
175 $this->refinery
176 );
177 $items['display_settings'] = $this->ui_factory->input()->field()->section(
178 ['tile_image' => $timg],
179 $this->lng->txt('tst_presentation_settings_section')
180 );
181
182 $additional_features_inputs = [];
183
185 $additional_features_inputs['skill_service'] = $this->ui_factory->input()->field()->checkbox(
186 $this->lng->txt('tst_activate_skill_service')
187 )->withValue($this->poolOBJ->isSkillServiceEnabled());
188 }
189
190 $items['additional_features'] = $this->ui_factory->input()->field()->section(
191 $additional_features_inputs,
192 $this->lng->txt('obj_features')
193 );
194
195 return $this->ui_factory->input()->container()->form()->standard(
196 $this->ctrl->getFormAction($this, self::CMD_SAVE_GENERAL_FORM),
197 $items
198 );
199 }

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

Referenced by saveFormCmd(), and showFormCmd().

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

◆ executeCommand()

ilObjQuestionPoolSettingsGeneralGUI::executeCommand ( )

Command Execution.

Definition at line 65 of file class.ilObjQuestionPoolSettingsGeneralGUI.php.

65 : void
66 {
67 // allow only write access
68
69 if (!$this->access->checkAccess('write', '', $this->poolGUI->getRefId())) {
70 $this->tpl->setOnScreenMessage('info', $this->lng->txt('cannot_edit_question_pool'), true);
71 $this->ctrl->redirectByClass(
72 [
73 ilRepositoryGUI::class,
74 self::class,
75 ilInfoScreenGUI::class
76 ],
77 'showSummary'
78 );
79 }
80
81 $this->tabs->activateTab('settings');
82 $this->tabs->activateSubTab('qpl_settings_subtab_general');
83
84 // process command
85
86 $nextClass = $this->ctrl->getNextClass();
87
88 switch ($nextClass) {
89 default:
90 $cmd = $this->ctrl->getCmd(self::CMD_SHOW_GENERAL_FORM) . 'Cmd';
91 $this->$cmd();
92 }
93 }

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

+ Here is the call graph for this function:

◆ performSaveForm()

ilObjQuestionPoolSettingsGeneralGUI::performSaveForm (   $data)
private

Definition at line 121 of file class.ilObjQuestionPoolSettingsGeneralGUI.php.

121 : void
122 {
123 $title_and_description = $data['general_settings']['title_and_description'] ?? null;
124 if ($title_and_description instanceof TitleAndDescription) {
125 $this->poolOBJ->getObjectProperties()->storePropertyTitleAndDescription(
126 $title_and_description
127 );
128 }
129
130 $this->poolOBJ->getObjectProperties()->storePropertyIsOnline(
131 $data['availability']['online'] ?? $this->poolOBJ->getObjectProperties()->getPropertyIsOnline()->withOffline()
132 );
133
134 $display_settings = $data['display_settings'] ?? [];
135 if (isset($display_settings['tile_image'])) {
136 $this->poolOBJ->getObjectProperties()->storePropertyTileImage($display_settings['tile_image']);
137 }
138
139 $this->poolOBJ->setSkillServiceEnabled($data['additional_features']['skill_service'] ?? false);
140
141 $this->poolOBJ->saveToDb();
142 }

References $data.

Referenced by saveFormCmd().

+ Here is the caller graph for this function:

◆ saveFormCmd()

ilObjQuestionPoolSettingsGeneralGUI::saveFormCmd ( )
private

Definition at line 104 of file class.ilObjQuestionPoolSettingsGeneralGUI.php.

104 : void
105 {
106 $form = $this->buildForm()->withRequest($this->http_request);
107 $result = $form->getInputGroup()->getContent();
108
109 if (!$result->isOK()) {
110 $this->tpl->setOnScreenMessage(MessageBox::FAILURE, $this->lng->txt('form_input_not_valid'));
111 $this->showFormCmd($form);
112 return;
113 }
114
115 $this->performSaveForm($result->value());
116 $this->tpl->setOnScreenMessage(MessageBox::SUCCESS, $this->lng->txt("msg_obj_modified"), true);
117 $this->ctrl->redirect($this, self::CMD_SHOW_GENERAL_FORM);
118
119 }
@ FAILURE
The progress of the process/task cannot be calculated (yet), but it has started processing.
Definition: Status.php:42

References buildForm(), ILIAS\Repository\ctrl(), ILIAS\UI\Implementation\Component\Progress\State\Bar\FAILURE, ILIAS\Repository\lng(), performSaveForm(), and showFormCmd().

+ Here is the call graph for this function:

◆ showFormCmd()

ilObjQuestionPoolSettingsGeneralGUI::showFormCmd ( ?Form  $form = null)
private

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

95 : void
96 {
97 $this->tabs->activateSubTab(self::TAB_COMMON_SETTINGS);
98 if ($form === null) {
99 $form = $this->buildForm();
100 }
101 $this->tpl->setContent($this->ui_renderer->render($form));
102 }

References buildForm(), and ILIAS\Repository\tabs().

Referenced by saveFormCmd().

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

Field Documentation

◆ $poolOBJ

ilObjQuestionPool ilObject ilObjQuestionPoolSettingsGeneralGUI::$poolOBJ
protected

◆ CMD_SAVE_GENERAL_FORM

const ilObjQuestionPoolSettingsGeneralGUI::CMD_SAVE_GENERAL_FORM = 'saveForm'

◆ CMD_SHOW_GENERAL_FORM

const ilObjQuestionPoolSettingsGeneralGUI::CMD_SHOW_GENERAL_FORM = 'showForm'

◆ TAB_COMMON_SETTINGS

const ilObjQuestionPoolSettingsGeneralGUI::TAB_COMMON_SETTINGS = 'settings'

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