| 1 |
<?php |
| 2 |
/* Icinga Web 2 | (c) 2016 Icinga Development Team | GPLv2+ */ |
| 3 |
|
| 4 |
use Icinga\Module\Toplevelview\Tree\TLVTreeNode; |
| 5 |
use Icinga\Module\Toplevelview\Util\Str; |
| 6 |
|
| 7 |
class Zend_View_Helper_Breadcrumb extends Zend_View_Helper_Abstract |
| 8 |
{ |
| 9 |
/** @var \Icinga\Web\View */ |
| 10 |
public $view; |
| 11 |
|
| 12 |
/** |
| 13 |
* breadcrumb renders a list of TLVTreeNodes into a HTML breadcrumb list |
| 14 |
* |
| 15 |
* @param TLVTreeNode[] $breadcrumb |
| 16 |
* |
| 17 |
* @return string |
| 18 |
*/ |
| 19 |
public function breadcrumb($breadcrumb, $config_name) |
| 20 |
{ |
| 21 |
$htm = '<ul class="breadcrumb">'; |
| 22 |
foreach ($breadcrumb as $crumb) { |
| 23 |
$htm .= '<li>' . $this->view->qlink( |
| 24 |
Str::limit($crumb->getTitle()), |
| 25 |
'toplevelview/show/tree', |
| 26 |
[ |
| 27 |
'name' => $config_name, |
| 28 |
'id' => $crumb->getFullId() |
| 29 |
] |
| 30 |
) . '</li>'; |
| 31 |
} |
| 32 |
$htm .= '</ul>'; |
| 33 |
return $htm; |
| 34 |
} |
| 35 |
} |