2015-01-21 15:46:41 +01:00
|
|
|
<?php
|
2015-02-04 10:46:36 +01:00
|
|
|
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
2015-01-21 15:46:41 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper for generating frequently used jump links
|
|
|
|
*
|
|
|
|
* Most of the monitoring overviews link to detail information, e.g. the full information of the involved monitored
|
|
|
|
* object. Instead of reintroducing link generation and translation in those views, this helper contains most
|
|
|
|
* frequently used jump links.
|
|
|
|
*/
|
|
|
|
class Zend_View_Helper_Link extends Zend_View_Helper_Abstract
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Helper entry point
|
|
|
|
*
|
|
|
|
* @return $this
|
|
|
|
*/
|
|
|
|
public function link()
|
|
|
|
{
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a host link
|
|
|
|
*
|
|
|
|
* @param string $host Hostname
|
|
|
|
* @param string $linkText Link text, e.g. the host's display name
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function host($host, $linkText)
|
|
|
|
{
|
|
|
|
return $this->view->qlink(
|
|
|
|
$linkText,
|
2015-02-23 17:07:21 +01:00
|
|
|
'monitoring/host/show',
|
2015-04-08 16:25:29 +02:00
|
|
|
array('host_name' => $host),
|
2015-02-23 17:07:21 +01:00
|
|
|
array('title' => sprintf($this->view->translate('Show detailed information for host %s'), $host))
|
2015-01-21 15:46:41 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a service link
|
|
|
|
*
|
|
|
|
* @param string $service Service name
|
|
|
|
* @param string $serviceLinkText Text for the service link, e.g. the service's display name
|
|
|
|
* @param string $host Hostname
|
|
|
|
* @param string $hostLinkText Text for the host link, e.g. the host's display name
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function service($service, $serviceLinkText, $host, $hostLinkText)
|
|
|
|
{
|
|
|
|
return sprintf(
|
|
|
|
$this->view->translate('%s on %s', 'Service running on host'),
|
|
|
|
$this->view->qlink(
|
|
|
|
$serviceLinkText,
|
2015-02-23 17:07:21 +01:00
|
|
|
'monitoring/service/show',
|
2015-04-20 16:09:14 +02:00
|
|
|
array('host_name' => $host, 'service' => $service),
|
2015-02-23 17:07:21 +01:00
|
|
|
array('title' => sprintf(
|
|
|
|
$this->view->translate('Show detailed information for service %s on host %s'),
|
|
|
|
$service,
|
|
|
|
$host
|
|
|
|
))
|
2015-01-21 15:46:41 +01:00
|
|
|
),
|
|
|
|
$this->host($host, $hostLinkText)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|