ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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.

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:26

References $DIC, and read().

+ 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.

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 }
Class ilECSUserConsent.
hasConsented(int $server_id, int $a_mid)

References getUserId(), and hasConsented().

+ 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.

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 }

Referenced by ilECSUserConsentModalGUI\__construct().

+ Here is the caller graph for this function:

◆ getUserId()

ilECSUserConsents::getUserId ( )

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

59 : int
60 {
61 return $this->usr_id;
62 }

References $usr_id.

Referenced by add(), and read().

+ 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.

64 : bool
65 {
66 return array_key_exists("{$server_id}:{$a_mid}", $this->consents);
67 }

Referenced by add().

+ Here is the caller graph for this function:

◆ read()

ilECSUserConsents::read ( )
protected

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

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:69

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

Referenced by __construct().

+ 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: