ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
class.ilMDAnnotation.php
Go to the documentation of this file.
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
31
include_once
'class.ilMDBase.php'
;
32
33
class
ilMDAnnotation
extends
ilMDBase
34
{
35
// SET/GET
36
public
function
setEntity
($a_entity)
37
{
38
$this->entity = $a_entity;
39
}
40
public
function
getEntity
()
41
{
42
return
$this->entity;
43
}
44
public
function
setDate
($a_date)
45
{
46
$this->date = $a_date;
47
}
48
public
function
getDate
()
49
{
50
return
$this->date;
51
}
52
public
function
setDescription
($a_desc)
53
{
54
$this->description = $a_desc;
55
}
56
public
function
getDescription
()
57
{
58
return
$this->description
;
59
}
60
public
function
setDescriptionLanguage
($lng_obj)
61
{
62
if
(is_object($lng_obj)) {
63
$this->description_language = &$lng_obj;
64
}
65
}
66
public
function
&
getDescriptionLanguage
()
67
{
68
return
$this->description_language;
69
}
70
public
function
getDescriptionLanguageCode
()
71
{
72
if
(is_object($this->description_language)) {
73
return
$this->description_language->getLanguageCode();
74
}
75
return
false
;
76
}
77
78
public
function
save
()
79
{
80
if
($this->db->autoExecute(
81
'il_meta_annotation'
,
82
$this->__getFields(),
83
ilDBConstants::AUTOQUERY_INSERT
84
)) {
85
$this->
setMetaId
($this->db->getLastInsertId());
86
87
return
$this->
getMetaId
();
88
}
89
return
false
;
90
}
91
92
public
function
update
()
93
{
94
global
$ilDB
;
95
96
if
($this->
getMetaId
()) {
97
if
($this->db->autoExecute(
98
'il_meta_annotation'
,
99
$this->__getFields(),
100
ilDBConstants::AUTOQUERY_UPDATE
,
101
"meta_annotation_id = "
. $ilDB->quote($this->
getMetaId
())
102
)) {
103
return
true
;
104
}
105
}
106
return
false
;
107
}
108
109
public
function
delete
()
110
{
111
global
$ilDB
;
112
113
if
($this->
getMetaId
()) {
114
$query
=
"DELETE FROM il_meta_annotation "
.
115
"WHERE meta_annotation_id = "
. $ilDB->quote($this->
getMetaId
());
116
117
$this->db->query(
$query
);
118
119
return
true
;
120
}
121
return
false
;
122
}
123
124
125
public
function
__getFields
()
126
{
127
return
array(
'rbac_id'
=> $this->
getRBACId
(),
128
'obj_id'
=> $this->
getObjId
(),
129
'obj_type'
=>
ilUtil::prepareDBString
($this->
getObjType
()),
130
'entity'
=>
ilUtil::prepareDBString
($this->
getEntity
()),
131
'date'
=>
ilUtil::prepareDBString
($this->
getDate
()),
132
'description'
=>
ilUtil::prepareDBString
($this->
getDescription
()),
133
'description_language'
=>
ilUtil::prepareDBString
($this->
getDescriptionLanguageCode
()));
134
}
135
136
public
function
read
()
137
{
138
global
$ilDB
;
139
140
include_once
'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php'
;
141
142
if
($this->
getMetaId
()) {
143
$query
=
"SELECT * FROM il_meta_annotation "
.
144
"WHERE meta_annotation_id = "
. $ilDB->quote($this->
getMetaId
());
145
146
$res
= $this->db->query(
$query
);
147
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
148
$this->
setRBACId
(
$row
->rbac_id);
149
$this->
setObjId
(
$row
->obj_id);
150
$this->
setObjType
(
$row
->obj_type);
151
$this->
setEntity
(
ilUtil::stripSlashes
(
$row
->entity));
152
$this->
setDate
(
ilUtil::stripSlashes
(
$row
->date));
153
$this->
setDescription
(
ilUtil::stripSlashes
(
$row
->description));
154
$this->description_language =
new
ilMDLanguageItem
(
$row
->description_language);
155
}
156
}
157
return
true
;
158
}
159
160
/*
161
* XML Export of all meta data
162
* @param object (xml writer) see class.ilMD2XML.php
163
*
164
*/
165
public
function
toXML
(&$writer)
166
{
167
$writer->xmlStartTag(
'Annotation'
);
168
$writer->xmlElement(
'Entity'
, null, $this->
getEntity
());
169
$writer->xmlElement(
'Date'
, null, $this->
getDate
());
170
$writer->xmlElement(
'Description'
, array(
'Language'
=> $this->
getDescriptionLanguageCode
()), $this->
getDescription
());
171
$writer->xmlEndTag(
'Annotation'
);
172
}
173
174
175
176
// STATIC
177
public
function
_getIds
($a_rbac_id, $a_obj_id)
178
{
179
global
$ilDB
;
180
181
$query
=
"SELECT meta_annotation_id FROM il_meta_annotation "
.
182
"WHERE rbac_id = "
. $ilDB->quote($a_rbac_id) .
" "
.
183
"AND obj_id = "
. $ilDB->quote($a_obj_id);
184
185
186
$res
= $ilDB->query(
$query
);
187
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
188
$ids[] =
$row
->meta_annotation_id;
189
}
190
return
$ids ? $ids : array();
191
}
192
}
ilMDBase\setObjType
setObjType($a_type)
Definition:
class.ilMDBase.php:109
$description
$description
Definition:
no_cookie.tpl.php:7
ilMDAnnotation\getDate
getDate()
Definition:
class.ilMDAnnotation.php:48
ilMDAnnotation\getDescription
getDescription()
Definition:
class.ilMDAnnotation.php:56
ilDBConstants\AUTOQUERY_INSERT
const AUTOQUERY_INSERT
Definition:
class.ilDBConstants.php:57
ilMDAnnotation\update
update()
Definition:
class.ilMDAnnotation.php:92
ilMDBase\getRBACId
getRBACId()
Definition:
class.ilMDBase.php:97
ilMDAnnotation\save
save()
Definition:
class.ilMDAnnotation.php:78
ilMDAnnotation\__getFields
__getFields()
Definition:
class.ilMDAnnotation.php:125
ilMDAnnotation\setEntity
setEntity($a_entity)
Definition:
class.ilMDAnnotation.php:36
ilMDAnnotation\toXML
toXML(&$writer)
Definition:
class.ilMDAnnotation.php:165
ilMDBase\setMetaId
setMetaId($a_meta_id, $a_read_data=true)
Definition:
class.ilMDBase.php:117
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
ilMDAnnotation\read
read()
Definition:
class.ilMDAnnotation.php:136
ilMDLanguageItem
Definition:
class.ilMDLanguageItem.php:32
ilMDBase\setObjId
setObjId($a_id)
Definition:
class.ilMDBase.php:101
ilMDBase\setRBACId
setRBACId($a_id)
Definition:
class.ilMDBase.php:93
ilMDAnnotation\getDescriptionLanguageCode
getDescriptionLanguageCode()
Definition:
class.ilMDAnnotation.php:70
$query
$query
Definition:
proxy_ylocal.php:13
ilMDAnnotation
Definition:
class.ilMDAnnotation.php:33
ilUtil\stripSlashes
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Definition:
class.ilUtil.php:2406
ilMDAnnotation\setDate
setDate($a_date)
Definition:
class.ilMDAnnotation.php:44
ilMDAnnotation\_getIds
_getIds($a_rbac_id, $a_obj_id)
Definition:
class.ilMDAnnotation.php:177
$row
$row
Definition:
migrateto20.php:360
ilMDAnnotation\setDescription
setDescription($a_desc)
Definition:
class.ilMDAnnotation.php:52
ilMDBase\getMetaId
getMetaId()
Definition:
class.ilMDBase.php:125
ilMDBase\getObjId
getObjId()
Definition:
class.ilMDBase.php:105
ilUtil\prepareDBString
static prepareDBString($a_str)
prepare a string for db writing (insert/update)
Definition:
class.ilUtil.php:2871
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
ilMDAnnotation\getEntity
getEntity()
Definition:
class.ilMDAnnotation.php:40
php
ilMDBase\getObjType
getObjType()
Definition:
class.ilMDBase.php:113
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
ilMDBase
Definition:
class.ilMDBase.php:32
ilDBConstants\AUTOQUERY_UPDATE
const AUTOQUERY_UPDATE
Definition:
class.ilDBConstants.php:58
ilMDAnnotation\setDescriptionLanguage
setDescriptionLanguage($lng_obj)
Definition:
class.ilMDAnnotation.php:60
ilMDAnnotation\getDescriptionLanguage
& getDescriptionLanguage()
Definition:
class.ilMDAnnotation.php:66
Services
Migration
DBUpdate_426
classes
class.ilMDAnnotation.php
Generated on Thu Feb 27 2025 19:02:00 for ILIAS by
1.8.13 (using
Doxyfile
)