ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
static getListByObject ($a_str)
 Get list of roles assigned to an object.

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

static ilRoleAutoComplete::getList (   $a_str)
static

Get completion list.

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

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

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

{
global $ilDB;
$ilDB->setLimit(20);
$query = "SELECT o1.title role,o2.title container FROM object_data o1 ".
"JOIN rbac_fa fa ON o1.obj_id = rol_id ".
"JOIN tree t1 ON fa.parent = t1.child ".
"JOIN object_reference obr ON ref_id = t1.parent ".
"JOIN object_data o2 ON obr.obj_id = o2.obj_id ".
"WHERE o1.type = 'role' ".
"AND assign = 'y' ".
"AND ".$ilDB->like('o1.title','text','%'.$a_str.'%')." ".
"AND fa.parent != 8 ".
"ORDER BY role,container";
$res = $ilDB->query($query);
$counter = 0;
$result = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$result[$counter] = new stdClass();
$result[$counter]->value = $row->role;
$result[$counter]->label = $row->role." (".$row->container.")";
++$counter;
}
if($counter == 0)
{
return self::getListByObject($a_str);
}
include_once './Services/JSON/classes/class.ilJsonUtil.php';
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

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

Referenced by getList().

{
global $rbacreview,$ilDB;
include_once './Services/JSON/classes/class.ilJsonUtil.php';
$result = array();
if(strpos($a_str,'@') !== 0)
{
}
$a_str = substr($a_str,1);
$ilDB->setLimit(100);
$query = "SELECT ref_id, title FROM object_data ode ".
"JOIN object_reference ore ON ode.obj_id = ore.obj_id ".
"WHERE ".$ilDB->like('title', 'text',$a_str.'%').' '.
'ORDER BY title';
$res = $ilDB->query($query);
$counter = 0;
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$rolf = $rbacreview->getRoleFolderIdOfObject($row->ref_id);
if($rolf)
{
foreach($rbacreview->getRolesOfRoleFolder($rolf,false) as $rol_id)
{
$role = ilObject::_lookupTitle($rol_id);
$result[$counter] = new stdClass();
$result[$counter]->value = $role;
$result[$counter]->label = $role." (".$row->title.")";
++$counter;
}
}
}
}

+ 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: