ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjNotificationSettingsGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilObjNotificationSettingsGUI:

Public Member Functions

 __construct (int $a_ref_id)
 
 executeCommand ()
 

Protected Member Functions

 show ()
 
 initForm ()
 
 save ()
 

Protected Attributes

ilObjNotificationSettings $settings
 
int $ref_id
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
int $obj_id
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too. If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Handles general notification settings, see e.g. https://www.ilias.de/docu/goto_docu_wiki_wpage_3457_1357.html

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 21 of file class.ilObjNotificationSettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjNotificationSettingsGUI::__construct ( int  $a_ref_id)

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

References $DIC, ilObject\_lookupObjId(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\settings().

31  {
32  global $DIC;
33 
34  $this->ctrl = $DIC->ctrl();
35  $this->lng = $DIC->language();
36  $this->tpl = $DIC["tpl"];
37  $this->ref_id = $a_ref_id;
38  $this->obj_id = ilObject::_lookupObjId($a_ref_id);
39  $this->settings = new ilObjNotificationSettings($this->obj_id);
40  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilObjNotificationSettingsGUI::executeCommand ( )

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

References $ctrl, ilCtrl\getCmd(), and ilCtrl\getNextClass().

42  : void
43  {
45 
46  $next_class = $ctrl->getNextClass($this);
47  $cmd = $ctrl->getCmd("show");
48 
49  switch ($next_class) {
50  default:
51  if (in_array($cmd, array("show", "save"))) {
52  $this->$cmd();
53  }
54  }
55  }
getCmd(string $fallback_command=null)
getNextClass($a_gui_class=null)
+ Here is the call graph for this function:

◆ initForm()

ilObjNotificationSettingsGUI::initForm ( )
protected

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

References $ctrl, $lng, ilRadioOption\addSubItem(), ilCtrl\getFormAction(), ILIAS\Repository\lng(), ilObjNotificationSettings\MODE_DEF_ON_NO_OPT_OUT, ilObjNotificationSettings\MODE_DEF_ON_OPT_OUT, ILIAS\Repository\settings(), ilCheckboxInputGUI\setValue(), ilRadioGroupInputGUI\setValue(), and ilLanguage\txt().

Referenced by save(), and show().

66  {
68  $lng = $this->lng;
69 
70  $form = new ilPropertyFormGUI();
71 
72  $form->setFormAction($ctrl->getFormAction($this, 'save'));
73  $form->setTitle($lng->txt('obj_notification_settings'));
74 
75  $radio_grp = new ilRadioGroupInputGUI($lng->txt("obj_activation"), 'notification_type');
76  $radio_grp->setValue('0');
77 
78  $opt_default = new ilRadioOption($lng->txt("obj_user_decides_notification"), '0');
79  $opt_0 = new ilRadioOption($lng->txt("obj_settings_for_all_members"), '1');
80 
81  $radio_grp->addOption($opt_default);
82  $radio_grp->addOption($opt_0);
83 
84  $chb_2 = new ilCheckboxInputGUI($lng->txt('obj_user_not_disable_not'), 'no_opt_out');
85  $chb_2->setValue(1);
86 
87  $opt_0->addSubItem($chb_2);
88  $form->addItem($radio_grp);
89 
90  if ($this->settings->getMode() === ilObjNotificationSettings::MODE_DEF_ON_OPT_OUT) {
91  $radio_grp->setValue('1');
92  }
94  $radio_grp->setValue('1');
95  $chb_2->setChecked(true);
96  }
97 
98  $form->addCommandButton("save", $lng->txt("save"));
99 
100  $form->setTitle($this->lng->txt("notifications"));
101 
102  return $form;
103  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
This class represents a checkbox property in a property form.
This class represents a property in a property form.
getFormAction(object $a_gui_obj, string $a_fallback_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilObjNotificationSettingsGUI::save ( )
protected

Definition at line 105 of file class.ilObjNotificationSettingsGUI.php.

References $ctrl, initForm(), ILIAS\Repository\lng(), ilObjNotificationSettings\MODE_DEF_OFF_USER_ACTIVATION, ilObjNotificationSettings\MODE_DEF_ON_NO_OPT_OUT, ilObjNotificationSettings\MODE_DEF_ON_OPT_OUT, ilCtrl\redirect(), ILIAS\Repository\settings(), and show().

105  : void
106  {
107  $ctrl = $this->ctrl;
108 
109  $form = $this->initForm();
110  if ($form->checkInput()) {
112  if ($form->getInput('notification_type') === "1") {
113  if ((int) $form->getInput('no_opt_out')) {
115  } else {
117  }
118  }
119  $this->settings->save();
120  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
121  $ctrl->redirect($this, "show");
122  }
123 
124  $form->setValuesByPost();
125  $this->show();
126  }
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
+ Here is the call graph for this function:

◆ show()

ilObjNotificationSettingsGUI::show ( )
protected

Definition at line 57 of file class.ilObjNotificationSettingsGUI.php.

References $tpl, initForm(), and ilGlobalTemplateInterface\setContent().

Referenced by save().

57  : void
58  {
59  $tpl = $this->tpl;
60 
61  $form = $this->initForm();
62  $tpl->setContent($form->getHTML());
63  }
setContent(string $a_html)
Sets content for standard template.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilObjNotificationSettingsGUI::$ctrl
protected

Definition at line 26 of file class.ilObjNotificationSettingsGUI.php.

Referenced by executeCommand(), initForm(), and save().

◆ $lng

ilLanguage ilObjNotificationSettingsGUI::$lng
protected

Definition at line 25 of file class.ilObjNotificationSettingsGUI.php.

Referenced by initForm().

◆ $obj_id

int ilObjNotificationSettingsGUI::$obj_id
protected

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

◆ $ref_id

int ilObjNotificationSettingsGUI::$ref_id
protected

Definition at line 24 of file class.ilObjNotificationSettingsGUI.php.

◆ $settings

ilObjNotificationSettings ilObjNotificationSettingsGUI::$settings
protected

Definition at line 23 of file class.ilObjNotificationSettingsGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilObjNotificationSettingsGUI::$tpl
protected

Definition at line 27 of file class.ilObjNotificationSettingsGUI.php.

Referenced by show().


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