Dotclear


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/admin/class.dc.menu.php

    r3075 r2566  
    2222          $this->title = $title; 
    2323          $this->itemSpace = $itemSpace; 
    24           $this->pinned = array(); 
    2524          $this->items = array(); 
    2625     } 
    2726 
    28      public function addItem($title,$url,$img,$active,$show=true,$id=null,$class=null,$pinned=false) 
     27     public function addItem($title,$url,$img,$active,$show=true,$id=null,$class=null) 
    2928     { 
    3029          if($show) { 
    31                $item = $this->itemDef($title,$url,$img,$active,$id,$class); 
    32                if ($pinned) { 
    33                     $this->pinned[] = $item; 
    34                } else { 
    35                     $this->items[$title] = $item; 
    36                } 
     30               $this->items[] = $this->itemDef($title,$url,$img,$active,$id,$class); 
    3731          } 
    3832     } 
    3933 
    40      public function prependItem($title,$url,$img,$active,$show=true,$id=null,$class=null,$pinned=false) 
     34     public function prependItem($title,$url,$img,$active,$show=true,$id=null,$class=null) 
    4135     { 
    4236          if ($show) { 
    43                $item = $this->itemDef($title,$url,$img,$active,$id,$class); 
    44                if ($pinned) { 
    45                     array_unshift($this->pinned,$item); 
    46                } else { 
    47                     $this->items[$title] = $item; 
    48                } 
     37               array_unshift($this->items,$this->itemDef($title,$url,$img,$active,$id,$class)); 
    4938          } 
    5039     } 
     
    5241     public function draw() 
    5342     { 
    54           if (count($this->items) + count($this->pinned) == 0) { 
     43          if (count($this->items) == 0) { 
    5544               return ''; 
    5645          } 
     
    6150          '<ul>'."\n"; 
    6251 
    63           // 1. Display pinned items (unsorted) 
    64           for ($i=0; $i<count($this->pinned); $i++) 
     52          for ($i=0; $i<count($this->items); $i++) 
    6553          { 
    66                if ($i+1 < count($this->pinned) && $this->itemSpace != '') { 
    67                     $res .= preg_replace('|</li>$|',$this->itemSpace.'</li>',$this->pinned[$i]); 
     54               if ($i+1 < count($this->items) && $this->itemSpace != '') { 
     55                    $res .= preg_replace('|</li>$|',$this->itemSpace.'</li>',$this->items[$i]); 
    6856                    $res .= "\n"; 
    6957               } else { 
    70                     $res .= $this->pinned[$i]."\n"; 
     58                    $res .= $this->items[$i]."\n"; 
    7159               } 
    72           } 
    73  
    74           // 2. Display unpinned itmes (sorted) 
    75           $i = 0; 
    76           dcUtils::lexicalKeySort($this->items); 
    77           foreach ($this->items as $title => $item) 
    78           { 
    79                if ($i+1 < count($this->items) && $this->itemSpace != '') { 
    80                     $res .= preg_replace('|</li>$|',$this->itemSpace.'</li>',$item); 
    81                     $res .= "\n"; 
    82                } else { 
    83                     $res .= $item."\n"; 
    84                } 
    85                $i++; 
    8660          } 
    8761 
Note: See TracChangeset for help on using the changeset viewer.

Sites map