19declare(strict_types=1);
28use JetBrains\PhpStorm\NoReturn;
44 protected const string ROW_ID =
"row_ids";
55 protected ilUIServices $ui_services,
56 protected ilHTTPServices $http_services,
59 protected ilDataFactory $data_factory
66 self::TABLE_COL_FILENAME => $this->ui_services->factory()->table()->column()->text(
67 $this->
lng->txt(self::TABLE_COL_FILENAME)
69 self::TABLE_COL_FILESIZE => $this->ui_services->factory()->table()->column()->number(
70 $this->
lng->txt(self::TABLE_COL_FILESIZE)
72 self::TABLE_COL_FILETYPE => $this->ui_services->factory()->table()->column()->text(
73 $this->
lng->txt(self::TABLE_COL_FILETYPE)
80 $this->url_builder =
new URLBuilder($this->data_factory->uri($this->http_services->request()->getUri()->__toString()));
81 list($this->url_builder, $this->action_parameter_token, $this->row_id_token) =
82 $this->url_builder->acquireParameters(
83 [
'datatable', self::TABLE_ID],
84 self::TABLE_ACTION_ID,
88 self::TABLE_ACTION_CONFIRM_DELETE => $this->ui_services->factory()->table()->action()->multi(
89 $this->
lng->txt(self::LNG_TABLE_ACTION_CONFIRM_DELETE),
90 $this->url_builder->withParameter($this->action_parameter_token, self::TABLE_ACTION_CONFIRM_DELETE),
98 if (isset($this->table)) {
101 $this->table = $this->ui_services->factory()->table()->data(
102 $this->data_retrieval,
103 $this->
lng->txt(self::LNG_TABLE_TITLE),
106 ->withId(self::TABLE_ID)
108 ->withRequest($this->http_services->request());
113 $tokens = $this->http_services->wrapper()->query()->retrieve(
114 $this->row_id_token->getName(),
115 $this->refinery->custom()->transformation(fn($v) => $v)
117 return is_array($tokens) ? $tokens : [$tokens];
123 protected function delete(array $ids):
void
125 $this->data_retrieval->deleteFilesByIds($ids);
126 $this->ui_services->mainTemplate()->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
127 $this->
ctrl->redirectByClass(ilObjCourseGUI::class,
'editInfo');
130 #[NoReturn] protected function showDeleteModal(array $ids): void
134 $items[] = $this->ui_services->factory()->modal()->interruptiveItem()->standard(
136 $this->data_retrieval->getFileTitle((
int)
$id)
139 echo($this->ui_services->renderer()->renderAsync([
140 $this->ui_services->factory()->modal()->interruptive(
141 $this->lng->txt(
'confirm'),
142 $this->lng->txt(
'info_delete_sure'),
143 (
string) $this->url_builder
145 $this->action_parameter_token,
146 self::TABLE_ACTION_DELETE
151 )->withAffectedItems($items)
159 if (!$this->http_services->wrapper()->query()->has($this->action_parameter_token->getName())) {
162 $action = $this->http_services->wrapper()->query()->retrieve(
163 $this->action_parameter_token->getName(),
164 $this->refinery->to()->string()
166 $tokens = $this->http_services->wrapper()->query()->retrieve(
167 $this->row_id_token->getName(),
168 $this->refinery->custom()->transformation(fn($v) => $v)
170 $all_entries = ($tokens[0] ??
"") === self::ALL_OBJECTS;
173 $ids = $this->data_retrieval->getAllFileIds();
178 if (is_null($ids[0]) || count($ids) === 0) {
183 $this->showDeleteModal($ids);
194 return $this->ui_services->renderer()->render([$this->table]);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Provides fluid interface to RBAC services.
const string LNG_TABLE_COL_FILETYPE
const string TABLE_COL_FILETYPE
const string LNG_TABLE_COL_FILESIZE
const string LNG_TABLE_TITLE
const string TABLE_COL_FILESIZE
const string TABLE_ACTION_CONFIRM_DELETE
const string TABLE_ACTION_ID
ilURLBuilderToken $row_id_token
const string LNG_TABLE_ACTION_CONFIRM_DELETE
const string LNG_TABLE_COL_FILENAME
const string TABLE_ACTION_DELETE
const string TABLE_COL_FILENAME
ilURLBuilderToken $action_parameter_token
__construct(protected ilCourseInfoFileTableDataRetrieval $data_retrieval, protected ilLanguage $lng, protected ilUIServices $ui_services, protected ilHTTPServices $http_services, protected ilRefineryFactory $refinery, protected ilCtrl $ctrl, protected ilDataFactory $data_factory)
Class ilCtrl provides processing control methods.
This describes a Data Table.