ILIAS
release_7 Revision v7.30-3-g800a261c036
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
l
m
p
r
s
t
w
+
Functions
_
a
b
c
f
g
h
i
r
s
t
w
+
Variables
$
c
d
e
f
g
h
j
l
m
p
s
t
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Files
File List
+
Globals
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Modules
Pages
class.ilParameterAppender.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
define(
"LINKS_USER_ID"
, 1);
25
define(
"LINKS_SESSION_ID"
, 2);
26
define(
"LINKS_LOGIN"
, 3);
27
define(
'LINKS_MATRICULATION'
, 4);
28
29
// Errors
30
define(
"LINKS_ERR_NO_NAME"
, 1);
31
define(
"LINKS_ERR_NO_VALUE"
, 2);
32
define(
"LINKS_ERR_NO_NAME_VALUE"
, 3);
33
42
class
ilParameterAppender
43
{
44
public
$webr_id
= null;
45
public
$db
= null;
46
47
public
$err
= null;
48
49
54
public
function
__construct
(
$webr_id
)
55
{
56
global
$DIC
;
57
58
$ilDB
= $DIC[
'ilDB'
];
59
60
$this->webr_id =
$webr_id
;
61
$this->db =
$ilDB
;
62
}
63
70
public
static
function
getParameterIds
($a_webr_id, $a_link_id)
71
{
72
global
$DIC
;
73
74
$ilDB
= $DIC[
'ilDB'
];
75
76
$query
=
"SELECT * FROM webr_params "
.
77
"WHERE webr_id = "
.
$ilDB
->quote($a_webr_id,
'integer'
) .
" "
.
78
"AND link_id = "
.
$ilDB
->quote($a_link_id,
'integer'
);
79
$res
=
$ilDB
->query(
$query
);
80
while
($row =
$res
->fetchRow(
ilDBConstants::FETCHMODE_ASSOC
)) {
81
$params[] = $row[
'param_id'
];
82
}
83
return
(array) $params;
84
}
85
86
public
function
getErrorCode
()
87
{
88
return
$this->err
;
89
}
90
91
// SET GET
92
public
function
setObjId
($a_obj_id)
93
{
94
$this->webr_id = $a_obj_id;
95
}
96
97
public
function
getObjId
()
98
{
99
return
$this->webr_id
;
100
}
101
102
public
function
setName
($a_name)
103
{
104
$this->name = $a_name;
105
}
106
public
function
getName
()
107
{
108
return
$this->name
;
109
}
110
public
function
setValue
($a_value)
111
{
112
$this->value = $a_value;
113
}
114
public
function
getValue
()
115
{
116
return
$this->value;
117
}
118
119
public
function
validate
()
120
{
121
if
(!strlen($this->
getName
()) and !$this->
getValue
()) {
122
$this->err =
LINKS_ERR_NO_NAME_VALUE
;
123
return
false
;
124
}
125
if
(!strlen($this->
getName
())) {
126
$this->err =
LINKS_ERR_NO_NAME
;
127
return
false
;
128
}
129
if
(!$this->
getValue
()) {
130
$this->err =
LINKS_ERR_NO_VALUE
;
131
return
false
;
132
}
133
return
true
;
134
}
135
136
137
public
function
add
($a_link_id)
138
{
139
global
$DIC
;
140
141
$ilDB
= $DIC[
'ilDB'
];
142
143
if
(!$a_link_id) {
144
return
false
;
145
}
146
if
(!strlen($this->
getName
() or !strlen($this->
getValue
()))) {
147
return
false
;
148
}
149
150
$next_id =
$ilDB
->nextId(
'webr_params'
);
151
$query
=
"INSERT INTO webr_params (param_id,webr_id,link_id,name,value) "
.
152
"VALUES( "
.
153
$ilDB
->quote($next_id,
'integer'
) .
", "
.
154
$ilDB
->quote($this->
getObjId
(),
'integer'
) .
", "
.
155
$ilDB
->quote($a_link_id,
'integer'
) .
", "
.
156
$ilDB
->quote($this->
getName
(),
'text'
) .
", "
.
157
$ilDB
->quote($this->
getValue
(),
'integer'
) .
158
")"
;
159
$res
=
$ilDB
->manipulate(
$query
);
160
161
return
$next_id;
162
}
163
164
public
function
delete
($a_param_id)
165
{
166
global
$DIC
;
167
168
$ilDB
= $DIC[
'ilDB'
];
169
170
$query
=
"DELETE FROM webr_params "
.
171
"WHERE param_id = "
.
$ilDB
->quote($a_param_id,
'integer'
) .
" "
.
172
"AND webr_id = "
.
$ilDB
->quote($this->
getObjId
(),
'integer'
);
173
$res
=
$ilDB
->manipulate(
$query
);
174
return
true
;
175
}
176
181
public
static
function
_isEnabled
()
182
{
183
global
$DIC
;
184
185
$ilSetting
= $DIC[
'ilSetting'
];
186
187
return
$ilSetting
->get(
'links_dynamic'
,
false
) ? true :
false
;
188
}
189
190
public
static
function
_append
($a_link_data)
191
{
192
global
$DIC
;
193
194
$ilUser
= $DIC[
'ilUser'
];
195
196
if
(!is_array($a_link_data)) {
197
return
false
;
198
}
199
if
(count($params =
ilParameterAppender::_getParams
($a_link_data[
'link_id'
]))) {
200
// Check for prefix
201
202
foreach
($params as $param_data) {
203
if
((
int
) $param_data[
'value'
] ===
LINKS_SESSION_ID
) {
204
continue
;
205
}
206
if
(!strpos($a_link_data[
'target'
],
'?'
)) {
207
$a_link_data[
'target'
] .=
"?"
;
208
}
else
{
209
$a_link_data[
'target'
] .=
"&"
;
210
}
211
$a_link_data[
'target'
] .= ($param_data[
'name'
] .
"="
);
212
switch
($param_data[
'value'
]) {
213
case
LINKS_LOGIN
:
214
$a_link_data[
'target'
] .= (urlencode(
$ilUser
->getLogin()));
215
break
;
216
case
LINKS_USER_ID
:
217
$a_link_data[
'target'
] .= (
$ilUser
->getId());
218
break
;
219
220
case
LINKS_MATRICULATION
:
221
$a_link_data[
'target'
] .= (
$ilUser
->getMatriculation());
222
break
;
223
}
224
}
225
}
226
return
$a_link_data;
227
}
228
234
public
static
function
_getParams
($a_link_id)
235
{
236
global
$DIC
;
237
238
$ilDB
= $DIC[
'ilDB'
];
239
240
$params = [];
241
242
$res
=
$ilDB
->query(
"SELECT * FROM webr_params WHERE link_id = "
.
243
$ilDB
->quote((
int
) $a_link_id,
'integer'
));
244
while
($row =
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
245
$params[$row->param_id][
'name'
] = $row->name;
246
$params[$row->param_id][
'value'
] = $row->value;
247
}
248
249
return
$params;
250
}
251
258
public
static
function
parameterToInfo
($a_name, $a_value)
259
{
260
$info = $a_name;
261
262
switch
($a_value) {
263
case
LINKS_USER_ID
:
264
return
$info .
'=USER_ID'
;
265
266
case
LINKS_SESSION_ID
:
267
return
$info .
'=SESSION_ID'
;
268
269
case
LINKS_LOGIN
:
270
return
$info .
'=LOGIN'
;
271
272
case
LINKS_MATRICULATION
:
273
return
$info .
'=MATRICULATION'
;
274
}
275
return
''
;
276
}
277
278
public
static
function
_deleteAll
($a_webr_id)
279
{
280
global
$DIC
;
281
282
$ilDB
= $DIC[
'ilDB'
];
283
284
$query
=
"DELETE FROM webr_params WHERE webr_id = "
.
285
$ilDB
->quote((
int
) $a_webr_id,
'integer'
);
286
$res
=
$ilDB
->manipulate(
$query
);
287
288
return
true
;
289
}
290
295
public
static
function
_getOptionSelect
()
296
{
297
global
$DIC
;
298
299
$lng
= $DIC[
'lng'
];
300
301
return
array(0 =>
$lng
->txt(
'links_select_one'
),
302
LINKS_USER_ID
=>
$lng
->txt(
'links_user_id'
),
303
LINKS_LOGIN
=>
$lng
->txt(
'links_user_name'
),
304
LINKS_MATRICULATION
=>
$lng
->txt(
'matriculation'
)
305
);
306
}
307
}
ilParameterAppender\$err
$err
Definition:
class.ilParameterAppender.php:47
ilParameterAppender\getObjId
getObjId()
Definition:
class.ilParameterAppender.php:97
ilParameterAppender\getParameterIds
static getParameterIds($a_webr_id, $a_link_id)
Get Parameter ids of link.
Definition:
class.ilParameterAppender.php:70
ilParameterAppender\$db
$db
Definition:
class.ilParameterAppender.php:45
ilParameterAppender\_getOptionSelect
static _getOptionSelect()
Get options as array.
Definition:
class.ilParameterAppender.php:295
LINKS_MATRICULATION
const LINKS_MATRICULATION
Definition:
class.ilParameterAppender.php:27
ilParameterAppender\setObjId
setObjId($a_obj_id)
Definition:
class.ilParameterAppender.php:92
LINKS_LOGIN
const LINKS_LOGIN
Definition:
class.ilParameterAppender.php:26
ilParameterAppender\validate
validate()
Definition:
class.ilParameterAppender.php:119
ilParameterAppender\_append
static _append($a_link_data)
Definition:
class.ilParameterAppender.php:190
ilParameterAppender\_deleteAll
static _deleteAll($a_webr_id)
Definition:
class.ilParameterAppender.php:278
$name
if($format !==null) $name
Definition:
metadata.php:230
ilParameterAppender\parameterToInfo
static parameterToInfo($a_name, $a_value)
Get info text describing an existing dynamic link.
Definition:
class.ilParameterAppender.php:258
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
$lng
$lng
Definition:
save_question_post_data.php:23
$DIC
global $DIC
Definition:
goto.php:24
ilParameterAppender\getErrorCode
getErrorCode()
Definition:
class.ilParameterAppender.php:86
LINKS_ERR_NO_VALUE
const LINKS_ERR_NO_VALUE
Definition:
class.ilParameterAppender.php:31
$query
$query
Definition:
proxy_ylocal.php:13
ilParameterAppender\add
add($a_link_id)
Definition:
class.ilParameterAppender.php:137
LINKS_ERR_NO_NAME
const LINKS_ERR_NO_NAME
Definition:
class.ilParameterAppender.php:30
ilParameterAppender\getName
getName()
Definition:
class.ilParameterAppender.php:106
ilParameterAppender\setName
setName($a_name)
Definition:
class.ilParameterAppender.php:102
ilParameterAppender\$webr_id
$webr_id
Definition:
class.ilParameterAppender.php:44
$ilSetting
global $ilSetting
Definition:
privfeed.php:17
ilParameterAppender\__construct
__construct($webr_id)
Constructor public.
Definition:
class.ilParameterAppender.php:54
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
ilDBConstants\FETCHMODE_ASSOC
const FETCHMODE_ASSOC
Definition:
class.ilDBConstants.php:10
ilParameterAppender
Class ilParameterAppender.
Definition:
class.ilParameterAppender.php:42
LINKS_ERR_NO_NAME_VALUE
const LINKS_ERR_NO_NAME_VALUE
Definition:
class.ilParameterAppender.php:32
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:11
$ilUser
$ilUser
Definition:
imgupload.php:18
LINKS_USER_ID
const LINKS_USER_ID
Definition:
class.ilParameterAppender.php:24
ilParameterAppender\_getParams
static _getParams($a_link_id)
Get dynamic parameter definitions.
Definition:
class.ilParameterAppender.php:234
ilParameterAppender\_isEnabled
static _isEnabled()
Check if dynamic parameters are enabled.
Definition:
class.ilParameterAppender.php:181
LINKS_SESSION_ID
const LINKS_SESSION_ID
Definition:
class.ilParameterAppender.php:25
ilParameterAppender\setValue
setValue($a_value)
Definition:
class.ilParameterAppender.php:110
ilParameterAppender\getValue
getValue()
Definition:
class.ilParameterAppender.php:114
Modules
WebResource
classes
class.ilParameterAppender.php
Generated on Tue Apr 8 2025 21:01:33 for ILIAS by
1.8.13 (using
Doxyfile
)