ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilPDSelectedItemsBlockViewSettings Class Reference

Class ilPDSelectedItemsBlockViewSettings. More...

+ Inheritance diagram for ilPDSelectedItemsBlockViewSettings:
+ Collaboration diagram for ilPDSelectedItemsBlockViewSettings:

Public Member Functions

 __construct ($actor, $view=self::VIEW_SELECTED_ITEMS)
 ilPDSelectedItemsBlockViewSettings constructor. More...
 
 getMembershipsView ()
 
 getSelectedItemsView ()
 
 getStudyProgrammeView ()
 
 isMembershipsViewActive ()
 
 isSelectedItemsViewActive ()
 
 isStudyProgrammeViewActive ()
 
 getSortByStartDateMode ()
 
 getSortByLocationMode ()
 
 getSortByTypeMode ()
 
 getDefaultSortType ()
 
 isSortedByType ()
 
 isSortedByLocation ()
 
 isSortedByStartDate ()
 
 storeDefaultSortType ($type)
 
 enabledMemberships ()
 
 enabledSelectedItems ()
 
 enableMemberships ($status)
 
 enableSelectedItems ($status)
 
 allViewsEnabled ()
 
 getDefaultView ()
 
 storeDefaultView ($view)
 
 parse ()
 
 getActor ()
 
 getCurrentView ()
 
 getCurrentSortOption ()
 
 isValidView ($view)
 

Protected Member Functions

 allViewsDisabled ()
 

Protected Attributes

 $settings
 
 $actor
 
 $validViews = array()
 
 $currentView = self::VIEW_SELECTED_ITEMS
 
 $currentSortOption = self::SORT_BY_LOCATION
 

Static Protected Attributes

static $availableViews
 
static $availableSortOptions
 
static $availableSortOptionsByView
 

Additional Inherited Members

- Data Fields inherited from ilPDSelectedItemsBlockConstants
const VIEW_SELECTED_ITEMS = 0
 
const VIEW_MY_MEMBERSHIPS = 1
 
const VIEW_MY_STUDYPROGRAMME = 2
 
const SORT_BY_TYPE = 'type'
 
const SORT_BY_LOCATION = 'location'
 
const SORT_BY_START_DATE = 'start_date'
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilPDSelectedItemsBlockViewSettings::__construct (   $actor,
  $view = self::VIEW_SELECTED_ITEMS 
)

ilPDSelectedItemsBlockViewSettings constructor.

Parameters
ilObjUser$actor
int$view

Definition at line 76 of file class.ilPDSelectedItemsBlockViewSettings.php.

References $actor, $DIC, $ilSetting, and settings().

77  {
78  global $DIC;
79 
80  $ilSetting = $DIC->settings();
81 
82  $this->settings = $ilSetting;
83 
84  $this->actor = $actor;
85  $this->currentView = $view;
86  }
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2
global $ilSetting
Definition: privfeed.php:17
+ Here is the call graph for this function:

Member Function Documentation

◆ allViewsDisabled()

ilPDSelectedItemsBlockViewSettings::allViewsDisabled ( )
protected
Returns
boolean

Definition at line 244 of file class.ilPDSelectedItemsBlockViewSettings.php.

References enabledMemberships(), and enabledSelectedItems().

+ Here is the call graph for this function:

◆ allViewsEnabled()

ilPDSelectedItemsBlockViewSettings::allViewsEnabled ( )
Returns
boolean

Definition at line 236 of file class.ilPDSelectedItemsBlockViewSettings.php.

References enabledMemberships(), and enabledSelectedItems().

+ Here is the call graph for this function:

◆ enabledMemberships()

ilPDSelectedItemsBlockViewSettings::enabledMemberships ( )
Returns
boolean

Definition at line 204 of file class.ilPDSelectedItemsBlockViewSettings.php.

References settings().

Referenced by allViewsDisabled(), allViewsEnabled(), and parse().

205  {
206  return $this->settings->get('disable_my_memberships', 0) == 0;
207  }
settings()
Definition: settings.php:2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enabledSelectedItems()

ilPDSelectedItemsBlockViewSettings::enabledSelectedItems ( )
Returns
boolean

Definition at line 212 of file class.ilPDSelectedItemsBlockViewSettings.php.

References settings().

Referenced by allViewsDisabled(), allViewsEnabled(), and parse().

213  {
214  return $this->settings->get('disable_my_offers', 0) == 0;
215  }
settings()
Definition: settings.php:2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enableMemberships()

ilPDSelectedItemsBlockViewSettings::enableMemberships (   $status)
Parameters
$statusboolean

Definition at line 220 of file class.ilPDSelectedItemsBlockViewSettings.php.

References settings().

221  {
222  $this->settings->set('disable_my_memberships', (int) !$status);
223  }
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

◆ enableSelectedItems()

ilPDSelectedItemsBlockViewSettings::enableSelectedItems (   $status)
Parameters
$statusboolean

Definition at line 228 of file class.ilPDSelectedItemsBlockViewSettings.php.

References settings().

229  {
230  $this->settings->set('disable_my_offers', (int) !$status);
231  }
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

◆ getActor()

ilPDSelectedItemsBlockViewSettings::getActor ( )
Returns
ilObjUser

Definition at line 305 of file class.ilPDSelectedItemsBlockViewSettings.php.

References $actor.

Referenced by ilPDSelectedItemsBlockViewGUI\bySettings().

+ Here is the caller graph for this function:

◆ getCurrentSortOption()

ilPDSelectedItemsBlockViewSettings::getCurrentSortOption ( )

◆ getCurrentView()

ilPDSelectedItemsBlockViewSettings::getCurrentView ( )
Returns
int

Definition at line 313 of file class.ilPDSelectedItemsBlockViewSettings.php.

References $currentView.

Referenced by parse().

+ Here is the caller graph for this function:

◆ getDefaultSortType()

ilPDSelectedItemsBlockViewSettings::getDefaultSortType ( )
Returns
string

Definition at line 163 of file class.ilPDSelectedItemsBlockViewSettings.php.

References getSortByLocationMode(), and settings().

Referenced by parse().

164  {
165  return $this->settings->get('my_memberships_def_sort', $this->getSortByLocationMode());
166  }
settings()
Definition: settings.php:2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDefaultView()

ilPDSelectedItemsBlockViewSettings::getDefaultView ( )
Returns
int

Definition at line 252 of file class.ilPDSelectedItemsBlockViewSettings.php.

References getSelectedItemsView(), and settings().

Referenced by parse().

253  {
254  return (int) $this->settings->get('personal_items_default_view', $this->getSelectedItemsView());
255  }
settings()
Definition: settings.php:2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMembershipsView()

ilPDSelectedItemsBlockViewSettings::getMembershipsView ( )
Returns
int

Definition at line 91 of file class.ilPDSelectedItemsBlockViewSettings.php.

Referenced by isMembershipsViewActive(), and parse().

92  {
93  return self::VIEW_MY_MEMBERSHIPS;
94  }
+ Here is the caller graph for this function:

◆ getSelectedItemsView()

ilPDSelectedItemsBlockViewSettings::getSelectedItemsView ( )
Returns
int

Definition at line 99 of file class.ilPDSelectedItemsBlockViewSettings.php.

Referenced by getDefaultView(), isSelectedItemsViewActive(), and parse().

100  {
101  return self::VIEW_SELECTED_ITEMS;
102  }
+ Here is the caller graph for this function:

◆ getSortByLocationMode()

ilPDSelectedItemsBlockViewSettings::getSortByLocationMode ( )
Returns
string

Definition at line 147 of file class.ilPDSelectedItemsBlockViewSettings.php.

Referenced by getDefaultSortType(), and isSortedByLocation().

148  {
149  return self::SORT_BY_LOCATION;
150  }
+ Here is the caller graph for this function:

◆ getSortByStartDateMode()

ilPDSelectedItemsBlockViewSettings::getSortByStartDateMode ( )
Returns
string

Definition at line 139 of file class.ilPDSelectedItemsBlockViewSettings.php.

Referenced by isSortedByStartDate().

140  {
141  return self::SORT_BY_START_DATE;
142  }
+ Here is the caller graph for this function:

