aboutsummaryrefslogtreecommitdiff
path: root/lib/models/CourseMemberNotification.php
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+github@gmail.com>2021-07-22 16:07:19 +0200
committerJan-Hendrik Willms <tleilax+github@gmail.com>2021-07-22 16:19:12 +0200
commita3da1483a9e689846179159355badfec8073dbec (patch)
tree770dcca6bdf5f6f2a11b0e7fcbbeda6919a3fc52 /lib/models/CourseMemberNotification.php
current code from svn, revision 62608
Diffstat (limited to 'lib/models/CourseMemberNotification.php')
-rw-r--r--lib/models/CourseMemberNotification.php61
1 files changed, 61 insertions, 0 deletions
diff --git a/lib/models/CourseMemberNotification.php b/lib/models/CourseMemberNotification.php
new file mode 100644
index 0000000..8436f7d
--- /dev/null
+++ b/lib/models/CourseMemberNotification.php
@@ -0,0 +1,61 @@
+<?php
+/**
+ * CourseMemberNotification.class.php
+ * model class for table seminar_user_notification
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * @author André Noack <noack@data-quest.de>
+ * @copyright 2021 Stud.IP Core-Group
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
+ * @category Stud.IP
+ *
+ * @property string seminar_id database column
+ * @property string user_id database column
+ * @property string notifications database column
+ * @property string mkdate database column
+ * @property string chdate database column
+ * @property User user belongs_to User
+ * @property Course course belongs_to Course
+ */
+class CourseMemberNotification extends SimpleORMap implements PrivacyObject
+{
+ protected static function configure($config = [])
+ {
+ $config['db_table'] = 'seminar_user_notifications';
+ $config['belongs_to']['user'] = [
+ 'class_name' => User::class,
+ 'foreign_key' => 'user_id',
+ ];
+ $config['belongs_to']['course'] = [
+ 'class_name' => Course::class,
+ 'foreign_key' => 'seminar_id',
+ ];
+ $config['serialized_fields']['notification_data'] = 'JSONArrayObject';
+
+ parent::configure($config);
+ }
+
+ /**
+ * Export available data of a given user into a storage object
+ * (an instance of the StoredUserData class) for that user.
+ *
+ * @param StoredUserData $storage object to store data into
+ */
+ public static function exportUserData(StoredUserData $storage)
+ {
+ $sorm = self::findByUser_id($storage->user_id);
+ if ($sorm) {
+ $field_data = [];
+ foreach ($sorm as $row) {
+ $field_data[] = $row->toRawArray();
+ }
+ if ($field_data) {
+ $storage->addTabularData(_('Veranstaltungsbenachrichtigung'), 'seminar_user_notification', $field_data);
+ }
+ }
+ }
+}