icingaweb2/library/Icinga/Web/Navigation/DashboardPane.php

74 lines
1.3 KiB
PHP
Raw Normal View History

2015-09-07 09:06:40 +02:00
<?php
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
namespace Icinga\Web\Navigation;
use Icinga\Web\Url;
/**
* A dashboard pane
*/
class DashboardPane extends NavigationItem
{
/**
* This pane's dashlets
*
* @var array
*/
protected $dashlets;
/**
* Set this pane's dashlets
*
* @param array $dashlets
*
* @return $this
*/
public function setDashlets(array $dashlets)
{
$this->dashlets = $dashlets;
return $this;
}
/**
* Return this pane's dashlets
*
* @param bool $order Whether to order the dashlets first
*
2015-09-07 09:06:40 +02:00
* @return array
*/
public function getDashlets($order = true)
2015-09-07 09:06:40 +02:00
{
if ($this->dashlets === null) {
return array();
}
if ($order) {
ksort($this->dashlets);
}
return $this->dashlets;
2015-09-07 09:06:40 +02:00
}
/**
* {@inheritdoc}
*/
public function init()
{
$this->setUrl(Url::fromPath('dashboard', array('pane' => $this->getName())));
}
/**
* {@inheritdoc}
*/
public function merge(NavigationItem $item)
{
parent::merge($item);
$this->setDashlets(array_merge(
$this->getDashlets(false),
$item->getDashlets(false)
));
}
2015-09-07 09:06:40 +02:00
}