31 public function __construct($a_data, $a_id, $a_call_by_reference =
true, $a_prepare_output =
true)
34 $this->cache =
$DIC->news()->internal()->repo()->cache();
39 $this->
lng->loadLanguageModule(
'news');
40 $this->
lng->loadLanguageModule(
'feed');
45 $next_class = $this->
ctrl->getNextClass($this);
46 $cmd = $this->
ctrl->getCmd();
50 if (!$this->rbac_system->checkAccess(
"read", $this->object->getRefId())) {
54 switch ($next_class) {
55 case 'ilpermissiongui':
56 $this->tabs_gui->setTabActive(
'perm_settings');
58 $this->
ctrl->forwardCommand($perm_gui);
62 if ($cmd ===
null || $cmd ===
'' || $cmd ===
'view') {
63 $cmd =
"editSettings";
75 if ($rbacsystem->checkAccess(
"read", $this->object->getRefId())) {
76 $this->tabs_gui->addTarget(
77 "news_edit_news_settings",
78 $this->
ctrl->getLinkTarget($this,
"editSettings"),
79 [
"editSettings",
"view"]
83 if ($rbacsystem->checkAccess(
'edit_permission', $this->object->getRefId())) {
84 $this->tabs_gui->addTarget(
86 $this->
ctrl->getLinkTargetByClass(ilPermissionGUI::class,
"perm"),
88 ilPermissionGUI::class
96 $this->tpl->setContent($form->getHTML());
109 $enable_internal_news =
$ilSetting->get(
"block_activated_news");
110 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
111 $rss_title_format = $news_set->get(
"rss_title_format");
112 $enable_private_feed = $news_set->get(
"enable_private_feed");
113 $news_default_visibility = ($news_set->get(
"default_visibility") !=
"")
114 ? $news_set->get(
"default_visibility")
117 $allow_shorter_periods = $news_set->get(
"allow_shorter_periods");
118 $allow_longer_periods = $news_set->get(
"allow_longer_periods");
123 $form->setFormAction($ilCtrl->getFormAction($this));
124 $form->setTitle(
$lng->
txt(
"news_settings"));
128 $lng->
txt(
"news_enable_internal_news"),
129 "enable_internal_news"
131 $cb_prop->setValue(
"1");
132 $cb_prop->setInfo(
$lng->
txt(
"news_enable_internal_news_info"));
133 $cb_prop->setChecked((
bool) $enable_internal_news);
134 $form->addItem($cb_prop);
139 $radio_group->addOption($radio_option);
141 $radio_group->addOption($radio_option);
142 $radio_group->setInfo(
$lng->
txt(
"news_news_item_visibility_info"));
143 $radio_group->setRequired(
false);
144 $radio_group->setValue($news_default_visibility);
145 $form->addItem($radio_group);
148 $nr_opts = [50 => 50, 100 => 100, 200 => 200];
153 $nr_sel->setInfo(
$lng->
txt(
"news_nr_of_items_info"));
154 $nr_sel->setOptions($nr_opts);
155 $nr_sel->setValue((
string) $news_set->get(
"max_items"));
156 $form->addItem($nr_sel);
159 $min_opts = [0 => 0, 1 => 1, 2 => 2, 5 => 5, 10 => 10, 20 => 20, 30 => 30, 60 => 60];
162 "news_acc_cache_mins"
164 $min_sel->setInfo(
$lng->
txt(
"news_cache_info"));
165 $min_sel->setOptions($min_opts);
166 $min_sel->setValue((
string) $news_set->get(
"acc_cache_mins"));
167 $form->addItem($min_sel);
172 30 =>
"1 " .
$lng->
txt(
"month"),
173 366 =>
"1 " .
$lng->
txt(
"year")
179 $per_sel->setInfo(
$lng->
txt(
"news_pd_period_info"));
180 $per_sel->setOptions($per_opts);
182 $form->addItem($per_sel);
186 $lng->
txt(
"news_allow_shorter_periods"),
187 "allow_shorter_periods"
189 $sp_prop->setValue(
"1");
190 $sp_prop->setInfo(
$lng->
txt(
"news_allow_shorter_periods_info"));
191 $sp_prop->setChecked((
bool) $allow_shorter_periods);
192 $form->addItem($sp_prop);
196 $lng->
txt(
"news_allow_longer_periods"),
197 "allow_longer_periods"
199 $lp_prop->setValue(
"1");
200 $lp_prop->setInfo(
$lng->
txt(
"news_allow_longer_periods_info"));
201 $lp_prop->setChecked((
bool) $allow_longer_periods);
202 $form->addItem($lp_prop);
206 $lng->
txt(
"news_enable_internal_rss"),
207 "enable_internal_rss"
209 $cb_prop->setValue(
"1");
210 $cb_prop->setInfo(
$lng->
txt(
"news_enable_internal_rss_info"));
211 $cb_prop->setChecked((
bool) $enable_internal_rss);
219 14 =>
"2 " .
$lng->
txt(
"weeks"),
220 30 =>
"1 " .
$lng->
txt(
"month"),
221 60 =>
"2 " .
$lng->
txt(
"months"),
222 120 =>
"4 " .
$lng->
txt(
"months"),
223 180 =>
"6 " .
$lng->
txt(
"months"),
224 365 =>
"1 " .
$lng->
txt(
"year")
230 $rssp_sel->setOptions($rssp_opts);
231 $rssp_sel->setValue($rss_period);
232 $cb_prop->addSubItem($rssp_sel);
236 $sh->setTitle(
$lng->
txt(
"news_rss"));
241 "" =>
$lng->
txt(
"news_rss_title_format_obj_news"),
242 "news_obj" =>
$lng->
txt(
"news_rss_title_format_news_obj"),
246 $si->setValue($rss_title_format);
247 $cb_prop->addSubItem($si);
249 $form->addItem($cb_prop);
253 $lng->
txt(
"news_enable_private_feed"),
254 "enable_private_feed"
256 $cb_prop->setValue(
"1");
257 $cb_prop->setInfo(
$lng->
txt(
"news_enable_private_feed_info"));
258 $cb_prop->setChecked((
bool) $enable_private_feed);
259 $form->addItem($cb_prop);
261 if ($ilAccess->checkAccess(
'write',
'', $this->object->getRefId())) {
263 $form->addCommandButton(
"saveSettings",
$lng->
txt(
"save"));
264 $form->addCommandButton(
"view",
$lng->
txt(
"cancel"));
275 if (!$ilAccess->checkAccess(
'write',
'', $this->object->getRefId())) {
276 $ilCtrl->redirect($this,
"view");
280 $this->cache->flush();
287 if ($form->checkInput()) {
288 $ilSetting->set(
"block_activated_news", $form->getInput(
"enable_internal_news"));
289 $ilSetting->set(
"block_activated_pdnews", $form->getInput(
"enable_internal_news"));
290 $news_set->set(
"enable_rss_for_internal", $form->getInput(
"enable_internal_rss"));
291 $news_set->set(
"max_items", $form->getInput(
"news_max_items"));
292 $news_set->set(
"acc_cache_mins", $form->getInput(
"news_acc_cache_mins"));
293 $news_set->set(
"pd_period", $form->getInput(
"news_pd_period"));
294 $news_set->set(
"default_visibility", $form->getInput(
"news_default_visibility"));
295 $news_set->set(
"allow_shorter_periods", $form->getInput(
"allow_shorter_periods"));
296 $news_set->set(
"allow_longer_periods", $form->getInput(
"allow_longer_periods"));
297 $news_set->set(
"rss_period", $form->getInput(
"news_rss_period"));
298 $news_set->set(
"rss_title_format", $form->getInput(
"rss_title_format"));
300 if ($form->getInput(
"enable_internal_rss")) {
301 $news_set->set(
"enable_private_feed", $form->getInput(
"enable_private_feed"));
303 $news_set->set(
"enable_private_feed",
'0');
306 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"settings_saved"),
true);
309 $ilCtrl->redirect($this,
"view");
Multi-Level News Cache Implementation:
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _lookupRSSPeriod()
static _lookupDefaultPDPeriod()
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
getAdminTabs()
administration tabs show only permissions and trash folder
readonly NewsCache $cache
Class ilObjectGUI Basic methods of all Output classes.
ilRbacSystem $rbac_system
prepareOutput(bool $show_sub_objects=true)
This class represents an option in a radio group.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc