ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
ILIAS\File\Versions\Table\Table Class Reference
+ Collaboration diagram for ILIAS\File\Versions\Table\Table:

Public Member Functions

 __construct (private readonly \ilFileVersionsGUI $calling_gui)
 
 getIdToken ()
 
 getUrlBuilder ()
 
 getHTML ()
 

Private Member Functions

 buildTable ()
 
 initURIBuilder ()
 
 initColumns ()
 
 initActions ()
 
 getURI (string $command)
 
 getIRSS ()
 

Private Attributes

UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
ilCtrlInterface $ctrl
 
ilLanguage $lng
 
URLBuilder $url_builder
 
URLBuilderToken $id_token
 
ILIAS HTTP Services $http
 
DataFactory $data_factory
 

Detailed Description

Definition at line 33 of file Table.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\File\Versions\Table\Table::__construct ( private readonly \ilFileVersionsGUI  $calling_gui)

Definition at line 44 of file Table.php.

46 {
47 global $DIC;
48 $this->ui_factory = $DIC['ui.factory'];
49 $this->ui_renderer = $DIC['ui.renderer'];
50 $this->ctrl = $DIC['ilCtrl'];
51 $this->lng = $DIC['lng'];
52 $this->http = $DIC->http();
53 $this->data_factory = new DataFactory();
54
55 $this->url_builder = $this->initURIBuilder();
56 }
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\File\Versions\Table\Table\initURIBuilder(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildTable()

ILIAS\File\Versions\Table\Table::buildTable ( )
private

Definition at line 73 of file Table.php.

74 {
75 $file = $this->calling_gui->getFile();
76 $irss = $this->getIRSS();
77 $rid = $irss->manage()->find($file->getResourceId());
78 $revision = $irss->manage()->getCurrentRevisionIncludingDraft($rid);
79 $amount_of_versions = count($irss->manage()->getResource($rid)->getAllRevisionsIncludingDraft());
80 $current_version_is_draft = $revision->getStatus() === RevisionStatus::DRAFT;
81 $current_version = $file->getVersion(true);
82
83 $data_retrieval = new DataRetrieval(
84 $file,
85 $current_version,
86 $current_version_is_draft,
87 $amount_of_versions,
88 $this->ctrl,
89 $this->calling_gui,
90 $this->lng,
91 $this->ui_factory
92 );
93
94 return $this->ui_factory->table()
95 ->data($data_retrieval, $this->lng->txt('versions'), $this->initColumns())
96 ->withActions($this->initActions())
97 ->withOrder(new Order('version', Order::DESC))
98 ->withRequest($this->http->request());
99 }
const DESC
Definition: Order.php:31
This describes a Data Table.
Definition: Data.php:33

References ILIAS\Repository\ctrl(), ILIAS\Data\Order\DESC, ILIAS\ResourceStorage\Revision\DRAFT, ILIAS\File\Versions\Table\Table\getIRSS(), ILIAS\FileDelivery\http(), ILIAS\File\Versions\Table\Table\initActions(), and ILIAS\Repository\lng().

Referenced by ILIAS\File\Versions\Table\Table\getHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ILIAS\File\Versions\Table\Table::getHTML ( )

Definition at line 68 of file Table.php.

68 : string
69 {
70 return $this->ui_renderer->render([$this->buildTable()]);
71 }

References ILIAS\File\Versions\Table\Table\buildTable().

+ Here is the call graph for this function:

◆ getIdToken()

ILIAS\File\Versions\Table\Table::getIdToken ( )

Definition at line 58 of file Table.php.

58 : URLBuilderToken
59 {
60 return $this->id_token;
61 }
URLBuilderToken $id_token
Definition: Table.php:40

References ILIAS\File\Versions\Table\Table\$id_token.

◆ getIRSS()

ILIAS\File\Versions\Table\Table::getIRSS ( )
private

Definition at line 168 of file Table.php.

168 : IRSS
169 {
170 global $DIC;
171 return $DIC->resourceStorage();
172 }

References $DIC.

Referenced by ILIAS\File\Versions\Table\Table\buildTable().

+ Here is the caller graph for this function:

◆ getURI()

ILIAS\File\Versions\Table\Table::getURI ( string  $command)
private

Definition at line 161 of file Table.php.

161 : URI
162 {
163 return new URI(
164 ILIAS_HTTP_PATH . '/' . $this->ctrl->getLinkTarget($this->calling_gui, $command)
165 );
166 }

References ILIAS\Repository\ctrl().

Referenced by ILIAS\File\Versions\Table\Table\initURIBuilder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUrlBuilder()

ILIAS\File\Versions\Table\Table::getUrlBuilder ( )

Definition at line 63 of file Table.php.

63 : URLBuilder
64 {
65 return $this->url_builder;
66 }

References ILIAS\File\Versions\Table\Table\$url_builder.

◆ initActions()

ILIAS\File\Versions\Table\Table::initActions ( )
private
Returns
array<string, \ILIAS\UI\Component\Table\Action\Action>

Definition at line 133 of file Table.php.

133 : array
134 {
135 $a = $this->ui_factory->table()->action();
136
137 return [
138 DataRetrieval::ACTION_DELETE => $a->standard(
139 $this->lng->txt('delete'),
140 $this->url_builder->withURI($this->getURI(\ilFileVersionsGUI::CMD_RENDER_DELETE_SELECTED_VERSIONS_MODAL)),
141 $this->id_token
142 )->withAsync(true),
144 $this->lng->txt('file_rollback'),
145 $this->url_builder->withURI($this->getURI(\ilFileVersionsGUI::CMD_ROLLBACK_VERSION)),
146 $this->id_token
147 ),
149 $this->lng->txt('file_publish'),
150 $this->url_builder->withURI($this->getURI(\ilFileVersionsGUI::CMD_PUBLISH)),
151 $this->id_token
152 ),
154 $this->lng->txt('file_unpublish'),
155 $this->url_builder->withURI($this->getURI(\ilFileVersionsGUI::CMD_UNPUBLISH)),
156 $this->id_token
157 ),
158 ];
159 }
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples

