ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMDKeywordExposer Class Reference

Class ilMDKeywordExposer. More...

+ Inheritance diagram for ilMDKeywordExposer:
+ Collaboration diagram for ilMDKeywordExposer:

Public Member Functions

 isInterestedInContexts ()
 
 getContentModification (CalledContexts $screen_context_stack)
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\Layout\Provider\AbstractModificationProvider
 __construct (Container $dic)
 
 getContentModification (CalledContexts $screen_context_stack)
 
 getLogoModification (CalledContexts $screen_context_stack)
 
 getResponsiveLogoModification (CalledContexts $screen_context_stack)
 
 getMainBarModification (CalledContexts $screen_context_stack)
 
 getMetaBarModification (CalledContexts $screen_context_stack)
 
 getBreadCrumbsModification (CalledContexts $screen_context_stack)
 
 getFooterModification (CalledContexts $screen_context_stack)
 
 getPageBuilderDecorator (CalledContexts $screen_context_stack)
 
 getTitleModification (CalledContexts $screen_context_stack)
 
 getShortTitleModification (CalledContexts $screen_context_stack)
 
 getViewTitleModification (CalledContexts $screen_context_stack)
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 __construct (Container $dic)
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 

Private Member Functions

 getGeneral (int $object_id)
 
 getRights (int $object_id)
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 globalScreen ()
 
- Protected Attributes inherited from ILIAS\GlobalScreen\Scope\Layout\Provider\AbstractModificationProvider
 $context_collection
 
 $factory
 
- Protected Attributes inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 $dic
 

Detailed Description

Member Function Documentation

◆ getContentModification()

ilMDKeywordExposer::getContentModification ( CalledContexts  $screen_context_stack)
Parameters
CalledContexts$screen_context_stack
Returns
ContentModification

Implements ILIAS\GlobalScreen\Scope\Layout\Provider\ModificationProvider.

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

References ilMDCopyrightSelectionEntry\_extractEntryId(), ilMDSettings\_getInstance(), ILIAS\GlobalScreen\ScreenContext\Stack\CalledContexts\current(), getGeneral(), getRights(), and ILIAS\GlobalScreen\Provider\AbstractProvider\globalScreen().

21  {
22  if ($screen_context_stack->current()->hasReferenceId()) {
23  $object_id = $screen_context_stack->current()->getReferenceId()->toObjectId()->toInt();
24 
25  if ($general = $this->getGeneral($object_id)) {
26  // Keywords
27  $keywords = [];
28  foreach ($general->getKeywordIds() as $keyword_id) {
29  $keyword = $general->getKeyword($keyword_id);
30  $keywords[] = $keyword->getKeyword();
31  }
32 
33  $delimiter = ilMDSettings::_getInstance()->getDelimiter() ?? ",";
34 
35  if (count($keywords) > 0) {
36  $this->globalScreen()->layout()->meta()->addMetaDatum('keywords', implode($delimiter, $keywords));
37  }
38  // Languages
39  $languages = [];
40  foreach ($general->getLanguageIds() as $language_id) {
41  $language = $general->getLanguage($language_id);
42  $languages[] = $language->getLanguageCode();
43  }
44  if (count($languages) > 0) {
45  $this->globalScreen()->layout()->meta()->addMetaDatum('languages', implode($delimiter, $languages));
46  }
47  }
48 
49  if ($rights = $this->getRights($object_id)) {
50  // Copyright
51  $copy_right_id = ilMDCopyrightSelectionEntry::_extractEntryId($rights->getDescription());
52  if ($copy_right_id > 0) {
53  $entry = new ilMDCopyrightSelectionEntry($copy_right_id);
54  $this->globalScreen()->layout()->meta()->addMetaDatum('copyright', $entry->getTitle());
55  }
56  }
57  }
58 
59  return null;
60  }
static _getInstance()
get instance
static _extractEntryId($a_cp_string)
extract entry id
+ Here is the call graph for this function:

◆ getGeneral()

ilMDKeywordExposer::getGeneral ( int  $object_id)
private

Definition at line 62 of file class.ilMDKeywordExposer.php.

References ilMDGeneral\_getId().

Referenced by getContentModification().

62  : ?ilMDGeneral
63  {
64  if ($id = ilMDGeneral::_getId($object_id, $object_id)) {
65  $gen = new ilMDGeneral();
66  $gen->setMetaId($id);
67 
68  return $gen;
69  }
70  return null;
71  }
static _getId($a_rbac_id, $a_obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRights()

ilMDKeywordExposer::getRights ( int  $object_id)
private

Definition at line 73 of file class.ilMDKeywordExposer.php.

References ilMDRights\_getId().

Referenced by getContentModification().

73  : ?ilMDRights
74  {
75  if ($id = ilMDRights::_getId($object_id, $object_id)) {
76  $rig = new ilMDRights();
77  $rig->setMetaId($id);
78 
79  return $rig;
80  }
81  return null;
82  }
static _getId($a_rbac_id, $a_obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isInterestedInContexts()

ilMDKeywordExposer::isInterestedInContexts ( )

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