Changeset 3075:2efd73dc6db6
- Timestamp:
- 08/16/15 09:27:01 (9 years ago)
- Branch:
- default
- Location:
- inc/admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/class.dc.favorites.php
r2725 r3075 315 315 true, 316 316 $v['id'], 317 $v['class'] 317 $v['class'], 318 true 318 319 ); 319 320 } -
inc/admin/class.dc.menu.php
r2566 r3075 22 22 $this->title = $title; 23 23 $this->itemSpace = $itemSpace; 24 $this->pinned = array(); 24 25 $this->items = array(); 25 26 } 26 27 27 public function addItem($title,$url,$img,$active,$show=true,$id=null,$class=null )28 public function addItem($title,$url,$img,$active,$show=true,$id=null,$class=null,$pinned=false) 28 29 { 29 30 if($show) { 30 $this->items[] = $this->itemDef($title,$url,$img,$active,$id,$class); 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 } 31 37 } 32 38 } 33 39 34 public function prependItem($title,$url,$img,$active,$show=true,$id=null,$class=null )40 public function prependItem($title,$url,$img,$active,$show=true,$id=null,$class=null,$pinned=false) 35 41 { 36 42 if ($show) { 37 array_unshift($this->items,$this->itemDef($title,$url,$img,$active,$id,$class)); 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 } 38 49 } 39 50 } … … 41 52 public function draw() 42 53 { 43 if (count($this->items) == 0) {54 if (count($this->items) + count($this->pinned) == 0) { 44 55 return ''; 45 56 } … … 50 61 '<ul>'."\n"; 51 62 52 for ($i=0; $i<count($this->items); $i++) 63 // 1. Display pinned items (unsorted) 64 for ($i=0; $i<count($this->pinned); $i++) 65 { 66 if ($i+1 < count($this->pinned) && $this->itemSpace != '') { 67 $res .= preg_replace('|</li>$|',$this->itemSpace.'</li>',$this->pinned[$i]); 68 $res .= "\n"; 69 } else { 70 $res .= $this->pinned[$i]."\n"; 71 } 72 } 73 74 // 2. Display unpinned itmes (sorted) 75 $i = 0; 76 dcUtils::lexicalKeySort($this->items); 77 foreach ($this->items as $title => $item) 53 78 { 54 79 if ($i+1 < count($this->items) && $this->itemSpace != '') { 55 $res .= preg_replace('|</li>$|',$this->itemSpace.'</li>',$ this->items[$i]);80 $res .= preg_replace('|</li>$|',$this->itemSpace.'</li>',$item); 56 81 $res .= "\n"; 57 82 } else { 58 $res .= $ this->items[$i]."\n";83 $res .= $item."\n"; 59 84 } 85 $i++; 60 86 } 61 87 -
inc/admin/prepend.php
r3059 r3075 69 69 70 70 $url = $core->adminurl->get($adminurl); 71 $_menu[$section]->prependItem($desc,$url,$icon,preg_match('/'.preg_quote($url).'(\?.*)?$/',$_SERVER['REQUEST_URI']),$perm); 71 $_menu[$section]->prependItem($desc,$url,$icon, 72 preg_match('/'.preg_quote($url).'(\?.*)?$/',$_SERVER['REQUEST_URI']),$perm,null,null,true); 72 73 } 73 74
Note: See TracChangeset
for help on using the changeset viewer.