1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Epesi\FileStorage; |
4
|
|
|
|
5
|
|
|
use Epesi\Core\System\Modules\ModuleView; |
|
|
|
|
6
|
|
|
use Epesi\FileStorage\Seeds\FileView; |
7
|
|
|
use Epesi\Core\Layout\Seeds\ActionBar; |
8
|
|
|
use Epesi\FileStorage\Models\FileAccessLog; |
9
|
|
|
use atk4\ui\GridFilterPlugin; |
|
|
|
|
10
|
|
|
use atk4\core\SessionTrait; |
11
|
|
|
|
12
|
|
|
class FileAccessHistory extends ModuleView |
13
|
|
|
{ |
14
|
|
|
use SessionTrait; |
15
|
|
|
|
16
|
|
|
protected $label = 'File Access History'; |
17
|
|
|
|
18
|
|
|
protected $fileId; |
19
|
|
|
|
20
|
|
|
public function body() |
21
|
|
|
{ |
22
|
|
|
ActionBar::addButton('back')->link(url()->previous()); |
23
|
|
|
|
24
|
|
|
$this->fileId = $this->stickyGet('id', $this->recall('fileId')); |
25
|
|
|
|
26
|
|
|
$this->memorize('fileId', $this->fileId); |
27
|
|
|
|
28
|
|
|
$this->displayFileDetails(); |
29
|
|
|
|
30
|
|
|
$this->displayFileAccessHistory(); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function displayFileDetails() |
34
|
|
|
{ |
35
|
|
|
$this->add(['View', ['ui' => 'segment']])->add([new FileView($this->fileId), 'disableActions' => 'history']); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function displayFileAccessHistory() |
39
|
|
|
{ |
40
|
|
|
$grid = $this->add([ |
41
|
|
|
'CRUD', |
42
|
|
|
'quickSearch' => [ |
43
|
|
|
'accessed_by_user', 'action', 'ip_address', 'host_name' |
44
|
|
|
] |
45
|
|
|
]); |
46
|
|
|
|
47
|
|
|
$grid->addItemsPerPageSelector([10, 25, 50, 100], __('Items per page') . ':'); |
|
|
|
|
48
|
|
|
|
49
|
|
|
$grid->setModel(FileAccessLog::create(['read_only' => true])->addCondition('file_id', $this->stickyGet('id'))->setOrder('accessed_at desc')); |
50
|
|
|
|
51
|
|
|
$grid->setModel(FileAccessLog::create(['read_only' => true])->addCondition('file_id', $this->fileId)->setOrder('accessed_at', 'desc')); |
52
|
|
|
|
53
|
|
|
$grid->addFilterColumn(); |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths