ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilUserClipboard Class Reference

User clipboard. More...

+ Collaboration diagram for ilUserClipboard:

Public Member Functions

 hasContent ()
 Check if clipboard has content. More...
 
 get ()
 Get clipboard content. More...
 
 getValidatedContent ()
 Get validated content of clipboard. More...
 
 add ($a_usr_ids)
 Add entries to clipboard. More...
 
 delete (array $a_usr_ids)
 User ids to delete. More...
 
 replace (array $a_usr_ids)
 Replace clipboard content. More...
 
 clear ()
 
 save ()
 Save clipboard content in session. More...
 

Static Public Member Functions

static getInstance ($a_usr_id)
 Get singelton instance. More...
 

Data Fields

const SESSION_KEYWORD = 'usr_clipboard'
 

Protected Member Functions

 __construct ($a_user_id)
 singleton constructor More...
 
 read ()
 Read from session. More...
 

Private Attributes

 $user_id = 0
 
 $clipboard = array()
 

Static Private Attributes

static $instance = null
 

Detailed Description

User clipboard.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 11 of file class.ilUserClipboard.php.

Constructor & Destructor Documentation

◆ __construct()

ilUserClipboard::__construct (   $a_user_id)
protected

singleton constructor

Definition at line 24 of file class.ilUserClipboard.php.

References read().

25  {
26  $this->user_id = $a_user_id;
27  $this->read();
28  }
read()
Read from session.
+ Here is the call graph for this function:

Member Function Documentation

◆ add()

ilUserClipboard::add (   $a_usr_ids)

Add entries to clipboard.

Definition at line 80 of file class.ilUserClipboard.php.

References array.

81  {
82  $this->clipboard = array_unique(array_merge($this->clipboard, (array) $a_usr_ids));
83  }
Create styles array
The data for the language used.

◆ clear()

ilUserClipboard::clear ( )

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

References array.

110  {
111  $this->clipboard = array();
112  }
Create styles array
The data for the language used.

◆ delete()

ilUserClipboard::delete ( array  $a_usr_ids)

User ids to delete.

Parameters
array$a_usr_ids

Definition at line 89 of file class.ilUserClipboard.php.

References $remaining, array, and replace().

90  {
91  $remaining = array();
92  foreach ($this->get() as $usr_id) {
93  if (!in_array($usr_id, $a_usr_ids)) {
94  $remaining[] = $usr_id;
95  }
96  }
97  $this->replace($remaining);
98  }
if($state['core:TerminatedAssocId'] !==null) $remaining
replace(array $a_usr_ids)
Replace clipboard content.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ get()

ilUserClipboard::get ( )

Get clipboard content.

Returns
array

Definition at line 56 of file class.ilUserClipboard.php.

References $clipboard, and array.

57  {
58  return (array) $this->clipboard;
59  }
Create styles array
The data for the language used.

◆ getInstance()

static ilUserClipboard::getInstance (   $a_usr_id)
static

Get singelton instance.

Parameters
int$a_usr_id
Returns
ilUserClipboard

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

Referenced by ilUserClipboardTableGUI\__construct(), ilLPTableBaseGUI\addToClipboard(), ilMembershipGUI\addToClipboard(), ilObjRoleGUI\addToClipboardObject(), ilObjUserFolderGUI\addToClipboardObject(), ilRepositorySearchGUI\emptyClipboard(), ilRepositorySearchGUI\fillAutoCompleteToolbar(), and ilRepositorySearchGUI\removeFromClipboard().

36  {
37  if (!self::$instance) {
38  self::$instance = new self($a_usr_id);
39  }
40  return self::$instance;
41  }
+ Here is the caller graph for this function:

◆ getValidatedContent()

ilUserClipboard::getValidatedContent ( )

Get validated content of clipboard.

Returns
type

Definition at line 65 of file class.ilUserClipboard.php.

References $valid, ilObjUser\_lookupLogin(), and array.

66  {
67  $valid = array();
68  foreach ($this->clipboard as $usr_id) {
69  include_once './Services/User/classes/class.ilObjUser.php';
70  if (strlen(ilObjUser::_lookupLogin($usr_id))) {
71  $valid[] = $usr_id;
72  }
73  }
74  return $valid;
75  }
static _lookupLogin($a_user_id)
lookup login
$valid
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ hasContent()

ilUserClipboard::hasContent ( )

Check if clipboard has content.

Returns
bool

Definition at line 47 of file class.ilUserClipboard.php.

48  {
49  return (bool) count($this->clipboard);
50  }

◆ read()

ilUserClipboard::read ( )
protected

Read from session.

Definition at line 125 of file class.ilUserClipboard.php.

References array, and ilSession\get().

Referenced by __construct().

126  {
127  $this->clipboard = (array) ilSession::get(self::SESSION_KEYWORD);
128  }
static get($a_var)
Get a value.
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ replace()

ilUserClipboard::replace ( array  $a_usr_ids)

Replace clipboard content.

Parameters
array$a_usr_ids

Definition at line 104 of file class.ilUserClipboard.php.

Referenced by delete().

105  {
106  $this->clipboard = $a_usr_ids;
107  }
+ Here is the caller graph for this function:

◆ save()

ilUserClipboard::save ( )

Save clipboard content in session.

Definition at line 117 of file class.ilUserClipboard.php.

References array, and ilSession\set().

118  {
119  ilSession::set(self::SESSION_KEYWORD, (array) $this->clipboard);
120  }
static set($a_var, $a_val)
Set a value.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

Field Documentation

◆ $clipboard

ilUserClipboard::$clipboard = array()
private

Definition at line 18 of file class.ilUserClipboard.php.

Referenced by get().

◆ $instance

ilUserClipboard::$instance = null
staticprivate

Definition at line 15 of file class.ilUserClipboard.php.

◆ $user_id

ilUserClipboard::$user_id = 0
private

Definition at line 17 of file class.ilUserClipboard.php.

◆ SESSION_KEYWORD

const ilUserClipboard::SESSION_KEYWORD = 'usr_clipboard'

Definition at line 13 of file class.ilUserClipboard.php.


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