Beispiel #1
0
 public function GroupsSave()
 {
     if ($this->_POST) {
         $Users = new UsersModule();
         $UserGroupID = _intval($this->_POST['UserGroupID'], true);
         $Data['GroupName'] = trim($this->_POST['GroupName']);
         if (!$Data['GroupName']) {
             $this->__Message('缺少用户组名称!');
         }
         $Data['IsRoot'] = _intval($this->_POST['IsRoot'], true);
         $Data['RegEnable'] = _intval($this->_POST['RegEnable'], true);
         $Data['RegStatus'] = _intval($this->_POST['RegStatus'], true);
         $Data['LoginStatus'] = _intval($this->_POST['LoginStatus'], true);
         $Data['DisplayOrder'] = _intval($this->_POST['DisplayOrder'], true);
         if ($UserGroupID) {
             if ($Users->UpdateUserGroup($UserGroupID, $Data)) {
                 if ($Data['IsDefault']) {
                     $Users->SetUserDefaultGroup($UserGroupID);
                 }
                 $this->__Message('用户组更新成功!', UrlRewriteSimple('Users', 'Groups', true), '返回用户组');
             } else {
                 $this->__Message('用户组更新失败!');
             }
         } else {
             $UserGroupID = $Users->NewUserGroup($Data);
             if ($UserGroupID) {
                 if ($Data['IsDefault']) {
                     $Users->SetUserDefaultGroup($UserGroupID);
                 }
                 $this->__Message('用户组添加成功!', UrlRewriteSimple('Users', 'Groups', true), '返回用户组');
             } else {
                 $this->__Message('用户组添加失败!');
             }
         }
     }
 }