38 $this->db = $DIC->database();
53 $this->glo_id = $a_val;
73 $this->terms = $a_val;
93 if (!in_array($a_term_id, $this->terms)) {
94 $this->terms[] = $a_term_id;
105 foreach ($this->terms as $k => $v) {
106 if ($v == $a_term_id) {
107 unset($this->terms[$k]);
118 $set = $this->db->query(
"SELECT term_id FROM glo_term_reference " .
119 " WHERE glo_id = " . $this->db->quote($this->getGlossaryId(),
"integer"));
120 while ($rec = $this->db->fetchAssoc($set)) {
121 $this->
addTerm($rec[
"term_id"]);
133 "glo_term_reference",
136 "term_id" => array(
"integer",
$t),
146 public function delete()
148 $this->db->manipulate(
149 "DELETE FROM glo_term_reference WHERE " .
150 " glo_id = " . $this->db->quote($this->getGlossaryId(),
"integer")
163 $db = $DIC->database();
165 "DELETE FROM glo_term_reference WHERE " .
166 " term_id = " .
$db->quote($a_term_id,
"integer")
181 $db = $DIC->database();
183 "SELECT * FROM glo_term_reference " .
184 " WHERE glo_id = " .
$db->quote($a_glossary_id,
"integer")
186 if ($rec =
$db->fetchAssoc($set)) {
202 $db = $DIC->database();
203 if (!is_array($a_glo_id)) {
204 $a_glo_id = array($a_glo_id);
207 $q =
"SELECT * FROM glo_term_reference " .
208 " WHERE " .
$db->in(
"glo_id", $a_glo_id,
false,
"integer") .
209 " AND term_id = " .
$db->quote($a_term_id,
"integer")
211 if ($rec =
$db->fetchAssoc($set)) {
227 $db = $DIC->database();
229 $q =
"SELECT DISTINCT glo_id FROM glo_term_reference " .
230 " WHERE term_id = " .
$db->quote($a_term_id,
"integer")
233 while ($rec =
$db->fetchAssoc($set)) {
234 $glos[] = $rec[
"glo_id"];
static hasReferences($a_glossary_id)
Check if a glossary uses references.
getGlossaryId()
Get glossary id.
static isReferenced($a_glo_id, $a_term_id)
Is a term referenced by one or multiple glossaries.
deleteTerm($a_term_id)
Delete term.
addTerm($a_term_id)
Add term.
static lookupReferencesOfTerm($a_term_id)
Lookup references of a term.
setTerms($a_val)
Set terms.
static deleteReferencesOfTerm($a_term_id)
Delete all references of a term.
setGlossaryId($a_val)
Set glossary id.
__construct($a_glo_id=0)
__construct