ILIAS  release_8 Revision v8.24
AbstractMetaBarItemRenderer.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
25use ILIAS\GlobalScreen\Collector\Renderer\ComponentDecoratorApplierTrait;
26use ILIAS\GlobalScreen\Collector\Renderer\isSupportedTrait;
32
38{
39 use ComponentDecoratorApplierTrait;
40 use isSupportedTrait;
41
42 protected UIServices $ui;
43
47 public function __construct()
48 {
49 global $DIC;
50 $this->ui = $DIC->ui();
51 }
52
57 protected function getURI(string $uri_string): URI
58 {
59 if (strpos($uri_string, 'http') === 0) {
60 return new URI($uri_string);
61 }
62
63 return new URI(rtrim(ILIAS_HTTP_PATH, "/") . "/" . ltrim($uri_string, "./"));
64 }
65
69 public function getComponentForItem(isItem $item): Component
70 {
71 $component = $this->getSpecificComponentForItem($item);
72
73 return $this->applyDecorator($component, $item);
74 }
75
76 abstract protected function getSpecificComponentForItem(isItem $item): Component;
77
82 protected function buildIcon(isItem $item): Symbol
83 {
84 if ($item instanceof hasSymbol && $item->hasSymbol()) {
85 return $this->applySymbolDecorator($item->getSymbol(), $item);
86 }
87 if ($item instanceof hasTitle) {
88 $abbr = strtoupper(substr($item->getTitle(), 0, 1));
89 } else {
90 $abbr = strtoupper(substr(uniqid('', true), -1));
91 }
92
93 return $this->ui->factory()->symbol()->icon()->standard($abbr, $abbr, 'small', true)->withAbbreviation($abbr);
94 }
95}
Provides fluid interface to RBAC services.
Definition: UIServices.php:24
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
global $DIC
Definition: feed.php:28
A component is the most general form of an entity in the UI.
Definition: Component.php:28
This describes a symbol.
Definition: Symbol.php:30
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...