ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
Version
$Id$

Definition at line 12 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 34 of file class.ilGlossaryAct.php.

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

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 60 of file class.ilGlossaryAct.php.

61 {
62 if (!$this->access->checkAccessOfUser($this->user->getId(), "write", "", $this->glossary->getRefId()))
63 {
64 return;
65 }
66
67 if (!$this->access->checkAccessOfUser($this->user->getId(), "read", "", $a_source_glossary->getRefId()))
68 {
69 return;
70 }
71
72 include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
73 if (ilGlossaryTerm::_lookGlossaryID($a_term_id) != $a_source_glossary->getId())
74 {
75 return;
76 }
77
78 ilGlossaryTerm::_copyTerm($a_term_id, $this->glossary->getId());
79 }
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 49 of file class.ilGlossaryAct.php.

50 {
51 return new self($a_glossary, $a_user);
52 }

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 88 of file class.ilGlossaryAct.php.

89 {
90 if (!$this->access->checkAccessOfUser($this->user->getId(), "write", "", $this->glossary->getRefId()))
91 {
92 return;
93 }
94
95 if (!$this->access->checkAccessOfUser($this->user->getId(), "read", "", $a_source_glossary->getRefId()))
96 {
97 return;
98 }
99
100 include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
101 include_once("./Modules/Glossary/classes/class.ilGlossaryTermReferences.php");
102 $refs = new ilGlossaryTermReferences($this->glossary->getId());
103 foreach ($a_term_ids as $term_id)
104 {
105 if (ilGlossaryTerm::_lookGlossaryID($term_id) != $a_source_glossary->getId())
106 {
107 continue;
108 }
109
110 if ($this->glossary->getId() == $a_source_glossary->getId())
111 {
112 continue;
113 }
114 $refs->addTerm($term_id);
115 }
116 $refs->update();
117 }

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 27 of file class.ilGlossaryAct.php.

◆ $glossary

ilGlossaryAct::$glossary
protected

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

◆ $user

ilGlossaryAct::$user
protected

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


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