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

Class ilECSUserConsents. More...

+ Collaboration diagram for ilECSUserConsents:

Public Member Functions

 getUserId ()
 
 hasConsented (int $server_id, int $a_mid)
 
 delete ()
 
 add (int $server_id, int $a_mid)
 

Static Public Member Functions

static getInstanceByUserId (int $a_usr_id)
 

Protected Member Functions

 __construct (int $a_usr_id)
 
 read ()
 

Protected Attributes

ilDBInterface $db
 

Private Attributes

int $usr_id
 
array $consents = []
 

Static Private Attributes

static array $instances = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilECSUserConsents::__construct ( int  $a_usr_id)
protected

Definition at line 40 of file class.ilECSUserConsents.php.

References $DIC, and read().

41  {
42  global $DIC;
43 
44  $this->db = $DIC->database();
45  $this->usr_id = $a_usr_id;
46  if ($a_usr_id > 0) {
47  $this->read();
48  }
49  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ add()

ilECSUserConsents::add ( int  $server_id,
int  $a_mid 
)

Definition at line 77 of file class.ilECSUserConsents.php.

References getUserId(), and hasConsented().

77  : void
78  {
79  if (!$this->hasConsented($server_id, $a_mid)) {
80  $consent = new ilECSUserConsent($this->getUserId(), $server_id, $a_mid);
81  $consent->save();
82  $this->consents["{$server_id}:{$a_mid}"] = $consent;
83  }
84  }
hasConsented(int $server_id, int $a_mid)
Class ilECSUserConsent.
+ Here is the call graph for this function:

◆ delete()

ilECSUserConsents::delete ( )

Definition at line 69 of file class.ilECSUserConsents.php.

69  : void
70  {
71  foreach ($this->consents as $mid => $consent) {
72  $consent->delete();
73  }
74  $this->consents = [];
75  }

◆ getInstanceByUserId()

static ilECSUserConsents::getInstanceByUserId ( int  $a_usr_id)
static

Definition at line 51 of file class.ilECSUserConsents.php.

Referenced by ilECSUserConsentModalGUI\__construct().

51  : self
52  {
53  if (!isset(self::$instances[$a_usr_id])) {
54  self::$instances[$a_usr_id] = new self($a_usr_id);
55  }
56  return self::$instances[$a_usr_id];
57  }
+ Here is the caller graph for this function:

◆ getUserId()

ilECSUserConsents::getUserId ( )

Definition at line 59 of file class.ilECSUserConsents.php.

References $usr_id.

Referenced by add(), and read().

59  : int
60  {
61  return $this->usr_id;
62  }
+ Here is the caller graph for this function:

◆ hasConsented()

ilECSUserConsents::hasConsented ( int  $server_id,
int  $a_mid 
)

Definition at line 64 of file class.ilECSUserConsents.php.

Referenced by add().

64  : bool
65  {
66  return array_key_exists("{$server_id}:{$a_mid}", $this->consents);
67  }
+ Here is the caller graph for this function:

◆ read()

ilECSUserConsents::read ( )
protected

Definition at line 86 of file class.ilECSUserConsents.php.

References $res, ilDBConstants\FETCHMODE_OBJECT, getUserId(), and ilDBConstants\T_INTEGER.

Referenced by __construct().

86  : void
87  {
88  $query = 'SELECT * FROM ecs_user_consent ' .
89  'WHERE usr_id = ' . $this->db->quote(
90  $this->getUserId(),
92  );
93  $res = $this->db->query($query);
94  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
95  $this->consents["{$row->server_id}:{$row->mid}"] = new ilECSUserConsent(
96  (int) $row->usr_id,
97  (int) $row->server_id,
98  (int) $row->mid
99  );
100  }
101  }
$res
Definition: ltiservices.php:66
Class ilECSUserConsent.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $consents

array ilECSUserConsents::$consents = []
private

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

◆ $db

ilDBInterface ilECSUserConsents::$db
protected

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

◆ $instances

array ilECSUserConsents::$instances = []
staticprivate

Definition at line 30 of file class.ilECSUserConsents.php.

◆ $usr_id

int ilECSUserConsents::$usr_id
private

Definition at line 32 of file class.ilECSUserConsents.php.

Referenced by getUserId().


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