ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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...
 

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

References read().

45  {
46  $this->read();
47  }
+ 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 150 of file class.ilMemberViewSettings.php.

References setContainer().

Referenced by toggleActivation().

151  {
152  $this->active = true;
153  $this->setContainer($a_ref_id);
154  }
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 160 of file class.ilMemberViewSettings.php.

References $_SESSION.

Referenced by toggleActivation().

161  {
162  $this->active = false;
163  $this->container = null;
164  unset($_SESSION['member_view_container']);
165  }
$_SESSION["AccountId"]
+ Here is the caller graph for this function:

◆ findEffectiveRefId()

ilMemberViewSettings::findEffectiveRefId ( )
protected

Find effective ref_id for request.

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

References $_GET, and $target_arr.

Referenced by read().

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

◆ getContainer()

ilMemberViewSettings::getContainer ( )

Returns $container.

See also
ilMemberView::$container

Definition at line 66 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 75 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 96 of file class.ilMemberViewSettings.php.

References getContainer(), and getCurrentRefId().

97  {
98  global $tree;
99 
100  if(!$this->active)
101  {
102  // Not active
103  return false;
104  }
105 
106 
107  if(!$this->getCurrentRefId())
108  {
109  // No ref id given => mail, search, personal desktop menu in other tab
110  return false;
111  }
112 
113  if(!in_array($this->getCurrentRefId(),$this->container_items) and
114  $this->getContainer() != $this->getCurrentRefId())
115  {
116  // outside of course
117  return false;
118  }
119  return true;
120  }
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 127 of file class.ilMemberViewSettings.php.

References getContainer().

128  {
129  if(!$this->active || !(int)$a_ref_id)
130  {
131  // Not active
132  return false;
133  }
134 
135  if(!in_array($a_ref_id,$this->container_items) and
136  $this->getContainer() != $a_ref_id)
137  {
138  // outside of course
139  return false;
140  }
141  return true;
142  }
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 189 of file class.ilMemberViewSettings.php.

References $enabled.

190  {
191  return (bool) $this->enabled;
192  }

◆ read()

ilMemberViewSettings::read ( )
protected

Read settings.

Returns
void

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

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

Referenced by __construct().

199  {
200  global $ilSetting,$tree;
201 
202  $this->findEffectiveRefId();
203 
204  // member view is always enabled
205  // (2013-06-18, http://www.ilias.de/docu/goto_docu_wiki_1357_Reorganising_Administration.html)
206 
207  // $this->enabled = $ilSetting->get('preview_learner');
208  $this->enabled = true;
209 
210  if(isset($_SESSION['member_view_container']))
211  {
212  $this->active = true;
213  $this->container = (int) $_SESSION['member_view_container'];
214  $this->container_items = $tree->getSubTreeIds($this->getContainer());
215  }
216  }
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 85 of file class.ilMemberViewSettings.php.

References $_SESSION, and $container.

Referenced by activate().

86  {
87  $this->container = $container;
88  $_SESSION['member_view_container'] = $this->container;
89  $_SESSION['il_cont_admin_panel'] = false;
90  }
$_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 173 of file class.ilMemberViewSettings.php.

References activate(), and deactivate().

174  {
175  if($a_activation)
176  {
177  return $this->activate($a_ref_id);
178  }
179  else
180  {
181  return $this->deactivate($a_ref_id);
182  }
183  }
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 33 of file class.ilMemberViewSettings.php.

◆ $container

ilMemberViewSettings::$container = null
private

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

Referenced by getContainer(), and setContainer().

◆ $container_items

ilMemberViewSettings::$container_items = array()
private

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

◆ $current_ref_id

ilMemberViewSettings::$current_ref_id = 0
private

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

Referenced by getCurrentRefId().

◆ $enabled

ilMemberViewSettings::$enabled = false
private

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

Referenced by isEnabled().

◆ $instance

ilMemberViewSettings::$instance = null
staticprivate

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


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