mirror of
				https://github.com/Icinga/icingaweb2.git
				synced 2025-10-31 03:14:31 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			60 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			PHTML
		
	
	
	
	
	
			
		
		
	
	
			60 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			PHTML
		
	
	
	
	
	
| <tr>
 | |
|     <th><?= $this->translate('Comments') ?></th>
 | |
|     <td>
 | |
|         <?php
 | |
| 
 | |
|         /** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */
 | |
| 
 | |
|         if ($object->getType() === $object::TYPE_HOST) {
 | |
|             $addCommentLink = $this->href(
 | |
|                 'monitoring/host/add-comment',
 | |
|                 array('host' => $object->getName())
 | |
|             );
 | |
|         } else {
 | |
|             $addCommentLink = $this->href(
 | |
|                 'monitoring/service/add-comment',
 | |
|                 array('host' => $object->getHost()->getName(), 'service' => $object->getName())
 | |
|             );
 | |
|         }
 | |
| 
 | |
|         ?>
 | |
|         <a href="<?= $addCommentLink ?>">
 | |
|             <?= $this->icon('comment') ?> <?= $this->translate('Add comment') ?>
 | |
|         </a>
 | |
|     </td>
 | |
| </tr>
 | |
| 
 | |
| <?php
 | |
| 
 | |
| foreach ($object->comments as $comment) {
 | |
|     // Ticket hook sample
 | |
|     $text = $this->tickets ? preg_replace_callback(
 | |
|         $this->tickets->getPattern(),
 | |
|         array($this->tickets, 'createLink'),
 | |
|         $this->escape($comment->comment)
 | |
|     ) : $this->escape($comment->comment);
 | |
| 
 | |
| 
 | |
|     $form = clone $delCommentForm;
 | |
|     $form->populate(array('comment_id' => $comment->id));
 | |
| 
 | |
|     ?>
 | |
| 
 | |
|     <tr>
 | |
|         <th><?= $this->escape($comment->author) ?> (<?= $this->timeSince($comment->timestamp) ?>)</th>
 | |
|         <td>
 | |
|             <table>
 | |
|                 <tr>
 | |
|                     <td style="vertical-align: top;" data-base-target="_self">
 | |
|                         <?= $form ?> (<?= ucfirst($comment->type) ?>):
 | |
|                     </td>
 | |
|                     <td style="padding-left: .5em;">
 | |
|                         <?= str_replace(array('\r\n', '\n'), '<br>', $text) ?>
 | |
|                     </td>
 | |
|                 </tr>
 | |
|             </table>
 | |
|         </td>
 | |
|     </tr>
 | |
| 
 | |
| <?php }  // endforeach ?>
 |