ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilPDSelectedItemsBlockSelectedItemsProvider.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 protected ilObjUser $actor;
27
28 public function __construct(ilObjUser $actor)
29 {
30 global $DIC;
31
32 $this->actor = $actor;
33 $this->fav_manager = new ilFavouritesManager();
34 $this->access = $DIC->access();
35 $this->settings = $DIC->settings();
36 }
37
38 public function getItems(array $object_type_white_list = []): array
39 {
40 $short_desc = $this->settings->get('rep_shorten_description');
41 $short_desc_max_length = (int) $this->settings->get('rep_shorten_description_length');
42
43 $favourites = $this->fav_manager->getFavouritesOfUser(
44 $this->actor->getId(),
45 count($object_type_white_list) > 0 ? $object_type_white_list : null
46 );
47 $access_granted_favourites = [];
48 foreach ($favourites as $idx => $favourite) {
49 if (!$this->access->checkAccess('visible', '', $favourite['ref_id'])) {
50 continue;
51 }
52
53 if ($short_desc && $short_desc_max_length !== 0) {
54 $favourite['description'] = ilStr::shortenTextExtended($favourite['description'], $short_desc_max_length, true);
55 }
56
57 $access_granted_favourites[$idx] = $favourite;
58 }
59 return $access_granted_favourites;
60 }
61}
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