Source for file UserUtil.class.php
Documentation is available at UserUtil.class.php
* Zikula Application Framework
* @copyright Robert Gasch
* @link http://www.zikula.org
* @version $Id: UserUtil.class.php 24342 2008-06-06 12:03:14Z markwest $
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
* @author Robert Gasch rgasch@gmail.com
* @param uid The userID of the user to retrieve
* @param getVars whether or not to also get the user-variables (not implemented yet)
* @return The resulting user object
* Return a field from a user object
* @param id The userID of the user to retrieve
* @param field The field from the user object to get
* @return The requested field
* Return a hash structure mapping uid to username
* @param where The where clause to use (optional)
* @param orderBy The order by clause to use (optional)
* @param limitOffset The select-limit offset (optional) (default=-1)
* @param limitNumRows The number of rows to fetch (optional) (default=-1)
* @param assocKey The associative key to apply (optional) (default='gid')
* @return An array mapping uid to username
function getPNUsers ($where= '', $orderBy= '', $limitOffset=- 1, $limitNumRows=- 1, $assocKey= 'uid')
* @param gid The groupID to retrieve
* @return The resulting group object
* Return a hash structure mapping gid to groupname
* @param where The where clause to use (optional) (default='')
* @param orderBy The order by clause to use (optional) (default='')
* @param limitOffset The select-limit offset (optional) (default=-1)
* @param limitNumRows The number of rows to fetch (optional) (default=-1)
* @param assocKey The associative key to apply (optional) (default='gid')
* @return An array mapping gid to groupname
function getPNGroups ($where= '', $orderBy= '', $limitOffset=- 1, $limitNumRows=- 1, $assocKey= 'gid')
* Return a (string) list of user-ids which can then be used in a SQL 'IN (...)' clause
* @param where The where clause to use (optional)
* @param orderBy The order by clause to use (optional)
* @param separator The field separator to use (default=",") (optional)
* @return A string list of user ids
for ($i= 0; $i< $size; $i++ ) {
$list .= $keys[$i] . $separator;
if (($length = strlen($list)) > 0) {
$list= substr($list, 0, $length - 1);
* Return a (string) list of group-ids which can then be used in a SQL 'IN (...)' clause
* @param where The where clause to use (optional)
* @param orderBy The order by clause to use (optional)
* @param separator The field separator to use (default=",") (optional)
* @return A string list of group ids
for ($i= 0; $i< $numkeys; $i++ ) {
$list .= $keys[$i] . $separator;
if (($length = strlen($list)) > 0) {
$list= substr($list, 0, $length - 1);
* Return an array group-ids for the specified user
* @param uid The user ID for which we want the groups
* @return An array of group IDs
* Return a string list of group-ids for the specified user
* @param uid The user ID for which we want the groups
* @param separator The field separator to use (default=",") (optional)
* @return A string list of group ids
$size = count ($gidArray);
for ($i= 0; $i< $size; $i++ ) {
$gidlist .= $gidArray[$i] . $separator;
if (($length = strlen($gidlist)) > 0) {
$gidlist = substr($gidlist, 0, $length - 1);
* Return a string list of user-ids for the specified group
* @param gid The group ID for which we want the users
* @param separator The field separator to use (default=",") (optional)
* @return an array of user IDs
* Return the defined dynamic user data fields
* @return an array of dynamic data field definitions
* Return a string list of user-ids for the specified group
* @param uid The user ID for which we want the users
* @param assocKey The associate Key to use
* @param standardFields Whether or not to also marshall the standard user properties into the DUD array
* @return an array of user IDs
foreach ($user as $k=> $v) {
if (strpos($k, 'user_')=== 0) {
* Return a PN array structure for the PN user group selector
* @param defaultValue The default value of the selector (default=0) (optional)
* @param defaultText The text of the default value (optional)
* @param ignore An array of keys to ignore (optional)
* @param includeAll whether to include an "All" choice (optional)
* @param allText The text to display for the "All" choice (optional)
* @return The PN array structure for the user group selector
$includeAll= 0, $allText= '')
$dropdown[] = array ('id'=> $defaultValue, 'name'=> $defaultText);
if (sizeof($groupdata) == 0) {
$dropdown[] = array ('id'=> $includeAll, 'name'=> $allText);
for ($i= 0; $i< $numkeys; $i++ ) {
if (!isset ($ignore[$keys[$i]])) {
$dropdown[] = array ('id'=> $keys[$i], 'name'=> $groupdata[$keys[$i]]['name']);
* Return a PN array strcuture for the PN user dropdown box
* @param defaultValue The default value of the selector (optional) (default=0)
* @param defaultText The text of the default value (optional) (default='')
* @param ignore An array of keys to ignore (optional) (default=array())
* @param includeAll whether to include an "All" choice (optional) (default=0)
* @param allText The text to display for the "All" choice (optional) (default='')
* @param exclude An SQL IN-LIST string to exclude specified uids
* @return The PN array structure for the user group selector
$includeAll= 0, $allText= '', $exclude= '')
$dropdown[] = array ('id'=> $defaultValue, 'name'=> $defaultText);
if (sizeof ($userdata) == 0) {
$dropdown[] = array ('id'=> $includeAll, 'name'=> $allText);
for ($i= 0; $i< $numkeys; $i++ ) {
if (!isset ($ignore[$keys[$i]])) {
$dropdown[] = array ('id'=> $keys[$i], 'name'=> $userdata[$keys[$i]]['name']);
|