ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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'
 

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

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$

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

40  {
41  $this->gui = $a_parent_gui;
42  $this->modes = $a_modes;
43  $this->obj_id = $a_obj_id;
44  }

Member Function Documentation

◆ cancel()

ilObjectServiceSettingsGUI::cancel ( )
protected

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

References $GLOBALS.

347  {
348  $GLOBALS['ilCtrl']->returnToParent($this);
349  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

◆ editSettings()

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

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

Parameters
ilPropertyFormGUI$form

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

References $GLOBALS.

Referenced by updateToolSettings().

356  {
357  if(!$form instanceof ilPropertyFormGUI)
358  {
359  $form = $this->initSettingsForm();
360  }
361  $GLOBALS['tpl']->setContent($form->getHTML());
362  }
This class represents a property form user interface.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjectServiceSettingsGUI::executeCommand ( )

Control class handling.

Returns

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

References $cmd, and $ilCtrl.

53  {
54  global $ilCtrl;
55 
56  $next_class = $ilCtrl->getNextClass($this);
57  $cmd = $ilCtrl->getCmd('editSettings');
58 
59  switch($next_class)
60  {
61  default:
62  $this->$cmd();
63  break;
64  }
65  }
$cmd
Definition: sahs_server.php:35
global $ilCtrl
Definition: ilias.php:18

◆ getModes()

ilObjectServiceSettingsGUI::getModes ( )

Get active modes.

Returns
bool

Definition at line 332 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 341 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 72 of file class.ilObjectServiceSettingsGUI.php.

References $GLOBALS, $ilCtrl, $ilSetting, $info, $ref_id, ilObject\_getAllReferences(), ilCalendarSettings\_getInstance(), ilContainer\_lookupContainerSetting(), ilObject\_lookupType(), ilPropertyFormGUI\addItem(), ilMembershipNotifications\addToSettingsForm(), array, ilBadgeHandler\getInstance(), and ilCalendarSettings\lookupCalendarActivated().

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

73  {
74  global $ilSetting, $ilCtrl;
75 
76  // info tab
77  if(in_array(self::INFO_TAB_VISIBILITY, $services))
78  {
79  $info = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_info_tab'), self::INFO_TAB_VISIBILITY);
80  $info->setValue(1);
82  $a_obj_id,
83  self::INFO_TAB_VISIBILITY,
84  true
85  ));
86  //$info->setOptionTitle($GLOBALS['lng']->txt('obj_tool_setting_info_tab'));
87  $info->setInfo($GLOBALS['lng']->txt('obj_tool_setting_info_tab_info'));
88  $form->addItem($info);
89  }
90 
91  // calendar
92  if(in_array(self::CALENDAR_VISIBILITY, $services))
93  {
94  include_once './Services/Calendar/classes/class.ilObjCalendarSettings.php';
95  if(ilCalendarSettings::_getInstance()->isEnabled())
96  {
97  // Container tools (calendar, news, ... activation)
98  $cal = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_calendar'), self::CALENDAR_VISIBILITY);
99  $cal->setValue(1);
100  include_once './Services/Calendar/classes/class.ilObjCalendarSettings.php';
101  $cal->setChecked(ilCalendarSettings::lookupCalendarActivated($a_obj_id));
102  //$cal->setOptionTitle($GLOBALS['lng']->txt('obj_tool_setting_calendar'));
103  $cal->setInfo($GLOBALS['lng']->txt('obj_tool_setting_calendar_info'));
104  $form->addItem($cal);
105  }
106  }
107 
108  // news
109  if(in_array(self::USE_NEWS, $services))
110  {
111  $news = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_use_news'), self::USE_NEWS);
112  $news->setValue(1);
114  $a_obj_id,
115  self::USE_NEWS,
116  true
117  );
118  $news->setChecked($checked);
119  $info = $GLOBALS['lng']->txt('obj_tool_setting_use_news_info');
120  if ($checked)
121  {
122  $info.=" <a href='".$ilCtrl->getLinkTargetByClass("ilcontainernewssettingsgui", "").
123  "'>ยป ".$GLOBALS['lng']->txt('obj_tool_setting_use_news_open_settings')."</a>";
124  }
125  $news->setInfo($info);
126  $form->addItem($news);
127 
128  }
129  if(in_array(self::NEWS_VISIBILITY, $services))
130  {
131  if($ilSetting->get('block_activated_news'))
132  {
133  // Container tools (calendar, news, ... activation)
134  $news = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_news'), self::NEWS_VISIBILITY);
135  $news->setValue(1);
136  $news->setChecked(ilContainer::_lookupContainerSetting(
137  $a_obj_id,
138  self::NEWS_VISIBILITY,
139  $ilSetting->get('block_activated_news',true)
140  ));
141  //$news->setOptionTitle($GLOBALS['lng']->txt('obj_tool_setting_news'));
142  $news->setInfo($GLOBALS['lng']->txt('obj_tool_setting_news_info'));
143  $form->addItem($news);
144 
145  if(in_array(ilObject::_lookupType($a_obj_id), array('crs', 'grp')))
146  {
147  $ref_id = array_pop(ilObject::_getAllReferences($a_obj_id));
148 
149  include_once 'Services/Membership/classes/class.ilMembershipNotifications.php';
151  }
152  }
153  }
154 
155  // (local) custom metadata
156  if(in_array(self::CUSTOM_METADATA, $services))
157  {
158  $md = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_custom_metadata'), self::CUSTOM_METADATA);
159  $md->setInfo($GLOBALS['lng']->txt('obj_tool_setting_custom_metadata_info'));
160  $md->setValue(1);
161  $md->setChecked(ilContainer::_lookupContainerSetting(
162  $a_obj_id,
163  self::CUSTOM_METADATA,
164  false
165  ));
166  $form->addItem($md);
167  }
168 
169  // tag cloud
170  if(in_array(self::TAG_CLOUD, $services))
171  {
172  $tags_active = new ilSetting("tags");
173  if($tags_active->get("enable", false))
174  {
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);
178  $tag->setChecked(ilContainer::_lookupContainerSetting(
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  {
190  $tax = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_taxonomies'), self::TAXONOMIES);
191  $tax->setValue(1);
192  $tax->setChecked(ilContainer::_lookupContainerSetting(
193  $a_obj_id,
194  self::TAXONOMIES,
195  false
196  ));
197  $form->addItem($tax);
198  }
199 
200  // auto rating
201  if(in_array(self::AUTO_RATING_NEW_OBJECTS, $services))
202  {
203  $GLOBALS['lng']->loadLanguageModule("rating");
204 
205  // auto rating for new objects
206  $rate = new ilCheckboxInputGUI($GLOBALS['lng']->txt('rating_new_objects_auto'), self::AUTO_RATING_NEW_OBJECTS);
207  $rate->setValue(1);
208  //$rate->setOptionTitle($GLOBALS['lng']->txt('rating_new_objects_auto'));
209  $rate->setInfo($GLOBALS['lng']->txt('rating_new_objects_auto_info'));
210  $rate->setChecked(ilContainer::_lookupContainerSetting(
211  $a_obj_id,
212  self::AUTO_RATING_NEW_OBJECTS,
213  false
214  ));
215  $form->addItem($rate);
216  }
217 
218  // badges
219  if(in_array(self::BADGES, $services))
220  {
221  include_once 'Services/Badge/classes/class.ilBadgeHandler.php';
222  if(ilBadgeHandler::getInstance()->isActive())
223  {
224  $bdg = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_badges'), self::BADGES);
225  $bdg->setInfo($GLOBALS['lng']->txt('obj_tool_setting_badges_info'));
226  $bdg->setValue(1);
227  $bdg->setChecked(ilContainer::_lookupContainerSetting(
228  $a_obj_id,
229  self::BADGES,
230  false
231  ));
232  $form->addItem($bdg);
233  }
234  }
235 
236  return $form;
237  }
ILIAS Setting Class.
static _getInstance()
get singleton instance
static lookupCalendarActivated($a_obj_id)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
This class represents a checkbox property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
static _getAllReferences($a_id)
get all reference ids of object
global $ilCtrl
Definition: ilias.php:18
$info
Definition: example_052.php:80
static addToSettingsForm($a_ref_id, ilPropertyFormGUI $a_form=null, ilFormPropertyGUI $a_input=null)
Add notification settings to form.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=NULL)
Lookup a container setting.
$ref_id
Definition: sahs_server.php:39
global $ilSetting
Definition: privfeed.php:17
static getInstance()
Constructor.
+ 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 395 of file class.ilObjectServiceSettingsGUI.php.

References getModes().

Referenced by updateToolSettings().

396  {
397  return in_array($a_mode, $this->getModes());
398  }
+ 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
type$a_obj_id
ilPropertyFormGUI$form
type$services

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

References $ref_id, ilObject\_getAllReferences(), ilCalendarSettings\_getInstance(), ilObject\_lookupType(), ilContainer\_writeContainerSetting(), array, ilPropertyFormGUI\getInput(), ilBadgeHandler\getInstance(), and ilMembershipNotifications\importFromForm().

Referenced by ilObjGlossaryGUI\saveProperties(), ilObjWikiGUI\saveSettingsObject(), ilObjBookingPoolGUI\updateCustom(), ilObjGroupGUI\updateObject(), ilObjCategoryGUI\updateObject(), and ilObjCourseGUI\updateObject().

246  {
247  // info
248  if(in_array(self::INFO_TAB_VISIBILITY, $services))
249  {
250  include_once './Services/Container/classes/class.ilContainer.php';
251  ilContainer::_writeContainerSetting($a_obj_id,self::INFO_TAB_VISIBILITY,(int) $form->getInput(self::INFO_TAB_VISIBILITY));
252  }
253 
254  // calendar
255  if(in_array(self::CALENDAR_VISIBILITY, $services))
256  {
257  include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
258  if(ilCalendarSettings::_getInstance()->isEnabled())
259  {
260  include_once './Services/Container/classes/class.ilContainer.php';
261  ilContainer::_writeContainerSetting($a_obj_id,self::CALENDAR_VISIBILITY,(int) $form->getInput(self::CALENDAR_VISIBILITY));
262  }
263  }
264 
265  // news
266  if(in_array(self::USE_NEWS, $services))
267  {
268  include_once './Services/Container/classes/class.ilContainer.php';
269  ilContainer::_writeContainerSetting($a_obj_id,self::USE_NEWS,(int) $form->getInput(self::USE_NEWS));
270  }
271  if(in_array(self::NEWS_VISIBILITY, $services))
272  {
273  include_once './Services/Container/classes/class.ilContainer.php';
274  ilContainer::_writeContainerSetting($a_obj_id,self::NEWS_VISIBILITY,(int) $form->getInput(self::NEWS_VISIBILITY));
275 
276  if(in_array(ilObject::_lookupType($a_obj_id), array('crs', 'grp')))
277  {
278  $ref_id = array_pop(ilObject::_getAllReferences($a_obj_id));
279 
280  include_once "Services/Membership/classes/class.ilMembershipNotifications.php";
282  }
283  }
284 
285  // rating
286  if(in_array(self::AUTO_RATING_NEW_OBJECTS, $services))
287  {
288  include_once './Services/Container/classes/class.ilContainer.php';
289  ilContainer::_writeContainerSetting($a_obj_id,self::AUTO_RATING_NEW_OBJECTS,(int) $form->getInput(self::AUTO_RATING_NEW_OBJECTS));
290  }
291 
292  // taxonomies
293  if(in_array(self::TAXONOMIES, $services))
294  {
295  include_once './Services/Container/classes/class.ilContainer.php';
296  ilContainer::_writeContainerSetting($a_obj_id,self::TAXONOMIES,(int) $form->getInput(self::TAXONOMIES));
297  }
298 
299  // tag cloud
300  if(in_array(self::TAG_CLOUD, $services))
301  {
302  include_once './Services/Container/classes/class.ilContainer.php';
303  ilContainer::_writeContainerSetting($a_obj_id,self::TAG_CLOUD,(int) $form->getInput(self::TAG_CLOUD));
304  }
305 
306  // (local) custom metadata
307  if(in_array(self::CUSTOM_METADATA, $services))
308  {
309  include_once './Services/Container/classes/class.ilContainer.php';
310  ilContainer::_writeContainerSetting($a_obj_id,self::CUSTOM_METADATA,(int) $form->getInput(self::CUSTOM_METADATA));
311  }
312 
313  // badges
314  if(in_array(self::BADGES, $services))
315  {
316  include_once 'Services/Badge/classes/class.ilBadgeHandler.php';
317  if(ilBadgeHandler::getInstance()->isActive())
318  {
319  include_once './Services/Container/classes/class.ilContainer.php';
320  ilContainer::_writeContainerSetting($a_obj_id,self::BADGES,(int) $form->getInput(self::BADGES));
321  }
322  }
323 
324  return true;
325  }
static _getInstance()
get singleton instance
static _getAllReferences($a_id)
get all reference ids of object
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
$ref_id
Definition: sahs_server.php:39
static _writeContainerSetting($a_id, $a_keyword, $a_value)
static importFromForm($a_ref_id, ilPropertyFormGUI $a_form=null)
Import notification settings from form.
static getInstance()
Constructor.
+ 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 368 of file class.ilObjectServiceSettingsGUI.php.

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

369  {
370  $form = $this->initSettingsForm();
371  if($form->checkInput())
372  {
373  include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
374  if(ilCalendarSettings::_getInstance()->isEnabled())
375  {
376  if($this->isModeActive(self::CALENDAR_VISIBILITY))
377  {
378  ilContainer::_writeContainerSetting($this->getObjId(),'show_calendar',(int) $form->getInput('calendar'));
379  }
380  }
381  ilUtil::sendSuccess($GLOBALS['lng']->txt('settings_saved'),true);
382  $GLOBALS['ilCtrl']->redirect($this);
383  }
384 
385  ilUtil::sendFailure($GLOBALS['lng']->txt('err_check_input'));
386  $form->setValuesByPost();
387  $this->editSettings($form);
388  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _getInstance()
get singleton instance
isModeActive($a_mode)
Check if specific mode is active.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static _writeContainerSetting($a_id, $a_keyword, $a_value)
editSettings(ilPropertyFormGUI $form=null)
Edit tool settings (calendar, news, comments, ...)
+ Here is the call graph for this function:

Field Documentation

◆ $gui

ilObjectServiceSettingsGUI::$gui = null
private

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

◆ $modes

ilObjectServiceSettingsGUI::$modes = array()
private

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

Referenced by getModes().

◆ $obj_id

ilObjectServiceSettingsGUI::$obj_id = 0
private

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

Referenced by getObjId().

◆ AUTO_RATING_NEW_OBJECTS

◆ BADGES

◆ CALENDAR_VISIBILITY

◆ CUSTOM_METADATA

◆ INFO_TAB_VISIBILITY

◆ NEWS_VISIBILITY

◆ TAG_CLOUD

◆ TAXONOMIES

◆ USE_NEWS


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