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/classes/SeminarCategories.php | |
| parent | da0022e5c1abbf9825ae76debaabdff7e8623bb4 (diff) | |
| parent | 97a188592c679890a25c37ab78463add76a52ff7 (diff) | |
Merge branch 'main' into issue-3911issue-3911
Diffstat (limited to 'lib/classes/SeminarCategories.php')
| -rw-r--r-- | lib/classes/SeminarCategories.php | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/lib/classes/SeminarCategories.php b/lib/classes/SeminarCategories.php new file mode 100644 index 0000000..25eb4c1 --- /dev/null +++ b/lib/classes/SeminarCategories.php @@ -0,0 +1,138 @@ +<?php +# Lifter007: TODO +# Lifter003: TODO +# Lifter010: TODO +/** + * SeminarCategories.php + * + * encapsulates configuration settings for courses from config.inc.php + * aka $SEM_CLASS, $SEM_TYPE, $UPLOAD_TYPES + * + * @author André Noack <noack@data-quest>, Suchi & Berg GmbH <info@data-quest.de> + * @access public + * @package core + */ +// +---------------------------------------------------------------------------+ +// This file is part of Stud.IP +// SeminarCategories.php +// +// Copyright (C) 2008 André Noack <noack@data-quest>, data-quest GmbH <info@data-quest.de> +// +---------------------------------------------------------------------------+ +// 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 any later version. +// +---------------------------------------------------------------------------+ +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +---------------------------------------------------------------------------+ + +class SeminarCategories { + + private static $seminar_categories = []; + + private $sem_class_data = []; + private $sem_type_data = []; + + /** + * Enter description here... + * + * @param String $id + * @return Array + */ + public static function Get($id) + { + if (empty(self::$seminar_categories[$id])) { + $cat = new SeminarCategories($id); + if ($cat->id !== false) { + self::$seminar_categories[$id] = $cat; + } else { + self::$seminar_categories[$id] = false; + } + } + return self::$seminar_categories[$id]; + } + + /** + * Enter description here... + * + * @return Array + */ + public static function GetAll(){ + $ret = []; + foreach($GLOBALS['SEM_CLASS'] as $id => $sem_class){ + $ret[] = self::get($id); + } + return $ret; + } + + /** + * Enter description here... + * + * @param String $id + * @return String + */ + public static function GetByTypeId($id){ + return self::Get($GLOBALS['SEM_TYPE'][$id]['class']); + } + + /** + * Enter description here... + * + * @param String $seminar_id + * @return SeminarCategories + */ + public static function GetBySeminarId($seminar_id){ + return self::GetByTypeId(Seminar::GetInstance($seminar_id)->status); + } + + /** + * Enter description here... + * + * @param String $sem_class_id + */ + private function __construct($sem_class_id) { + if(isset($GLOBALS['SEM_CLASS'][$sem_class_id])){ + $this->sem_class_data = $GLOBALS['SEM_CLASS'][$sem_class_id]; + $this->sem_class_data['id'] = $sem_class_id; + foreach($GLOBALS['SEM_TYPE'] as $type_id => $type_data){ + if($type_data['class'] == $sem_class_id) { + $this->sem_type_data[$type_id] = $type_data['name']; + } + } + } + } + + /** + * Enter description here... + * + * @param String $type_id + * @return String + */ + public function getNameOfType($type_id){ + return isset($this->sem_type_data[$type_id]) ? $this->sem_type_data[$type_id] : ''; + } + + /** + * Enter description here... + * + * @return Array + */ + public function getTypes(){ + return $this->sem_type_data; + } + + public function __get($attribute){ + if(isset($this->sem_class_data[$attribute])){ + return $this->sem_class_data[$attribute]; + } else { + return false; + } + } +} +?> |
