ILIAS  release_8 Revision v8.24
class.ilMDBase.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4/*
5 +-----------------------------------------------------------------------------+
6 | ILIAS open source |
7 +-----------------------------------------------------------------------------+
8 | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
9 | |
10 | This program is free software; you can redistribute it and/or |
11 | modify it under the terms of the GNU General Public License |
12 | as published by the Free Software Foundation; either version 2 |
13 | of the License, or (at your option) any later version. |
14 | |
15 | This program is distributed in the hope that it will be useful, |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 | GNU General Public License for more details. |
19 | |
20 | You should have received a copy of the GNU General Public License |
21 | along with this program; if not, write to the Free Software |
22 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23 +-----------------------------------------------------------------------------+
24*/
25
32abstract class ilMDBase
33{
39 private int $rbac_id;
40
44 private int $obj_id;
45
49 private string $obj_type;
50
51 private ?int $meta_id = null;
52 private int $parent_id;
53 private string $parent_type;
54
59 private bool $export_mode = false;
60
61 protected ilLogger $log;
62 protected ilDBInterface $db;
63
73 public function __construct(
74 int $a_rbac_id = 0,
75 int $a_obj_id = 0,
76 string $a_type = ''
77 ) {
78 global $DIC;
79
80 $this->db = $DIC->database();
81
82 if ($a_obj_id === 0) {
83 $a_obj_id = $a_rbac_id;
84 }
85
86 $this->log = ilLoggerFactory::getLogger("meta");
87
88 $this->rbac_id = $a_rbac_id;
89 $this->obj_id = $a_obj_id;
90 $this->obj_type = $a_type;
91 }
92
93 abstract public function read(): bool;
94
95 // SET/GET
96 public function setRBACId(int $a_id): void
97 {
98 $this->rbac_id = $a_id;
99 }
100
101 public function getRBACId(): int
102 {
103 return $this->rbac_id;
104 }
105
106 public function setObjId(int $a_id): void
107 {
108 $this->obj_id = $a_id;
109 }
110
111 public function getObjId(): int
112 {
113 return $this->obj_id;
114 }
115
116 public function setObjType(string $a_type): void
117 {
118 $this->obj_type = $a_type;
119 }
120
121 public function getObjType(): string
122 {
123 return $this->obj_type;
124 }
125
126 public function setMetaId(int $a_meta_id, bool $a_read_data = true): void
127 {
128 $this->meta_id = $a_meta_id;
129
130 if ($a_read_data) {
131 $this->read();
132 }
133 }
134
135 public function getMetaId(): ?int
136 {
137 return $this->meta_id;
138 }
139
140 public function setParentType(string $a_parent_type): void
141 {
142 $this->parent_type = $a_parent_type;
143 }
144
145 public function getParentType(): string
146 {
147 return $this->parent_type;
148 }
149
150 public function setParentId(int $a_id): void
151 {
152 $this->parent_id = $a_id;
153 }
154
155 public function getParentId(): int
156 {
157 return $this->parent_id;
158 }
159
160 public function setExportMode(bool $a_export_mode = true): void
161 {
162 $this->export_mode = $a_export_mode;
163 }
164
165 public function getExportMode(): bool
166 {
167 return $this->export_mode;
168 }
169
170 public function validate(): bool
171 {
172 return false;
173 }
174
175 public function update(): bool
176 {
177 return false;
178 }
179
180 public function save(): int
181 {
182 return 0;
183 }
184
185 public function delete(): bool
186 {
187 return false;
188 }
189
190 public function toXML(ilXmlWriter $writer): void
191 {
192 }
193}
static getLogger(string $a_component_id)
Get component logger.
Component logger with individual log levels by component id.
setObjType(string $a_type)
int $rbac_id
object id (NOT ref_id!) of rbac object (e.g for page objects the obj_id of the content object; for me...
setParentType(string $a_parent_type)
string $obj_type
type of the object (e.g st,pg,crs ...)
ilDBInterface $db
bool $export_mode
export mode, if true, first Identifier will be set to ILIAS/il_<INSTALL_ID>_<TYPE>_<ID>
ilLogger $log
__construct(int $a_rbac_id=0, int $a_obj_id=0, string $a_type='')
constructor
setObjId(int $a_id)
int $obj_id
obj_id (e.g for structure objects the obj_id of the structure object)
setExportMode(bool $a_export_mode=true)
toXML(ilXmlWriter $writer)
string $parent_type
setMetaId(int $a_meta_id, bool $a_read_data=true)
setRBACId(int $a_id)
setParentId(int $a_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
Interface ilDBInterface.