mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-26 09:19:35 -05:00
48 lines
1.3 KiB
PHP
48 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Icinga\Module\Businessprocess\Renderer\TileRenderer;
|
|
|
|
use Icinga\Module\Businessprocess\BusinessProcess;
|
|
use Icinga\Module\Businessprocess\Html\BaseElement;
|
|
use Icinga\Module\Businessprocess\Html\Icon;
|
|
use Icinga\Module\Businessprocess\Html\Link;
|
|
use Icinga\Module\Businessprocess\Renderer\Renderer;
|
|
use Icinga\Module\Businessprocess\Web\Url;
|
|
|
|
class AddNewTile extends BaseElement
|
|
{
|
|
protected $tag = 'div';
|
|
|
|
protected $node;
|
|
|
|
protected $defaultAttributes = array('class' => 'addnew');
|
|
|
|
public function __construct(Renderer $renderer)
|
|
{
|
|
$bp = $renderer->getBusinessProcess();
|
|
$path = $renderer->getCurrentPath();
|
|
|
|
$params = array(
|
|
'config' => $bp->getName()
|
|
);
|
|
|
|
// Workaround for array issues
|
|
$url = Url::fromPath('businessprocess/node/add');
|
|
$p = $url->getParams();
|
|
$p->mergeValues($params);
|
|
if (! empty($path)) {
|
|
$p->addValues('path', $path);
|
|
}
|
|
|
|
$this->add(
|
|
Link::create(
|
|
Icon::create('plus'),
|
|
$url,
|
|
null,
|
|
array(
|
|
'title' => $this->translate('Add a new business process node')
|
|
)
|
|
)->addContent($this->translate('Add'))
|
|
);
|
|
}
|
|
}
|