Issues (44)

src/FileAccessHistory.php (3 issues)

1
<?php
2
3
namespace Epesi\FileStorage;
4
5
use Epesi\Core\System\Modules\ModuleView;
0 ignored issues
show
The type Epesi\Core\System\Modules\ModuleView was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Epesi\FileStorage\View\FileView;
7
use Epesi\Core\Layout\View\ActionBar;
0 ignored issues
show
The type Epesi\Core\Layout\View\ActionBar was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Epesi\FileStorage\Models\FileAccessLog;
9
use atk4\core\SessionTrait;
10
11
class FileAccessHistory extends ModuleView
12
{
13
	use SessionTrait;
14
	
15
	protected $label = 'File Access History';
16
	
17
	protected $fileId;
18
	
19
	public function body()
20
	{
21
		ActionBar::addItemButton('back')->link(url()->previous());
22
		
23
		$this->fileId = $this->stickyGet('id', $this->recall('fileId'));
24
		
25
		$this->memorize('fileId', $this->fileId);
26
		
27
		$this->displayFileDetails();
28
		
29
		$this->displayFileAccessHistory();
30
	}
31
	
32
	public function displayFileDetails()
33
	{
34
		$this->add(['View', ['ui' => 'segment']])->add([new FileView($this->fileId), 'disableActions' => 'history']);
35
	}
36
	
37
	public function displayFileAccessHistory()
38
	{	
39
		$grid = $this->add([
40
				'CRUD',
41
				'quickSearch' => [
42
						'accessed_by_user', 'action', 'ip_address', 'host_name'
43
				],
44
		        'ipp' => 10
45
		]);
46
47
		$grid->addItemsPerPageSelector([10, 25, 50, 100], __('Items per page') . ':');
0 ignored issues
show
Are you sure __('Items per page') of type array|string can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

47
		$grid->addItemsPerPageSelector([10, 25, 50, 100], /** @scrutinizer ignore-type */ __('Items per page') . ':');
Loading history...
48
49
		$grid->setModel(FileAccessLog::create(['read_only' => true])->addCondition('file_id', $this->fileId)->setOrder('accessed_at', 'desc'));
50
51
		$grid->addFilterColumn();
52
	}
53
}
54