ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjNewsSettingsGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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)
 
 executeCommand ()
 
 getAdminTabs ()
 
 editSettings ()
 
 getSettingsForm ()
 
 saveSettings ()
 
- Public Member Functions inherited from ilObjectGUI
 getRefId ()
 
 setAdminMode (string $mode)
 
 getAdminMode ()
 
 getObject ()
 
 executeCommand ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode (bool $mode=true)
 If true, a creation screen is displayed the current [ref_id] does belong to the parent class The mode is determined in ilRepositoryGUI. More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 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...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 editAvailabilityPeriodObject ()
 
 saveAvailabilityPeriodObject ()
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 
 getDidacticTemplateVar (string $type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $obj, ?int $parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 
 addExternalEditFormCustom (ilPropertyFormGUI $form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction (string $cmd, string $default_form_action="")
 Get form action for command (command is method name without "Object", e.g. More...
 
 isVisible (int $ref_id, string $type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject (bool $error=false)
 Display deletion confirmation screen. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Protected Attributes

ilNewsCache $acache
 
- Protected Attributes inherited from ilObjectGUI
ILIAS Notes Service $notes_service
 
ServerRequestInterface $request
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilSetting $settings
 
ilToolbarGUI $toolbar
 
ilRbacAdmin $rbac_admin
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
ilObjectService $object_service
 
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 
ilCtrl $ctrl
 
ilErrorHandling $error
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ILIAS $ilias
 
ArrayBasedRequestWrapper $post_wrapper
 
RequestWrapper $request_wrapper
 
Refinery $refinery
 
ilFavouritesManager $favourites
 
ilObjectCustomIconFactory $custom_icon_factory
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
Filesystem $temp_file_system
 
ilObject $object = null
 
bool $creation_mode = false
 
 $data
 
int $id
 
bool $call_by_reference = false
 
bool $prepare_output
 
int $ref_id
 
int $obj_id
 
int $maxcount
 
array $form_action = []
 
array $return_location = []
 
array $target_frame = []
 
string $tmp_import_dir
 
string $sub_objects = ""
 
bool $omit_locator = false
 
string $type = ""
 
string $admin_mode = self::ADMIN_MODE_NONE
 
int $requested_ref_id = 0
 
int $requested_crtptrefid = 0
 
int $requested_crtcb = 0
 
string $requested_new_type = ""
 
string $link_params
 
string $html = ""
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot (bool $raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode (int $ref_id, string $cmd="")
 
static _gotoSharedWorkspaceNode (int $wsp_id)
 
- Data Fields inherited from ilObjectGUI
const ADMIN_MODE_NONE = ""
 
const ADMIN_MODE_SETTINGS = "settings"
 
const ADMIN_MODE_REPOSITORY = "repository"
 
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 
const SUPPORTED_IMPORT_MIME_TYPES = [MimeType::APPLICATION__ZIP, MimeType::APPLICATION__X_ZIP_COMPRESSED]
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 createActionDispatcherGUI ()
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction (?ilObjectListGUI $list_gui=null)
 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 More...
 
 setAdminTabs ()
 set admin tabs More...
 
 setLocator ()
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator (bool $omit=true)
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 getCreationFormsHTML (StandardForm|ilPropertyFormGUI|array $form)
 
 getTitleForCreationFormPage ()
 
 getCreationFormTitle ()
 
 initCreateForm (string $new_type)
 
 didacticTemplatesToForm ()
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 retrieveAdditionalDidacticTemplateOptions ()
 
 addAdoptContentLinkToToolbar ()
 
 addImportButtonToToolbar ()
 
 addAvailabilityPeriodButtonToToolbar (ilToolbarGUI $toolbar)
 
 parseDidacticTemplateVar (string $var, string $type)
 
 afterSave (ilObject $new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 routeImportCmdObject ()
 
 importFile (string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
 
 deleteUploadedImportFile (string $path_to_uploaded_file_in_temp_dir)
 
 afterImport (ilObject $new_object)
 Post (successful) object import hook. More...
 
 setFormAction (string $cmd, string $form_action)
 
 getReturnLocation (string $cmd, string $default_location="")
 Get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 getTargetFrame (string $cmd, string $default_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame (string $cmd, string $target_frame)
 Set specific target frame for command. More...
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) More...
 
 getTabs ()
 overwrite in derived GUI class of your object type More...
 
 redirectToRefId (int $ref_id, string $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 ["ref_id"] value of the request More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 getCreatableObjectTypes ()
 
 buildAddNewItemElements (array $subtypes, string $create_target_class=ilRepositoryGUI::class, ?int $redirect_target_ref_id=null,)
 
 buildGroup (string $create_target_class, array $obj_types_in_group, string $title, array $subtypes)
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning News Settings.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de ilObjNewsSettingsGUI: ilPermissionGUI

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

Constructor & Destructor Documentation

◆ __construct()

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

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

References ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\lng().

30  {
31  $this->type = 'nwss';
32  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
33 
34  $this->lng->loadLanguageModule('news');
35  $this->lng->loadLanguageModule('feed');
36  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ editSettings()

ilObjNewsSettingsGUI::editSettings ( )

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

References getSettingsForm().

88  : void
89  {
90  $form = $this->getSettingsForm();
91  $this->tpl->setContent($form->getHTML());
92  }
+ Here is the call graph for this function:

◆ executeCommand()

ilObjNewsSettingsGUI::executeCommand ( )

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

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), null, and ilObjectGUI\prepareOutput().

38  : void
39  {
40  $next_class = $this->ctrl->getNextClass($this);
41  $cmd = $this->ctrl->getCmd();
42 
43  $this->prepareOutput();
44 
45  if (!$this->rbac_system->checkAccess("visible,read", $this->object->getRefId())) {
46  throw new ilPermissionException($this->lng->txt('no_permission'));
47  }
48 
49  switch ($next_class) {
50  case 'ilpermissiongui':
51  $this->tabs_gui->setTabActive('perm_settings');
52  $perm_gui = new ilPermissionGUI($this);
53  $this->ctrl->forwardCommand($perm_gui);
54  break;
55 
56  default:
57  if ($cmd === null || $cmd === '' || $cmd === 'view') {
58  $cmd = "editSettings";
59  }
60 
61  $this->$cmd();
62  break;
63  }
64  }
prepareOutput(bool $show_sub_objects=true)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjNewsSettingsGUI::getAdminTabs ( )

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

References ilObjectGUI\$rbac_system, and ILIAS\Repository\ctrl().

66  : void
67  {
68  $rbacsystem = $this->rbac_system;
69 
70  if ($rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
71  $this->tabs_gui->addTarget(
72  "news_edit_news_settings",
73  $this->ctrl->getLinkTarget($this, "editSettings"),
74  ["editSettings", "view"]
75  );
76  }
77 
78  if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
79  $this->tabs_gui->addTarget(
80  "perm_settings",
81  $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm"),
82  [],
83  'ilpermissiongui'
84  );
85  }
86  }
ilRbacSystem $rbac_system
+ Here is the call graph for this function:

◆ getSettingsForm()

ilObjNewsSettingsGUI::getSettingsForm ( )

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

References ilObjectGUI\$access, ilObjectGUI\$ctrl, $feed_set, $ilSetting, ilObjectGUI\$lng, ilObjectGUI\$settings, ilNewsItem\_lookupDefaultPDPeriod(), ilNewsItem\_lookupRSSPeriod(), ilRadioOption\setInfo(), ilFormPropertyGUI\setInfo(), ilSelectInputGUI\setOptions(), and ilLanguage\txt().

Referenced by editSettings(), and saveSettings().

95  {
96  $ilCtrl = $this->ctrl;
97  $lng = $this->lng;
99  $ilAccess = $this->access;
100 
101  $news_set = new ilSetting("news");
102  $feed_set = new ilSetting("feed");
103 
104  $enable_internal_news = $ilSetting->get("block_activated_news");
105  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
106  $rss_title_format = $news_set->get("rss_title_format");
107  $enable_private_feed = $news_set->get("enable_private_feed");
108  $news_default_visibility = ($news_set->get("default_visibility") != "")
109  ? $news_set->get("default_visibility")
110  : "users";
111 
112  $allow_shorter_periods = $news_set->get("allow_shorter_periods");
113  $allow_longer_periods = $news_set->get("allow_longer_periods");
114 
115  $rss_period = ilNewsItem::_lookupRSSPeriod();
116 
117  $form = new ilPropertyFormGUI();
118  $form->setFormAction($ilCtrl->getFormAction($this));
119  $form->setTitle($lng->txt("news_settings"));
120 
121  // Enable internal news
122  $cb_prop = new ilCheckboxInputGUI(
123  $lng->txt("news_enable_internal_news"),
124  "enable_internal_news"
125  );
126  $cb_prop->setValue("1");
127  $cb_prop->setInfo($lng->txt("news_enable_internal_news_info"));
128  $cb_prop->setChecked((bool) $enable_internal_news);
129  $form->addItem($cb_prop);
130 
131  // Default Visibility
132  $radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "news_default_visibility");
133  $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users");
134  $radio_group->addOption($radio_option);
135  $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public");
136  $radio_group->addOption($radio_option);
137  $radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
138  $radio_group->setRequired(false);
139  $radio_group->setValue($news_default_visibility);
140  $form->addItem($radio_group);
141 
142  // Number of news items per object
143  $nr_opts = [50 => 50, 100 => 100, 200 => 200];
144  $nr_sel = new ilSelectInputGUI(
145  $lng->txt("news_nr_of_items"),
146  "news_max_items"
147  );
148  $nr_sel->setInfo($lng->txt("news_nr_of_items_info"));
149  $nr_sel->setOptions($nr_opts);
150  $nr_sel->setValue((string) $news_set->get("max_items"));
151  $form->addItem($nr_sel);
152 
153  // Access Cache
154  $min_opts = [0 => 0, 1 => 1, 2 => 2, 5 => 5, 10 => 10, 20 => 20, 30 => 30, 60 => 60];
155  $min_sel = new ilSelectInputGUI(
156  $lng->txt("news_cache"),
157  "news_acc_cache_mins"
158  );
159  $min_sel->setInfo($lng->txt("news_cache_info"));
160  $min_sel->setOptions($min_opts);
161  $min_sel->setValue((string) $news_set->get("acc_cache_mins"));
162  $form->addItem($min_sel);
163 
164  // PD News Period
165  $per_opts = [
166  7 => "1 " . $lng->txt("week"),
167  30 => "1 " . $lng->txt("month"),
168  366 => "1 " . $lng->txt("year")
169  ];
170  $per_sel = new ilSelectInputGUI(
171  $lng->txt("news_pd_period"),
172  "news_pd_period"
173  );
174  $per_sel->setInfo($lng->txt("news_pd_period_info"));
175  $per_sel->setOptions($per_opts);
176  $per_sel->setValue((string) ilNewsItem::_lookupDefaultPDPeriod());
177  $form->addItem($per_sel);
178 
179  // Allow user to choose lower values
180  $sp_prop = new ilCheckboxInputGUI(
181  $lng->txt("news_allow_shorter_periods"),
182  "allow_shorter_periods"
183  );
184  $sp_prop->setValue("1");
185  $sp_prop->setInfo($lng->txt("news_allow_shorter_periods_info"));
186  $sp_prop->setChecked((bool) $allow_shorter_periods);
187  $form->addItem($sp_prop);
188 
189  // Allow user to choose higher values
190  $lp_prop = new ilCheckboxInputGUI(
191  $lng->txt("news_allow_longer_periods"),
192  "allow_longer_periods"
193  );
194  $lp_prop->setValue("1");
195  $lp_prop->setInfo($lng->txt("news_allow_longer_periods_info"));
196  $lp_prop->setChecked((bool) $allow_longer_periods);
197  $form->addItem($lp_prop);
198 
199  // Enable rss for internal news
200  $cb_prop = new ilCheckboxInputGUI(
201  $lng->txt("news_enable_internal_rss"),
202  "enable_internal_rss"
203  );
204  $cb_prop->setValue("1");
205  $cb_prop->setInfo($lng->txt("news_enable_internal_rss_info"));
206  $cb_prop->setChecked((bool) $enable_internal_rss);
207 
208  // RSS News Period
209  $rssp_opts = [
210  2 => "2 " . $lng->txt("days"),
211  3 => "3 " . $lng->txt("days"),
212  5 => "5 " . $lng->txt("days"),
213  7 => "1 " . $lng->txt("week"),
214  14 => "2 " . $lng->txt("weeks"),
215  30 => "1 " . $lng->txt("month"),
216  60 => "2 " . $lng->txt("months"),
217  120 => "4 " . $lng->txt("months"),
218  180 => "6 " . $lng->txt("months"),
219  365 => "1 " . $lng->txt("year")
220  ];
221  $rssp_sel = new ilSelectInputGUI(
222  $lng->txt("news_rss_period"),
223  "news_rss_period"
224  );
225  $rssp_sel->setOptions($rssp_opts);
226  $rssp_sel->setValue($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 = [
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(
248  $lng->txt("news_enable_private_feed"),
249  "enable_private_feed"
250  );
251  $cb_prop->setValue("1");
252  $cb_prop->setInfo($lng->txt("news_enable_private_feed_info"));
253  $cb_prop->setChecked((bool) $enable_private_feed);
254  $form->addItem($cb_prop);
255 
256  if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
257  // command buttons
258  $form->addCommandButton("saveSettings", $lng->txt("save"));
259  $form->addCommandButton("view", $lng->txt("cancel"));
260  }
261  return $form;
262  }
This class represents an option in a radio group.
static _lookupRSSPeriod()
This class represents a selection list property in a property form.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setInfo(string $a_info)
setOptions(array $a_options)
ilLanguage $lng
This class represents a property in a property form.
$feed_set
Definition: privfeed.php:33
global $ilSetting
Definition: privfeed.php:31
ilAccessHandler $access
ilSetting $settings
static _lookupDefaultPDPeriod()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveSettings()

ilObjNewsSettingsGUI::saveSettings ( )

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

References ilObjectGUI\$access, ilObjectGUI\$ctrl, $feed_set, $ilSetting, ilObjectGUI\$settings, getSettingsForm(), and ILIAS\Repository\lng().

264  : void
265  {
266  $ilCtrl = $this->ctrl;
268  $ilAccess = $this->access;
269 
270  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
271  $ilCtrl->redirect($this, "view");
272  }
273 
274  // empty news cache
275  $this->acache = new ilNewsCache();
276  $this->acache->deleteAllEntries();
277 
278  $news_set = new ilSetting("news");
279  $feed_set = new ilSetting("feed");
280 
281  $form = $this->getSettingsForm();
282 
283  if ($form->checkInput()) {
284  $ilSetting->set("block_activated_news", $form->getInput("enable_internal_news"));
285  $ilSetting->set("block_activated_pdnews", $form->getInput("enable_internal_news"));
286  $news_set->set("enable_rss_for_internal", $form->getInput("enable_internal_rss"));
287  $news_set->set("max_items", $form->getInput("news_max_items"));
288  $news_set->set("acc_cache_mins", $form->getInput("news_acc_cache_mins"));
289  $news_set->set("pd_period", $form->getInput("news_pd_period"));
290  $news_set->set("default_visibility", $form->getInput("news_default_visibility"));
291  $news_set->set("allow_shorter_periods", $form->getInput("allow_shorter_periods"));
292  $news_set->set("allow_longer_periods", $form->getInput("allow_longer_periods"));
293  $news_set->set("rss_period", $form->getInput("news_rss_period"));
294  $news_set->set("rss_title_format", $form->getInput("rss_title_format"));
295 
296  if ($form->getInput("enable_internal_rss")) {
297  $news_set->set("enable_private_feed", $form->getInput("enable_private_feed"));
298  } else {
299  $news_set->set("enable_private_feed", '0');
300  }
301 
302  $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
303  }
304 
305  $ilCtrl->redirect($this, "view");
306  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$feed_set
Definition: privfeed.php:33
global $ilSetting
Definition: privfeed.php:31
ilAccessHandler $access
ilSetting $settings
+ Here is the call graph for this function:

Field Documentation

◆ $acache

ilNewsCache ilObjNewsSettingsGUI::$acache
protected

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


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