mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-30 01:04:09 +02:00
Contacts: replace foreach loop with hardcoded HTML and move the styles to a CSS file
This commit is contained in:
parent
eca0d50bae
commit
882699201d
@ -14,42 +14,41 @@ $contactHelper = $this->getHelper('ContactFlags');
|
|||||||
<?php
|
<?php
|
||||||
if (count($contacts) === 0) {
|
if (count($contacts) === 0) {
|
||||||
echo t('No contacts matching the filter');
|
echo t('No contacts matching the filter');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
foreach ($contacts as $contact):
|
foreach ($contacts as $contact): ?>
|
||||||
$periodLink = $this->href('monitoring/show/contacts', array('contact' => $contact->contact_name)); ?>
|
<div class="contact">
|
||||||
<div style="background-color: lightgray; padding: 0.5em; border-radius: 0.5em; overflow: hidden; margin: 0.125em; float: left;">
|
<img src="<?= $this->href('/static/gravatar', array('email' => $contact->contact_email )) ?>" />
|
||||||
<img src="<?= $this->href('/static/gravatar', array('email' => $contact->contact_email )) ?>"
|
|
||||||
style="width: 60px; border: 4px solid white; border-radius: 8px; margin-right: 8px; float: left;" />
|
|
||||||
<a href="<?= $this->href(
|
<a href="<?= $this->href(
|
||||||
'monitoring/show/contact',
|
'monitoring/show/contact',
|
||||||
array('contact' => $contact->contact_name)
|
array('contact' => $contact->contact_name)
|
||||||
) ?>"><strong><?= $contact->contact_name ?></strong></a> (<?= $contact->contact_alias ?>)
|
) ?>"><strong><?= $contact->contact_name ?></strong></a> (<?= $contact->contact_alias ?>)
|
||||||
<?php
|
<div><?= sprintf(
|
||||||
foreach (array(
|
'%1$s: <a href="mailto:%2$s">%2$s</a>',
|
||||||
'eMail' => array(
|
t('Email'),
|
||||||
$contact->contact_email, '<a href="mailto:%1$s">%1$s</a>'
|
htmlspecialchars($contact->contact_email)
|
||||||
),
|
) ?></div>
|
||||||
'Pager' => $contact->contact_pager,
|
<?php if ($contact->contact_pager): ?>
|
||||||
'Service notification period' => $contact->contact_notify_service_timeperiod,
|
<div>
|
||||||
'Host notification period' => $contact->contact_notify_host_timeperiod
|
<?= t('Pager') ?>:
|
||||||
) as $key => $value):
|
<?= htmlspecialchars($contact->contact_pager) ?>
|
||||||
if (is_string($value)) {
|
</div>
|
||||||
$format = '%s';
|
<?php endif; ?>
|
||||||
} else {
|
<div style="clear: both;"></div>
|
||||||
$format = $value[1];
|
<div class="notification-periods">
|
||||||
$value = $value[0];
|
<div>
|
||||||
}
|
<?= t('Service notification period') ?>:
|
||||||
if ($value): ?>
|
<?= htmlspecialchars($contact->contact_notify_service_timeperiod) ?>
|
||||||
<br />
|
</div>
|
||||||
<?php
|
<div>
|
||||||
printf(
|
<?= t('Host notification period') ?>:
|
||||||
'%s: %s', $key,
|
<?= htmlspecialchars($contact->contact_notify_host_timeperiod) ?>
|
||||||
sprintf($format, htmlspecialchars($value))
|
</div>
|
||||||
);
|
</div>
|
||||||
endif;
|
|
||||||
endforeach;
|
|
||||||
?>
|
|
||||||
<div class="clearfix"></div>
|
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php
|
||||||
|
endforeach;
|
||||||
|
if (true): /* The following piece of HTML MUST be nested in <?php */ ?>
|
||||||
|
<div style="clear: both;"></div>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -32,3 +32,24 @@ table.objectstate td.state {
|
|||||||
padding-top: 0.5em;
|
padding-top: 0.5em;
|
||||||
padding-bottom: 0.5em;
|
padding-bottom: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.contacts div.contact {
|
||||||
|
background-color: lightgray;
|
||||||
|
padding: 0.5em;
|
||||||
|
border-radius: 0.5em;
|
||||||
|
overflow: hidden;
|
||||||
|
margin: 0.125em;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.contacts div.contact > img {
|
||||||
|
width: 60px;
|
||||||
|
border: 4px solid white;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-right: 8px;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.contacts div.notification-periods {
|
||||||
|
margin-top: 0.5em;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user