◆ getSortByTypeMode()

ilPDSelectedItemsBlockViewSettings::getSortByTypeMode ( )
Returns
string

Definition at line 155 of file class.ilPDSelectedItemsBlockViewSettings.php.

Referenced by isSortedByType().

156  {
157  return self::SORT_BY_TYPE;
158  }
+ Here is the caller graph for this function:

◆ getStudyProgrammeView()

ilPDSelectedItemsBlockViewSettings::getStudyProgrammeView ( )
Returns
int

Definition at line 107 of file class.ilPDSelectedItemsBlockViewSettings.php.

Referenced by isStudyProgrammeViewActive().

108  {
109  return self::VIEW_MY_STUDYPROGRAMME;
110  }
+ Here is the caller graph for this function:

◆ isMembershipsViewActive()

ilPDSelectedItemsBlockViewSettings::isMembershipsViewActive ( )
Returns
boolean

Definition at line 115 of file class.ilPDSelectedItemsBlockViewSettings.php.

References getMembershipsView().

Referenced by ilPDSelectedItemsBlockViewGUI\bySettings().

116  {
117  return $this->currentView == $this->getMembershipsView();
118  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSelectedItemsViewActive()

ilPDSelectedItemsBlockViewSettings::isSelectedItemsViewActive ( )
Returns
boolean

Definition at line 123 of file class.ilPDSelectedItemsBlockViewSettings.php.

References getSelectedItemsView().

Referenced by parse().

124  {
125  return $this->currentView == $this->getSelectedItemsView();
126  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSortedByLocation()

ilPDSelectedItemsBlockViewSettings::isSortedByLocation ( )
Returns
boolean

Definition at line 179 of file class.ilPDSelectedItemsBlockViewSettings.php.

References getSortByLocationMode().

180  {
181  return $this->currentSortOption == $this->getSortByLocationMode();
182  }
+ Here is the call graph for this function:

◆ isSortedByStartDate()

ilPDSelectedItemsBlockViewSettings::isSortedByStartDate ( )
Returns
boolean

Definition at line 187 of file class.ilPDSelectedItemsBlockViewSettings.php.

References getSortByStartDateMode().

188  {
189  return $this->currentSortOption == $this->getSortByStartDateMode();
190  }
+ Here is the call graph for this function:

◆ isSortedByType()

ilPDSelectedItemsBlockViewSettings::isSortedByType ( )
Returns
boolean

Definition at line 171 of file class.ilPDSelectedItemsBlockViewSettings.php.

References getSortByTypeMode().

172  {
173  return $this->currentSortOption == $this->getSortByTypeMode();
174  }
+ Here is the call graph for this function:

◆ isStudyProgrammeViewActive()

ilPDSelectedItemsBlockViewSettings::isStudyProgrammeViewActive ( )
Returns
boolean

Definition at line 131 of file class.ilPDSelectedItemsBlockViewSettings.php.

References getStudyProgrammeView().

Referenced by parse().

132  {
133  return $this->currentView == $this->getStudyProgrammeView();
134  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isValidView()

ilPDSelectedItemsBlockViewSettings::isValidView (   $view)
Parameters
string$view
Returns
boolean

Definition at line 330 of file class.ilPDSelectedItemsBlockViewSettings.php.

Referenced by parse().

331  {
332  return in_array($view, $this->validViews);
333  }
+ Here is the caller graph for this function:

◆ parse()

ilPDSelectedItemsBlockViewSettings::parse ( )

Definition at line 269 of file class.ilPDSelectedItemsBlockViewSettings.php.

References $key, enabledMemberships(), enabledSelectedItems(), getCurrentView(), getDefaultSortType(), getDefaultView(), getMembershipsView(), getSelectedItemsView(), isSelectedItemsViewActive(), isStudyProgrammeViewActive(), isValidView(), and storeDefaultView().

270  {
271  $this->validViews = self::$availableViews;
272 
273  foreach (array_filter([
274  $this->getMembershipsView() => !$this->enabledMemberships(),
275  $this->getSelectedItemsView() => !$this->enabledSelectedItems()
276  ]) as $viewId => $status) {
277  $key = array_search($viewId, $this->validViews);
278  if ($key !== false) {
279  unset($this->validViews[$key]);
280  }
281  }
282 
283  if (count($this->validViews) == 1) {
284  $this->storeDefaultView($this->getSelectedItemsView());
285  $this->validViews[] = $this->getSelectedItemsView();
286  }
287 
288  if (!$this->isValidView($this->getCurrentView())) {
289  $this->currentView = $this->getDefaultView();
290  }
291 
292  $this->currentSortOption = $this->actor->getPref('pd_order_items');
293  if (!in_array($this->currentSortOption, self::$availableSortOptionsByView[$this->currentView])) {
294  if ($this->isSelectedItemsViewActive()) {
295  $this->currentSortOption = self::SORT_BY_LOCATION;
296  } elseif ($this->isStudyProgrammeViewActive()) {
297  $this->currentSortOption = $this->getDefaultSortType();
298  }
299  }
300  }
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:

◆ storeDefaultSortType()

ilPDSelectedItemsBlockViewSettings::storeDefaultSortType (   $type)
Parameters
string$type

Definition at line 195 of file class.ilPDSelectedItemsBlockViewSettings.php.

References $type, and settings().

196  {
197  assert(in_array($type, self::$availableSortOptions));
198  $this->settings->set('my_memberships_def_sort', $type);
199  }
$type
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

◆ storeDefaultView()

ilPDSelectedItemsBlockViewSettings::storeDefaultView (   $view)
Parameters
$viewint

Definition at line 260 of file class.ilPDSelectedItemsBlockViewSettings.php.

References settings().

Referenced by parse().

261  {
262  assert(in_array($view, self::$availableViews));
263  $this->settings->set('personal_items_default_view', $view);
264  }
settings()
Definition: settings.php:2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $actor

ilPDSelectedItemsBlockViewSettings::$actor
protected

Definition at line 54 of file class.ilPDSelectedItemsBlockViewSettings.php.

Referenced by __construct(), and getActor().

◆ $availableSortOptions

ilPDSelectedItemsBlockViewSettings::$availableSortOptions
staticprotected
Initial value:
self::SORT_BY_LOCATION,
self::SORT_BY_TYPE,
self::SORT_BY_START_DATE
)

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

◆ $availableSortOptionsByView

ilPDSelectedItemsBlockViewSettings::$availableSortOptionsByView
staticprotected
Initial value:
self::VIEW_SELECTED_ITEMS => array(
self::SORT_BY_LOCATION,
self::SORT_BY_TYPE
),
self::VIEW_MY_MEMBERSHIPS => array(
self::SORT_BY_LOCATION,
self::SORT_BY_TYPE,
self::SORT_BY_START_DATE
),
self::VIEW_MY_STUDYPROGRAMME => array(
)
)

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

◆ $availableViews

ilPDSelectedItemsBlockViewSettings::$availableViews
staticprotected
Initial value:
self::VIEW_SELECTED_ITEMS,
self::VIEW_MY_MEMBERSHIPS,
self::VIEW_MY_STUDYPROGRAMME
)

Definition at line 14 of file class.ilPDSelectedItemsBlockViewSettings.php.

◆ $currentSortOption

ilPDSelectedItemsBlockViewSettings::$currentSortOption = self::SORT_BY_LOCATION
protected

Definition at line 69 of file class.ilPDSelectedItemsBlockViewSettings.php.

Referenced by getCurrentSortOption().

◆ $currentView

ilPDSelectedItemsBlockViewSettings::$currentView = self::VIEW_SELECTED_ITEMS
protected

Definition at line 64 of file class.ilPDSelectedItemsBlockViewSettings.php.

Referenced by getCurrentView().

◆ $settings

ilPDSelectedItemsBlockViewSettings::$settings
protected

Definition at line 49 of file class.ilPDSelectedItemsBlockViewSettings.php.

◆ $validViews

ilPDSelectedItemsBlockViewSettings::$validViews = array()
protected

Definition at line 59 of file class.ilPDSelectedItemsBlockViewSettings.php.


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