function postProcess()
 {
     $idSite = $this->getSubmitValue('form_site_admin');
     $confPdf = new PdfConfigDb($idSite);
     $listChoix = $confPdf->getChoixPdf();
     $paramElem = $this->getSubmitValue('param_pdf_result');
     //print ("debut : ".$paramElem."<br>");
     $tabLine = split("@@", $paramElem);
     $param = array();
     $i = 0;
     foreach ($tabLine as $key => $info) {
         //print ("Get : ".$key." : int : ".$info."<br>");
         $tmpLine = split("#", $info);
         //$param[$tmpLine[0]] = array_slice ($tmpLine, 1);
         $param[$i] = $tmpLine;
         $i++;
     }
     /*
     foreach ($param as $key => $info) {
     	print ("Select : ".$key." : int : ".$info[PDF_INDEX_INT]." all : ".$info[PDF_INDEX_ALL]);
     	if (isset($info[PDF_INDEX_AUTRE])) {
     		print(", autre : ".$info[PDF_INDEX_AUTRE]);
     	}
     	print("<br>");
     //			print (" Result Select : ".$key." : int : ".$info."<br>");
     }
     */
     /*		
     $param = array();
     foreach ($listChoix as $key => $info) {
     	$selCh =  $this->getSubmitValue($key);
     	$selInt = "false";
     	$selAll = "false";
     	if ($selCh == 1) {
     	//print ("$key : $selCh<br>");
     		if (! isset($info["PAG"])) {
     			if ($info["INT"] == "true") {
     				if ($this->getSubmitValue($key."I") == 1) {
     					$selInt = "true";
     				}
     			}
     			if ($info["ALL"] == "true") {
     				if ($this->getSubmitValue($key."A") == 1) {
     					$selAll = "true";
     				}
     			}
     		}
     		$param[$key] = array ($selInt, $selAll);
     	}
     }
     */
     /*
     foreach ($param as $key => $info) {
     	print ("Select : ".$key." : int : ".$info[0]." all : ".$info[1]."<br>");
     }
     */
     // add a new pdf
     if ($this->pdfId == -1) {
         $confPdf->addPdf($this->getSubmitValue('form_name'), $param, $this->getSubmitValue('form_public_pdf') == 'yes');
     } else {
         $confPdf->updatePdf($this->getSubmitValue('form_id'), $this->getSubmitValue('form_name'), $param, $this->getSubmitValue('form_public_pdf') == 'yes');
     }
     //$confPdf->savePdf ();
 }
 function display()
 {
     $viewAllDetail = false;
     $paramAll = getRequestVar('all', 0, 'int');
     if ($paramAll == 1) {
         $viewAllDetail = true;
     }
     $period = $this->request->getPeriod();
     $idSite = $this->request->getSiteId();
     $idSite = getRequestVar('site', -1, 'int');
     $idPdf = getRequestVar('idPdf', -2, 'int');
     //$pdf = new GenerePDF("P", "mm");
     $pdf = new GenerePDF('P', 'mm', 'A4', true, "UTF-8");
     // patch by HonestQiao
     if ($GLOBALS['lang']['lang_iso'] == 'zh') {
         $pdf->phpmvFont = "GB";
         $pdf->AddGBFont();
     }
     // patch by HonestQiao
     if (isset($GLOBALS["lang"]["text_dir"])) {
         $pdf->direction = $GLOBALS["lang"]["text_dir"];
     } else {
         $pdf->direction = "ltr";
     }
     // ENGLISH
     /* SPECIFIC TCPDF
     		$l = Array();
     		
     		// PAGE META DESCRIPTORS --------------------------------------
     		
     		$l['a_meta_charset'] = "UTF-16";
     		$l['a_meta_dir'] = $pdf->direction;
     		$l['a_meta_language'] = "jp";
     		
     		// TRANSLATIONS --------------------------------------
     		$l['w_page'] = "page";
     		
     		$pdf->setLanguageArray($l); //set language items
     */
     //  fin specifique TCPDF
     //
     $pdf->currentModule = $this;
     if ($idSite > 0) {
         $site = new Site($idSite);
         $pdf->currentSite = $site;
     } else {
         $pdf->currentSite = null;
     }
     $pdf->period = $period;
     $pdf->date = $this->request->getDate();
     $pdf->literalDate = getLiteralDate($period, $this->request->getDate());
     // Set PDF propertes data
     if ($idSite != -1) {
         $titre = "Statistics of " . $site->getName();
     } else {
         $titre = $pdf->pmvTranslate("summary_title");
     }
     $pdf->SetTitle($titre);
     $pdf->SetAuthor("phpMyVisites");
     $pdf->SetCreator($pdf->pmvTranslate("head_titre"));
     $pdf->SetKeywords($pdf->pmvTranslate("head_keywords"));
     $pdf->SetSubject($pdf->pmvTranslate("logo_description"));
     $pdf->SetFont($pdf->phpmvFont, "", 8);
     $pdf->SetLineWidth(0.1);
     $firstPageOk = false;
     if ($idSite <= 0) {
         // *******************************************************
         // Sites Summary
         // *******************************************************
         $pdf->titrePage1 = "summary_title";
         $pdf->AddPage();
         $firstPageOk = true;
         $pdf->setSitesSummaryStatistics();
         $pdf->Ln();
     } else {
         $zoom = $this->data->getVisitsStatistics();
         if (!isset($zoom["nb_vis"])) {
             $pdf->titrePage1 = "summary_title";
             $pdf->AddPage();
             $firstPageOk = true;
             $txtNoVisit = $pdf->pmvTranslate("aucunvisiteur_titre");
             $pdf->setErrorMessage($txtNoVisit);
         } else {
             $confPf = new PdfConfigDb($idSite, true);
             if ($idPdf == -2) {
                 // No PDF
                 // Get default site pdf
                 $idPdf = $site->getIdPdf();
             }
             $paramShowPdf = $confPf->getPdf($idPdf);
             if ($paramShowPdf == null) {
                 //print("take defaut<br>");
                 $paramShowPdf = $confPf->getDefaultPdf();
             } else {
                 $paramShowPdf = $paramShowPdf->pdfParam;
             }
             $confShowPdf = $confPf->getChoixPdf();
             $pdfLink = array();
             // Create all links object
             foreach ($paramShowPdf as $keyTab => $info) {
                 $key = $info[PDF_INDEX_KEY];
                 if ($key == "PG0") {
                 } elseif (isset($confShowPdf[$key]["PAG"])) {
                     $pdfLink[$key] = $pdf->AddLink();
                 }
             }
             //$pdf->Cell(80, PDF_DEFAULT_ROW_HEIGHT, "test", "0", "", "L", 0);
             // Generate page
             foreach ($paramShowPdf as $keyTab => $info) {
                 $key = $info[PDF_INDEX_KEY];
                 if ($key == "PG0") {
                     $pdf->titrePage1 = "summary_title";
                     $pdf->AddPage();
                     $firstPageOk = true;
                     $pdf->setSitesSummaryStatistics();
                     $pdf->Ln();
                 } elseif ($key == "SUM") {
                     $firstPageOk = $pdf->setPageSummary($paramShowPdf, $confShowPdf, $pdfLink, $firstPageOk);
                 } elseif (isset($confShowPdf[$key]["PAG"])) {
                     if (isset($info[PDF_INDEX_AUTRE])) {
                         $lib = $info[PDF_INDEX_AUTRE];
                     } else {
                         $lib = $confShowPdf[$key]["TIT"];
                     }
                     $pdf->titrePage1 = $lib;
                     $pdf->AddPage();
                     $firstPageOk = true;
                     $pdf->SetLink($pdfLink[$key]);
                 } else {
                     if (!$firstPageOk) {
                         $pdf->AddPage();
                         $firstPageOk = true;
                     }
                     //echo "$key : PAR1 : ".$confShowPdf[$key]["PAR1"]." : ".$info[PDF_INDEX_AUTRE]."<br>";
                     //print("xx : z" . $key . "z : w" . $info . "w : " . $confShowPdf[$key]["FCT"] . "<br>");
                     //$pdf->$confShowPdf[$key]["FCT"]($info[0], $info[1]);
                     if ($confShowPdf[$key]["INT"] == "true" && $confShowPdf[$key]["ALL"] == "true") {
                         //echo "int all<br>";
                         $pdf->{$confShowPdf}[$key]["FCT"]($info[PDF_INDEX_ALL] == "true", $info[PDF_INDEX_INT] == "true");
                     } elseif ($confShowPdf[$key]["INT"] == "true") {
                         //echo "int<br>";
                         $pdf->{$confShowPdf}[$key]["FCT"]($info[PDF_INDEX_INT] == "true");
                     } elseif ($confShowPdf[$key]["ALL"] == "true") {
                         //echo "all<br>";
                         $pdf->{$confShowPdf}[$key]["FCT"]($info[PDF_INDEX_ALL] == "true");
                     } elseif (isset($confShowPdf[$key]["PAR1"]) && isset($info[PDF_INDEX_AUTRE])) {
                         //echo "PAR1<br>";
                         $pdf->{$confShowPdf}[$key]["FCT"]($info[PDF_INDEX_AUTRE]);
                     } else {
                         //echo "Vide<br>";
                         $pdf->{$confShowPdf}[$key]["FCT"]();
                     }
                 }
             }
         }
     }
     if (!$firstPageOk) {
         $pdf->AddPage();
         $firstPageOk = true;
     }
     $pdf->Ln(15);
     $pdf->SetFont($pdf->phpmvFont, "I", 6);
     $pdf->SetTextColor(128);
     $twtTime = sprintf($pdf->pmvTranslate("generique_timefooter"), getTimeElapsed());
     $w = $pdf->GetStringWidth($twtTime) + 6;
     $pdf->SetX((210 - $w) / 2);
     $pdf->Write(3, $twtTime);
     // *******************************************************
     // Output PDF
     // *******************************************************
     //echo "fin : " . $pdf->traceMsg;
     // stats-siteX.pdf
     $pdf->Output("stats-site{$idSite}.pdf", "D");
 }