ILIAS  release_7 Revision v7.30-3-g800a261c036
ilMemberViewSettings Class Reference

@classDescription 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 ()
 Deactivate member view. More...
 
 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

 $logger
 
 $request
 
 $ctrl
 
 $tree
 
 $settings
 

Private Member Functions

 __construct ()
 Constructor (singleton) More...
 

Private Attributes

 $active = false
 
 $enabled = false
 
 $container = null
 
 $container_items = array()
 
 $current_ref_id = 0
 

Static Private Attributes

static $instance = null
 

Detailed Description

@classDescription Settings for members view

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

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

Constructor & Destructor Documentation

◆ __construct()

ilMemberViewSettings::__construct ( )
private

Constructor (singleton)

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

94 {
95 global $DIC;
96
97 $this->tree = $DIC->repositoryTree();
98 $this->settings = $DIC->settings();
99 $this->request = $DIC->http()->request();
100 $this->ctrl = $DIC->ctrl();
101 $this->logger = $DIC->logger()->cont();
102 $this->read();
103 }
global $DIC
Definition: goto.php:24
settings()
Definition: settings.php:2

References $DIC, read(), and settings().

+ 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.

Parameters
int$a_ref_id

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

196 : void
197 {
198 $this->active = true;
199 $this->setContainer($a_ref_id);
200 }

References setContainer().

Referenced by toggleActivation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deactivate()

ilMemberViewSettings::deactivate ( )

Deactivate member view.

Returns

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

206 : void
207 {
208 $this->active = false;
209 $this->container = null;
210 ilSession::clear(self::SESSION_MEMBER_VIEW_CONTAINER);
211 }
static clear($a_var)
Unset a value.

References ilSession\clear().

Referenced by read(), and toggleActivation().

+ 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 268 of file class.ilMemberViewSettings.php.

269 {
270 if ($this->ctrl->isAsynch()) {
271 // Ignore asynchronous requests
272 return;
273 }
274
275 $ref_id = (int) $this->request->getQueryParams()['ref_id'] ?? 0;
276 if ($ref_id) {
277 return $this->current_ref_id = $ref_id;
278 }
279 $target_str = (string) $this->request->getQueryParams()['target'] ?? '';
280 if (strlen($target_str)) {
281 $target_arr = explode('_', (string) $target_str);
282 if (isset($target_arr[1]) && (int) $target_arr[1]) {
283 $this->current_ref_id = (int) $target_arr[1];
284 }
285 }
286 }
$target_arr
Definition: goto.php:49

References $target_arr.

Referenced by read().

+ Here is the caller graph for this function:

◆ getContainer()

ilMemberViewSettings::getContainer ( )
Returns
int|null

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

120 : ?int
121 {
122 return $this->container;
123 }

References $container.

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

+ Here is the caller graph for this function:

◆ getCurrentRefId()

ilMemberViewSettings::getCurrentRefId ( )
Returns
int

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

128 : int
129 {
131 }

References $current_ref_id.

Referenced by isActive(), and read().

+ Here is the caller graph for this function:

◆ getInstance()

◆ isActive()

ilMemberViewSettings::isActive ( )

Check if member view currently enabled.

Returns
bool

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

147 : bool
148 {
149 static $mv_status;
150 if (!isset($mv_status)) {
151 if (!$this->active) {
152 // Not active
153 return $mv_status = false;
154 }
155
156 if (!$this->getCurrentRefId()) {
157 // No ref id given => mail, search, personal desktop menu in other tab
158 return $mv_status = false;
159 }
160
161 if (!in_array($this->getCurrentRefId(), $this->container_items) and
162 $this->getContainer() != $this->getCurrentRefId()
163 ) {
164 // outside of course
165 return $mv_status = false;
166 }
167 return $mv_status = true;
168 }
169
170 return $mv_status;
171 }

References getContainer(), and getCurrentRefId().

+ 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.

Parameters
int$a_ref_id
Returns
bool

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

178 : bool
179 {
180 if (!$this->active || !(int) $a_ref_id) {
181 return false;
182 }
183
184 if (
185 !in_array($a_ref_id, $this->container_items) &&
186 $this->getContainer() != $a_ref_id) {
187 return false;
188 }
189 return true;
190 }

References getContainer().

+ Here is the call graph for this function:

◆ isEnabled()

ilMemberViewSettings::isEnabled ( )

Check if members view is enabled in the administration.

Returns
bool

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

231 : bool
232 {
233 return (bool) $this->enabled;
234 }

References $enabled.

◆ read()

ilMemberViewSettings::read ( )
protected

Read settings.

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

239 : void
240 {
242
243 // member view is always enabled
244 // (2013-06-18, http://www.ilias.de/docu/goto_docu_wiki_1357_Reorganising_Administration.html)
245
246 // $this->enabled = $ilSetting->get('preview_learner');
247 $this->enabled = true;
248
249 if (ilSession::get(self::SESSION_MEMBER_VIEW_CONTAINER)) {
250 $this->active = true;
251 $this->container = (int) ilSession::get(self::SESSION_MEMBER_VIEW_CONTAINER);
252 $this->container_items = $this->tree->getSubTreeIds($this->getContainer());
253
254 // deactivate if out of scope
255 if (
256 $this->getCurrentRefId() &&
257 !in_array($this->getCurrentRefId(), $this->container_items) &&
258 $this->getCurrentRefId() != $this->getContainer()
259 ) {
260 $this->deactivate();
261 }
262 }
263 }
findEffectiveRefId()
Find effective ref_id for request.
deactivate()
Deactivate member view.
static get($a_var)
Get a value.

References $current_ref_id, deactivate(), findEffectiveRefId(), ilSession\get(), getContainer(), and getCurrentRefId().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContainer()

ilMemberViewSettings::setContainer ( int  $container)
Parameters
int$container

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

137 {
138 $this->container = $container;
139 ilSession::set(self::SESSION_MEMBER_VIEW_CONTAINER, $this->container);
140 ilSession::set('il_cont_admin_panel', false);
141 }
static set($a_var, $a_val)
Set a value.

References $container, and ilSession\set().

Referenced by activate().

+ 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.

Parameters
int$a_ref_id
bool$a_activation

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

218 : void
219 {
220 if ($a_activation) {
221 $this->activate($a_ref_id);
222 } else {
223 $this->deactivate($a_ref_id);
224 }
225 }
activate(int $a_ref_id)
Enable member view for this session and container.

References activate(), and deactivate().

+ Here is the call graph for this function:

Field Documentation

◆ $active

ilMemberViewSettings::$active = false
private

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

◆ $container

ilMemberViewSettings::$container = null
private

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

Referenced by getContainer(), and setContainer().

◆ $container_items

ilMemberViewSettings::$container_items = array()
private

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

◆ $ctrl

ilMemberViewSettings::$ctrl
protected

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

◆ $current_ref_id

ilMemberViewSettings::$current_ref_id = 0
private

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

Referenced by getCurrentRefId(), and read().

◆ $enabled

ilMemberViewSettings::$enabled = false
private

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

Referenced by isEnabled().

◆ $instance

ilMemberViewSettings::$instance = null
staticprivate

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

Referenced by getInstance().

◆ $logger

ilMemberViewSettings::$logger
protected

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

◆ $request

ilMemberViewSettings::$request
protected

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

◆ $settings

ilMemberViewSettings::$settings
protected

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

◆ $tree

ilMemberViewSettings::$tree
protected

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

◆ SESSION_MEMBER_VIEW_CONTAINER

const ilMemberViewSettings::SESSION_MEMBER_VIEW_CONTAINER = 'member_view_container'

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


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