<?php
/**
 * Export module - pdf
 * 
 * Main PDF report generation page
 * 
 * @package linea21\utils\export
 * @author $Author$ - linea21 <info@linea21.com>
 * @version $Id$ 
 * @access public
 * @license http://opensource.org/licenses/gpl-3.0.html
 * Define, compose and generate a SDI (Sustainable Development Indicators) PDF report
 */

//require_once('../class/system/tcpdf/tcpdf.php');
require_once('../lib/vendor/tcpdf/tcpdf.php');
include_once(override('../export/pdf/pdf.report.inc.php', THEME_ADMIN_PATH));

require_once(override('../export/pdf/extendedTCPDF.php', THEME_ADMIN_PATH));


# bench start tag
$start_time=getmicrotime();

# we create the pdf
$pdf = new eTCPDF('P', 'mm', 'A4', true, 'UTF-8');
// @todo SET Page unit
//$pdf->setPageUnit('px');
#inclusion propriétés du document
include_once(override('../export/pdf/pdf.doc_define.php', THEME_ADMIN_PATH));

#inclusion page de garde
if(!$report_settings['quick_export']) include_once(override('../export/pdf/pdf.firstpage.php', THEME_ADMIN_PATH));

// SDI / dashboard report
if($report_settings['export_module'] == 'dashboard') {
	for($i=0; $i<count($sdi); $i++) {
	  indicator_display_info($i);
	}
// project report
} else {
	for($i=0; $i<count($project); $i++) {
		project_display_info($i);
	}
		
}

#inclusion sommaire
if($report_settings['summary']===true) include_once(override('../export/pdf/pdf.summary.php', THEME_ADMIN_PATH));

# bench stop tag
$stop_time=getmicrotime();

$total_time=(float) $stop_time-$start_time;

#inclusion page d'infos de génération
if($report_settings['publi_infos']===true) include_once(override('../export/pdf/pdf.lastpage.php', THEME_ADMIN_PATH));

# pdf output
$pdf->Output('rapport'.date("dmY_His").'.pdf', $report_settings['file']);
ob_end_flush();

?>