ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
class.ilMDLocation.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
ilMDLocation
extends
ilMDBase
34
{
35
// SET/GET
36
public
function
setLocation
($a_location)
37
{
38
$this->location = $a_location;
39
}
40
public
function
getLocation
()
41
{
42
return
$this->location
;
43
}
44
public
function
setLocationType
($a_location_type)
45
{
46
$this->location_type = $a_location_type;
47
}
48
public
function
getLocationType
()
49
{
50
return
$this->location_type;
51
}
52
53
public
function
save
()
54
{
55
global
$DIC
;
56
57
$ilDB
= $DIC[
'ilDB'
];
58
59
$fields = $this->
__getFields
();
60
$fields[
'meta_location_id'
] = array(
'integer'
,$next_id =
$ilDB
->nextId(
'il_meta_location'
));
61
62
if
($this->db->insert(
'il_meta_location'
, $fields)) {
63
$this->
setMetaId
($next_id);
64
return
$this->
getMetaId
();
65
}
66
return
false
;
67
}
68
69
public
function
update
()
70
{
71
global
$DIC
;
72
73
$ilDB
= $DIC[
'ilDB'
];
74
75
if
($this->
getMetaId
()) {
76
if
($this->db->update(
77
'il_meta_location'
,
78
$this->__getFields(),
79
array(
"meta_location_id"
=> array(
'integer'
,$this->
getMetaId
()))
80
)) {
81
return
true
;
82
}
83
}
84
return
false
;
85
}
86
87
public
function
delete
()
88
{
89
global
$DIC
;
90
91
$ilDB
= $DIC[
'ilDB'
];
92
93
if
($this->
getMetaId
()) {
94
$query
=
"DELETE FROM il_meta_location "
.
95
"WHERE meta_location_id = "
.
$ilDB
->quote($this->
getMetaId
(),
'integer'
);
96
$res
=
$ilDB
->manipulate(
$query
);
97
98
return
true
;
99
}
100
return
false
;
101
}
102
103
104
public
function
__getFields
()
105
{
106
return
array(
'rbac_id'
=> array(
'integer'
,$this->
getRBACId
()),
107
'obj_id'
=> array(
'integer'
,$this->
getObjId
()),
108
'obj_type'
=> array(
'text'
,$this->
getObjType
()),
109
'parent_type'
=> array(
'text'
,$this->
getParentType
()),
110
'parent_id'
=> array(
'integer'
,$this->
getParentId
()),
111
'location'
=> array(
'text'
,$this->
getLocation
()),
112
'location_type'
=> array(
'text'
,$this->
getLocationType
()));
113
}
114
115
public
function
read
()
116
{
117
global
$DIC
;
118
119
$ilDB
= $DIC[
'ilDB'
];
120
121
include_once
'Services/MetaData/classes/class.ilMDLanguageItem.php'
;
122
123
if
($this->
getMetaId
()) {
124
$query
=
"SELECT * FROM il_meta_location "
.
125
"WHERE meta_location_id = "
.
$ilDB
->quote($this->
getMetaId
(),
'integer'
);
126
127
$res
= $this->db->query(
$query
);
128
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
129
$this->
setRBACId
(
$row
->rbac_id);
130
$this->
setObjId
(
$row
->obj_id);
131
$this->
setObjType
(
$row
->obj_type);
132
$this->
setParentId
(
$row
->parent_id);
133
$this->
setParentType
(
$row
->parent_type);
134
$this->
setLocation
(
$row
->location);
135
$this->
setLocationType
(
$row
->location_type);
136
}
137
}
138
return
true
;
139
}
140
141
/*
142
* XML Export of all meta data
143
* @param object (xml writer) see class.ilMD2XML.php
144
*
145
*/
146
public
function
toXML
(&$writer)
147
{
148
$writer->xmlElement(
149
'Location'
,
150
array(
'Type'
=> $this->
getLocationType
()
151
? $this->
getLocationType
()
152
:
'LocalFile'
),
153
$this->
getLocation
()
154
);
155
}
156
157
158
// STATIC
159
public
static
function
_getIds
($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
160
{
161
global
$DIC
;
162
163
$ilDB
= $DIC[
'ilDB'
];
164
165
$query
=
"SELECT meta_location_id FROM il_meta_location "
.
166
"WHERE rbac_id = "
.
$ilDB
->quote($a_rbac_id,
'integer'
) .
" "
.
167
"AND obj_id = "
.
$ilDB
->quote($a_obj_id,
'integer'
) .
" "
.
168
"AND parent_id = "
.
$ilDB
->quote($a_parent_id,
'integer'
) .
" "
.
169
"AND parent_type = "
.
$ilDB
->quote($a_parent_type,
'text'
);
170
171
$res
=
$ilDB
->query(
$query
);
172
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
173
$ids[] =
$row
->meta_location_id;
174
}
175
return
$ids ? $ids : array();
176
}
177
}
ilMDLocation
Definition:
class.ilMDLocation.php:33
ilMDLocation\getLocation
getLocation()
Definition:
class.ilMDLocation.php:40
ilMDBase\setObjType
setObjType($a_type)
Definition:
class.ilMDBase.php:109
$DIC
global $DIC
Definition:
saml.php:7
ilMDLocation\setLocationType
setLocationType($a_location_type)
Definition:
class.ilMDLocation.php:44
$location
$location
Definition:
buildRTE.php:44
ilMDLocation\save
save()
Definition:
class.ilMDLocation.php:53
ilMDLocation\update
update()
Definition:
class.ilMDLocation.php:69
ilMDBase\getRBACId
getRBACId()
Definition:
class.ilMDBase.php:97
ilMDLocation\toXML
toXML(&$writer)
Definition:
class.ilMDLocation.php:146
ilMDLocation\setLocation
setLocation($a_location)
Definition:
class.ilMDLocation.php:36
ilMDLocation\__getFields
__getFields()
Definition:
class.ilMDLocation.php:104
ilMDLocation\getLocationType
getLocationType()
Definition:
class.ilMDLocation.php:48
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
ilMDLocation\read
read()
Definition:
class.ilMDLocation.php:115
ilMDBase\setObjId
setObjId($a_id)
Definition:
class.ilMDBase.php:101
ilMDBase\setRBACId
setRBACId($a_id)
Definition:
class.ilMDBase.php:93
$query
$query
Definition:
proxy_ylocal.php:13
ilMDBase\setParentId
setParentId($a_id)
Definition:
class.ilMDBase.php:137
$row
$row
Definition:
migrateto20.php:360
ilMDBase\getMetaId
getMetaId()
Definition:
class.ilMDBase.php:125
ilMDBase\getParentType
getParentType()
Definition:
class.ilMDBase.php:133
ilMDBase\getObjId
getObjId()
Definition:
class.ilMDBase.php:105
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
ilMDBase\setParentType
setParentType($a_parent_type)
Definition:
class.ilMDBase.php:129
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
ilMDLocation\_getIds
static _getIds($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
Definition:
class.ilMDLocation.php:159
ilMDBase\getParentId
getParentId()
Definition:
class.ilMDBase.php:141
Services
MetaData
classes
class.ilMDLocation.php
Generated on Thu Jan 16 2025 19:02:26 for ILIAS by
1.8.13 (using
Doxyfile
)