19declare(strict_types=1);
26use Psr\Http\Message\RequestInterface;
51 protected RequestInterface $request,
52 protected bool $is_editable =
false
54 $this->
setId(
'mount_instructions_documents');
63 foreach ($columns as $index =>
$column) {
74 $this->
setTitle($this->
lng->txt(
'webdav_tbl_docs_title'));
75 $this->
setFormAction($this->
ctrl->getFormAction($this->getParentObject(), $command));
83 $this->
setRowTemplate(
'tpl.webdav_documents_row.html',
'components/ILIAS/WebDAV');
85 if ($this->is_editable) {
121 if (array_key_exists($index, $column_definition)) {
122 $column = $column_definition[$index];
128 is_array($this->visible_optional_columns) &&
129 array_key_exists(
$column[
'field'], $this->visible_optional_columns)
139 final protected function fillRow(array $row): void
146 $this->tpl->setCurrentBlock(
'column');
149 $this->tpl->touchBlock(
'column');
151 $this->tpl->setVariable(
'COLUMN_VALUE', $value);
154 $this->tpl->parseCurrentBlock();
165 'field' =>
'sorting',
166 'txt' => $this->
lng->txt(
'meta_order',
'meta'),
175 'txt' => $this->
lng->txt(
'webdav_tbl_docs_head_title'),
183 'field' =>
'creation_ts',
184 'txt' => $this->
lng->txt(
'created'),
191 'field' =>
'modification_ts',
192 'txt' => $this->
lng->txt(
'last_change'),
199 'field' =>
'language',
200 'txt' => $this->
lng->txt(
'language'),
206 if ($this->is_editable) {
208 'field' =>
'actions',
209 'txt' => $this->
lng->txt(
'actions'),
260 foreach (
$data[
'items'] as $key => $document) {
261 $data[
'items'][$key] = [
262 'id' => $document->getId(),
263 'title' => $document->getTitle(),
264 'creation_ts' => $document->getCreationTs(),
265 'modification_ts' => $document->getModificationTs(),
266 'raw_text' => $document->getUploadedInstructions(),
267 'processed_text' => $document->getProcessedInstructions(),
268 'language' => $document->getLanguage(),
275 $function =
'format' . ucfirst(
$column);
276 if (method_exists($this, $function)) {
277 return $this->{$function}(
$column, $row);
279 if (in_array(
$column, [
'creation_ts',
'modification_ts'],
true)) {
283 return trim((
string) $row[
$column]);
288 if (!$this->is_editable) {
294 $edit_btn = $this->ui_factory
297 $this->
lng->txt(
'edit'),
298 $this->ctrl->getLinkTarget($this->getParentObject(),
'showEditDocumentForm')
301 $delete_modal = $this->ui_factory
304 $this->
lng->txt(
'webdav_doc_delete'),
305 $this->lng->txt(
'webdav_sure_delete_documents_s') .
' ' . $row[
'title'],
306 $this->ctrl->getFormAction($this->getParentObject(),
'deleteDocument')
309 $delete_btn = $this->ui_factory
311 ->shy($this->
lng->txt(
'delete'),
'#')
312 ->withOnClick($delete_modal->getShowSignal());
314 $this->ui_components[] = $delete_modal;
318 $drop_down = $this->ui_factory
320 ->standard([$edit_btn, $delete_btn])
321 ->withLabel($this->
lng->txt(
'actions'));
323 return $this->ui_renderer->render($drop_down);
328 if ($row[
'processed_text'] ===
null) {
329 $row[
'processed_text'] =
'';
332 $url = $this->webdav_uri_builder->getUriToMountInstructionModalByLanguage($row[
'language']);
333 $title_link = $this->ui_factory
336 ->withAdditionalOnLoadCode(fn(
$id):
string =>
"$('#$id').click(function(){ triggerWebDAVModal('$url');});");
338 return $this->ui_renderer->render([$title_link]);
344 if (!$this->is_editable) {
349 $sorting_field->setValue($value);
350 $sorting_field->setMaxLength(4);
351 $sorting_field->setSize(2);
353 return $sorting_field->render();
359 return parent::getHTML() . $this->ui_renderer->render($this->ui_components);
Builds a Color from either hex- or rgb values.
preProcessData(array &$data)
getSelectableColumns()
Get selectable columns.
formatActions(string $column, array $row)
int $num_rendered_criteria
formatSorting(string $column, array $row)
setProvider(TableDataProvider $provider)
array $visible_optional_columns
TableDataProvider $provider
fillRow(array $row)
Standard Version of Fill Row.
isColumnVisible(int $index)
__construct(UploadGUI $parent_obj, protected UriBuilder $webdav_uri_builder, string $command, protected Factory $ui_factory, protected Renderer $ui_renderer, protected RequestInterface $request, protected bool $is_editable=false)
formatTitle(string $column, array $row)
formatCellValue(string $column, array $row)
static maybeRenderWebDAVModalInGlobalTpl()
@ilCtrl_isCalledBy ILIAS\WebDAV\Mount\UploadGUI: ilObjWebDAVGUI
Class for date presentation.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setLimit(int $a_limit=0, int $a_default_limit=0)
set max.
determineOffsetAndOrder(bool $a_omit_offset=false)
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
setExternalSegmentation(bool $a_val)
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
setFormName(string $a_name="")
setFormAction(string $a_form_action, bool $a_multipart=false)
resetOffset(bool $a_in_determination=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setDefaultOrderField(string $a_defaultorderfield)
getExternalSegmentation()
setExternalSorting(bool $a_val)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setDefaultOrderDirection(string $a_defaultorderdirection)
setData(array $a_data)
Set table data.
determineSelectedFilters()
setMaxCount(int $a_max_count)
set max.
A component is the most general form of an entity in the UI.
This is how the factory for UI elements looks.
An entity that renders components to a string output.
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc