linea21-utils
[ class tree: linea21-utils ] [ index: linea21-utils ] [ all elements ]

Source for file pdf.report.inc.php

Documentation is available at pdf.report.inc.php

  1. <?php
  2. /**
  3.  * @package linea21.utils
  4.  * @subpackage report_sdi
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  *  Define, compose and generate a SDI (Sustainable Development Indicators) PDF report
  10.  */
  11.  
  12. /**
  13. * DisplayOneSdi()
  14. * Affiche un IDD + infos satellites
  15. * 
  16. * @param int $pointer 
  17. * @return bool true
  18. */
  19. function DisplayOneSdi($pointer)
  20. {
  21.     global $sdi;
  22.     global $pdf;
  23.     global $report_settings;
  24.  
  25.     $pdf->AddPage();
  26.     // lien interne si actif
  27.     if ($report_settings['summary'] === true) $pdf->SetLink($pointer+1);
  28.     DisplayGeneralsInfo($sdi[$pointer]);
  29.     DisplayValues($sdi[$pointer]['sdii_id']);
  30.     if ($report_settings['display_provider'] === true) DisplayProviderInfo($sdi[$pointer]);
  31.     if ($report_settings['display_reglementation'] === true) DisplayReglementationInfo($sdi[$pointer]);
  32.     if ($report_settings['display_evaluation'] === true) DisplayEvaluationInfo($sdi[$pointer]);
  33.  
  34.     return true;
  35. } 
  36.  
  37. /**
  38. * DisplayGeneralsInfo()
  39. * Affiche les infos générales d'un IDD
  40. * 
  41. * @param int $current_record 
  42. * @return bool true
  43. */
  44. function DisplayGeneralsInfo($current_record)
  45. {
  46.     global $pdf;
  47.     global $lang;
  48.     global $report_settings;
  49.     
  50.     // titre d'un indicateur
  51.     $out_title = formatText(strtoupper($current_record['sdii_name']));
  52.     $pdf->SetColor('SDI_TITLE_COLOR');
  53.     $pdf->SetFont(DOC_POLICE, SDI_TITLE_STYLE, SDI_TITLE_SIZE);
  54.     $pdf->Bookmark(strtolower($out_title));
  55.     $pdf->Write(DOC_HEIGHT, $out_title); 
  56.     // si non publié
  57.     if ($current_record['sdii_statut'] == 'D') {
  58.         $pdf->SetColor('DOC_ADVISE_COLOR');
  59.         $pdf->SetFont(DOC_POLICE, '', SDI_TITLE_SIZE);
  60.         $out_status = ' :: ' . strtolower($lang['statut']['draftpdf']);
  61.         $pdf->Write(DOC_HEIGHT, $out_status);
  62.         $pdf->SetFont(DOC_POLICE, SDI_TITLE_STYLE, SDI_TITLE_SIZE);
  63.         $pdf->SetColor('DOC_COLOR');
  64.     } 
  65.     $pdf->Ln(DOC_HEIGHT); 
  66.     // thème d'appartenance
  67.     $out_theme = formatText('> > ' . $lang['sdi']['theme'] . ' : ' . $current_record['theme_name'] . ' (' . $current_record['sdtheme_name'] . ')') . END_LINE;
  68.     $pdf->SetFont(DOC_POLICE, DOC_STYLE, DOC_SIZE);
  69.     $pdf->SetColor('SDI_TITLE_COLOR');
  70.     $pdf->Write(DOC_HEIGHT, $out_theme);
  71.     $pdf->SetY($pdf->GetY() + DOC_INTERVAL);
  72.     $pdf->SetColor('DOC_COLOR'); // ré-initialise la couleur de police   
  73.     // description
  74.     $out_desc = formatText(strip_tags($current_record['sdii_description'])) . END_LINE;
  75.     $pdf->Bookmark($lang['sdi']['description'], 1, -1);
  76.     $pdf->MultiCell(0, DOC_HEIGHT, $out_desc);
  77.     $pdf->SetY($pdf->GetY() + DOC_INTERVAL); 
  78.     // objectif
  79.     $out_goal = formatText(empty_nc(strip_tags($current_record['sdii_goal']))) . END_LINE;
  80.     $out_goal_item = formatText($lang['sdi']['goal']) . END_LINE;
  81.     $pdf->Bookmark($out_goal_item, 2, -1);
  82.     $pdf->FormatSdiItem($out_goal_item);
  83.     $pdf->MultiCell(0, DOC_HEIGHT, $out_goal);
  84.     $pdf->SetY($pdf->GetY() + DOC_INTERVAL); 
  85.     // conseil d'amélioration
  86.     $out_consulting = formatText(empty_nc(strip_tags($current_record['sdii_consulting']))) . END_LINE;
  87.     $out_consulting_item = formatText($lang['sdi']['consulting']) . END_LINE;
  88.     $pdf->Bookmark($out_consulting_item, 2, -1);
  89.     $pdf->FormatSdiItem($out_consulting_item);
  90.     $pdf->MultiCell(0, DOC_HEIGHT, $out_consulting);
  91.     $pdf->SetY($pdf->GetY() + DOC_INTERVAL); 
  92.     // informations de mesure
  93.     $out_mesures_item = formatText($lang['sdi']['info_mesure']) . END_LINE;
  94.     $out_mesures_behavior = ($current_record['sdii_threshold_relative'] == 'Y' ? $lang['sdi']['threshold_relative_Y']: $lang['sdi']['threshold_relative_N']);
  95.     $out_mesures_unit = formatText($lang['sdi']['unit']) . ' : ' . $current_record['sdii_unit'] . END_LINE;
  96.     $pdf->Bookmark($out_mesures_item, 2, -1);
  97.     $pdf->FormatSdiItem($out_mesures_item); 
  98.     // unitée de mesure
  99.     $pdf->SetFont(DOC_POLICE, EM_STYLE, MIN_SIZE);
  100.     $pdf->Write(DOC_HEIGHT, $out_mesures_unit . END_LINE); 
  101.     // comportement
  102.     $pdf->Write(DOC_HEIGHT, $out_mesures_behavior . END_LINE);
  103.     $pdf->SetFont(DOC_POLICE, DOC_STYLE, DOC_SIZE); 
  104.     // tableau de valeurs
  105.     DrawMesuresArray($current_record);
  106.     $pdf->SetFont(DOC_POLICE, EM_STYLE, MIN_SIZE);
  107.     $pdf->SetY($pdf->GetY() + DOC_INTERVAL);
  108. } 
  109.  
  110. /**
  111. * DrawMesuresArray()
  112. * Dessine le tableau des valeurs IDD
  113. * 
  114. * @param  $current_record 
  115. * @return bool true
  116. */
  117. function DrawMesuresArray($current_record)
  118. {
  119.     global $pdf;
  120.     global $lang;
  121.  
  122.     $cell_width = 40; 
  123.     // initialisation 6 cellules
  124.     $pdf->SetWidths(array_fill(0, 6, $cell_width));
  125.     $pdf->SetAligns(array_fill(0, 6, 'C'));
  126.     $pdf->SetFont(DOC_POLICE, ARRAY_TITLE_STYLE, ARRAY_TITLE_SIZE);
  127.     $pdf->Row(array($lang['sdi']['max_value'], $lang['sdi']['min_value'], $lang['sdi']['threshold_value'], $lang['sdi']['frequency']));
  128.     $pdf->SetFont(DOC_POLICE, ARRAY_DATA_STYLE, ARRAY_DATA_SIZE);
  129.     $pdf->Row(array($current_record['sdii_max_value'], $current_record['sdii_min_value'], $current_record['sdii_threshold_value'], $current_record['sdii_frequency']));
  130.     $pdf->SetFont(DOC_POLICE, DOC_STYLE, DOC_SIZE);
  131.  
  132.     return true;
  133. } 
  134.  
  135. /**
  136. * DisplayProviderInfo()
  137. * Affiche les informations Fournisseurs d'un IDD
  138. * 
  139. * @param  $current_record 
  140. * @return bool true
  141. */
  142. function DisplayProviderInfo($current_record)
  143. {
  144.     global $pdf;
  145.     global $lang;
  146.  
  147.     $out_name = formatText($current_record['sdip_name']);
  148.     if (!empty($current_record['sdip_service'])) $out_name .= ' - ' . formatText($current_record['sdip_service']);
  149.     if (!empty($current_record['sdip_incharge'])) $out_name .= ' - ' . formatText($current_record['sdip_incharge']) . ' (' . $lang['sdi']['p_incharge'] . ')';
  150.     $out_name .= END_LINE;
  151.     $out_adress = formatText(empty_nc(strip_tags($current_record['sdip_address'])));
  152.     $out_phone_fax = $lang['sdi']['p_phone'] . ' : ' . formatText(empty_nc($current_record['sdip_phone']));
  153.     $out_phone_fax .= ' - ' . $lang['sdi']['p_fax'] . ' : ' . formatText(empty_nc($current_record['sdip_fax'])) . END_LINE;
  154.     $out_email_item = $lang['sdi']['p_email'] . ' : ';
  155.     $out_email = formatText($current_record['sdip_email']);
  156.     $out_desc = formatText(empty_nc(strip_tags($current_record['sdip_description']))) . END_LINE;
  157.     $out_provider_item = formatText($lang['sdi']['p_title']) ;
  158.  
  159.     $pdf->ParagraphBreak();
  160.     $pdf->Bookmark($out_provider_item, 1, -1);
  161.     $pdf->FormatSdiInfo($out_provider_item);
  162.  
  163.     $firstcell_width = 60;
  164.  
  165.     $pdf->SetX($pdf->GetX() + $firstcell_width);
  166.     $pdf->MultiCell(0, DOC_HEIGHT, $out_name);
  167.  
  168.     $pdf->SetX($pdf->GetX() + $firstcell_width);
  169.     $pdf->MultiCell(0, DOC_HEIGHT, $out_adress);
  170.  
  171.     $pdf->SetX($pdf->GetX() + $firstcell_width);
  172.     $pdf->MultiCell(0, DOC_HEIGHT, $out_phone_fax);
  173.  
  174.     $pdf->SetX($pdf->GetX() + $firstcell_width);
  175.     $pdf->Cell($pdf->GetStringWidth($out_email_item), DOC_HEIGHT, $out_email_item);
  176.     if (empty($out_email)) $pdf->Cell(0, DOC_HEIGHT, empty_nc($out_email));
  177.     else $pdf->Cell(0, DOC_HEIGHT, $out_email, 0, 0, '', 0, 'mailto:' . $out_email);
  178.     $pdf->SetY($pdf->GetY() + DOC_INTERVAL);
  179.  
  180.     return true;
  181. } 
  182.  
  183. /**
  184. * DisplayReglementationInfo()
  185. * Affiche la réglementation d'un IDD
  186. * 
  187. * @param  $current_record 
  188. * @return bool true
  189. */
  190. function DisplayReglementationInfo($current_record)
  191. {
  192.     global $pdf;
  193.     global $lang;
  194.  
  195.     $out_name = formatText(empty_nc($current_record['sdir_title'])) . END_LINE;
  196.     $out_body = formatText(empty_nc(strip_tags($current_record['sdir_body']))) . END_LINE;
  197.     $out_uri = formatText($current_record['sdir_mask_uri']);
  198.     $out_uri_href = $current_record['sdir_referer_uri'];
  199.  
  200.     $out_name_item = $lang['sdi']['r_title'] . ' : ';
  201.     $out_body_item = $lang['sdi']['r_body'] . ' : ';
  202.     $out_uri_item = $lang['sdi']['r_referer_uri'] . ' : ';
  203.  
  204.     $out_reglementation_item = formatText($lang['sdi']['add_step4']) ;
  205.  
  206.     $pdf->ParagraphBreak();
  207.     $pdf->Bookmark($out_reglementation_item, 1, -1);
  208.     $pdf->FormatSdiInfo($out_reglementation_item);
  209.  
  210.     $firstcell_width = 60; 
  211.     // nom de l'organisme fournisseur
  212.     $pdf->SetFont(DOC_POLICE, EM_STYLE, DOC_SIZE);
  213.     $pdf->Cell($firstcell_width, DOC_HEIGHT, $out_name_item, 0, 0, 'R');
  214.     $pdf->SetFont(DOC_POLICE, DOC_STYLE, DOC_SIZE);
  215.     $pdf->MultiCell(0, DOC_HEIGHT, $out_name);
  216.     $pdf->SetY($pdf->GetY() + DOC_INTERVAL); 
  217.     // détail reglementation
  218.     $pdf->SetFont(DOC_POLICE, EM_STYLE, DOC_SIZE);
  219.     $pdf->Cell($firstcell_width, DOC_HEIGHT, $out_body_item, 0, 0, 'R');
  220.     $pdf->SetFont(DOC_POLICE, DOC_STYLE, DOC_SIZE);
  221.     $pdf->MultiCell(0, DOC_HEIGHT, $out_body);
  222.     $pdf->SetY($pdf->GetY() + DOC_INTERVAL); 
  223.     // lien internet reglementation
  224.     $pdf->SetFont(DOC_POLICE, EM_STYLE, DOC_SIZE);
  225.     $pdf->Cell($firstcell_width, DOC_HEIGHT, $out_uri_item, 0, 0, 'R');
  226.     $pdf->SetFont(DOC_POLICE, DOC_STYLE, DOC_SIZE);
  227.     if (!empty($out_uri_href)) {
  228.         if (!empty($out_uri)) $pdf->Cell(0, DOC_HEIGHT, $out_uri, 0, 0, '', 0, $out_uri_href);
  229.         //if (!empty($out_uri)) $pdf->Cell(0, DOC_HEIGHT, ' (', 0, 0);
  230.         //$pdf->Cell(0, DOC_HEIGHT, $out_uri, 0, 0, '', 0, $out_uri_href);
  231.         //if (!empty($out_uri)) $pdf->Cell(0, DOC_HEIGHT, ')', 0, 0);
  232.     } else $pdf->Write(DOC_HEIGHT, empty_nc($out_uri));
  233.     $pdf->SetY($pdf->GetY() + DOC_INTERVAL);
  234.  
  235.     return true;
  236. } 
  237.  
  238. /**
  239. * DisplayEvaluationInfo()
  240. * Affiche le tableau de critères d'évaluation
  241. * 
  242. * @param int $current_record 
  243. * @return bool true
  244. */
  245. function DisplayEvaluationInfo($current_record)
  246. {
  247.     global $pdf;
  248.     global $lang;
  249.  
  250.     $out_eval_item = formatText($lang['sdi']['e_title']) ;
  251.  
  252.     $pdf->ParagraphBreak();
  253.     $pdf->Bookmark($out_eval_item, 1, -1);
  254.     $pdf->FormatSdiInfo($out_eval_item);
  255.  
  256.     $cell_width = (integer) 190 / 6;
  257.     $pdf->SetWidths(array_fill(0, 6, $cell_width));
  258.     $pdf->SetAligns(array_fill(0, 6, 'C'));
  259.     $pdf->SetFont(DOC_POLICE, ARRAY_TITLE_STYLE, ARRAY_TITLE_SIZE);
  260.     $pdf->Row(array($lang['sdi']['e_scale_compare'], $lang['sdi']['e_fiability'], $lang['sdi']['e_accessibility'], $lang['sdi']['e_lisibility'], $lang['sdi']['e_relevance'], $lang['sdi']['e_global_performance']));
  261.     $pdf->SetFont(DOC_POLICE, ARRAY_DATA_STYLE, ARRAY_DATA_SIZE);
  262.     $pdf->Row(array($current_record['sdie_scale_compare'], $current_record['sdie_fiability'], $current_record['sdie_accessibility'], $current_record['sdie_lisibility'], $current_record['sdie_relevance'], $current_record['sdie_global_performance']));
  263.     $pdf->SetFont(DOC_POLICE, DOC_STYLE, DOC_SIZE);
  264.  
  265.     return true;
  266. } 
  267.  
  268. /**
  269.  * DisplayValues()
  270.  * Affiche les valeurs d'un IDD.
  271.  * 
  272.  * @param int $sdi_id 
  273.  * @return bool true
  274.  ***/
  275. function DisplayValues($sdi_id)
  276. {
  277.     global $pdf;
  278.     global $lang;
  279.     global $report_settings;
  280.     global $scale_array;
  281.     global $sql_object;
  282.  
  283.     if ($report_settings['graphic_values'] === true && $report_settings['table_values'] === true) $mode = 'TWICE';
  284.     elseif ($report_settings['graphic_values'] === true || $report_settings['table_values'] === true) $mode = 'ONE';
  285.     else return false;
  286.  
  287.     $out_values_item = $lang['dashboard']['value'];
  288.     $pdf->ParagraphBreak();
  289.     $pdf->Bookmark($out_values_item, 1, -1);
  290.     $pdf->FormatSdiInfo($out_values_item);
  291.  
  292.     $scale_no_values = array(); // recipient no values
  293.     $scale_insuffisant_values = array(); // recipient insuffisant values graph
  294.     for($i = 0; $i < count($scale_array); $i++) {
  295.         if ($report_settings['graphic_values'] === true) {
  296.             if (DisplayGraphicValues($sdi_id, $scale_array[$i], GetStatus($report_settings['status']), $mode) === false) array_push($scale_insuffisant_values, $scale_array[$i]);
  297.         } 
  298.  
  299.         if ($report_settings['table_values'] === true) {
  300.             if (DisplayTableValues($sdi_id, $scale_array[$i], GetStatus($report_settings['status']), $mode) === false) array_push($scale_no_values, $scale_array[$i]);
  301.         } 
  302.     } 
  303.     DisplayNoValuesFor($scale_no_values, $lang['dashboard']['rap_no_values_for']);
  304.     DisplayNoValuesFor($scale_insuffisant_values, $lang['dashboard']['rap_insuffisant_values'], $mode, $scale_no_values);
  305.  
  306.     return true;
  307. } 
  308.  
  309. /**
  310.  * GetStatus()
  311.  * Formattage du statut pour requête SQL
  312.  * 
  313.  * @param string $current_status 
  314.  * @return string $status
  315.  ***/
  316. function GetStatus($current_status)
  317. {
  318.     switch ($current_status) {
  319.         case 'ALL':
  320.             $status = 'SCA';
  321.             break;
  322.         case 'PUBLIC':
  323.             $status = 'SCP';
  324.             break;
  325.     } 
  326.     return $status;
  327. } 
  328.  
  329. /**
  330.  * DisplayNoValuesFor()
  331.  * Affiche les échelles ne contenant pas de valeurs ou insuffisamment
  332.  * 
  333.  * @param array $array_scale 
  334.  * @param string $message 
  335.  * @param integer $mode 
  336.  * @param integer $array 
  337.  * @return bool true
  338.  ***/
  339. function DisplayNoValuesFor($array_scale, $message, $mode = -1, $array = -1)
  340. {
  341.     global $pdf;
  342.     global $lang;
  343.     global $scale_denomination_array;
  344.     $content = '';
  345.     $sep = ''; 
  346.     // si mode TWICE et deuxi�me tableau fourni. On le soustriat au premier.
  347.     if ($array != -1 && $mode == 'TWICE') $array_scale = array_values(array_diff($array_scale, $array));
  348.  
  349.     if (count($array_scale) == 0) return true;
  350.  
  351.     for($i = 0; $i < count($array_scale); $i++) {
  352.         $content .= $sep . $scale_denomination_array[$array_scale[$i]];
  353.         $sep = ', ';
  354.     } 
  355.     if (empty($content)) return true;
  356.     $margin = 0;
  357.     $pdf->SetX($pdf->GetX() + $margin);
  358.     $pdf->SetFont(DOC_POLICE, EM_STYLE, DOC_SIZE);
  359.     $pdf->Cell(0, DOC_HEIGHT, $message, 0, 1, 'L');
  360.     $pdf->SetFont(DOC_POLICE, DOC_STYLE, DOC_SIZE);
  361.     $margin = 10;
  362.     $pdf->SetColor('DOC_ADVISE_COLOR');
  363.     $pdf->SetX($pdf->GetX() + $margin);
  364.     $pdf->MultiCell(0, DOC_HEIGHT, $content);
  365.     $pdf->SetY($pdf->GetY() + DOC_INTERVAL);
  366.     $pdf->SetColor('DOC_COLOR');
  367.  
  368.     return true;
  369. } 
  370.  
  371. /**
  372.  * DisplayGraphicValues()
  373.  * Gènère et affiche les valeurs sous forme graphique
  374.  * 
  375.  * @param int $sdi_id 
  376.  * @param int $current_scale 
  377.  * @param string $status 
  378.  * @param string $mode 
  379.  * @return bool true
  380.  ***/
  381. function DisplayGraphicValues($sdi_id, $current_scale, $status, $mode)
  382. {
  383.     global $pdf;
  384.     global $sql_object;
  385.     global $scale_denomination_array;
  386.  
  387.     $values = $sql_object->DBSelect(SQL_getAllValue($status, $current_scale, $sdi_id));
  388.     // renversement des valeurs pour affichage chronologique
  389.     if(is_array($values)) $values = @array_reverse ($values, false);
  390.  
  391.     $result_sdii = $sql_object->DBSelect(SQL_getInfoSdi($sdi_id));
  392.  
  393.     if (count($values) < 3) return false; 
  394.     // on checke si le graph tient sur la page sinon Saut de page
  395.     $pdf->CheckPageBreak((GRAPH_HEIGHT * 0.36) + DOC_INTERVAL); 
  396.     // Affichage du titre seulement si $values>= 3
  397.     $out_scale_item = $scale_denomination_array[$current_scale];
  398.     $pdf->Bookmark($out_scale_item, 2, -1);
  399.     $pdf->FormatSdiItem($out_scale_item);
  400.     $pdf->SetY($pdf->GetY() + DOC_INTERVAL);
  401.     
  402.     // stockage de l'ordonnée initiale
  403.     $_y = $pdf->GetY();
  404.     
  405.     // positionnement en fonction du mode.
  406.     
  407.     if ($mode == 'TWICE') $_x = 94;
  408.     else $_x = 50;
  409.  
  410.     require_once "../class/system/artichow/BarPlot.class.php";
  411.     require_once "../class/system/artichow/LinePlot.class.php";
  412.     
  413.     $unit = $result_sdii[0]['sdii_unit']; 
  414.     
  415.     for ($i = 0; $i < count($values); $i++) {
  416.         $ydata[$i] = $values[$i]['sdiv_value'];
  417.         $ydata2[$i] = $result_sdii[0]['sdii_threshold_value'];
  418.         list($day, $month, $year)=explode('-', $values[$i]['date_p']);
  419.     $months[$i] = $day . '-' .$month. '-'. substr($year, 2, 2);    
  420.     }
  421.     
  422.     // Create the graph.
  423.     $graph = new Graph(GRAPH_WIDTH, GRAPH_HEIGHT);
  424.     if(function_exists('imageantialias')) {
  425.       $graph->setAntiAliasing(TRUE);
  426.     }
  427.     $graph->border->setColor(new Color(133, 133, 133, 50));
  428.  
  429.     $group = new PlotGroup;
  430.     $group->setSpace(5, 5, 5, 0);
  431.     $group->setBackgroundColor(
  432.         new Color(244, 244, 244)
  433.     );
  434.     $group->grid->hideVertical();
  435.     $group->grid->setColor(new Color(0, 0, 0, 80));
  436.     $group->grid->setType(LINE_DOTTED );
  437.     $group->setPadding(40, 15, 20, 50);
  438.     
  439.     $bplot = new BarPlot($ydata);
  440.     //$bplot->setSpace(4, 4, 4, 0);
  441.     //$bplot->setPadding(15, 15, 5, 50);
  442.     $bplot->SetBarGradient(
  443.         new LinearGradient(
  444.             new Color(207, 228, 252, 0),
  445.             new Color(146, 174, 206, 0),
  446.             90
  447.         )
  448.     );    
  449.  
  450.     $group->axis->left->title->set($unit);
  451.     $group->axis->left->title->setFont(new Tuffy(10));
  452.     $group->axis->left->title->move(-4, 0);
  453.     $group->axis->left->setTitleAlignment(LABEL_TOP);
  454.  
  455.     $bplot->label->border->setColor(new Color(20, 20, 20, 20));
  456.     $bplot->label->setPadding(3, 1, 1, 0);
  457.     $bplot->barBorder->setColor(new Color(161, 182, 206, 0));
  458.  
  459.     $group->axis->bottom->setLabelText($months); 
  460.     $group->axis->bottom->label->setAngle(55);
  461.     $group->axis->bottom->label->setFont(new Tuffy(7));
  462.  
  463.     $group->add($bplot);
  464.  
  465.  
  466.     $plot = new LinePlot($ydata2, LINEPLOT_MIDDLE);
  467.     $plot->setFillColor(new Color(254, 148, 64, 50));
  468.     $plot->setColor(new Color(254, 148, 64, 0));
  469.     $plot->mark->setType(MARK_SQUARE);
  470.     $plot->mark->setSize(5);
  471.     $plot->mark->setFill(new Color(246, 149, 55, 20));
  472.     $plot->mark->border->show();
  473.     $plot->mark->border->setColor(new Color(254, 148, 64, 0));
  474.  
  475.     $group->add($plot);
  476.     $graph->add($group);
  477.     if(!file_exists('tmp')) mkdir('tmp');
  478.     $graph->draw('tmp/'.$sdi_id.'_'.$current_scale.'.png');
  479.     // /////////////////////////////
  480.     // Affichage
  481.     $pdf->Image('tmp/'.$sdi_id.'_'.$current_scale.'.png', $_x, $_y, 0, 0);
  482.     // conversion px -> mm + replacement en ordonnée
  483.     if ($mode == 'TWICE') $pdf->SetY($_y);
  484.     else $pdf->SetY($_y + (GRAPH_HEIGHT * 0.36)); //$pdf->SetY($_y + (GRAPH_HEIGHT * 0.36) + DOC_INTERVAL);
  485.     return true;
  486. }
  487.  
  488. /**
  489.  * DisplayTableValues()
  490.  * Affiche un tableau de valeurs a une échelle donnée
  491.  * 
  492.  * @param int $sdi_id 
  493.  * @param int $current_scale 
  494.  * @param string $status 
  495.  * @param string $mode 
  496.  * @return bool true
  497.  ***/
  498. function DisplayTableValues($sdi_id, $current_scale, $status, $mode)
  499. {
  500.     global $pdf;
  501.     global $lang;
  502.     global $sql_object;
  503.     global $scale_denomination_array;
  504.  
  505.     $_y = $pdf->GetY();
  506.     $sdi_values = $sql_object->DBSelect(SQL_getAllValue($status, $current_scale, $sdi_id));
  507.  
  508.     if (count($sdi_values) <= 1 && $sdi_values[0] == false) return false;
  509.  
  510.     if ($mode != 'TWICE' || (count($sdi_values) >= 1 && count($sdi_values) < 3)) {
  511.         // Affichage du titre seulement si affichage des valeurs en standalone
  512.         $out_scale_item = $scale_denomination_array[$current_scale];
  513.         $pdf->Bookmark($out_scale_item, 2, -1);
  514.         $pdf->FormatSdiItem($out_scale_item);
  515.         $pdf->SetY($pdf->GetY() + DOC_INTERVAL);
  516.     } 
  517.  
  518.     $pdf->Ln(DOC_INTERVAL);
  519.     if ($mode == 'TWICE') $_margin = 20;
  520.     else $_margin = 60;
  521.  
  522.     $pdf->SetX($_margin);
  523.  
  524.     $cell_width = 30;
  525.     $pdf->SetWidths(array_fill(0, 2, $cell_width));
  526.     $pdf->SetAligns(array_fill(0, 2, 'C'));
  527.     $pdf->SetFont(DOC_POLICE, ARRAY_TITLE_STYLE, ARRAY_TITLE_SIZE);
  528.     $pdf->Row(array($lang['dashboard']['name_pluriel'], $lang['statut']['published_on']));
  529.     $pdf->SetFont(DOC_POLICE, ARRAY_DATA_STYLE, ARRAY_DATA_SIZE);
  530.     for($i = 0; $i < count($sdi_values); $i++) {
  531.         $pdf->SetX($_margin);
  532.         $current_value = formatText($sdi_values[$i]['sdiv_value']);
  533.         if ($sdi_values[$i]['sdiv_statut'] == 'D') $current_value .= ' *';
  534.         $current_date = formatText($sdi_values[$i]['date_p']);
  535.         $pdf->Row(array($current_value, $current_date));
  536.     } 
  537.     $pdf->SetX($_margin);
  538.     $pdf->SetFont(DOC_POLICE, EM_STYLE, MIN_SIZE);
  539.     $pdf->MultiCell(0, DOC_HEIGHT, '* ' . strtolower($lang['statut']['draftpdf']), 0, 'L', 0);
  540.     $pdf->SetFont(DOC_POLICE, DOC_STYLE, DOC_SIZE);
  541.     $pdf->Ln(DOC_INTERVAL * 2); 
  542.     // conversion px -> mm + replacement en ordonnées
  543.     if ($mode == 'TWICE' && count($sdi_values) >= 3 && $pdf->GetY() < ($_y + (GRAPH_HEIGHT * 0.36))) $pdf->SetY($_y + (GRAPH_HEIGHT * 0.36) + DOC_INTERVAL);
  544.  
  545.     return true;
  546. } 
  547.  
  548. ?>

Documentation generated on Sat, 08 Nov 2008 14:53:50 +0100 by phpDocumentor 1.4.1