id = $id;
$this->title = $title;
$this->itemSpace = $itemSpace;
$this->items = array();
}
public function addItem($title,$url,$img,$active,$show=true,$id=null,$class=null)
{
if($show) {
$this->items[] = $this->itemDef($title,$url,$img,$active,$id,$class);
}
}
public function prependItem($title,$url,$img,$active,$show=true,$id=null,$class=null)
{
if ($show) {
array_unshift($this->items,$this->itemDef($title,$url,$img,$active,$id,$class));
}
}
public function draw()
{
if (count($this->items) == 0) {
return '';
}
$res =
'
'.
($this->title ? '
'.$this->title.'
' : '').
'
'."\n";
for ($i=0; $iitems); $i++)
{
if ($i+1 < count($this->items) && $this->itemSpace != '') {
$res .= preg_replace('|$|',$this->itemSpace.'',$this->items[$i]);
$res .= "\n";
} else {
$res .= $this->items[$i]."\n";
}
}
$res .= '
'."\n";
return $res;
}
protected function itemDef($title,$url,$img,$active,$id=null,$class=null)
{
if (is_array($url)) {
$link = $url[0];
$ahtml = (!empty($url[1])) ? ' '.$url[1] : '';
} else {
$link = $url;
$ahtml = '';
}
$img = dc_admin_icon_url($img);
return
''.
''.$title.''."\n";
}
}
?>