本文整理汇总了PHP中UserUtil::getGroupListForUser方法的典型用法代码示例。如果您正苦于以下问题:PHP UserUtil::getGroupListForUser方法的具体用法?PHP UserUtil::getGroupListForUser怎么用?PHP UserUtil::getGroupListForUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserUtil
的用法示例。
在下文中一共展示了UserUtil::getGroupListForUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGidCacheString
/**
* Get a unique string for a user, depending on this group memberships.
*
* String ready to be used as part of the CacheID of the output views.
* Useful when there aren't another user-based access privilegies, just group permissions.
*
* @param integer $uid User ID to get the group memberships from. Default: current user.
*
* @return string Cache GIDs string to use on Zikula_View.
*/
public static function getGidCacheString($uid = null)
{
$str = UserUtil::getGroupListForUser($uid, '_');
return $str == '-1' ? 'guest' : 'groups_' . $str;
}
示例2: exportToCsv
public function exportToCsv($args){
$optFields = $args['optFields'];
$d = date('_Ymd_Hi') ;
$filename = $args['filename'];//="")?$args['filename']:"exportUsers" . $d. '.csv';
$delimiter = isset($args['delimiter'])?$args['delimiter'] : ';';
$titlerow = array();
$groups = false;
$titlerow[] ="uname";
$sql = "SELECT uid, uname";
foreach ($optFields as $key => $value) {
if ($value) {
if ($key != "export_groups") $sql .= ",". $key;
// generate CSV header line
switch ($key) {
case "activated" :
$titlerow[] ="activated";
break;
case "email":
$titlerow[] ="email";
break;
case "iw_nom":
$titlerow[] ="firstname";
break;
case "iw_cognom1":
$titlerow[] ="lastname1";
break;
case "iw_cognom2":
$titlerow[] ="lastname2";
break;
case "iw_naixement":
$titlerow[] ="birthdate";
break;
case "iw_sex":
$titlerow[] ="gender";
break;
case "export_groups":
$titlerow[] ="in";
$groups = true;
break;
}
}
}
$sql.= " FROM users, IWusers WHERE uid = iw_uid";
// Get users info
$rs = DBUtil::executeSQL($sql);
$rsm = DBUtil::marshallObjects($rs);
// Get groups from every user
// if ($groups) {
foreach ($rsm as $key => $user){
if ($groups) {
// Get all groups
$rsm[$key]['in'] = UserUtil::getGroupListForUser($user['uid'], "|");
}
// Remove uid field
array_splice($rsm[$key], 0, 1);
}
$result = array();
FileUtil::exportCSV($rsm, $titlerow, $delimiter, '"', $filename);
return true; //$result;
}