mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-20 20:34:26 +02:00
IcingaTemplateRepository: list names
This commit is contained in:
parent
71ab8b4663
commit
fa286d1fcb
@ -71,4 +71,25 @@ class IcingaTemplateRepository
|
||||
public function storeChances(Db $db)
|
||||
{
|
||||
}
|
||||
|
||||
public function listAllowedTemplateNames()
|
||||
{
|
||||
$type = $this->type;
|
||||
$db = $this->connection->getDbAdapter();
|
||||
$table = 'icinga_' . $this->type;
|
||||
|
||||
$query = $db->select()
|
||||
->from($table, 'object_name')
|
||||
->order('object_name');
|
||||
|
||||
if ($type !== 'command') {
|
||||
$query->where('object_type = ?', 'template');
|
||||
}
|
||||
|
||||
if (in_array($type, ['host', 'service'])) {
|
||||
$query->where('template_choice_id IS NULL');
|
||||
}
|
||||
|
||||
return $db->fetchCol($query);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user