<?php

/**
 * This file contains the definition for the report_generator class.
 *
 * @package CGHTML2PDF
 * @category Utilities
 * @author  calguy1000 <calguy1000@cmsmadesimple.org>
 * @copyright Copyright 2014 by Robert Campbell
 */

namespace CGHTML2PDF;

/**
 * A base report generator for PDF reports.
 */
class report_generator extends \CGExtensions\reports\template_report_generator
{
    /**
     * @ignore
     */
    public function get_output()
    {
        // get the data that has been passed through a template
        $html = parent::get_output();
        if( !$html ) return; // todo: throw an exception

        $obj = new html2pdf(array()); // @todo:  options for this stuff
        $obj->pdf->SetTitle($this->get_title());
        $obj->pdf->SetSubject($this->get_description());
        $email = \cge_userops::get_uid_email();
        if( $email ) $obj->pdf->SetAuthor($email);

        // todo ... stylesheet stuff (prepend to html)
        $obj->writeHTML($html);
    }

} // end of class

?>
