|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Icybee package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Olivier Laviale <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Icybee\Modules\Files\Block; |
|
13
|
|
|
|
|
14
|
|
|
use Brickrouge\Document; |
|
15
|
|
|
|
|
16
|
|
|
use Icybee\Modules\Files as Root; |
|
17
|
|
|
use Icybee\Modules\Files\File; |
|
18
|
|
|
use Icybee\Modules\Files\Module; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* A block to manage files. |
|
22
|
|
|
*/ |
|
23
|
|
|
class ManageBlock extends \Icybee\Modules\Nodes\Block\ManageBlock |
|
24
|
|
|
{ |
|
25
|
|
|
static protected function add_assets(Document $document) |
|
26
|
|
|
{ |
|
27
|
|
|
parent::add_assets($document); |
|
28
|
|
|
|
|
29
|
|
|
$document->css->add(Root\DIR . '/public/manage.css'); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
public function __construct(Module $module, array $attributes) |
|
33
|
|
|
{ |
|
34
|
|
|
parent::__construct($module, $attributes + [ |
|
35
|
|
|
|
|
36
|
|
|
self::T_COLUMNS_ORDER => [ 'title', 'size', 'download', 'is_online', 'uid', 'mime', 'updated_at' ] |
|
37
|
|
|
|
|
38
|
|
|
]); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Adds the following columns: |
|
43
|
|
|
* |
|
44
|
|
|
* - `mime`: An instance of {@link ManageBlock\MimeColumn}. |
|
45
|
|
|
* - `size`: An instance of {@link ManageBlock\SizeColumn}. |
|
46
|
|
|
* - `download`: An instance of {@link ManageBlock\DownloadColumn}. |
|
47
|
|
|
* |
|
48
|
|
|
* @return array |
|
49
|
|
|
*/ |
|
50
|
|
|
protected function get_available_columns() |
|
51
|
|
|
{ |
|
52
|
|
|
return array_merge(parent::get_available_columns(), [ |
|
53
|
|
|
|
|
54
|
|
|
File::MIME => ManageBlock\MimeColumn::class, |
|
55
|
|
|
File::SIZE => ManageBlock\SizeColumn::class, |
|
56
|
|
|
'download' => ManageBlock\DownloadColumn::class |
|
57
|
|
|
|
|
58
|
|
|
]); |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|