ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilObjectServiceSettingsGUI Class Reference

GUI class for service settings (calendar, notes, comments) More...

+ Collaboration diagram for ilObjectServiceSettingsGUI:

Public Member Functions

 __construct ($a_parent_gui, $a_obj_id, $a_modes)
 Constructor. More...
 
 executeCommand ()
 Control class handling. More...
 
 getModes ()
 Get active modes. More...
 
 getObjId ()
 Get obj id. More...
 

Static Public Member Functions

static initServiceSettingsForm ($a_obj_id, ilPropertyFormGUI $form, $services)
 Init service settings form. More...
 
static updateServiceSettingsForm ($a_obj_id, ilPropertyFormGUI $form, $services)
 Update service settings. More...
 

Data Fields

const CALENDAR_VISIBILITY = 'cont_show_calendar'
 
const NEWS_VISIBILITY = 'cont_show_news'
 
const USE_NEWS = 'cont_use_news'
 
const AUTO_RATING_NEW_OBJECTS = 'cont_auto_rate_new_obj'
 
const INFO_TAB_VISIBILITY = 'cont_show_info_tab'
 
const TAXONOMIES = 'cont_taxonomies'
 
const TAG_CLOUD = 'cont_tag_cloud'
 
const CUSTOM_METADATA = 'cont_custom_md'
 
const BADGES = 'cont_badges'
 
const ORGU_POSITION_ACCESS = 'obj_orgunit_positions'
 
const SKILLS = 'cont_skills'
 

Protected Member Functions

 cancel ()
 
 editSettings (ilPropertyFormGUI $form=null)
 Edit tool settings (calendar, news, comments, ...) More...
 
 updateToolSettings ()
 Update settings. More...
 
 isModeActive ($a_mode)
 Check if specific mode is active. More...
 

Protected Attributes

 $ctrl
 

Private Attributes

 $gui = null
 
 $modes = array()
 
 $obj_id = 0
 

Detailed Description

GUI class for service settings (calendar, notes, comments)

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

@ilCtrl_Calls ilObjectServiceSettingsGUI:

Definition at line 14 of file class.ilObjectServiceSettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjectServiceSettingsGUI::__construct (   $a_parent_gui,
  $a_obj_id,
  $a_modes 
)

Constructor.

Parameters
type$a_parent_gui

Definition at line 46 of file class.ilObjectServiceSettingsGUI.php.

47 {
48 global $DIC;
49
50 $this->ctrl = $DIC->ctrl();
51 $this->gui = $a_parent_gui;
52 $this->modes = $a_modes;
53 $this->obj_id = $a_obj_id;
54 }
global $DIC
Definition: saml.php:7

References $DIC.

Member Function Documentation

◆ cancel()

ilObjectServiceSettingsGUI::cancel ( )
protected

Definition at line 396 of file class.ilObjectServiceSettingsGUI.php.

397 {
398 $GLOBALS['ilCtrl']->returnToParent($this);
399 }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

References $GLOBALS.

◆ editSettings()

ilObjectServiceSettingsGUI::editSettings ( ilPropertyFormGUI  $form = null)
protected

Edit tool settings (calendar, news, comments, ...)

Parameters
ilPropertyFormGUI$form

Definition at line 405 of file class.ilObjectServiceSettingsGUI.php.

406 {
407 if (!$form instanceof ilPropertyFormGUI) {
408 $form = $this->initSettingsForm();
409 }
410 $GLOBALS['tpl']->setContent($form->getHTML());
411 }
This class represents a property form user interface.
if(isset($_POST['submit'])) $form

References $form, and $GLOBALS.

Referenced by updateToolSettings().

+ Here is the caller graph for this function:

◆ executeCommand()

ilObjectServiceSettingsGUI::executeCommand ( )

Control class handling.

Returns

Definition at line 62 of file class.ilObjectServiceSettingsGUI.php.

63 {
65
66 $next_class = $ilCtrl->getNextClass($this);
67 $cmd = $ilCtrl->getCmd('editSettings');
68
69 switch ($next_class) {
70 default:
71 $this->$cmd();
72 break;
73 }
74 }
global $ilCtrl
Definition: ilias.php:18

References $ctrl, and $ilCtrl.

◆ getModes()

ilObjectServiceSettingsGUI::getModes ( )

Get active modes.

Returns
bool

Definition at line 382 of file class.ilObjectServiceSettingsGUI.php.

References $modes.

Referenced by isModeActive().

+ Here is the caller graph for this function:

◆ getObjId()

ilObjectServiceSettingsGUI::getObjId ( )

Get obj id.

Returns
type

Definition at line 391 of file class.ilObjectServiceSettingsGUI.php.

References $obj_id.

Referenced by updateToolSettings().

+ Here is the caller graph for this function:

◆ initServiceSettingsForm()

static ilObjectServiceSettingsGUI::initServiceSettingsForm (   $a_obj_id,
ilPropertyFormGUI  $form,
  $services 
)
static

Init service settings form.

Parameters
ilPropertyFormGUI$form
type$services

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

82 {
83 global $DIC;
84
85 $ilSetting = $DIC->settings();
86 $ilCtrl = $DIC->ctrl();
87
88 // info tab
89 if (in_array(self::INFO_TAB_VISIBILITY, $services)) {
90 $info = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_info_tab'), self::INFO_TAB_VISIBILITY);
91 $info->setValue(1);
93 $a_obj_id,
94 self::INFO_TAB_VISIBILITY,
95 true
96 ));
97 //$info->setOptionTitle($GLOBALS['lng']->txt('obj_tool_setting_info_tab'));
98 $info->setInfo($GLOBALS['lng']->txt('obj_tool_setting_info_tab_info'));
99 $form->addItem($info);
100 }
101
102 // calendar
103 if (in_array(self::CALENDAR_VISIBILITY, $services)) {
104 include_once './Services/Calendar/classes/class.ilObjCalendarSettings.php';
105 if (ilCalendarSettings::_getInstance()->isEnabled()) {
106 // Container tools (calendar, news, ... activation)
107 $cal = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_calendar'), self::CALENDAR_VISIBILITY);
108 $cal->setValue(1);
109 include_once './Services/Calendar/classes/class.ilObjCalendarSettings.php';
110 $cal->setChecked(ilCalendarSettings::lookupCalendarActivated($a_obj_id));
111 //$cal->setOptionTitle($GLOBALS['lng']->txt('obj_tool_setting_calendar'));
112 $cal->setInfo($GLOBALS['lng']->txt('obj_tool_setting_calendar_info'));
113 $form->addItem($cal);
114 }
115 }
116
117 // news
118 if (in_array(self::USE_NEWS, $services)) {
119 $news = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_use_news'), self::USE_NEWS);
120 $news->setValue(1);
122 $a_obj_id,
123 self::USE_NEWS,
124 true
125 );
126 $news->setChecked($checked);
127 $info = $GLOBALS['lng']->txt('obj_tool_setting_use_news_info');
128 if ($checked) {
129 $info.=" <a href='" . $ilCtrl->getLinkTargetByClass("ilcontainernewssettingsgui", "") .
130 "'>ยป " . $GLOBALS['lng']->txt('obj_tool_setting_use_news_open_settings') . "</a>";
131 }
132 $news->setInfo($info);
133 $form->addItem($news);
134 }
135 if (in_array(self::NEWS_VISIBILITY, $services)) {
136 if ($ilSetting->get('block_activated_news')) {
137 // Container tools (calendar, news, ... activation)
138 $news = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_news'), self::NEWS_VISIBILITY);
139 $news->setValue(1);
140 $news->setChecked(ilContainer::_lookupContainerSetting(
141 $a_obj_id,
142 self::NEWS_VISIBILITY,
143 $ilSetting->get('block_activated_news', true)
144 ));
145 //$news->setOptionTitle($GLOBALS['lng']->txt('obj_tool_setting_news'));
146 $news->setInfo($GLOBALS['lng']->txt('obj_tool_setting_news_info'));
147 $form->addItem($news);
148
149 if (in_array(ilObject::_lookupType($a_obj_id), array('crs', 'grp'))) {
150 $ref_id = array_pop(ilObject::_getAllReferences($a_obj_id));
151
152 include_once 'Services/Membership/classes/class.ilMembershipNotifications.php';
154 }
155 }
156 }
157
158 // (local) custom metadata
159 if (in_array(self::CUSTOM_METADATA, $services)) {
160 $md = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_custom_metadata'), self::CUSTOM_METADATA);
161 $md->setInfo($GLOBALS['lng']->txt('obj_tool_setting_custom_metadata_info'));
162 $md->setValue(1);
164 $a_obj_id,
165 self::CUSTOM_METADATA,
166 false
167 ));
168 $form->addItem($md);
169 }
170
171 // tag cloud
172 if (in_array(self::TAG_CLOUD, $services)) {
173 $tags_active = new ilSetting("tags");
174 if ($tags_active->get("enable", false)) {
175 $tag = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_tag_cloud'), self::TAG_CLOUD);
176 $tag->setInfo($GLOBALS['lng']->txt('obj_tool_setting_tag_cloud_info'));
177 $tag->setValue(1);
179 $a_obj_id,
180 self::TAG_CLOUD,
181 false
182 ));
183 $form->addItem($tag);
184 }
185 }
186
187 // taxonomies
188 if (in_array(self::TAXONOMIES, $services)) {
189 $tax = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_taxonomies'), self::TAXONOMIES);
190 $tax->setValue(1);
192 $a_obj_id,
193 self::TAXONOMIES,
194 false
195 ));
196 $form->addItem($tax);
197 }
198
199 // auto rating
200 if (in_array(self::AUTO_RATING_NEW_OBJECTS, $services)) {
201 $GLOBALS['lng']->loadLanguageModule("rating");
202
203 // auto rating for new objects
204 $rate = new ilCheckboxInputGUI($GLOBALS['lng']->txt('rating_new_objects_auto'), self::AUTO_RATING_NEW_OBJECTS);
205 $rate->setValue(1);
206 //$rate->setOptionTitle($GLOBALS['lng']->txt('rating_new_objects_auto'));
207 $rate->setInfo($GLOBALS['lng']->txt('rating_new_objects_auto_info'));
208 $rate->setChecked(ilContainer::_lookupContainerSetting(
209 $a_obj_id,
210 self::AUTO_RATING_NEW_OBJECTS,
211 false
212 ));
213 $form->addItem($rate);
214 }
215
216 // badges
217 if (in_array(self::BADGES, $services)) {
218 include_once 'Services/Badge/classes/class.ilBadgeHandler.php';
219 if (ilBadgeHandler::getInstance()->isActive()) {
220 $bdg = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_badges'), self::BADGES);
221 $bdg->setInfo($GLOBALS['lng']->txt('obj_tool_setting_badges_info'));
222 $bdg->setValue(1);
224 $a_obj_id,
225 self::BADGES,
226 false
227 ));
228 $form->addItem($bdg);
229 }
230 }
231 if (in_array(self::ORGU_POSITION_ACCESS, $services)) {
232 $position_settings = ilOrgUnitGlobalSettings::getInstance()->getObjectPositionSettingsByType(
233 ilObject::_lookupType($a_obj_id)
234 );
235 if (
236 $position_settings->isActive()
237 ) {
238 $lia = new ilCheckboxInputGUI(
239 $GLOBALS['DIC']->language()->txt('obj_orgunit_positions'),
240 self::ORGU_POSITION_ACCESS
241 );
242 $lia->setInfo($GLOBALS['DIC']->language()->txt('obj_orgunit_positions_info'));
243 $lia->setValue(1);
244 $lia->setChecked(
245 (bool) ilOrgUnitGlobalSettings::getInstance()->isPositionAccessActiveForObject($a_obj_id)
246 );
247 if (!$position_settings->isChangeableForObject()) {
248 $lia->setDisabled(true);
249 }
250 $form->addItem($lia);
251 }
252 }
253
254 // skills
255 if (in_array(self::SKILLS, $services)) {
256 $skmg_set = new ilSetting("skmg");
257 if ($skmg_set->get("enable_skmg")) {
258 $skill = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_skills'), self::SKILLS);
259 $skill->setInfo($GLOBALS['lng']->txt('obj_tool_setting_skills_info'));
260 $skill->setValue(1);
261 $skill->setChecked(ilContainer::_lookupContainerSetting(
262 $a_obj_id,
263 self::SKILLS,
264 false
265 ));
266 $form->addItem($skill);
267 }
268 }
269
270 return $form;
271 }
static getInstance()
Constructor.
static _getInstance()
get singleton instance
static lookupCalendarActivated($a_obj_id)
This class represents a checkbox property in a property form.
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
static addToSettingsForm($a_ref_id, ilPropertyFormGUI $a_form=null, ilFormPropertyGUI $a_input=null)
Add notification settings to form.
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
ILIAS Setting Class.
if(function_exists( 'posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Definition: cron.php:35
$info
Definition: index.php:5
global $ilSetting
Definition: privfeed.php:17

References $DIC, $form, $GLOBALS, $ilCtrl, $ilSetting, $info, $tag, ilObject\_getAllReferences(), ilCalendarSettings\_getInstance(), ilContainer\_lookupContainerSetting(), ilObject\_lookupType(), ilMembershipNotifications\addToSettingsForm(), ilOrgUnitGlobalSettings\getInstance(), ilBadgeHandler\getInstance(), and ilCalendarSettings\lookupCalendarActivated().

Referenced by ilObjBookingPoolGUI\addExternalEditFormCustom(), ilObjExerciseGUI\initEditCustomForm(), ilObjCategoryGUI\initEditForm(), ilObjCourseGUI\initEditForm(), ilObjSessionGUI\initForm(), ilObjGroupGUI\initForm(), ilObjGlossaryGUI\initSettingsForm(), ilObjWikiGUI\initSettingsForm(), and ilIndividualAssessmentSettingsGUI\initSettingsForm().

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

◆ isModeActive()

ilObjectServiceSettingsGUI::isModeActive (   $a_mode)
protected

Check if specific mode is active.

Parameters
type$a_mode
Returns
type

Definition at line 441 of file class.ilObjectServiceSettingsGUI.php.

442 {
443 return in_array($a_mode, $this->getModes());
444 }

References getModes().

Referenced by updateToolSettings().

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

◆ updateServiceSettingsForm()

static ilObjectServiceSettingsGUI::updateServiceSettingsForm (   $a_obj_id,
ilPropertyFormGUI  $form,
  $services 
)
static

Update service settings.

Parameters
int$a_obj_id
ilPropertyFormGUI$form
string[]$services
Returns
bool

Definition at line 283 of file class.ilObjectServiceSettingsGUI.php.

284 {
285 // info
286 if (in_array(self::INFO_TAB_VISIBILITY, $services)) {
287 include_once './Services/Container/classes/class.ilContainer.php';
288 ilContainer::_writeContainerSetting($a_obj_id, self::INFO_TAB_VISIBILITY, (int) $form->getInput(self::INFO_TAB_VISIBILITY));
289 }
290
291 // calendar
292 if (in_array(self::CALENDAR_VISIBILITY, $services)) {
293 include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
294 if (ilCalendarSettings::_getInstance()->isEnabled()) {
295 include_once './Services/Container/classes/class.ilContainer.php';
296 ilContainer::_writeContainerSetting($a_obj_id, self::CALENDAR_VISIBILITY, (int) $form->getInput(self::CALENDAR_VISIBILITY));
297 }
298 }
299
300 // news
301 if (in_array(self::USE_NEWS, $services)) {
302 include_once './Services/Container/classes/class.ilContainer.php';
303 ilContainer::_writeContainerSetting($a_obj_id, self::USE_NEWS, (int) $form->getInput(self::USE_NEWS));
304 }
305 if (in_array(self::NEWS_VISIBILITY, $services)) {
306 include_once './Services/Container/classes/class.ilContainer.php';
307 ilContainer::_writeContainerSetting($a_obj_id, self::NEWS_VISIBILITY, (int) $form->getInput(self::NEWS_VISIBILITY));
308
309 if (in_array(ilObject::_lookupType($a_obj_id), array('crs', 'grp'))) {
310 $ref_id = array_pop(ilObject::_getAllReferences($a_obj_id));
311
312 include_once "Services/Membership/classes/class.ilMembershipNotifications.php";
314 }
315 }
316
317 // rating
318 if (in_array(self::AUTO_RATING_NEW_OBJECTS, $services)) {
319 include_once './Services/Container/classes/class.ilContainer.php';
320 ilContainer::_writeContainerSetting($a_obj_id, self::AUTO_RATING_NEW_OBJECTS, (int) $form->getInput(self::AUTO_RATING_NEW_OBJECTS));
321 }
322
323 // taxonomies
324 if (in_array(self::TAXONOMIES, $services)) {
325 include_once './Services/Container/classes/class.ilContainer.php';
326 ilContainer::_writeContainerSetting($a_obj_id, self::TAXONOMIES, (int) $form->getInput(self::TAXONOMIES));
327 }
328
329 // tag cloud
330 if (in_array(self::TAG_CLOUD, $services)) {
331 include_once './Services/Container/classes/class.ilContainer.php';
332 ilContainer::_writeContainerSetting($a_obj_id, self::TAG_CLOUD, (int) $form->getInput(self::TAG_CLOUD));
333 }
334
335 // (local) custom metadata
336 if (in_array(self::CUSTOM_METADATA, $services)) {
337 include_once './Services/Container/classes/class.ilContainer.php';
338 ilContainer::_writeContainerSetting($a_obj_id, self::CUSTOM_METADATA, (int) $form->getInput(self::CUSTOM_METADATA));
339 }
340
341 // badges
342 if (in_array(self::BADGES, $services)) {
343 include_once 'Services/Badge/classes/class.ilBadgeHandler.php';
344 if (ilBadgeHandler::getInstance()->isActive()) {
345 include_once './Services/Container/classes/class.ilContainer.php';
346 ilContainer::_writeContainerSetting($a_obj_id, self::BADGES, (int) $form->getInput(self::BADGES));
347 }
348 }
349
350 // extended user access
351 if (in_array(self::ORGU_POSITION_ACCESS, $services)) {
352 $position_settings = ilOrgUnitGlobalSettings::getInstance()->getObjectPositionSettingsByType(
353 ilObject::_lookupType($a_obj_id)
354 );
355
356 if ($position_settings->isActive() && $position_settings->isChangeableForObject()) {
357 $orgu_object_settings = new ilOrgUnitObjectPositionSetting($a_obj_id);
358 $orgu_object_settings->setActive(
359 (int) $form->getInput(self::ORGU_POSITION_ACCESS)
360 );
361 $orgu_object_settings->update();
362 }
363 }
364
365 // skills
366 if (in_array(self::SKILLS, $services)) {
367 $skmg_set = new ilSetting("skmg");
368 if ($skmg_set->get("enable_skmg")) {
369 include_once './Services/Container/classes/class.ilContainer.php';
370 ilContainer::_writeContainerSetting($a_obj_id, self::SKILLS, (int) $form->getInput(self::SKILLS));
371 }
372 }
373
374 return true;
375 }
static _writeContainerSetting($a_id, $a_keyword, $a_value)
static importFromForm($a_ref_id, ilPropertyFormGUI $a_form=null)
Import notification settings from form.
Stores object activation status of orgunit position settings.

References $form, ilObject\_getAllReferences(), ilCalendarSettings\_getInstance(), ilObject\_lookupType(), ilContainer\_writeContainerSetting(), ilOrgUnitGlobalSettings\getInstance(), ilBadgeHandler\getInstance(), and ilMembershipNotifications\importFromForm().

Referenced by ilObjSessionGUI\saveObject(), ilObjGlossaryGUI\saveProperties(), ilObjWikiGUI\saveSettingsObject(), ilIndividualAssessmentSettingsGUI\update(), ilObjBookingPoolGUI\updateCustom(), ilObjExerciseGUI\updateCustom(), ilObjCategoryGUI\updateObject(), ilObjCourseGUI\updateObject(), ilObjGroupGUI\updateObject(), and ilObjSessionGUI\updateObject().

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

◆ updateToolSettings()

ilObjectServiceSettingsGUI::updateToolSettings ( )
protected

Update settings.

Definition at line 417 of file class.ilObjectServiceSettingsGUI.php.

418 {
419 $form = $this->initSettingsForm();
420 if ($form->checkInput()) {
421 include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
422 if (ilCalendarSettings::_getInstance()->isEnabled()) {
423 if ($this->isModeActive(self::CALENDAR_VISIBILITY)) {
424 ilContainer::_writeContainerSetting($this->getObjId(), 'show_calendar', (int) $form->getInput('calendar'));
425 }
426 }
427 ilUtil::sendSuccess($GLOBALS['lng']->txt('settings_saved'), true);
428 $GLOBALS['ilCtrl']->redirect($this);
429 }
430
431 ilUtil::sendFailure($GLOBALS['lng']->txt('err_check_input'));
432 $form->setValuesByPost();
433 $this->editSettings($form);
434 }
editSettings(ilPropertyFormGUI $form=null)
Edit tool settings (calendar, news, comments, ...)
isModeActive($a_mode)
Check if specific mode is active.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References $form, $GLOBALS, ilCalendarSettings\_getInstance(), ilContainer\_writeContainerSetting(), editSettings(), getObjId(), isModeActive(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilObjectServiceSettingsGUI::$ctrl
protected

Definition at line 19 of file class.ilObjectServiceSettingsGUI.php.

Referenced by executeCommand().

◆ $gui

ilObjectServiceSettingsGUI::$gui = null
private

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

◆ $modes

ilObjectServiceSettingsGUI::$modes = array()
private

Definition at line 39 of file class.ilObjectServiceSettingsGUI.php.

Referenced by getModes().

◆ $obj_id

ilObjectServiceSettingsGUI::$obj_id = 0
private

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

Referenced by getObjId().

◆ AUTO_RATING_NEW_OBJECTS

◆ BADGES

◆ CALENDAR_VISIBILITY

◆ CUSTOM_METADATA

◆ INFO_TAB_VISIBILITY

◆ NEWS_VISIBILITY

◆ ORGU_POSITION_ACCESS

◆ SKILLS

◆ TAG_CLOUD

◆ TAXONOMIES

◆ USE_NEWS


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