<?php
require_once('./CS_Includes.inc.php');
try {
$alertsEnabled = (strlen($CS->GetOption('alert_smtp_server')) > 0 && strlen($CS->GetOption('alert_source')) > 0);
$alerts = CSAlert::GetAlertGroupArray();
}
catch (Exception $e) {
CS::Abort($e);
}
$i = 0; //Row counter
CS::PrintHtmlHeader('Alert Groups - Settings');
?>
<body id="Main">
<h1>Alert Groups</h1>
<?php if (!$alertsEnabled): ?>
<p class="InfoMsg">Alerts are currently disabled. Please check you have configured SMTP Server and Alert Source in General Options!</p>
<?php endif; ?>
<p>All configured alert groups are displayed in the table below. Select an alert group name to configure it. Alternatively,
you can <a href="AlertAdmin.php">add another</a>.</p>
<table width="100%">
<tr class="Header"><td>Name</td><td>Status</td><td>Target Count</td><td>Reference Count</td>
<?php if (count($alerts) == 0): ?>
<tr><td colspan="4">No alert groups defined.</td></tr>
<?php else: ?>
<?php foreach($alerts as $alert): ?>
<tr class="<?php echo (++$i % 2) ? 'Odd' : 'Even'; ?>">
<td><a href="AlertAdmin.php?alert_id=<?php echo $alert['alert_id']; ?>"><?php echo $alert['name']; ?></a></td>
<td><?php echo ($alert['enabled'] == 1) ? 'Enabled' : 'Disabled'; ?></td>
<td><a href="AlertTargets.php?alert_id=<?php echo $alert['alert_id']; ?>"><?php echo $alert['targ_cnt']; ?> e-mail addresses</a></td>
<td><?php echo $alert['ref_cnt']; ?> devices</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</body>
</html>