Source for file jquery.php

Documentation is available at jquery.php

  1. <?php
  2. /**
  3.  *    extension file for SimpleTest
  4.  *    @version    $Id: jquery.php 1582 2007-11-02 04:47:05Z maetl_ $
  5.  */
  6. require_once dirname(__FILE__'/../treemap_reporter.php';
  7.  
  8. /**
  9.  * outputs <ul> representing treemap of test report,
  10.  * and attaches jQuery Treemap to render results.
  11.  */
  12.  
  13.     function _getCss({
  14.         $css ".treemapView { color:white; }
  15.                 .treemapCell {background-color:green;font-size:10px;font-family:Arial;}
  16.                   .treemapHead {cursor:pointer;background-color:#B34700}
  17.                 .treemapCell.selected, .treemapCell.selected .treemapCell.selected {background-color:#FFCC80}
  18.                   .treemapCell.selected .treemapCell {background-color:#FF9900}
  19.                   .treemapCell.selected .treemapHead {background-color:#B36B00}
  20.                   .transfer {border:1px solid black}";
  21.         return $css;
  22.     }
  23.  
  24.     function paintResultsHeader({
  25.         $title $this->_reporter->getTitle();
  26.         echo "<html><head>";
  27.         echo "<title>{$title}</title>";
  28.         echo "<style type=\"text/css\">" $this->_getCss("</style>";
  29.         echo "<script type=\"text/javascript\" src=\"http://code.jquery.com/jquery-latest.js\"></script>";
  30.         echo "<script type=\"text/javascript\" src=\"http://www.fbtools.com/jquery/treemap/treemap.js\"></script>";
  31.         echo "<script type=\"text/javascript\">\n";
  32.         echo "    window.onload = function() { jQuery(\"ul\").treemap(800,600,{getData:getDataFromUL}); };
  33.                     function getDataFromUL(el) {
  34.                      var data = [];
  35.                      jQuery(\"li\",el).each(function(){
  36.                        var item = jQuery(this);
  37.                        var row = [item.find(\"span.desc\").html(),item.find(\"span.data\").html()];
  38.                        data.push(row);
  39.                      });
  40.                      return data;
  41.                     }";
  42.         echo "</script></head>";
  43.         echo "<body><ul>";
  44.     }
  45.     
  46.     function paintRectangleStart($node{
  47.         echo "<li><span class=\"desc\">"basename($node->getDescription()) "</span>";
  48.         echo "<span class=\"data\">" $node->getTotalSize("</span>";
  49.     }
  50.     
  51.     function paintRectangleEnd({}
  52.     
  53.     function paintResultsFooter({
  54.         echo "</ul></body>";
  55.         echo "</html>";
  56.     }
  57.     
  58.     function divideMapNodes($map{
  59.         foreach($map->getChildren(as $node{
  60.             if (!$node->isLeaf()) {
  61.                 $this->paintRectangleStart($node);
  62.                 $this->divideMapNodes($node);
  63.             }
  64.         }
  65.     }
  66.  
  67. }
  68.  
  69. ?>

Documentation generated on Sun, 04 May 2008 09:21:42 -0500 by phpDocumentor 1.3.0