ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilRoleAutoComplete Class Reference

Auto completion class for user lists. More...

+ Collaboration diagram for ilRoleAutoComplete:

Static Public Member Functions

static getList ($a_str)
 Get completion list. More...
 
static getListByObject ($a_str)
 Get list of roles assigned to an object. More...
 

Detailed Description

Auto completion class for user lists.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 8 of file class.ilRoleAutoComplete.php.

Member Function Documentation

◆ getList()

static ilRoleAutoComplete::getList (   $a_str)
static

Get completion list.

Definition at line 13 of file class.ilRoleAutoComplete.php.

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(DB_FETCHMODE_OBJECT))
33 {
34 $result[$counter] = new stdClass();
35 $result[$counter]->value = $row->role;
36 $result[$counter]->label = $row->role." (".$row->container.")";
37 ++$counter;
38 }
39
40 if($counter == 0)
41 {
42 return self::getListByObject($a_str);
43 }
44
45 include_once './Services/JSON/classes/class.ilJsonUtil.php';
47 }
$result
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
static encode($mixed, $suppress_native=false)
static getListByObject($a_str)
Get list of roles assigned to an object.
global $ilDB

References $ilDB, $query, $res, $result, $row, DB_FETCHMODE_OBJECT, ilJsonUtil\encode(), and getListByObject().

Referenced by ilRoleAutoCompleteInputGUI\echoAutoCompleteList(), and ilRegistrationSettingsGUI\getLocalRoleAutoComplete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getListByObject()

static ilRoleAutoComplete::getListByObject (   $a_str)
static

Get list of roles assigned to an object.

Returns
Parameters
object$result

Definition at line 54 of file class.ilRoleAutoComplete.php.

55 {
56 global $rbacreview,$ilDB;
57
58 include_once './Services/JSON/classes/class.ilJsonUtil.php';
59 $result = array();
60
61 if(strpos($a_str,'@') !== 0)
62 {
64 }
65
66 $a_str = substr($a_str,1);
67
68 $ilDB->setLimit(100);
69 $query = "SELECT ref_id, title FROM object_data ode ".
70 "JOIN object_reference ore ON ode.obj_id = ore.obj_id ".
71 "WHERE ".$ilDB->like('title', 'text',$a_str.'%').' '.
72 'ORDER BY title';
73 $res = $ilDB->query($query);
74 $counter = 0;
75 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
76 {
77 foreach($rbacreview->getRolesOfRoleFolder($row->ref_id,false) as $rol_id)
78 {
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 }
88 }
static _lookupTitle($a_id)
lookup object title

References $ilDB, $query, $res, $result, $row, ilObject\_lookupTitle(), DB_FETCHMODE_OBJECT, and ilJsonUtil\encode().

Referenced by getList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: