ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilMemberViewSettings Class Reference

Settings for members view. More...

+ Collaboration diagram for ilMemberViewSettings:

Public Member Functions

 getContainer ()
 
 getCurrentRefId ()
 
 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: shib_login.php:22
+ 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 133 of file class.ilMemberViewSettings.php.

Referenced by toggleActivation().

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

◆ deactivate()

ilMemberViewSettings::deactivate ( )

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

References ilSession\clear(), and null.

Referenced by read(), and toggleActivation().

139  : void
140  {
141  $this->active = false;
142  $this->container = null;
143  ilSession::clear(self::SESSION_MEMBER_VIEW_CONTAINER);
144  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 198 of file class.ilMemberViewSettings.php.

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

Referenced by read().

198  : int
199  {
200  // re-enable asynchronous request due to #41218
201  $ref_id = (int) ($this->request->getQueryParams()['ref_id'] ?? 0);
202  if ($ref_id) {
203  return $this->current_ref_id = $ref_id;
204  }
205  $target_str = (string) ($this->request->getQueryParams()['target'] ?? '');
206  if ($target_str !== '') {
207  $target_arr = explode('_', $target_str);
208  if (isset($target_arr[1]) && (int) $target_arr[1]) {
209  $this->current_ref_id = (int) $target_arr[1];
210  }
211  }
212  return 0;
213  }
$ref_id
Definition: ltiauth.php:65
+ 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 $container, $current_ref_id, ilObjectFactory\getInstanceByRefId(), and ilSession\set().

Referenced by isActive(), and read().

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

◆ getInstance()

◆ isActive()

ilMemberViewSettings::isActive ( )

Check if member view currently enabled.

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

References getContainer(), and getCurrentRefId().

87  : bool
88  {
89  static $mv_status;
90  if (!isset($mv_status)) {
91  if (!$this->active) {
92  // Not active
93  return $mv_status = false;
94  }
95 
96  if (!$this->getCurrentRefId()) {
97  // No ref id given => mail, search, personal desktop menu in other tab
98  return $mv_status = false;
99  }
100 
101  if (!in_array($this->getCurrentRefId(), $this->container_items) &&
102  $this->getContainer() !== $this->getCurrentRefId()
103  ) {
104  // outside of course
105  return $mv_status = false;
106  }
107  return $mv_status = true;
108  }
109 
110  return $mv_status;
111  }
+ 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 116 of file class.ilMemberViewSettings.php.

References getContainer().

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

◆ isEnabled()

ilMemberViewSettings::isEnabled ( )

Check if members view is enabled in the administration.

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

References $enabled.

161  : bool
162  {
163  return $this->enabled;
164  }

◆ read()

ilMemberViewSettings::read ( )
protected

Read settings.

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

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

Referenced by __construct().

169  : void
170  {
172 
173  // member view is always enabled
174  // (2013-06-18, http://www.ilias.de/docu/goto_docu_wiki_1357_Reorganising_Administration.html)
175 
176  // $this->enabled = $ilSetting->get('preview_learner');
177  $this->enabled = true;
178 
179  if (ilSession::get(self::SESSION_MEMBER_VIEW_CONTAINER)) {
180  $this->active = true;
181  $this->container = (int) ilSession::get(self::SESSION_MEMBER_VIEW_CONTAINER);
182  $this->container_items = $this->tree->getSubTreeIds($this->getContainer());
183 
184  // deactivate if out of scope
185  if (
186  $this->getCurrentRefId() &&
187  !in_array($this->getCurrentRefId(), $this->container_items) &&
188  $this->getCurrentRefId() !== $this->getContainer()
189  ) {
190  $this->deactivate();
191  }
192  }
193  }
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:

◆ toggleActivation()

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

Toggle activation status.

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

References activate(), and deactivate().

149  : void
150  {
151  if ($a_activation) {
152  $this->activate($a_ref_id);
153  } else {
154  $this->deactivate();
155  }
156  }
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 getCurrentRefId().

◆ $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: