1<?php
2/*
3    +-----------------------------------------------------------------------------+
4    | ILIAS open source                                                           |
5    +-----------------------------------------------------------------------------+
6    | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
7    |                                                                             |
8    | This program is free software; you can redistribute it and/or               |
9    | modify it under the terms of the GNU General Public License                 |
10    | as published by the Free Software Foundation; either version 2              |
11    | of the License, or (at your option) any later version.                      |
12    |                                                                             |
13    | This program is distributed in the hope that it will be useful,             |
14    | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
15    | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
16    | GNU General Public License for more details.                                |
17    |                                                                             |
18    | You should have received a copy of the GNU General Public License           |
19    | along with this program; if not, write to the Free Software                 |
20    | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
21    +-----------------------------------------------------------------------------+
22*/
23
24/**
25* Meta Data class
26* always instantiate this class first to set/get single meta data elements
27*
28* @package ilias-core
29* @version $Id$
30*/
31
32class ilMD5295Base
33{
34    /*
35     * object id (NOT ref_id!) of rbac object (e.g for page objects the obj_id
36     * of the content object; for media objects this is set to 0, because their
37     * object id are not assigned to ref ids)
38     */
39    public $rbac_id;
40
41    /*
42     * obj_id (e.g for structure objects the obj_id of the structure object)
43     */
44    public $obj_id;
45
46    /*
47     * type of the object (e.g st,pg,crs ...)
48     */
49    public $obj_type;
50
51    /*
52     * export mode, if true, first Identifier will be
53     * set to ILIAS/il_<INSTALL_ID>_<TYPE>_<ID>
54     */
55    public $export_mode = false;
56
57    /**
58     * @var ilLogger
59     */
60    protected $log;
61
62    /*
63     * constructor
64     *
65     * @param	$a_rbac_id	int		object id (NOT ref_id!) of rbac object (e.g for page objects
66     *								the obj_id of the content object; for media objects this
67     *								is set to 0, because their object id are not assigned to ref ids)
68     * @param	$a_obj_id	int		object id (e.g for structure objects the obj_id of the structure object)
69     * @param	$a_type		string	type of the object (e.g st,pg,crs ...)
70     */
71    public function __construct(
72        $a_rbac_id = 0,
73        $a_obj_id = 0,
74        $a_type = 0
75    ) {
76        global $DIC;
77
78        $ilDB = $DIC['ilDB'];
79
80        if ($a_obj_id == 0) {
81            $a_obj_id = $a_rbac_id;
82        }
83
84        $this->db = $ilDB;
85        $this->log = ilLoggerFactory::getLogger("meta");
86
87        $this->rbac_id = $a_rbac_id;
88        $this->obj_id = $a_obj_id;
89        $this->obj_type = $a_type;
90    }
91
92    // SET/GET
93    public function setRBACId($a_id)
94    {
95        $this->rbac_id = $a_id;
96    }
97    public function getRBACId()
98    {
99        return $this->rbac_id;
100    }
101    public function setObjId($a_id)
102    {
103        $this->obj_id = $a_id;
104    }
105    public function getObjId()
106    {
107        return $this->obj_id;
108    }
109    public function setObjType($a_type)
110    {
111        $this->obj_type = $a_type;
112    }
113    public function getObjType()
114    {
115        return $this->obj_type;
116    }
117    public function setMetaId($a_meta_id, $a_read_data = true)
118    {
119        $this->meta_id = $a_meta_id;
120
121        if ($a_read_data) {
122            $this->read();
123        }
124    }
125    public function getMetaId()
126    {
127        return $this->meta_id;
128    }
129    public function setParentType($a_parent_type)
130    {
131        $this->parent_type = $a_parent_type;
132    }
133    public function getParentType()
134    {
135        return $this->parent_type;
136    }
137    public function setParentId($a_id)
138    {
139        $this->parent_id = $a_id;
140    }
141    public function getParentId()
142    {
143        return $this->parent_id;
144    }
145
146    public function setExportMode($a_export_mode = true)
147    {
148        $this->export_mode = $a_export_mode;
149    }
150
151    public function getExportMode()
152    {
153        return $this->export_mode;
154    }
155
156
157    /*
158     * Should be overwritten in all inherited classes
159     *
160     * @access public
161     * @return bool
162     */
163    public function validate()
164    {
165        return false;
166    }
167
168    /*
169     * Should be overwritten in all inherited classes
170     *
171     * @access public
172     * @return bool
173     */
174    public function update()
175    {
176        return false;
177    }
178
179    /*
180     * Should be overwritten in all inherited classes
181     *
182     * @access public
183     * @return bool
184     */
185    public function save()
186    {
187        return false;
188    }
189    /*
190     * Should be overwritten in all inherited classes
191     *
192     * @access public
193     * @return bool
194     */
195    public function delete()
196    {
197    }
198
199    /*
200     * Should be overwritten in all inherited classes
201     * XML Export of all meta data
202     * @param object (xml writer) see class.ilMD52952XML.php
203     *
204     */
205    public function toXML(&$writer)
206    {
207    }
208}
209