miner.php display rig 'when' table at top of the multi-rig summary page
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
diff --git a/miner.php b/miner.php
index a8832e4..c2c1bee 100644
--- a/miner.php
+++ b/miner.php
@@ -203,6 +203,8 @@ function getparam($name, $both = false)
#
function fmt($section, $name, $value)
{
+ $dfmt = 'H:i:s j-M-Y \U\T\CP';
+
$errorclass = ' class=err';
$warnclass = ' class=warn';
$b = ' ';
@@ -325,6 +327,9 @@ function fmt($section, $name, $value)
if ($value != 'Y')
$class = $warnclass;
break;
+ case 'STATUS.When':
+ $ret = date($dfmt, $value);
+ break;
}
if ($section == 'NOTIFY' && substr($name, 0, 1) == '*' && $value != '0')
@@ -346,7 +351,7 @@ function showhead($cmd, $item, $values)
foreach ($values as $name => $value)
{
- if ($name == '0')
+ if ($name == '0' or $name == '')
$name = ' ';
echo "<td valign=bottom class=h>$name</td>";
}
@@ -550,7 +555,7 @@ function process($cmds, $rig)
}
#
# $head is a hack but this is just a demo anyway :)
-function doforeach($cmd, $des, $sum, $head)
+function doforeach($cmd, $des, $sum, $head, $datetime)
{
global $miner, $port;
global $error, $readonly, $notify, $rigs;
@@ -588,6 +593,45 @@ function doforeach($cmd, $des, $sum, $head)
return;
}
+ if ($datetime)
+ {
+ $dthead = array('' => 1, 'STATUS' => 1, 'Description' => 1, 'When' => 1);
+ showhead('', null, $dthead);
+
+ foreach ($anss as $rig => $ans)
+ {
+ echo '<tr>';
+
+ foreach ($ans as $item => $row)
+ {
+ if ($item != 'STATUS')
+ continue;
+
+ foreach ($dthead as $name => $x)
+ {
+ if ($name == '')
+ echo "<td align=right><input type=button value='Rig $rig' onclick='pr(\"?rig=$rig\",null)'></td>";
+ else
+ {
+ if (isset($row[$name]))
+ list($showvalue, $class) = fmt('STATUS', $name, $row[$name]);
+ else
+ {
+ $class = '';
+ $showvalue = ' ';
+ }
+ echo "<td$class align=right>$showvalue</td>";
+ }
+ }
+ }
+
+ echo '</tr>';
+ }
+ echo $tableend;
+ echo '<tr><td><br><br></td></tr>';
+ echo $tablebegin;
+ }
+
$total = array();
foreach ($anss as $rig => $ans)
@@ -795,15 +839,15 @@ function display()
echo $tablebegin;
$sum = array('MHS av', 'Getworks', 'Found Blocks', 'Accepted', 'Rejected', 'Discarded', 'Stale', 'Utility', 'Local Work', 'Total MH');
- doforeach('summary', 'summary information', $sum, array());
+ doforeach('summary', 'summary information', $sum, array(), true);
echo $tableend;
echo '<tr><td><br><br></td></tr>';
echo $tablebegin;
- doforeach('devs', 'device list', $sum, array(''=>'','ID'=>'','Name'=>''));
+ doforeach('devs', 'device list', $sum, array(''=>'','ID'=>'','Name'=>''), false);
echo $tableend;
echo '<tr><td><br><br></td></tr>';
echo $tablebegin;
- doforeach('pools', 'pool list', $sum, array(''=>''));
+ doforeach('pools', 'pool list', $sum, array(''=>''), false);
echo $tableend;
}
#