108 $this->obj_id = $a_obj_id;
118 if (!self::$instances[$a_obj_id])
123 return self::$instances[$a_obj_id];
130 $res = $this->db->queryf(
'
131 SELECT * FROM frm_settings
133 array(
'integer'), array($this->obj_id));
135 $row = $this->db->fetchObject(
$res);
139 $this->default_view =
$row->default_view;
140 $this->anonymized =
$row->anonymized ;
141 $this->statistics_enabled =
$row->statistics_enabled ;
142 $this->post_activation_enabled =
$row->post_activation ;
143 $this->admin_force_noti =
$row->admin_force_noti == 1 ?
true :
false;
144 $this->user_toggle_noti =
$row->user_toggle_noti == 1 ?
true :
false;
145 $this->preset_subject =
$row->preset_subject;
146 $this->add_re_subject =
$row->add_re_subject;
148 $this->notification_type =
$row->notification_type == null ?
'default':
$row->notification_type;
149 $this->mark_mod_posts =
$row->mark_mod_posts == 1 ?
true :
false;
164 $this->db->insert(
'frm_settings',
165 array(
'obj_id' => array(
'integer', $this->obj_id),
166 'default_view' => array(
'integer', $this->default_view),
167 'anonymized' => array(
'integer', $this->anonymized),
168 'statistics_enabled'=> array(
'integer', $this->statistics_enabled),
169 'post_activation' => array(
'integer', $this->post_activation_enabled),
170 'admin_force_noti' => array(
'integer', $this->admin_force_noti),
171 'user_toggle_noti' => array(
'integer', $this->user_toggle_noti),
172 'preset_subject' => array(
'integer', $this->preset_subject),
173 'add_re_subject' => array(
'integer', $this->add_re_subject),
174 'notification_type' => array(
'text', $this->notification_type),
175 'mark_mod_posts' => array(
'integer', $this->mark_mod_posts))
188 $this->db->update(
'frm_settings',
189 array(
'default_view' => array(
'integer', $this->default_view),
190 'anonymized' => array(
'integer', $this->anonymized),
191 'statistics_enabled'=> array(
'integer', $this->statistics_enabled),
192 'post_activation' => array(
'integer', $this->post_activation_enabled),
193 'admin_force_noti' => array(
'integer', $this->admin_force_noti),
194 'user_toggle_noti' => array(
'integer', $this->user_toggle_noti),
195 'preset_subject' => array(
'integer', $this->preset_subject),
196 'add_re_subject' => array(
'integer', $this->add_re_subject),
197 'notification_type' => array(
'text', $this->notification_type),
198 'mark_mod_posts' => array(
'integer', $this->mark_mod_posts)),
199 array(
'obj_id' => array(
'integer', $this->obj_id))
206 public function copy($a_new_obj_id)
210 $this->db->insert(
'frm_settings',
211 array(
'obj_id' => array(
'integer', $a_new_obj_id),
212 'default_view' => array(
'integer', $this->default_view),
213 'anonymized' => array(
'integer', $this->anonymized),
214 'statistics_enabled'=> array(
'integer', $this->statistics_enabled),
215 'post_activation' => array(
'integer', $this->post_activation_enabled),
216 'admin_force_noti' => array(
'integer', $this->admin_force_noti),
217 'user_toggle_noti' => array(
'integer', $this->user_toggle_noti),
218 'preset_subject' => array(
'integer', $this->preset_subject),
219 'add_re_subject' => array(
'integer', $this->add_re_subject),
220 'notification_type' => array(
'text', $this->notification_type),
221 'mark_mod_posts' => array(
'integer', $this->mark_mod_posts))
231 $this->default_view = $a_default_view;
239 $this->statistics_enabled = $a_statistic_status;
247 $this->anonymized = $a_anonymized;
257 $result = $ilDB->queryf(
"SELECT anonymized FROM frm_settings WHERE obj_id = %s",
258 array(
'integer'),array($a_obj_id));
260 while($record = $ilDB->fetchAssoc(
$result))
262 return $record[
'anonymized'];
270 $this->post_activation_enabled = $a_post_activation;
278 $this->obj_id = $a_obj_id;
288 $this->admin_force_noti = $a_admin_force;
298 $this->user_toggle_noti = $a_user_toggle;
310 $res = $ilDB->queryF(
"SELECT admin_force_noti FROM frm_settings WHERE obj_id = %s",
313 while($record = $ilDB->fetchAssoc(
$res))
315 return $record[
'admin_force_noti'];
325 $res = $ilDB->queryF(
"SELECT user_toggle_noti FROM frm_settings WHERE obj_id = %s",
328 while($record = $ilDB->fetchAssoc(
$res))
330 return $record[
'user_toggle_noti'];
337 if(null === $a_allow_rating)
342 $this->thread_ratings_allowed = $a_allow_rating;
349 $this->preset_subject = $a_preset_subject;
357 $this->add_re_subject = $a_add_re_subject;
366 if($a_notification_type == null)
367 $this->notification_type =
'default';
369 $this->notification_type = $a_notification_type;
381 return "empty_subject";
385 return "preset_subject";
389 return "add_re_to_subject";
391 else return "preset_subject";
395 if($a_subject_setting ==
'empty_subject')
400 else if($a_subject_setting ==
'preset_subject')
405 else if($a_subject_setting ==
'add_re_to_subject')
414 $this->mark_mod_posts = $a_mod_post;