4 require_once
'Services/PersonalDesktop/ItemsBlock/classes/class.ilPDSelectedItemsBlockGroup.php';
50 $this->lng = $DIC->language();
51 $this->tree = $DIC->repositoryTree();
52 $this->object_cache = $DIC[
'ilObjDataCache'];
53 $this->accessHandler = $DIC->rbac()->system();
74 if ($this->viewSettings->isSortedByLocation()) {
114 return $items_groups;
124 require_once
'Services/PersonalDesktop/ItemsBlock/classes/class.ilPDSelectedItemsBlockMembershipsViewGUI.php';
125 require_once
'Services/PersonalDesktop/ItemsBlock/classes/class.ilPDSelectedItemsBlockMembershipsProvider.php';
132 require_once
'Services/PersonalDesktop/ItemsBlock/classes/class.ilPDSelectedItemsBlockSelectedItemsViewGUI.php';
133 require_once
'Services/PersonalDesktop/ItemsBlock/classes/class.ilPDSelectedItemsBlockSelectedItemsProvider.php';
146 return $this->tree->getRootId() == $refId;
154 $nd = $this->tree->getNodeData($this->tree->getRootId());
158 $title = $this->lng->txt(
'repository');
169 require_once
'Services/Object/classes/class.ilObjectListGUIPreloader.php';
173 foreach ($item_groups as $item_group) {
174 foreach ($item_group->getItems() as $item) {
175 $obj_ids[] = $item[
'obj_id'];
176 $listPreloader->addItem($item[
'obj_id'], $item[
'type'], $item[
'ref_id']);
180 $listPreloader->preload();
191 $objDefinition = $DIC[
"objDefinition"];
193 $object_types_by_container = $DIC[
'objDefinition']->getGroupedRepositoryObjectTypes(array(
'cat',
'crs',
'grp',
'fold'));
195 $grouped_items = array();
197 foreach ($object_types_by_container as $container_object_type => $container_data) {
200 if (!$objDefinition->isPlugin($container_object_type)) {
201 $title = $this->lng->txt(
'objs_' . $container_object_type);
203 include_once(
"./Services/Component/classes/class.ilPlugin.php");
205 $title = $pl->txt(
"objs_" . $container_object_type);
209 $group->setItems($this->provider->getItems($container_data[
'objs']));
211 $grouped_items[] = $group;
214 return $grouped_items;
222 $items = $this->provider->getItems();
224 if (0 == count($items)) {
229 'upcoming' => array(),
230 'ongoing' => array(),
232 'not_dated' => array()
235 foreach ($items as
$key => $item) {
236 if ($item[
'start'] && $item[
'start'] && $item[
'start'] instanceof
ilDate) {
238 $groups[
'upcoming'][] = $item;
239 } elseif ($item[
'end']->
get(
IL_CAL_UNIX) > time()) {
240 $groups[
'ongoing'][] = $item;
242 $groups[
'ended'][] = $item;
245 $groups[
'not_dated'][] = $item;
249 uasort($groups[
'upcoming'],
function ($left, $right) {
256 return strcmp($left[
'title'], $right[
'title']);
259 uasort($groups[
'ongoing'],
function ($left, $right) {
266 return strcmp($left[
'title'], $right[
'title']);
269 uasort($groups[
'ended'],
function ($left, $right) {
276 return strcmp($left[
'title'], $right[
'title']);
279 uasort($groups[
'not_dated'],
function ($left, $right) {
280 return strcmp($left[
'title'], $right[
'title']);
284 $upcoming->setLabel($this->lng->txt(
'pd_upcoming'));
285 $upcoming->setItems($groups[
'upcoming']);
288 $ongoing->setLabel($this->lng->txt(
'pd_ongoing'));
289 $ongoing->setItems($groups[
'ongoing']);
292 $ended->setLabel($this->lng->txt(
'pd_ended'));
293 $ended->setItems($groups[
'ended']);
296 $not_dated->setLabel($this->lng->txt(
'pd_not_date'));
297 $not_dated->setItems($groups[
'not_dated']);
299 return array_filter([
305 return count($group->
getItems()) > 0;
314 $grouped_items = array();
316 $items = $this->provider->getItems();
318 $parent_ref_ids = array_values(array_unique(array_map(
function ($item) {
319 return $item[
'parent_ref'];
321 $this->object_cache->preloadReferenceCache($parent_ref_ids);
323 foreach ($items as
$key => $item) {
324 if (!array_key_exists(
'grp_' . $item[
'parent_ref'], $grouped_items)) {
331 $group->setLabel($this->object_cache->lookupTitle($this->object_cache->lookupObjId($item[
'parent_ref'])));
333 $grouped_items[
'grp_' . $item[
'parent_ref']] = $group;
336 $grouped_items[
'grp_' . $item[
'parent_ref']]->pushItem($item);
339 return $grouped_items;
Class ilPDSelectedItemsBlockMembershipsViewGUI.
__construct(ilPDSelectedItemsBlockViewSettings $viewSettings, ilPDSelectedItemsBlockProvider $provider)
ilPDSelectedItemsBlockViewGUI constructor.
Class ilPDSelectedItemsBlockViewGUI.
static preloadByObjIds(array $a_obj_ids)
Preload list gui data.
Class ilPDSelectedItemsBlockGroup.
Class ilPDSelectedItemsBlockSelectedItemsViewGUI.
static getPluginObjectByType($type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin...
Preloader for object list GUIs.
preloadItemGroups(array $item_groups)
Class ilPDSelectedItemsBlockMembershipsProvider.
const CONTEXT_PERSONAL_DESKTOP
static bySettings(ilPDSelectedItemsBlockViewSettings $viewSettings)
Class ilPDSelectedItemsBlockViewSettings.
getMinimumDetailLevelForSection()
Class ilPDSelectedItemsBlockMembershipsProvider.
Interface ilPDSelectedItemsBlockProvider.
isMembershipsViewActive()