ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
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)
 
 executeCommand ()
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 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

readonly NewsCache $cache
 
- Protected Attributes inherited from ilObjectGUI
ILIAS Notes Service $notes_service
 
GlobalHttpState $http
 
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
 
CustomIconFactory $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 ()
 @abstract 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

News Settings.

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

Definition at line 27 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 31 of file class.ilObjNewsSettingsGUI.php.

32 {
33 global $DIC;
34 $this->cache = $DIC->news()->internal()->repo()->cache();
35
36 $this->type = 'nwss';
37 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
38
39 $this->lng->loadLanguageModule('news');
40 $this->lng->loadLanguageModule('feed');
41 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ editSettings()

ilObjNewsSettingsGUI::editSettings ( )

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

93 : void
94 {
95 $form = $this->getSettingsForm();
96 $this->tpl->setContent($form->getHTML());
97 }

References getSettingsForm().

+ Here is the call graph for this function:

◆ executeCommand()

ilObjNewsSettingsGUI::executeCommand ( )

Reimplemented from ilObjectGUI.

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

43 : void
44 {
45 $next_class = $this->ctrl->getNextClass($this);
46 $cmd = $this->ctrl->getCmd();
47
48 $this->prepareOutput();
49
50 if (!$this->rbac_system->checkAccess("read", $this->object->getRefId())) {
51 throw new ilPermissionException($this->lng->txt('no_permission'));
52 }
53
54 switch ($next_class) {
55 case 'ilpermissiongui':
56 $this->tabs_gui->setTabActive('perm_settings');
57 $perm_gui = new ilPermissionGUI($this);
58 $this->ctrl->forwardCommand($perm_gui);
59 break;
60
61 default:
62 if ($cmd === null || $cmd === '' || $cmd === 'view') {
63 $cmd = "editSettings";
64 }
65
66 $this->$cmd();
67 break;
68 }
69 }
prepareOutput(bool $show_sub_objects=true)

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

+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjNewsSettingsGUI::getAdminTabs ( )

administration tabs show only permissions and trash folder

Reimplemented from ilObjectGUI.

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

71 : void
72 {
73 $rbacsystem = $this->rbac_system;
74
75 if ($rbacsystem->checkAccess("read", $this->object->getRefId())) {
76 $this->tabs_gui->addTarget(
77 "news_edit_news_settings",
78 $this->ctrl->getLinkTarget($this, "editSettings"),
79 ["editSettings", "view"]
80 );
81 }
82
83 if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
84 $this->tabs_gui->addTarget(
85 "perm_settings",
86 $this->ctrl->getLinkTargetByClass(ilPermissionGUI::class, "perm"),
87 [],
88 ilPermissionGUI::class
89 );
90 }
91 }
ilRbacSystem $rbac_system

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

+ Here is the call graph for this function:

◆ getSettingsForm()

ilObjNewsSettingsGUI::getSettingsForm ( )

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

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

References ilObjectGUI\$access, ilObjectGUI\$ctrl, $feed_set, $ilSetting, ilObjectGUI\$lng, ILIAS\UI\Implementation\Component\Input\Field\$options, ilObjectGUI\$settings, ilNewsItem\_lookupDefaultPDPeriod(), ilNewsItem\_lookupRSSPeriod(), and ilLanguage\txt().

Referenced by editSettings(), and saveSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveSettings()

ilObjNewsSettingsGUI::saveSettings ( )

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

269 : void
270 {
271 $ilCtrl = $this->ctrl;
273 $ilAccess = $this->access;
274
275 if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
276 $ilCtrl->redirect($this, "view");
277 }
278
279 // empty news cache
280 $this->cache->flush();
281
282 $news_set = new ilSetting("news");
283 $feed_set = new ilSetting("feed");
284
285 $form = $this->getSettingsForm();
286
287 if ($form->checkInput()) {
288 $ilSetting->set("block_activated_news", $form->getInput("enable_internal_news"));
289 $ilSetting->set("block_activated_pdnews", $form->getInput("enable_internal_news"));
290 $news_set->set("enable_rss_for_internal", $form->getInput("enable_internal_rss"));
291 $news_set->set("max_items", $form->getInput("news_max_items"));
292 $news_set->set("acc_cache_mins", $form->getInput("news_acc_cache_mins"));
293 $news_set->set("pd_period", $form->getInput("news_pd_period"));
294 $news_set->set("default_visibility", $form->getInput("news_default_visibility"));
295 $news_set->set("allow_shorter_periods", $form->getInput("allow_shorter_periods"));
296 $news_set->set("allow_longer_periods", $form->getInput("allow_longer_periods"));
297 $news_set->set("rss_period", $form->getInput("news_rss_period"));
298 $news_set->set("rss_title_format", $form->getInput("rss_title_format"));
299
300 if ($form->getInput("enable_internal_rss")) {
301 $news_set->set("enable_private_feed", $form->getInput("enable_private_feed"));
302 } else {
303 $news_set->set("enable_private_feed", '0');
304 }
305
306 $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
307 }
308
309 $ilCtrl->redirect($this, "view");
310 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $cache

readonly NewsCache ilObjNewsSettingsGUI::$cache
protected

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


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