This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
More...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.
If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Auto completion class for user lists
- Author
- Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Definition at line 24 of file class.ilRoleAutoComplete.php.
◆ getList()
static ilRoleAutoComplete::getList |
( |
string |
$a_str | ) |
|
|
static |
Get completion list.
Definition at line 29 of file class.ilRoleAutoComplete.php.
References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.
Referenced by ilRoleAutoCompleteInputGUI\echoAutoCompleteList(), and ilRegistrationSettingsGUI\getLocalRoleAutoComplete().
33 $ilDB = $DIC->database();
34 $ilDB->setLimit(20, 0);
35 $query =
"SELECT o1.title role,o2.title container FROM object_data o1 " .
36 "JOIN rbac_fa fa ON o1.obj_id = rol_id " .
39 "JOIN object_reference obr ON ref_id = fa.parent " .
40 "JOIN object_data o2 ON obr.obj_id = o2.obj_id " .
41 "WHERE o1.type = 'role' " .
43 "AND (" .
$ilDB->like(
'o1.title',
'text',
'%' . $a_str .
'%') .
"OR " .
44 $ilDB->like(
'o2.title',
'text',
'%' . $a_str .
'%') .
" )" .
45 "AND fa.parent != 8 " .
46 "ORDER BY role,container";
53 $result[$counter]->value = $row->role;
54 $result[$counter]->label = $row->role .
" (" . $row->container .
")";
59 return self::getListByObject($a_str);
62 return json_encode($result, JSON_THROW_ON_ERROR);
◆ getListByObject()
static ilRoleAutoComplete::getListByObject |
( |
string |
$a_str | ) |
|
|
static |
Get list of roles assigned to an object.
Definition at line 68 of file class.ilRoleAutoComplete.php.
References $DIC, $ilDB, $query, $res, ilObject\_lookupTitle(), and ilDBConstants\FETCHMODE_OBJECT.
72 $rbacreview = $DIC->rbac()->review();
73 $ilDB = $DIC->database();
77 if (strpos($a_str,
'@') !== 0) {
78 return json_encode($result, JSON_THROW_ON_ERROR);
81 $a_str = substr($a_str, 1);
83 $ilDB->setLimit(100, 0);
84 $query =
"SELECT ref_id, title FROM object_data ode " .
85 "JOIN object_reference ore ON ode.obj_id = ore.obj_id " .
86 "WHERE " .
$ilDB->like(
'title',
'text', $a_str .
'%') .
' ' .
91 foreach ($rbacreview->getRolesOfRoleFolder($row->ref_id,
false) as $rol_id) {
95 $result[$counter]->value = $role;
96 $result[$counter]->label = $role .
" (" . $row->title .
")";
100 return json_encode($result, JSON_THROW_ON_ERROR);
static _lookupTitle(int $obj_id)
The documentation for this class was generated from the following file: