ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilMDKeywordExposer Class Reference

Class ilMDKeywordExposer. More...

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

Public Member Functions

 __construct (\ILIAS\DI\Container $dic)
 
 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 (protected Container $dic)
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 

Protected Member Functions

 generalReader (int $object_id)
 
 copyrightReader (int $object_id)
 
- Protected Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 globalScreen ()
 

Protected Attributes

Metadata $md
 
- Protected Attributes inherited from ILIAS\GlobalScreen\Scope\Layout\Provider\AbstractModificationProvider
ContextCollection $context_collection
 
DataFactory $data
 
ModificationFactory $factory
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMDKeywordExposer::__construct ( \ILIAS\DI\Container  $dic)

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

References ILIAS\GlobalScreen\Provider\__construct().

38  {
39  $this->md = $dic->learningObjectMetadata();
41  }
__construct(Container $dic, ilPlugin $plugin)
$dic
Definition: result.php:31
+ Here is the call graph for this function:

Member Function Documentation

◆ copyrightReader()

ilMDKeywordExposer::copyrightReader ( int  $object_id)
protected

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

References $path, and ilObject\_lookupType().

Referenced by getContentModification().

105  : Reader
106  {
107  $path = $this->md->paths()->custom()
108  ->withNextStep('rights')
109  ->withNextStep('description')
110  ->withNextStep('string')
111  ->get();
112  return $this->md->read(
113  $object_id,
114  $object_id,
115  ilObject::_lookupType($object_id),
116  $path
117  );
118  }
$path
Definition: ltiservices.php:29
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generalReader()

ilMDKeywordExposer::generalReader ( int  $object_id)
protected

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

References $path, and ilObject\_lookupType().

Referenced by getContentModification().

94  : Reader
95  {
96  $path = $this->md->paths()->custom()->withNextStep('general')->get();
97  return $this->md->read(
98  $object_id,
99  $object_id,
100  ilObject::_lookupType($object_id),
101  $path
102  );
103  }
$path
Definition: ltiservices.php:29
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContentModification()

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

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

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

References copyrightReader(), ILIAS\GlobalScreen\ScreenContext\Stack\CalledContexts\current(), generalReader(), ILIAS\GlobalScreen\Provider\AbstractProvider\globalScreen(), and null.

49  {
50  if ($screen_context_stack->current()->hasReferenceId()) {
51  $object_id = $screen_context_stack->current()->getReferenceId()->toObjectId()->toInt();
52  $paths = $this->md->paths();
53  $reader = $this->generalReader($object_id);
54 
55  // Keywords
56  $keywords = [];
57  foreach ($reader->allData($paths->keywords()) as $keyword) {
58  $keywords[] = $keyword->value();
59  }
60  if (count($keywords) > 0) {
61  $this->globalScreen()->layout()->meta()->addMetaDatum(
62  $this->data->htmlMetadata()->userDefined('keywords', implode(',', $keywords))
63  );
64  }
65 
66  // Languages
67  $languages = [];
68  foreach ($reader->allData($paths->languages()) as $language) {
69  $languages[] = $language->value();
70  }
71  if (count($languages) > 0) {
72  $this->globalScreen()->layout()->meta()->addMetaDatum(
73  $this->data->htmlMetadata()->userDefined('languages', implode(',', $languages))
74  );
75  }
76 
77  // Copyright
78  if ($this->md->copyrightHelper()->isCopyrightSelectionActive()) {
79  $reader = $this->copyrightReader($object_id);
80  if ($this->md->copyrightHelper()->hasPresetCopyright($reader)) {
81  $copyright = $this->md->copyrightHelper()->readPresetCopyright($reader)->presentAsString();
82  } else {
83  $copyright = $this->md->copyrightHelper()->readCustomCopyright($reader);
84  }
85  $this->globalScreen()->layout()->meta()->addMetaDatum(
86  $this->data->htmlMetadata()->userDefined('copyright', $copyright)
87  );
88  }
89  }
90 
91  return null;
92  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ isInterestedInContexts()

ilMDKeywordExposer::isInterestedInContexts ( )

Field Documentation

◆ $md

Metadata ilMDKeywordExposer::$md
protected

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


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