ILIAS  trunk Revision v11.0_alpha-1753-gb21ca8c4367
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilMDBase.php
Go to the documentation of this file.
1 <?php
2 
3 declare(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 
33 abstract class ilMDBase
34 {
40  private int $rbac_id;
41 
45  private int $obj_id;
46 
50  private string $obj_type;
51 
52  private ?int $meta_id = null;
53  private int $parent_id;
54  private string $parent_type;
55 
60  private bool $export_mode = false;
61 
62  protected ilLogger $log;
63  protected ilDBInterface $db;
64 
74  public function __construct(
75  int $a_rbac_id = 0,
76  int $a_obj_id = 0,
77  string $a_type = ''
78  ) {
79  global $DIC;
80 
81  $this->db = $DIC->database();
82 
83  if ($a_obj_id === 0) {
84  $a_obj_id = $a_rbac_id;
85  }
86 
87  $this->log = ilLoggerFactory::getLogger("meta");
88 
89  $this->rbac_id = $a_rbac_id;
90  $this->obj_id = $a_obj_id;
91  $this->obj_type = $a_type;
92  }
93 
94  abstract public function read(): bool;
95 
96  // SET/GET
97  public function setRBACId(int $a_id): void
98  {
99  $this->rbac_id = $a_id;
100  }
101 
102  public function getRBACId(): int
103  {
104  return $this->rbac_id;
105  }
106 
107  public function setObjId(int $a_id): void
108  {
109  $this->obj_id = $a_id;
110  }
111 
112  public function getObjId(): int
113  {
114  return $this->obj_id;
115  }
116 
117  public function setObjType(string $a_type): void
118  {
119  $this->obj_type = $a_type;
120  }
121 
122  public function getObjType(): string
123  {
124  return $this->obj_type;
125  }
126 
127  public function setMetaId(int $a_meta_id, bool $a_read_data = true): void
128  {
129  $this->meta_id = $a_meta_id;
130 
131  if ($a_read_data) {
132  $this->read();
133  }
134  }
135 
136  public function getMetaId(): ?int
137  {
138  return $this->meta_id;
139  }
140 
141  public function setParentType(string $a_parent_type): void
142  {
143  $this->parent_type = $a_parent_type;
144  }
145 
146  public function getParentType(): string
147  {
148  return $this->parent_type;
149  }
150 
151  public function setParentId(int $a_id): void
152  {
153  $this->parent_id = $a_id;
154  }
155 
156  public function getParentId(): int
157  {
158  return $this->parent_id;
159  }
160 
161  public function setExportMode(bool $a_export_mode = true): void
162  {
163  $this->export_mode = $a_export_mode;
164  }
165 
166  public function getExportMode(): bool
167  {
168  return $this->export_mode;
169  }
170 
171  public function validate(): bool
172  {
173  return false;
174  }
175 
176  public function update(): bool
177  {
178  return false;
179  }
180 
181  public function save(): int
182  {
183  return 0;
184  }
185 
186  public function delete(): bool
187  {
188  return false;
189  }
190 
191  public function toXML(ilXmlWriter $writer): void
192  {
193  }
194 }
ilLogger $log
string $parent_type
static getLogger(string $a_component_id)
Get component logger.
bool $export_mode
export mode, if true, first Identifier will be set to ILIAS/il_<INSTALL_ID>_<TYPE>_<ID> ...
setRBACId(int $a_id)
ilDBInterface $db
__construct(int $a_rbac_id=0, int $a_obj_id=0, string $a_type='')
constructor
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setObjId(int $a_id)
int $obj_id
obj_id (e.g for structure objects the obj_id of the structure object)
global $DIC
Definition: shib_login.php:22
setExportMode(bool $a_export_mode=true)
setParentId(int $a_id)
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...
string $obj_type
type of the object (e.g st,pg,crs ...)
setParentType(string $a_parent_type)
setMetaId(int $a_meta_id, bool $a_read_data=true)
toXML(ilXmlWriter $writer)
setObjType(string $a_type)