1 | <?php |
||
34 | class PartialFormSubmission extends SubmittedForm |
||
35 | { |
||
36 | private static $table_name = 'PartialFormSubmission'; |
||
|
|||
37 | |||
38 | private static $db = [ |
||
39 | 'IsSend' => 'Boolean(false)', |
||
40 | 'TokenSalt' => 'Varchar(16)', |
||
41 | 'Token' => 'Varchar(16)', |
||
42 | ]; |
||
43 | |||
44 | private static $has_one = [ |
||
45 | 'UserDefinedForm' => DataObject::class |
||
46 | ]; |
||
47 | |||
48 | private static $has_many = [ |
||
49 | 'PartialFields' => PartialFieldSubmission::class, |
||
50 | 'PartialUploads' => PartialFileFieldSubmission::class |
||
51 | ]; |
||
52 | |||
53 | private static $cascade_deletes = [ |
||
54 | 'PartialFields' |
||
55 | ]; |
||
56 | |||
57 | /** |
||
58 | * @var array |
||
59 | */ |
||
60 | private static $summary_fields = [ |
||
61 | 'ID' => 'ID', |
||
62 | 'PartialLink' => 'Link', |
||
63 | 'Created' => 'Created', |
||
64 | 'LastEdited' => 'Last Edited', |
||
65 | ]; |
||
66 | |||
67 | 1 | public function getCMSFields() |
|
116 | |||
117 | 43 | public function getParent() |
|
121 | |||
122 | /** |
||
123 | * @param Member $member |
||
124 | * @param array $context |
||
125 | * @return bool |
||
126 | */ |
||
127 | 1 | public function canCreate($member = null, $context = []) |
|
131 | |||
132 | /** |
||
133 | * @param Member |
||
134 | * |
||
135 | * @return boolean|string |
||
136 | */ |
||
137 | 40 | public function canView($member = null) |
|
145 | |||
146 | /** |
||
147 | * @param Member |
||
148 | * |
||
149 | * @return boolean|string |
||
150 | */ |
||
151 | 3 | public function canEdit($member = null) |
|
159 | |||
160 | /** |
||
161 | * @param Member |
||
162 | * |
||
163 | * @return boolean|string |
||
164 | */ |
||
165 | 3 | public function canDelete($member = null) |
|
173 | |||
174 | /** |
||
175 | * Get the share link of the form |
||
176 | * |
||
177 | * @return string |
||
178 | * @throws Exception |
||
179 | */ |
||
180 | 4 | public function getPartialLink() |
|
195 | |||
196 | /** |
||
197 | * Get the unique token for the share link |
||
198 | * |
||
199 | * @return bool|string|null |
||
200 | * @throws Exception |
||
201 | */ |
||
202 | 5 | protected function getPartialToken() |
|
212 | |||
213 | /** |
||
214 | * Generate a new token |
||
215 | * |
||
216 | * @return bool|string |
||
217 | * @throws Exception |
||
218 | */ |
||
219 | 4 | protected function generateToken() |
|
225 | |||
226 | /** |
||
227 | * Generate a key based on the share token salt |
||
228 | * |
||
229 | * @param string $token |
||
230 | * @return string|bool |
||
231 | */ |
||
232 | 6 | public function generateKey($token) |
|
236 | |||
237 | /** |
||
238 | * Get all partial fields for loading data into the form |
||
239 | * |
||
240 | * @return array |
||
241 | */ |
||
242 | 2 | public function getFields() |
|
249 | } |
||
250 |