ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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'
 

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$

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

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

Member Function Documentation

◆ cancel()

ilObjectServiceSettingsGUI::cancel ( )
protected

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

248 {
249 $GLOBALS['ilCtrl']->returnToParent($this);
250 }
$GLOBALS['ct_recipient']

References $GLOBALS.

◆ editSettings()

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

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

Parameters
ilPropertyFormGUI$form

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

257 {
258 if(!$form instanceof ilPropertyFormGUI)
259 {
260 $form = $this->initSettingsForm();
261 }
262 $GLOBALS['tpl']->setContent($form->getHTML());
263 }
This class represents a property form user interface.

References $GLOBALS.

Referenced by updateToolSettings().

+ Here is the caller graph for this function:

◆ executeCommand()

ilObjectServiceSettingsGUI::executeCommand ( )

Control class handling.

Returns

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

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

References $cmd, and $ilCtrl.

◆ getModes()

ilObjectServiceSettingsGUI::getModes ( )

Get active modes.

Returns
bool

Definition at line 233 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 242 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 64 of file class.ilObjectServiceSettingsGUI.php.

65 {
66 global $ilSetting;
67
68 // info tab
69 if(in_array(self::INFO_TAB_VISIBILITY, $services))
70 {
71 $info = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_info_tab'), self::INFO_TAB_VISIBILITY);
72 $info->setValue(1);
74 $a_obj_id,
75 self::INFO_TAB_VISIBILITY,
76 true
77 ));
78 //$info->setOptionTitle($GLOBALS['lng']->txt('obj_tool_setting_info_tab'));
79 $info->setInfo($GLOBALS['lng']->txt('obj_tool_setting_info_tab_info'));
80 $form->addItem($info);
81 }
82
83 // calendar
84 if(in_array(self::CALENDAR_VISIBILITY, $services))
85 {
86 include_once './Services/Calendar/classes/class.ilObjCalendarSettings.php';
87 if(ilCalendarSettings::_getInstance()->isEnabled())
88 {
89 // Container tools (calendar, news, ... activation)
90 $cal = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_calendar'), self::CALENDAR_VISIBILITY);
91 $cal->setValue(1);
92 include_once './Services/Calendar/classes/class.ilObjCalendarSettings.php';
93 $cal->setChecked(ilCalendarSettings::lookupCalendarActivated($a_obj_id));
94 //$cal->setOptionTitle($GLOBALS['lng']->txt('obj_tool_setting_calendar'));
95 $cal->setInfo($GLOBALS['lng']->txt('obj_tool_setting_calendar_info'));
96 $form->addItem($cal);
97 }
98 }
99
100 // news
101 if(in_array(self::NEWS_VISIBILITY, $services))
102 {
103 if($ilSetting->get('block_activated_news'))
104 {
105 // Container tools (calendar, news, ... activation)
106 $news = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_news'), self::NEWS_VISIBILITY);
107 $news->setValue(1);
108 $news->setChecked(ilContainer::_lookupContainerSetting(
109 $a_obj_id,
110 self::NEWS_VISIBILITY,
111 $ilSetting->get('block_activated_news',true)
112 ));
113 //$news->setOptionTitle($GLOBALS['lng']->txt('obj_tool_setting_news'));
114 $news->setInfo($GLOBALS['lng']->txt('obj_tool_setting_news_info'));
115 $form->addItem($news);
116 }
117 }
118
119 // tag cloud
120 if(in_array(self::TAG_CLOUD, $services))
121 {
122 $tags_active = new ilSetting("tags");
123 if($tags_active->get("enable", false))
124 {
125 $tag = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_tag_cloud'), self::TAG_CLOUD);
126 $tag->setInfo($GLOBALS['lng']->txt('obj_tool_setting_tag_cloud_info'));
127 $tag->setValue(1);
129 $a_obj_id,
130 self::TAG_CLOUD,
131 false
132 ));
133 $form->addItem($tag);
134 }
135 }
136
137 // taxonomies
138 if(in_array(self::TAXONOMIES, $services))
139 {
140 $tax = new ilCheckboxInputGUI($GLOBALS['lng']->txt('obj_tool_setting_taxonomies'), self::TAXONOMIES);
141 $tax->setValue(1);
143 $a_obj_id,
144 self::TAXONOMIES,
145 false
146 ));
147 $form->addItem($tax);
148 }
149
150 // auto rating
151 if(in_array(self::AUTO_RATING_NEW_OBJECTS, $services))
152 {
153 $GLOBALS['lng']->loadLanguageModule("rating");
154
155 // auto rating for new objects
156 $rate = new ilCheckboxInputGUI($GLOBALS['lng']->txt('rating_new_objects_auto'), self::AUTO_RATING_NEW_OBJECTS);
157 $rate->setValue(1);
158 //$rate->setOptionTitle($GLOBALS['lng']->txt('rating_new_objects_auto'));
159 $rate->setInfo($GLOBALS['lng']->txt('rating_new_objects_auto_info'));
160 $rate->setChecked(ilContainer::_lookupContainerSetting(
161 $a_obj_id,
162 self::AUTO_RATING_NEW_OBJECTS,
163 false
164 ));
165 $form->addItem($rate);
166 }
167
168 return $form;
169 }
static _getInstance()
get singleton instance
static lookupCalendarActivated($a_obj_id)
This class represents a checkbox property in a property form.
_lookupContainerSetting($a_id, $a_keyword, $a_default_value=NULL)
Lookup a container setting.
addItem($a_item)
Add Item (Property, SectionHeader).
ILIAS Setting Class.
global $ilSetting
Definition: privfeed.php:40

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

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

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

297 {
298 return in_array($a_mode, $this->getModes());
299 }

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
type$a_obj_id
ilPropertyFormGUI$form
type$services

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

178 {
179 // info
180 if(in_array(self::INFO_TAB_VISIBILITY, $services))
181 {
182 include_once './Services/Container/classes/class.ilContainer.php';
183 ilContainer::_writeContainerSetting($a_obj_id,self::INFO_TAB_VISIBILITY,(int) $form->getInput(self::INFO_TAB_VISIBILITY));
184 }
185
186 // calendar
187 if(in_array(self::CALENDAR_VISIBILITY, $services))
188 {
189 include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
190 if(ilCalendarSettings::_getInstance()->isEnabled())
191 {
192 include_once './Services/Container/classes/class.ilContainer.php';
193 ilContainer::_writeContainerSetting($a_obj_id,self::CALENDAR_VISIBILITY,(int) $form->getInput(self::CALENDAR_VISIBILITY));
194 }
195 }
196
197 // news
198 if(in_array(self::NEWS_VISIBILITY, $services))
199 {
200 include_once './Services/Container/classes/class.ilContainer.php';
201 ilContainer::_writeContainerSetting($a_obj_id,self::NEWS_VISIBILITY,(int) $form->getInput(self::NEWS_VISIBILITY));
202 }
203
204 // rating
205 if(in_array(self::AUTO_RATING_NEW_OBJECTS, $services))
206 {
207 include_once './Services/Container/classes/class.ilContainer.php';
208 ilContainer::_writeContainerSetting($a_obj_id,self::AUTO_RATING_NEW_OBJECTS,(int) $form->getInput(self::AUTO_RATING_NEW_OBJECTS));
209 }
210
211 // taxonomies
212 if(in_array(self::TAXONOMIES, $services))
213 {
214 include_once './Services/Container/classes/class.ilContainer.php';
215 ilContainer::_writeContainerSetting($a_obj_id,self::TAXONOMIES,(int) $form->getInput(self::TAXONOMIES));
216 }
217
218 // tag cloud
219 if(in_array(self::TAG_CLOUD, $services))
220 {
221 include_once './Services/Container/classes/class.ilContainer.php';
222 ilContainer::_writeContainerSetting($a_obj_id,self::TAG_CLOUD,(int) $form->getInput(self::TAG_CLOUD));
223 }
224
225 return true;
226 }
_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.

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

Referenced by ilObjCategoryGUI\updateObject(), ilObjCourseGUI\updateObject(), and ilObjGroupGUI\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 269 of file class.ilObjectServiceSettingsGUI.php.

270 {
271 $form = $this->initSettingsForm();
272 if($form->checkInput())
273 {
274 include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
275 if(ilCalendarSettings::_getInstance()->isEnabled())
276 {
277 if($this->isModeActive(self::CALENDAR_VISIBILITY))
278 {
279 ilContainer::_writeContainerSetting($this->getObjId(),'show_calendar',(int) $form->getInput('calendar'));
280 }
281 }
282 ilUtil::sendSuccess($GLOBALS['lng']->txt('settings_saved'),true);
283 $GLOBALS['ilCtrl']->redirect($this);
284 }
285
286 ilUtil::sendFailure($GLOBALS['lng']->txt('err_check_input'));
287 $form->setValuesByPost();
288 $this->editSettings($form);
289 }
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 $GLOBALS, ilCalendarSettings\_getInstance(), ilContainer\_writeContainerSetting(), editSettings(), getObjId(), isModeActive(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

Field Documentation

◆ $gui

ilObjectServiceSettingsGUI::$gui = null
private

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

◆ $modes

ilObjectServiceSettingsGUI::$modes = array()
private

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

Referenced by getModes().

◆ $obj_id

ilObjectServiceSettingsGUI::$obj_id = 0
private

Definition at line 25 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

◆ TAG_CLOUD

◆ TAXONOMIES


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