r1502 + introduce getObjectCount() and try using it
authorDenis Ovsienko <infrastation@yandex.ru>
Sat, 12 Jan 2008 14:32:12 +0000 (14:32 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Sat, 12 Jan 2008 14:32:12 +0000 (14:32 +0000)
inc/functions.php
inc/interface.php

index 5b5a2adf39905559035018f2d5c9a00289f0e23f..5bd7d8c7ba8694563ae5135e89ea90bcdd2274d3 100644 (file)
@@ -1112,4 +1112,18 @@ function getRSUforRackRow ($rowData = NULL)
        return ($counter['T'] + $counter['W'] + $counter['U']) / ($counter['T'] + $counter['W'] + $counter['U'] + $counter['F']);
 }
 
+function getObjectCount ($rackData)
+{
+       $objects = array();
+       for ($i = $rackData['height']; $i > 0; $i--)
+               for ($locidx = 0; $locidx < 3; $locidx++)
+                       if
+                       (
+                               $rackData[$i][$locidx]['state'] == 'T' and
+                               !in_array ($rackData[$i][$locidx]['object_id'], $objects)
+                       )
+                               $objects[] = $rackData[$i][$locidx]['object_id'];
+       return count ($objects);
+}
+
 ?>
index c8f31615299ed1206703296a455015e9e795bd04..174fccbe32619cd7c3cbb630134b8fd714f48e78 100644 (file)
@@ -2600,6 +2600,9 @@ function renderRackPage ($rack_id)
        echo "<tr><th width='50%' class=tdright>Utilization:</th><td class=tdleft>";
        renderProgressBar (getRSUforRack ($rackData));
        echo "</td></tr>\n";
+       echo "<tr><th width='50%' class=tdright>Objects:</th><td class=tdleft>";
+       echo getObjectCount ($rackData);
+       echo "</td></tr>\n";
        if (!empty ($rackData['comment']))
                echo "<tr><th width='50%' class=tdright>Comment:</th><td class=tdleft>${rackData['comment']}</td></tr>\n";
        echo '</table>';