19 declare(strict_types=1);
30 private \ILIAS\DI\RBACServices
$rbac;
33 public function __construct($a_data,
int $a_id,
bool $a_call_by_reference =
true,
bool $a_prepare_output =
true)
40 $this->
rbac = $DIC->rbac();
41 $this->cronManager = $DIC->cron()->manager();
45 $this->
lng->loadLanguageModule(
'forum');
50 if (!$this->
rbac->system()->checkAccess(
'visible,read', $this->
object->getRefId())) {
51 $this->error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
54 $next_class = $this->
ctrl->getNextClass($this);
55 $cmd = $this->
ctrl->getCmd();
59 switch ($next_class) {
60 case 'ilpermissiongui':
61 $this->tabs_gui->setTabActive(
'perm_settings');
66 if (!$cmd || $cmd ===
'view') {
67 $cmd =
'editSettings';
77 if ($this->
rbac->system()->checkAccess(
'visible,read', $this->
object->getRefId())) {
78 $this->tabs_gui->addTarget(
80 $this->
ctrl->getLinkTarget($this,
'editSettings'),
81 [
'editSettings',
'view']
85 if ($this->
rbac->system()->checkAccess(
'edit_permission', $this->
object->getRefId())) {
86 $this->tabs_gui->addTarget(
88 $this->
ctrl->getLinkTargetByClass(ilPermissionGUI::class,
'perm'),
97 $this->tabs_gui->activateTab(
'settings');
104 $this->tpl->setContent($form->getHTML());
112 if (!$form->checkInput()) {
113 $form->setValuesByPost();
119 $frma_set->set(
'forum_overview', (
string) $form->getInput(
'forum_overview'));
120 $this->
settings->set(
'file_upload_allowed_fora', (
string) ((
int) $form->getInput(
'file_upload_allowed_fora')));
121 $this->
settings->set(
'send_attachments_by_mail', (
string) ((
int) $form->getInput(
'send_attachments_by_mail')));
122 $this->
settings->set(
'enable_fora_statistics', (
string) ((
int) $form->getInput(
'fora_statistics')));
123 $this->
settings->set(
'enable_anonymous_fora', (
string) ((
int) $form->getInput(
'anonymous_fora')));
125 if (!$this->cronManager->isJobActive(
'frm_notification')) {
126 $this->
settings->set(
'forum_notification', (
string) ((
int) $form->getInput(
'forum_notification')));
129 $this->
settings->set(
'save_post_drafts', (
string) ((
int) $form->getInput(
'save_post_drafts')));
130 $this->
settings->set(
'autosave_drafts', (
string) ((
int) $form->getInput(
'autosave_drafts')));
131 $this->
settings->set(
'autosave_drafts_ival', (
string) ((
int) $form->getInput(
'autosave_drafts_ival')));
133 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'));
134 $form->setValuesByPost();
144 'fora_statistics' => (bool) $this->
settings->get(
'enable_fora_statistics'),
145 'anonymous_fora' => (bool) $this->
settings->get(
'enable_anonymous_fora'),
146 'forum_notification' => (
int) $this->
settings->get(
'forum_notification',
'0') === 1,
147 'file_upload_allowed_fora' => (
int) $this->
settings->get(
148 'file_upload_allowed_fora',
151 'save_post_drafts' => (
int) $this->
settings->get(
'save_post_drafts',
'0'),
152 'autosave_drafts' => (
int) $this->
settings->get(
'autosave_drafts',
'0'),
153 'autosave_drafts_ival' => (
int) $this->
settings->get(
'autosave_drafts_ival',
'30'),
154 'send_attachments_by_mail' => (bool) $this->
settings->get(
'send_attachments_by_mail')
161 $form->setFormAction($this->
ctrl->getFormAction($this,
'saveSettings'));
162 $form->setTitle($this->
lng->txt(
'settings'));
166 $this->
lng->txt(
'frm_all_postings_stats') .
', ' . $this->
lng->txt(
'unread') .
', ' . $this->
lng->txt(
'new'),
170 $this->
lng->txt(
'frm_all_postings_stats') .
', ' . $this->
lng->txt(
'unread'),
173 $frm_radio->setInfo($this->
lng->txt(
'frm_disp_info_desc'));
174 $form->addItem($frm_radio);
177 $check->setInfo($this->
lng->txt(
'enable_fora_statistics_desc'));
181 $check->setInfo($this->
lng->txt(
'enable_anonymous_fora_desc'));
185 $this->
lng->txt(
'file_upload_allowed_fora'),
186 'file_upload_allowed_fora' 189 $this->
lng->txt(
'file_upload_option_allow'),
191 $this->
lng->txt(
'file_upload_option_allow_info')
193 $file_upload->addOption($option_all_forums);
196 $this->
lng->txt(
'file_upload_option_disallow'),
198 $this->
lng->txt(
'file_upload_allowed_fora_desc')
200 $file_upload->addOption($option_per_forum);
202 $form->addItem($file_upload);
204 if ($this->cronManager->isJobActive(
'frm_notification')) {
211 $notifications =
new ilCheckboxInputGUI($this->
lng->txt(
'cron_forum_notification'),
'forum_notification');
212 $notifications->
setInfo($this->
lng->txt(
'cron_forum_notification_desc'));
213 $notifications->setValue(
'1');
214 $form->addItem($notifications);
218 $check->setInfo($this->
lng->txt(
'enable_send_attachments_desc'));
223 $drafts->
setInfo($this->
lng->txt(
'adm_save_drafts_desc'));
224 $drafts->setValue(
'1');
226 $autosave_drafts =
new ilCheckboxInputGUI($this->
lng->txt(
'adm_autosave_drafts'),
'autosave_drafts');
227 $autosave_drafts->
setInfo($this->
lng->txt(
'adm_autosave_drafts_desc'));
228 $autosave_drafts->setValue(
'1');
230 $autosave_interval =
new ilNumberInputGUI($this->
lng->txt(
'adm_autosave_ival'),
'autosave_drafts_ival');
232 $autosave_interval->setMinValue(30);
233 $autosave_interval->setMaxValue(60 * 60);
234 $autosave_interval->setSize(10);
235 $autosave_interval->setRequired(
true);
236 $autosave_interval->setSuffix($this->
lng->txt(
'seconds'));
237 $autosave_drafts->addSubItem($autosave_interval);
238 $drafts->addSubItem($autosave_drafts);
239 $form->addItem($drafts);
242 $form->addCommandButton(
'saveSettings', $this->
lng->txt(
'save'));
250 switch ($a_form_id) {
254 'enable_fora_statistics' => [
255 (bool) $this->
settings->get(
'enable_fora_statistics',
'0'),
258 'enable_anonymous_fora' => [
259 (bool) $this->
settings->get(
'enable_anonymous_fora',
'0'),
264 return [[
'editSettings', $fields]];
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct($data, int $id=0, bool $call_by_reference=true, bool $prepare_output=true)
prepareOutput(bool $show_sub_objects=true)
ilCronManager $cronManager
populateForm(ilPropertyFormGUI $form)
const FORUM_OVERVIEW_NO_NEW_POSTS
const FILE_UPLOAD_INDIVIDUAL
const FILE_UPLOAD_GLOBALLY_ALLOWED
editSettings(ilPropertyFormGUI $form=null)
Class ilObjectGUI Basic methods of all Output classes.
ILIAS DI RBACServices $rbac
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
Forum Administration Settings.
const FORUM_OVERVIEW_WITH_NEW_POSTS
__construct(Container $dic, ilPlugin $plugin)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
addToExternalSettingsForm(int $a_form_id)