19 declare(strict_types=1);
46 protected bool $is_editable =
false 48 $this->
setId(
'mount_instructions_documents');
57 foreach ($columns as $index =>
$column) {
62 isset($column[
'width']) ? $column[
'width'] :
'',
63 isset($column[
'is_checkbox']) ? (
bool) $column[
'is_checkbox'] :
false 68 $this->
setTitle($this->
lng->txt(
'webdav_tbl_docs_title'));
69 $this->
setFormAction($this->
ctrl->getFormAction($this->getParentObject(), $command));
77 $this->
setRowTemplate(
'tpl.webdav_documents_row.html',
'components/ILIAS/WebDAV');
79 if ($this->is_editable) {
98 $optional_columns = array_filter(
104 foreach ($optional_columns as
$column) {
105 $columns[$column[
'field']] =
$column;
114 if (array_key_exists($index, $column_definition)) {
115 $column = $column_definition[$index];
121 is_array($this->visible_optional_columns) &&
122 array_key_exists(
$column[
'field'], $this->visible_optional_columns)
131 final protected function fillRow(array $row): void
138 $this->tpl->setCurrentBlock(
'column');
141 $this->tpl->touchBlock(
'column');
143 $this->tpl->setVariable(
'COLUMN_VALUE', $value);
146 $this->tpl->parseCurrentBlock();
157 'field' =>
'sorting',
158 'txt' => $this->
lng->txt(
'meta_order',
'meta'),
167 'txt' => $this->
lng->txt(
'webdav_tbl_docs_head_title'),
175 'field' =>
'creation_ts',
176 'txt' => $this->
lng->txt(
'created'),
183 'field' =>
'modification_ts',
184 'txt' => $this->
lng->txt(
'last_change'),
191 'field' =>
'language',
192 'txt' => $this->
lng->txt(
'language'),
198 if ($this->is_editable) {
200 'field' =>
'actions',
201 'txt' => $this->
lng->txt(
'actions'),
252 foreach ($data[
'items'] as $key => $document) {
253 $data[
'items'][$key] = [
254 'id' => $document->getId(),
255 'title' => $document->getTitle(),
256 'creation_ts' => $document->getCreationTs(),
257 'modification_ts' => $document->getModificationTs(),
258 'raw_text' => $document->getUploadedInstructions(),
259 'processed_text' => $document->getProcessedInstructions(),
260 'language' => $document->getLanguage(),
267 $function =
'format' . ucfirst($column);
268 if (method_exists($this, $function)) {
269 return $this->{$function}(
$column, $row);
271 if (in_array($column, [
'creation_ts',
'modification_ts'])) {
275 return trim((
string) $row[$column]);
280 if (!$this->is_editable) {
286 $edit_btn = $this->ui_factory
289 $this->
lng->txt(
'edit'),
293 $delete_modal = $this->ui_factory
296 $this->
lng->txt(
'webdav_doc_delete'),
297 $this->
lng->txt(
'webdav_sure_delete_documents_s') .
' ' . $row[
'title'],
301 $delete_btn = $this->ui_factory
303 ->shy($this->
lng->txt(
'delete'),
'#')
304 ->withOnClick($delete_modal->getShowSignal());
306 $this->ui_components[] = $delete_modal;
310 $drop_down = $this->ui_factory
312 ->standard([$edit_btn, $delete_btn])
313 ->withLabel($this->
lng->txt(
'actions'));
315 return $this->ui_renderer->render($drop_down);
320 if ($row[
'processed_text'] ==
null) {
321 $row[
'processed_text'] =
'';
325 $url = $uri_builder->getUriToMountInstructionModalByLanguage($row[
'language']);
326 $title_link = $this->ui_factory
328 ->shy($row[$column],
'#')
329 ->withAdditionalOnLoadCode(fn(
$id):
string =>
"$('#$id').click(function(){ triggerWebDAVModal('$url');});");
331 return $this->ui_renderer->render([$title_link]);
336 $value = strval(($this->i++) * $this->factor);
337 if (!$this->is_editable) {
342 $sorting_field->setValue($value);
343 $sorting_field->setMaxLength(4);
344 $sorting_field->setSize(2);
346 return $sorting_field->render();
351 return parent::getHTML() . $this->ui_renderer->render($this->ui_components);
isColumnVisible(int $index)
__construct(ilWebDAVMountInstructionsUploadGUI $parent_obj, protected ilWebDAVUriBuilder $webdav_uri_builder, string $command, protected Factory $ui_factory, protected Renderer $ui_renderer, protected RequestInterface $request, protected bool $is_editable=false)
ilWebDAVMountInstructionsTableDataProvider $provider
static maybeRenderWebDAVModalInGlobalTpl()
setFormAction(string $a_form_action, bool $a_multipart=false)
preProcessData(array &$data)
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
formatTitle(string $column, array $row)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
formatActions(string $column, array $row)
formatSorting(string $column, array $row)
setFormName(string $a_name="")
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
resetOffset(bool $a_in_determination=false)
setExternalSorting(bool $a_val)
setDefaultOrderField(string $a_defaultorderfield)
This is how the factory for UI elements looks.
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
getExternalSegmentation()
setProvider(ilWebDAVMountInstructionsTableDataProvider $provider)
setDefaultOrderDirection(string $a_defaultorderdirection)
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
determineSelectedFilters()
__construct(Container $dic, ilPlugin $plugin)
array $visible_optional_columns
setLimit(int $a_limit=0, int $a_default_limit=0)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
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)
int $num_rendered_criteria
formatCellValue(string $column, array $row)
determineOffsetAndOrder(bool $a_omit_offset=false)
setMaxCount(int $a_max_count)
set max.
setExternalSegmentation(bool $a_val)