ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 24 of file class.ilObjNotificationSettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjNotificationSettingsGUI::__construct ( int  $a_ref_id)

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

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

34  {
35  global $DIC;
36 
37  $this->ctrl = $DIC->ctrl();
38  $this->lng = $DIC->language();
39  $this->tpl = $DIC["tpl"];
40  $this->ref_id = $a_ref_id;
41  $this->obj_id = ilObject::_lookupObjId($a_ref_id);
42  $this->settings = new ilObjNotificationSettings($this->obj_id);
43  }
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: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilObjNotificationSettingsGUI::executeCommand ( )

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

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

45  : void
46  {
48 
49  $next_class = $ctrl->getNextClass($this);
50  $cmd = $ctrl->getCmd("show");
51 
52  switch ($next_class) {
53  default:
54  if (in_array($cmd, array("show", "save"))) {
55  $this->$cmd();
56  }
57  }
58  }
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 68 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(), ilRadioGroupInputGUI\setValue(), and ilLanguage\txt().

Referenced by save(), and show().

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

◆ save()

ilObjNotificationSettingsGUI::save ( )
protected

Definition at line 108 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().

108  : void
109  {
110  $ctrl = $this->ctrl;
111 
112  $form = $this->initForm();
113  if ($form->checkInput()) {
115  if ($form->getInput('notification_type') === "1") {
116  if ((int) $form->getInput('no_opt_out')) {
118  } else {
120  }
121  }
122  $this->settings->save();
123  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
124  $ctrl->redirect($this, "show");
125  }
126 
127  $form->setValuesByPost();
128  $this->show();
129  }
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 60 of file class.ilObjNotificationSettingsGUI.php.

References $tpl, initForm(), and ILIAS\UICore\GlobalTemplate\setContent().

Referenced by save().

60  : void
61  {
62  $tpl = $this->tpl;
63 
64  $form = $this->initForm();
65  $tpl->setContent($form->getHTML());
66  }
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 29 of file class.ilObjNotificationSettingsGUI.php.

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

◆ $lng

ilLanguage ilObjNotificationSettingsGUI::$lng
protected

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

Referenced by initForm().

◆ $obj_id

int ilObjNotificationSettingsGUI::$obj_id
protected

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

◆ $ref_id

int ilObjNotificationSettingsGUI::$ref_id
protected

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

◆ $settings

ilObjNotificationSettings ilObjNotificationSettingsGUI::$settings
protected

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

◆ $tpl

ilGlobalTemplateInterface ilObjNotificationSettingsGUI::$tpl
protected

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

Referenced by show().


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