Exemple #1
0
 /**
  * Display chosen exporter
  */
 protected function displayChosenExporter()
 {
     $Exporter = new ExporterFactory(Request::param('type'));
     $Exporter->display();
     echo '<p class="text">&nbsp;</p>';
     echo '<p class="text">' . Ajax::window('<a href="' . self::$URL . '?id=' . $this->TrainingID . '">&laquo; ' . __('back to list') . '</a>', 'small') . '</p>';
 }
 /**
  * Create association between an exporter type string and the class which
  * will be responsible to handle output.
  *
  * @static
  * @access public
  * @param string Exporter type string
  * @param string Name of the class which must be instantiated for this type of exporter
  */
 function register($type, $className)
 {
     $instance =& ExporterFactory::getInstance();
     if (array_key_exists($type, $instance->_classList)) {
         Amber::showError('Error', 'Duplicate exporter type: "' . $type . '"');
         die;
     }
     $instance->_classList[$type] = $className;
 }
 /**
  * @access private
  * @param string
  */
 function _installExporter($type)
 {
     $this->_exporter =& ExporterFactory::create($type);
     $this->exporterType = $type;
     if (is_array($this->Controls)) {
         $ctlNames = array_keys($this->Controls);
         foreach ($ctlNames as $ctlName) {
             $this->_exporter->setControlExporter($this->Controls[$ctlName]);
         }
     }
 }
<?php

/**
 *
 * @package Amber
 * @subpackage Exporter
 *
 */
ExporterFactory::register('typo3', 'ExporterTypo3');
/**
 *
 * @package Amber
 * @subpackage Exporter
 *
 */
class ExporterTypo3 extends ExporterHtml
{
    var $type = 'typo3';
    // Report - Typo3
    function startReportSubExporter(&$report, $asSubreport = false)
    {
        $this->layout =& $report->layout;
        $css = $this->getReportCssStyles($report, $this->cssClassPrefix);
        $this->setCss($css);
        $tmp = "\n\n<!-- Start of AmberReport // -->\n\n<div class=\"AmberReport\">\n";
        $this->_base->_out($tmp);
    }
    function endReportSubExporter(&$report)
    {
        $this->_base->_out("\n</div>\n\n<!-- End of AmberReport // -->\n\n");
    }
<?php

/**
 *
 * @package Amber
 * @subpackage Exporter
 *
 */
define('FPDF_FONTPATH', AMBER_LIBS_FPDF . '/font/');
ExporterFactory::register('pdf', 'ExporterFPdf');
ExporterFactory::register('.pdf', 'ExporterFPdf');
ExporterFactory::register('fpdf', 'ExporterFPdf');
ExporterFactory::register('testpdf', 'ExporterFPdf');
/**
 *
 * @package Amber
 * @subpackage Exporter
 *
 */
class ExporterFPdf extends Exporter
{
    var $type = 'fpdf';
    var $_pdf;
    var $firstPage = true;
    function &getExporterBasicClass(&$layout, $reset)
    {
        require_once AMBER_LIBS_FPDF . '/fpdf.php';
        require_once 'PDF.inc.php';
        return PDF::getInstance($layout, $reset);
    }
    /*********************************
<?php

/**
 *
 * @package Amber
 * @subpackage Exporter
 *
 */
require_once 'AmberHtmlHelper.php';
define('__SCALE__', 1);
// scaling factor. Don't use fractions or errors will occur:
// fractions in border-width are not shown with current browsers
define('__HAIRLINEWIDTH__', 20);
// width of hairline in twips; here 1px
ExporterFactory::register('html', 'ExporterHtml');
/**
 *
 * @package Amber
 * @subpackage Exporter
 *
 */
class ExporterHtml extends Exporter
{
    var $type = 'html';
    var $cssClassPrefix = 's';
    var $_CtrlStdValues;
    var $_html;
    // Report - html
    function &getExporterBasicClass(&$layout, $reset)
    {
        return AmberHtmlHelper::getInstance($layout, $reset);
<?php

/**
 *
 * @package Amber
 * @subpackage Exporter
 *
 */
//require_once 'ExporterFactory.php';
ExporterFactory::register('null', 'Exporter');
define("BorderCheat", 20);
// default value of Exporter->SectionSlip
/**
 *
 * @package Amber
 * @subpackage Exporter
 *
 */
class Exporter
{
    /// Public Properties
    var $SectionSlip;
    // width of area in twips by which controls may draw across section borders
    /// Private Properties
    var $type = 'null';
    var $_docTitle;
    var $_section;
    var $_base;
    // ref to pdf/html
    /**
     * @access public