ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
class.ilRoleAutoComplete.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8
class
ilRoleAutoComplete
9
{
13
public
static
function
getList
($a_str)
14
{
15
global
$ilDB
;
16
17
$ilDB->setLimit(20);
18
$query
=
"SELECT o1.title role,o2.title container FROM object_data o1 "
.
19
"JOIN rbac_fa fa ON o1.obj_id = rol_id "
.
20
"JOIN tree t1 ON fa.parent = t1.child "
.
21
"JOIN object_reference obr ON ref_id = t1.parent "
.
22
"JOIN object_data o2 ON obr.obj_id = o2.obj_id "
.
23
"WHERE o1.type = 'role' "
.
24
"AND assign = 'y' "
.
25
"AND "
. $ilDB->like(
'o1.title'
,
'text'
,
'%'
. $a_str .
'%'
) .
" "
.
26
"AND fa.parent != 8 "
.
27
"ORDER BY role,container"
;
28
29
$res
= $ilDB->query(
$query
);
30
$counter
= 0;
31
$result
=
array
();
32
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
33
$result
[
$counter
] =
new
stdClass();
34
$result
[
$counter
]->value =
$row
->role;
35
$result
[
$counter
]->label =
$row
->role .
" ("
.
$row
->container .
")"
;
36
++
$counter
;
37
}
38
39
if
(
$counter
== 0) {
40
return
self::getListByObject($a_str);
41
}
42
43
include_once
'./Services/JSON/classes/class.ilJsonUtil.php'
;
44
return
ilJsonUtil::encode
(
$result
);
45
}
46
52
public
static
function
getListByObject
($a_str)
53
{
54
global $rbacreview,
$ilDB
;
55
56
include_once
'./Services/JSON/classes/class.ilJsonUtil.php'
;
57
$result
=
array
();
58
59
if
(strpos($a_str,
'@'
) !== 0) {
60
return
ilJsonUtil::encode
(
$result
);
61
}
62
63
$a_str = substr($a_str, 1);
64
65
$ilDB->setLimit(100);
66
$query
=
"SELECT ref_id, title FROM object_data ode "
.
67
"JOIN object_reference ore ON ode.obj_id = ore.obj_id "
.
68
"WHERE "
. $ilDB->like(
'title'
,
'text'
, $a_str .
'%'
) .
' '
.
69
'ORDER BY title'
;
70
$res
= $ilDB->query(
$query
);
71
$counter
= 0;
72
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
73
foreach
($rbacreview->getRolesOfRoleFolder(
$row
->ref_id,
false
) as $rol_id) {
74
$role =
ilObject::_lookupTitle
($rol_id);
75
76
$result
[
$counter
] =
new
stdClass();
77
$result
[
$counter
]->value = $role;
78
$result
[
$counter
]->label = $role .
" ("
.
$row
->title .
")"
;
79
++
$counter
;
80
}
81
}
82
return
ilJsonUtil::encode
(
$result
);
83
}
84
}
$result
$result
Definition:
CleanUpTest.php:463
ilRoleAutoComplete\getList
static getList($a_str)
Get completion list.
Definition:
class.ilRoleAutoComplete.php:13
ilObject\_lookupTitle
static _lookupTitle($a_id)
lookup object title
Definition:
class.ilObject.php:933
$counter
$counter
Definition:
config-scanner.php:59
ilJsonUtil\encode
static encode($mixed, $suppress_native=false)
Definition:
class.ilJsonUtil.php:23
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
$query
$query
Definition:
proxy_ylocal.php:13
array
Create styles array
The data for the language used.
Definition:
40duplicateStyle.php:19
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
ilRoleAutoComplete\getListByObject
static getListByObject($a_str)
Get list of roles assigned to an object.
Definition:
class.ilRoleAutoComplete.php:52
ilRoleAutoComplete
Auto completion class for user lists.
Definition:
class.ilRoleAutoComplete.php:8
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
$row
$row
Definition:
10autofilter-selection-1.php:74
Services
AccessControl
classes
class.ilRoleAutoComplete.php
Generated on Tue Jan 28 2025 19:01:27 for ILIAS by
1.8.13 (using
Doxyfile
)