ILIAS  trunk Revision v12.0_alpha-16-g3e876e53c80
PropertiesAggregatorImpl.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use DateTimeImmutable;
25use ilObject;
27use ilLanguage;
29use ILIAS\StaticURL\Services as StaticURL;
30use ILIAS\Data\Factory as DataFactory;
31use ilPathGUI;
32
34{
35 public function __construct(
36 protected AccessChecker $access,
37 protected ilObjectDefinition $obj_definition,
38 protected ilLanguage $lng,
39 protected StaticURL $static_url,
40 protected DataFactory $data_factory
41 ) {
42 }
43
44 public function lookupTitle(int $obj_id): string
45 {
46 return ilObject::_lookupTitle($obj_id);
47 }
48
49 public function lookupDescription(int $obj_id): string
50 {
51 return ilObject::_lookupDescription($obj_id);
52 }
53
54 public function lookupCreationDate(int $obj_id): DateTimeImmutable
55 {
56 return new DateTimeImmutable(ilObject::_lookupCreationDate($obj_id));
57 }
58
59 public function lookupType(int $obj_id): string
60 {
61 return ilObject::_lookupType($obj_id);
62 }
63
64 public function buildLink(int $ref_id, string $type): ?URI
65 {
66 if (!$this->access->canAccessLinkToObject($ref_id)) {
67 return null;
68 }
69 $ref_id = $this->data_factory->refId($ref_id);
70 return $this->static_url->builder()->build($type, $ref_id);
71 }
72
73 public function buildRepositoryPath(int $ref_id): string
74 {
75 $path_gui = new ilPathGUI();
76 $path_gui->enableTextOnly(true);
77 return $path_gui->getPath(ROOT_FOLDER_ID, $ref_id);
78 }
79
80 public function makeTypePresentable(string $type): string
81 {
82 if (!$this->obj_definition->isPlugin($type)) {
83 return $this->lng->txt('obj_' . $type);
84 } else {
85 return ilObjectPlugin::lookupTxtById($type, "obj_" . $type);
86 }
87 }
88
89 public function buildIconPath(int $obj_id, string $type): string
90 {
91 return ilObject::_getIcon($obj_id, 'small', $type);
92 }
93}
Builds data types.
Definition: Factory.php:36
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
Class Services.
Definition: Services.php:38
__construct(protected AccessChecker $access, protected ilObjectDefinition $obj_definition, protected ilLanguage $lng, protected StaticURL $static_url, protected DataFactory $data_factory)
language handling
parses the objects.xml it handles the xml-description of all ilias objects
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupTxtById(string $plugin_id, string $lang_var)
Class ilObject Basic functions for all objects.
static _lookupType(int $id, bool $reference=false)
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static _lookupCreationDate(int $obj_id)
static _lookupTitle(int $obj_id)
static _lookupDescription(int $obj_id)
const ROOT_FOLDER_ID
Definition: constants.php:32
$static_url
Definition: goto.php:29
$ref_id
Definition: ltiauth.php:66
global $lng
Definition: privfeed.php:31