ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilECSParticipantConsents.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 private int $server_id;
24 private int $mid;
25
26 protected ilDBInterface $db;
27
28 public function __construct(int $server_id, int $mid)
29 {
30 global $DIC;
31
32 $this->db = $DIC->database();
33
34 $this->server_id = $server_id;
35 $this->mid = $mid;
36 }
37
38 public function delete(): void
39 {
40 $query = 'DELETE FROM ecs_user_consent ' .
41 'WHERE mid = ' . $this->db->quote($this->mid, ilDBConstants::T_INTEGER) . ' ' .
42 'AND server_id = ' . $this->db->quote($this->server_id, ilDBConstants::T_INTEGER);
43 $this->db->manipulate($query);
44 }
45
46 public function hasConsents(): bool
47 {
48 $query = 'SELECT count(*) as num FROM ecs_user_consent ' .
49 'WHERE mid = ' . $this->db->quote($this->mid, ilDBConstants::T_INTEGER) . ' ' .
50 'AND server_id = ' . $this->db->quote($this->server_id, ilDBConstants::T_INTEGER);
51 $res = $this->db->query($query);
52 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
53 return (bool) $row->num;
54 }
55 return false;
56 }
57}
__construct(int $server_id, int $mid)
Interface ilDBInterface.
$res
Definition: ltiservices.php:69
global $DIC
Definition: shib_login.php:26