Source for file pdf.report.inc.php
Documentation is available at pdf.report.inc.php
* @author linea21 <info@linea21.com>
* @license http://opensource.org/licenses/gpl-3.0.html
* Define, compose and generate a SDI (Sustainable Development Indicators) PDF report
* Affiche un IDD + infos satellites
if ($report_settings['summary'] === true) $pdf->SetLink($pointer+ 1);
$pdf->SetTextColorArray(getColor('SDI_ITEM_COLOR'));
$pdf->SetTextColorArray(getColor('DOC_COLOR'));
$pdf->SetFillColorArray(getColor('BCKG_INFO'));
$pdf->SetTextColorArray(getColor('SDI_INFO_COLOR'));
$pdf->SetTextColorArray(getColor('DOC_COLOR'));
$pdf->SetTextColorArray(getColor('DOC_COLOR'));
* Affiche les infos générales d'un IDD
* @param int $current_record
$out_title = formatText($current_record['sdii_name']);
$pdf->SetTextColorArray(getColor('SDI_TITLE_COLOR'));
if ($current_record['sdii_statut'] == 'D') {
$pdf->SetTextColorArray(getColor('DOC_ADVISE_COLOR'));
$out_status = ' :: ' . strtolower($lang['statut']['draftpdf']);
$pdf->SetTextColorArray(getColor('DOC_COLOR'));
$out_theme = formatText('» ' . $lang['sdi']['theme'] . ' : ' . $current_record['theme_name'] . ' (' . $current_record['sdtheme_name'] . ')') . END_LINE;
$pdf->SetTextColorArray(getColor('SDI_TITLE_COLOR'));
$pdf->SetTextColorArray(getColor('DOC_COLOR'));
$pdf->Bookmark(ucfirst($lang['sdi']['description']), 1, - 1);
$pdf->MultiCell(0, DOC_HEIGHT, $out_desc, 0, 'L');
$pdf->Bookmark($out_goal_item, 1, - 1);
$pdf->MultiCell(0, DOC_HEIGHT, $out_goal, 0, 'L');
// conseil d'amélioration
$pdf->Bookmark($out_consulting_item, 1, - 1);
$pdf->MultiCell(0, DOC_HEIGHT, $out_consulting, 0, 'L');
// informations de mesure
$out_mesures_behavior = ($current_record['sdii_threshold_relative'] == 'Y' ? $lang['sdi']['threshold_relative_Y']: $lang['sdi']['threshold_relative_N']);
$out_mesures_unit = formatText($lang['sdi']['unit']) . ' : ' . $current_record['sdii_unit'] . END_LINE;
$pdf->Bookmark($out_mesures_item, 1, - 1);
* Dessine le tableau des valeurs IDD
<table cellspacing="0" cellpadding="5" border="1">
<td>'. $lang['sdi']['max_value']. '</td>
<td>'. $lang['sdi']['min_value']. '</td>
<td>'. $lang['sdi']['threshold_value']. '</td>
<td>'. $lang['sdi']['frequency']. '</td>
<td>'. $current_record['sdii_max_value']. '</td>
<td>'. $current_record['sdii_min_value']. '</td>
<td>'. $current_record['sdii_threshold_value']. '</td>
<td>'. $current_record['sdii_frequency']. '</td>
$pdf->writeHTML($tbl, true, false, false, false, '');
* Affiche les informations Fournisseurs d'un IDD
$out_name = formatText($current_record['sdip_name']);
if (!empty($current_record['sdip_service'])) $out_name .= ' - ' . formatText($current_record['sdip_service']);
if (!empty($current_record['sdip_incharge'])) $out_name .= ' - ' . formatText($current_record['sdip_incharge']) . ' (' . $lang['sdi']['p_incharge'] . ')';
$out_phone_fax = $lang['sdi']['p_phone'] . ' : ' . formatText(empty_nc($current_record['sdip_phone']));
$out_email_item = $lang['sdi']['p_email'] . ' : ';
$out_email = formatText($current_record['sdip_email']);
$pdf->Bookmark($out_provider_item, 1, - 1);
$pdf->SetX($pdf->GetX() + $firstcell_width);
$pdf->MultiCell(0, DOC_HEIGHT, $out_name, 0, 'L');
$pdf->SetX($pdf->GetX() + $firstcell_width);
$pdf->MultiCell(0, DOC_HEIGHT, $out_adress, 0, 'L');
$pdf->SetX($pdf->GetX() + $firstcell_width);
$pdf->MultiCell(0, DOC_HEIGHT, $out_phone_fax, 0, 'L');
$pdf->SetX($pdf->GetX() + $firstcell_width);
$pdf->Cell($pdf->GetStringWidth($out_email_item), DOC_HEIGHT, $out_email_item);
else $pdf->Cell(0, DOC_HEIGHT, $out_email, 0, 0, 'L', 0, 'mailto:' . $out_email);
* DisplayReglementationInfo()
* Affiche la réglementation d'un IDD
$out_uri = formatText($current_record['sdir_mask_uri']);
$out_uri_href = $current_record['sdir_referer_uri'];
$out_name_item = $lang['sdi']['r_title'] . ' : ';
$out_body_item = $lang['sdi']['r_body'] . ' : ';
$out_uri_item = $lang['sdi']['r_referer_uri'] . ' : ';
$pdf->Bookmark($out_reglementation_item, 1, - 1);
// nom de l'organisme fournisseur
$pdf->Cell($firstcell_width, DOC_HEIGHT, $out_name_item, 0, 0, 'R');
$pdf->MultiCell(0, DOC_HEIGHT, $out_name, 0, 'L');
$pdf->Cell($firstcell_width, DOC_HEIGHT, $out_body_item, 0, 0, 'R');
$pdf->MultiCell(0, DOC_HEIGHT, $out_body, 0, 'L');
// lien internet reglementation
$pdf->Cell($firstcell_width, DOC_HEIGHT, $out_uri_item, 0, 0, 'R');
if (!empty($out_uri_href)) {
if (!empty($out_uri)) $pdf->Cell(0, DOC_HEIGHT, $out_uri, 0, 0, '', 0, $out_uri_href);
//if (!empty($out_uri)) $pdf->Cell(0, DOC_HEIGHT, ' (', 0, 0);
//$pdf->Cell(0, DOC_HEIGHT, $out_uri, 0, 0, '', 0, $out_uri_href);
//if (!empty($out_uri)) $pdf->Cell(0, DOC_HEIGHT, ')', 0, 0);
* DisplayEvaluationInfo()
* Affiche le tableau de critères d'évaluation
* @param int $current_record
$pdf->Bookmark($out_eval_item, 1, - 1);
<table cellspacing="0" cellpadding="5" border="1">
<td>'. $lang['sdi']['e_scale_compare']. '</td>
<td>'. $lang['sdi']['e_fiability']. '</td>
<td>'. $lang['sdi']['e_accessibility']. '</td>
<td>'. $lang['sdi']['e_lisibility']. '</td>
<td>'. $lang['sdi']['e_relevance']. '</td>
<td>'. $lang['sdi']['e_global_performance']. '</td>
<td>'. $current_record['sdie_scale_compare']. '</td>
<td>'. $current_record['sdie_fiability']. '</td>
<td>'. $current_record['sdie_accessibility']. '</td>
<td>'. $current_record['sdie_lisibility']. '</td>
<td>'. $current_record['sdie_relevance']. '</td>
<td>'. $current_record['sdie_global_performance']. '</td>
$pdf->writeHTML($tbl, true, false, false, false, '');
* Affiche les valeurs d'un IDD.
if ($report_settings['graphic_values'] === true && $report_settings['table_values'] === true) $mode = 'TWICE';
elseif ($report_settings['graphic_values'] === true || $report_settings['table_values'] === true) $mode = 'ONE';
$out_values_item = ucfirst($lang['dashboard']['value']);
$pdf->Bookmark($out_values_item, 1, - 1);
$scale_no_values = array(); // recipient no values
$scale_insuffisant_values = array(); // recipient insuffisant values graph
for($i = 0; $i < count($scale_array); $i++ ) {
if ($report_settings['graphic_values'] === true) {
if ($report_settings['table_values'] === true) {
DisplayNoValuesFor($scale_insuffisant_values, $lang['dashboard']['rap_insuffisant_values'], $mode, $scale_no_values);
* Formattage du statut pour requête SQL
* @param string $current_status
switch ($current_status) {
* Affiche les échelles ne contenant pas de valeurs ou insuffisamment
* @param array $array_scale
global $scale_denomination_array;
// si mode TWICE et deuxième tableau fourni. On le soustrait au premier.
if (count($array_scale) == 0) return true;
for($i = 0; $i < count($array_scale); $i++ ) {
$content .= $sep . $scale_denomination_array[$array_scale[$i]];
if (empty($content)) return true;
$pdf->SetX($pdf->GetX() + $margin);
$pdf->SetTextColorArray(getColor('DOC_ADVISE_COLOR'));
$pdf->SetX($pdf->GetX() + $margin);
$pdf->SetTextColorArray(getColor('DOC_COLOR'));
* Gènère et affiche les valeurs sous forme graphique
* @param int $current_scale
global $scale_denomination_array;
$values = $sql_object->DBSelect(SQL_getAllValue($status, $current_scale, $sdi_id));
// renversement des valeurs pour affichage chronologique
if (count($values) < 3) return false;
// on checke si le graph tient sur la page sinon Saut de page
// $pdf->CheckPageBreak((GRAPH_HEIGHT * 0.36) + DOC_INTERVAL);
// Affichage du titre seulement si $values>= 3
$out_scale_item = $scale_denomination_array[$current_scale];
//$pdf->Bookmark($out_scale_item, 2, -1);
// stockage de l'ordonnée initiale
// positionnement en fonction du mode.
if ($mode == 'TWICE') $_x = 104;
require_once "../class/system/artichow/BarPlot.class.php";
require_once "../class/system/artichow/LinePlot.class.php";
$unit = $result_sdii[0]['sdii_unit'];
for ($i = 0; $i < count($values); $i++ ) {
$ydata[$i] = $values[$i]['sdiv_value'];
$ydata2[$i] = $result_sdii[0]['sdii_threshold_value'];
list ($day, $month, $year)= explode('-', $values[$i]['date_p']);
$months[$i] = $day . '-' . $month. '-'. substr($year, 2, 2);
$graph->setAntiAliasing(TRUE);
$graph->border->SetColor(new Color(133, 133, 133, 50));
$group->setSpace(5, 5, 5, 0);
$group->setBackgroundColor(
$group->grid->hideVertical();
$group->grid->SetColor(new Color(0, 0, 0, 80));
$group->setPadding(40, 15, 20, 50);
$bplot = new BarPlot($ydata);
//$bplot->setSpace(4, 4, 4, 0);
//$bplot->setPadding(15, 15, 5, 50);
new Color(207, 228, 252, 0),
new Color(146, 174, 206, 0),
$group->axis->left->title->set($unit);
$group->axis->left->title->setFont(new Tuffy(10));
$group->axis->left->title->move(- 4, 0);
$group->axis->left->setTitleAlignment(LABEL_TOP);
$bplot->label->border->SetColor(new Color(20, 20, 20, 20));
$bplot->label->setPadding(3, 1, 1, 0);
$bplot->barBorder->SetColor(new Color(161, 182, 206, 0));
$group->axis->bottom->setLabelText($months);
$group->axis->bottom->label->setAngle(55);
$group->axis->bottom->label->setFont(new Tuffy(7));
$plot->setFillColor(new Color(254, 148, 64, 50));
$plot->SetColor(new Color(254, 148, 64, 0));
$plot->mark->setFill(new Color(246, 149, 55, 20));
$plot->mark->border->show();
$plot->mark->border->SetColor(new Color(254, 148, 64, 0));
$graph->draw('tmp/'. $sdi_id. '_'. $current_scale. '.png');
// /////////////////////////////
$pdf->Image('tmp/'. $sdi_id. '_'. $current_scale. '.png', $_x, $_y, 0, 0);
// conversion px -> mm + replacement en ordonnée
if ($mode == 'TWICE') $pdf->SetY($_y);
else $pdf->SetY($_y + (GRAPH_HEIGHT * 0.36)); //$pdf->SetY($_y + (GRAPH_HEIGHT * 0.36) + DOC_INTERVAL);
* Affiche un tableau de valeurs a une échelle donnée
* @param int $current_scale
global $scale_denomination_array;
$sdi_values = $sql_object->DBSelect(SQL_getAllValue($status, $current_scale, $sdi_id));
if (count($sdi_values) <= 1 && $sdi_values[0] == false) return false;
// we prepare values for displaying
for($i = 0; $i < count($sdi_values); $i++ ) {
$current_value = formatText($sdi_values[$i]['sdiv_value']);
if ($sdi_values[$i]['sdiv_statut'] == 'D') $current_value .= ' *';
if (!empty($sdi_values[$i]['sdiv_comment'])) {
if($sdi_values[$i]['sdiv_comment_display']== 'Y') {
$comment_status = _t('dashboard', 'public');
$comment_status = _t('dashboard', 'private');
$bullet = ' <sup>['. $j. ']</sup>';
$current_value .= $bullet;
$comments .= $bullet. ' '. formatText(strip_tags($sdi_values[$i]['sdiv_comment'])) . ' ('. $comment_status. ')<br />';
$current_date = formatText($sdi_values[$i]['date_p']);
<td>'. $current_value. '</td>
<td>'. $current_date. '</td>
if ($mode != 'TWICE' || (count($sdi_values) >= 1 && count($sdi_values) < 3)) {
// Affichage du titre seulement si affichage des valeurs en standalone
$out_scale_item = $scale_denomination_array[$current_scale];
//$pdf->Bookmark($out_scale_item, 2, -1);
if ($mode == 'TWICE') $_margin = 20;
<table cellspacing="0" cellpadding="5" border="1" style="width:40%">
<td>'. $lang['dashboard']['name_pluriel']. '</td>
<td>'. $lang['statut']['published_on']. '</td>
$pdf->writeHTML($tbl, true, false, false, false, '');
if(!empty($comments)) $pdf->writeHTMLCell(0, DOC_HEIGHT, $pdf->GetX(), $pdf->GetY(), $comments, 0, 1);
// conversion px -> mm + replacement en ordonnées
|