mirror of
				https://github.com/Icinga/icingaweb2.git
				synced 2025-10-31 03:14:31 +01:00 
			
		
		
		
	This reverts commit b9aee47d1f44893ef953bf9168e21f368b95ed7f. Conflicts: modules/monitoring/application/views/scripts/list/comments.phtml modules/monitoring/application/views/scripts/list/downtimes.phtml
		
			
				
	
	
		
			67 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			PHTML
		
	
	
	
	
	
			
		
		
	
	
			67 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			PHTML
		
	
	
	
	
	
| <tr>
 | |
|     <th><?= $this->translate('Notifications') ?></th>
 | |
|     <td>
 | |
|         <?php
 | |
|         /** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */
 | |
|         if ($this->hasPermission('monitoring/command/send-custom-notification')) {
 | |
|             if ($object->getType() === $object::TYPE_HOST) {
 | |
|                 /** @var \Icinga\Module\Monitoring\Object\Host $object */
 | |
|                 echo $this->qlink(
 | |
|                     $this->translate('Send notification'),
 | |
|                     'monitoring/host/send-custom-notification',
 | |
|                     array('host_name' => $object->getName()),
 | |
|                     array(
 | |
|                         'icon'              => 'bell',
 | |
|                         'data-base-target'  => '_self',
 | |
|                         'title'             => $this->translate(
 | |
|                             'Send a custom notification to contacts responsible for this host'
 | |
|                         )
 | |
|                     )
 | |
|                 );
 | |
|             } else {
 | |
|                 /** @var \Icinga\Module\Monitoring\Object\Service $object */
 | |
|                 echo $this->qlink(
 | |
|                     $this->translate('Send notification'),
 | |
|                     'monitoring/service/send-custom-notification',
 | |
|                     array('host_name' => $object->getHost()->getName(), 'service_description' => $object->getName()),
 | |
|                     array(
 | |
|                         'icon'              => 'bell',
 | |
|                         'data-base-target'  => '_self',
 | |
|                         'title'             => $this->translate(
 | |
|                             'Send a custom notification to contacts responsible for this service'
 | |
|                         )
 | |
|                     )
 | |
|                 );
 | |
|             }
 | |
|             if (! in_array((int) $object->state, array(0, 99))) {
 | |
|                 echo '<br />';
 | |
|             }
 | |
|         } elseif (in_array((int) $object->state, array(0, 99))) {
 | |
|             echo '-';
 | |
|         }
 | |
|         // We are not interested in notifications for OK or pending objects
 | |
|         if (! in_array((int) $object->state, array(0, 99))) {
 | |
|             if ($object->current_notification_number > 0) {
 | |
|                 if ((int) $object->current_notification_number === 1) {
 | |
|                     $msg = sprintf(
 | |
|                         $this->translate('A notification has been sent for this issue %s.'),
 | |
|                         $this->timeAgo($object->last_notification)
 | |
|                     );
 | |
|                 } else {
 | |
|                     $msg = sprintf(
 | |
|                         $this->translate('%d notifications have been sent for this issue.'),
 | |
|                         $object->current_notification_number
 | |
|                     ) . '<br />' . sprintf(
 | |
|                         $this->translate('The last one was sent %s.'),
 | |
|                         $this->timeAgo($object->last_notification)
 | |
|                     );
 | |
|                 }
 | |
|             } else {
 | |
|                 $msg = $this->translate('No notification has been sent for this issue.');
 | |
|             }
 | |
|             echo $msg;
 | |
|         }
 | |
|         ?>
 | |
|     </td>
 | |
| </tr>
 |