ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilPDSelectedItemsBlockSelectedItemsProvider.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2017 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4
9{
13 protected $actor;
14
18 protected $fav_manager;
19
23 protected $access;
24
28 protected $settings;
29
34 public function __construct(ilObjUser $actor)
35 {
36 global $DIC;
37
38 $this->actor = $actor;
39 $this->fav_manager = new ilFavouritesManager();
40 $this->access = $DIC->access();
41 $this->settings = $DIC->settings();
42 }
43
47 public function getItems($object_type_white_list = array())
48 {
49 $short_desc = $this->settings->get("rep_shorten_description");
50 $short_desc_max_length = $this->settings->get("rep_shorten_description_length");
51
52 $favourites = $this->fav_manager->getFavouritesOfUser(
53 $this->actor->getId(),
54 count($object_type_white_list) > 0 ? $object_type_white_list : null
55 );
56 $access_granted_favourites = [];
57 foreach ($favourites as $idx => $favourite) {
58
59 if (!$this->access->checkAccess('visible', '', $favourite['ref_id'])) {
60 continue;
61 }
62
63 if ($short_desc && $short_desc_max_length) {
64 $favourite['description'] = ilUtil::shortenText($favourite['description'], $short_desc_max_length, true);
65 }
66
67 $access_granted_favourites[$idx] = $favourite;
68 }
69 return $access_granted_favourites;
70 }
71}
An exception for terminatinating execution or to throw for unit testing.
Manages favourites, currently the interface for other components, needs discussion.
__construct(ilObjUser $actor)
ilPDSelectedItemsBlockSelectedItemsProvider constructor.
getItems($object_type_white_list=array())
array An array of repository items, each given as a structured array
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
Interface ilPDSelectedItemsBlockProvider.
settings()
Definition: settings.php:2
$DIC
Definition: xapitoken.php:46