Ejemplo n.º 1
0
 function run()
 {
     global $output_format;
     global $form_action;
     global $sbsearch_x;
     global $pdfdoc;
     global $orientation;
     if (isset($output_format)) {
         $this->outputformat = $output_format;
     }
     if (isset($form_action) || !$this->filtered) {
         reset($this->bands);
         if ($this->outputformat == PDF) {
             if (!$this->issubreport) {
                 header("Content-type: application/pdf");
                 /* Create a PDFlib object */
                 $this->pdf = PDF_new();
                 $pdfdoc = $this->pdf;
                 $orientation = $this->orientation;
                 /* Create a PDF document in memory */
                 PDF_open_file($this->pdf, "");
                 /* Create the first page */
                 $this->ypos = newpage(false);
                 $this->pageheader();
             }
             /* Make an instance of the table class */
             switch ($this->orientation) {
                 case LANDSCAPE:
                     $this->table = new jh_pdf_table(&$this->pdf, &$this->ypos, $this->subx, 812, 30);
                     break;
                 case PORTRAIT:
                     $this->table = new jh_pdf_table(&$this->pdf, &$this->ypos, $this->subx, 565, 30);
                     break;
             }
             /* Set a function that will be called if a new page is necessary */
             $this->table->setnewpagefunction(newpage);
             if ($this->issubreport) {
                 $this->table->setverttableborderwidth(1);
                 $this->table->setverttablebordercolor(0);
                 //$this->table->setcolspacingwidth(1);
                 //$this->table->setcolspacingcolor(0);
                 $this->table->setrowspacingwidth(1);
                 $this->table->setrowspacingcolor(0);
             }
             $this->table->setheaderbgcolor($this->headercolor);
             $this->table->setbgcolors(array(false, 0.9));
         }
         if ($this->outputformat == HTML) {
             echo "<link rel=\"StyleSheet\" href=\"phpreport/report.css\" type=\"text/css\" />\n";
             echo "<style type=\"text/css\">";
             echo "@import url(\"phpreport/report.css\"); ";
             echo "</style>";
         }
         $w = "width=\"100%\"";
         if ($this->issubreport) {
             $w = "width=\"100%\"";
         }
         $b = "1";
         if ($this->issubreport) {
             $b = "0";
         }
         if ($this->outputformat == HTML) {
             if ($this->title != '') {
                 $fecha = date("d/m/Y h:m:s");
                 echo "<table {$w} border=\"0\"><tr><td><h2>{$this->title}</h2></td><td align=\"right\">{$fecha}</td></tr></table>";
             }
             echo "<table {$w} border=\"{$b}\" cellspacing=\"0\" cellpadding=\"2\">";
         }
         while (list($bandname, $bandparams) = each($this->bands)) {
             $this->renderBand($bandparams);
         }
         if ($this->outputformat == HTML) {
             if ($this->showsummaries) {
                 $cs = count($this->phpgrid->printable);
                 echo "<tr class=\"reportdetaileven\">";
                 echo "<td colspan=\"{$cs}\" align=\"right\">{$this->recordcount} registro(s)</td>";
                 echo "</tr>";
             }
             echo "</table>";
         }
         if ($this->outputformat == PDF) {
             /* Close the table (important!) */
             $this->table->endtable();
         }
         if ($this->showsummaries) {
             if ($this->outputformat == PDF) {
                 $rm = 0;
                 // Make an instance of the table class
                 switch ($this->orientation) {
                     case LANDSCAPE:
                         $rm = 812;
                         break;
                     case PORTRAIT:
                         $rm = 565;
                         break;
                 }
                 $this->ypos -= 10;
                 // Make an instance of the class
                 $text = new jh_pdf_flowingtext(&$this->pdf, &$this->ypos, 30, $rm, 30);
                 $text->setfontsize(9);
                 $text->addtext($this->recordcount . " registro(s)", true);
                 $text->puttext(30, $this->ypos, "right", 0);
                 $this->ypos -= 26;
             }
         }
         if ($this->outputformat == PDF) {
             if (!$this->issubreport) {
                 /* Close the last page */
                 PDF_end_page($this->pdf);
                 /* Close the PDF document */
                 PDF_close($this->pdf);
                 /* Output the current part of the in-memory created PDF document */
                 print PDF_get_buffer($this->pdf);
                 /* Delete the PDFlib object */
                 PDF_delete($this->pdf);
             }
         }
     } else {
         $sbsearch_x = 1;
         $this->phpgrid->showformatcombo = TRUE;
         $this->phpgrid->showgrid = 0;
         $this->phpgrid->run();
     }
 }
Ejemplo n.º 2
0

<?php 
include "config.php";
include 'form.php';
$content = alert_m(array("WEEEEWOOOO"), array("green"));
newpage($content);
Ejemplo n.º 3
0
   the current page and create a new one; the call from jh_pdf_flowingtext
   does not include any parameter, thus the default is set to true */
function newpage($closepage = true)
{
    global $pdf;
    if ($closepage) {
        PDF_end_page($pdf);
        /* Output the current part of the in-memory created PDF document */
        print PDF_get_buffer($pdf);
    }
    /* Create a DIN A4 page */
    PDF_begin_page($pdf, 595, 842);
    return 812;
}
/* Create the first page */
$ypos = newpage(false);
/* Create a text object which will contain the weekday name */
$day = new jh_pdf_text_jhpci(&$pdf);
$day->setalignment("center");
/* Create a barcode object which will contain some number */
$barcode = new jh_pdf_barcode_jhpci(&$pdf);
$barcode->settype('25i');
$barcode->setheight(20);
/* Create a text object which will contain the same number as
   the barcode, but this time as plain text */
$bctext = new jh_pdf_text_jhpci(&$pdf);
$bctext->setalignment("center");
/* Create a container object and put in the three objects
   created above and some empty space between them */
$content = new jh_pdf_container_jhpci(&$pdf);
$content->addobject($day);