19 declare(strict_types=1);
71 $this->db = $DIC->database();
73 $this->content_style_service = $DIC
76 ->styleForObjId($obj_id);
81 if (!isset(self::$instances[$a_obj_id])) {
82 self::$instances[$a_obj_id] =
new self($a_obj_id);
85 return self::$instances[$a_obj_id];
88 private function read(): void
90 if ($this->obj_id !== 0) {
91 $res = $this->db->queryF(
92 'SELECT * FROM frm_settings WHERE obj_id = %s',
97 $row = $this->db->fetchObject(
$res);
98 if (is_object($row)) {
101 $this->default_view = (
int) $row->default_view;
102 $this->anonymized = (
bool) $row->anonymized;
103 $this->statistics_enabled = (bool) $row->statistics_enabled;
104 $this->post_activation_enabled = (
bool) $row->post_activation;
105 $this->admin_force_noti = (bool) $row->admin_force_noti;
106 $this->user_toggle_noti = (
bool) $row->user_toggle_noti;
107 $this->preset_subject = (bool) $row->preset_subject;
108 $this->add_re_subject = (
bool) $row->add_re_subject;
109 $this->interested_events = (
int) $row->interested_events;
111 $this->notification_type = $row->notification_type ??
'default';
112 $this->mark_mod_posts = (
bool) $row->mark_mod_posts;
113 $this->is_thread_rating_enabled = (bool) $row->thread_rating;
114 $this->file_upload_allowed = (
bool) $row->file_upload_allowed;
115 if (is_numeric($row->lp_req_num_postings)) {
116 $this->lp_req_num_postings = (
int) $row->lp_req_num_postings;
124 if ($this->obj_id && !$this->exists) {
128 'obj_id' => [
'integer', $this->obj_id],
129 'default_view' => [
'integer', $this->default_view],
130 'anonymized' => [
'integer', (
int) $this->anonymized],
131 'statistics_enabled' => [
'integer', (
int) $this->statistics_enabled],
132 'post_activation' => [
'integer', (
int) $this->post_activation_enabled],
133 'admin_force_noti' => [
'integer', (
int) $this->admin_force_noti],
134 'user_toggle_noti' => [
'integer', (
int) $this->user_toggle_noti],
135 'preset_subject' => [
'integer', (
int) $this->preset_subject],
136 'add_re_subject' => [
'integer', (
int) $this->add_re_subject],
137 'notification_type' => [
'text', $this->notification_type],
138 'mark_mod_posts' => [
'integer', (
int) $this->mark_mod_posts],
139 'thread_rating' => [
'integer', (
int) $this->is_thread_rating_enabled],
140 'file_upload_allowed' => [
'integer', (
int) $this->file_upload_allowed],
141 'lp_req_num_postings' => [
'integer', $this->lp_req_num_postings],
142 'interested_events' => [
'integer', $this->interested_events]
145 $this->exists =
true;
151 if ($this->obj_id !== 0) {
152 if (!$this->exists) {
160 'default_view' => [
'integer', $this->default_view],
161 'anonymized' => [
'integer', (
int) $this->anonymized],
162 'statistics_enabled' => [
'integer', (
int) $this->statistics_enabled],
163 'post_activation' => [
'integer', (
int) $this->post_activation_enabled],
164 'admin_force_noti' => [
'integer', (
int) $this->admin_force_noti],
165 'user_toggle_noti' => [
'integer', (
int) $this->user_toggle_noti],
166 'preset_subject' => [
'integer', (
int) $this->preset_subject],
167 'add_re_subject' => [
'integer', (
int) $this->add_re_subject],
168 'notification_type' => [
'text', $this->notification_type],
169 'mark_mod_posts' => [
'integer', (
int) $this->mark_mod_posts],
170 'thread_rating' => [
'integer', (
int) $this->is_thread_rating_enabled],
171 'file_upload_allowed' => [
'integer', (
int) $this->file_upload_allowed],
172 'lp_req_num_postings' => [
'integer', (
int) $this->lp_req_num_postings],
173 'interested_events' => [
'integer', $this->interested_events]
176 'obj_id' => [
'integer', $this->obj_id]
182 public function copy(
int $a_new_obj_id): bool
184 if ($a_new_obj_id !== 0) {
185 $this->content_style_service->cloneTo($a_new_obj_id);
190 'default_view' => [
'integer', $this->default_view],
191 'anonymized' => [
'integer', (
int) $this->anonymized],
192 'statistics_enabled' => [
'integer', (
int) $this->statistics_enabled],
193 'post_activation' => [
'integer', (
int) $this->post_activation_enabled],
194 'admin_force_noti' => [
'integer', (
int) $this->admin_force_noti],
195 'user_toggle_noti' => [
'integer', (
int) $this->user_toggle_noti],
196 'preset_subject' => [
'integer', (
int) $this->preset_subject],
197 'add_re_subject' => [
'integer', (
int) $this->add_re_subject],
198 'notification_type' => [
'text', $this->notification_type],
199 'mark_mod_posts' => [
'integer', (
int) $this->mark_mod_posts],
200 'thread_rating' => [
'integer', (
int) $this->is_thread_rating_enabled],
201 'file_upload_allowed' => [
'integer', (
int) $this->file_upload_allowed],
202 'lp_req_num_postings' => [
'integer', $this->lp_req_num_postings],
203 'interested_events' => [
'integer', $this->interested_events]
206 'obj_id' => [
'integer', $a_new_obj_id]
228 $this->default_view = $a_default_view;
238 $this->statistics_enabled = $a_statistic_status;
248 $this->anonymized = $a_anonymized;
259 $ilDB = $DIC->database();
261 $result =
$ilDB->queryF(
262 'SELECT anonymized FROM frm_settings WHERE obj_id = %s',
267 while ($record =
$ilDB->fetchAssoc($result)) {
268 return (
bool) $record[
'anonymized'];
276 $this->post_activation_enabled = $a_post_activation;
286 $this->obj_id = $a_obj_id;
292 return $this->obj_id;
297 $this->admin_force_noti = $a_admin_force;
307 $this->user_toggle_noti = $a_user_toggle;
319 $ilDB = $DIC->database();
322 'SELECT admin_force_noti FROM frm_settings WHERE obj_id = %s',
327 return (
bool) $record[
'admin_force_noti'];
337 $ilDB = $DIC->database();
340 'SELECT user_toggle_noti FROM frm_settings WHERE obj_id = %s',
344 while ($record =
$ilDB->fetchAssoc(
$res)) {
345 return (
bool) $record[
'user_toggle_noti'];
353 $this->preset_subject = $a_preset_subject;
363 $this->add_re_subject = $a_add_re_subject;
373 if ($a_notification_type ===
null) {
374 $this->notification_type =
'default';
376 $this->notification_type = $a_notification_type;
388 return "empty_subject";
392 return "preset_subject";
396 return "add_re_to_subject";
399 return "preset_subject";
404 if ($a_subject_setting ===
'empty_subject') {
407 } elseif ($a_subject_setting ===
'preset_subject') {
410 } elseif ($a_subject_setting ===
'add_re_to_subject') {
418 $this->mark_mod_posts = $a_mod_post;
438 $this->file_upload_allowed = $allowed;
448 if (self::isFileUploadGloballyAllowed()) {
460 (
int) $DIC->settings()->get(
'file_upload_allowed_fora') === self::FILE_UPLOAD_GLOBALLY_ALLOWED
468 return (
bool) $DIC->settings()->get(
'send_attachments_by_mail');
const PAGE_NAME_THREAD_OVERVIEW
setDefaultView(int $a_default_view)
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)
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)
setFileUploadAllowed(bool $allowed)
const FILE_UPLOAD_INDIVIDUAL
static getInstance(int $a_obj_id=0)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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)
readonly ilDBInterface $db
const FILE_UPLOAD_GLOBALLY_ALLOWED
int $interested_events
Preset notification events for forced notification.
static isSendAttachmentsByMailEnabled()
setAnonymisation(bool $a_anonymized)
__construct(private int $obj_id=0)
bool $add_re_subject
Add 'Re: ' to subject on reply.
bool $post_activation_enabled
const PAGE_SIZE_THREAD_OVERVIEW
bool $file_upload_allowed
isIsThreadRatingEnabled()
setLpReqNumPostings(?int $lp_req_num_postings)
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)