function listGroupsOfObject($id, $perm = 'listen')
 {
     $groups = sotf_Group::listGroupIdsOfObject($id, $perm);
     $retval = array();
     foreach ($groups as $gid) {
         $group = sotf_Group::getById($gid);
         $retval[$group->get('name')] = $group->getAll();
     }
     asort($retval);
     //debug("GROUPS", $retval);
     return $retval;
 }
Exemplo n.º 2
0
$page->popup = true;
$page->forceLogin();
$context = sotf_Utils::getParameter('context');
$objectname = sotf_Utils::getParameter('objectname');
$objectid = sotf_Utils::getParameter('objectid');
$userid = sotf_Utils::getParameter('userid');
$save = sotf_Utils::getParameter('save');
$pattern = sotf_Utils::getParameter('pattern');
$prefix = sotf_Utils::getParameter('prefix');
$new = sotf_Utils::getParameter('new');
if ($new) {
    // restart user search
} elseif ($userid) {
    if ($userid[0] == 'g') {
        $gid = substr($userid, 1);
        $group = sotf_Group::getById($gid);
        $users[$userid] = $group->get('name');
        $smarty->assign("USERS", $users);
    } else {
        $username = sotf_User::getUsername($userid);
        $users[$userid] = $username;
        $smarty->assign("USERS", $users);
    }
} elseif ($pattern) {
    $smarty->assign("PATTERN", $pattern);
    $users = sotf_User::findUsers($pattern, $prefix);
    debug("USERS", $users);
    $groups = sotf_Group::findGroups($pattern, $prefix);
    debug("GROUPS", $groups);
    if (count($users) + count($groups) > 50) {
        $smarty->assign("TOO_MANY_MATCHES", count($users) + count($groups));