ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 399 of file class.ilObjectServiceSettingsGUI.php.

400 {
402 $ilCtrl->returnToParent($this);
403 }
global $ilCtrl
Definition: ilias.php:18

References $ctrl, and $ilCtrl.

◆ editSettings()

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

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

Parameters
ilPropertyFormGUI$form

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

410 {
411 global $DIC;
412
413 $tpl = $DIC->ui()->mainTemplate();
414
415 if (!$form instanceof ilPropertyFormGUI) {
416 $form = $this->initSettingsForm();
417 }
418 $tpl->setContent($form->getHTML());
419 }
$tpl
Definition: ilias.php:10
This class represents a property form user interface.
if(isset($_POST['submit'])) $form

References $DIC, $form, and $tpl.

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 }

References $ctrl, and $ilCtrl.

◆ getModes()

ilObjectServiceSettingsGUI::getModes ( )

Get active modes.

Returns
bool

Definition at line 385 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 394 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 $lng = $DIC->language();
88
89 $lng->loadLanguageModule("obj");
90
91 // info tab
92 if (in_array(self::INFO_TAB_VISIBILITY, $services)) {
93 $info = new ilCheckboxInputGUI($lng->txt('obj_tool_setting_info_tab'), self::INFO_TAB_VISIBILITY);
94 $info->setValue(1);
96 $a_obj_id,
97 self::INFO_TAB_VISIBILITY,
98 true
99 ));
100 //$info->setOptionTitle($lng->txt('obj_tool_setting_info_tab'));
101 $info->setInfo($lng->txt('obj_tool_setting_info_tab_info'));
102 $form->addItem($info);
103 }
104
105 // calendar
106 if (in_array(self::CALENDAR_VISIBILITY, $services)) {
107 include_once './Services/Calendar/classes/class.ilObjCalendarSettings.php';
108 if (ilCalendarSettings::_getInstance()->isEnabled()) {
109 // Container tools (calendar, news, ... activation)
110 $cal = new ilCheckboxInputGUI($lng->txt('obj_tool_setting_calendar'), self::CALENDAR_VISIBILITY);
111 $cal->setValue(1);
112 include_once './Services/Calendar/classes/class.ilObjCalendarSettings.php';
113 $cal->setChecked(ilCalendarSettings::lookupCalendarActivated($a_obj_id));
114 //$cal->setOptionTitle($lng->txt('obj_tool_setting_calendar'));
115 $cal->setInfo($lng->txt('obj_tool_setting_calendar_info'));
116 $form->addItem($cal);
117 }
118 }
119
120 // news
121 if (in_array(self::USE_NEWS, $services)) {
122 $news = new ilCheckboxInputGUI($lng->txt('obj_tool_setting_use_news'), self::USE_NEWS);
123 $news->setValue(1);
125 $a_obj_id,
126 self::USE_NEWS,
127 true
128 );
129 $news->setChecked($checked);
130 $info = $lng->txt('obj_tool_setting_use_news_info');
131 if ($checked) {
132 $info .= " <a href='" . $ilCtrl->getLinkTargetByClass("ilcontainernewssettingsgui", "") .
133 "'>ยป " . $lng->txt('obj_tool_setting_use_news_open_settings') . "</a>";
134 }
135 $news->setInfo($info);
136 $form->addItem($news);
137 }
138 if (in_array(self::NEWS_VISIBILITY, $services)) {
139 if ($ilSetting->get('block_activated_news')) {
140 // Container tools (calendar, news, ... activation)
141 $news = new ilCheckboxInputGUI($lng->txt('obj_tool_setting_news'), self::NEWS_VISIBILITY);
142 $news->setValue(1);
143 $news->setChecked(ilContainer::_lookupContainerSetting(
144 $a_obj_id,
145 self::NEWS_VISIBILITY,
146 $ilSetting->get('block_activated_news', true)
147 ));
148 //$news->setOptionTitle($lng->txt('obj_tool_setting_news'));
149 $news->setInfo($lng->txt('obj_tool_setting_news_info'));
150 $form->addItem($news);
151
152 if (in_array(ilObject::_lookupType($a_obj_id), array('crs', 'grp'))) {
153 $ref_id = array_pop(ilObject::_getAllReferences($a_obj_id));
154
155 include_once 'Services/Membership/classes/class.ilMembershipNotifications.php';
157 }
158 }
159 }
160
161 // (local) custom metadata
162 if (in_array(self::CUSTOM_METADATA, $services)) {
163 $md = new ilCheckboxInputGUI($lng->txt('obj_tool_setting_custom_metadata'), self::CUSTOM_METADATA);
164 $md->setInfo($lng->txt('obj_tool_setting_custom_metadata_info'));
165 $md->setValue(1);
167 $a_obj_id,
168 self::CUSTOM_METADATA,
169 false
170 ));
171 $form->addItem($md);
172 }
173
174 // tag cloud
175 if (in_array(self::TAG_CLOUD, $services)) {
176 $tags_active = new ilSetting("tags");
177 if ($tags_active->get("enable", false)) {
178 $tag = new ilCheckboxInputGUI($lng->txt('obj_tool_setting_tag_cloud'), self::TAG_CLOUD);
179 $tag->setInfo($lng->txt('obj_tool_setting_tag_cloud_info'));
180 $tag->setValue(1);
182 $a_obj_id,
183 self::TAG_CLOUD,
184 false
185 ));
186 $form->addItem($tag);
187 }
188 }
189
190 // taxonomies
191 if (in_array(self::TAXONOMIES, $services)) {
192 $tax = new ilCheckboxInputGUI($lng->txt('obj_tool_setting_taxonomies'), self::TAXONOMIES);
193 $tax->setValue(1);
195 $a_obj_id,
196 self::TAXONOMIES,
197 false
198 ));
199 $form->addItem($tax);
200 }
201
202 // auto rating
203 if (in_array(self::AUTO_RATING_NEW_OBJECTS, $services)) {
204 $lng->loadLanguageModule("rating");
205
206 // auto rating for new objects
207 $rate = new ilCheckboxInputGUI($lng->txt('rating_new_objects_auto'), self::AUTO_RATING_NEW_OBJECTS);
208 $rate->setValue(1);
209 //$rate->setOptionTitle($lng->txt('rating_new_objects_auto'));
210 $rate->setInfo($lng->txt('rating_new_objects_auto_info'));
211 $rate->setChecked(ilContainer::_lookupContainerSetting(
212 $a_obj_id,
213 self::AUTO_RATING_NEW_OBJECTS,
214 false
215 ));
216 $form->addItem($rate);
217 }
218
219 // badges
220 if (in_array(self::BADGES, $services)) {
221 include_once 'Services/Badge/classes/class.ilBadgeHandler.php';
222 if (ilBadgeHandler::getInstance()->isActive()) {
223 $bdg = new ilCheckboxInputGUI($lng->txt('obj_tool_setting_badges'), self::BADGES);
224 $bdg->setInfo($lng->txt('obj_tool_setting_badges_info'));
225 $bdg->setValue(1);
227 $a_obj_id,
228 self::BADGES,
229 false
230 ));
231 $form->addItem($bdg);
232 }
233 }
234 if (in_array(self::ORGU_POSITION_ACCESS, $services)) {
235 $position_settings = ilOrgUnitGlobalSettings::getInstance()->getObjectPositionSettingsByType(
236 ilObject::_lookupType($a_obj_id)
237 );
238 if (
239 $position_settings->isActive()
240 ) {
241 $lia = new ilCheckboxInputGUI(
242 $GLOBALS['DIC']->language()->txt('obj_orgunit_positions'),
243 self::ORGU_POSITION_ACCESS
244 );
245 $lia->setInfo($GLOBALS['DIC']->language()->txt('obj_orgunit_positions_info'));
246 $lia->setValue(1);
247 $lia->setChecked(
248 (bool) ilOrgUnitGlobalSettings::getInstance()->isPositionAccessActiveForObject($a_obj_id)
249 );
250 if (!$position_settings->isChangeableForObject()) {
251 $lia->setDisabled(true);
252 }
253 $form->addItem($lia);
254 }
255 }
256
257 // skills
258 if (in_array(self::SKILLS, $services)) {
259 $skmg_set = new ilSetting("skmg");
260 if ($skmg_set->get("enable_skmg")) {
261 $skill = new ilCheckboxInputGUI($lng->txt('obj_tool_setting_skills'), self::SKILLS);
262 $skill->setInfo($lng->txt('obj_tool_setting_skills_info'));
263 $skill->setValue(1);
264 $skill->setChecked(ilContainer::_lookupContainerSetting(
265 $a_obj_id,
266 self::SKILLS,
267 false
268 ));
269 $form->addItem($skill);
270 }
271 }
272
273 return $form;
274 }
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
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
global $ilSetting
Definition: privfeed.php:17
$lng

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

Referenced by ilObjBookingPoolGUI\addExternalEditFormCustom(), ilObjTestSettingsGeneralGUI\buildForm(), ilObjContentPageGUI\initEditCustomForm(), ilObjExerciseGUI\initEditCustomForm(), ilObjMediaPoolGUI\initEditCustomForm(), ilObjCategoryGUI\initEditForm(), ilObjCourseGUI\initEditForm(), ilObjSessionGUI\initForm(), ilObjGroupGUI\initForm(), ilObjSurveyGUI\initPropertiesForm(), 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 454 of file class.ilObjectServiceSettingsGUI.php.

455 {
456 return in_array($a_mode, $this->getModes());
457 }

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 286 of file class.ilObjectServiceSettingsGUI.php.

287 {
288 // info
289 if (in_array(self::INFO_TAB_VISIBILITY, $services)) {
290 include_once './Services/Container/classes/class.ilContainer.php';
291 ilContainer::_writeContainerSetting($a_obj_id, self::INFO_TAB_VISIBILITY, (int) $form->getInput(self::INFO_TAB_VISIBILITY));
292 }
293
294 // calendar
295 if (in_array(self::CALENDAR_VISIBILITY, $services)) {
296 include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
297 if (ilCalendarSettings::_getInstance()->isEnabled()) {
298 include_once './Services/Container/classes/class.ilContainer.php';
299 ilContainer::_writeContainerSetting($a_obj_id, self::CALENDAR_VISIBILITY, (int) $form->getInput(self::CALENDAR_VISIBILITY));
300 }
301 }
302
303 // news
304 if (in_array(self::USE_NEWS, $services)) {
305 include_once './Services/Container/classes/class.ilContainer.php';
306 ilContainer::_writeContainerSetting($a_obj_id, self::USE_NEWS, (int) $form->getInput(self::USE_NEWS));
307 }
308 if (in_array(self::NEWS_VISIBILITY, $services)) {
309 include_once './Services/Container/classes/class.ilContainer.php';
310 ilContainer::_writeContainerSetting($a_obj_id, self::NEWS_VISIBILITY, (int) $form->getInput(self::NEWS_VISIBILITY));
311
312 if (in_array(ilObject::_lookupType($a_obj_id), array('crs', 'grp'))) {
313 $ref_id = array_pop(ilObject::_getAllReferences($a_obj_id));
314
315 include_once "Services/Membership/classes/class.ilMembershipNotifications.php";
317 }
318 }
319
320 // rating
321 if (in_array(self::AUTO_RATING_NEW_OBJECTS, $services)) {
322 include_once './Services/Container/classes/class.ilContainer.php';
323 ilContainer::_writeContainerSetting($a_obj_id, self::AUTO_RATING_NEW_OBJECTS, (int) $form->getInput(self::AUTO_RATING_NEW_OBJECTS));
324 }
325
326 // taxonomies
327 if (in_array(self::TAXONOMIES, $services)) {
328 include_once './Services/Container/classes/class.ilContainer.php';
329 ilContainer::_writeContainerSetting($a_obj_id, self::TAXONOMIES, (int) $form->getInput(self::TAXONOMIES));
330 }
331
332 // tag cloud
333 if (in_array(self::TAG_CLOUD, $services)) {
334 include_once './Services/Container/classes/class.ilContainer.php';
335 ilContainer::_writeContainerSetting($a_obj_id, self::TAG_CLOUD, (int) $form->getInput(self::TAG_CLOUD));
336 }
337
338 // (local) custom metadata
339 if (in_array(self::CUSTOM_METADATA, $services)) {
340 include_once './Services/Container/classes/class.ilContainer.php';
341 ilContainer::_writeContainerSetting($a_obj_id, self::CUSTOM_METADATA, (int) $form->getInput(self::CUSTOM_METADATA));
342 }
343
344 // badges
345 if (in_array(self::BADGES, $services)) {
346 include_once 'Services/Badge/classes/class.ilBadgeHandler.php';
347 if (ilBadgeHandler::getInstance()->isActive()) {
348 include_once './Services/Container/classes/class.ilContainer.php';
349 ilContainer::_writeContainerSetting($a_obj_id, self::BADGES, (int) $form->getInput(self::BADGES));
350 }
351 }
352
353 // extended user access
354 if (in_array(self::ORGU_POSITION_ACCESS, $services)) {
355 $position_settings = ilOrgUnitGlobalSettings::getInstance()->getObjectPositionSettingsByType(
356 ilObject::_lookupType($a_obj_id)
357 );
358
359 if ($position_settings->isActive() && $position_settings->isChangeableForObject()) {
360 $orgu_object_settings = new ilOrgUnitObjectPositionSetting($a_obj_id);
361 $orgu_object_settings->setActive(
362 (int) $form->getInput(self::ORGU_POSITION_ACCESS)
363 );
364 $orgu_object_settings->update();
365 }
366 }
367
368 // skills
369 if (in_array(self::SKILLS, $services)) {
370 $skmg_set = new ilSetting("skmg");
371 if ($skmg_set->get("enable_skmg")) {
372 include_once './Services/Container/classes/class.ilContainer.php';
373 ilContainer::_writeContainerSetting($a_obj_id, self::SKILLS, (int) $form->getInput(self::SKILLS));
374 }
375 }
376
377 return true;
378 }
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 ilObjTestSettingsGeneralGUI\performSaveForm(), ilObjSessionGUI\saveObject(), ilObjGlossaryGUI\saveProperties(), ilObjSurveyGUI\savePropertiesObject(), ilObjWikiGUI\saveSettingsObject(), ilIndividualAssessmentSettingsGUI\update(), ilObjContentPageGUI\updateCustom(), ilObjBookingPoolGUI\updateCustom(), ilObjExerciseGUI\updateCustom(), ilObjMediaPoolGUI\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 425 of file class.ilObjectServiceSettingsGUI.php.

426 {
427 global $DIC;
428
429 $lng = $DIC->language();
431
432 $form = $this->initSettingsForm();
433 if ($form->checkInput()) {
434 include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
435 if (ilCalendarSettings::_getInstance()->isEnabled()) {
436 if ($this->isModeActive(self::CALENDAR_VISIBILITY)) {
437 ilContainer::_writeContainerSetting($this->getObjId(), 'show_calendar', (int) $form->getInput('calendar'));
438 }
439 }
440 ilUtil::sendSuccess($lng->txt('settings_saved'), true);
441 $ctrl->redirect($this);
442 }
443
444 ilUtil::sendFailure($lng->txt('err_check_input'));
445 $form->setValuesByPost();
446 $this->editSettings($form);
447 }
editSettings(ilPropertyFormGUI $form=null)
Edit tool settings (calendar, news, comments, ...)
isModeActive($a_mode)
Check if specific mode is active.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References $ctrl, $DIC, $form, $lng, ilCalendarSettings\_getInstance(), ilContainer\_writeContainerSetting(), editSettings(), getObjId(), isModeActive(), and ilUtil\sendFailure().

+ 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 cancel(), executeCommand(), and updateToolSettings().

◆ $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

const ilObjectServiceSettingsGUI::AUTO_RATING_NEW_OBJECTS = 'cont_auto_rate_new_obj'

◆ 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: