ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ILIAS\GlobalScreen\Identification\IdentificationFactory Class Reference

Class IdentificationFactory All elements in the GlobalScreen service must be identifiable for the supplying components mentioned in the readme. More...

+ Collaboration diagram for ILIAS\GlobalScreen\Identification\IdentificationFactory:

Public Member Functions

 __construct (protected ProviderFactory $provider_factory)
 IdentificationFactory constructor. More...
 
 core (Provider $provider)
 Returns a IdentificationProvider for core components, only a Provider is needed. More...
 
 tool (Provider $provider)
 Returns a IdentificationProvider for core tools, only a Provider is needed. More...
 
 plugin (string $plugin_id, Provider $provider)
 Returns a IdentificationProvider for ILIAS-Plugins which takes care of the plugin_id for further identification where a provided GlobalScreen-element comes from (e.g. More...
 
 fromSerializedIdentification ($serialized_string)
 

Protected Attributes

SerializerFactory $serializer_factory
 
IdentificationMap $map
 

Detailed Description

Class IdentificationFactory All elements in the GlobalScreen service must be identifiable for the supplying components mentioned in the readme.

The GlobalScreen service uses this identification, for example, for parent/child relationships. The identification is also forwarded to the UI service or to the instance that then renders the GlobalScreen elements. This means that the identification can be used there again, for example, to generate unique IDs for the online help. There will be at least two IdentificationProvider, one for core components and one for plugins. This factory allows to acces both. The identification you get can be serialized and is used e.g. to store in database and cache. you don't need to take care of storing this. Since you are passing some identifiers as a string such as 'personal_desktop' the GlobalScreen-Services must take care after naming collisions. Therefore you always pass your Provider (or even the Plugin-Class in case of Plugins) and the GlobalScreen- Services will use this information to generate unique identifications. Currently Identifications are only used for the GlobalScreen-MainMenu-Elements. Other like Footer may follow.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 48 of file IdentificationFactory.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\GlobalScreen\Identification\IdentificationFactory::__construct ( protected ProviderFactory  $provider_factory)
final

IdentificationFactory constructor.

Parameters
ProviderFactory$provider_factory

Definition at line 57 of file IdentificationFactory.php.

58  {
59  $this->serializer_factory = new SerializerFactory();
60  $this->map = new IdentificationMap();
61  }

Member Function Documentation

◆ core()

ILIAS\GlobalScreen\Identification\IdentificationFactory::core ( Provider  $provider)
final

Returns a IdentificationProvider for core components, only a Provider is needed.

Definition at line 67 of file IdentificationFactory.php.

References ILIAS\GlobalScreen\Identification\IdentificationFactory\$map.

Referenced by ILIAS\GlobalScreen\MainMenu\IdentificationFactoryTest\testSerializingCore(), and ILIAS\GlobalScreen\MainMenu\IdentificationFactoryTest\testUnserializingCore().

67  : CoreIdentificationProvider
68  {
69  return new CoreIdentificationProvider($provider, $this->serializer_factory->core(), $this->map);
70  }
$provider
Definition: ltitoken.php:80
+ Here is the caller graph for this function:

◆ fromSerializedIdentification()

ILIAS\GlobalScreen\Identification\IdentificationFactory::fromSerializedIdentification (   $serialized_string)
final
Parameters
$serialized_string
Returns
IdentificationInterface

Definition at line 96 of file IdentificationFactory.php.

References null.

Referenced by ILIAS\GlobalScreen\MainMenu\IdentificationFactoryTest\testFactoryMustReturnCorrectTypeCore(), ILIAS\GlobalScreen\MainMenu\IdentificationFactoryTest\testFactoryMustReturnCorrectTypePlugin(), ILIAS\GlobalScreen\MainMenu\IdentificationFactoryTest\testUnserializingCore(), and ILIAS\GlobalScreen\MainMenu\IdentificationFactoryTest\testUnserializingPlugin().

96  : IdentificationInterface
97  {
98  if ($serialized_string === null || $serialized_string === "") {
99  return new NullIdentification();
100  }
101  if ($this->map->isInMap($serialized_string)) {
102  return $this->map->getFromMap($serialized_string);
103  }
104 
105  return $this->serializer_factory->fromSerializedIdentification($serialized_string)->unserialize($serialized_string, $this->map, $this->provider_factory);
106  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ plugin()

ILIAS\GlobalScreen\Identification\IdentificationFactory::plugin ( string  $plugin_id,
Provider  $provider 
)
final

Returns a IdentificationProvider for ILIAS-Plugins which takes care of the plugin_id for further identification where a provided GlobalScreen-element comes from (e.g.

to disable or delete all elements when a plugin is deleted or deactivated).

Definition at line 87 of file IdentificationFactory.php.

References ILIAS\GlobalScreen\Identification\IdentificationFactory\$map.

Referenced by ILIAS\GlobalScreen\MainMenu\IdentificationFactoryTest\testUnserializingPlugin().

87  : PluginIdentificationProvider
88  {
89  return new PluginIdentificationProvider($provider, $plugin_id, $this->serializer_factory->plugin(), $this->map);
90  }
$provider
Definition: ltitoken.php:80
+ Here is the caller graph for this function:

◆ tool()

ILIAS\GlobalScreen\Identification\IdentificationFactory::tool ( Provider  $provider)
final

Returns a IdentificationProvider for core tools, only a Provider is needed.

Definition at line 76 of file IdentificationFactory.php.

References ILIAS\GlobalScreen\Identification\IdentificationFactory\$map.

76  : ToolIdentificationProvider
77  {
78  return new ToolIdentificationProvider($provider, $this->serializer_factory->core(), $this->map);
79  }
$provider
Definition: ltitoken.php:80

Field Documentation

◆ $map

◆ $serializer_factory

SerializerFactory ILIAS\GlobalScreen\Identification\IdentificationFactory::$serializer_factory
protected

Definition at line 50 of file IdentificationFactory.php.


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