ILIAS  release_8 Revision v8.24
ILIAS\Glossary\Term\TermManager Class Reference

Manages terms. More...

+ Collaboration diagram for ILIAS\Glossary\Term\TermManager:

Public Member Functions

 __construct (InternalDomainService $domain_service, TermSessionRepository $session_repo, \ilObjGlossary $glossary, int $user_id)
 
 setSessionLang (string $lang)
 
 getSessionLang ()
 
 copyTermFromOtherGlossary (int $other_glossary_ref_id, int $term_id)
 
 referenceTermsFromOtherGlossary (int $other_glossary_ref_id, array $term_ids)
 Reference terms of another glossary in current glossary. More...
 

Protected Attributes

InternalDomainService $domain
 
TermSessionRepository $session_repo
 
ilObjGlossary $glossary
 
int $user_id
 

Detailed Description

Manages terms.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 29 of file class.TermManager.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Glossary\Term\TermManager::__construct ( InternalDomainService  $domain_service,
TermSessionRepository  $session_repo,
\ilObjGlossary  $glossary,
int  $user_id 
)

Definition at line 36 of file class.TermManager.php.

41 {
42 $this->session_repo = $session_repo;
43 $this->glossary = $glossary;
44 $this->user_id = $user_id;
45 $this->domain = $domain_service;
46 }
TermSessionRepository $session_repo

References ILIAS\Glossary\Term\TermManager\$glossary, ILIAS\Glossary\Term\TermManager\$session_repo, and ILIAS\Glossary\Term\TermManager\$user_id.

Member Function Documentation

◆ copyTermFromOtherGlossary()

ILIAS\Glossary\Term\TermManager::copyTermFromOtherGlossary ( int  $other_glossary_ref_id,
int  $term_id 
)

Definition at line 58 of file class.TermManager.php.

61 : void {
62 $access = $this->domain->access();
63
64 if (!$access->checkAccessOfUser(
65 $this->user_id,
66 "write",
67 "",
68 $this->glossary->getRefId()
69 )
70 ) {
71 return;
72 }
73
74 if (!$access->checkAccessOfUser(
75 $this->user_id,
76 "read",
77 "",
78 $other_glossary_ref_id
79 )) {
80 return;
81 }
82
83 if (\ilGlossaryTerm::_lookGlossaryID($term_id) !=
84 \ilObject::_lookupObjectId($other_glossary_ref_id)) {
85 return;
86 }
87
88 \ilGlossaryTerm::_copyTerm($term_id, $this->glossary->getId());
89 }
static _lookGlossaryID(int $term_id)
get glossary id form term id
static _copyTerm(int $a_term_id, int $a_glossary_id)
Copy a term to a glossary.
static _lookupObjectId(int $ref_id)

◆ getSessionLang()

ILIAS\Glossary\Term\TermManager::getSessionLang ( )

Definition at line 53 of file class.TermManager.php.

53 : string
54 {
55 return $this->session_repo->getLang($this->glossary->getRefId());
56 }

◆ referenceTermsFromOtherGlossary()

ILIAS\Glossary\Term\TermManager::referenceTermsFromOtherGlossary ( int  $other_glossary_ref_id,
array  $term_ids 
)

Reference terms of another glossary in current glossary.

Definition at line 94 of file class.TermManager.php.

97 : void {
98 $access = $this->domain->access();
99
100 if (!$access->checkAccessOfUser(
101 $this->user_id,
102 "write",
103 "",
104 $this->glossary->getRefId()
105 )) {
106 return;
107 }
108
109 if (!$access->checkAccessOfUser(
110 $this->user_id,
111 "read",
112 "",
113 $other_glossary_ref_id
114 )) {
115 return;
116 }
117
118 $other_glossary_obj_id = \ilObject::_lookupObjectId($other_glossary_ref_id);
119 $refs = new \ilGlossaryTermReferences($this->glossary->getId());
120 foreach ($term_ids as $term_id) {
121 if (\ilGlossaryTerm::_lookGlossaryID($term_id) != $other_glossary_obj_id) {
122 continue;
123 }
124
125 if ($this->glossary->getId() == $other_glossary_obj_id) {
126 continue;
127 }
128 $refs->addTerm($term_id);
129 }
130 $refs->update();
131 }

◆ setSessionLang()

ILIAS\Glossary\Term\TermManager::setSessionLang ( string  $lang)

Definition at line 48 of file class.TermManager.php.

48 : void
49 {
50 $this->session_repo->setLang($this->glossary->getRefId(), $lang);
51 }
$lang
Definition: xapiexit.php:26

References $lang.

Field Documentation

◆ $domain

InternalDomainService ILIAS\Glossary\Term\TermManager::$domain
protected

Definition at line 31 of file class.TermManager.php.

◆ $glossary

ilObjGlossary ILIAS\Glossary\Term\TermManager::$glossary
protected

Definition at line 33 of file class.TermManager.php.

Referenced by ILIAS\Glossary\Term\TermManager\__construct().

◆ $session_repo

TermSessionRepository ILIAS\Glossary\Term\TermManager::$session_repo
protected

Definition at line 32 of file class.TermManager.php.

Referenced by ILIAS\Glossary\Term\TermManager\__construct().

◆ $user_id

int ILIAS\Glossary\Term\TermManager::$user_id
protected

Definition at line 34 of file class.TermManager.php.

Referenced by ILIAS\Glossary\Term\TermManager\__construct().


The documentation for this class was generated from the following file: