1 | <?php |
||
29 | class PartialFormSubmission extends SubmittedForm |
||
30 | { |
||
31 | private static $table_name = 'PartialFormSubmission'; |
||
|
|||
32 | |||
33 | private static $db = [ |
||
34 | 'IsSend' => 'Boolean(false)', |
||
35 | 'TokenSalt' => 'Varchar(16)', |
||
36 | 'Token' => 'Varchar(16)', |
||
37 | ]; |
||
38 | |||
39 | private static $has_one = [ |
||
40 | 'UserDefinedForm' => DataObject::class |
||
41 | ]; |
||
42 | |||
43 | private static $has_many = [ |
||
44 | 'PartialFields' => PartialFieldSubmission::class |
||
45 | ]; |
||
46 | |||
47 | private static $cascade_deletes = [ |
||
48 | 'PartialFields' |
||
49 | ]; |
||
50 | |||
51 | /** |
||
52 | * @var array |
||
53 | */ |
||
54 | private static $summary_fields = [ |
||
55 | 'ID' => 'ID', |
||
56 | 'PartialLink' => 'Link', |
||
57 | 'Created' => 'Created', |
||
58 | 'LastEdited' => 'Last Edited', |
||
59 | ]; |
||
60 | |||
61 | public function getCMSFields() |
||
95 | |||
96 | public function getParent() |
||
100 | |||
101 | /** |
||
102 | * @param Member |
||
103 | * |
||
104 | * @return boolean|string |
||
105 | */ |
||
106 | public function canCreate($member = null, $context = []) |
||
114 | |||
115 | /** |
||
116 | * @param Member |
||
117 | * |
||
118 | * @return boolean|string |
||
119 | */ |
||
120 | public function canView($member = null) |
||
128 | |||
129 | /** |
||
130 | * @param Member |
||
131 | * |
||
132 | * @return boolean|string |
||
133 | */ |
||
134 | public function canEdit($member = null) |
||
142 | |||
143 | /** |
||
144 | * @param Member |
||
145 | * |
||
146 | * @return boolean|string |
||
147 | */ |
||
148 | public function canDelete($member = null) |
||
156 | |||
157 | /** |
||
158 | * Get the share link of the form |
||
159 | * |
||
160 | * @return string |
||
161 | * @throws \Exception |
||
162 | */ |
||
163 | public function getPartialLink() |
||
178 | |||
179 | /** |
||
180 | * Get the unique token for the share link |
||
181 | * |
||
182 | * @return bool|string|null |
||
183 | * @throws \Exception |
||
184 | */ |
||
185 | protected function getPartialToken() |
||
195 | |||
196 | /** |
||
197 | * Generate a new token |
||
198 | * |
||
199 | * @return bool|string |
||
200 | * @throws \Exception |
||
201 | */ |
||
202 | protected function generateToken() |
||
208 | |||
209 | /** |
||
210 | * Generate a key based on the share token salt |
||
211 | * |
||
212 | * @param string $token |
||
213 | * @return mixed |
||
214 | */ |
||
215 | public function generateKey($token) |
||
219 | } |
||
220 |