ILIAS  release_7 Revision v7.30-3-g800a261c036
ilGlossaryAct Class Reference

Glossary actor class. More...

+ Collaboration diagram for ilGlossaryAct:

Public Member Functions

 copyTerm (ilObjGlossary $a_source_glossary, $a_term_id)
 Copy term. More...
 
 referenceTerms (ilObjGlossary $a_source_glossary, $a_term_ids)
 Reference a term of another glossary in current glossary. More...
 

Static Public Member Functions

static getInstance (ilObjGlossary $a_glossary, ilObjUser $a_user)
 Get instance. More...
 

Protected Member Functions

 __construct (ilObjGlossary $a_glossary, ilObjUser $a_user)
 ilGlossaryAct constructor. More...
 

Protected Attributes

 $glossary
 
 $user
 
 $access
 

Detailed Description

Glossary actor class.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e

Definition at line 10 of file class.ilGlossaryAct.php.

Constructor & Destructor Documentation

◆ __construct()

ilGlossaryAct::__construct ( ilObjGlossary  $a_glossary,
ilObjUser  $a_user 
)
protected

ilGlossaryAct constructor.

Parameters
ilObjGlossary$a_glossary
ilObjUser$a_user

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

33 {
34 global $DIC;
35
36 $this->access = $DIC->access();
37 $this->glossary = $a_glossary;
38 $this->user = $a_user;
39 }
user()
Definition: user.php:4
global $DIC
Definition: goto.php:24

References $DIC, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ copyTerm()

ilGlossaryAct::copyTerm ( ilObjGlossary  $a_source_glossary,
  $a_term_id 
)

Copy term.

Parameters
ilObjGlossary$a_source_glossary
int$a_term_idterm id

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

59 {
60 if (!$this->access->checkAccessOfUser($this->user->getId(), "write", "", $this->glossary->getRefId())) {
61 return;
62 }
63
64 if (!$this->access->checkAccessOfUser($this->user->getId(), "read", "", $a_source_glossary->getRefId())) {
65 return;
66 }
67
68 if (ilGlossaryTerm::_lookGlossaryID($a_term_id) != $a_source_glossary->getId()) {
69 return;
70 }
71
72 ilGlossaryTerm::_copyTerm($a_term_id, $this->glossary->getId());
73 }
static _lookGlossaryID($term_id)
get glossary id form term id
static _copyTerm($a_term_id, $a_glossary_id)
Copy a term to a glossary.
getRefId()
get reference id @access public
getId()
get object id @access public

References ilGlossaryTerm\_copyTerm(), ilGlossaryTerm\_lookGlossaryID(), ilObject\getId(), and ilObject\getRefId().

+ Here is the call graph for this function:

◆ getInstance()

static ilGlossaryAct::getInstance ( ilObjGlossary  $a_glossary,
ilObjUser  $a_user 
)
static

Get instance.

Parameters
ilObjGlossary$a_glossary
ilObjUser$a_user
Returns
ilGlossaryAct

Definition at line 47 of file class.ilGlossaryAct.php.

48 {
49 return new self($a_glossary, $a_user);
50 }

Referenced by ilGlossaryForeignTermCollectorGUI\copyTerms(), and ilGlossaryForeignTermCollectorGUI\referenceTerms().

+ Here is the caller graph for this function:

◆ referenceTerms()

ilGlossaryAct::referenceTerms ( ilObjGlossary  $a_source_glossary,
  $a_term_ids 
)

Reference a term of another glossary in current glossary.

Parameters
ilObjGlossary$a_source_glossary
int[]$a_term_ids

Definition at line 82 of file class.ilGlossaryAct.php.

83 {
84 if (!$this->access->checkAccessOfUser($this->user->getId(), "write", "", $this->glossary->getRefId())) {
85 return;
86 }
87
88 if (!$this->access->checkAccessOfUser($this->user->getId(), "read", "", $a_source_glossary->getRefId())) {
89 return;
90 }
91
92 $refs = new ilGlossaryTermReferences($this->glossary->getId());
93 foreach ($a_term_ids as $term_id) {
94 if (ilGlossaryTerm::_lookGlossaryID($term_id) != $a_source_glossary->getId()) {
95 continue;
96 }
97
98 if ($this->glossary->getId() == $a_source_glossary->getId()) {
99 continue;
100 }
101 $refs->addTerm($term_id);
102 }
103 $refs->update();
104 }

References ilGlossaryTerm\_lookGlossaryID(), ilObject\getId(), and ilObject\getRefId().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilGlossaryAct::$access
protected

Definition at line 25 of file class.ilGlossaryAct.php.

◆ $glossary

ilGlossaryAct::$glossary
protected

Definition at line 15 of file class.ilGlossaryAct.php.

◆ $user

ilGlossaryAct::$user
protected

Definition at line 20 of file class.ilGlossaryAct.php.


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