2019-10-24 08:05:38 -04:00
|
|
|
<?php
|
|
|
|
|
|
2020-03-13 03:38:01 -04:00
|
|
|
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */
|
|
|
|
|
|
2023-05-25 05:18:21 -04:00
|
|
|
namespace Icinga\Module\Icingadb\Widget\ItemTable;
|
2019-10-24 08:05:38 -04:00
|
|
|
|
2019-11-04 19:07:30 -05:00
|
|
|
use Icinga\Module\Icingadb\Common\Links;
|
2021-04-29 10:32:29 -04:00
|
|
|
use Icinga\Module\Icingadb\Model\Usergroup;
|
2021-06-22 04:29:25 -04:00
|
|
|
use ipl\Html\Attributes;
|
2019-10-24 08:05:38 -04:00
|
|
|
use ipl\Html\BaseHtmlElement;
|
2021-04-29 10:32:29 -04:00
|
|
|
use ipl\Html\HtmlDocument;
|
|
|
|
|
use ipl\Html\HtmlElement;
|
2021-06-22 04:29:25 -04:00
|
|
|
use ipl\Html\Text;
|
2021-09-07 08:28:32 -04:00
|
|
|
use ipl\Stdlib\Filter;
|
2023-08-09 08:25:44 -04:00
|
|
|
use ipl\Web\Common\BaseTableRowItem;
|
2019-11-04 18:19:04 -05:00
|
|
|
use ipl\Web\Widget\Link;
|
2019-10-24 08:05:38 -04:00
|
|
|
|
2021-04-29 10:32:29 -04:00
|
|
|
/**
|
|
|
|
|
* Usergroup item of a usergroup list. Represents one database row.
|
|
|
|
|
*
|
|
|
|
|
* @property Usergroup $item
|
2023-05-25 05:18:21 -04:00
|
|
|
* @property UsergroupTable $table
|
2021-04-29 10:32:29 -04:00
|
|
|
*/
|
2023-05-25 05:18:21 -04:00
|
|
|
class UsergroupTableRow extends BaseTableRowItem
|
2019-10-24 08:05:38 -04:00
|
|
|
{
|
2023-05-25 05:18:21 -04:00
|
|
|
protected $defaultAttributes = ['class' => 'usergroup-table-row'];
|
2019-10-24 08:05:38 -04:00
|
|
|
|
2023-08-09 08:25:44 -04:00
|
|
|
protected function init(): void
|
2021-04-29 10:32:29 -04:00
|
|
|
{
|
2023-05-25 05:18:21 -04:00
|
|
|
if (isset($this->table)) {
|
|
|
|
|
$this->table->addDetailFilterAttribute($this, Filter::equal('name', $this->item->name));
|
|
|
|
|
}
|
2021-04-29 10:32:29 -04:00
|
|
|
}
|
2019-10-24 08:05:38 -04:00
|
|
|
|
2023-08-09 08:25:44 -04:00
|
|
|
protected function assembleVisual(BaseHtmlElement $visual): void
|
2019-10-24 08:05:38 -04:00
|
|
|
{
|
2021-06-22 04:29:25 -04:00
|
|
|
$visual->addHtml(new HtmlElement(
|
|
|
|
|
'div',
|
|
|
|
|
Attributes::create(['class' => 'usergroup-ball']),
|
|
|
|
|
Text::create($this->item->display_name[0])
|
|
|
|
|
));
|
2019-10-24 08:05:38 -04:00
|
|
|
}
|
|
|
|
|
|
2023-08-09 08:25:44 -04:00
|
|
|
protected function assembleTitle(BaseHtmlElement $title): void
|
2019-10-24 08:05:38 -04:00
|
|
|
{
|
2021-06-22 04:29:25 -04:00
|
|
|
$title->addHtml(
|
2023-05-25 05:18:21 -04:00
|
|
|
isset($this->table)
|
|
|
|
|
? new Link($this->item->display_name, Links::usergroup($this->item), ['class' => 'subject'])
|
|
|
|
|
: new HtmlElement(
|
2021-06-22 04:29:25 -04:00
|
|
|
'span',
|
|
|
|
|
Attributes::create(['class' => 'subject']),
|
|
|
|
|
Text::create($this->item->display_name)
|
2023-05-25 05:18:21 -04:00
|
|
|
),
|
|
|
|
|
new HtmlElement('span', null, Text::create($this->item->name))
|
2021-06-22 04:29:25 -04:00
|
|
|
);
|
2019-10-24 08:05:38 -04:00
|
|
|
}
|
2021-04-29 10:32:29 -04:00
|
|
|
|
2023-08-09 08:25:44 -04:00
|
|
|
protected function assembleColumns(HtmlDocument $columns): void
|
2021-04-29 10:32:29 -04:00
|
|
|
{
|
|
|
|
|
}
|
2019-10-24 08:05:38 -04:00
|
|
|
}
|