Changeset 2593:6741802596a0 for inc/admin/class.dc.menu.php
- Timestamp:
- 11/27/13 16:32:38 (12 years ago)
- Branch:
- twig
- Children:
- 2612:1537212bd291, 2613:014098e27ea0
- Parents:
- 2468:d7fda5a0bd39 (diff), 2589:3d427735ca70 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
inc/admin/class.dc.menu.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/class.dc.menu.php
r2566 r2593 4 4 # This file is part of Dotclear 2. 5 5 # 6 # Copyright (c) 2003-201 3Olivier Meunier & Association Dotclear6 # Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear 7 7 # Licensed under the GPL version 2.0 license. 8 8 # See LICENSE file or … … 14 14 class dcMenu 15 15 { 16 private $items; 16 17 private $id; 17 18 public $title; 18 19 public function __construct($id,$title,$itemSpace='') 19 public $separator; 20 21 public function __construct($id,$title,$separator='') 20 22 { 21 23 $this->id = $id; 22 24 $this->title = $title; 23 $this-> itemSpace = $itemSpace;25 $this->separator = $separator; 24 26 $this->items = array(); 25 27 } 26 28 29 public function getID() 30 { 31 return $this->id; 32 } 33 34 public function getTitle() 35 { 36 return $this->title; 37 } 38 39 public function getSeparator() 40 { 41 return $this->separator; 42 } 43 44 public function getItems() 45 { 46 return $this->items; 47 } 48 27 49 public function addItem($title,$url,$img,$active,$show=true,$id=null,$class=null) 28 50 { … … 31 53 } 32 54 } 33 55 34 56 public function prependItem($title,$url,$img,$active,$show=true,$id=null,$class=null) 35 57 { … … 38 60 } 39 61 } 40 41 public function draw() 42 { 43 if (count($this->items) == 0) { 44 return ''; 45 } 46 47 $res = 48 '<div id="'.$this->id.'">'. 49 ($this->title ? '<h3>'.$this->title.'</h3>' : ''). 50 '<ul>'."\n"; 51 52 for ($i=0; $i<count($this->items); $i++) 53 { 54 if ($i+1 < count($this->items) && $this->itemSpace != '') { 55 $res .= preg_replace('|</li>$|',$this->itemSpace.'</li>',$this->items[$i]); 56 $res .= "\n"; 57 } else { 58 $res .= $this->items[$i]."\n"; 59 } 60 } 61 62 $res .= '</ul></div>'."\n"; 63 64 return $res; 65 } 66 62 67 63 protected function itemDef($title,$url,$img,$active,$id=null,$class=null) 68 64 { … … 74 70 $ahtml = ''; 75 71 } 76 77 $img = dc_admin_icon_url($img); 78 72 73 return array( 74 'title' => $title, 75 'link' => $link, 76 'ahtml' => $ahtml, 77 'img' => dc_admin_icon_url($img), 78 'active' => (boolean) $active, 79 'id' => $id, 80 'class' => $class 81 ); 82 } 83 84 /** 85 @deprecated Use Template engine instead 86 */ 87 public function draw() 88 { 89 if (count($this->items) == 0) { 90 return ''; 91 } 92 93 $res = 94 '<div id="'.$this->id.'">'. 95 ($this->title ? '<h3>'.$this->title.'</h3>' : ''). 96 '<ul>'."\n"; 97 98 for ($i=0; $i<count($this->items); $i++) 99 { 100 if ($i+1 < count($this->items) && $this->separator != '') { 101 $res .= preg_replace('|</li>$|',$this->separator.'</li>',$this->drawItem($this->items[$i])); 102 $res .= "\n"; 103 } else { 104 $res .= $this->drawItem($this->items[$i])."\n"; 105 } 106 } 107 108 $res .= '</ul></div>'."\n"; 109 110 return $res; 111 } 112 113 /** 114 @deprecated Use Template engine instead 115 */ 116 protected function drawItem($item) 117 { 79 118 return 80 '<li'.(($ active || $class) ? ' class="'.(($active) ? 'active ' : '').(($class) ? $class: '').'"' : '').81 (($i d) ? ' id="'.$id.'"' : '').82 (($i mg) ? ' style="background-image: url('.$img.');"' : '').119 '<li'.(($item['active'] || $item['class']) ? ' class="'.(($item['active']) ? 'active ' : '').(($item['class']) ? $item['class'] : '').'"' : ''). 120 (($item['id']) ? ' id="'.$item['id'].'"' : ''). 121 (($item['img']) ? ' style="background-image: url('.$item['img'].');"' : ''). 83 122 '>'. 84 85 '<a href="'.$ link.'"'.$ahtml.'>'.$title.'</a></li>'."\n";123 124 '<a href="'.$item['link'].'"'.$item['ahtml'].'>'.$item['title'].'</a></li>'."\n"; 86 125 } 87 126 } 127 ?>
Note: See TracChangeset
for help on using the changeset viewer.
