ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilMemberViewSettings Class Reference

Settings for members view More...

+ Collaboration diagram for ilMemberViewSettings:

Public Member Functions

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

Static Public Member Functions

static getInstance ()
 Get instance. More...
 

Protected Member Functions

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

Protected Attributes

 $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

Settings for members view

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

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

Constructor & Destructor Documentation

◆ __construct()

ilMemberViewSettings::__construct ( )
private

Constructor (singleton)

Returns

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

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

55  {
56  global $DIC;
57 
58  $this->tree = $DIC->repositoryTree();
59  $this->settings = $DIC->settings();
60  $this->read();
61  }
settings()
Definition: settings.php:2
global $DIC
Definition: saml.php:7
+ Here is the call graph for this function:

Member Function Documentation

◆ activate()

ilMemberViewSettings::activate (   $a_ref_id)

Enable member view for this session and container.

Returns
Parameters
int$a_ref_idReference Id of course or group
Exceptions
IllegalArgumentExceptionThrown if reference id is not a course or group

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

References setContainer().

Referenced by toggleActivation().

159  {
160  $this->active = true;
161  $this->setContainer($a_ref_id);
162  }
setContainer($container)
Sets $container.
+ 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 168 of file class.ilMemberViewSettings.php.

References $_SESSION.

Referenced by toggleActivation().

169  {
170  $this->active = false;
171  $this->container = null;
172  unset($_SESSION['member_view_container']);
173  }
$_SESSION["AccountId"]
+ Here is the caller graph for this function:

◆ findEffectiveRefId()

ilMemberViewSettings::findEffectiveRefId ( )
protected

Find effective ref_id for request.

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

References $_GET, and $target_arr.

Referenced by read().

227  {
228  if ((int) $_GET['ref_id']) {
229  return $this->current_ref_id = (int) $_GET['ref_id'];
230  }
231 
232  $target_arr = explode('_', (string) $_GET['target']);
233  if (isset($target_arr[1]) and (int) $target_arr[1]) {
234  $this->current_ref_id = (int) $target_arr[1];
235  }
236  }
$target_arr
Definition: goto.php:47
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ getContainer()

ilMemberViewSettings::getContainer ( )

Returns $container.

See also
ilMemberView::$container

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

References $container.

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

+ Here is the caller graph for this function:

◆ getCurrentRefId()

ilMemberViewSettings::getCurrentRefId ( )

Get current ref_id of request.

Returns
type

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

References $current_ref_id.

Referenced by isActive().

+ Here is the caller graph for this function:

◆ getInstance()

◆ isActive()

ilMemberViewSettings::isActive ( )

Check if member view currently enabled.

Returns
bool

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

References $tree, getContainer(), and getCurrentRefId().

110  {
111  $tree = $this->tree;
112 
113  if (!$this->active) {
114  // Not active
115  return false;
116  }
117 
118 
119  if (!$this->getCurrentRefId()) {
120  // No ref id given => mail, search, personal desktop menu in other tab
121  return false;
122  }
123 
124  if (!in_array($this->getCurrentRefId(), $this->container_items) and
125  $this->getContainer() != $this->getCurrentRefId()) {
126  // outside of course
127  return false;
128  }
129  return true;
130  }
getContainer()
Returns $container.
getCurrentRefId()
Get current ref_id of request.
+ Here is the call graph for this function:

◆ isActiveForRefId()

ilMemberViewSettings::isActiveForRefId (   $a_ref_id)

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

Parameters
int$a_ref_id
Returns
bool

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

References getContainer().

138  {
139  if (!$this->active || !(int) $a_ref_id) {
140  // Not active
141  return false;
142  }
143 
144  if (!in_array($a_ref_id, $this->container_items) and
145  $this->getContainer() != $a_ref_id) {
146  // outside of course
147  return false;
148  }
149  return true;
150  }
getContainer()
Returns $container.
+ Here is the call graph for this function:

◆ isEnabled()

ilMemberViewSettings::isEnabled ( )

Check if members view is enabled in the administration.

Returns
bool active

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

References $enabled.

195  {
196  return (bool) $this->enabled;
197  }

◆ read()

ilMemberViewSettings::read ( )
protected

Read settings.

Returns
void

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

References $_SESSION, $ilSetting, $settings, $tree, findEffectiveRefId(), and getContainer().

Referenced by __construct().

204  {
206  $tree = $this->tree;
207 
208  $this->findEffectiveRefId();
209 
210  // member view is always enabled
211  // (2013-06-18, http://www.ilias.de/docu/goto_docu_wiki_1357_Reorganising_Administration.html)
212 
213  // $this->enabled = $ilSetting->get('preview_learner');
214  $this->enabled = true;
215 
216  if (isset($_SESSION['member_view_container'])) {
217  $this->active = true;
218  $this->container = (int) $_SESSION['member_view_container'];
219  $this->container_items = $tree->getSubTreeIds($this->getContainer());
220  }
221  }
getContainer()
Returns $container.
$_SESSION["AccountId"]
findEffectiveRefId()
Find effective ref_id for request.
global $ilSetting
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContainer()

ilMemberViewSettings::setContainer (   $container)

Sets $container.

Parameters
object$container
See also
ilMemberView::$container

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

References $_SESSION, and $container.

Referenced by activate().

99  {
100  $this->container = $container;
101  $_SESSION['member_view_container'] = $this->container;
102  $_SESSION['il_cont_admin_panel'] = false;
103  }
$_SESSION["AccountId"]
+ Here is the caller graph for this function:

◆ toggleActivation()

ilMemberViewSettings::toggleActivation (   $a_ref_id,
  $a_activation 
)

Toggle activation status.

Returns
Parameters
int$a_ref_id
bool$a_activation

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

References activate(), and deactivate().

182  {
183  if ($a_activation) {
184  return $this->activate($a_ref_id);
185  } else {
186  return $this->deactivate($a_ref_id);
187  }
188  }
activate($a_ref_id)
Enable member view for this session and container.
deactivate()
Deactivate member view.
+ Here is the call graph for this function:

Field Documentation

◆ $active

ilMemberViewSettings::$active = false
private

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

◆ $container

ilMemberViewSettings::$container = null
private

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

Referenced by getContainer(), and setContainer().

◆ $container_items

ilMemberViewSettings::$container_items = array()
private

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

◆ $current_ref_id

ilMemberViewSettings::$current_ref_id = 0
private

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

Referenced by getCurrentRefId().

◆ $enabled

ilMemberViewSettings::$enabled = false
private

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

Referenced by isEnabled().

◆ $instance

ilMemberViewSettings::$instance = null
staticprivate

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

◆ $settings

ilMemberViewSettings::$settings
protected

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

Referenced by read().

◆ $tree

ilMemberViewSettings::$tree
protected

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

Referenced by isActive(), and read().


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