Exemplo n.º 1
0
 /**
  * return upload configuration for user for given user_id
  *       array('upload'=>in byte, 'upload_unit'=> kB, MB, GB or TB, 
  *              'quota'=>in byte, 'quota_unit'=> kB, MB, GB or TB,
  *               'forbidden'=> 1 or 0, 'types'=>array(forbidden datetypes)
  *               ,'area_close'=> 1=Dateibereich gesperrt 0=Dateibreich offen
  *               ,'area_close_text'=>Begruendung warm Dateibereich gesperrt) 
  * @param  $user_id a user_id
  * @return array()
  *  
  */
 public static function getUserConfig($user_id)
 {
     $user = array_shift(User::findByUser_id($user_id));
     $config = DocUsergroupConfig::getGroupConfig($user_id);
     if (empty($config)) {
         $config = DocUsergroupConfig::getGroupConfig($user['perms']);
     }
     if (empty($config)) {
         $config = DocUsergroupConfig::getGroupConfig('default');
     }
     return $config;
 }
Exemplo n.º 2
0
    public function individual_action($user_id = null) 
    {
        $users = array();
        if ($user_id != null) {
            $users = DocUsergroupConfig::searchForUser(array('user_id' => $user_id));
        }
        if (Request::submitted('search')) {
            $data['username'] = Request::get('userName');
            $data['Vorname'] = Request::get('userVorname');
            $data['Nachname'] = Request::get('userNachname');
            $data['Email'] = Request::get('userMail');
            if (Request::get('userGroup') != 'alle') {
                $data['perms'] = Request::get('userGroup');
            }
            $users = DocUsergroupConfig::searchForUser($data);
        }
        $userSetting = array();

        foreach ($users as $u) {
            $config = DocUsergroupConfig::getGroupConfig($u['user_id']);
            $foo = array();
            foreach ($u as $key => $value) {
                $foo[$key] = $value;
            }
            if (empty($config)) {
                $foo['upload'] = 'keine individuelle Einstellung';
                $foo['upload_unit'] = '';
                $foo['quota'] = 'keine individuelle Einstellung';
                $foo['quota_unit'] = '';
                $foo['forbidden'] = 0;
                $foo['area_close'] = 0;
                $foo['types'] = array();
                $foo['deleteIcon'] = 0;
                $userSetting[] = $foo;
            } else {
                $foo['config_id'] = $config['id'];
                $foo['upload'] = $this->sizeInUnit($config['upload_quota'], $config['upload_unit']);
                $foo['upload_unit'] = $config['upload_unit'];
                $foo['quota'] = $this->sizeInUnit($config['quota'], $config['quota_unit']);
                $foo['quota_unit'] = $config['quota_unit'];
                $foo['forbidden'] = $config['forbidden'];
                $foo['area_close'] = $config['area_close'];
                $foo['types'] = $config['types'];
                $foo['deleteIcon'] = 1;
                $userSetting[] = $foo;
            }
        }
        $viewData['users'] = $userSetting;
        $this->viewData = $viewData;
    }