19declare(strict_types=1);
42 public function __construct(
int $a_ref_id,
int $a_ext_consumer_id)
47 $this->db =
$DIC->database();
49 $this->ref_id = $a_ref_id;
50 $this->consumer_id = $a_ext_consumer_id;
54 $this->log->warning(
"no ref_id set");
61 $this->admin = $a_role;
71 $this->tutor = $a_role;
81 $this->member = $a_role;
94 $this->consumer_id = $a_consumer_id;
106 public function delete():
void
108 $query =
'DELETE FROM lti_int_provider_obj ' .
109 'WHERE ref_id = ' . $this->db->quote($this->ref_id,
'integer') .
' ' .
110 'AND ext_consumer_id = ' . $this->db->quote($this->
getConsumerId(),
'integer');
111 $this->db->manipulate($query);
118 $query =
'INSERT INTO lti_int_provider_obj ' .
119 '(ref_id,ext_consumer_id,admin,tutor,member) VALUES( ' .
120 $this->db->quote($this->ref_id,
'integer') .
', ' .
122 $this->db->quote($this->getAdminRole(),
'integer') .
', ' .
123 $this->db->quote($this->getTutorRole(),
'integer') .
', ' .
124 $this->db->quote($this->getMemberRole(),
'integer') .
126 $this->db->manipulate($query);
132 protected function read(): bool
134 if (!$this->ref_id) {
138 $query =
'SELECT * FROM lti_int_provider_obj ' .
139 'WHERE ref_id = ' . $this->db->quote($this->ref_id,
'integer') .
' ' .
140 'AND ext_consumer_id = ' . $this->db->quote($this->
getConsumerId(),
'integer');
142 $res = $this->db->query($query);
143 while ($row =
$res->fetchObject()) {
144 $this->ref_id = (
int) $row->ref_id;
145 $this->consumer_id = (
int) $row->ext_consumer_id;
setAdminRole(int $a_role)
setConsumerId(int $a_consumer_id)
Set consumer id.
read()
Read object settings.
__construct(int $a_ref_id, int $a_ext_consumer_id)
Constructor.
setTutorRole(int $a_role)
setMemberRole(int $a_role)
static getLogger(string $a_component_id)
Get component logger.
Component logger with individual log levels by component id.