ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMemberViewSettings Class Reference

Settings for members view. More...

+ Collaboration diagram for ilMemberViewSettings:

Public Member Functions

 getContainer ()
 
 getCurrentRefId ()
 
 setContainer (int $container)
 
 isActive ()
 Check if member view currently enabled. More...
 
 isActiveForRefId (int $a_ref_id)
 Check if member view is currently enabled for given ref id. More...
 
 activate (int $a_ref_id)
 Enable member view for this session and container. More...
 
 deactivate ()
 
 toggleActivation (int $a_ref_id, bool $a_activation)
 Toggle activation status. More...
 
 isEnabled ()
 Check if members view is enabled in the administration. More...
 

Static Public Member Functions

static getInstance ()
 

Data Fields

const SESSION_MEMBER_VIEW_CONTAINER = 'member_view_container'
 

Protected Member Functions

 read ()
 Read settings. More...
 
 findEffectiveRefId ()
 Find effective ref_id for request. More...
 

Protected Attributes

ilLogger $logger
 
RequestInterface $request
 
ilCtrl $ctrl
 
ilTree $tree
 
ilSetting $settings
 
Container Service $container_service
 

Private Member Functions

 __construct ()
 

Private Attributes

bool $active = false
 
bool $enabled = false
 
int $container = null
 
array $container_items = []
 
int $current_ref_id = 0
 

Static Private Attributes

static ilMemberViewSettings $instance = null
 

Detailed Description

Settings for members view.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 26 of file class.ilMemberViewSettings.php.

Constructor & Destructor Documentation

◆ __construct()

ilMemberViewSettings::__construct ( )
private

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

References $DIC, ILIAS\Repository\ctrl(), ILIAS\Repository\logger(), read(), and ILIAS\Repository\settings().

43  {
44  global $DIC;
45 
46  $this->tree = $DIC->repositoryTree();
47  $this->settings = $DIC->settings();
48  $this->request = $DIC->http()->request();
49  $this->ctrl = $DIC->ctrl();
50  $this->logger = $DIC->logger()->cont();
51  $this->read();
52  $this->container_service = $DIC->container();
53  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ activate()

ilMemberViewSettings::activate ( int  $a_ref_id)

Enable member view for this session and container.

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

References setContainer().

Referenced by toggleActivation().

131  : void
132  {
133  $this->active = true;
134  $this->setContainer($a_ref_id);
135  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deactivate()

ilMemberViewSettings::deactivate ( )

Definition at line 137 of file class.ilMemberViewSettings.php.

References ilSession\clear().

Referenced by read(), and toggleActivation().

137  : void
138  {
139  $this->active = false;
140  $this->container = null;
141  ilSession::clear(self::SESSION_MEMBER_VIEW_CONTAINER);
142  }
static clear(string $a_var)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findEffectiveRefId()

ilMemberViewSettings::findEffectiveRefId ( )
protected

Find effective ref_id for request.

Definition at line 196 of file class.ilMemberViewSettings.php.

References $ref_id, $target_arr, ILIAS\Repository\ctrl(), and ILIAS\Repository\int().

Referenced by read().

196  : int
197  {
198  if ($this->ctrl->isAsynch()) {
199  // Ignore asynchronous requests
200  return 0;
201  }
202 
203  $ref_id = (int) ($this->request->getQueryParams()['ref_id'] ?? 0);
204  if ($ref_id) {
205  return $this->current_ref_id = $ref_id;
206  }
207  $target_str = (string) ($this->request->getQueryParams()['target'] ?? '');
208  if ($target_str !== '') {
209  $target_arr = explode('_', $target_str);
210  if (isset($target_arr[1]) && (int) $target_arr[1]) {
211  $this->current_ref_id = (int) $target_arr[1];
212  }
213  }
214  return 0;
215  }
$target_arr
Definition: goto.php:50
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContainer()

ilMemberViewSettings::getContainer ( )

Definition at line 60 of file class.ilMemberViewSettings.php.

References $container.

Referenced by isActive(), isActiveForRefId(), and read().

60  : ?int
61  {
62  return $this->container;
63  }
+ Here is the caller graph for this function:

◆ getCurrentRefId()

ilMemberViewSettings::getCurrentRefId ( )

Definition at line 65 of file class.ilMemberViewSettings.php.

References $current_ref_id.

Referenced by isActive(), and read().

65  : int
66  {
67  return $this->current_ref_id;
68  }
+ Here is the caller graph for this function:

◆ getInstance()

◆ isActive()

ilMemberViewSettings::isActive ( )

Check if member view currently enabled.

Definition at line 85 of file class.ilMemberViewSettings.php.

References getContainer(), and getCurrentRefId().

85  : bool
86  {
87  static $mv_status;
88  if (!isset($mv_status)) {
89  if (!$this->active) {
90  // Not active
91  return $mv_status = false;
92  }
93 
94  if (!$this->getCurrentRefId()) {
95  // No ref id given => mail, search, personal desktop menu in other tab
96  return $mv_status = false;
97  }
98 
99  if (!in_array($this->getCurrentRefId(), $this->container_items) &&
100  $this->getContainer() !== $this->getCurrentRefId()
101  ) {
102  // outside of course
103  return $mv_status = false;
104  }
105  return $mv_status = true;
106  }
107 
108  return $mv_status;
109  }
+ Here is the call graph for this function:

◆ isActiveForRefId()

ilMemberViewSettings::isActiveForRefId ( int  $a_ref_id)

Check if member view is currently enabled for given ref id.

Definition at line 114 of file class.ilMemberViewSettings.php.

References getContainer().

114  : bool
115  {
116  if (!$this->active || !$a_ref_id) {
117  return false;
118  }
119 
120  if (
121  !in_array($a_ref_id, $this->container_items) &&
122  $this->getContainer() !== $a_ref_id) {
123  return false;
124  }
125  return true;
126  }
+ Here is the call graph for this function:

◆ isEnabled()

ilMemberViewSettings::isEnabled ( )

Check if members view is enabled in the administration.

Definition at line 159 of file class.ilMemberViewSettings.php.

References $enabled.

159  : bool
160  {
161  return $this->enabled;
162  }

◆ read()

ilMemberViewSettings::read ( )
protected

Read settings.

Definition at line 167 of file class.ilMemberViewSettings.php.

References deactivate(), findEffectiveRefId(), ilSession\get(), getContainer(), getCurrentRefId(), and ILIAS\Repository\int().

Referenced by __construct().

167  : void
168  {
170 
171  // member view is always enabled
172  // (2013-06-18, http://www.ilias.de/docu/goto_docu_wiki_1357_Reorganising_Administration.html)
173 
174  // $this->enabled = $ilSetting->get('preview_learner');
175  $this->enabled = true;
176 
177  if (ilSession::get(self::SESSION_MEMBER_VIEW_CONTAINER)) {
178  $this->active = true;
179  $this->container = (int) ilSession::get(self::SESSION_MEMBER_VIEW_CONTAINER);
180  $this->container_items = $this->tree->getSubTreeIds($this->getContainer());
181 
182  // deactivate if out of scope
183  if (
184  $this->getCurrentRefId() &&
185  !in_array($this->getCurrentRefId(), $this->container_items) &&
186  $this->getCurrentRefId() !== $this->getContainer()
187  ) {
188  $this->deactivate();
189  }
190  }
191  }
static get(string $a_var)
findEffectiveRefId()
Find effective ref_id for request.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContainer()

ilMemberViewSettings::setContainer ( int  $container)

Definition at line 70 of file class.ilMemberViewSettings.php.

References $container, and ilSession\set().

Referenced by activate().

70  : void
71  {
72  $this->container = $container;
73  ilSession::set(self::SESSION_MEMBER_VIEW_CONTAINER, $this->container);
74  $this->container_service
75  ->internal()
76  ->domain()
77  ->content()
78  ->view()
79  ->setContentView();
80  }
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toggleActivation()

ilMemberViewSettings::toggleActivation ( int  $a_ref_id,
bool  $a_activation 
)

Toggle activation status.

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

References activate(), and deactivate().

147  : void
148  {
149  if ($a_activation) {
150  $this->activate($a_ref_id);
151  } else {
152  $this->deactivate();
153  }
154  }
activate(int $a_ref_id)
Enable member view for this session and container.
+ Here is the call graph for this function:

Field Documentation

◆ $active

bool ilMemberViewSettings::$active = false
private

Definition at line 35 of file class.ilMemberViewSettings.php.

◆ $container

int ilMemberViewSettings::$container = null
private

Definition at line 37 of file class.ilMemberViewSettings.php.

Referenced by getContainer(), and setContainer().

◆ $container_items

array ilMemberViewSettings::$container_items = []
private

Definition at line 38 of file class.ilMemberViewSettings.php.

◆ $container_service

Container Service ilMemberViewSettings::$container_service
protected

Definition at line 40 of file class.ilMemberViewSettings.php.

◆ $ctrl

ilCtrl ilMemberViewSettings::$ctrl
protected

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

◆ $current_ref_id

int ilMemberViewSettings::$current_ref_id = 0
private

Definition at line 39 of file class.ilMemberViewSettings.php.

Referenced by getCurrentRefId().

◆ $enabled

bool ilMemberViewSettings::$enabled = false
private

Definition at line 36 of file class.ilMemberViewSettings.php.

Referenced by isEnabled().

◆ $instance

ilMemberViewSettings ilMemberViewSettings::$instance = null
staticprivate

Definition at line 34 of file class.ilMemberViewSettings.php.

◆ $logger

ilLogger ilMemberViewSettings::$logger
protected

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

◆ $request

RequestInterface ilMemberViewSettings::$request
protected

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

◆ $settings

ilSetting ilMemberViewSettings::$settings
protected

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

◆ $tree

ilTree ilMemberViewSettings::$tree
protected

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

◆ SESSION_MEMBER_VIEW_CONTAINER

const ilMemberViewSettings::SESSION_MEMBER_VIEW_CONTAINER = 'member_view_container'

Definition at line 28 of file class.ilMemberViewSettings.php.


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