ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 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'
 

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

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

Member Function Documentation

◆ cancel()

ilObjectServiceSettingsGUI::cancel ( )
protected

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

References $GLOBALS.

291  {
292  $GLOBALS['ilCtrl']->returnToParent($this);
293  }
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276

◆ editSettings()

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

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

Parameters
ilPropertyFormGUI$form

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

References $GLOBALS.

Referenced by updateToolSettings().

300  {
301  if(!$form instanceof ilPropertyFormGUI)
302  {
303  $form = $this->initSettingsForm();
304  }
305  $GLOBALS['tpl']->setContent($form->getHTML());
306  }
This class represents a property form user interface.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjectServiceSettingsGUI::executeCommand ( )

Control class handling.

Returns

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

References $cmd, and $ilCtrl.

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

◆ getModes()

ilObjectServiceSettingsGUI::getModes ( )

Get active modes.

Returns
bool

Definition at line 276 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 285 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 70 of file class.ilObjectServiceSettingsGUI.php.

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

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

71  {
72  global $ilSetting;
73 
74  // info tab
75  if(in_array(self::INFO_TAB_VISIBILITY, $services))
76  {
77  $info = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_info_tab'), self::INFO_TAB_VISIBILITY);
78  $info->setValue(1);
80  $a_obj_id,
81  self::INFO_TAB_VISIBILITY,
82  true
83  ));
84  //$info->setOptionTitle($GLOBALS['lng']->txt('obj_tool_setting_info_tab'));
85  $info->setInfo($GLOBALS['lng']->txt('obj_tool_setting_info_tab_info'));
86  $form->addItem($info);
87  }
88 
89  // calendar
90  if(in_array(self::CALENDAR_VISIBILITY, $services))
91  {
92  include_once './Services/Calendar/classes/class.ilObjCalendarSettings.php';
93  if(ilCalendarSettings::_getInstance()->isEnabled())
94  {
95  // Container tools (calendar, news, ... activation)
96  $cal = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_calendar'), self::CALENDAR_VISIBILITY);
97  $cal->setValue(1);
98  include_once './Services/Calendar/classes/class.ilObjCalendarSettings.php';
99  $cal->setChecked(ilCalendarSettings::lookupCalendarActivated($a_obj_id));
100  //$cal->setOptionTitle($GLOBALS['lng']->txt('obj_tool_setting_calendar'));
101  $cal->setInfo($GLOBALS['lng']->txt('obj_tool_setting_calendar_info'));
102  $form->addItem($cal);
103  }
104  }
105 
106  // news
107  if(in_array(self::NEWS_VISIBILITY, $services))
108  {
109  if($ilSetting->get('block_activated_news'))
110  {
111  // Container tools (calendar, news, ... activation)
112  $news = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_news'), self::NEWS_VISIBILITY);
113  $news->setValue(1);
114  $news->setChecked(ilContainer::_lookupContainerSetting(
115  $a_obj_id,
116  self::NEWS_VISIBILITY,
117  $ilSetting->get('block_activated_news',true)
118  ));
119  //$news->setOptionTitle($GLOBALS['lng']->txt('obj_tool_setting_news'));
120  $news->setInfo($GLOBALS['lng']->txt('obj_tool_setting_news_info'));
121  $form->addItem($news);
122 
123  if(in_array(ilObject::_lookupType($a_obj_id), array('crs', 'grp')))
124  {
125  $ref_id = array_pop(ilObject::_getAllReferences($a_obj_id));
126 
127  include_once 'Services/Membership/classes/class.ilMembershipNotifications.php';
129  }
130  }
131  }
132 
133  // (local) custom metadata
134  if(in_array(self::CUSTOM_METADATA, $services))
135  {
136  $md = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_custom_metadata'), self::CUSTOM_METADATA);
137  $md->setInfo($GLOBALS['lng']->txt('obj_tool_setting_custom_metadata_info'));
138  $md->setValue(1);
139  $md->setChecked(ilContainer::_lookupContainerSetting(
140  $a_obj_id,
141  self::CUSTOM_METADATA,
142  false
143  ));
144  $form->addItem($md);
145  }
146 
147  // tag cloud
148  if(in_array(self::TAG_CLOUD, $services))
149  {
150  $tags_active = new ilSetting("tags");
151  if($tags_active->get("enable", false))
152  {
153  $tag = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_tag_cloud'), self::TAG_CLOUD);
154  $tag->setInfo($GLOBALS['lng']->txt('obj_tool_setting_tag_cloud_info'));
155  $tag->setValue(1);
156  $tag->setChecked(ilContainer::_lookupContainerSetting(
157  $a_obj_id,
158  self::TAG_CLOUD,
159  false
160  ));
161  $form->addItem($tag);
162  }
163  }
164 
165  // taxonomies
166  if(in_array(self::TAXONOMIES, $services))
167  {
168  $tax = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_taxonomies'), self::TAXONOMIES);
169  $tax->setValue(1);
170  $tax->setChecked(ilContainer::_lookupContainerSetting(
171  $a_obj_id,
172  self::TAXONOMIES,
173  false
174  ));
175  $form->addItem($tax);
176  }
177 
178  // auto rating
179  if(in_array(self::AUTO_RATING_NEW_OBJECTS, $services))
180  {
181  $GLOBALS['lng']->loadLanguageModule("rating");
182 
183  // auto rating for new objects
184  $rate = new ilCheckboxInputGUI($GLOBALS['lng']->txt('rating_new_objects_auto'), self::AUTO_RATING_NEW_OBJECTS);
185  $rate->setValue(1);
186  //$rate->setOptionTitle($GLOBALS['lng']->txt('rating_new_objects_auto'));
187  $rate->setInfo($GLOBALS['lng']->txt('rating_new_objects_auto_info'));
188  $rate->setChecked(ilContainer::_lookupContainerSetting(
189  $a_obj_id,
190  self::AUTO_RATING_NEW_OBJECTS,
191  false
192  ));
193  $form->addItem($rate);
194  }
195 
196  return $form;
197  }
ILIAS Setting Class.
static _getInstance()
get singleton instance
static lookupCalendarActivated($a_obj_id)
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
$info
Definition: example_052.php:80
static addToSettingsForm($a_ref_id, ilPropertyFormGUI $a_form=null, ilFormPropertyGUI $a_input=null)
Add notification settings to form.
static _lookupType($a_id, $a_reference=false)
lookup object type
$ref_id
Definition: sahs_server.php:39
global $ilSetting
Definition: privfeed.php:40
_lookupContainerSetting($a_id, $a_keyword, $a_default_value=NULL)
Lookup a container setting.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
+ 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 339 of file class.ilObjectServiceSettingsGUI.php.

