ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 141 of file class.ilObjQuestionPoolSettingsGeneralGUI.php.

References ILIAS\Repository\$refinery, ILIAS\Repository\ctrl(), ilMD\getGeneral(), ilObjQuestionPool\isSkillManagementGloballyActivated(), ILIAS\Repository\lng(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by saveFormCmd(), and showFormCmd().

141  : Form
142  {
143  $items = [];
144 
145  $md_obj = new ilMD($this->poolOBJ->getId(), 0, "qpl");
146  $md_section = $md_obj->getGeneral();
147 
148  $title_and_description = $this->poolOBJ->getObjectProperties()->getPropertyTitleAndDescription()->toForm(
149  $this->lng,
150  $this->ui_factory->input()->field(),
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(),
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(),
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  $additional_features_inputs['show_tax'] = $this->ui_factory->input()->field()->checkbox(
191  $this->lng->txt('qpl_settings_general_form_property_show_taxonomies')
192  )->withValue($this->poolOBJ->getShowTaxonomies());
193 
194  $items['additional_features'] = $this->ui_factory->input()->field()->section(
195  $additional_features_inputs,
196  $this->lng->txt('obj_features')
197  );
198 
199  return $this->ui_factory->input()->container()->form()->standard(
200  $this->ctrl->getFormAction($this, self::CMD_SAVE_GENERAL_FORM),
201  $items
202  );
203  }
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:58
getGeneral()
Definition: class.ilMD.php:34
Refinery Factory $refinery
+ 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('ilObjQuestionPoolGUI', 'infoScreen');
71  }
72 
73  $this->tabs->activateTab('settings');
74  $this->tabs->activateSubTab('qpl_settings_subtab_general');
75 
76  // process command
77 
78  $nextClass = $this->ctrl->getNextClass();
79 
80  switch ($nextClass) {
81  default:
82  $cmd = $this->ctrl->getCmd(self::CMD_SHOW_GENERAL_FORM) . 'Cmd';
83  $this->$cmd();
84  }
85  }
+ Here is the call graph for this function:

◆ performSaveForm()

ilObjQuestionPoolSettingsGeneralGUI::performSaveForm (   $data)
private

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

References $data.

Referenced by saveFormCmd().

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

◆ saveFormCmd()

ilObjQuestionPoolSettingsGeneralGUI::saveFormCmd ( )
private

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

References buildForm(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), performSaveForm(), and showFormCmd().

96  : void
97  {
98  $form = $this->buildForm();
99  $form = $form->withRequest($this->http_request);
100 
101  $result = $form->getInputGroup()->getContent();
102 
103  if ($result->isOK()) {
104  $values = $result->value();
105  $this->performSaveForm($values);
106  $this->tpl->setOnScreenMessage(MessageBox::SUCCESS, $this->lng->txt("msg_obj_modified"), true);
107  $this->ctrl->redirect($this, self::CMD_SHOW_GENERAL_FORM);
108  } else {
109  $this->tpl->setOnScreenMessage(MessageBox::FAILURE, $this->lng->txt('form_input_not_valid'));
110  $this->showFormCmd($form);
111  }
112  }
+ Here is the call graph for this function:

◆ showFormCmd()

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

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

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

Referenced by saveFormCmd().

87  : void
88  {
89  $this->tabs->activateSubTab(self::TAB_COMMON_SETTINGS);
90  if ($form === null) {
91  $form = $this->buildForm();
92  }
93  $this->tpl->setContent($this->ui_renderer->render($form));
94  }
+ 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: