controller = $controller; $this->action = $action; $this->param = $param; $this->iconClass = $iconClass; if($active != null) { $this->active = $active; } else { $this->active = ($GLOBALS["side"] == $controller && $GLOBALS["subside"] == $action && $GLOBALS["passed"] == $param); } $this->title = $title; return $this; } public function setIconColor($iconColorClass) { $this->iconColor = $iconColorClass; return $this; } public function setBGColor($bgColorClass) { $this->bgColorClass = $bgColorClass; return $this; } private function isActive() { return $this->active; } private function link() { $self = $GLOBALS["self"]; if($this->hasChilds()) { return $self->Html->link( $this->title.'', ['controller' => $this->controller, "action" => $this->action, $this->param], ['escape' => false] ); } else { return $self->Html->Link( ''. $this->iconClass .'' .'' . $this->title . '', ['controller' => $this->controller, 'action' => $this->action, $this->param], ['class' => $this->bgColorClass, 'escape' => false]); } } public function __toString() { $str = ""; $str .= "hasChilds()) { $class .= "dropdown";} if($this->isActive()) { $class .= " selected"; } if(strlen($class) > 0 ) $str .= " class='$class'"; $str .= ">"; $str .= $this->link(); if($this->hasChilds()) { $str .= ""; } $str .= ""; return $str; } }