diff options
| author | Philipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de> | 2024-09-24 10:53:31 +0200 |
|---|---|---|
| committer | Philipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de> | 2024-09-24 10:53:31 +0200 |
| commit | 4459dd7917f4d1c34f40bb68f0e991e9c3d53e4c (patch) | |
| tree | 5c07151ae61276d334e88f6309c30d439a85c12e /lib/models/ArchivedCourse.class.php | |
| parent | da0022e5c1abbf9825ae76debaabdff7e8623bb4 (diff) | |
| parent | 97a188592c679890a25c37ab78463add76a52ff7 (diff) | |
Merge branch 'main' into issue-3911issue-3911
Diffstat (limited to 'lib/models/ArchivedCourse.class.php')
| -rw-r--r-- | lib/models/ArchivedCourse.class.php | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/lib/models/ArchivedCourse.class.php b/lib/models/ArchivedCourse.class.php deleted file mode 100644 index 81879af..0000000 --- a/lib/models/ArchivedCourse.class.php +++ /dev/null @@ -1,105 +0,0 @@ -<?php -/** - * ArchivedCourse.class.php - * model class for table archiv - * - * 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 2012 Stud.IP Core-Group - * @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2 - * @category Stud.IP - * - * @property string $id alias column for seminar_id - * @property string $seminar_id database column - * @property string $name database column - * @property string $untertitel database column - * @property string $beschreibung database column - * @property int $start_time database column - * @property string $semester database column - * @property string $heimat_inst_id database column - * @property string $institute database column - * @property string $dozenten database column - * @property string $fakultaet database column - * @property string $dump database column - * @property string $archiv_file_id database column - * @property string $archiv_protected_file_id database column - * @property int $mkdate database column - * @property string $forumdump database column - * @property string|null $wikidump database column - * @property string $studienbereiche database column - * @property string $veranstaltungsnummer database column - * @property SimpleORMapCollection|ArchivedCourseMember[] $members has_many ArchivedCourseMember - * @property Institute $home_institut belongs_to Institute - */ - -class ArchivedCourse extends SimpleORMap implements PrivacyObject -{ - protected static function configure($config = []) - { - $config['db_table'] = 'archiv'; - - $config['has_many']['members'] = [ - 'class_name' => ArchivedCourseMember::class, - 'on_delete' => 'delete', - 'on_store' => 'store', - ]; - $config['belongs_to']['home_institut'] = [ - 'class_name' => Institute::class, - 'foreign_key' => 'heimat_inst_id', - ]; - - $config['registered_callbacks']['after_delete'][] = 'deleteFiles'; - - 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::findThru($storage->user_id, [ - 'thru_table' => 'archiv_user', - 'thru_key' => 'user_id', - 'thru_assoc_key' => 'Seminar_id', - 'assoc_foreign_key' => 'Seminar_id', - ]); - if ($sorm) { - $limit = 'seminar_id name untertitel beschreibung start_time ' - . 'semester heimat_inst_id institute dozenten fakultaet ' - . 'archiv_file_id archiv_protected_file_id mkdate ' - . 'studienbereiche VeranstaltungsNummer'; - $field_data = []; - foreach ($sorm as $row) { - $field_data[] = $row->toRawArray($limit); - } - if ($field_data) { - $storage->addTabularData(_('archivierte Seminare'), 'archiv', $field_data); - } - } - } - - /** - * delete data files belonging to this archived course - * - * @return int number of deleted files - */ - public function deleteFiles() - { - $ok = 0; - if ($this->archiv_file_id) { - $ok += unlink($GLOBALS['ARCHIV_PATH'] . '/' . basename($this->archiv_file_id)); - } - if ($this->archiv_protected_file_id) { - $ok += unlink($GLOBALS['ARCHIV_PATH'] . '/' . basename($this->archiv_protected_file_id)); - } - return $ok; - } -} |
