mirror of
				https://github.com/Icinga/icingaweb2.git
				synced 2025-10-31 03:14:31 +01:00 
			
		
		
		
	Conflicts: modules/monitoring/application/views/scripts/list/comments.phtml modules/monitoring/application/views/scripts/list/hostgroups.phtml modules/monitoring/application/views/scripts/process/info.phtml modules/monitoring/application/views/scripts/show/components/downtime.phtml modules/monitoring/application/views/scripts/show/components/notifications.phtml modules/monitoring/public/css/module.less
		
			
				
	
	
		
			63 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			PHTML
		
	
	
	
	
	
			
		
		
	
	
			63 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			PHTML
		
	
	
	
	
	
| <tr>
 | |
|     <th><?= $this->translate('Comments'); ?></th>
 | |
|     <td>
 | |
|         <?php if ($this->hasPermission('monitoring/command/comment/add')) {
 | |
|             /** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */
 | |
|             if ($object->getType() === $object::TYPE_HOST) {
 | |
|                 echo $this->qlink(
 | |
|                     $this->translate('Add comment'),
 | |
|                     'monitoring/host/add-comment',
 | |
|                     array('host' => $object->getName()),
 | |
|                     array(
 | |
|                         'icon'              => 'comment',
 | |
|                         'data-base-target'  => '_self',
 | |
|                         'title'             => $this->translate('Add a new comment to this host')
 | |
|                     )
 | |
|                 );
 | |
|             } else {
 | |
|                 echo $this->qlink(
 | |
|                     $this->translate('Add comment'),
 | |
|                     'monitoring/service/add-comment',
 | |
|                     array('host' => $object->getHost()->getName(), 'service' => $object->getName()),
 | |
|                     array(
 | |
|                         'icon'              => 'comment',
 | |
|                         'data-base-target'  => '_self',
 | |
|                         'title'             => $this->translate('Add a new comment to this service')
 | |
|                     )
 | |
|                 );
 | |
|             }
 | |
|         } else {
 | |
|             echo '-';
 | |
|         } ?>
 | |
|     </td>
 | |
| </tr>
 | |
| 
 | |
| <?php
 | |
| 
 | |
| foreach ($object->comments as $comment) {
 | |
|     // Ticket hook sample
 | |
|     $commentText = $this->tickets ? preg_replace_callback(
 | |
|         $this->tickets->getPattern(),
 | |
|         array($this->tickets, 'createLink'),
 | |
|         $this->escape($comment->comment)
 | |
|     ) : $this->escape($comment->comment);
 | |
| 
 | |
|     ?>
 | |
|     <tr>
 | |
|         <th><?= $this->escape($comment->author); ?> (<?= $this->timeAgo($comment->timestamp); ?>)</th>
 | |
|         <td data-base-target="_self">
 | |
|             <?php if (isset($delCommentForm)) { // Form is unset if the current user lacks the respective permission
 | |
|                 $delCommentForm = clone $delCommentForm;
 | |
|                 $delCommentForm->populate(
 | |
|                     array(
 | |
|                         'comment_id' => $comment->id,
 | |
|                         'comment_is_service' => isset($comment->service_description)
 | |
|                     )
 | |
|                 );
 | |
|                 echo $delCommentForm;
 | |
|             } ?>
 | |
|             <span class="sr-only">(<?= $this->translate('Comment'); ?>): </span><?= str_replace(array('\r\n', '\n'), '<br>', $commentText); ?>
 | |
|         </td>
 | |
|     </tr>
 | |
| <?php } // endforeach ?>
 |