Dotclear

Changeset 33:ec137d251a9f for inc/core


Ignore:
Timestamp:
04/28/11 16:31:56 (14 years ago)
Author:
Franck <carnet.franck.paul@…>
Branch:
userprefs
Message:

Bugfix de synchro des préfs fusionnées sur la suppression d'une ou plusieurs préférences

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/core/class.dc.workspace.php

    r30 r33  
    291291               unset($this->{$array.'_prefs'}[$id]); 
    292292          } 
     293 
     294          $this->prefs = $this->global_prefs; 
     295          foreach ($this->local_prefs as $id => $v) { 
     296               $this->prefs[$id] = $v; 
     297          } 
     298     } 
     299 
     300     /** 
     301     Removes all existing pref. in a Workspace  
     302      
     303     @param    force_global   <b>boolean</b> Force global pref drop 
     304     */ 
     305     public function dropAll($force_global=false) 
     306     { 
     307          if (!$this->ws) { 
     308               throw new Exception(__('No workspace specified')); 
     309          } 
     310           
     311          $strReq = 'DELETE FROM '.$this->table.' '; 
     312           
     313          if (($force_global) || ($this->user_id === null)) { 
     314               $strReq .= 'WHERE user_id IS NULL '; 
     315               $global = true; 
     316          } else { 
     317               $strReq .= "WHERE user_id = '".$this->con->escape($this->user_id)."' "; 
     318               $global = false; 
     319          } 
     320           
     321          $strReq .= "AND pref_ws = '".$this->con->escape($this->ws)."' "; 
     322           
     323          $this->con->execute($strReq); 
     324           
     325          $array = $global ? 'global' : 'local'; 
     326          unset($this->{$array.'_prefs'}); 
     327          $this->{$array.'_prefs'} = array(); 
     328           
     329          $array = $global ? 'local' : 'global'; 
     330          $this->prefs = $this->{$array.'_prefs'}; 
    293331     } 
    294332      
Note: See TracChangeset for help on using the changeset viewer.

Sites map