ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
OwnershipManagementTableBuilder.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
29
31{
32 public function __construct(
33 protected InternalDomainService $domain,
34 protected InternalGUIService $gui,
35 protected int $user_id,
36 protected string $title,
37 protected array $objects,
38 protected string $selected_type,
39 object $parent_gui,
40 string $parent_cmd
41 ) {
42 parent::__construct($parent_gui, $parent_cmd);
43 }
44
45 protected function getId(): string
46 {
47 return 'objownmgmt';
48 }
49
50 protected function getTitle(): string
51 {
52 return $this->title;
53 }
54
55 protected function getRetrieval(): RetrievalInterface
56 {
58 $this->domain,
59 $this->user_id,
60 $this->objects,
61 $this->selected_type
62 );
63 }
64
65 protected function transformRow(array $data_row): array
66 {
67 $f = $this->gui->ui()->factory();
68 $refinery = $this->domain->refinery();
69
70 $icon = $f->symbol()->icon()->standard(
71 $data_row['type'],
72 $data_row['title'],
74 );
75
76 return [
77 'id' => $data_row['ref_id'],
78 'icon' => $icon,
79 'title' => $refinery->encode()->htmlSpecialCharsAsEntities()->transform(
80 $data_row['title']
81 ),
82 'path' => $data_row['path'],
83 'type' => $data_row['type'],
84 'readable' => $data_row['readable']
85 ];
86 }
87
88 protected function activeAction(string $action, array $data_row): bool
89 {
90 if (!$data_row['readable']) {
91 return false;
92 }
93
94 if ($action === 'export') {
95 $obj_definition = $this->domain->objectDefinition();
96 $type = $data_row['type'];
97 if (in_array($type, ['crsr', 'catr', 'grpr']) || !$obj_definition->allowExport($type)) {
98 return false;
99 }
100 }
101
102 if ($action === 'show') {
103 return true; // Show action should always be available for readable items
104 }
105
106 if (!method_exists($this->parent_gui, 'isReadOnly')) {
107 return true;
108 }
109
110 return !$this->parent_gui->isReadOnly();
111 }
112
114 {
115 $lng = $this->domain->lng();
116
117 $table = $table
118 ->iconColumn('icon', $lng->txt('type'), false)
119 ->textColumn('title', $lng->txt('title'), true)
120 ->textColumn('path', $lng->txt('path'));
121
123 'show',
124 $lng->txt('show')
125 );
126
128 'move',
129 $lng->txt('move')
130 );
131
133 'changeOwner',
134 $lng->txt('change_owner')
135 );
136
138 'export',
139 $lng->txt('export')
140 );
141
143 'delete',
144 $lng->txt('delete')
145 );
146
147 return $table;
148 }
149}
__construct(protected InternalDomainService $domain, protected InternalGUIService $gui, protected int $user_id, protected string $title, protected array $objects, protected string $selected_type, object $parent_gui, string $parent_cmd)
transformRow(array $data_row)
transform raw data array to table row data array
singleAction(string $action, string $title, bool $async=false)
iconColumn(string $key, string $title, bool $sortable=false)
Refinery Factory $refinery
This describes the specific behavior of an ILIAS standard icon.
Definition: Standard.php:27
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $lng
Definition: privfeed.php:31