3 include_once(
"./Services/Object/classes/class.ilObjectGUI.php");
44 public function __construct($a_data, $a_id, $a_call_by_reference =
true, $a_prepare_output =
true)
48 $this->rbacsystem = $DIC->rbac()->system();
49 $this->error = $DIC[
"ilErr"];
50 $this->access = $DIC->access();
51 $this->ctrl = $DIC->ctrl();
52 $this->lng = $DIC->language();
55 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
57 $this->lng->loadLanguageModule(
'news');
58 $this->lng->loadLanguageModule(
'feed');
73 $next_class = $this->ctrl->getNextClass($this);
74 $cmd = $this->ctrl->getCmd();
78 if (!$ilAccess->checkAccess(
'read',
'', $this->object->getRefId())) {
79 $ilErr->raiseError($this->lng->txt(
'no_permission'),
$ilErr->WARNING);
82 switch ($next_class) {
83 case 'ilpermissiongui':
84 $this->tabs_gui->setTabActive(
'perm_settings');
85 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
87 $ret = $this->ctrl->forwardCommand($perm_gui);
91 if (!$cmd || $cmd ==
'view') {
92 $cmd =
"editSettings";
112 if (
$rbacsystem->checkAccess(
"visible,read", $this->object->getRefId())) {
113 $this->tabs_gui->addTarget(
114 "news_edit_news_settings",
115 $this->ctrl->getLinkTarget($this,
"editSettings"),
116 array(
"editSettings",
"view")
120 if (
$rbacsystem->checkAccess(
'edit_permission', $this->object->getRefId())) {
121 $this->tabs_gui->addTarget(
123 $this->ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm"),
143 $enable_internal_news =
$ilSetting->get(
"block_activated_news");
144 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
145 $rss_title_format = $news_set->get(
"rss_title_format");
146 $enable_private_feed = $news_set->get(
"enable_private_feed");
147 $news_default_visibility = ($news_set->get(
"default_visibility") !=
"")
148 ? $news_set->get(
"default_visibility")
150 $disable_repository_feeds =
$feed_set->get(
"disable_rep_feeds");
151 $nr_personal_desktop_feeds =
$ilSetting->get(
"block_limit_pdfeed");
153 $allow_shorter_periods = $news_set->get(
"allow_shorter_periods");
154 $allow_longer_periods = $news_set->get(
"allow_longer_periods");
156 include_once(
"./Services/News/classes/class.ilNewsItem.php");
159 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
162 $form->setTitle(
$lng->txt(
"news_settings"));
166 $lng->txt(
"news_enable_internal_news"),
167 "enable_internal_news" 170 $cb_prop->setInfo(
$lng->txt(
"news_enable_internal_news_info"));
171 $cb_prop->setChecked($enable_internal_news);
172 $form->addItem($cb_prop);
177 $radio_group->addOption($radio_option);
178 $radio_option =
new ilRadioOption(
$lng->txt(
"news_visibility_public"),
"public");
179 $radio_group->addOption($radio_option);
180 $radio_group->
setInfo(
$lng->txt(
"news_news_item_visibility_info"));
181 $radio_group->setRequired(
false);
182 $radio_group->setValue($news_default_visibility);
183 $form->addItem($radio_group);
186 $nr_opts = array(50 => 50, 100 => 100, 200 => 200);
188 $lng->txt(
"news_nr_of_items"),
191 $nr_sel->
setInfo(
$lng->txt(
"news_nr_of_items_info"));
192 $nr_sel->setOptions($nr_opts);
193 $nr_sel->setValue($news_set->get(
"max_items"));
194 $form->addItem($nr_sel);
197 $min_opts = array(0 => 0, 1 => 1, 2 => 2, 5 => 5, 10 => 10, 20 => 20, 30 => 30, 60 => 60);
199 $lng->txt(
"news_cache"),
200 "news_acc_cache_mins" 203 $min_sel->setOptions($min_opts);
204 $min_sel->setValue($news_set->get(
"acc_cache_mins"));
205 $form->addItem($min_sel);
209 2 =>
"2 " .
$lng->txt(
"days"),
210 3 =>
"3 " .
$lng->txt(
"days"),
211 5 =>
"5 " .
$lng->txt(
"days"),
212 7 =>
"1 " .
$lng->txt(
"week"),
213 14 =>
"2 " .
$lng->txt(
"weeks"),
214 30 =>
"1 " .
$lng->txt(
"month"),
215 60 =>
"2 " .
$lng->txt(
"months"),
216 120 =>
"4 " .
$lng->txt(
"months"),
217 180 =>
"6 " .
$lng->txt(
"months"),
218 366 =>
"1 " .
$lng->txt(
"year"));
220 $lng->txt(
"news_pd_period"),
223 $per_sel->
setInfo(
$lng->txt(
"news_pd_period_info"));
224 $per_sel->setOptions($per_opts);
226 $form->addItem($per_sel);
230 $lng->txt(
"news_allow_shorter_periods"),
231 "allow_shorter_periods" 234 $sp_prop->setInfo(
$lng->txt(
"news_allow_shorter_periods_info"));
235 $sp_prop->setChecked($allow_shorter_periods);
236 $form->addItem($sp_prop);
240 $lng->txt(
"news_allow_longer_periods"),
241 "allow_longer_periods" 244 $lp_prop->setInfo(
$lng->txt(
"news_allow_longer_periods_info"));
245 $lp_prop->setChecked($allow_longer_periods);
246 $form->addItem($lp_prop);
250 $lng->txt(
"news_enable_internal_rss"),
251 "enable_internal_rss" 254 $cb_prop->setInfo(
$lng->txt(
"news_enable_internal_rss_info"));
255 $cb_prop->setChecked($enable_internal_rss);
259 2 =>
"2 " .
$lng->txt(
"days"),
260 3 =>
"3 " .
$lng->txt(
"days"),
261 5 =>
"5 " .
$lng->txt(
"days"),
262 7 =>
"1 " .
$lng->txt(
"week"),
263 14 =>
"2 " .
$lng->txt(
"weeks"),
264 30 =>
"1 " .
$lng->txt(
"month"),
265 60 =>
"2 " .
$lng->txt(
"months"),
266 120 =>
"4 " .
$lng->txt(
"months"),
267 180 =>
"6 " .
$lng->txt(
"months"),
268 365 =>
"1 " .
$lng->txt(
"year")
271 $lng->txt(
"news_rss_period"),
275 $rssp_sel->setValue((
int) $rss_period);
276 $cb_prop->addSubItem($rssp_sel);
280 $sh->setTitle(
$lng->txt(
"news_rss"));
285 "" =>
$lng->txt(
"news_rss_title_format_obj_news"),
286 "news_obj" =>
$lng->txt(
"news_rss_title_format_news_obj"),
290 $si->setValue($rss_title_format);
291 $cb_prop->addSubItem($si);
293 $form->addItem($cb_prop);
297 $lng->txt(
"news_enable_private_feed"),
298 "enable_private_feed" 301 $cb_prop->setInfo(
$lng->txt(
"news_enable_private_feed_info"));
302 $cb_prop->setChecked($enable_private_feed);
303 $form->addItem($cb_prop);
308 $sh->setTitle(
$lng->txt(
"feed_settings"));
314 $sel->setOptions(array(0 =>
"0",
320 $sel->setValue($nr_personal_desktop_feeds);
321 $form->addItem($sel);
325 $lng->txt(
"feed_disable_rep_feeds"),
326 "disable_repository_feeds" 329 $cb_prop->setInfo(
$lng->txt(
"feed_disable_rep_feeds_info"));
330 $cb_prop->setChecked($disable_repository_feeds);
331 $form->addItem($cb_prop);
333 if ($ilAccess->checkAccess(
'write',
'', $this->object->getRefId())) {
335 $form->addCommandButton(
"saveSettings",
$lng->txt(
"save"));
336 $form->addCommandButton(
"view",
$lng->txt(
"cancel"));
339 $this->tpl->setContent(
$form->getHTML());
351 if (!$ilAccess->checkAccess(
'write',
'', $this->object->getRefId())) {
352 $ilCtrl->redirect($this,
"view");
356 include_once(
"./Services/News/classes/class.ilNewsCache.php");
358 $this->acache->deleteAllEntries();
367 $news_set->set(
"enable_rss_for_internal",
$_POST[
"enable_internal_rss"]);
368 $news_set->set(
"max_items",
$_POST[
"news_max_items"]);
369 $news_set->set(
"acc_cache_mins",
$_POST[
"news_acc_cache_mins"]);
370 $news_set->set(
"pd_period",
$_POST[
"news_pd_period"]);
371 $news_set->set(
"default_visibility",
$_POST[
"news_default_visibility"]);
372 $news_set->set(
"allow_shorter_periods",
$_POST[
"allow_shorter_periods"]);
373 $news_set->set(
"allow_longer_periods",
$_POST[
"allow_longer_periods"]);
374 $news_set->set(
"rss_period",
$_POST[
"news_rss_period"]);
375 $news_set->set(
"rss_title_format",
$_POST[
"rss_title_format"]);
377 $feed_set->set(
"disable_rep_feeds",
$_POST[
"disable_repository_feeds"]);
379 if (
$_POST[
"nr_pd_feeds"] > 0) {
385 if (
$_POST[
"enable_internal_rss"] != 0) {
386 $news_set->set(
"enable_private_feed",
$_POST[
"enable_private_feed"]);
388 $news_set->set(
"enable_private_feed", 0);
391 ilUtil::sendSuccess($this->lng->txt(
"settings_saved"),
true);
393 $ilCtrl->redirect($this,
"view");
This class represents an option in a radio group.
static _lookupRSSPeriod()
setInfo($a_info)
Set Info.
prepareOutput($a_show_subobjects=true)
prepare output
if(isset($_POST['submit'])) $form
Class ilObjectGUI Basic methods of all Output classes.
saveSettings()
Save news and external webfeeds settings.
executeCommand()
Execute command.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Contructor.
editSettings()
Edit news settings.
static _lookupDefaultPDPeriod()