53 parent::__construct(
$identifier,
"div",
"ui breadcrumb");
56 $this->_contentSeparator =
"<div class='divider'> / </div>";
58 return $e->getContent();
60 if (isset($hrefFunction)) {
61 $this->_hrefFunction = $hrefFunction;
75 return $this->
getOnClick($this->root, $targetSelector, array(
81 if ($this->autoActive) {
84 return parent::contentAsString();
92 if (! isset($index)) {
95 $activeItem = $this->content[$index];
96 $activeItem->addToProperty(
"class",
"active");
97 $activeItem->setTagName(
"div");
120 public function getHref($index =
null, $separator =
"/") {
121 if (! isset($index)) {
124 if ($this->absolutePaths ===
true) {
125 return $this->_hrefFunction($this->content[$index]);
127 return $this->root . implode($separator, array_slice(array_map(
function ($e) {
128 return $this->_hrefFunction($e);
160 if ($this->autoActive) {
163 $count = $this->
count();
164 for ($i = 1; $i < $count; $i ++) {
167 return parent::compile($js, $view);
174 public function on($event, $jsCode, $stopPropagation =
false, $preventDefault =
false) {
175 foreach ($this->content as $element) {
176 $element->on($event, $jsCode, $stopPropagation, $preventDefault);
181 public function _ajaxOn($operation, $event, $url, $responseElement =
"", $parameters = array()) {
182 foreach ($this->content as $element) {
183 if ($element->getProperty($this->attr) != NULL) {
184 $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters);
197 $count = $this->
count();
199 if (\is_array($value)) {
200 @list ($text, $href) = $value;
201 $itemO->setContent($text);
202 $itemO->setProperty(
'href', $href);
204 $itemO->setContent($value);
210 $item = $this->
getItem($index);
212 $icon =
new HtmlIcon(
"icon-" . $this->identifier, $icon);
213 $item->wrapContent($icon);
218 $count = $this->
count();
219 $itemO = parent::addItem($item);
223 $itemO->setProperty($this->attr, $this->
getHref($count));
233 $size = \sizeof($this->content);
234 for ($i = 0; $i < $size; $i ++) {
235 $this->content[$i]->setProperty($this->attr, $this->
getHref($i));
fromDispatcher($dispatcher)
Collects url parts from the request dispatcher : controllerName, actionName, parameters Used internal...
getItem($index)
Return the item at index.
getOnClick($url, $responseElement="", $parameters=array())
Performs a get to $url on the click event on $element and display it in $responseElement.
Base class for Semantic double elements.
Sem class for navigation elements : Breadcrumbs and Pagination.
getContentDivider($index)
addToPropertyCtrl($name, $value, $typeCtrl)
Semantic UI Breadcrumb component.
createItem($value)
{The item factory.}
setStartIndex($startIndex)
setAutoActive($autoActive)
fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0)
Adds new elements in breadcrumbs corresponding to request dispatcher : controllerName,...
autoGetOnClick($targetSelector)
Associate an ajax get to the breadcrumb elements, displayed in $targetSelector $this->attr member is ...
addItem($item)
adds and returns an item
setHrefFunction($_hrefFunction)
sets the function who generates the href elements.
compile(JsUtils $js=NULL, &$view=NULL)
_ajaxOn($operation, $event, $url, $responseElement="", $parameters=array())
getHref($index=null, $separator="/")
Returns the url of the element at $index or the breadcrumbs url if $index is ommited.
setAbsolutePaths($absolutePaths)
on($event, $jsCode, $stopPropagation=false, $preventDefault=false)
__construct($identifier, $items=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL)