ILIAS  release_8 Revision v8.23
class.ilPDSelectedItemsBlockSelectedItemsProvider.php
Go to the documentation of this file.
1 <?php
2 
20 {
21  protected ilObjUser $actor;
24  protected ilSetting $settings;
25 
26  public function __construct(ilObjUser $actor)
27  {
28  global $DIC;
29 
30  $this->actor = $actor;
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()): 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 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
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...
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)