Dotclear

Changeset 1532:f6c9584b4677 for inc/core


Ignore:
Timestamp:
08/23/13 13:16:14 (12 years ago)
Author:
Nicolas <nikrou77@…>
Branch:
default
Message:

Fix issue #1535 : Allow categories to be ordered by drag and drop
Need to close isse #655 : duplicated

Location:
inc/core
Files:
2 edited

Legend:

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

    r1468 r1532  
    555555          $this->triggerBlog(); 
    556556     } 
     557 
     558        /** 
     559        Set category position 
     560 
     561        @param  id              <b>integer</b>          Category ID 
     562        @param  left            <b>integer</b>          Category ID before 
     563        @param  right           <b>integer</b>          Category ID after 
     564        */ 
     565        public function updCategoryPosition($id,$left,$right) 
     566        { 
     567                $this->categories()->updatePosition($id,$left,$right); 
     568                $this->triggerBlog(); 
     569        } 
    557570      
    558571     /** 
  • inc/core/class.dc.categories.php

    r1179 r1532  
    188188     } 
    189189      
     190        public function updatePosition($id,$left,$right) 
     191        { 
     192                $sql = 'UPDATE '.$this->table.' SET ' 
     193                        .$this->f_left.' = '.$left.', ' 
     194                        .$this->f_right.' = '.$right 
     195                        .' WHERE '.$this->f_id .' = '.(integer) $id 
     196                        .$this->getCondition(); 
     197 
     198                $this->con->begin(); 
     199                try { 
     200                        $this->con->execute($sql); 
     201                        $this->con->commit(); 
     202                } catch (Exception $e) { 
     203                        $this->con->rollback(); 
     204                        throw $e; 
     205                } 
     206        } 
     207 
    190208     public function deleteNode($node,$keep_children=true) 
    191209     { 
Note: See TracChangeset for help on using the changeset viewer.

Sites map