|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Dynamic\ProductCatalog\Docs; |
|
4
|
|
|
|
|
5
|
|
|
use SilverStripe\Forms\FieldList; |
|
6
|
|
|
use SilverStripe\Security\Permission; |
|
7
|
|
|
use SilverStripe\Security\PermissionProvider; |
|
8
|
|
|
|
|
9
|
|
|
class CareCleaningDoc extends ProductDoc implements PermissionProvider |
|
10
|
|
|
{ |
|
11
|
|
|
/** |
|
12
|
|
|
* @var string |
|
13
|
|
|
*/ |
|
14
|
|
|
private static $singular_name = 'Care & Cleaning Doc'; |
|
|
|
|
|
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* @var string |
|
18
|
|
|
*/ |
|
19
|
|
|
private static $plural_name = 'Care & Cleaning Docs'; |
|
|
|
|
|
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @var string |
|
23
|
|
|
*/ |
|
24
|
|
|
private static $table_name = 'CareCleaningDoc'; |
|
|
|
|
|
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @return FieldList |
|
28
|
|
|
*/ |
|
29
|
2 |
|
public function getCMSFields() |
|
30
|
|
|
{ |
|
31
|
2 |
|
$fields = parent::getCMSFields(); |
|
32
|
|
|
|
|
33
|
2 |
|
$fields->dataFieldByName('Download')->setFolderName('Uploads/Products/CareCleaningDocs'); |
|
34
|
|
|
|
|
35
|
2 |
|
return $fields; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @return array |
|
40
|
|
|
*/ |
|
41
|
1 |
|
public function providePermissions() |
|
42
|
|
|
{ |
|
43
|
|
|
return array( |
|
44
|
1 |
|
'Care_EDIT' => 'Edit Care and Cleaning Docs', |
|
45
|
|
|
'Care_DELETE' => 'Delete Care and Cleaning Docs', |
|
46
|
|
|
'Care_CREATE' => 'Create Care and Cleaning Docs', |
|
47
|
|
|
); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @param null $member |
|
|
|
|
|
|
52
|
|
|
* |
|
53
|
|
|
* @return bool|int |
|
54
|
|
|
*/ |
|
55
|
1 |
|
public function canCreate($member = null, $context = []) |
|
56
|
|
|
{ |
|
57
|
1 |
|
return Permission::check('Care_CREATE', 'any', $member); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @param null $member |
|
|
|
|
|
|
62
|
|
|
* |
|
63
|
|
|
* @return bool|int |
|
64
|
|
|
*/ |
|
65
|
1 |
|
public function canEdit($member = null, $context = []) |
|
|
|
|
|
|
66
|
|
|
{ |
|
67
|
1 |
|
return Permission::check('Care_EDIT', 'any', $member); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @param null $member |
|
|
|
|
|
|
72
|
|
|
* |
|
73
|
|
|
* @return bool|int |
|
74
|
|
|
*/ |
|
75
|
1 |
|
public function canDelete($member = null, $context = []) |
|
|
|
|
|
|
76
|
|
|
{ |
|
77
|
1 |
|
return Permission::check('Care_DELETE', 'any', $member); |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* @param null $member |
|
|
|
|
|
|
82
|
|
|
* |
|
83
|
|
|
* @return bool |
|
84
|
|
|
*/ |
|
85
|
11 |
|
public function canView($member = null, $context = []) |
|
|
|
|
|
|
86
|
|
|
{ |
|
87
|
11 |
|
return true; |
|
88
|
|
|
} |
|
89
|
|
|
} |
|
90
|
|
|
|