ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ 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
global
$ilDB
;
81
82
$fields = $this->
__getFields
();
83
$fields[
'meta_annotation_id'
] =
array
(
'integer'
,$next_id = $ilDB->nextId(
'il_meta_annotation'
));
84
85
if
($this->db->insert(
'il_meta_annotation'
, $fields)) {
86
$this->
setMetaId
($next_id);
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->update(
98
'il_meta_annotation'
,
99
$this->__getFields(),
100
array
(
"meta_annotation_id"
=>
array
(
'integer'
,$this->
getMetaId
()))
101
)) {
102
return
true
;
103
}
104
}
105
return
false
;
106
}
107
108
public
function
delete
()
109
{
110
global
$ilDB
;
111
112
if
($this->
getMetaId
()) {
113
$query
=
"DELETE FROM il_meta_annotation "
.
114
"WHERE meta_annotation_id = "
. $ilDB->quote($this->
getMetaId
(),
'integer'
);
115
$res
= $ilDB->manipulate(
$query
);
116
117
return
true
;
118
}
119
return
false
;
120
}
121
122
123
public
function
__getFields
()
124
{
125
return
array
(
'rbac_id'
=>
array
(
'integer'
,$this->
getRBACId
()),
126
'obj_id'
=>
array
(
'integer'
,$this->
getObjId
()),
127
'obj_type'
=>
array
(
'text'
,$this->
getObjType
()),
128
'entity'
=>
array
(
'clob'
,$this->
getEntity
()),
129
'a_date'
=>
array
(
'clob'
,$this->
getDate
()),
130
'description'
=>
array
(
'clob'
,$this->
getDescription
()),
131
'description_language'
=>
array
(
'text'
,$this->
getDescriptionLanguageCode
()));
132
}
133
134
public
function
read
()
135
{
136
global
$ilDB
;
137
138
include_once
'Services/MetaData/classes/class.ilMDLanguageItem.php'
;
139
140
if
($this->
getMetaId
()) {
141
$query
=
"SELECT * FROM il_meta_annotation "
.
142
"WHERE meta_annotation_id = "
. $ilDB->quote($this->
getMetaId
(),
'integer'
);
143
144
$res
= $this->db->query(
$query
);
145
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
146
$this->
setRBACId
(
$row
->rbac_id);
147
$this->
setObjId
(
$row
->obj_id);
148
$this->
setObjType
(
$row
->obj_type);
149
$this->
setEntity
(
$row
->entity);
150
$this->
setDate
(
$row
->a_date);
151
$this->
setDescription
(
$row
->description);
152
$this->description_language =
new
ilMDLanguageItem
(
$row
->description_language);
153
}
154
}
155
return
true
;
156
}
157
158
/*
159
* XML Export of all meta data
160
* @param object (xml writer) see class.ilMD2XML.php
161
*
162
*/
163
public
function
toXML
(&$writer)
164
{
165
$writer->xmlStartTag(
'Annotation'
);
166
$writer->xmlElement(
'Entity'
, null, $this->
getEntity
());
167
$writer->xmlElement(
'Date'
, null, $this->
getDate
());
168
$writer->xmlElement(
169
'Description'
,
170
array
(
'Language'
=> $this->
getDescriptionLanguageCode
()
171
? $this->
getDescriptionLanguageCode
()
172
:
'en'
),
173
$this->
getDescription
()
174
);
175
$writer->xmlEndTag(
'Annotation'
);
176
}
177
178
179
180
// STATIC
181
public
static
function
_getIds
($a_rbac_id, $a_obj_id)
182
{
183
global
$ilDB
;
184
185
$query
=
"SELECT meta_annotation_id FROM il_meta_annotation "
.
186
"WHERE rbac_id = "
. $ilDB->quote($a_rbac_id,
'integer'
) .
" "
.
187
"AND obj_id = "
. $ilDB->quote($a_obj_id,
'integer'
);
188
189
190
$res
= $ilDB->query(
$query
);
191
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
192
$ids[] =
$row
->meta_annotation_id;
193
}
194
return
$ids ? $ids :
array
();
195
}
196
}
ilMDAnnotation\_getIds
static _getIds($a_rbac_id, $a_obj_id)
Definition:
class.ilMDAnnotation.php:181
ilMDBase\setObjType
setObjType($a_type)
Definition:
class.ilMDBase.php:107
$description
$description
Definition:
no_cookie.tpl.php:7
ilMDAnnotation\getDate
getDate()
Definition:
class.ilMDAnnotation.php:48
ilMDAnnotation\getDescription
getDescription()
Definition:
class.ilMDAnnotation.php:56
ilMDAnnotation\update
update()
Definition:
class.ilMDAnnotation.php:92
ilMDBase\getRBACId
getRBACId()
Definition:
class.ilMDBase.php:95
ilMDAnnotation\save
save()
Definition:
class.ilMDAnnotation.php:78
ilMDAnnotation\__getFields
__getFields()
Definition:
class.ilMDAnnotation.php:123
ilMDAnnotation\setEntity
setEntity($a_entity)
Definition:
class.ilMDAnnotation.php:36
ilMDAnnotation\toXML
toXML(&$writer)
Definition:
class.ilMDAnnotation.php:163
ilMDBase\setMetaId
setMetaId($a_meta_id, $a_read_data=true)
Definition:
class.ilMDBase.php:115
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
ilMDAnnotation\read
read()
Definition:
class.ilMDAnnotation.php:134
ilMDLanguageItem
Definition:
class.ilMDLanguageItem.php:32
ilMDBase\setObjId
setObjId($a_id)
Definition:
class.ilMDBase.php:99
date
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Definition:
31docproperties_write-xls.php:86
ilMDBase\setRBACId
setRBACId($a_id)
Definition:
class.ilMDBase.php:91
ilMDAnnotation\getDescriptionLanguageCode
getDescriptionLanguageCode()
Definition:
class.ilMDAnnotation.php:70
$query
$query
Definition:
proxy_ylocal.php:13
ilMDAnnotation
Definition:
class.ilMDAnnotation.php:33
ilMDAnnotation\setDate
setDate($a_date)
Definition:
class.ilMDAnnotation.php:44
array
Create styles array
The data for the language used.
Definition:
40duplicateStyle.php:19
ilMDAnnotation\setDescription
setDescription($a_desc)
Definition:
class.ilMDAnnotation.php:52
ilMDBase\getMetaId
getMetaId()
Definition:
class.ilMDBase.php:123
ilMDBase\getObjId
getObjId()
Definition:
class.ilMDBase.php:103
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
ilMDAnnotation\getEntity
getEntity()
Definition:
class.ilMDAnnotation.php:40
ilMDBase\getObjType
getObjType()
Definition:
class.ilMDBase.php:111
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
$row
$row
Definition:
10autofilter-selection-1.php:74
ilMDBase
Definition:
class.ilMDBase.php:32
ilMDAnnotation\setDescriptionLanguage
setDescriptionLanguage($lng_obj)
Definition:
class.ilMDAnnotation.php:60
ilMDAnnotation\getDescriptionLanguage
& getDescriptionLanguage()
Definition:
class.ilMDAnnotation.php:66
Services
MetaData
classes
class.ilMDAnnotation.php
Generated on Sat Jan 18 2025 19:01:34 for ILIAS by
1.8.13 (using
Doxyfile
)