19 declare(strict_types=1);
48 $this->domain = $domain_service;
49 $this->event_handler = $DIC->event();
54 $this->session_repo->setLang($this->glossary->getRefId(),
$lang);
59 return $this->session_repo->getLang($this->glossary->getRefId());
63 int $other_glossary_ref_id,
66 $access = $this->domain->access();
68 if (!$access->checkAccessOfUser(
72 $this->glossary->getRefId()
78 if (!$access->checkAccessOfUser(
82 $other_glossary_ref_id
99 int $other_glossary_ref_id,
102 $access = $this->domain->access();
104 if (!$access->checkAccessOfUser(
108 $this->glossary->getRefId()
113 if (!$access->checkAccessOfUser(
117 $other_glossary_ref_id
123 $refs = new \ilGlossaryTermReferences($this->glossary->getId());
124 foreach ($term_ids as $term_id) {
129 if ($this->glossary->getId() == $other_glossary_obj_id) {
132 $refs->addTerm($term_id);
139 $rows = explode(
"\n", $input);
141 foreach ($rows as $row) {
142 $cells = explode(
";", $row);
143 if (count($cells) === 1) {
144 $cells = explode(
"\t", $row);
147 "term" => trim($cells[0] ??
""),
148 "definition" => trim($cells[1] ??
"")
157 $term = new \ilGlossaryTerm();
158 $term->setGlossaryId($this->glossary->getId());
159 $term->setTerm($data[
"term"]);
160 $term->setLanguage($language);
161 $term->setShortText($data[
"definition"]);
164 $page_object = new \ilGlossaryDefPage();
165 $page_object->setId($term->getId());
166 $page_object->setParentId($this->glossary->getId());
167 $page_object->create(
false);
168 $paragraph = new \ilPCParagraph($page_object);
169 $paragraph->create($page_object,
"pg");
170 $paragraph->setLanguage($language);
171 $paragraph->setText($data[
"definition"]);
172 $page_object->update();
181 $db = $DIC->database();
187 $db->manipulate(
"DELETE FROM glossary_term " .
188 " WHERE id = " .
$db->quote($term_id,
"integer"));
191 $page_object = new \ilGlossaryDefPage($term_id);
192 $page_object->delete();
197 $this->event_handler->raise(
"Modules/Glossary",
"deleteTerm", [
"term_id" => $term_id]);
static deleteReferencesOfTerm(int $a_term_id)
Delete all references of a term.
getDataArrayFromInputString(string $input)
setSessionLang(string $lang)
Stores repository clipboard data.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
TermSessionRepository $session_repo
static _copyTerm(int $a_term_id, int $a_glossary_id)
Copy a term to a glossary.
createTermDefinitionPairsFromBulkInputString(string $input, string $language)
__construct(InternalDomainService $domain_service, TermSessionRepository $session_repo, \ilObjGlossary $glossary, int $user_id)
static _lookupObjectId(int $ref_id)
referenceTermsFromOtherGlossary(int $other_glossary_ref_id, array $term_ids)
Reference terms of another glossary in current glossary.
copyTermFromOtherGlossary(int $other_glossary_ref_id, int $term_id)
ilAppEventHandler $event_handler
InternalDomainService $domain
static _lookGlossaryID(int $term_id)
get glossary id form term id