blob: e2bf1cad081e698cea5c76b9261acd988abddd60 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
<?php
class QuestionnaireAnonymousAnswer extends SimpleORMap implements PrivacyObject
{
protected static function configure($config = [])
{
$config['db_table'] = 'questionnaire_anonymous_answers';
$config['belongs_to']['questionnaire'] = [
'class_name' => Questionnaire::class,
];
parent::configure($config);
}
/**
* Return a storage object (an instance of the StoredUserData class)
* enriched with the available data of a given user.
*
* @return StoredUserData object
*/
public static function exportUserData(StoredUserData $storage)
{
$sorm = self::findBySQL("user_id = ?", [$storage->user_id]);
$user = User::find($storage->user_id);
if ($sorm) {
$field_data = [];
foreach ($sorm as $row) {
$field_data[] = $row->toRawArray();
}
if ($field_data) {
$storage->addTabularData(
_('Fragebögen anonyme Antworten'),
'questionnaire_anonymous_answers',
$field_data,
$user
);
}
}
return $storage;
}
}
|