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