ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilObjNotificationSettingsGUI Class Reference

Handles general notification settings, see e.g. More...

+ Collaboration diagram for ilObjNotificationSettingsGUI:

Public Member Functions

 __construct ($a_ref_id)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 

Protected Member Functions

 show ()
 Show form. More...
 
 initForm ()
 Init settings form. More...
 
 save ()
 Save. More...
 

Protected Attributes

 $lng
 
 $ctrl
 
 $tpl
 
 $obj_id
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjNotificationSettingsGUI::__construct (   $a_ref_id)

Constructor.

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

References $DIC, ilObject\_lookupObjId(), and settings().

38  {
39  global $DIC;
40 
41  $this->ctrl = $DIC->ctrl();
42  $this->lng = $DIC->language();
43  $this->tpl = $DIC["tpl"];
44  $this->ref_id = $a_ref_id;
45  $this->obj_id = ilObject::_lookupObjId($a_ref_id);
46  include_once("./Services/Notification/classes/class.ilObjNotificationSettings.php");
47  $this->settings = new ilObjNotificationSettings($this->obj_id);
48  }
settings()
Definition: settings.php:2
global $DIC
Definition: saml.php:7
Handles general object notification settings, see e.g.
static _lookupObjId($a_id)
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilObjNotificationSettingsGUI::executeCommand ( )

Execute command.

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

References $ctrl.

54  {
56 
57  $next_class = $ctrl->getNextClass($this);
58  $cmd = $ctrl->getCmd("show");
59 
60  switch ($next_class) {
61  default:
62  if (in_array($cmd, array("show", "save"))) {
63  $this->$cmd();
64  }
65  }
66  }

◆ initForm()

ilObjNotificationSettingsGUI::initForm ( )
protected

Init settings form.

Returns
ilPropertyFormGUI

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

References $ctrl, $form, $lng, ilRadioOption\addSubItem(), ilObjNotificationSettings\MODE_DEF_ON_NO_OPT_OUT, ilObjNotificationSettings\MODE_DEF_ON_OPT_OUT, settings(), ilCheckboxInputGUI\setValue(), and ilRadioGroupInputGUI\setValue().

Referenced by save(), and show().

85  {
87  $lng = $this->lng;
88 
89  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
90  $form = new ilPropertyFormGUI();
91 
92  $form->setFormAction($ctrl->getFormAction($this, 'save'));
93  $form->setTitle($lng->txt('obj_notification_settings'));
94 
95  $radio_grp = new ilRadioGroupInputGUI($lng->txt("obj_activation"), 'notification_type');
96  $radio_grp->setValue('0');
97 
98  $opt_default = new ilRadioOption($lng->txt("obj_user_decides_notification"), '0');
99  $opt_0 = new ilRadioOption($lng->txt("obj_settings_for_all_members"), '1');
100 
101  $radio_grp->addOption($opt_default);
102  $radio_grp->addOption($opt_0);
103 
104  $chb_2 = new ilCheckboxInputGUI($lng->txt('obj_user_not_disable_not'), 'no_opt_out');
105  $chb_2->setValue(1);
106 
107  $opt_0->addSubItem($chb_2);
108  $form->addItem($radio_grp);
109 
110  if ($this->settings->getMode() == ilObjNotificationSettings::MODE_DEF_ON_OPT_OUT) {
111  $radio_grp->setValue('1');
112  }
114  $radio_grp->setValue('1');
115  $chb_2->setChecked(true);
116  }
117 
118  $form->addCommandButton("save", $lng->txt("save"));
119 
120  $form->setTitle($this->lng->txt("notifications"));
121 
122  return $form;
123  }
This class represents an option in a radio group.
settings()
Definition: settings.php:2
This class represents a property form user interface.
This class represents a checkbox property in a property form.
This class represents a property in a property form.
if(isset($_POST['submit'])) $form
addSubItem($a_item)
Add Subitem.
setValue($a_value)
Set Value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilObjNotificationSettingsGUI::save ( )
protected

Save.

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

References $_POST, $ctrl, $form, initForm(), ilObjNotificationSettings\MODE_DEF_OFF_USER_ACTIVATION, ilObjNotificationSettings\MODE_DEF_ON_NO_OPT_OUT, ilObjNotificationSettings\MODE_DEF_ON_OPT_OUT, settings(), and show().

129  {
130  $ctrl = $this->ctrl;
131 
132  $form = $this->initForm();
133  if ($form->checkInput()) {
135  if ($_POST['notification_type'] == "1") {
136  if ((int) $form->getInput('no_opt_out')) {
138  } else {
140  }
141  }
142  $this->settings->save();
143  ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
144  $ctrl->redirect($this, "show");
145  }
146 
147  $form->setValuesByPost();
148  $this->show();
149  }
settings()
Definition: settings.php:2
if(isset($_POST['submit'])) $form
$_POST["username"]
+ Here is the call graph for this function:

◆ show()

ilObjNotificationSettingsGUI::show ( )
protected

Show form.

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

References $form, $tpl, and initForm().

Referenced by save().

72  {
73  $tpl = $this->tpl;
74 
75  $form = $this->initForm();
76  $tpl->setContent($form->getHTML());
77  }
if(isset($_POST['submit'])) $form
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilObjNotificationSettingsGUI::$ctrl
protected

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

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

◆ $lng

ilObjNotificationSettingsGUI::$lng
protected

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

Referenced by initForm().

◆ $obj_id

ilObjNotificationSettingsGUI::$obj_id
protected

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

◆ $tpl

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: