ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilUserClipboard Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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 (array $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 (int $a_usr_id)
 

Data Fields

const SESSION_KEYWORD = 'usr_clipboard'
 

Protected Member Functions

 __construct (int $a_user_id)
 
 read ()
 Read from session. More...
 

Private Attributes

array $clipboard = []
 

Static Private Attributes

static ilUserClipboard $instance = null
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning User clipboard

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

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

Constructor & Destructor Documentation

◆ __construct()

ilUserClipboard::__construct ( int  $a_user_id)
protected

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

References read().

30  {
31  $this->read();
32  }
read()
Read from session.
+ Here is the call graph for this function:

Member Function Documentation

◆ add()

ilUserClipboard::add ( array  $a_usr_ids)

Add entries to clipboard.

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

75  : void // Missing array type.
76  {
77  $this->clipboard = array_unique(array_merge($this->clipboard, $a_usr_ids));
78  }

◆ clear()

ilUserClipboard::clear ( )

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

102  : void
103  {
104  $this->clipboard = [];
105  }

◆ delete()

ilUserClipboard::delete ( array  $a_usr_ids)

User ids to delete.

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

References replace().

83  : void // Missing array type.
84  {
85  $remaining = [];
86  foreach ($this->get() as $usr_id) {
87  if (!in_array($usr_id, $a_usr_ids)) {
88  $remaining[] = $usr_id;
89  }
90  }
91  $this->replace($remaining);
92  }
replace(array $a_usr_ids)
Replace clipboard content.
+ Here is the call graph for this function:

◆ get()

ilUserClipboard::get ( )

Get clipboard content.

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

References $clipboard.

53  : array // Missing array type.
54  {
55  return $this->clipboard;
56  }

◆ getInstance()

static ilUserClipboard::getInstance ( int  $a_usr_id)
static

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

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

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

◆ getValidatedContent()

ilUserClipboard::getValidatedContent ( )

Get validated content of clipboard.

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

References $valid, and ilObjUser\_lookupLogin().

61  : array // Missing array type.
62  {
63  $valid = [];
64  foreach ($this->clipboard as $usr_id) {
65  if (strlen(ilObjUser::_lookupLogin($usr_id))) {
66  $valid[] = $usr_id;
67  }
68  }
69  return $valid;
70  }
$valid
static _lookupLogin(int $a_user_id)
+ Here is the call graph for this function:

◆ hasContent()

ilUserClipboard::hasContent ( )

Check if clipboard has content.

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

45  : bool
46  {
47  return (bool) count($this->clipboard);
48  }

◆ read()

ilUserClipboard::read ( )
protected

Read from session.

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

References ilSession\get().

Referenced by __construct().

118  : void
119  {
120  $this->clipboard = (array) ilSession::get(self::SESSION_KEYWORD);
121  }
static get(string $a_var)
+ 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.

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

Referenced by delete().

97  : void // Missing array type.
98  {
99  $this->clipboard = $a_usr_ids;
100  }
+ Here is the caller graph for this function:

◆ save()

ilUserClipboard::save ( )

Save clipboard content in session.

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

References ilSession\set().

110  : void
111  {
112  ilSession::set(self::SESSION_KEYWORD, $this->clipboard);
113  }
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:

Field Documentation

◆ $clipboard

array ilUserClipboard::$clipboard = []
private

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

Referenced by get().

◆ $instance

ilUserClipboard ilUserClipboard::$instance = null
staticprivate

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

◆ SESSION_KEYWORD

const ilUserClipboard::SESSION_KEYWORD = 'usr_clipboard'

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


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