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


PHP UserUtil::getGroups方法代码示例

本文整理汇总了PHP中UserUtil::getGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP UserUtil::getGroups方法的具体用法?PHP UserUtil::getGroups怎么用?PHP UserUtil::getGroups使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserUtil的用法示例。


在下文中一共展示了UserUtil::getGroups方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: orderGroupInfo

    public function orderGroupInfo($args) {
        if (!SecurityUtil::checkPermission('IWusers::', '::', ACCESS_READ)) {
            throw new Zikula_Exception_Fatal($this->__('No teniu autorització per accedir a aquesta informació.'));
        }       

        $orderBy = $this->request->request->get('orderBy', '');
        if ($orderBy=='') $orderBy = "gid";
        
        $gi = UserUtil::getGroups('',$orderBy);
        foreach ($gi as $key => $value) {
            $groupInfo[] = array_slice($value,0,2);
        }
       
        $view = Zikula_View::getInstance($this->name);
        $view->assign('groupInfo', $groupInfo);
        
        $content = $view->fetch('IWusers_groupsTable.tpl');
        return new Zikula_Response_Ajax(array('content' => $content));
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:19,代码来源:Ajax.php

示例2: main

    public function main()
    {
        // Security check
        if (!SecurityUtil::checkPermission('SiriusXtecAuth::', '::', ACCESS_ADMIN)) {
            return LogUtil::registerPermissionError();
        }
        $MVars = ModUtil::getVar($this->name);
		$login_redirect = ModUtil::getVar('Users','login_redirect');
        $allGroups = UserUtil::getGroups();
        
        foreach ($allGroups as $key => $group) {
            
            if (in_array($key,$MVars['new_users_groups'])) {
                $allGroups[$key]['sel'] = 1;
            }else {
                $allGroups[$key]['sel'] = 0;
            }
        }
		$this->view->assign('login_redirect',$login_redirect);
        $this->view->assign('MVars', $MVars);
        $this->view->assign('allGroups',$allGroups);
        return $this->view->fetch('SiriusXtecAuth_admin_config.tpl');
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:23,代码来源:Admin.php

示例3: import


//.........这里部分代码省略.........
                                    'activated'   => 'activated',
                                    'firstname'   => 'nom',
                                    'lastname1'   => 'cognom1',
                                    'lastname2'   => 'cognom2',
                                    'description' => 'description',
                                    'birthdate'   => 'naixement',
                                    'gender'      => 'sex',
                                    'in'          => 'in',
                                    'out'         => 'out'
                    );

                $import = new CsvImporter($importFile['tmp_name'],true, $headerTrans, $delimiter);  
                $header  = $import->getHeader();
                $oHeader = $import->getOriHeader();
                
                $check  = ModUtil::apiFunc($this->name, 'admin', 'checkCsvHeader', $header);
                // Check CSV file header
                if (!$check['correcte']) {
                    // CSV header incorrect
                    LogUtil::registerError($check['msg']);
                } else {
                    // Get CSV file content
                    $data = $import->get();
                    // Initialize 
                    $update = array();
                    $insert = array();
                    $optimizeGroups = ((in_array('in', $header)) || (in_array('out', $header)));
                    $forcechgpass   = in_array('forcechgpass', $header);
                    $iErrors = array();
                    // Check file info
                    foreach ($data as &$line) {
                        $uid = UserUtil::getIdFromName($line['uname']);
                        if ($optimizeGroups) {
                            $res = ModUtil::apiFunc($this->name, 'admin', 'optimizeGroups', array('uid' => $uid, 'data'=> $line));
                            $line['in'] = $res['in'];
                            $line['out'] = $res['out'];                            
                        }                            
                        if ($uid){       
                            $line['uid'] = $uid;
                            // Update
                            if (isset($line['activated'])){
                                if ($line['activated']!=""){
                                    $line['activated'] = $line['activated'] == '0' ? 0 : 1;                                    
                                } else {
                                    // Mantain actual value
                                    $line['activated'] = DBUtil::selectField('users', 'activated', 'uid='.$uid);
                                }                                
                            }
                            $update[] = $line;                                
                        } else {
                            // Insert new user
                            if ($line['uname'] !=""){
                                if (!isset($line['activated']) || (isset($line['activated']) && $line['activated']!='0')) $line['activated'] = 1;
                                $insert[] = $line;
                            } else {
                                // Error. No username 
                                $line['error'] = $this->__('No username.');
                                $iErrors[] = $line;
                            }
                        }                            
                    }
                    // Process file information
                    $allChanges = ModUtil::apiFunc($this->name, 'admin', 'applyCsvValues', array('update' => $update, 'insert' =>$insert));               
                    unset($update); $update = array();
                    unset($insert); $insert = array();
                    foreach ($allChanges as $user){                       
                        switch ($user['action']){
                            case 'm':
                                $update[] = $user;
                                break;
                            default:
                                $insert[] = $user;
                        }
                        if (isset($user['error'])){ 
                            // There are errors
                            $iErrors[] = $user;
                        }
                    }
                    $view->assign('insert', $insert);
                    $view->assign('update', $update);
                    $view->assign('iErrors', $iErrors);
                    $view->assign('header', $oHeader);
                    $view->assign('hc', count($oHeader));
                    return $view->fetch('IWusers_admin_importResults.tpl');        

                } // File header is correct
            } // exist import file                
        } // Is POST
         
        // Get zikula groups name and gid
        $g = UserUtil::getGroups('','name');
        foreach ($g as $key => $value) {
            $groupInfo[] = array_slice($value,0,2);
        }
                
        $view->assign('post_max_size', ini_get('post_max_size'));
        $view->assign('groupInfo', $groupInfo);
        
        return $view->fetch('IWusers_admin_import.tpl');        
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:101,代码来源:Admin.php

示例4: getSelector_Group

 /**
  * Return the html for the PN user group selector.
  *
  * @param string  $name          The selector name.
  * @param integer $selectedValue The currently selected value of the selector (optional) (default=0).
  * @param integer $defaultValue  The default value of the selector (optional) (default=0).
  * @param string  $defaultText   The text of the default value (optional) (default='').
  * @param integer $allValue      The value to assign for the "All" choice (optional) (default=0).
  * @param string  $allText       The text to display for the "All" choice (optional) (default='').
  * @param string  $excludeList   A (string) list of IDs to exclude (optional) (default=null).
  * @param boolean $submit        Whether or not to auto-submit the selector (optional) (default=false).
  * @param boolean $disabled      Whether or not to disable selector (optional) (default=false).
  * @param integer $multipleSize  The size to use for a multiple selector, 1 produces a normal/single selector (optional (default=1).
  *
  * @return The html for the user group selector.
  */
 public static function getSelector_Group($name = 'groupid', $selectedValue = 0, $defaultValue = 0, $defaultText = '', $allValue = 0, $allText = '', $excludeList = '', $submit = false, $disabled = false, $multipleSize = 1)
 {
     $data = array();
     $grouplist = UserUtil::getGroups(array(), array('name' => 'ASC'));
     foreach ($grouplist as $k => $v) {
         $id = $v['gid'];
         $disp = $v['name'];
         if (strpos($excludeList, ",{$id},") === false) {
             $data[$id] = $disp;
         }
     }
     return self::getSelector_Generic($name, $data, $selectedValue, $defaultValue, $defaultText, $allValue, $allText, $submit, $disabled, $multipleSize);
 }
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:29,代码来源:HtmlUtil.php

示例5: optimizeGroups

 /**
  * Simplify "in" & "out" file information. 
  *   
  * > The purpose is optimize insertion and deletion actions.\n
  * > For example, if file indicates that a user must be deleted from a group
  * > and added in the same group id, group id will be removed from "in" and "out" list.\n
  * > Filter non existent group ids. Aviod redundant information processing
  * 
  * @parameter array $args.
  * Array description:
  * * integer **uid** User id
  * * string **in** Group ids separated by "|". Group ids where user will be added.
  * * string **out** Group ids separated by "|". Group ids where user will be removed.
  * 
  * @return array 
  */
 public function optimizeGroups($args){
     $this->throwForbiddenUnless(SecurityUtil::checkPermission('IWusers::', '::', ACCESS_READ));
     $line = $args['data'];
     //Initialize vars
     $result = array();
     $result['in'] = null;
     $result['out'] = null;
             
     // All Zikula groups
     $allGroups = array_keys(UserUtil::getGroups());
     // User groups
     $usrGroups = UserUtil::getGroupsForUser($args['uid']); 
    
     if (array_key_exists('in', $line)) {
         // File contains "in" field
         // 1. Erase non exitent groups
         $clean_in = array_intersect($allGroups, explode('|', $line['in']));
         // 2. Mantain only new groups. Remove gid from list "in" if user already belongs to this group            
         $result['in'] = implode('|', array_diff($clean_in, $usrGroups));             
     } else {
         // Needed in "out" clean process
         $clean_in = array();
     }        
     if (array_key_exists('out', $line)) {
         // File contains "out" field
         $out = explode('|', $line['out']);
         // 1. Erase non exitent groups
         $clean_out = array_intersect($allGroups, explode('|', $line['out']));
         // 2. Only in "out" list gid that are not in "in" list
         $out = array_diff($clean_out, $clean_in);
         // 3. Only in "out" list gids where user is member
         $result['out'] = implode('|', array_intersect($out, $usrGroups));            
     }                
     return $result;
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:51,代码来源:Admin.php

示例6: getAllGroupsUnits

/**
     * Funció: getAllGroups
     *         Retorna tots els grups de zikula
     * @author: Joan Guillén i Pelegay(jguille2@xtec.cat)
     * @param: 
     * @return: Array amb tota la taula groups
     */
    public function getAllGroupsUnits() {
        //Verificar permisos
       $this->throwForbiddenUnless(SecurityUtil::checkPermission('Cataleg::', '::', ACCESS_READ));
      /* $grupsUnitatsLlista = ModUtil::getVar("Cataleg", "grupsUnitats");
       //$allGroups = DBUtil::selectObjectArray('groups', '','','-1','-1','gid');
       $allGroups = UserUtil::getGroups();
       foreach ($grupsUnitatsLlista as $grup) {
           $allGroupsUnits[$grup] = $allGroups[$grup];
       }*/
       $allGroups = UserUtil::getGroups('','name');
       $grupsUnitatsLlista = ModUtil::getVar("Cataleg", "grupsUnitats");
       foreach ($allGroups as $gid=>$group){
           if (in_array($gid,$grupsUnitatsLlista)) {
               $allGroupsUnits[$gid] = $group;
           }
       }
       return $allGroupsUnits;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:25,代码来源:Admin.php


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