ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilPDSelectedItemsBlockSelectedItemsProvider.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 {
23  protected ilObjUser $actor;
26  protected ilSetting $settings;
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.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)