PageRenderTime 39ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/core/web/includes/bgps_view.php

https://github.com/vmasilva/mmc
PHP | 76 lines | 39 code | 15 blank | 22 comment | 8 complexity | df95d226ee9d2909bd6610f521943679 MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. /**
  3. * (c) 2004-2007 Linbox / Free&ALter Soft, http://linbox.com
  4. * (c) 2007-2008 Mandriva, http://www.mandriva.com
  5. *
  6. * $Id$
  7. *
  8. * This file is part of Mandriva Management Console (MMC).
  9. *
  10. * MMC is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * MMC is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with MMC; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  23. */
  24. ?>
  25. <?
  26. require("config.inc.php");
  27. require("acl.inc.php");
  28. require("session.inc.php");
  29. require("PageGenerator.php");
  30. function print_mem_bar($title, $max, $used, $cache = 0, $width = 320) {
  31. $wused = ($used / $max) * $width;
  32. if ($title != "") {
  33. echo $title." :";
  34. }
  35. echo "<div class=\"membarfree\" style=\"width: ".$width."px\">";
  36. if ($cache > 0) {
  37. printf("<div class=\"membarcache\" style=\"width: %.0fpx\">", $wused);
  38. $wused = (($used - $cache) / $max) * $width;
  39. }
  40. printf("<div class=\"membarused\" style=\"width: %.0fpx\"></div>", $wused);
  41. if ($cache > 0) {
  42. echo "</div>";
  43. }
  44. echo "</div>\n";
  45. }
  46. function get_process() {
  47. return xmlCall("base.listProcess",null);
  48. }
  49. $arr = get_process();
  50. if (count($arr) == 0) { //if no job in background
  51. print '<div style="text-align: center;">'._("No job.").'</div>';
  52. return;
  53. }
  54. foreach ($arr as $ps) {
  55. echo $ps[0]."<br/>";
  56. echo $ps[2]."<br/>";
  57. if ($ps[1] != "-1") {
  58. print_mem_bar("progress",100,$ps[1]);
  59. }
  60. }
  61. ?>