References getModes().

Referenced by updateToolSettings().

340  {
341  return in_array($a_mode, $this->getModes());
342  }
+ 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 205 of file class.ilObjectServiceSettingsGUI.php.

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

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

206  {
207  // info
208  if(in_array(self::INFO_TAB_VISIBILITY, $services))
209  {
210  include_once './Services/Container/classes/class.ilContainer.php';
211  ilContainer::_writeContainerSetting($a_obj_id,self::INFO_TAB_VISIBILITY,(int) $form->getInput(self::INFO_TAB_VISIBILITY));
212  }
213 
214  // calendar
215  if(in_array(self::CALENDAR_VISIBILITY, $services))
216  {
217  include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
218  if(ilCalendarSettings::_getInstance()->isEnabled())
219  {
220  include_once './Services/Container/classes/class.ilContainer.php';
221  ilContainer::_writeContainerSetting($a_obj_id,self::CALENDAR_VISIBILITY,(int) $form->getInput(self::CALENDAR_VISIBILITY));
222  }
223  }
224 
225  // news
226  if(in_array(self::NEWS_VISIBILITY, $services))
227  {
228  include_once './Services/Container/classes/class.ilContainer.php';
229  ilContainer::_writeContainerSetting($a_obj_id,self::NEWS_VISIBILITY,(int) $form->getInput(self::NEWS_VISIBILITY));
230 
231  if(in_array(ilObject::_lookupType($a_obj_id), array('crs', 'grp')))
232  {
233  $ref_id = array_pop(ilObject::_getAllReferences($a_obj_id));
234 
235  include_once "Services/Membership/classes/class.ilMembershipNotifications.php";
237  }
238  }
239 
240  // rating
241  if(in_array(self::AUTO_RATING_NEW_OBJECTS, $services))
242  {
243  include_once './Services/Container/classes/class.ilContainer.php';
244  ilContainer::_writeContainerSetting($a_obj_id,self::AUTO_RATING_NEW_OBJECTS,(int) $form->getInput(self::AUTO_RATING_NEW_OBJECTS));
245  }
246 
247  // taxonomies
248  if(in_array(self::TAXONOMIES, $services))
249  {
250  include_once './Services/Container/classes/class.ilContainer.php';
251  ilContainer::_writeContainerSetting($a_obj_id,self::TAXONOMIES,(int) $form->getInput(self::TAXONOMIES));
252  }
253 
254  // tag cloud
255  if(in_array(self::TAG_CLOUD, $services))
256  {
257  include_once './Services/Container/classes/class.ilContainer.php';
258  ilContainer::_writeContainerSetting($a_obj_id,self::TAG_CLOUD,(int) $form->getInput(self::TAG_CLOUD));
259  }
260 
261  // (local) custom metadata
262  if(in_array(self::CUSTOM_METADATA, $services))
263  {
264  include_once './Services/Container/classes/class.ilContainer.php';
265  ilContainer::_writeContainerSetting($a_obj_id,self::CUSTOM_METADATA,(int) $form->getInput(self::CUSTOM_METADATA));
266  }
267 
268  return true;
269  }
static _getInstance()
get singleton instance
_writeContainerSetting($a_id, $a_keyword, $a_value)
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.
static _lookupType($a_id, $a_reference=false)
lookup object type
$ref_id
Definition: sahs_server.php:39
static importFromForm($a_ref_id, ilPropertyFormGUI $a_form=null)
Import notification settings from form.
+ 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 312 of file class.ilObjectServiceSettingsGUI.php.

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

