19 declare(strict_types=1);
75 $this->db = $DIC->database();
76 $this->obj_id = $a_obj_id;
78 $this->content_style_service = $DIC
81 ->styleForObjId($a_obj_id);
90 if (!isset(self::$instances[$a_obj_id])) {
91 self::$instances[$a_obj_id] =
new self($a_obj_id);
94 return self::$instances[$a_obj_id];
97 private function read(): void
100 $res = $this->db->queryF(
101 'SELECT * FROM frm_settings WHERE obj_id = %s',
106 $row = $this->db->fetchObject(
$res);
107 if (is_object($row)) {
108 $this->exists =
true;
110 $this->default_view = (
int) $row->default_view;
111 $this->anonymized = (
bool) $row->anonymized;
112 $this->statistics_enabled = (bool) $row->statistics_enabled;
113 $this->post_activation_enabled = (
bool) $row->post_activation;
114 $this->admin_force_noti = (bool) $row->admin_force_noti;
115 $this->user_toggle_noti = (
bool) $row->user_toggle_noti;
116 $this->preset_subject = (bool) $row->preset_subject;
117 $this->add_re_subject = (
bool) $row->add_re_subject;
118 $this->interested_events = (
int) $row->interested_events;
120 $this->notification_type = $row->notification_type ??
'default';
121 $this->mark_mod_posts = (
bool) $row->mark_mod_posts;
122 $this->thread_sorting = (
int) $row->thread_sorting;
123 $this->is_thread_rating_enabled = (
bool) $row->thread_rating;
124 $this->file_upload_allowed = (bool) $row->file_upload_allowed;
125 if (is_numeric($row->lp_req_num_postings)) {
126 $this->lp_req_num_postings = (
int) $row->lp_req_num_postings;
134 if ($this->obj_id && !$this->exists) {
138 'obj_id' => [
'integer', $this->obj_id],
139 'default_view' => [
'integer', $this->default_view],
140 'anonymized' => [
'integer', (
int) $this->anonymized],
141 'statistics_enabled' => [
'integer', (
int) $this->statistics_enabled],
142 'post_activation' => [
'integer', (
int) $this->post_activation_enabled],
143 'admin_force_noti' => [
'integer', (
int) $this->admin_force_noti],
144 'user_toggle_noti' => [
'integer', (
int) $this->user_toggle_noti],
145 'preset_subject' => [
'integer', (
int) $this->preset_subject],
146 'add_re_subject' => [
'integer', (
int) $this->add_re_subject],
147 'notification_type' => [
'text', $this->notification_type],
148 'mark_mod_posts' => [
'integer', (
int) $this->mark_mod_posts],
149 'thread_sorting' => [
'integer', $this->thread_sorting],
150 'thread_rating' => [
'integer', (
int) $this->is_thread_rating_enabled],
151 'file_upload_allowed' => [
'integer', (
int) $this->file_upload_allowed],
152 'lp_req_num_postings' => [
'integer', $this->lp_req_num_postings],
153 'interested_events' => [
'integer', $this->interested_events]
156 $this->exists =
true;
163 if (!$this->exists) {
171 'default_view' => [
'integer', $this->default_view],
172 'anonymized' => [
'integer', (
int) $this->anonymized],
173 'statistics_enabled' => [
'integer', (
int) $this->statistics_enabled],
174 'post_activation' => [
'integer', (
int) $this->post_activation_enabled],
175 'admin_force_noti' => [
'integer', (
int) $this->admin_force_noti],
176 'user_toggle_noti' => [
'integer', (
int) $this->user_toggle_noti],
177 'preset_subject' => [
'integer', (
int) $this->preset_subject],
178 'add_re_subject' => [
'integer', (
int) $this->add_re_subject],
179 'notification_type' => [
'text', $this->notification_type],
180 'mark_mod_posts' => [
'integer', (
int) $this->mark_mod_posts],
181 'thread_sorting' => [
'integer', $this->thread_sorting],
182 'thread_rating' => [
'integer', (
int) $this->is_thread_rating_enabled],
183 'file_upload_allowed' => [
'integer', (
int) $this->file_upload_allowed],
184 'lp_req_num_postings' => [
'integer', (
int) $this->lp_req_num_postings],
185 'interested_events' => [
'integer', $this->interested_events]
188 'obj_id' => [
'integer', $this->obj_id]
194 public function copy(
int $a_new_obj_id): bool
197 $this->content_style_service->cloneTo($a_new_obj_id);
202 'default_view' => [
'integer', $this->default_view],
203 'anonymized' => [
'integer', (
int) $this->anonymized],
204 'statistics_enabled' => [
'integer', (
int) $this->statistics_enabled],
205 'post_activation' => [
'integer', (
int) $this->post_activation_enabled],
206 'admin_force_noti' => [
'integer', (
int) $this->admin_force_noti],
207 'user_toggle_noti' => [
'integer', (
int) $this->user_toggle_noti],
208 'preset_subject' => [
'integer', (
int) $this->preset_subject],
209 'add_re_subject' => [
'integer', (
int) $this->add_re_subject],
210 'notification_type' => [
'text', $this->notification_type],
211 'mark_mod_posts' => [
'integer', (
int) $this->mark_mod_posts],
212 'thread_sorting' => [
'integer', $this->thread_sorting],
213 'thread_rating' => [
'integer', (
int) $this->is_thread_rating_enabled],
214 'file_upload_allowed' => [
'integer', (
int) $this->file_upload_allowed],
215 'lp_req_num_postings' => [
'integer', $this->lp_req_num_postings],
216 'interested_events' => [
'integer', $this->interested_events]
219 'obj_id' => [
'integer', $a_new_obj_id]
241 $this->default_view = $a_default_view;
251 $this->statistics_enabled = $a_statistic_status;
261 $this->anonymized = $a_anonymized;
272 $ilDB = $DIC->database();
274 $result =
$ilDB->queryF(
275 'SELECT anonymized FROM frm_settings WHERE obj_id = %s',
280 while ($record =
$ilDB->fetchAssoc($result)) {
281 return (
bool) $record[
'anonymized'];
289 $this->post_activation_enabled = $a_post_activation;
299 $this->obj_id = $a_obj_id;
310 $this->admin_force_noti = $a_admin_force;
320 $this->user_toggle_noti = $a_user_toggle;
332 $ilDB = $DIC->database();
335 'SELECT admin_force_noti FROM frm_settings WHERE obj_id = %s',
340 return (
bool) $record[
'admin_force_noti'];
350 $ilDB = $DIC->database();
353 'SELECT user_toggle_noti FROM frm_settings WHERE obj_id = %s',
357 while ($record =
$ilDB->fetchAssoc(
$res)) {
358 return (
bool) $record[
'user_toggle_noti'];
366 $this->preset_subject = $a_preset_subject;
376 $this->add_re_subject = $a_add_re_subject;
386 if ($a_notification_type === null) {
387 $this->notification_type =
'default';
389 $this->notification_type = $a_notification_type;
401 return "empty_subject";
405 return "preset_subject";
409 return "add_re_to_subject";
412 return "preset_subject";
417 if ($a_subject_setting ===
'empty_subject') {
420 } elseif ($a_subject_setting ===
'preset_subject') {
423 } elseif ($a_subject_setting ===
'add_re_to_subject') {
431 $this->mark_mod_posts = $a_mod_post;
441 $this->thread_sorting = $a_thread_sorting;
461 $this->file_upload_allowed = $allowed;
471 if (self::isFileUploadGloballyAllowed()) {
487 (
int) $DIC->settings()->get(
'file_upload_allowed_fora') === self::FILE_UPLOAD_GLOBALLY_ALLOWED
495 return (
bool) $DIC->settings()->get(
'send_attachments_by_mail');
bool $user_toggle_noti
Activation of allowing members to deactivate (CRS/GRP)forum notification.
setAddReSubject(bool $a_add_re_subject)
bool $preset_subject
If deactivated, user is forced to enter a new subject on repliees.
setPostActivation(bool $a_post_activation)
setUserToggleNoti(bool $a_user_toggle)
setDefaultView($a_default_view)
bool $admin_force_noti
Activation of (CRS/GRP) forum notification by mod/admin.
ILIAS Style Content Object ObjectFacade $content_style_service
setMarkModeratorPosts(bool $a_mod_post)
setStatisticsStatus(bool $a_statistic_status)
bool $is_thread_rating_enabled
setPresetSubject(bool $a_preset_subject)
const FORUM_OVERVIEW_NO_NEW_POSTS
setFileUploadAllowed(bool $allowed)
const FILE_UPLOAD_INDIVIDUAL
static getInstance(int $a_obj_id=0)
static _isAnonymized(int $a_obj_id)
static _isAdminForceNoti(int $a_obj_id)
string $notification_type
Global notification-type setting (CRS/GRP) possible values: 'all_users', 'per_user', null (default)
setThreadSorting(int $a_thread_sorting)
const FILE_UPLOAD_GLOBALLY_ALLOWED
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
int $interested_events
Preset notification events for forced notification.
static isSendAttachmentsByMailEnabled()
setAnonymisation(bool $a_anonymized)
bool $add_re_subject
Add 'Re: ' to subject on reply.
bool $post_activation_enabled
bool $file_upload_allowed
const THREAD_SORTING_DEFAULT
isIsThreadRatingEnabled()
const THREAD_SORTING_MANUAL
setLpReqNumPostings(?int $lp_req_num_postings)
const FORUM_OVERVIEW_WITH_NEW_POSTS
setNotificationType(?string $a_notification_type)
setAdminForceNoti(bool $a_admin_force)
isPostActivationEnabled()
static isFileUploadGloballyAllowed()
setInterestedEvents(int $interested_events)
setSubjectSetting($a_subject_setting)
static _isUserToggleNoti(int $a_obj_id)
setIsThreadRatingEnabled(bool $is_thread_rating_enabled)
__construct(int $a_obj_id=0)