ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilObjNewsSettingsGUI Class Reference

News Settings. More...

+ Inheritance diagram for ilObjNewsSettingsGUI:
+ Collaboration diagram for ilObjNewsSettingsGUI:

Public Member Functions

 __construct ($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
 Contructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getAdminTabs ()
 Get tabs. More...
 
 editSettings ()
 Edit news settings. More...
 
 saveSettings ()
 Save news and external webfeeds settings. More...
 
- Public Member Functions inherited from ilObjectGUI
 executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui More...
 
 getCreationMode ()
 get creation mode More...
 
 prepareOutput ($a_show_subobjects=true)
 prepare output More...
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ()
 cancel action and go back to previous page public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 edit object More...
 
 addExternalEditFormCustom (ilPropertyFormGUI $a_form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html. More...
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 

Protected Attributes

 $rbacsystem
 
 $error
 
 $access
 
 $settings
 
- Protected Attributes inherited from ilObjectGUI
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $rbacsystem
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 
 $object_service
 
 $favourites
 

Static Private Attributes

static $ERROR_MESSAGE
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot ($a_raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode ($a_ref_id, $a_cmd="frameset")
 Goto repository root. More...
 
- Data Fields inherited from ilObjectGUI
const COPY_WIZARD_NEEDS_PAGE = 1
 
 $objDefinition
 
 $tpl
 
 $tree
 
 $lng
 
 $data
 
 $object
 
 $ref_id
 
 $obj_id
 
 $maxcount
 
 $formaction
 
 $return_location
 
 $target_frame
 
 $tab_target_script
 
 $actions
 
 $sub_objects
 
 $omit_locator = false
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 Get object service. More...
 
 assignObject ()
 
 setTitleAndDescription ()
 called by prepare output More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction ($a_list_gui)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 setTabs ()
 set admin tabs public More...
 
 setAdminTabs ()
 set admin tabs public More...
 
 setLocator ()
 set Locator More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator ($a_omit=true)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm ($a_new_type)
 Init object creation form. More...
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types. More...
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 Init object edit form. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 Get values for edit form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $a_form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm ($a_new_type)
 Init object import form. More...
 
 importFileObject ($parent_id=null, $a_catch_errors=true)
 Import. More...
 
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook. More...
 
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command More...
 
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command More...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl. More...
 
 getTabs ()
 get tabs abstract method. More...
 
 __showButton ($a_cmd, $a_text, $a_target='')
 
 hitsperpageObject ()
 
__initTableGUI ()
 
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table More...
 
 redirectToRefId ($a_ref_id, $a_cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current $_GET["ref_id"] value More...
 
 fillCloneTemplate ($a_tpl_varname, $a_type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission. More...
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 

Detailed Description

News Settings.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

ilObjNewsSettingsGUI: ilPermissionGUI

Definition at line 16 of file class.ilObjNewsSettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjNewsSettingsGUI::__construct (   $a_data,
  $a_id,
  $a_call_by_reference = true,
  $a_prepare_output = true 
)

Contructor.

public

Definition at line 44 of file class.ilObjNewsSettingsGUI.php.

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and settings().

45  {
46  global $DIC;
47 
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();
53  $this->settings = $DIC->settings();
54  $this->type = 'nwss';
55  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
56 
57  $this->lng->loadLanguageModule('news');
58  $this->lng->loadLanguageModule('feed');
59  }
settings()
Definition: settings.php:2
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Member Function Documentation

◆ editSettings()

ilObjNewsSettingsGUI::editSettings ( )

Edit news settings.

Definition at line 129 of file class.ilObjNewsSettingsGUI.php.

References $access, ilObjectGUI\$ctrl, $feed_set, $ilCtrl, $ilSetting, ilObjectGUI\$lng, $settings, $si, ilNewsItem\_lookupDefaultPDPeriod(), ilNewsItem\_lookupRSSPeriod(), ilRadioOption\setInfo(), and ilCheckboxInputGUI\setValue().

130  {
132  $lng = $this->lng;
134  $ilAccess = $this->access;
135 
136  $news_set = new ilSetting("news");
137  $feed_set = new ilSetting("feed");
138 
139  $enable_internal_news = $ilSetting->get("block_activated_news");
140  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
141  $rss_title_format = $news_set->get("rss_title_format");
142  $enable_private_feed = $news_set->get("enable_private_feed");
143  $news_default_visibility = ($news_set->get("default_visibility") != "")
144  ? $news_set->get("default_visibility")
145  : "users";
146  $disable_repository_feeds = $feed_set->get("disable_rep_feeds");
147  $nr_personal_desktop_feeds = $ilSetting->get("block_limit_pdfeed");
148 
149  $allow_shorter_periods = $news_set->get("allow_shorter_periods");
150  $allow_longer_periods = $news_set->get("allow_longer_periods");
151 
152  include_once("./Services/News/classes/class.ilNewsItem.php");
153  $rss_period = ilNewsItem::_lookupRSSPeriod();
154 
155  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
156  $form = new ilPropertyFormGUI();
157  $form->setFormAction($ilCtrl->getFormAction($this));
158  $form->setTitle($lng->txt("news_settings"));
159 
160  // Enable internal news
161  $cb_prop = new ilCheckboxInputGUI(
162  $lng->txt("news_enable_internal_news"),
163  "enable_internal_news"
164  );
165  $cb_prop->setValue("1");
166  $cb_prop->setInfo($lng->txt("news_enable_internal_news_info"));
167  $cb_prop->setChecked($enable_internal_news);
168  $form->addItem($cb_prop);
169 
170  // Default Visibility
171  $radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "news_default_visibility");
172  $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users");
173  $radio_group->addOption($radio_option);
174  $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public");
175  $radio_group->addOption($radio_option);
176  $radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
177  $radio_group->setRequired(false);
178  $radio_group->setValue($news_default_visibility);
179  $form->addItem($radio_group);
180 
181  // Number of news items per object
182  $nr_opts = array(50 => 50, 100 => 100, 200 => 200);
183  $nr_sel = new ilSelectInputGUI(
184  $lng->txt("news_nr_of_items"),
185  "news_max_items"
186  );
187  $nr_sel->setInfo($lng->txt("news_nr_of_items_info"));
188  $nr_sel->setOptions($nr_opts);
189  $nr_sel->setValue($news_set->get("max_items"));
190  $form->addItem($nr_sel);
191 
192  // Access Cache
193  $min_opts = array(0 => 0, 1 => 1, 2 => 2, 5 => 5, 10 => 10, 20 => 20, 30 => 30, 60 => 60);
194  $min_sel = new ilSelectInputGUI(
195  $lng->txt("news_cache"),
196  "news_acc_cache_mins"
197  );
198  $min_sel->setInfo($lng->txt("news_cache_info"));
199  $min_sel->setOptions($min_opts);
200  $min_sel->setValue($news_set->get("acc_cache_mins"));
201  $form->addItem($min_sel);
202 
203  // PD News Period
204  $per_opts = array(
205  7 => "1 " . $lng->txt("week"),
206  30 => "1 " . $lng->txt("month"),
207  366 => "1 " . $lng->txt("year"));
208  $per_sel = new ilSelectInputGUI(
209  $lng->txt("news_pd_period"),
210  "news_pd_period"
211  );
212  $per_sel->setInfo($lng->txt("news_pd_period_info"));
213  $per_sel->setOptions($per_opts);
214  $per_sel->setValue((int) ilNewsItem::_lookupDefaultPDPeriod());
215  $form->addItem($per_sel);
216 
217  // Allow user to choose lower values
218  $sp_prop = new ilCheckboxInputGUI(
219  $lng->txt("news_allow_shorter_periods"),
220  "allow_shorter_periods"
221  );
222  $sp_prop->setValue("1");
223  $sp_prop->setInfo($lng->txt("news_allow_shorter_periods_info"));
224  $sp_prop->setChecked($allow_shorter_periods);
225  $form->addItem($sp_prop);
226 
227  // Allow user to choose higher values
228  $lp_prop = new ilCheckboxInputGUI(
229  $lng->txt("news_allow_longer_periods"),
230  "allow_longer_periods"
231  );
232  $lp_prop->setValue("1");
233  $lp_prop->setInfo($lng->txt("news_allow_longer_periods_info"));
234  $lp_prop->setChecked($allow_longer_periods);
235  $form->addItem($lp_prop);
236 
237  // Enable rss for internal news
238  $cb_prop = new ilCheckboxInputGUI(
239  $lng->txt("news_enable_internal_rss"),
240  "enable_internal_rss"
241  );
242  $cb_prop->setValue("1");
243  $cb_prop->setInfo($lng->txt("news_enable_internal_rss_info"));
244  $cb_prop->setChecked($enable_internal_rss);
245 
246  // RSS News Period
247  $rssp_opts = array(
248  2 => "2 " . $lng->txt("days"),
249  3 => "3 " . $lng->txt("days"),
250  5 => "5 " . $lng->txt("days"),
251  7 => "1 " . $lng->txt("week"),
252  14 => "2 " . $lng->txt("weeks"),
253  30 => "1 " . $lng->txt("month"),
254  60 => "2 " . $lng->txt("months"),
255  120 => "4 " . $lng->txt("months"),
256  180 => "6 " . $lng->txt("months"),
257  365 => "1 " . $lng->txt("year")
258  );
259  $rssp_sel = new ilSelectInputGUI(
260  $lng->txt("news_rss_period"),
261  "news_rss_period"
262  );
263  $rssp_sel->setOptions($rssp_opts);
264  $rssp_sel->setValue((int) $rss_period);
265  $cb_prop->addSubItem($rssp_sel);
266 
267  // Section Header: RSS
268  $sh = new ilFormSectionHeaderGUI();
269  $sh->setTitle($lng->txt("news_rss"));
270  $form->addItem($sh);
271 
272  // title format for rss entries
273  $options = array(
274  "" => $lng->txt("news_rss_title_format_obj_news"),
275  "news_obj" => $lng->txt("news_rss_title_format_news_obj"),
276  );
277  $si = new ilSelectInputGUI($lng->txt("news_rss_title_format"), "rss_title_format");
278  $si->setOptions($options);
279  $si->setValue($rss_title_format);
280  $cb_prop->addSubItem($si);
281 
282  $form->addItem($cb_prop);
283 
284  // Enable private news feed
285  $cb_prop = new ilCheckboxInputGUI(
286  $lng->txt("news_enable_private_feed"),
287  "enable_private_feed"
288  );
289  $cb_prop->setValue("1");
290  $cb_prop->setInfo($lng->txt("news_enable_private_feed_info"));
291  $cb_prop->setChecked($enable_private_feed);
292  $form->addItem($cb_prop);
293 
294 
295  // Section Header: External Web Feeds Settings
296  $sh = new ilFormSectionHeaderGUI();
297  $sh->setTitle($lng->txt("feed_settings"));
298  $form->addItem($sh);
299 
300  // Disable External Web Feeds in catetegories
301  $cb_prop = new ilCheckboxInputGUI(
302  $lng->txt("feed_disable_rep_feeds"),
303  "disable_repository_feeds"
304  );
305  $cb_prop->setValue("1");
306  $cb_prop->setInfo($lng->txt("feed_disable_rep_feeds_info"));
307  $cb_prop->setChecked($disable_repository_feeds);
308  $form->addItem($cb_prop);
309 
310  if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
311  // command buttons
312  $form->addCommandButton("saveSettings", $lng->txt("save"));
313  $form->addCommandButton("view", $lng->txt("cancel"));
314  }
315 
316  $this->tpl->setContent($form->getHTML());
317  }
This class represents an option in a radio group.
static _lookupRSSPeriod()
This class represents a property form user interface.
This class represents a section header in a property form.
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Info.
global $ilCtrl
Definition: ilias.php:18
This class represents a property in a property form.
setValue($a_value)
Set Value.
$feed_set
Definition: privfeed.php:19
global $ilSetting
Definition: privfeed.php:17
static _lookupDefaultPDPeriod()
+ Here is the call graph for this function:

◆ executeCommand()

ilObjNewsSettingsGUI::executeCommand ( )

Execute command.

public

Definition at line 67 of file class.ilObjNewsSettingsGUI.php.

References $ret, and ilObjectGUI\prepareOutput().

68  {
69  $next_class = $this->ctrl->getNextClass($this);
70  $cmd = $this->ctrl->getCmd();
71 
72  $this->prepareOutput();
73 
74  if (!$this->rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
75  $this->error->raiseError($this->lng->txt('no_permission'), $this->error->WARNING);
76  }
77 
78  switch ($next_class) {
79  case 'ilpermissiongui':
80  $this->tabs_gui->setTabActive('perm_settings');
81  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
82  $perm_gui = new ilPermissionGUI($this);
83  $ret = $this->ctrl->forwardCommand($perm_gui);
84  break;
85 
86  default:
87  if (!$cmd || $cmd == 'view') {
88  $cmd = "editSettings";
89  }
90 
91  $this->$cmd();
92  break;
93  }
94  return true;
95  }
prepareOutput($a_show_subobjects=true)
prepare output
$ret
Definition: parser.php:6
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjNewsSettingsGUI::getAdminTabs ( )

Get tabs.

public

Definition at line 103 of file class.ilObjNewsSettingsGUI.php.

References $access, and $rbacsystem.

104  {
106  $ilAccess = $this->access;
107 
108  if ($rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
109  $this->tabs_gui->addTarget(
110  "news_edit_news_settings",
111  $this->ctrl->getLinkTarget($this, "editSettings"),
112  array("editSettings", "view")
113  );
114  }
115 
116  if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
117  $this->tabs_gui->addTarget(
118  "perm_settings",
119  $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm"),
120  array(),
121  'ilpermissiongui'
122  );
123  }
124  }

◆ saveSettings()

ilObjNewsSettingsGUI::saveSettings ( )

Save news and external webfeeds settings.

Definition at line 322 of file class.ilObjNewsSettingsGUI.php.

References $_POST, $access, ilObjectGUI\$ctrl, $feed_set, $ilCtrl, $ilSetting, and $settings.

323  {
326  $ilAccess = $this->access;
327 
328  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
329  $ilCtrl->redirect($this, "view");
330  }
331 
332  // empty news cache
333  include_once("./Services/News/classes/class.ilNewsCache.php");
334  $this->acache = new ilNewsCache();
335  $this->acache->deleteAllEntries();
336 
337  $news_set = new ilSetting("news");
338  $feed_set = new ilSetting("feed");
339 
340 
341 
342  $ilSetting->set("block_activated_news", $_POST["enable_internal_news"]);
343  $ilSetting->set("block_activated_pdnews", $_POST["enable_internal_news"]);
344  $news_set->set("enable_rss_for_internal", $_POST["enable_internal_rss"]);
345  $news_set->set("max_items", $_POST["news_max_items"]);
346  $news_set->set("acc_cache_mins", $_POST["news_acc_cache_mins"]);
347  $news_set->set("pd_period", $_POST["news_pd_period"]);
348  $news_set->set("default_visibility", $_POST["news_default_visibility"]);
349  $news_set->set("allow_shorter_periods", $_POST["allow_shorter_periods"]);
350  $news_set->set("allow_longer_periods", $_POST["allow_longer_periods"]);
351  $news_set->set("rss_period", $_POST["news_rss_period"]);
352  $news_set->set("rss_title_format", $_POST["rss_title_format"]);
353 
354  $feed_set->set("disable_rep_feeds", $_POST["disable_repository_feeds"]);
355 
356  if ($_POST["enable_internal_rss"] != 0) {
357  $news_set->set("enable_private_feed", $_POST["enable_private_feed"]);
358  } else {
359  $news_set->set("enable_private_feed", 0);
360  }
361 
362  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
363 
364  $ilCtrl->redirect($this, "view");
365  }
News cache.
global $ilCtrl
Definition: ilias.php:18
$feed_set
Definition: privfeed.php:19
global $ilSetting
Definition: privfeed.php:17
$_POST["username"]

Field Documentation

◆ $access

ilObjNewsSettingsGUI::$access
protected

Definition at line 31 of file class.ilObjNewsSettingsGUI.php.

Referenced by editSettings(), getAdminTabs(), and saveSettings().

◆ $error

ilObjNewsSettingsGUI::$error
protected

Definition at line 26 of file class.ilObjNewsSettingsGUI.php.

◆ $ERROR_MESSAGE

ilObjNewsSettingsGUI::$ERROR_MESSAGE
staticprivate

Definition at line 38 of file class.ilObjNewsSettingsGUI.php.

◆ $rbacsystem

ilObjNewsSettingsGUI::$rbacsystem
protected

Definition at line 21 of file class.ilObjNewsSettingsGUI.php.

Referenced by getAdminTabs().

◆ $settings

ilObjNewsSettingsGUI::$settings
protected

Definition at line 36 of file class.ilObjNewsSettingsGUI.php.

Referenced by editSettings(), and saveSettings().


The documentation for this class was generated from the following file: