ILIAS  release_7 Revision v7.30-3-g800a261c036
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 if (!$this->access->checkAccess('visible', '', $favourite['ref_id'])) {
59 continue;
60 }
61
62 if ($short_desc && $short_desc_max_length) {
63 $favourite['description'] = ilUtil::shortenText($favourite['description'], $short_desc_max_length, true);
64 }
65
66 $access_granted_favourites[$idx] = $favourite;
67 }
68 return $access_granted_favourites;
69 }
70}
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.
global $DIC
Definition: goto.php:24
Interface ilPDSelectedItemsBlockProvider.
settings()
Definition: settings.php:2