Auto completion class for user lists.
More...
Auto completion class for user lists.
- Author
- Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Definition at line 25 of file class.ilRoleAutoComplete.php.
◆ getList()
static ilRoleAutoComplete::getList |
( |
string |
$a_str | ) |
|
|
static |
Get completion list.
Definition at line 30 of file class.ilRoleAutoComplete.php.
30 : string
31 {
33
35 $ilDB->setLimit(20, 0);
36 $query = "SELECT o1.title role,o2.title container FROM object_data o1 " .
37 "JOIN rbac_fa fa ON o1.obj_id = rol_id " .
38
39
40 "JOIN object_reference obr ON ref_id = fa.parent AND obr.deleted IS NULL " .
41 "JOIN object_data o2 ON obr.obj_id = o2.obj_id " .
42 "INNER JOIN tree t ON t.child = obr.ref_id AND t.tree = 1 " .
43 "WHERE o1.type = 'role' " .
44 "AND assign = 'y' " .
45 "AND (" .
$ilDB->like(
'o1.title',
'text',
'%' . $a_str .
'%') .
"OR " .
46 $ilDB->like(
'o2.title',
'text',
'%' . $a_str .
'%') .
" )" .
47 "AND fa.parent != 8 " .
48 "ORDER BY role,container";
49
52 $result = [];
55 $result[
$counter]->value = $row->role;
56 $result[
$counter]->label = $row->role .
" (" . $row->container .
")";
58 }
59
62 }
63
64 return json_encode($result, JSON_THROW_ON_ERROR);
65 }
static getListByObject(string $a_str)
Get list of roles assigned to an object.
References $counter, $DIC, $ilDB, $res, ilDBConstants\FETCHMODE_OBJECT, and getListByObject().
Referenced by ilRoleAutoCompleteInputGUI\echoAutoCompleteList(), and ilRegistrationSettingsGUI\getLocalRoleAutoComplete().
◆ getListByObject()
static ilRoleAutoComplete::getListByObject |
( |
string |
$a_str | ) |
|
|
static |
Get list of roles assigned to an object.
Definition at line 70 of file class.ilRoleAutoComplete.php.
70 : string
71 {
73
74 $rbacreview =
$DIC->rbac()->review();
76
77 $result = [];
78
79 if (strpos($a_str, '@') !== 0) {
80 return json_encode($result, JSON_THROW_ON_ERROR);
81 }
82
83 $a_str = substr($a_str, 1);
84
85 $ilDB->setLimit(100, 0);
86 $query = "SELECT ref_id, title FROM object_data ode " .
87 "JOIN object_reference ore ON ode.obj_id = ore.obj_id " .
88 "WHERE " .
$ilDB->like(
'title',
'text', $a_str .
'%') .
' ' .
89 'ORDER BY title';
93 foreach ($rbacreview->getRolesOfRoleFolder($row->ref_id, false) as $rol_id) {
95
98 $result[
$counter]->label = $role .
" (" . $row->title .
")";
100 }
101 }
102 return json_encode($result, JSON_THROW_ON_ERROR);
103 }
static _lookupTitle(int $obj_id)
References $counter, $DIC, $ilDB, $res, ilObject\_lookupTitle(), and ilDBConstants\FETCHMODE_OBJECT.
Referenced by getList().
The documentation for this class was generated from the following file: