ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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'
 

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

30  {
31  $this->gui = $a_parent_gui;
32  $this->modes = $a_modes;
33  $this->obj_id = $a_obj_id;
34  }

Member Function Documentation

◆ cancel()

ilObjectServiceSettingsGUI::cancel ( )
protected

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

References $GLOBALS.

201  {
202  $GLOBALS['ilCtrl']->returnToParent($this);
203  }
$GLOBALS['ct_recipient']

◆ editSettings()

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

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

Parameters
ilPropertyFormGUI$form

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

References $GLOBALS.

Referenced by updateToolSettings().

210  {
211  if(!$form instanceof ilPropertyFormGUI)
212  {
213  $form = $this->initSettingsForm();
214  }
215  $GLOBALS['tpl']->setContent($form->getHTML());
216  }
This class represents a property form user interface.
$GLOBALS['ct_recipient']
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjectServiceSettingsGUI::executeCommand ( )

Control class handling.

Returns

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

References $cmd, and $ilCtrl.

43  {
44  global $ilCtrl;
45 
46  $next_class = $ilCtrl->getNextClass($this);
47  $cmd = $ilCtrl->getCmd('editSettings');
48 
49  switch($next_class)
50  {
51  default:
52  $this->$cmd();
53  break;
54  }
55  }
$cmd
Definition: sahs_server.php:35
global $ilCtrl
Definition: ilias.php:18

◆ getModes()

ilObjectServiceSettingsGUI::getModes ( )

Get active modes.

Returns
bool

Definition at line 186 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 195 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 62 of file class.ilObjectServiceSettingsGUI.php.

References $GLOBALS, $ilSetting, ilCalendarSettings\_getInstance(), ilContainer\_lookupContainerSetting(), ilPropertyFormGUI\addItem(), and ilCalendarSettings\lookupCalendarActivated().

Referenced by ilObjCategoryGUI\initEditForm(), ilObjCourseGUI\initEditForm(), and ilObjGroupGUI\initForm().

63  {
64  global $ilSetting;
65 
66  // info tab
67  if(in_array(self::INFO_TAB_VISIBILITY, $services))
68  {
69  $info = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_info_tab'), self::INFO_TAB_VISIBILITY);
70  $info->setValue(1);
71  $info->setChecked(ilContainer::_lookupContainerSetting(
72  $a_obj_id,
73  self::INFO_TAB_VISIBILITY,
74  true
75  ));
76  //$info->setOptionTitle($GLOBALS['lng']->txt('obj_tool_setting_info_tab'));
77  $info->setInfo($GLOBALS['lng']->txt('obj_tool_setting_info_tab_info'));
78  $form->addItem($info);
79  }
80 
81  // calendar
82  if(in_array(self::CALENDAR_VISIBILITY, $services))
83  {
84  include_once './Services/Calendar/classes/class.ilObjCalendarSettings.php';
85  if(ilCalendarSettings::_getInstance()->isEnabled())
86  {
87  // Container tools (calendar, news, ... activation)
88  $cal = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_calendar'), self::CALENDAR_VISIBILITY);
89  $cal->setValue(1);
90  include_once './Services/Calendar/classes/class.ilObjCalendarSettings.php';
91  $cal->setChecked(ilCalendarSettings::lookupCalendarActivated($a_obj_id));
92  //$cal->setOptionTitle($GLOBALS['lng']->txt('obj_tool_setting_calendar'));
93  $cal->setInfo($GLOBALS['lng']->txt('obj_tool_setting_calendar_info'));
94  $form->addItem($cal);
95  }
96  }
97 
98  // news
99  if(in_array(self::NEWS_VISIBILITY, $services))
100  {
101  if($ilSetting->get('block_activated_news'))
102  {
103  // Container tools (calendar, news, ... activation)
104  $news = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_news'), self::NEWS_VISIBILITY);
105  $news->setValue(1);
106  $news->setChecked(ilContainer::_lookupContainerSetting(
107  $a_obj_id,
108  self::NEWS_VISIBILITY,
109  $ilSetting->get('block_activated_news',true)
110  ));
111  //$news->setOptionTitle($GLOBALS['lng']->txt('obj_tool_setting_news'));
112  $news->setInfo($GLOBALS['lng']->txt('obj_tool_setting_news_info'));
113  $form->addItem($news);
114  }
115  }
116 
117  // auto rating
118  if(in_array(self::AUTO_RATING_NEW_OBJECTS, $services))
119  {
120  $GLOBALS['lng']->loadLanguageModule("rating");
121 
122  // auto rating for new objects
123  $rate = new ilCheckboxInputGUI($GLOBALS['lng']->txt('rating_new_objects_auto'), self::AUTO_RATING_NEW_OBJECTS);
124  $rate->setValue(1);
125  //$rate->setOptionTitle($GLOBALS['lng']->txt('rating_new_objects_auto'));
126  $rate->setInfo($GLOBALS['lng']->txt('rating_new_objects_auto_info'));
127  $rate->setChecked(ilContainer::_lookupContainerSetting(
128  $a_obj_id,
129  self::AUTO_RATING_NEW_OBJECTS,
130  false
131  ));
132  $form->addItem($rate);
133  }
134 
135  return $form;
136  }
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).
$GLOBALS['ct_recipient']
global $ilSetting
Definition: privfeed.php:40
_lookupContainerSetting($a_id, $a_keyword, $a_default_value=NULL)
Lookup a container setting.
+ 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 249 of file class.ilObjectServiceSettingsGUI.php.

References getModes().

Referenced by updateToolSettings().

250  {
251  return in_array($a_mode, $this->getModes());
252  }
+ 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 144 of file class.ilObjectServiceSettingsGUI.php.

References ilCalendarSettings\_getInstance(), ilContainer\_writeContainerSetting(), and ilPropertyFormGUI\getInput().

Referenced by ilObjGroupGUI\updateObject(), ilObjCategoryGUI\updateObject(), and ilObjCourseGUI\updateObject().

145  {
146  // info
147  if(in_array(self::INFO_TAB_VISIBILITY, $services))
148  {
149  include_once './Services/Container/classes/class.ilContainer.php';
150  ilContainer::_writeContainerSetting($a_obj_id,self::INFO_TAB_VISIBILITY,(int) $form->getInput(self::INFO_TAB_VISIBILITY));
151  }
152 
153  // calendar
154  if(in_array(self::CALENDAR_VISIBILITY, $services))
155  {
156  include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
157  if(ilCalendarSettings::_getInstance()->isEnabled())
158  {
159  include_once './Services/Container/classes/class.ilContainer.php';
160  ilContainer::_writeContainerSetting($a_obj_id,self::CALENDAR_VISIBILITY,(int) $form->getInput(self::CALENDAR_VISIBILITY));
161  }
162  }
163 
164  // news
165  if(in_array(self::NEWS_VISIBILITY, $services))
166  {
167  include_once './Services/Container/classes/class.ilContainer.php';
168  ilContainer::_writeContainerSetting($a_obj_id,self::NEWS_VISIBILITY,(int) $form->getInput(self::NEWS_VISIBILITY));
169  }
170 
171  // rating
172  if(in_array(self::AUTO_RATING_NEW_OBJECTS, $services))
173  {
174  include_once './Services/Container/classes/class.ilContainer.php';
175  ilContainer::_writeContainerSetting($a_obj_id,self::AUTO_RATING_NEW_OBJECTS,(int) $form->getInput(self::AUTO_RATING_NEW_OBJECTS));
176  }
177 
178  return true;
179  }
static _getInstance()
get singleton instance
_writeContainerSetting($a_id, $a_keyword, $a_value)
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
+ 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 222 of file class.ilObjectServiceSettingsGUI.php.

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

223  {
224  $form = $this->initSettingsForm();
225  if($form->checkInput())
226  {
227  include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
228  if(ilCalendarSettings::_getInstance()->isEnabled())
229  {
230  if($this->isModeActive(self::CALENDAR_VISIBILITY))
231  {
232  ilContainer::_writeContainerSetting($this->getObjId(),'show_calendar',(int) $form->getInput('calendar'));
233  }
234  }
235  ilUtil::sendSuccess($GLOBALS['lng']->txt('settings_saved'),true);
236  $GLOBALS['ilCtrl']->redirect($this);
237  }
238 
239  ilUtil::sendFailure($GLOBALS['lng']->txt('err_check_input'));
240  $form->setValuesByPost();
241  $this->editSettings($form);
242  }
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)
$GLOBALS['ct_recipient']
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
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 21 of file class.ilObjectServiceSettingsGUI.php.

◆ $modes

ilObjectServiceSettingsGUI::$modes = array()
private

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

Referenced by getModes().

◆ $obj_id

ilObjectServiceSettingsGUI::$obj_id = 0
private

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

Referenced by getObjId().

◆ AUTO_RATING_NEW_OBJECTS

const ilObjectServiceSettingsGUI::AUTO_RATING_NEW_OBJECTS = 'cont_auto_rate_new_obj'

◆ CALENDAR_VISIBILITY

◆ INFO_TAB_VISIBILITY

◆ NEWS_VISIBILITY


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