当前位置: 首页>>代码示例>>PHP>>正文


PHP UserUtil::getGroupListForUser方法代码示例

本文整理汇总了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;
 }
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:15,代码来源:UserUtil.php

示例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;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:60,代码来源:Admin.php


注:本文中的UserUtil::getGroupListForUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。