mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
monitoring/lib: Add translate parameter to MonitoredObject::getType()
This commit is contained in:
parent
331c01c371
commit
b585b92196
@ -580,11 +580,27 @@ abstract class MonitoredObject implements Filterable
|
|||||||
/**
|
/**
|
||||||
* Get the type of the object
|
* Get the type of the object
|
||||||
*
|
*
|
||||||
* @return string
|
* @param bool $translate
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getType()
|
public function getType($translate = false)
|
||||||
{
|
{
|
||||||
return $this->type;
|
if ($translate !== false) {
|
||||||
|
switch ($this->type) {
|
||||||
|
case self::TYPE_HOST:
|
||||||
|
$type = mt('montiroing', 'host');
|
||||||
|
break;
|
||||||
|
case self::TYPE_SERVICE:
|
||||||
|
$type = mt('monitoring', 'service');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new InvalidArgumentException('Invalid type ' . $this->type);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$type = $this->type;
|
||||||
|
}
|
||||||
|
return $type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user