35 $this->db = $DIC->database();
36 $this->event_handler = $DIC->event();
46 $this->glo_id = $a_val;
59 $this->terms = $a_val;
70 public function addTerm(
int $a_term_id): void
72 if (!in_array($a_term_id, $this->terms)) {
73 $this->terms[] = $a_term_id;
79 foreach ($this->terms as $k => $v) {
80 if ($v == $a_term_id) {
81 unset($this->terms[$k]);
86 $this->event_handler->raise(
"components/ILIAS/Glossary",
"deleteTerm", [
"term_id" => $a_term_id]);
89 public function read(): void
91 $set = $this->db->query(
"SELECT term_id FROM glo_term_reference " .
92 " WHERE glo_id = " . $this->db->quote($this->getGlossaryId(),
"integer"));
93 while ($rec = $this->db->fetchAssoc($set)) {
94 $this->
addTerm($rec[
"term_id"]);
103 "glo_term_reference",
106 "term_id" => array(
"integer", $t),
116 public function delete():
void 118 $this->db->manipulate(
119 "DELETE FROM glo_term_reference WHERE " .
120 " glo_id = " . $this->db->quote($this->getGlossaryId(),
"integer")
131 $db = $DIC->database();
133 "DELETE FROM glo_term_reference WHERE " .
134 " term_id = " . $db->
quote($a_term_id,
"integer")
146 $db = $DIC->database();
148 "SELECT * FROM glo_term_reference " .
149 " WHERE glo_id = " . $db->
quote($a_glossary_id,
"integer")
169 $db = $DIC->database();
171 "SELECT * FROM glo_term_reference " .
172 " WHERE " . $db->
in(
"glo_id", $a_glo_id,
false,
"integer") .
173 " AND term_id = " . $db->
quote($a_term_id,
"integer")
190 $db = $DIC->database();
192 $q =
"SELECT DISTINCT glo_id FROM glo_term_reference " .
193 " WHERE term_id = " . $db->
quote($a_term_id,
"integer")
197 $glos[] = $rec[
"glo_id"];
static deleteReferencesOfTerm(int $a_term_id)
Delete all references of a term.
deleteTerm(int $a_term_id)
fetchAssoc(ilDBStatement $statement)
quote($value, string $type)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilAppEventHandler $event_handler
static hasReferences(int $a_glossary_id)
Check if a glossary uses references.
static isReferenced(array $a_glo_id, int $a_term_id)
Is a term referenced by a set of glossaries.
setGlossaryId(int $a_val)
static lookupReferencesOfTerm(int $a_term_id)
query(string $query)
Run a (read-only) Query on the database.
in(string $field, array $values, bool $negate=false, string $type="")
__construct(int $a_glo_id=0)
manipulate(string $query)
Run a (write) Query on the database.