3 include_once(
"./Services/Object/classes/class.ilObjectGUI.php");
24 public function __construct($a_data, $a_id, $a_call_by_reference =
true, $a_prepare_output =
true)
29 $this->lng->loadLanguageModule(
'news');
30 $this->lng->loadLanguageModule(
'feed');
42 global $rbacsystem,
$ilErr,$ilAccess;
44 $next_class = $this->ctrl->getNextClass($this);
45 $cmd = $this->ctrl->getCmd();
49 if(!$ilAccess->checkAccess(
'read',
'',$this->object->getRefId()))
51 $ilErr->raiseError($this->lng->txt(
'no_permission'),$ilErr->WARNING);
56 case 'ilpermissiongui':
57 $this->tabs_gui->setTabActive(
'perm_settings');
58 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
60 $ret =& $this->ctrl->forwardCommand($perm_gui);
66 $cmd =
"editSettings";
83 global $rbacsystem, $ilAccess;
85 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
87 $this->tabs_gui->addTarget(
"news_edit_news_settings",
88 $this->ctrl->getLinkTarget($this,
"editSettings"),
89 array(
"editSettings",
"view"));
92 if ($rbacsystem->checkAccess(
'edit_permission',$this->object->getRefId()))
94 $this->tabs_gui->addTarget(
"perm_settings",
95 $this->ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm"),
96 array(),
'ilpermissiongui');
110 $enable_internal_news = $ilSetting->get(
"block_activated_news");
111 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
112 $rss_title_format = $news_set->get(
"rss_title_format");
113 $enable_private_feed = $news_set->get(
"enable_private_feed");
114 $news_default_visibility = ($news_set->get(
"default_visibility") !=
"")
115 ? $news_set->get(
"default_visibility")
117 $disable_repository_feeds =
$feed_set->get(
"disable_rep_feeds");
118 $nr_personal_desktop_feeds = $ilSetting->get(
"block_limit_pdfeed");
120 $allow_shorter_periods = $news_set->get(
"allow_shorter_periods");
121 $allow_longer_periods = $news_set->get(
"allow_longer_periods");
123 include_once(
"./Services/News/classes/class.ilNewsItem.php");
126 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
128 $form->setFormAction($ilCtrl->getFormAction($this));
129 $form->setTitle($lng->txt(
"news_settings"));
133 "enable_internal_news");
135 $cb_prop->setInfo($lng->txt(
"news_enable_internal_news_info"));
136 $cb_prop->setChecked($enable_internal_news);
137 $form->addItem($cb_prop);
140 $radio_group =
new ilRadioGroupInputGUI($lng->txt(
"news_default_visibility"),
"news_default_visibility");
141 $radio_option =
new ilRadioOption($lng->txt(
"news_visibility_users"),
"users");
142 $radio_group->addOption($radio_option);
143 $radio_option =
new ilRadioOption($lng->txt(
"news_visibility_public"),
"public");
144 $radio_group->addOption($radio_option);
145 $radio_group->
setInfo($lng->txt(
"news_news_item_visibility_info"));
146 $radio_group->setRequired(
false);
147 $radio_group->setValue($news_default_visibility);
148 $form->addItem($radio_group);
151 $nr_opts = array(50 => 50, 100 => 100, 200 => 200);
154 $nr_sel->
setInfo($lng->txt(
"news_nr_of_items_info"));
155 $nr_sel->setOptions($nr_opts);
156 $nr_sel->setValue($news_set->get(
"max_items"));
157 $form->addItem($nr_sel);
160 $min_opts = array(0 => 0, 1 => 1, 2 => 2, 5 => 5, 10 => 10, 20 => 20, 30 => 30, 60 => 60);
162 "news_acc_cache_mins");
163 $min_sel->
setInfo($lng->txt(
"news_cache_info"));
164 $min_sel->setOptions($min_opts);
165 $min_sel->setValue($news_set->get(
"acc_cache_mins"));
166 $form->addItem($min_sel);
170 2 =>
"2 ".$lng->txt(
"days"),
171 3 =>
"3 ".$lng->txt(
"days"),
172 5 =>
"5 ".$lng->txt(
"days"),
173 7 =>
"1 ".$lng->txt(
"week"),
174 14 =>
"2 ".$lng->txt(
"weeks"),
175 30 =>
"1 ".$lng->txt(
"month"),
176 60 =>
"2 ".$lng->txt(
"months"),
177 120 =>
"4 ".$lng->txt(
"months"),
178 180 =>
"6 ".$lng->txt(
"months"),
179 366 =>
"1 ".$lng->txt(
"year"));
182 $per_sel->
setInfo($lng->txt(
"news_pd_period_info"));
183 $per_sel->setOptions($per_opts);
185 $form->addItem($per_sel);
189 "allow_shorter_periods");
191 $sp_prop->setInfo($lng->txt(
"news_allow_shorter_periods_info"));
192 $sp_prop->setChecked($allow_shorter_periods);
193 $form->addItem($sp_prop);
197 "allow_longer_periods");
199 $lp_prop->setInfo($lng->txt(
"news_allow_longer_periods_info"));
200 $lp_prop->setChecked($allow_longer_periods);
201 $form->addItem($lp_prop);
205 "enable_internal_rss");
207 $cb_prop->setInfo($lng->txt(
"news_enable_internal_rss_info"));
208 $cb_prop->setChecked($enable_internal_rss);
212 2 =>
"2 ".$lng->txt(
"days"),
213 3 =>
"3 ".$lng->txt(
"days"),
214 5 =>
"5 ".$lng->txt(
"days"),
215 7 =>
"1 ".$lng->txt(
"week"),
216 14 =>
"2 ".$lng->txt(
"weeks"),
217 30 =>
"1 ".$lng->txt(
"month"),
218 60 =>
"2 ".$lng->txt(
"months"),
219 120 =>
"4 ".$lng->txt(
"months"),
220 180 =>
"6 ".$lng->txt(
"months"),
221 365 =>
"1 ".$lng->txt(
"year")
226 $rssp_sel->setValue((
int) $rss_period);
227 $cb_prop->addSubItem($rssp_sel);
231 $sh->setTitle($lng->txt(
"news_rss"));
236 "" => $lng->txt(
"news_rss_title_format_obj_news"),
237 "news_obj" => $lng->txt(
"news_rss_title_format_news_obj"),
241 $si->setValue($rss_title_format);
242 $cb_prop->addSubItem($si);
244 $form->addItem($cb_prop);
248 "enable_private_feed");
250 $cb_prop->setInfo($lng->txt(
"news_enable_private_feed_info"));
251 $cb_prop->setChecked($enable_private_feed);
252 $form->addItem($cb_prop);
257 $sh->setTitle($lng->txt(
"feed_settings"));
262 $sel->
setInfo($lng->txt(
"feed_nr_pd_feeds_info"));
263 $sel->setOptions(array(0 =>
"0",
269 $sel->setValue($nr_personal_desktop_feeds);
270 $form->addItem($sel);
274 "disable_repository_feeds");
276 $cb_prop->setInfo($lng->txt(
"feed_disable_rep_feeds_info"));
277 $cb_prop->setChecked($disable_repository_feeds);
278 $form->addItem($cb_prop);
281 $form->addCommandButton(
"saveSettings", $lng->txt(
"save"));
282 $form->addCommandButton(
"view", $lng->txt(
"cancel"));
284 $this->tpl->setContent($form->getHTML());
295 include_once(
"./Services/News/classes/class.ilNewsCache.php");
297 $this->acache->deleteAllEntries();
304 $ilSetting->set(
"block_activated_news",
$_POST[
"enable_internal_news"]);
305 $ilSetting->set(
"block_activated_pdnews",
$_POST[
"enable_internal_news"]);
306 $news_set->set(
"enable_rss_for_internal",
$_POST[
"enable_internal_rss"]);
307 $news_set->set(
"max_items",
$_POST[
"news_max_items"]);
308 $news_set->set(
"acc_cache_mins",
$_POST[
"news_acc_cache_mins"]);
309 $news_set->set(
"pd_period",
$_POST[
"news_pd_period"]);
310 $news_set->set(
"default_visibility",
$_POST[
"news_default_visibility"]);
311 $news_set->set(
"allow_shorter_periods",
$_POST[
"allow_shorter_periods"]);
312 $news_set->set(
"allow_longer_periods",
$_POST[
"allow_longer_periods"]);
313 $news_set->set(
"rss_period",
$_POST[
"news_rss_period"]);
314 $news_set->set(
"rss_title_format",
$_POST[
"rss_title_format"]);
316 $feed_set->set(
"disable_rep_feeds",
$_POST[
"disable_repository_feeds"]);
317 $ilSetting->set(
"block_limit_pdfeed",
$_POST[
"nr_pd_feeds"]);
318 if (
$_POST[
"nr_pd_feeds"] > 0)
320 $ilSetting->set(
"block_activated_pdfeed", 1);
324 $ilSetting->set(
"block_activated_pdfeed", 0);
327 if (
$_POST[
"enable_internal_rss"]!=0)
329 $news_set->set(
"enable_private_feed",
$_POST[
"enable_private_feed"]);
333 $news_set->set(
"enable_private_feed", 0);
338 $ilCtrl->redirect($this,
"view");