ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 ()
 

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
$DIC
Definition: xapitoken.php:46
+ 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 161 of file class.ilMemberViewSettings.php.

References setContainer().

Referenced by toggleActivation().

162  {
163  $this->active = true;
164  $this->setContainer($a_ref_id);
165  }
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 171 of file class.ilMemberViewSettings.php.

References $_SESSION.

Referenced by toggleActivation().

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

◆ findEffectiveRefId()

ilMemberViewSettings::findEffectiveRefId ( )
protected

Find effective ref_id for request.

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

References $_GET, and $target_arr.

Referenced by read().

230  {
231  if ((int) $_GET['ref_id']) {
232  return $this->current_ref_id = (int) $_GET['ref_id'];
233  }
234 
235  $target_arr = explode('_', (string) $_GET['target']);
236  if (isset($target_arr[1]) and (int) $target_arr[1]) {
237  $this->current_ref_id = (int) $target_arr[1];
238  }
239  }
$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 getContainer(), and getCurrentRefId().

109  : bool
110  {
111  static $mv_status;
112  if (!isset($mv_status)) {
113  if (!$this->active) {
114  // Not active
115  return $mv_status = false;
116  }
117 
118  if (!$this->getCurrentRefId()) {
119  // No ref id given => mail, search, personal desktop menu in other tab
120  return $mv_status = false;
121  }
122 
123  if (!in_array($this->getCurrentRefId(), $this->container_items) and
124  $this->getContainer() != $this->getCurrentRefId()
125  ) {
126  // outside of course
127  return $mv_status = false;
128  }
129  return $mv_status = true;
130  }
131 
132  return $mv_status;
133  }
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 140 of file class.ilMemberViewSettings.php.

References getContainer().

141  {
142  if (!$this->active || !(int) $a_ref_id) {
143  // Not active
144  return false;
145  }
146 
147  if (!in_array($a_ref_id, $this->container_items) and
148  $this->getContainer() != $a_ref_id) {
149  // outside of course
150  return false;
151  }
152  return true;
153  }
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 197 of file class.ilMemberViewSettings.php.

References $enabled.

198  {
199  return (bool) $this->enabled;
200  }

◆ read()

ilMemberViewSettings::read ( )
protected

Read settings.

Returns
void

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

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

Referenced by __construct().

207  {
209  $tree = $this->tree;
210 
211  $this->findEffectiveRefId();
212 
213  // member view is always enabled
214  // (2013-06-18, http://www.ilias.de/docu/goto_docu_wiki_1357_Reorganising_Administration.html)
215 
216  // $this->enabled = $ilSetting->get('preview_learner');
217  $this->enabled = true;
218 
219  if (isset($_SESSION['member_view_container'])) {
220  $this->active = true;
221  $this->container = (int) $_SESSION['member_view_container'];
222  $this->container_items = $tree->getSubTreeIds($this->getContainer());
223  }
224  }
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 184 of file class.ilMemberViewSettings.php.

References activate(), and deactivate().

185  {
186  if ($a_activation) {
187  return $this->activate($a_ref_id);
188  } else {
189  return $this->deactivate($a_ref_id);
190  }
191  }
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 read().


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