當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。