19declare(strict_types=1);
34 public function __construct($a_data,
int $a_id = 0,
bool $a_call_by_reference =
true,
bool $a_prepare_output =
true)
40 $this->has_push_config = is_readable((
new ilSetting(
'notifications'))->
get(
'private_key_path',
''));
41 $this->
lng->loadLanguageModule(
'notifications_adm');
46 if (!$this->rbac_system->checkAccess(
'visible,read', $this->object->getRefId())) {
47 $this->
error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
51 $this->tabs_gui->activateTab(
'settings');
53 switch (strtolower($this->
ctrl->getNextClass())) {
54 case strtolower(ilPermissionGUI::class):
56 $this->
ctrl->forwardCommand($perm_gui);
59 match ($this->
ctrl->getCmd()) {
70 $this->tabs_gui->addTab(
72 $this->
lng->txt(
'settings'),
73 $this->ctrl->getLinkTarget($this,
'editSettings')
78 $this->tabs_gui->addTab(
80 $this->
lng->txt(
'perm_settings'),
81 $this->ctrl->getLinkTargetByClass([$this::class, ilPermissionGUI::class],
'perm')
95 $values[
'enable_osd'] =
null;
97 $values[
'enable_osd'] = [
99 'osd_play_sound' => (bool)
$settings->
get(
'osd_play_sound'),
102 if ($this->has_push_config) {
103 $values[
'enable_push'] =
$settings->
get(
'enable_push') ===
'1';
105 $form = $this->
getForm($values);
108 $this->tpl->setContent($this->dic->ui()->renderer()->render($form));
117 $this->
error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
122 $form = $this->
getForm()->withRequest($this->dic->http()->request());
123 $data = $form->getData();
124 if (isset(
$data[
'osd']) && is_array(
$data[
'osd'])) {
125 if (!isset(
$data[
'osd'][
'enable_osd'])) {
127 $DIC->notifications()->system()->clear(
'osd');
133 $settings->
set(
'osd_interval', ((
string)
$data[
'osd'][
'enable_osd'][
'osd_interval']));
134 $settings->
set(
'osd_play_sound', (
$data[
'osd'][
'enable_osd'][
'osd_play_sound']) ?
'1' :
'0');
139 if ($this->has_push_config) {
140 $push =
$data[
'push'][
'enable_push'] ??
false;
152 $enable_osd = $this->dic->ui()->factory()->input()->field()->optionalGroup(
154 'osd_interval' => $this->dic->ui()->factory()->input()->field()->numeric(
155 $this->lng->txt(
'osd_interval'),
156 $this->lng->txt(
'osd_interval_desc')
160 ->withAdditionalTransformation($this->dic->refinery()->custom()->constraint(
161 static function ($value) {
162 return $value >= 3000;
164 $this->
lng->txt(
'osd_error_refresh_interval_too_small')
166 'osd_play_sound' => $this->dic->ui()->factory()->input()->field()->checkbox(
167 $this->lng->txt(
'osd_play_sound'),
168 $this->lng->txt(
'osd_play_sound_desc')
171 $this->lng->txt(
'enable_osd')
172 )->withByline($this->
lng->txt(
'enable_osd_desc'));
174 $enable_push = $this->dic->ui()->factory()->input()->field()->checkbox(
175 $this->
lng->txt(
'enable_push'),
176 $this->lng->txt(
'enable_push_desc'),
179 if (!$this->has_push_config) {
180 $enable_push = $enable_push->withDisabled(
true);
183 if ($values !==
null) {
184 $enable_osd = $enable_osd->withValue($values[
'enable_osd'] ??
null);
185 $enable_push = $enable_push->withValue($values[
'enable_push'] ??
null);
188 return $this->dic->ui()->factory()->input()->container()->form()->standard(
189 $this->
ctrl->getFormAction($this,
'saveSettings'),
191 'osd' => $this->dic->ui()->factory()->input()->field()->section(
192 [
'enable_osd' => $enable_osd,],
193 $this->lng->txt(
'osd_settings')
195 'push' => $this->dic->ui()->factory()->input()->field()->section(
196 [
'enable_push' => $enable_push],
197 $this->lng->txt(
'push_settings')
Customizing of pimple-DIC for ILIAS.
@ilCtrl_IsCalledBy ilObjNotificationAdminGUI: ilAdministrationGUI @ilCtrl_Calls ilObjNotificationAdmi...
getForm(?array $values=null)
getAdminTabs()
administration tabs show only permissions and trash folder
__construct($a_data, int $a_id=0, bool $a_call_by_reference=true, bool $a_prepare_output=true)
showSettings(?Form $form=null)
Class ilObjectGUI Basic methods of all Output classes.
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
prepareOutput(bool $show_sub_objects=true)
delete(string $a_keyword)
set(string $a_key, string $a_val)
get(string $a_keyword, ?string $a_default_value=null)
get setting
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc