ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
TableDataProvider.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26
31{
32 private Services $irss;
33
34 public function __construct(
35 private Request $view_request,
36 ) {
37 global $DIC;
38 $this->irss = $DIC->resourceStorage();
39 }
40
41 public function getViewRequest(): Request
42 {
43 return $this->view_request;
44 }
45
49 public function getIdentifications(): array
50 {
51 $collection = $this->view_request->getCollection();
52 // Sort
53 $sorter = $this->irss->collection()->sort($collection);
54
55 switch ($this->view_request->getSortation()) {
57 $collection = $sorter->asc()->byTitle();
58 break;
60 $collection = $sorter->desc()->byTitle();
61 break;
63 $collection = $sorter->asc()->byCreationDate();
64 break;
66 $collection = $sorter->desc()->byCreationDate();
67 break;
69 $collection = $sorter->asc()->bySize();
70 break;
72 $collection = $sorter->desc()->bySize();
73 break;
74 }
75
76 return $this->irss->collection()->rangeAsArray(
77 $collection,
78 $this->view_request->getPage() * $this->view_request->getItemsPerPage(),
79 $this->view_request->getItemsPerPage(),
80 );
81 }
82
83 public function getTotal(): int
84 {
85 return $this->view_request->getCollection()->count();
86 }
87}
global $DIC
Definition: shib_login.php:26