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