34 $this->db = $DIC->database();
44 $this->glo_id = $a_val;
57 $this->terms = $a_val;
68 public function addTerm(
int $a_term_id): void
70 if (!in_array($a_term_id, $this->terms)) {
71 $this->terms[] = $a_term_id;
77 foreach ($this->terms as $k => $v) {
78 if ($v == $a_term_id) {
79 unset($this->terms[$k]);
84 public function read(): void
86 $set = $this->db->query(
"SELECT term_id FROM glo_term_reference " .
87 " WHERE glo_id = " . $this->db->quote($this->getGlossaryId(),
"integer"));
88 while ($rec = $this->db->fetchAssoc($set)) {
89 $this->
addTerm($rec[
"term_id"]);
101 "term_id" => array(
"integer", $t),
111 public function delete():
void 113 $this->db->manipulate(
114 "DELETE FROM glo_term_reference WHERE " .
115 " glo_id = " . $this->db->quote($this->getGlossaryId(),
"integer")
126 $db = $DIC->database();
128 "DELETE FROM glo_term_reference WHERE " .
129 " term_id = " . $db->
quote($a_term_id,
"integer")
141 $db = $DIC->database();
143 "SELECT * FROM glo_term_reference " .
144 " WHERE glo_id = " . $db->
quote($a_glossary_id,
"integer")
164 $db = $DIC->database();
166 "SELECT * FROM glo_term_reference " .
167 " WHERE " . $db->
in(
"glo_id", $a_glo_id,
false,
"integer") .
168 " AND term_id = " . $db->
quote($a_term_id,
"integer")
185 $db = $DIC->database();
187 $q =
"SELECT DISTINCT glo_id FROM glo_term_reference " .
188 " WHERE term_id = " . $db->
quote($a_term_id,
"integer")
192 $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...
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.