ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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.

References $DIC, and user().

35  {
36  global $DIC;
37 
38  $this->access = $DIC->access();
39  $this->glossary = $a_glossary;
40  $this->user = $a_user;
41  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
+ 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.

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

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

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

50  {
51  return new self($a_glossary, $a_user);
52  }
+ 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 85 of file class.ilGlossaryAct.php.

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

86  {
87  if (!$this->access->checkAccessOfUser($this->user->getId(), "write", "", $this->glossary->getRefId())) {
88  return;
89  }
90 
91  if (!$this->access->checkAccessOfUser($this->user->getId(), "read", "", $a_source_glossary->getRefId())) {
92  return;
93  }
94 
95  include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
96  include_once("./Modules/Glossary/classes/class.ilGlossaryTermReferences.php");
97  $refs = new ilGlossaryTermReferences($this->glossary->getId());
98  foreach ($a_term_ids as $term_id) {
99  if (ilGlossaryTerm::_lookGlossaryID($term_id) != $a_source_glossary->getId()) {
100  continue;
101  }
102 
103  if ($this->glossary->getId() == $a_source_glossary->getId()) {
104  continue;
105  }
106  $refs->addTerm($term_id);
107  }
108  $refs->update();
109  }
getId()
get object id public
static _lookGlossaryID($term_id)
get glossary id form term id
getRefId()
get reference id public
+ 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: