ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Services\Help\ScreenId\HelpScreenIdObserver Class Reference
+ Inheritance diagram for ILIAS\Services\Help\ScreenId\HelpScreenIdObserver:
+ Collaboration diagram for ILIAS\Services\Help\ScreenId\HelpScreenIdObserver:

Public Member Functions

 __construct ()
 
 getId ()
 Unique identifier of the implementing event-listener. More...
 
 update (\ilCtrlEvent $event, ?string $data)
 
 getScreenId ()
 
- Public Member Functions inherited from ilCtrlObserver
 getId ()
 Unique identifier of the implementing event-listener. More...
 
 update (ilCtrlEvent $event, ?string $data)
 Recieves an ilCtrl event and handles it appropriately. More...
 

Protected Member Functions

 addLatestCommandClass (?string $class)
 
 setLatestCommand (?string $command)
 
 cleanClassName (string $classname)
 
 cleanCommandName (string $command)
 

Protected Attributes

array $clean_name_stack = []
 
string $command = null
 

Private Attributes

const SCREEN_SEPARATOR = '/'
 
const COMMAND_SEPARATOR = '/'
 
array $map
 

Detailed Description

Definition at line 23 of file HelpScreenIdObserver.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Services\Help\ScreenId\HelpScreenIdObserver::__construct ( )

Definition at line 33 of file HelpScreenIdObserver.php.

34 {
35 $this->map = [];
36 //$this->map = include \ilHelpBuildScreenIdMapObjective::PATH();
37 }

Member Function Documentation

◆ addLatestCommandClass()

ILIAS\Services\Help\ScreenId\HelpScreenIdObserver::addLatestCommandClass ( ?string  $class)
protected

Definition at line 60 of file HelpScreenIdObserver.php.

60 : void
61 {
62 if (null === $class) {
63 return;
64 }
65
66 $clean_class_name = $this->cleanClassName($class);
67 $last_stack_entry = (($stack_size = count($this->clean_name_stack)) > 0) ?
68 $this->clean_name_stack[($stack_size - 1)] :
69 null;
70
71 if ($last_stack_entry !== $clean_class_name) {
72 $this->clean_name_stack[] = $clean_class_name;
73 }
74 }

References ILIAS\Services\Help\ScreenId\HelpScreenIdObserver\cleanClassName().

Referenced by ILIAS\Services\Help\ScreenId\HelpScreenIdObserver\update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanClassName()

ILIAS\Services\Help\ScreenId\HelpScreenIdObserver::cleanClassName ( string  $classname)
protected

Definition at line 83 of file HelpScreenIdObserver.php.

83 : ?string
84 {
85 // check for attributes in artifact
86 if (isset($this->map[$classname])) {
87 return $this->map[$classname];
88 }
89
90 // This is the fallback for classes which do not have a screen id attribute yet.
91 return $this->classNameToScreenId($classname);
92 }
classNameToScreenId(string $classname)

References ILIAS\Services\Help\ScreenId\classNameToScreenId().

Referenced by ILIAS\Services\Help\ScreenId\HelpScreenIdObserver\addLatestCommandClass().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanCommandName()

ILIAS\Services\Help\ScreenId\HelpScreenIdObserver::cleanCommandName ( string  $command)
protected

Definition at line 94 of file HelpScreenIdObserver.php.

References ILIAS\Services\Help\ScreenId\snakeToCamel().

Referenced by ILIAS\Services\Help\ScreenId\HelpScreenIdObserver\setLatestCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getId()

ILIAS\Services\Help\ScreenId\HelpScreenIdObserver::getId ( )

Unique identifier of the implementing event-listener.

Implements ilCtrlObserver.

Definition at line 39 of file HelpScreenIdObserver.php.

39 : string
40 {
41 return self::class;
42 }

◆ getScreenId()

ILIAS\Services\Help\ScreenId\HelpScreenIdObserver::getScreenId ( )

Definition at line 52 of file HelpScreenIdObserver.php.

52 : string
53 {
54 return implode(
55 self::SCREEN_SEPARATOR,
56 $this->clean_name_stack
57 ) . ($this->command !== null ? self::COMMAND_SEPARATOR . $this->command : '');
58 }

◆ setLatestCommand()

ILIAS\Services\Help\ScreenId\HelpScreenIdObserver::setLatestCommand ( ?string  $command)
protected

Definition at line 76 of file HelpScreenIdObserver.php.

76 : void
77 {
78 if (null !== $command) {
79 $this->command = $this->cleanCommandName($command);
80 }
81 }

References ILIAS\Services\Help\ScreenId\HelpScreenIdObserver\$command, and ILIAS\Services\Help\ScreenId\HelpScreenIdObserver\cleanCommandName().

Referenced by ILIAS\Services\Help\ScreenId\HelpScreenIdObserver\update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ILIAS\Services\Help\ScreenId\HelpScreenIdObserver::update ( \ilCtrlEvent  $event,
?string  $data 
)

Definition at line 44 of file HelpScreenIdObserver.php.

44 : void
45 {
46 match ($event) {
47 \ilCtrlEvent::COMMAND_CLASS_FORWARD => $this->addLatestCommandClass($data),
48 \ilCtrlEvent::COMMAND_DETERMINATION => $this->setLatestCommand($data),
49 };
50 }

References ILIAS\Services\Help\ScreenId\HelpScreenIdObserver\addLatestCommandClass(), and ILIAS\Services\Help\ScreenId\HelpScreenIdObserver\setLatestCommand().

+ Here is the call graph for this function:

Field Documentation

◆ $clean_name_stack

array ILIAS\Services\Help\ScreenId\HelpScreenIdObserver::$clean_name_stack = []
protected

Definition at line 30 of file HelpScreenIdObserver.php.

◆ $command

string ILIAS\Services\Help\ScreenId\HelpScreenIdObserver::$command = null
protected

◆ $map

array ILIAS\Services\Help\ScreenId\HelpScreenIdObserver::$map
private

Definition at line 29 of file HelpScreenIdObserver.php.

◆ COMMAND_SEPARATOR

const ILIAS\Services\Help\ScreenId\HelpScreenIdObserver::COMMAND_SEPARATOR = '/'
private

Definition at line 28 of file HelpScreenIdObserver.php.

◆ SCREEN_SEPARATOR

const ILIAS\Services\Help\ScreenId\HelpScreenIdObserver::SCREEN_SEPARATOR = '/'
private

Definition at line 27 of file HelpScreenIdObserver.php.


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