ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 46 of file class.ilObjQuestionPoolSettingsGeneralGUI.php.

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

Member Function Documentation

◆ buildForm()

ilObjQuestionPoolSettingsGeneralGUI::buildForm ( )
private

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

References ILIAS\UI\examples\Layout\Page\Standard\$refinery, ILIAS\Repository\ctrl(), ilObjQuestionPool\isSkillManagementGloballyActivated(), ILIAS\Repository\lng(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by saveFormCmd(), and showFormCmd().

143  : Form
144  {
145  $items = [];
146 
147  $title_and_description = $this->poolOBJ->getObjectProperties()->getPropertyTitleAndDescription()->toForm(
148  $this->lng,
149  $this->ui_factory->input()->field(),
151  );
152 
153  $items['general_settings'] = $this->ui_factory->input()->field()->section(
154  [
155  'title_and_description' => $title_and_description
156  ],
157  $this->lng->txt('qpl_form_general_settings')
158  );
159 
160  $online = $this->poolOBJ->getObjectProperties()->getPropertyIsOnline()->toForm(
161  $this->lng,
162  $this->ui_factory->input()->field(),
164  );
165  $availability = $this->ui_factory->input()->field()->section(
166  ['online' => $online],
167  $this->lng->txt('qpl_settings_availability')
168  );
169  $items['availability'] = $availability;
170 
171  $timg = $this->poolOBJ->getObjectProperties()->getPropertyTileImage()->toForm(
172  $this->lng,
173  $this->ui_factory->input()->field(),
175  );
176  $items['display_settings'] = $this->ui_factory->input()->field()->section(
177  ['tile_image' => $timg],
178  $this->lng->txt('tst_presentation_settings_section')
179  );
180 
181  $additional_features_inputs = [];
182 
184  $additional_features_inputs['skill_service'] = $this->ui_factory->input()->field()->checkbox(
185  $this->lng->txt('tst_activate_skill_service')
186  )->withValue($this->poolOBJ->isSkillServiceEnabled());
187  }
188 
189  $items['additional_features'] = $this->ui_factory->input()->field()->section(
190  $additional_features_inputs,
191  $this->lng->txt('obj_features')
192  );
193 
194  return $this->ui_factory->input()->container()->form()->standard(
195  $this->ctrl->getFormAction($this, self::CMD_SAVE_GENERAL_FORM),
196  $items
197  );
198  }
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjQuestionPoolSettingsGeneralGUI::executeCommand ( )

Command Execution.

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

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

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

◆ performSaveForm()

ilObjQuestionPoolSettingsGeneralGUI::performSaveForm (   $data)
private

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

References $data, and null.

Referenced by saveFormCmd().

120  : void
121  {
122  $title_and_description = $data['general_settings']['title_and_description'] ?? null;
123  if ($title_and_description instanceof ilObjectPropertyTitleAndDescription) {
124  $this->poolOBJ->getObjectProperties()->storePropertyTitleAndDescription(
125  $title_and_description
126  );
127  }
128 
129  $this->poolOBJ->getObjectProperties()->storePropertyIsOnline(
130  $data['availability']['online'] ?? $this->poolOBJ->getObjectProperties()->getPropertyIsOnline()->withOffline()
131  );
132 
133  $display_settings = $data['display_settings'] ?? [];
134  if (isset($display_settings['tile_image'])) {
135  $this->poolOBJ->getObjectProperties()->storePropertyTileImage($display_settings['tile_image']);
136  }
137 
138  $this->poolOBJ->setSkillServiceEnabled($data['additional_features']['skill_service'] ?? false);
139 
140  $this->poolOBJ->saveToDb();
141  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ saveFormCmd()

ilObjQuestionPoolSettingsGeneralGUI::saveFormCmd ( )
private

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

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

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

◆ showFormCmd()

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

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

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

Referenced by saveFormCmd().

94  : void
95  {
96  $this->tabs->activateSubTab(self::TAB_COMMON_SETTINGS);
97  if ($form === null) {
98  $form = $this->buildForm();
99  }
100  $this->tpl->setContent($this->ui_renderer->render($form));
101  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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: