Total Complexity | 6 |
Total Lines | 79 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
8 | class OperationManual extends ProductDoc implements PermissionProvider |
||
9 | { |
||
10 | /** |
||
11 | * @var string |
||
12 | */ |
||
13 | private static $singular_name = 'Operation Manual'; |
||
|
|||
14 | |||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | private static $plural_name = 'OperationManuals'; |
||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | private static $table_name = 'OperationManual'; |
||
24 | |||
25 | /** |
||
26 | * @return FieldList |
||
27 | */ |
||
28 | 1 | public function getCMSFields() |
|
29 | { |
||
30 | 1 | $fields = parent::getCMSFields(); |
|
31 | |||
32 | 1 | $fields->dataFieldByName('Download')->setFolderName('Uploads/Products/OperationManuals'); |
|
33 | |||
34 | 1 | return $fields; |
|
35 | } |
||
36 | |||
37 | /** |
||
38 | * @return array |
||
39 | */ |
||
40 | 1 | public function providePermissions() |
|
41 | { |
||
42 | return array( |
||
43 | 1 | 'Operation_EDIT' => 'Edit Operation Manuals', |
|
44 | 'Operation_DELETE' => 'Delete Operation Manuals', |
||
45 | 'Operation_CREATE' => 'Create Operation Manuals', |
||
46 | ); |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * @param null $member |
||
51 | * |
||
52 | * @return bool|int |
||
53 | */ |
||
54 | 1 | public function canCreate($member = null, $context = []) |
|
55 | { |
||
56 | 1 | return Permission::check('Operation_CREATE', 'any', $member); |
|
57 | } |
||
58 | |||
59 | /** |
||
60 | * @param null $member |
||
61 | * |
||
62 | * @return bool|int |
||
63 | */ |
||
64 | 1 | public function canEdit($member = null, $context = []) |
|
67 | } |
||
68 | |||
69 | /** |
||
70 | * @param null $member |
||
71 | * |
||
72 | * @return bool|int |
||
73 | */ |
||
74 | 1 | public function canDelete($member = null, $context = []) |
|
75 | { |
||
76 | 1 | return Permission::check('Operation_DELETE', 'any', $member); |
|
77 | } |
||
78 | |||
79 | /** |
||
80 | * @param null $member |
||
81 | * |
||
82 | * @return bool |
||
83 | */ |
||
84 | 11 | public function canView($member = null, $context = []) |
|
87 | } |
||
88 | } |
||
89 |