ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilPDSelectedItemsBlockMembershipsProvider Class Reference
+ Inheritance diagram for ilPDSelectedItemsBlockMembershipsProvider:
+ Collaboration diagram for ilPDSelectedItemsBlockMembershipsProvider:

Public Member Functions

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

Protected Member Functions

 getObjectsByMembership (array $objTypes=[])
 

Protected Attributes

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

Private Attributes

ilPDSelectedItemsBlockMembershipsObjectRepository $repository
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilPDSelectedItemsBlockMembershipsProvider::__construct ( ilObjUser  $actor)

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

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

30  {
31  global $DIC;
32 
33  $this->actor = $actor;
34  $this->tree = $DIC->repositoryTree();
35  $this->access = $DIC->access();
36  $this->settings = $DIC->settings();
38  $DIC->database(),
40  );
41  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
global $DIC
Definition: shib_login.php:22
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 = [])

Implements ilPDSelectedItemsBlockProvider.

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

References getObjectsByMembership().

97  : array
98  {
99  return $this->getObjectsByMembership($object_type_white_list);
100  }
+ Here is the call graph for this function:

◆ getObjectsByMembership()

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

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

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

Referenced by getItems().

43  : array
44  {
45  $short_desc = $this->settings->get('rep_shorten_description');
46  $short_desc_max_length = (int) $this->settings->get('rep_shorten_description_length');
47 
48  if (!is_array($objTypes) || $objTypes === []) {
49  $objTypes = $this->repository->getValidObjectTypes();
50  }
51 
52  $references = [];
53  foreach ($this->repository->getForUser($this->actor, $objTypes, $this->actor->getLanguage()) as $item) {
54  $refId = $item->getRefId();
55  $objId = $item->getObjId();
56  $parentRefId = $item->getParentRefId();
57  $title = $item->getTitle();
58  $parentTreeLftValue = $item->getParentLftTree();
59  $parentTreeLftValue = sprintf('%010d', $parentTreeLftValue);
60 
61  if (!$this->access->checkAccess('visible', '', $refId)) {
62  continue;
63  }
64 
65  $periodStart = $periodEnd = null;
66  if ($item->getPeriodStart() !== null && $item->getPeriodEnd() !== null) {
67  if ($item->objectPeriodHasTime()) {
68  $periodStart = new ilDateTime($item->getPeriodStart()->getTimestamp(), IL_CAL_UNIX);
69  $periodEnd = new ilDateTime($item->getPeriodEnd()->getTimestamp(), IL_CAL_UNIX);
70  } else {
71  $periodStart = new ilDate($item->getPeriodStart()->format('Y-m-d'), IL_CAL_DATE);
72  $periodEnd = new ilDate($item->getPeriodEnd()->format('Y-m-d'), IL_CAL_DATE);
73  }
74  }
75 
76  $description = $item->getDescription();
77  if ($short_desc && $short_desc_max_length !== 0) {
78  $description = ilStr::shortenTextExtended($description, $short_desc_max_length, true);
79  }
80 
81  $references[$parentTreeLftValue . $title . $refId] = [
82  'ref_id' => $refId,
83  'obj_id' => $objId,
84  'type' => $item->getType(),
85  'title' => $title,
86  'description' => $description,
87  'parent_ref' => $parentRefId,
88  'start' => $periodStart,
89  'end' => $periodEnd
90  ];
91  }
92  ksort($references);
93 
94  return $references;
95  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
$objId
Definition: xapitoken.php:57
$refId
Definition: xapitoken.php:58
const IL_CAL_UNIX
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 23 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: