ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPDSelectedItemsBlockMembershipsProvider Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilPDSelectedItemsBlockMembershipsProvider:
+ Collaboration diagram for ilPDSelectedItemsBlockMembershipsProvider:

Public Member Functions

 __construct (ilObjUser $actor)
 
 getItems (array $object_type_white_list=array())
 

Protected Member Functions

 getObjectsByMembership (array $objTypes=[])
 Gets all objects the current user is member of. More...
 

Protected Attributes

ilObjUser $actor
 
ilTree $tree
 
ilAccessHandler $access
 
ilSetting $settings
 

Private Attributes

ilPDSelectedItemsBlockMembershipsObjectRepository $repository
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Definition at line 19 of file class.ilPDSelectedItemsBlockMembershipsProvider.php.

Constructor & Destructor Documentation

◆ __construct()

ilPDSelectedItemsBlockMembershipsProvider::__construct ( ilObjUser  $actor)

Definition at line 27 of file class.ilPDSelectedItemsBlockMembershipsProvider.php.

References $actor, $DIC, ILIAS\Repository\access(), RECOVERY_FOLDER_ID, ILIAS\UI\examples\Deck\repository(), and ILIAS\Repository\settings().

28  {
29  global $DIC;
30 
31  $this->actor = $actor;
32  $this->tree = $DIC->repositoryTree();
33  $this->access = $DIC->access();
34  $this->settings = $DIC->settings();
36  $DIC->database(),
38  );
39  }
global $DIC
Definition: feed.php:28
const RECOVERY_FOLDER_ID
Definition: constants.php:37
+ Here is the call graph for this function:

Member Function Documentation

◆ getItems()

ilPDSelectedItemsBlockMembershipsProvider::getItems ( array  $object_type_white_list = array())
Parameters
array$object_type_white_listAn optional array of object_types used for filter purposes
Returns
array An array of repository items, each given as a structured array

Implements ilPDSelectedItemsBlockProvider.

Definition at line 98 of file class.ilPDSelectedItemsBlockMembershipsProvider.php.

References getObjectsByMembership().

98  : array
99  {
100  return $this->getObjectsByMembership($object_type_white_list);
101  }
getObjectsByMembership(array $objTypes=[])
Gets all objects the current user is member of.
+ Here is the call graph for this function:

◆ getObjectsByMembership()

ilPDSelectedItemsBlockMembershipsProvider::getObjectsByMembership ( array  $objTypes = [])
protected

Gets all objects the current user is member of.

Definition at line 44 of file class.ilPDSelectedItemsBlockMembershipsProvider.php.

References $objId, $refId, ILIAS\Repository\access(), IL_CAL_DATE, IL_CAL_UNIX, ILIAS\Repository\int(), ILIAS\UI\examples\Deck\repository(), ILIAS\Repository\settings(), and ilStr\shortenTextExtended().

Referenced by getItems().

44  : array
45  {
46  $short_desc = $this->settings->get("rep_shorten_description");
47  $short_desc_max_length = (int) $this->settings->get("rep_shorten_description_length");
48 
49  if (!is_array($objTypes) || $objTypes === []) {
50  $objTypes = $this->repository->getValidObjectTypes();
51  }
52 
53  $references = [];
54  foreach ($this->repository->getForUser($this->actor, $objTypes, $this->actor->getLanguage()) as $item) {
55  $refId = $item->getRefId();
56  $objId = $item->getObjId();
57  $parentRefId = $item->getParentRefId();
58  $title = $item->getTitle();
59  $parentTreeLftValue = $item->getParentLftTree();
60  $parentTreeLftValue = sprintf("%010d", $parentTreeLftValue);
61 
62  if (!$this->access->checkAccess('visible', '', $refId)) {
63  continue;
64  }
65 
66  $periodStart = $periodEnd = null;
67  if ($item->getPeriodStart() !== null && $item->getPeriodEnd() !== null) {
68  if ($item->objectPeriodHasTime()) {
69  $periodStart = new ilDateTime($item->getPeriodStart()->getTimestamp(), IL_CAL_UNIX);
70  $periodEnd = new ilDateTime($item->getPeriodEnd()->getTimestamp(), IL_CAL_UNIX);
71  } else {
72  $periodStart = new ilDate($item->getPeriodStart()->format('Y-m-d'), IL_CAL_DATE);
73  $periodEnd = new ilDate($item->getPeriodEnd()->format('Y-m-d'), IL_CAL_DATE);
74  }
75  }
76 
77  $description = $item->getDescription();
78  if ($short_desc && $short_desc_max_length !== 0) {
79  $description = ilStr::shortenTextExtended($description, $short_desc_max_length, true);
80  }
81 
82  $references[$parentTreeLftValue . $title . $refId] = [
83  'ref_id' => $refId,
84  'obj_id' => $objId,
85  'type' => $item->getType(),
86  'title' => $title,
87  'description' => $description,
88  'parent_ref' => $parentRefId,
89  'start' => $periodStart,
90  'end' => $periodEnd
91  ];
92  }
93  ksort($references);
94 
95  return $references;
96  }
$objId
Definition: xapitoken.php:57
$refId
Definition: xapitoken.php:58
const IL_CAL_UNIX
const IL_CAL_DATE
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilPDSelectedItemsBlockMembershipsProvider::$access
protected

◆ $actor

ilObjUser ilPDSelectedItemsBlockMembershipsProvider::$actor
protected

Definition at line 21 of file class.ilPDSelectedItemsBlockMembershipsProvider.php.

Referenced by __construct().

◆ $repository

ilPDSelectedItemsBlockMembershipsObjectRepository ilPDSelectedItemsBlockMembershipsProvider::$repository
private

◆ $settings

ilSetting ilPDSelectedItemsBlockMembershipsProvider::$settings
protected

◆ $tree

ilTree ilPDSelectedItemsBlockMembershipsProvider::$tree
protected

The documentation for this class was generated from the following file: