23 include_once(
"./classes/class.ilObjectGUI.php");
44 public function __construct($a_data, $a_id, $a_call_by_reference =
true, $a_prepare_output =
true)
49 $this->lng->loadLanguageModule(
'news');
50 $this->lng->loadLanguageModule(
'feed');
62 global $rbacsystem,
$ilErr,$ilAccess;
64 $next_class = $this->ctrl->getNextClass($this);
65 $cmd = $this->ctrl->getCmd();
69 if(!$ilAccess->checkAccess(
'read',
'',$this->object->getRefId()))
71 $ilErr->raiseError($this->lng->txt(
'no_permission'),$ilErr->WARNING);
76 case 'ilpermissiongui':
77 $this->tabs_gui->setTabActive(
'perm_settings');
78 include_once(
"./classes/class.ilPermissionGUI.php");
80 $ret =& $this->ctrl->forwardCommand($perm_gui);
86 $cmd =
"editSettings";
103 global $rbacsystem, $ilAccess;
105 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
107 $this->tabs_gui->addTarget(
"news_edit_news_settings",
108 $this->ctrl->getLinkTarget($this,
"editSettings"),
109 array(
"editSettings",
"view"));
112 if ($rbacsystem->checkAccess(
'edit_permission',$this->object->getRefId()))
114 $this->tabs_gui->addTarget(
"perm_settings",
115 $this->ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm"),
116 array(),
'ilpermissiongui');
130 $enable_internal_news = $ilSetting->get(
"block_activated_news");
131 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
132 $enable_private_feed = $news_set->get(
"enable_private_feed");
133 $news_default_visibility = ($news_set->get(
"default_visibility") !=
"")
134 ? $news_set->get(
"default_visibility")
136 $disable_repository_feeds =
$feed_set->get(
"disable_rep_feeds");
137 $nr_personal_desktop_feeds = $ilSetting->get(
"block_limit_pdfeed");
139 $allow_shorter_periods = $news_set->get(
"allow_shorter_periods");
140 $allow_longer_periods = $news_set->get(
"allow_longer_periods");
142 include_once(
"./Services/News/classes/class.ilNewsItem.php");
145 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
147 $form->setFormAction($ilCtrl->getFormAction($this));
148 $form->setTitle($lng->txt(
"news_settings"));
152 "enable_internal_news");
154 $cb_prop->setInfo($lng->txt(
"news_enable_internal_news_info"));
155 $cb_prop->setChecked($enable_internal_news);
156 $form->addItem($cb_prop);
160 "enable_internal_rss");
162 $cb_prop->setInfo($lng->txt(
"news_enable_internal_rss_info"));
163 $cb_prop->setChecked($enable_internal_rss);
167 2 =>
"2 ".$lng->txt(
"days"),
168 3 =>
"3 ".$lng->txt(
"days"),
169 5 =>
"5 ".$lng->txt(
"days"),
170 7 =>
"1 ".$lng->txt(
"week"),
171 14 =>
"2 ".$lng->txt(
"weeks"),
172 30 =>
"1 ".$lng->txt(
"month"),
173 60 =>
"2 ".$lng->txt(
"months"));
177 $rssp_sel->setValue((
int) $rss_period);
178 $cb_prop->addSubItem($rssp_sel);
180 $form->addItem($cb_prop);
184 "enable_private_feed");
186 $cb_prop->setInfo($lng->txt(
"news_enable_private_feed_info"));
187 $cb_prop->setChecked($enable_private_feed);
188 $form->addItem($cb_prop);
191 $radio_group =
new ilRadioGroupInputGUI($lng->txt(
"news_default_visibility"),
"news_default_visibility");
192 $radio_option =
new ilRadioOption($lng->txt(
"news_visibility_users"),
"users");
193 $radio_group->addOption($radio_option);
194 $radio_option =
new ilRadioOption($lng->txt(
"news_visibility_public"),
"public");
195 $radio_group->addOption($radio_option);
196 $radio_group->
setInfo($lng->txt(
"news_news_item_visibility_info"));
197 $radio_group->setRequired(
false);
198 $radio_group->setValue($news_default_visibility);
199 $form->addItem($radio_group);
202 $nr_opts = array(50 => 50, 100 => 100, 200 => 200);
205 $nr_sel->
setInfo($lng->txt(
"news_nr_of_items_info"));
206 $nr_sel->setOptions($nr_opts);
207 $nr_sel->setValue($news_set->get(
"max_items"));
208 $form->addItem($nr_sel);
211 $min_opts = array(0 => 0, 1 => 1, 2 => 2, 5 => 5, 10 => 10, 20 => 20, 30 => 30, 60 => 60);
213 "news_acc_cache_mins");
214 $min_sel->
setInfo($lng->txt(
"news_acc_cache_info"));
215 $min_sel->setOptions($min_opts);
216 $min_sel->setValue($news_set->get(
"acc_cache_mins"));
217 $form->addItem($min_sel);
221 2 =>
"2 ".$lng->txt(
"days"),
222 3 =>
"3 ".$lng->txt(
"days"),
223 5 =>
"5 ".$lng->txt(
"days"),
224 7 =>
"1 ".$lng->txt(
"week"),
225 14 =>
"2 ".$lng->txt(
"weeks"),
226 30 =>
"1 ".$lng->txt(
"month"),
227 60 =>
"2 ".$lng->txt(
"months"),
228 120 =>
"4 ".$lng->txt(
"months"),
229 180 =>
"6 ".$lng->txt(
"months"),
230 366 =>
"1 ".$lng->txt(
"year"));
233 $per_sel->
setInfo($lng->txt(
"news_pd_period_info"));
234 $per_sel->setOptions($per_opts);
236 $form->addItem($per_sel);
240 "allow_shorter_periods");
242 $sp_prop->setInfo($lng->txt(
"news_allow_shorter_periods_info"));
243 $sp_prop->setChecked($allow_shorter_periods);
244 $form->addItem($sp_prop);
248 "allow_longer_periods");
250 $lp_prop->setInfo($lng->txt(
"news_allow_longer_periods_info"));
251 $lp_prop->setChecked($allow_longer_periods);
252 $form->addItem($lp_prop);
256 $sh->setTitle($lng->txt(
"feed_settings"));
261 "disable_repository_feeds");
263 $cb_prop->setInfo($lng->txt(
"feed_disable_rep_feeds_info"));
264 $cb_prop->setChecked($disable_repository_feeds);
265 $form->addItem($cb_prop);
269 $sel->
setInfo($lng->txt(
"feed_nr_pd_feeds_info"));
270 $sel->setOptions(array(0 =>
"0",
276 $sel->setValue($nr_personal_desktop_feeds);
277 $form->addItem($sel);
281 $prox->
setInfo($lng->txt(
"feed_proxy_info"));
282 $prox->setValue(
$feed_set->get(
"proxy"));
283 $form->addItem($prox);
286 $proxp =
new ilTextInputGUI($lng->txt(
"feed_proxy_port"),
"proxy_port");
287 $proxp->
setInfo($lng->txt(
"feed_proxy_port_info"));
289 $proxp->setMaxLength(10);
290 $proxp->setValue(
$feed_set->get(
"proxy_port"));
291 $form->addItem($proxp);
294 $form->addCommandButton(
"saveSettings", $lng->txt(
"save"));
295 $form->addCommandButton(
"view", $lng->txt(
"cancel"));
297 $this->tpl->setContent($form->getHTML());
309 $ilSetting->set(
"block_activated_news", $_POST[
"enable_internal_news"]);
310 $ilSetting->set(
"block_activated_pdnews", $_POST[
"enable_internal_news"]);
311 $news_set->set(
"enable_rss_for_internal", $_POST[
"enable_internal_rss"]);
312 $news_set->set(
"max_items", $_POST[
"news_max_items"]);
313 $news_set->set(
"acc_cache_mins", $_POST[
"news_acc_cache_mins"]);
314 $news_set->set(
"pd_period", $_POST[
"news_pd_period"]);
315 $news_set->set(
"default_visibility", $_POST[
"news_default_visibility"]);
316 $news_set->set(
"allow_shorter_periods", $_POST[
"allow_shorter_periods"]);
317 $news_set->set(
"allow_longer_periods", $_POST[
"allow_longer_periods"]);
318 $news_set->set(
"rss_period", $_POST[
"news_rss_period"]);
320 $feed_set->set(
"disable_rep_feeds", $_POST[
"disable_repository_feeds"]);
321 $ilSetting->set(
"block_limit_pdfeed", $_POST[
"nr_pd_feeds"]);
322 if ($_POST[
"nr_pd_feeds"] > 0)
324 $ilSetting->set(
"block_activated_pdfeed", 1);
328 $ilSetting->set(
"block_activated_pdfeed", 0);
331 if ($_POST[
"enable_internal_rss"]!=0)
333 $news_set->set(
"enable_private_feed", $_POST[
"enable_private_feed"]);
337 $news_set->set(
"enable_private_feed", 0);
339 $feed_set->set(
"proxy", trim($_POST[
"proxy"]));
340 $feed_set->set(
"proxy_port", trim($_POST[
"proxy_port"]));
344 $ilCtrl->redirect($this,
"view");