19declare(strict_types=1);
69 $this->db =
$DIC->database();
77 if ($this->content_style_service ===
null) {
78 $this->content_style_service =
$DIC->contentStyle()->domain()->styleForObjId($this->obj_id);
86 if (!isset(self::$instances[$a_obj_id])) {
87 self::$instances[$a_obj_id] =
new self($a_obj_id);
90 return self::$instances[$a_obj_id];
93 private function read(): void
95 if ($this->obj_id !== 0) {
96 $res = $this->db->queryF(
97 'SELECT * FROM frm_settings WHERE obj_id = %s',
102 $row = $this->db->fetchObject(
$res);
103 if (is_object($row)) {
104 $this->exists =
true;
106 $this->default_view = (
int) $row->default_view;
107 $this->anonymized = (
bool) $row->anonymized;
108 $this->statistics_enabled = (bool) $row->statistics_enabled;
109 $this->post_activation_enabled = (
bool) $row->post_activation;
110 $this->admin_force_noti = (bool) $row->admin_force_noti;
111 $this->user_toggle_noti = (
bool) $row->user_toggle_noti;
112 $this->preset_subject = (bool) $row->preset_subject;
113 $this->add_re_subject = (
bool) $row->add_re_subject;
114 $this->interested_events = (
int) $row->interested_events;
116 $this->notification_type =
119 $this->mark_mod_posts = (bool) $row->mark_mod_posts;
120 $this->is_thread_rating_enabled = (
bool) $row->thread_rating;
121 $this->file_upload_allowed = (bool) $row->file_upload_allowed;
122 if (is_numeric($row->lp_req_num_postings)) {
123 $this->lp_req_num_postings = (
int) $row->lp_req_num_postings;
131 if ($this->obj_id && !$this->exists) {
135 'obj_id' => [
'integer', $this->obj_id],
136 'default_view' => [
'integer', $this->default_view],
137 'anonymized' => [
'integer', (
int) $this->anonymized],
138 'statistics_enabled' => [
'integer', (
int) $this->statistics_enabled],
139 'post_activation' => [
'integer', (
int) $this->post_activation_enabled],
140 'admin_force_noti' => [
'integer', (
int) $this->admin_force_noti],
141 'user_toggle_noti' => [
'integer', (
int) $this->user_toggle_noti],
142 'preset_subject' => [
'integer', (
int) $this->preset_subject],
143 'add_re_subject' => [
'integer', (
int) $this->add_re_subject],
144 'notification_type' => [
'text', $this->notification_type->value],
145 'mark_mod_posts' => [
'integer', (
int) $this->mark_mod_posts],
146 'thread_rating' => [
'integer', (
int) $this->is_thread_rating_enabled],
147 'file_upload_allowed' => [
'integer', (
int) $this->file_upload_allowed],
148 'lp_req_num_postings' => [
'integer', $this->lp_req_num_postings],
149 'interested_events' => [
'integer', $this->interested_events]
152 $this->exists =
true;
158 if ($this->obj_id !== 0) {
159 if (!$this->exists) {
167 'default_view' => [
'integer', $this->default_view],
168 'anonymized' => [
'integer', (
int) $this->anonymized],
169 'statistics_enabled' => [
'integer', (
int) $this->statistics_enabled],
170 'post_activation' => [
'integer', (
int) $this->post_activation_enabled],
171 'admin_force_noti' => [
'integer', (
int) $this->admin_force_noti],
172 'user_toggle_noti' => [
'integer', (
int) $this->user_toggle_noti],
173 'preset_subject' => [
'integer', (
int) $this->preset_subject],
174 'add_re_subject' => [
'integer', (
int) $this->add_re_subject],
175 'notification_type' => [
'text', $this->notification_type->value],
176 'mark_mod_posts' => [
'integer', (
int) $this->mark_mod_posts],
177 'thread_rating' => [
'integer', (
int) $this->is_thread_rating_enabled],
178 'file_upload_allowed' => [
'integer', (
int) $this->file_upload_allowed],
179 'lp_req_num_postings' => [
'integer', (
int) $this->lp_req_num_postings],
180 'interested_events' => [
'integer', $this->interested_events]
183 'obj_id' => [
'integer', $this->obj_id]
189 public function copy(
int $a_new_obj_id): bool
191 if ($a_new_obj_id !== 0) {
197 'default_view' => [
'integer', $this->default_view],
198 'anonymized' => [
'integer', (
int) $this->anonymized],
199 'statistics_enabled' => [
'integer', (
int) $this->statistics_enabled],
200 'post_activation' => [
'integer', (
int) $this->post_activation_enabled],
201 'admin_force_noti' => [
'integer', (
int) $this->admin_force_noti],
202 'user_toggle_noti' => [
'integer', (
int) $this->user_toggle_noti],
203 'preset_subject' => [
'integer', (
int) $this->preset_subject],
204 'add_re_subject' => [
'integer', (
int) $this->add_re_subject],
205 'notification_type' => [
'text', $this->notification_type->value],
206 'mark_mod_posts' => [
'integer', (
int) $this->mark_mod_posts],
207 'thread_rating' => [
'integer', (
int) $this->is_thread_rating_enabled],
208 'file_upload_allowed' => [
'integer', (
int) $this->file_upload_allowed],
209 'lp_req_num_postings' => [
'integer', $this->lp_req_num_postings],
210 'interested_events' => [
'integer', $this->interested_events]
213 'obj_id' => [
'integer', $a_new_obj_id]
235 $this->default_view = $a_default_view;
245 $this->statistics_enabled = $a_statistic_status;
255 $this->anonymized = $a_anonymized;
268 $result =
$ilDB->queryF(
269 'SELECT anonymized FROM frm_settings WHERE obj_id = %s',
274 while ($record =
$ilDB->fetchAssoc($result)) {
275 return (
bool) $record[
'anonymized'];
283 $this->post_activation_enabled = $a_post_activation;
293 $this->obj_id = $a_obj_id;
299 return $this->obj_id;
304 $this->admin_force_noti = $a_admin_force;
314 $this->user_toggle_noti = $a_user_toggle;
329 'SELECT admin_force_noti FROM frm_settings WHERE obj_id = %s',
334 return (
bool) $record[
'admin_force_noti'];
347 'SELECT user_toggle_noti FROM frm_settings WHERE obj_id = %s',
351 while ($record =
$ilDB->fetchAssoc(
$res)) {
352 return (
bool) $record[
'user_toggle_noti'];
360 $this->preset_subject = $a_preset_subject;
370 $this->add_re_subject = $a_add_re_subject;
380 $this->notification_type = $a_notification_type;
391 return "empty_subject";
395 return "preset_subject";
399 return "add_re_to_subject";
402 return "preset_subject";
407 if ($a_subject_setting ===
'empty_subject') {
410 } elseif ($a_subject_setting ===
'preset_subject') {
413 } elseif ($a_subject_setting ===
'add_re_to_subject') {
421 $this->mark_mod_posts = $a_mod_post;
441 $this->file_upload_allowed = $allowed;
451 if (self::isFileUploadGloballyAllowed()) {
463 (
int)
$DIC->settings()->get(
'file_upload_allowed_fora') === self::FILE_UPLOAD_GLOBALLY_ALLOWED
471 return (
bool)
$DIC->settings()->get(
'send_attachments_by_mail');
External facade for object content styles.
bool $post_activation_enabled
static _isAdminForceNoti(int $a_obj_id)
static _isUserToggleNoti(int $a_obj_id)
const PAGE_NAME_THREAD_OVERVIEW
const FILE_UPLOAD_INDIVIDUAL
setUserToggleNoti(bool $a_user_toggle)
setSubjectSetting($a_subject_setting)
int $interested_events
Preset notification events for forced notification.
setNotificationType(NotificationType $a_notification_type)
bool $user_toggle_noti
Activation of allowing members to deactivate (CRS/GRP)forum notification.
static isSendAttachmentsByMailEnabled()
setDefaultView(int $a_default_view)
bool $is_thread_rating_enabled
static _isAnonymized(int $a_obj_id)
setMarkModeratorPosts(bool $a_mod_post)
isPostActivationEnabled()
setFileUploadAllowed(bool $allowed)
NotificationType $notification_type
setPostActivation(bool $a_post_activation)
static getInstance(int $a_obj_id=0)
readonly ilDBInterface $db
const FILE_UPLOAD_GLOBALLY_ALLOWED
setAdminForceNoti(bool $a_admin_force)
setAnonymisation(bool $a_anonymized)
setLpReqNumPostings(?int $lp_req_num_postings)
const PAGE_SIZE_THREAD_OVERVIEW
ILIAS Style Content Object ObjectFacade $content_style_service
setPresetSubject(bool $a_preset_subject)
static isFileUploadGloballyAllowed()
setIsThreadRatingEnabled(bool $is_thread_rating_enabled)
setInterestedEvents(int $interested_events)
bool $preset_subject
If deactivated, user is forced to enter a new subject on repliees.
bool $admin_force_noti
Activation of (CRS/GRP) forum notification by mod/admin.
bool $file_upload_allowed
setAddReSubject(bool $a_add_re_subject)
isIsThreadRatingEnabled()
bool $add_re_subject
Add 'Re: ' to subject on reply.
__construct(private int $obj_id=0)
setStatisticsStatus(bool $a_statistic_status)
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
if(!file_exists('../ilias.ini.php'))