ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilECSUserConsent.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
27 private int $usr_id;
28 private int $server_id;
29 private int $mid;
30
31 protected ilDBInterface $db;
32
33 public function __construct(int $a_usr_id, int $server_id, int $a_mid)
34 {
35 global $DIC;
36
37 $this->db = $DIC->database();
38
39 $this->usr_id = $a_usr_id;
40 $this->server_id = $server_id;
41 $this->mid = $a_mid;
42 }
43
44 public function getUserId(): int
45 {
46 return $this->usr_id;
47 }
48
49 public function getMid(): int
50 {
51 return $this->mid;
52 }
53
54 public function getServerId(): int
55 {
56 return $this->server_id;
57 }
58
59 public function save(): void
60 {
61 $this->db->replace(
62 'ecs_user_consent',
63 [
64 'usr_id' => [ilDBConstants::T_INTEGER, $this->getUserId()],
65 'server_id' => [ilDBConstants::T_INTEGER, $this->getServerId()],
66 'mid' => [ilDBConstants::T_INTEGER, $this->getMid()]
67 ],
68 []
69 );
70 }
71
72 public function delete(): void
73 {
74 $query = 'DELETE FROM ecs_user_consent ' .
75 'WHERE usr_id = ' . $this->db->quote(
76 $this->getUserId(),
78 ) . ' ' .
79 'AND server_id = ' . $this->db->quote(
80 $this->getServerId(),
82 ) . ' ' .
83 'AND mid = ' . $this->db->quote(
84 $this->getMid(),
86 );
87 $this->db->manipulate($query);
88 }
89}
Class ilECSUserConsent.
__construct(int $a_usr_id, int $server_id, int $a_mid)
Interface ilDBInterface.
global $DIC
Definition: shib_login.php:26