PageRenderTime 51ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/web_gui/acct/app/modules/size/views/count.php

https://github.com/fzago-cray/robinhood
PHP | 84 lines | 69 code | 12 blank | 3 comment | 3 complexity | df7d7bb005a242aba3e75aae508229a1 MD5 | raw file
Possible License(s): AGPL-3.0, GPL-3.0, BSD-3-Clause, GPL-2.0
  1. <?php
  2. /* -*- mode: php; c-basic-offset: 4; indent-tabs-mode: nil; -*-
  3. * vim:expandtab:shiftwidth=4:tabstop=4:
  4. */
  5. $graph = new ezcGraphBarChart();
  6. $graph->palette = new ezcGraphPaletteEzBlue();
  7. $graph->legend = false;
  8. $graph->data['File size profile'] = new ezcGraphArrayDataSet($sz_ranges);
  9. $graph->xAxis->label = 'Size range';
  10. $graph->yAxis->label = 'File count';
  11. $graph->driver = new ezcGraphGdDriver();
  12. $graph->options->font = 'app/img/KhmerOSclassic.ttf';
  13. $graph->driver->options->imageFormat = IMG_PNG;
  14. $graph->render( 532, 300, 'app/img/graph/sizeCountBarGraph.png' );
  15. echo '<h2>File size profile</h2>';
  16. ?>
  17. <img src="app/img/graph/sizeCountBarGraph.png"/>
  18. <table class="simple">
  19. <thead>
  20. <tr>
  21. <th rowspan="2">User</th>
  22. <th rowspan="2">Total volume</th>
  23. <th rowspan="2">File count</th>
  24. <th rowspan="2">Avg file size</th>
  25. <th colspan="4">file size ratio</th>
  26. </tr>
  27. <tr>
  28. <th>empty</th>
  29. <th>&lt;1K</th>
  30. <th>&lt;1M</th>
  31. <th>&lt;1G</th>
  32. </tr>
  33. </thead>
  34. <tbody>
  35. <?php
  36. global $sz_range_fields;
  37. $i=0;
  38. foreach ($users as $u => $arr)
  39. {
  40. $i++;
  41. $nbz = $users[$u][$sz_range_fields[0]];
  42. $nb1K = $nbz + $users[$u][$sz_range_fields[1]] + $users[$u][$sz_range_fields[2]];
  43. $nb1M = $nb1K + $users[$u][$sz_range_fields[3]] + $users[$u][$sz_range_fields[4]];
  44. $nb1G = $nb1M + $users[$u][$sz_range_fields[5]] + $users[$u][$sz_range_fields[6]];
  45. if ($users[$u][COUNT] == 0)
  46. $rz = $r1K = $r1M = $r1G = 0.0;
  47. else
  48. {
  49. $rz = 1.0 * $nbz / $users[$u][COUNT];
  50. $r1K = 1.0 * $nb1K / $users[$u][COUNT];
  51. $r1M = 1.0 * $nb1M / $users[$u][COUNT];
  52. $r1G = 1.0 * $nb1G / $users[$u][COUNT];
  53. }
  54. echo "<tr><td><a href='".str_replace( " ", "%20", $u). "_size_popup.php' rel='#count'>".$u."</a></td>";
  55. echo "<td>".formatSizeNumber($users[$u][SIZE])."</td>";
  56. echo "<td>".formatNumber($users[$u][COUNT])."</td>";
  57. echo "<td>".formatSizeNumber(round($users[$u][SIZE]/$users[$u][COUNT],0))."</td>";
  58. echo "<td>". sprintf("%.2f%%", 100.0*$rz)."</td>";
  59. echo "<td>". sprintf("%.2f%%", 100.0*$r1K)."</td>";
  60. echo "<td>". sprintf("%.2f%%", 100.0*$r1M)."</td>";
  61. echo "<td>". sprintf("%.2f%%", 100.0*$r1G)."</td></tr>\n";
  62. if ($i>LIMIT)
  63. break;
  64. }
  65. ?>
  66. </tbody>
  67. </table>
  68. <!-- POPUP -->
  69. <div class="apple_overlay" style="width:800px;" id="count">
  70. <!-- the status detailed stat is loaded inside this tag -->
  71. <div class="contentWrap" style="height:800px;"></div>
  72. </div>