mirror of
				https://github.com/Icinga/icingaweb2.git
				synced 2025-10-31 11:24:51 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			51 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			PHTML
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			PHTML
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| $links = array();
 | |
| 
 | |
| // add warning to links that open in new tabs to improve accessibility, as recommended by WCAG20 G201
 | |
| $newTabInfo = sprintf('<span class="info-box display-on-hover"> %s </span>', $this->translate('opens in new window'));
 | |
| 
 | |
| $linkText = '<a href="%s" target="_blank">%s ' . $newTabInfo . '</a>';
 | |
| $localLinkText = '<a href="%s">%s</a>';
 | |
| 
 | |
| if ($object->notes_url) {
 | |
|     if (strpos($object->notes_url, "' ") === false) {
 | |
|         $links[] = sprintf($linkText, $this->resolveMacros($object->notes_url, $object), 'Notes');
 | |
|     } else {
 | |
|         // TODO: We should find out document what's going on here. Looks strange :p
 | |
|         foreach(explode("' ", $object->notes_url) as $url) {
 | |
|             $url = strpos($url, "'") === 0 ? substr($url, 1) : $url;
 | |
|             $url = strrpos($url, "'") === strlen($url) - 1 ? substr($url, 0, strlen($url) - 1) : $url;
 | |
|             $links[] = sprintf($linkText, $this->resolveMacros($url, $object), 'Notes');
 | |
|         }
 | |
|     }
 | |
| }
 | |
| if ($object->action_url) {
 | |
|     if (strpos($object->action_url, "' ") === false) {
 | |
|         $links[] = sprintf($linkText, $this->resolveMacros($object->action_url, $object), 'Action');
 | |
|     } else {
 | |
|         // TODO: We should find out document what's going on here. Looks strange :p
 | |
|         foreach(explode("' ", $object->action_url) as $url) {
 | |
|             $url = strpos($url, "'") === 0 ? substr($url, 1) : $url;
 | |
|             $url = strrpos($url, "'") === strlen($url) - 1 ? substr($url, 0, strlen($url) - 1) : $url;
 | |
|             $links[] = sprintf($linkText, $this->resolveMacros($url, $object), 'Action');
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| if (isset($this->actions)) {
 | |
|     foreach ($this->actions as $id => $action) {
 | |
|         $links[] = sprintf($localLinkText, $action, $id);
 | |
|     }
 | |
| }
 | |
| 
 | |
| if (empty($links)) {
 | |
|     return;
 | |
| }
 | |
| 
 | |
| ?>
 | |
| <tr>
 | |
|   <th><?= $this->translate('Actions') ?></th>
 | |
|   <td><?= implode("\n ", $links) . "\n" ?></td>
 | |
| </tr>
 |