ILIAS  trunk Revision v12.0_alpha-16-g3e876e53c80
class.ilCourseInfoFileTableDataRetrieval.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\UI\Component\Table\DataRetrieval as ilTableDataRetrievalInterface;
22
23class ilCourseInfoFileTableDataRetrieval implements ilTableDataRetrievalInterface
24{
26 protected array $data;
27
28 public function __construct(
29 protected ilObjCourse $course
30 ) {
31 $this->data = [];
32 }
33
34 public function getFileTitle(int $id): string
35 {
36 return $this->data[$id]->getFileName();
37 }
38
39 public function init(): void
40 {
41 if (!count($files = ilCourseFile::_readFilesByCourse($this->course->getId()))) {
42 return;
43 }
44 $this->data = [];
45 foreach ($files as $file) {
46 $this->data[$file->getFileId()] = $file;
47 }
48 }
49
50 public function getRows(
51 \ILIAS\UI\Component\Table\DataRowBuilder $row_builder,
52 array $visible_column_ids,
53 \ILIAS\Data\Range $range,
54 \ILIAS\Data\Order $order,
55 mixed $additional_viewcontrol_data,
56 mixed $filter_data,
57 mixed $additional_parameters
58 ): Generator {
59 foreach ($this->data as $id => $file) {
60 yield $row_builder->buildDataRow(
61 $id . '',
62 [
66 ]
67 );
68 }
69 }
70
74 public function getAllFileIds(): array
75 {
76 return array_keys($this->data);
77 }
78
79 public function deleteFilesByIds(array $ids): void
80 {
81 foreach ($ids as $file_id) {
82 $file = new ilCourseFile((int) $file_id);
83 if ($this->course->getId() == $file->getCourseId()) {
84 $file->delete();
85 }
86 }
87 }
88
89 public function getTotalRowCount(
90 mixed $additional_viewcontrol_data,
91 mixed $filter_data,
92 mixed $additional_parameters
93 ): ?int {
94 return count($this->data);
95 }
96}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static _readFilesByCourse(int $a_course_id)
getRows(\ILIAS\UI\Component\Table\DataRowBuilder $row_builder, array $visible_column_ids, \ILIAS\Data\Range $range, \ILIAS\Data\Order $order, mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
getTotalRowCount(mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
Mainly for the purpose of pagination-support, it is important to know about the total number of recor...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.