ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
AbstractMetaBarItemRenderer.php
Go to the documentation of this file.
2 
11 
18 {
20  use isSupportedTrait;
24  protected $ui;
25 
26 
30  public function __construct()
31  {
32  global $DIC;
33  $this->ui = $DIC->ui();
34  }
35 
36 
42  protected function getURI(string $uri_string) : URI
43  {
44  if (strpos($uri_string, 'http') === 0) {
45  return new URI($uri_string);
46  }
47 
48  return new URI(rtrim(ILIAS_HTTP_PATH, "/") . "/" . ltrim($uri_string, "./"));
49  }
50 
51 
55  public function getComponentForItem(isItem $item) : Component
56  {
57  $component = $this->getSpecificComponentForItem($item);
58  $component = $this->applyDecorator($component, $item);
59 
60  return $component;
61  }
62 
63 
64  abstract protected function getSpecificComponentForItem(isItem $item) : Component;
65 
66 
72  protected function getStandardSymbol(isItem $item) : Symbol
73  {
74  if ($item instanceof hasSymbol && $item->hasSymbol()) {
75  return $item->getSymbol();
76  }
77  if ($item instanceof hasTitle) {
78  $abbr = strtoupper(substr($item->getTitle(), 0, 1));
79  } else {
80  $abbr = strtoupper(substr(uniqid('', true), -1));
81  }
82 
83  return $this->ui->factory()->symbol()->icon()->standard($abbr, $abbr, 'small', true)->withAbbreviation($abbr);
84  }
85 }
This describes a symbol.
Definition: Symbol.php:11
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:17
ui()
Definition: ui.php:5
$DIC
Definition: xapitoken.php:46