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 $member |
||
103 | * @param array $context |
||
104 | * @return bool |
||
105 | */ |
||
106 | public function canCreate($member = null, $context = []) |
||
110 | |||
111 | /** |
||
112 | * @param Member |
||
113 | * |
||
114 | * @return boolean|string |
||
115 | */ |
||
116 | public function canView($member = null) |
||
124 | |||
125 | /** |
||
126 | * @param Member |
||
127 | * |
||
128 | * @return boolean|string |
||
129 | */ |
||
130 | public function canEdit($member = null) |
||
138 | |||
139 | /** |
||
140 | * @param Member |
||
141 | * |
||
142 | * @return boolean|string |
||
143 | */ |
||
144 | public function canDelete($member = null) |
||
152 | |||
153 | /** |
||
154 | * Get the share link of the form |
||
155 | * |
||
156 | * @return string |
||
157 | * @throws \Exception |
||
158 | */ |
||
159 | public function getPartialLink() |
||
174 | |||
175 | /** |
||
176 | * Get the unique token for the share link |
||
177 | * |
||
178 | * @return bool|string|null |
||
179 | * @throws \Exception |
||
180 | */ |
||
181 | protected function getPartialToken() |
||
191 | |||
192 | /** |
||
193 | * Generate a new token |
||
194 | * |
||
195 | * @return bool|string |
||
196 | * @throws \Exception |
||
197 | */ |
||
198 | protected function generateToken() |
||
204 | |||
205 | /** |
||
206 | * Generate a key based on the share token salt |
||
207 | * |
||
208 | * @param string $token |
||
209 | * @return mixed |
||
210 | */ |
||
211 | public function generateKey($token) |
||
215 | |||
216 | /** |
||
217 | * Get the partial fields in array |
||
218 | * |
||
219 | * @return array |
||
220 | */ |
||
221 | public function getFieldList() |
||
232 | } |
||
233 |