References Vendor\Package\$a, ILIAS\File\Versions\Table\DataRetrieval\ACTION_DELETE, ILIAS\File\Versions\Table\DataRetrieval\ACTION_PUBLISH, ILIAS\File\Versions\Table\DataRetrieval\ACTION_ROLLBACK, ILIAS\File\Versions\Table\DataRetrieval\ACTION_UNPUBLISH, ilFileVersionsGUI\CMD_PUBLISH, ilFileVersionsGUI\CMD_RENDER_DELETE_SELECTED_VERSIONS_MODAL, ilFileVersionsGUI\CMD_ROLLBACK_VERSION, ilFileVersionsGUI\CMD_UNPUBLISH, and ILIAS\Repository\lng().

Referenced by ILIAS\File\Versions\Table\Table\buildTable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initColumns()

ILIAS\File\Versions\Table\Table::initColumns ( )
private
Returns
array<string, \ILIAS\UI\Component\Table\Column\Column>

Definition at line 114 of file Table.php.

114 : array
115 {
117 $col = $this->ui_factory->table()->column();
118
119 return [
120 'version' => $col->number($this->lng->txt('version')),
121 'filename' => $col->link($this->lng->txt('filename')),
122 'date' => $col->date($this->lng->txt('date'), $df->dateFormat()->withTime24($df->dateFormat()->germanShort())),
123 'uploaded_by' => $col->text($this->lng->txt('file_uploaded_by')),
124 'versionname' => $col->text($this->lng->txt('versionname')),
125 'filesize' => $col->text($this->lng->txt('filesize'))->withIsSortable(false),
126 'status' => $col->text($this->lng->txt('status'))->withIsSortable(false),
127 ];
128 }

References ILIAS\File\Versions\Table\Table\$data_factory, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ initURIBuilder()

ILIAS\File\Versions\Table\Table::initURIBuilder ( )
private

Definition at line 101 of file Table.php.

101 : URLBuilder
102 {
103 $url_builder = new URLBuilder($this->getURI(\ilFileVersionsGUI::CMD_DEFAULT));
105 ['file', 'versions'],
107 );
108 return $url_builder;
109 }
getURI(string $command)
Definition: Table.php:161
acquireParameters(array $namespace, string ... $names)
Definition: URLBuilder.php:138

References ILIAS\File\Versions\Table\Table\$id_token, ILIAS\File\Versions\Table\Table\$url_builder, ILIAS\UI\URLBuilder\acquireParameters(), ilFileVersionsGUI\CMD_DEFAULT, ILIAS\File\Versions\Table\Table\getURI(), and ilFileVersionsGUI\HIST_ID.

Referenced by ILIAS\File\Versions\Table\Table\__construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrlInterface ILIAS\File\Versions\Table\Table::$ctrl
private

Definition at line 37 of file Table.php.

◆ $data_factory

DataFactory ILIAS\File\Versions\Table\Table::$data_factory
private

Definition at line 42 of file Table.php.

Referenced by ILIAS\File\Versions\Table\Table\initColumns().

◆ $http

ILIAS HTTP Services ILIAS\File\Versions\Table\Table::$http
private

Definition at line 41 of file Table.php.

◆ $id_token

URLBuilderToken ILIAS\File\Versions\Table\Table::$id_token
private

◆ $lng

ilLanguage ILIAS\File\Versions\Table\Table::$lng
private

Definition at line 38 of file Table.php.

◆ $ui_factory

UIFactory ILIAS\File\Versions\Table\Table::$ui_factory
private

Definition at line 35 of file Table.php.

◆ $ui_renderer

UIRenderer ILIAS\File\Versions\Table\Table::$ui_renderer
private

Definition at line 36 of file Table.php.

◆ $url_builder

URLBuilder ILIAS\File\Versions\Table\Table::$url_builder
private

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