84 lines
3.0 KiB
PHP
84 lines
3.0 KiB
PHP
<?php
|
|
require "../includes/items.php";
|
|
|
|
if (!function_exists('renderTrendLink')) {
|
|
/**
|
|
* Create a clickable link that opens the auto-start trend view with the tag.
|
|
*
|
|
* @param string $tagKey Historian tag name to trend.
|
|
* @param array $values Collected value array from items include.
|
|
*
|
|
* @return string
|
|
*/
|
|
function renderTrendLink(string $tagKey, array $values): string
|
|
{
|
|
$tagValue = $values[$tagKey] ?? null;
|
|
$displayValue = $tagValue === null ? '--' : (string) $tagValue;
|
|
$displayValue = htmlspecialchars($displayValue, ENT_QUOTES, 'UTF-8');
|
|
|
|
$href = '../trends/live/autochart.php?primary=' .
|
|
rawurlencode($tagKey) .
|
|
'&autostart=1';
|
|
$encodedHref = htmlspecialchars($href, ENT_QUOTES, 'UTF-8');
|
|
|
|
return '<a class="trend-link" href="' .
|
|
$encodedHref .
|
|
'" target="_blank" rel="noopener noreferrer">' .
|
|
$displayValue .
|
|
'</a>';
|
|
}
|
|
}
|
|
?>
|
|
|
|
<table width="100%" border="1" cellspacing="0" cellpadding="4">
|
|
<tr>
|
|
<td colspan="3" id="title">2500 kav</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="50%" id="vtitle" id="padded">A Phase</td>
|
|
<td id="sum-count" width="100px">
|
|
<?php echo renderTrendLink('2500kva A Phase', $value); ?>
|
|
</td>
|
|
<td id="vtitle">kav</td>
|
|
</tr>
|
|
<tr>
|
|
<td id="vtitle" id="padded">B Phase</td>
|
|
<td id="sum-count" width="100px">
|
|
<?php echo renderTrendLink('2500kva B Phase', $value); ?>
|
|
</td>
|
|
<td id="vtitle">kav</td>
|
|
</tr>
|
|
<tr>
|
|
<td id="vtitle" id="padded">C Phase</td>
|
|
<td id="sum-count" width="100px">
|
|
<?php echo renderTrendLink('2500kva C Phase', $value); ?>
|
|
</td>
|
|
<td id="vtitle">kav</td>
|
|
</tr>
|
|
</table>
|
|
<table class="col-4" border="1" cellspacing="0" cellpadding="4">
|
|
<tr>
|
|
<td colspan="3" id="title">3750 kva</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="50%" id="vtitle" id="padded">A Phase</td>
|
|
<td id="sum-count" width="100px">
|
|
<?php echo renderTrendLink('3750kva A Phase', $value); ?>
|
|
</td>
|
|
<td id="vtitle">kav</td>
|
|
</tr>
|
|
<tr>
|
|
<td id="vtitle" id="padded">B Phase</td>
|
|
<td id="sum-count" width="100px">
|
|
<?php echo renderTrendLink('3750kva B Phase', $value); ?>
|
|
</td>
|
|
<td id="vtitle">kav</td>
|
|
</tr>
|
|
<tr>
|
|
<td id="vtitle" id="padded">C Phase</td>
|
|
<td id="sum-count" width="100px">
|
|
<?php echo renderTrendLink('3750kva C Phase', $value); ?>
|
|
</td>
|
|
<td id="vtitle">kav</td>
|
|
</tr>
|
|
</table>
|