33 $this->
lng = $DIC->language();
34 $this->tree = $DIC->repositoryTree();
35 $this->object_cache = $DIC[
'ilObjDataCache'];
36 $this->accessHandler = $DIC->rbac()->system();
44 abstract public function getTitle(): string;
53 abstract public function getGroups(): array;
98 return $this->tree->getRootId() ==
$refId;
103 $nd = $this->tree->getNodeData($this->tree->getRootId());
104 $title =
$nd[
'title'];
106 if ($title ==
'ILIAS') {
107 $title = $this->
lng->txt(
'repository');
121 foreach ($item_groups as $item_group) {
122 foreach ($item_group->getItems() as $item) {
123 $obj_ids[] = (
int) $item[
'obj_id'];
124 $listPreloader->addItem($item[
'obj_id'], $item[
'type'], $item[
'ref_id']);
128 $listPreloader->preload();
139 $objDefinition = $DIC[
"objDefinition"];
141 $object_types_by_container = $DIC[
'objDefinition']->getGroupedRepositoryObjectTypes(array(
'cat',
'crs',
'grp',
'fold'));
143 $grouped_items = array();
145 foreach ($object_types_by_container as $container_object_type => $container_data) {
148 if (!$objDefinition->isPlugin($container_object_type)) {
149 $title = $this->
lng->txt(
'objs_' . $container_object_type);
152 $title = $pl->txt(
"objs_" . $container_object_type);
155 $group->setLabel($title);
156 $group->setItems($this->provider->getItems($container_data[
'objs']));
158 $grouped_items[] = $group;
161 return $grouped_items;
169 $items = $this->provider->getItems();
171 if (0 == count($items)) {
176 'upcoming' => array(),
177 'ongoing' => array(),
179 'not_dated' => array()
181 foreach ($items as
$key => $item) {
182 if ($item[
'start'] && $item[
'start']->
get(
IL_CAL_UNIX) > 0 && $item[
'start'] instanceof
ilDateTime) {
184 $groups[
'upcoming'][] = $item;
185 } elseif ($item[
'end']->
get(
IL_CAL_UNIX) > time()) {
186 $groups[
'ongoing'][] = $item;
188 $groups[
'ended'][] = $item;
191 $groups[
'not_dated'][] = $item;
195 uasort($groups[
'upcoming'],
function ($left, $right) {
202 return strcmp($left[
'title'], $right[
'title']);
205 uasort($groups[
'ongoing'],
function ($left, $right) {
212 return strcmp($left[
'title'], $right[
'title']);
215 uasort($groups[
'ended'],
function ($left, $right) {
222 return strcmp($left[
'title'], $right[
'title']);
225 uasort($groups[
'not_dated'],
function ($left, $right) {
226 return strcmp($left[
'title'], $right[
'title']);
230 $upcoming->setLabel($this->
lng->txt(
'pd_upcoming'));
231 $upcoming->setItems($groups[
'upcoming']);
234 $ongoing->setLabel($this->
lng->txt(
'pd_ongoing'));
235 $ongoing->setItems($groups[
'ongoing']);
238 $ended->setLabel($this->
lng->txt(
'pd_ended'));
239 $ended->setItems($groups[
'ended']);
242 $not_dated->setLabel($this->
lng->txt(
'pd_not_date'));
243 $not_dated->setItems($groups[
'not_dated']);
245 return array_filter([
251 return count($group->
getItems()) > 0;
260 $grouped_items = array();
262 $items = $this->provider->getItems();
264 $parent_ref_ids = array_values(array_unique(array_map(
function ($item) {
265 return $item[
'parent_ref'];
267 $this->object_cache->preloadReferenceCache($parent_ref_ids);
269 foreach ($items as
$key => $item) {
270 if (!array_key_exists(
'grp_' . $item[
'parent_ref'], $grouped_items)) {
277 $group->setLabel($this->object_cache->lookupTitle($this->object_cache->lookupObjId((
int) $item[
'parent_ref'])));
279 $grouped_items[
'grp_' . $item[
'parent_ref']] = $group;
282 $grouped_items[
'grp_' . $item[
'parent_ref']]->pushItem($item);
285 return $grouped_items;
293 $items = array_values($this->provider->getItems());
295 usort($items,
static function (array $first, array $second):
int {
296 return strnatcmp(strtolower($first[
'title']), strtolower($second[
'title']));
300 array_map([$group,
'pushItem'], $items);
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilPDSelectedItemsBlockViewSettings $viewSettings, ilPDSelectedItemsBlockProvider $provider)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static preloadByObjIds(array $a_obj_ids)
Preload list gui data.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilObjectDataCache $object_cache
ilPDSelectedItemsBlockViewSettings $viewSettings
sortItemsByAlphabetInOneGroup()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilPDSelectedItemsBlockProvider $provider
preloadItemGroups(array $item_groups)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const CONTEXT_PERSONAL_DESKTOP
static bySettings(ilPDSelectedItemsBlockViewSettings $viewSettings)
setIsInManageMode(bool $isInManageMode)
static getPluginObjectByType(string $type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
isMembershipsViewActive()
ilRbacSystem $accessHandler
mayRemoveItem(int $refId)