summaryrefslogtreecommitdiffstats
path: root/application/views/helpers/Breadcrumb.php
blob: 32637122c8a589cb9b893e3544bbbefed5f0abd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/* Icinga Web 2 | (c) 2016 Icinga Development Team | GPLv2+ */

use Icinga\Module\Toplevelview\Tree\TLVTreeNode;

class Zend_View_Helper_Breadcrumb extends Zend_View_Helper_Abstract
{
    /** @var \Icinga\Web\View */
    public $view;

    /**
     * @param TLVTreeNode[] $breadcrumb
     *
     * @return string
     */
    public function breadcrumb($breadcrumb, $config_name)
    {
        $htm = '<ul class="breadcrumb">';
        foreach ($breadcrumb as $crumb) {
            $htm .= '<li>' . $this->view->qlink(
                $crumb->getTitle(),
                'toplevelview/show/tree',
                array(
                        'name' => $config_name,
                        'id'   => $crumb->getFullId()
                    )
            ) . '</li>';
        }
        $htm .= '</ul>';
        return $htm;
    }
}