313  {
314  $form = $this->initSettingsForm();
315  if($form->checkInput())
316  {
317  include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
318  if(ilCalendarSettings::_getInstance()->isEnabled())
319  {
320  if($this->isModeActive(self::CALENDAR_VISIBILITY))
321  {
322  ilContainer::_writeContainerSetting($this->getObjId(),'show_calendar',(int) $form->getInput('calendar'));
323  }
324  }
325  ilUtil::sendSuccess($GLOBALS['lng']->txt('settings_saved'),true);
326  $GLOBALS['ilCtrl']->redirect($this);
327  }
328 
329  ilUtil::sendFailure($GLOBALS['lng']->txt('err_check_input'));
330  $form->setValuesByPost();
331  $this->editSettings($form);
332  }
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.
_writeContainerSetting($a_id, $a_keyword, $a_value)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
editSettings(ilPropertyFormGUI $form=null)
Edit tool settings (calendar, news, comments, ...)
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
+ Here is the call graph for this function:

Field Documentation

◆ $gui

ilObjectServiceSettingsGUI::$gui = null
private

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

◆ $modes

ilObjectServiceSettingsGUI::$modes = array()
private

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

Referenced by getModes().

◆ $obj_id

ilObjectServiceSettingsGUI::$obj_id = 0
private

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

Referenced by getObjId().

◆ AUTO_RATING_NEW_OBJECTS

◆ CALENDAR_VISIBILITY

◆ CUSTOM_METADATA

◆ INFO_TAB_VISIBILITY

◆ NEWS_VISIBILITY

◆ TAG_CLOUD

◆ TAXONOMIES


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