ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Mail\UserSettings\NewMailNotification Class Reference
+ Inheritance diagram for ILIAS\Mail\UserSettings\NewMailNotification:
+ Collaboration diagram for ILIAS\Mail\UserSettings\NewMailNotification:

Public Member Functions

 getIdentifier ()
 
 isAvailable ()
 If this function returns false the setting will not be shown, even if it's PropertyAttributes would allow it to be. More...
 
 getLabel (Language $lng)
 
 getSettingsPage ()
 
 getSection ()
 
 getInput (FieldFactory $field_factory, Language $lng, Refinery $refinery, \ilSetting $settings, ?\ilObjUser $user=null)
 
 getLegacyInput (Language $lng, \ilSetting $settings, ?\ilObjUser $user=null)
 You don't need to add a post_var to the input as the User will handle this for you, thus you can also not rely on the post_var anywhere else, as it will be changed. More...
 
 getDefaultValueForDisplay (Language $lng, \ilSetting $settings)
 
 hasUserPersonalizedSetting (\ilSetting $settings, \ilObjUser $user)
 
 persistUserInput (\ilObjUser $user, mixed $input, ?\ilPropertyFormGUI $form=null)
 
 retrieveValueFromUser (\ilObjUser $user)
 
- Public Member Functions inherited from ILIAS\User\Settings\SettingDefinition
 isAvailable ()
 If this function returns false the setting will not be shown, even if it's PropertyAttributes would allow it to be. More...
 
 getSettingsPage ()
 
 getDefaultValueForDisplay (Language $lng, \ilSetting $settings)
 
 hasUserPersonalizedSetting (\ilSetting $settings, \ilObjUser $user)
 
 getInput (FieldFactory $field_factory, Language $lng, Refinery $refinery, \ilSetting $settings, ?\ilObjUser $user=null)
 
 getLegacyInput (Language $lng, \ilSetting $settings, ?\ilObjUser $user=null)
 You don't need to add a post_var to the input as the User will handle this for you, thus you can also not rely on the post_var anywhere else, as it will be changed. More...
 
 persistUserInput (\ilObjUser $user, mixed $input)
 
 getIdentifier ()
 
 getLabel (Language $lng)
 
 getSection ()
 
 retrieveValueFromUser (\ilObjUser $user)
 

Private Member Functions

 mailOptionsFor (\ilObjUser $user)
 

Private Attributes

array $mail_options_by_user = []
 

Detailed Description

Definition at line 31 of file NewMailNotification.php.

Member Function Documentation

◆ getDefaultValueForDisplay()

ILIAS\Mail\UserSettings\NewMailNotification::getDefaultValueForDisplay ( Language  $lng,
\ilSetting  $settings 
)

Implements ILIAS\User\Settings\SettingDefinition.

Definition at line 99 of file NewMailNotification.php.

102 : string {
103 return $lng->txt('no');
104 }
global $lng
Definition: privfeed.php:31

◆ getIdentifier()

ILIAS\Mail\UserSettings\NewMailNotification::getIdentifier ( )

Implements ILIAS\User\Property.

Definition at line 36 of file NewMailNotification.php.

36 : string
37 {
38 return 'new_mail_notification';
39 }

◆ getInput()

ILIAS\Mail\UserSettings\NewMailNotification::getInput ( FieldFactory  $field_factory,
Language  $lng,
Refinery  $refinery,
\ilSetting  $settings,
?\ilObjUser  $user = null 
)

Implements ILIAS\User\Settings\SettingDefinition.

Definition at line 65 of file NewMailNotification.php.

71 : Input {
72 $lng->loadLanguageModule('mail');
73
74 return $field_factory->checkbox(
75 $this->getLabel($lng),
76 $lng->txt('mail_cronjob_notification_info')
77 )->withValue(
78 $user !== null && $this->retrieveValueFromUser($user)
79 );
80 }

◆ getLabel()

ILIAS\Mail\UserSettings\NewMailNotification::getLabel ( Language  $lng)

Implements ILIAS\User\Property.

Definition at line 50 of file NewMailNotification.php.

50 : string
51 {
52 return $lng->txt('cron_mail_notification');
53 }

References $lng.

◆ getLegacyInput()

ILIAS\Mail\UserSettings\NewMailNotification::getLegacyInput ( Language  $lng,
\ilSetting  $settings,
?\ilObjUser  $user = null 
)

You don't need to add a post_var to the input as the User will handle this for you, thus you can also not rely on the post_var anywhere else, as it will be changed.

Implements ILIAS\User\Settings\SettingDefinition.

Definition at line 82 of file NewMailNotification.php.

87 $lng->loadLanguageModule('mail');
88
89 $input = new \ilCheckboxInputGUI($this->getLabel($lng));
90 $input->setInfo($lng->txt('mail_cronjob_notification_info'));
91 $input->setChecked(
92 $user !== null && $this->retrieveValueFromUser($user)
93 );
94 $input->setValue('1');
95
96 return $input;
97 }
This class represents a property in a property form.

◆ getSection()

ILIAS\Mail\UserSettings\NewMailNotification::getSection ( )

Implements ILIAS\User\Property.

Definition at line 60 of file NewMailNotification.php.

61 {
62 return AvailableSections::Communication;
63 }

◆ getSettingsPage()

ILIAS\Mail\UserSettings\NewMailNotification::getSettingsPage ( )

Implements ILIAS\User\Settings\SettingDefinition.

Definition at line 55 of file NewMailNotification.php.

56 {
57 return AvailablePages::MainSettings;
58 }

◆ hasUserPersonalizedSetting()

ILIAS\Mail\UserSettings\NewMailNotification::hasUserPersonalizedSetting ( \ilSetting  $settings,
\ilObjUser  $user 
)

Implements ILIAS\User\Settings\SettingDefinition.

Definition at line 106 of file NewMailNotification.php.

109 : bool {
110 $value = $this->retrieveValueFromUser($user);
111 return $value !== false;
112 }

◆ isAvailable()

ILIAS\Mail\UserSettings\NewMailNotification::isAvailable ( )

If this function returns false the setting will not be shown, even if it's PropertyAttributes would allow it to be.

This is meant e.g. to check if the chat server is configured or the badges enabled. Settings that are not available will also not be available on the table to define their PropertyAttributes

Implements ILIAS\User\Settings\SettingDefinition.

Definition at line 41 of file NewMailNotification.php.

41 : bool
42 {
43 $settings = new \ilSetting();
44
45 return
46 $settings->get('mail_notification') === '1' &&
47 $settings->get('show_mail_settings') === '1';
48 }

◆ mailOptionsFor()

ILIAS\Mail\UserSettings\NewMailNotification::mailOptionsFor ( \ilObjUser  $user)
private

Definition at line 131 of file NewMailNotification.php.

132 {
133 if (!\array_key_exists($user->getId(), $this->mail_options_by_user)) {
134 $this->mail_options_by_user[$user->getId()] = new \ilMailOptions($user->getId());
135 }
136
137 return $this->mail_options_by_user[$user->getId()];
138 }

References ilObject\getId().

+ Here is the call graph for this function:

◆ persistUserInput()

ILIAS\Mail\UserSettings\NewMailNotification::persistUserInput ( \ilObjUser  $user,
mixed  $input,
?\ilPropertyFormGUI  $form = null 
)

Definition at line 114 of file NewMailNotification.php.

118 : \ilObjUser {
119 $mail_options = $this->mailOptionsFor($user);
120 $mail_options->setIsCronJobNotificationStatus($input === true || $input === '1');
121 $mail_options->updateOptions();
122
123 return $user;
124 }
User class.

◆ retrieveValueFromUser()

ILIAS\Mail\UserSettings\NewMailNotification::retrieveValueFromUser ( \ilObjUser  $user)

Implements ILIAS\User\Property.

Definition at line 126 of file NewMailNotification.php.

126 : bool
127 {
128 return $this->mailOptionsFor($user)->isCronJobNotificationEnabled();
129 }

Field Documentation

◆ $mail_options_by_user

array ILIAS\Mail\UserSettings\NewMailNotification::$mail_options_by_user = []
private

Definition at line 34 of file NewMailNotification.php.


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