ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
 ilObjectGUI ($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor @access public. More...
 
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...
 
 getAdminTabs (&$tabs_gui)
 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 ($in_rep=false)
 cancel action and go back to previous page @access public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object 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 ()
 list childs of current object More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 

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
 
 $ilias
 
 $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
 assignObject ()
 
 prepareOutput ()
 prepare output More...
 
 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...
 
 showMountWebfolderIcon ()
 
 setTabs ()
 set admin tabs @access public More...
 
 setAdminTabs ()
 set admin tabs @access 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...
 
 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...
 
 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...
 
 getTitlesByRefId ($a_ref_ids)
 get Titles of objects this method is used for error messages in methods cut/copy/paste More...
 
 getTabs (&$tabs_gui)
 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 ($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...
 
- Protected Attributes inherited from ilObjectGUI
 $tmp_import_dir
 

Detailed Description

News Settings.

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

@ilCtrl_Calls 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.

@access public

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

25 {
26 $this->type = 'nwss';
27 parent::ilObjectGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
28
29 $this->lng->loadLanguageModule('news');
30 $this->lng->loadLanguageModule('feed');
31
32 }

Member Function Documentation

◆ editSettings()

ilObjNewsSettingsGUI::editSettings ( )

Edit news settings.

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

104 {
105 global $ilCtrl, $lng, $ilSetting, $ilAccess;;
106
107 $news_set = new ilSetting("news");
108 $feed_set = new ilSetting("feed");
109
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")
116 : "users";
117 $disable_repository_feeds = $feed_set->get("disable_rep_feeds");
118 $nr_personal_desktop_feeds = $ilSetting->get("block_limit_pdfeed");
119
120 $allow_shorter_periods = $news_set->get("allow_shorter_periods");
121 $allow_longer_periods = $news_set->get("allow_longer_periods");
122
123 include_once("./Services/News/classes/class.ilNewsItem.php");
124 $rss_period = ilNewsItem::_lookupRSSPeriod();
125
126 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
127 $form = new ilPropertyFormGUI();
128 $form->setFormAction($ilCtrl->getFormAction($this));
129 $form->setTitle($lng->txt("news_settings"));
130
131 // Enable internal news
132 $cb_prop = new ilCheckboxInputGUI($lng->txt("news_enable_internal_news"),
133 "enable_internal_news");
134 $cb_prop->setValue("1");
135 $cb_prop->setInfo($lng->txt("news_enable_internal_news_info"));
136 $cb_prop->setChecked($enable_internal_news);
137 $form->addItem($cb_prop);
138
139 // Default Visibility
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);
149
150 // Number of news items per object
151 $nr_opts = array(50 => 50, 100 => 100, 200 => 200);
152 $nr_sel = new ilSelectInputGUI($lng->txt("news_nr_of_items"),
153 "news_max_items");
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);
158
159 // Access Cache
160 $min_opts = array(0 => 0, 1 => 1, 2 => 2, 5 => 5, 10 => 10, 20 => 20, 30 => 30, 60 => 60);
161 $min_sel = new ilSelectInputGUI($lng->txt("news_cache"),
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);
167
168 // PD News Period
169 $per_opts = array(
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"));
180 $per_sel = new ilSelectInputGUI($lng->txt("news_pd_period"),
181 "news_pd_period");
182 $per_sel->setInfo($lng->txt("news_pd_period_info"));
183 $per_sel->setOptions($per_opts);
184 $per_sel->setValue((int) ilNewsItem::_lookupDefaultPDPeriod());
185 $form->addItem($per_sel);
186
187 // Allow user to choose lower values
188 $sp_prop = new ilCheckboxInputGUI($lng->txt("news_allow_shorter_periods"),
189 "allow_shorter_periods");
190 $sp_prop->setValue("1");
191 $sp_prop->setInfo($lng->txt("news_allow_shorter_periods_info"));
192 $sp_prop->setChecked($allow_shorter_periods);
193 $form->addItem($sp_prop);
194
195 // Allow user to choose higher values
196 $lp_prop = new ilCheckboxInputGUI($lng->txt("news_allow_longer_periods"),
197 "allow_longer_periods");
198 $lp_prop->setValue("1");
199 $lp_prop->setInfo($lng->txt("news_allow_longer_periods_info"));
200 $lp_prop->setChecked($allow_longer_periods);
201 $form->addItem($lp_prop);
202
203 // Enable rss for internal news
204 $cb_prop = new ilCheckboxInputGUI($lng->txt("news_enable_internal_rss"),
205 "enable_internal_rss");
206 $cb_prop->setValue("1");
207 $cb_prop->setInfo($lng->txt("news_enable_internal_rss_info"));
208 $cb_prop->setChecked($enable_internal_rss);
209
210 // RSS News Period
211 $rssp_opts = array(
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")
222 );
223 $rssp_sel = new ilSelectInputGUI($lng->txt("news_rss_period"),
224 "news_rss_period");
225 $rssp_sel->setOptions($rssp_opts);
226 $rssp_sel->setValue((int) $rss_period);
227 $cb_prop->addSubItem($rssp_sel);
228
229 // Section Header: RSS
230 $sh = new ilFormSectionHeaderGUI();
231 $sh->setTitle($lng->txt("news_rss"));
232 $form->addItem($sh);
233
234 // title format for rss entries
235 $options = array(
236 "" => $lng->txt("news_rss_title_format_obj_news"),
237 "news_obj" => $lng->txt("news_rss_title_format_news_obj"),
238 );
239 $si = new ilSelectInputGUI($lng->txt("news_rss_title_format"), "rss_title_format");
240 $si->setOptions($options);
241 $si->setValue($rss_title_format);
242 $cb_prop->addSubItem($si);
243
244 $form->addItem($cb_prop);
245
246 // Enable private news feed
247 $cb_prop = new ilCheckboxInputGUI($lng->txt("news_enable_private_feed"),
248 "enable_private_feed");
249 $cb_prop->setValue("1");
250 $cb_prop->setInfo($lng->txt("news_enable_private_feed_info"));
251 $cb_prop->setChecked($enable_private_feed);
252 $form->addItem($cb_prop);
253
254
255 // Section Header: External Web Feeds Settings
256 $sh = new ilFormSectionHeaderGUI();
257 $sh->setTitle($lng->txt("feed_settings"));
258 $form->addItem($sh);
259
260 // Number of External Feeds on personal desktop
261 $sel = new ilSelectInputGUI($lng->txt("feed_nr_pd_feeds"), "nr_pd_feeds");
262 $sel->setInfo($lng->txt("feed_nr_pd_feeds_info"));
263 $sel->setOptions(array(0 => "0",
264 1 => "1",
265 2 => "2",
266 3 => "3",
267 4 => "4",
268 5 => "5"));
269 $sel->setValue($nr_personal_desktop_feeds);
270 $form->addItem($sel);
271
272 // Disable External Web Feeds in catetegories
273 $cb_prop = new ilCheckboxInputGUI($lng->txt("feed_disable_rep_feeds"),
274 "disable_repository_feeds");
275 $cb_prop->setValue("1");
276 $cb_prop->setInfo($lng->txt("feed_disable_rep_feeds_info"));
277 $cb_prop->setChecked($disable_repository_feeds);
278 $form->addItem($cb_prop);
279
280 if($ilAccess->checkAccess('write','',$this->object->getRefId()))
281 {
282 // command buttons
283 $form->addCommandButton("saveSettings", $lng->txt("save"));
284 $form->addCommandButton("view", $lng->txt("cancel"));
285 }
286
287 $this->tpl->setContent($form->getHTML());
288 }
This class represents a checkbox property in a property form.
This class represents a section header in a property form.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
ILIAS Setting Class.
global $ilCtrl
Definition: ilias.php:18
global $ilSetting
Definition: privfeed.php:40
$feed_set
Definition: privfeed.php:42
if(!is_array($argv)) $options

References $feed_set, $ilCtrl, $ilSetting, ilObjectGUI\$lng, $options, $si, ilNewsItem\_lookupDefaultPDPeriod(), and ilNewsItem\_lookupRSSPeriod().

+ Here is the call graph for this function:

◆ executeCommand()

ilObjNewsSettingsGUI::executeCommand ( )

Execute command.

@access public

Reimplemented from ilObjectGUI.

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

41 {
42 global $rbacsystem,$ilErr,$ilAccess;
43
44 $next_class = $this->ctrl->getNextClass($this);
45 $cmd = $this->ctrl->getCmd();
46
47 $this->prepareOutput();
48
49 if(!$ilAccess->checkAccess('read','',$this->object->getRefId()))
50 {
51 $ilErr->raiseError($this->lng->txt('no_permission'),$ilErr->WARNING);
52 }
53
54 switch($next_class)
55 {
56 case 'ilpermissiongui':
57 $this->tabs_gui->setTabActive('perm_settings');
58 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
59 $perm_gui =& new ilPermissionGUI($this);
60 $ret =& $this->ctrl->forwardCommand($perm_gui);
61 break;
62
63 default:
64 if(!$cmd || $cmd == 'view')
65 {
66 $cmd = "editSettings";
67 }
68
69 $this->$cmd();
70 break;
71 }
72 return true;
73 }
prepareOutput()
prepare output
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
$cmd
Definition: sahs_server.php:35

References $cmd, $ilErr, $ret, and ilObjectGUI\prepareOutput().

+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjNewsSettingsGUI::getAdminTabs ( )

Get tabs.

@access public

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

82 {
83 global $rbacsystem, $ilAccess;
84
85 if ($rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
86 {
87 $this->tabs_gui->addTarget("news_edit_news_settings",
88 $this->ctrl->getLinkTarget($this, "editSettings"),
89 array("editSettings", "view"));
90 }
91
92 if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
93 {
94 $this->tabs_gui->addTarget("perm_settings",
95 $this->ctrl->getLinkTargetByClass('ilpermissiongui',"perm"),
96 array(),'ilpermissiongui');
97 }
98 }

◆ saveSettings()

ilObjNewsSettingsGUI::saveSettings ( )

Save news and external webfeeds settings.

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

294 {
295 global $ilCtrl, $ilSetting, $ilAccess;
296
297 if(!$ilAccess->checkAccess('write','',$this->object->getRefId()))
298 {
299 $ilCtrl->redirect($this, "view");
300 }
301
302 // empty news cache
303 include_once("./Services/News/classes/class.ilNewsCache.php");
304 $this->acache = new ilNewsCache();
305 $this->acache->deleteAllEntries();
306
307 $news_set = new ilSetting("news");
308 $feed_set = new ilSetting("feed");
309
310
311
312 $ilSetting->set("block_activated_news", $_POST["enable_internal_news"]);
313 $ilSetting->set("block_activated_pdnews", $_POST["enable_internal_news"]);
314 $news_set->set("enable_rss_for_internal", $_POST["enable_internal_rss"]);
315 $news_set->set("max_items", $_POST["news_max_items"]);
316 $news_set->set("acc_cache_mins", $_POST["news_acc_cache_mins"]);
317 $news_set->set("pd_period", $_POST["news_pd_period"]);
318 $news_set->set("default_visibility", $_POST["news_default_visibility"]);
319 $news_set->set("allow_shorter_periods", $_POST["allow_shorter_periods"]);
320 $news_set->set("allow_longer_periods", $_POST["allow_longer_periods"]);
321 $news_set->set("rss_period", $_POST["news_rss_period"]);
322 $news_set->set("rss_title_format", $_POST["rss_title_format"]);
323
324 $feed_set->set("disable_rep_feeds", $_POST["disable_repository_feeds"]);
325 $ilSetting->set("block_limit_pdfeed", $_POST["nr_pd_feeds"]);
326 if ($_POST["nr_pd_feeds"] > 0)
327 {
328 $ilSetting->set("block_activated_pdfeed", 1);
329 }
330 else
331 {
332 $ilSetting->set("block_activated_pdfeed", 0);
333 }
334
335 if ($_POST["enable_internal_rss"]!=0)
336 {
337 $news_set->set("enable_private_feed", $_POST["enable_private_feed"]);
338 }
339 else
340 {
341 $news_set->set("enable_private_feed", 0);
342 }
343
344 ilUtil::sendSuccess($this->lng->txt("settings_saved"),true);
345
346 $ilCtrl->redirect($this, "view");
347 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12

References $_POST, $feed_set, $ilCtrl, $ilSetting, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

Field Documentation

◆ $ERROR_MESSAGE

ilObjNewsSettingsGUI::$ERROR_MESSAGE
staticprivate

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


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