ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 83 of file class.ilUserClipboard.php.

References array.

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

◆ clear()

ilUserClipboard::clear ( )

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

References array.

115  {
116  $this->clipboard = array();
117  }
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 92 of file class.ilUserClipboard.php.

References array, and replace().

93  {
94  $remaining = array();
95  foreach($this->get() as $usr_id)
96  {
97  if(!in_array($usr_id, $a_usr_ids))
98  {
99  $remaining[] = $usr_id;
100  }
101  }
102  $this->replace($remaining);
103  }
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 57 of file class.ilUserClipboard.php.

References $clipboard, and array.

58  {
59  return (array) $this->clipboard;
60  }
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  {
39  self::$instance = new self($a_usr_id);
40  }
41  return self::$instance;
42  }
+ Here is the caller graph for this function:

◆ getValidatedContent()

ilUserClipboard::getValidatedContent ( )

Get validated content of clipboard.

Returns
type

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

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

67  {
68  $valid = array();
69  foreach($this->clipboard as $usr_id)
70  {
71  include_once './Services/User/classes/class.ilObjUser.php';
72  if(strlen(ilObjUser::_lookupLogin($usr_id)))
73  {
74  $valid[] = $usr_id;
75  }
76  }
77  return $valid;
78  }
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 48 of file class.ilUserClipboard.php.

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

◆ read()

ilUserClipboard::read ( )
protected

Read from session.

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

References array, and ilSession\get().

Referenced by __construct().

131  {
132  $this->clipboard = (array) ilSession::get(self::SESSION_KEYWORD);
133  }
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 109 of file class.ilUserClipboard.php.

Referenced by delete().

110  {
111  $this->clipboard = $a_usr_ids;
112  }
+ Here is the caller graph for this function:

◆ save()

ilUserClipboard::save ( )

Save clipboard content in session.

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

References array, and ilSession\set().

123  {
124  ilSession::set(self::SESSION_KEYWORD, (array) $this->clipboard);
125  }
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: