Exemple #1
0
 /**
  * HTML line renderer
  *
  * @param WT_Report_HTML $html
  *
  * @return void
  */
 function render($html)
 {
     if ($this->x1 == ".") {
         $this->x1 = $html->GetX();
     }
     if ($this->y1 == ".") {
         $this->y1 = $html->GetY();
     }
     if ($this->x2 == ".") {
         $this->x2 = $html->getRemainingWidth();
     }
     if ($this->y2 == ".") {
         $this->y2 = $html->GetY();
     }
     // TODO Non verticle or horizontal lines can use a series of divs absolutely positioned
     // Vertical line
     if ($this->x1 == $this->x2) {
         echo "<div style=\"position:absolute;overflow:hidden;border-", $html->alignRTL, ":solid black 1pt;", $html->alignRTL, ":", $this->x1, "pt;top:", $this->y1 + 1, "pt;width:1pt;height:", $this->y2 - $this->y1, "pt;\"> </div>\n";
     }
     // Horizontal line
     if ($this->y1 == $this->y2) {
         echo "<div style=\"position:absolute;overflow:hidden;border-top:solid black 1pt;", $html->alignRTL, ":", $this->x1, "pt;top:", $this->y1 + 1, "pt;width:", $this->x2 - $this->x1, "pt;height:1pt;\"> </div>\n";
     }
     // Keep max Y updated
     // One or the other will be higher... lasy mans way...
     $html->addMaxY($this->y1);
     $html->addMaxY($this->y2);
 }
Exemple #2
0
 /**
  * Image renderer
  *
  * @param WT_Report_HTML $html
  *
  * @return void
  */
 function render($html)
 {
     global $lastpicbottom, $lastpicpage, $lastpicleft, $lastpicright;
     // Get the current positions
     if ($this->x == ".") {
         $this->x = $html->GetX();
     }
     if ($this->y == ".") {
         //-- first check for a collision with the last picture
         if (isset($lastpicbottom)) {
             if ($html->PageNo() == $lastpicpage && $lastpicbottom >= $html->GetY() && $this->x >= $lastpicleft && $this->x <= $lastpicright) {
                 $html->SetY($lastpicbottom + $html->cPadding * 2);
             }
         }
         $this->y = $html->GetY();
     }
     // Image alignment
     switch ($this->align) {
         case "L":
             echo "<div style=\"position:absolute;top:", $this->y, "pt;left:0pt;width:", $html->getRemainingWidth(), "pt;text-align:left;\">\n";
             echo "<img src=\"", $this->file, "\" style=\"width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n</div>\n";
             break;
         case "C":
             echo "<div style=\"position:absolute;top:", $this->y, "pt;left:0pt;width:", $html->getRemainingWidth(), "pt;text-align:center;\">\n";
             echo "<img src=\"", $this->file, "\" style=\"width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n</div>\n";
             break;
         case "R":
             echo "<div style=\"position:absolute;top:", $this->y, "pt;left:0pt;width:", $html->getRemainingWidth(), "pt;text-align:right;\">\n";
             echo "<img src=\"", $this->file, "\" style=\"width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n</div>\n";
             break;
         default:
             echo "<img src=\"", $this->file, "\" style=\"position:absolute;", $html->alignRTL, ":", $this->x, "pt;top:", $this->y, "pt;width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n";
     }
     $lastpicpage = $html->PageNo();
     $lastpicleft = $this->x;
     $lastpicright = $this->x + $this->width;
     $lastpicbottom = $this->y + $this->height;
     // Setup for the next line
     if ($this->line == "N") {
         $html->SetY($lastpicbottom);
     }
     // Keep max Y updated
     $html->addMaxY($lastpicbottom);
 }