ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ 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
$DIC
;
16
17
$ilDB
= $DIC[
'ilDB'
];
18
19
$ilDB
->setLimit(20);
20
$query
=
"SELECT o1.title role,o2.title container FROM object_data o1 "
.
21
"JOIN rbac_fa fa ON o1.obj_id = rol_id "
.
22
"JOIN tree t1 ON fa.parent = t1.child "
.
23
"JOIN object_reference obr ON ref_id = t1.parent "
.
24
"JOIN object_data o2 ON obr.obj_id = o2.obj_id "
.
25
"WHERE o1.type = 'role' "
.
26
"AND assign = 'y' "
.
27
"AND "
.
$ilDB
->like(
'o1.title'
,
'text'
,
'%'
. $a_str .
'%'
) .
" "
.
28
"AND fa.parent != 8 "
.
29
"ORDER BY role,container"
;
30
31
$res
=
$ilDB
->query(
$query
);
32
$counter = 0;
33
$result
= array();
34
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
35
$result
[$counter] =
new
stdClass
();
36
$result
[$counter]->value =
$row
->role;
37
$result
[$counter]->label =
$row
->role .
" ("
.
$row
->container .
")"
;
38
++$counter;
39
}
40
41
if
($counter == 0) {
42
return
self::getListByObject($a_str);
43
}
44
45
include_once
'./Services/JSON/classes/class.ilJsonUtil.php'
;
46
return
ilJsonUtil::encode
(
$result
);
47
}
48
54
public
static
function
getListByObject
($a_str)
55
{
56
global
$DIC
;
57
58
$rbacreview = $DIC[
'rbacreview'
];
59
$ilDB
= $DIC[
'ilDB'
];
60
61
include_once
'./Services/JSON/classes/class.ilJsonUtil.php'
;
62
$result
= array();
63
64
if
(strpos($a_str,
'@'
) !== 0) {
65
return
ilJsonUtil::encode
(
$result
);
66
}
67
68
$a_str = substr($a_str, 1);
69
70
$ilDB
->setLimit(100);
71
$query
=
"SELECT ref_id, title FROM object_data ode "
.
72
"JOIN object_reference ore ON ode.obj_id = ore.obj_id "
.
73
"WHERE "
.
$ilDB
->like(
'title'
,
'text'
, $a_str .
'%'
) .
' '
.
74
'ORDER BY title'
;
75
$res
=
$ilDB
->query(
$query
);
76
$counter = 0;
77
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
78
foreach
($rbacreview->getRolesOfRoleFolder(
$row
->ref_id,
false
) as $rol_id) {
79
$role =
ilObject::_lookupTitle
($rol_id);
80
81
$result
[$counter] =
new
stdClass
();
82
$result
[$counter]->value = $role;
83
$result
[$counter]->label = $role .
" ("
.
$row
->title .
")"
;
84
++$counter;
85
}
86
}
87
return
ilJsonUtil::encode
(
$result
);
88
}
89
}
$result
$result
Definition:
CleanUpTest.php:463
stdClass
$DIC
global $DIC
Definition:
saml.php:7
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:988
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
$row
$row
Definition:
migrateto20.php:360
$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:54
ilRoleAutoComplete
Auto completion class for user lists.
Definition:
class.ilRoleAutoComplete.php:8
php
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
Services
AccessControl
classes
class.ilRoleAutoComplete.php
Generated on Thu Feb 27 2025 19:01:51 for ILIAS by
1.8.13 (using
Doxyfile
)