ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
class.ilPDSelectedItemsBlockSelectedItemsProvider.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
24 protected readonly ilAccessHandler $access;
25 protected readonly ilSetting $settings;
26
27 public function __construct(protected readonly ilObjUser $actor)
28 {
29 global $DIC;
30
31 $this->fav_manager = new ilFavouritesManager();
32 $this->access = $DIC->access();
33 $this->settings = $DIC->settings();
34 }
35
36 public function getItems(array $object_type_white_list = []): array
37 {
38 $short_desc = $this->settings->get('rep_shorten_description');
39 $short_desc_max_length = (int) $this->settings->get('rep_shorten_description_length');
40
41 $favourites = $this->fav_manager->getFavouritesOfUser(
42 $this->actor->getId(),
43 count($object_type_white_list) > 0 ? $object_type_white_list : null
44 );
45 $access_granted_favourites = [];
46 foreach ($favourites as $idx => $favourite) {
47 if (!$this->access->checkAccess('visible', '', $favourite['ref_id'])) {
48 continue;
49 }
50
51 if ($short_desc && $short_desc_max_length !== 0) {
52 $favourite['description'] = ilStr::shortenTextExtended($favourite['description'], $short_desc_max_length, true);
53 }
54
55 $access_granted_favourites[$idx] = $favourite;
56 }
57 return $access_granted_favourites;
58 }
59}
Manages favourites, currently the interface for other components, needs discussion.
User class.
ILIAS Setting Class.
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
global $DIC
Definition: shib_login.php:26