[ Index ]
 

Code source de phpMyVisites 2.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/core/views/ -> ViewPdf.class.php (source)

   1  <?php
   2  /* 

   3   * phpMyVisites : website statistics and audience measurements

   4   * Copyright (C) 2002 - 2006

   5   * http://www.phpmyvisites.net/ 

   6   * phpMyVisites is free software (license GNU/GPL)

   7   * Authors : phpMyVisites team

   8  */
   9  
  10  // $Id: ViewPdf.class.php 127 2006-10-23 20:01:25Z cmil $

  11  //define ("INCLUDE_PATH", "../..");

  12  require_once  INCLUDE_PATH."/core/include/ViewModule.class.php";
  13  require_once INCLUDE_PATH."/core/include/myFpdf.php";
  14  
  15  define("PDF_COEF_MM_PX", 72 / 25.4);
  16  define("PDF_CHAPTER_LN_SPACE", 8);
  17  
  18  define("PDF_DEFAULT_ROW_HEIGHT", 6);
  19  
  20  define("PDF_DEFAULT_STYLE", "setStyleLinePage");
  21  define("PDF_DEFAULT_MAX_Y", 270);
  22  
  23  class TabCell {
  24      var $text = "";
  25      var $border = "";
  26      var $ln = 0;
  27      var $align = "C";
  28      var $fill = "";
  29      var $styleFct = PDF_DEFAULT_STYLE;
  30      var $url = "";
  31      
  32      
  33  	function TabCell($p_text = "", $p_border = "", $p_ln = 0, $p_align = "C", $p_fill = "", $p_styleFct = PDF_DEFAULT_STYLE, $p_url = "") {
  34          $this->text = $p_text;
  35          $this->border = $p_border;
  36          $this->ln = $p_ln;
  37          $this->align = $p_align;
  38          $this->fill = $p_fill;
  39          $this->styleFct = $p_styleFct;
  40          $this->url = $p_url;
  41      }
  42  }
  43  
  44  class GenerePDF extends myFPDF {
  45      // Current col

  46      var $col = 0;
  47      //Ordonnee du debut des colonnes

  48      var $y0;
  49      // Current module

  50      var $currentModule;
  51      // Current site for heder of pdf

  52      var $currentSite;
  53  
  54      var $request;
  55  
  56      var $titrePage1;
  57  
  58      var $direction;
  59  
  60      var $phpmvFont = "Arial";
  61  
  62      var $period;
  63      var $literalDate;
  64  
  65      // Header of each page

  66  	function Header() {
  67          //     //En-tete

  68          //        $LeTitre = $this->pmvTranslate("visites_titre") . " - " . $this->currentSite->getName();

  69          if ($this->currentSite != null) {
  70              if ($this->direction == "rtl") {
  71                  $LeTitre = $this->pmvTranslate($this->titrePage1." - ".$this->currentSite->getName());
  72              }
  73              else {
  74                  $LeTitre = $this->currentSite->getName()." - ".$this->pmvTranslate($this->titrePage1);
  75              }
  76          }
  77          else {
  78              $LeTitre = $this->pmvTranslate($this->titrePage1);
  79          }
  80  
  81          //$this->Image(INCLUDE_PATH."/themes/default/images/phpmv.png", 10, 5, 50);

  82  
  83          $this->SetTextColor(0, 0, 139);
  84          $this->SetFillColor(255, 255, 255);
  85          $this->SetFont($this->phpmvFont, "B", 11);
  86  
  87          $w = $this->GetStringWidth($LeTitre) + 6;
  88          if ($w < $this->GetStringWidth($this->literalDate)) {
  89              $w = $this->GetStringWidth($this->literalDate);
  90          }
  91  
  92          $this->SetX((210 - $w) / 2);
  93          $this->SetDrawColor(0, 0, 139);
  94          $this->SetFillColor(255, 255, 255);
  95  
  96          $this->SetLineWidth(0.2);
  97          $this->Cell($w, 8, $LeTitre, "LTR", 0, "C", 0);
  98          $this->Ln();
  99          $this->SetFont($this->phpmvFont, "", 8);
 100          $this->SetX((210 - $w) / 2);
 101          $this->Cell($w, 6, $this->literalDate, "LBR", 1, "C", 0);
 102          $this->Ln(2);
 103  
 104          $txtBeta = "PDF generation is a Beta feature of phpMyVisites! It is not complete yet. Please submit your suggestions / bugs report to the forums";
 105          $this->SetTextColor(255, 0, 0);
 106          $this->SetFont($this->phpmvFont, "U", 8);
 107          $w = $this->GetStringWidth($txtBeta) + 6;
 108          $this->SetX((210 - $w) / 2);
 109          $this->Cell($w, 2, $txtBeta, 0, 0, "C", 0, "http://www.phpmyvisites.us/forums/index.php/m/13258/");
 110          $this->Ln(5);
 111          //Sauvegarde de l"ordonn�e

 112          $this->y0 = $this->GetY();
 113  
 114      }
 115  
 116      // Footer of each page

 117  	function Footer() {
 118          //Pied de page

 119          $this->SetY(-15);
 120          $this->SetFont($this->phpmvFont, "I", 8);
 121          $this->SetTextColor(128);
 122          $this->Cell(40, 10, "Powered by phpMyVisites", 0, 0, "C", 0, "http://www.phpmyvisites.us/");
 123          $w = $this->GetStringWidth("Page ".$this->PageNo()) + 6;
 124          $this->SetX((210 - $w) / 2);
 125          $this->Cell($w, 10, "Page ".$this->PageNo(), 0, 0, "C");
 126      }
 127      
 128      // Rewrtie Cell for utf8

 129  	function Cell($w, $h = 0, $txt = "", $border = 0, $ln = 0, $align = "", $fill = 0, $link = "") {
 130          FPDF :: Cell($w, $h, utf8_decode($txt), $border, $ln, $align, $fill, $link);
 131  //        FPDF :: Cell($w, $h, $txt, $border, $ln, $align, $fill, $link);

 132  //        UFPDF :: Cell($w, $h, $txt, $border, $ln, $align, $fill, $link);

 133      }
 134  
 135  
 136  	function setStyleTitleTab() {
 137          $this->SetTextColor(255, 255, 255);
 138          $this->SetFillColor(96, 115, 165);
 139          $this->SetFont($this->phpmvFont, "B", 8);
 140      }
 141  
 142  	function setStyleLinePage() {
 143          $this->SetTextColor(0, 0, 139);
 144          $this->SetFillColor(255, 255, 255);
 145          $this->SetFont($this->phpmvFont, "", 8);
 146      }
 147  	function setStyleLinePageSmall() {
 148          $this->SetTextColor(0, 0, 139);
 149          $this->SetFillColor(255, 255, 255);
 150          $this->SetFont($this->phpmvFont, "", 6);
 151      }
 152  
 153  	function setStyleLineCategory() {
 154          $this->SetTextColor(0, 0, 139);
 155          $this->SetFillColor(255, 255, 255);
 156          $this->SetFont($this->phpmvFont, "B", 8);
 157      }
 158  	function setTitleChapter($keyChapter, $YJump = 40) {
 159          $this->SetTextColor(0, 0, 139);
 160          $this->SetFillColor(255, 255, 255);
 161          $this->SetFont($this->phpmvFont, "B", 9);
 162          if ($this->GetY() > (PDF_DEFAULT_MAX_Y - $YJump)) {
 163              $this->AddPage();
 164          }
 165          //        $this->Cell(80, PDF_DEFAULT_ROW_HEIGHT, $this->pmvTranslate($keyChapter), "0", "", "");

 166          if ($this->direction == "rtl") {
 167              $this->Cell(190, PDF_DEFAULT_ROW_HEIGHT, $this->pmvTranslate($keyChapter), "0", 0, "R");
 168          }
 169          else {
 170              $this->Cell(190, PDF_DEFAULT_ROW_HEIGHT, $this->pmvTranslate($keyChapter), "0", 0, "L");
 171  //            $this->Write(PDF_DEFAULT_ROW_HEIGHT, $this->pmvTranslate($keyChapter));

 172          }
 173          $this->Ln(PDF_CHAPTER_LN_SPACE);
 174      }
 175      
 176  	function setLineInfoText ($keyText, $nb = null, $YJump = 10) {
 177          $this->setStyleLinePage();
 178          if ($this->GetY() > (PDF_DEFAULT_MAX_Y - $YJump)) {
 179              $this->AddPage();
 180          }
 181  
 182          if (isset($nb)) {
 183              // Clean nb to pdf : <strong> 87 </strong> <small>(33%)</small>

 184              $src = array("<strong>", "</strong>", "<small>", "</small>");
 185              $dst = array("", "", "", "");
 186              $tmpNb = str_replace($src, $dst, $nb);
 187              
 188              $txtWrite = sprintf($this->pmvTranslate($keyText), $tmpNb);
 189              //$this->Write(PDF_DEFAULT_ROW_HEIGHT, sprintf($this->pmvTranslate($keyText), $tmpNb));

 190          }
 191          else {
 192              $txtWrite = $this->pmvTranslate($keyText);
 193              //$this->Write(PDF_DEFAULT_ROW_HEIGHT, $this->pmvTranslate($keyText));

 194          }
 195          if ($this->direction == "rtl") {
 196              //Cell($w, $h = 0, $txt = "", $border = 0, $ln = 0, $align = "", $fill = 0, $link = "")

 197              $this->Cell(190, PDF_DEFAULT_ROW_HEIGHT, $txtWrite, "0", 0, "R");
 198          }
 199          else {
 200              $this->Cell(190, PDF_DEFAULT_ROW_HEIGHT, $txtWrite, "0", 0, "L");
 201  //            $this->Write(PDF_DEFAULT_ROW_HEIGHT, $this->pmvTranslate($keyChapter));

 202          }
 203          
 204          //        $this->Cell(80, PDF_DEFAULT_ROW_HEIGHT, $this->pmvTranslate($keyChapter), "0", "", "");

 205          $this->Ln();
 206      }
 207  	function setStyleTitlePage() {
 208          $this->SetTextColor(0, 0, 139);
 209          $this->SetFillColor(255, 255, 255);
 210          $this->SetFont($this->phpmvFont, "B", 11);
 211      }
 212  	function setStyleSummaryLink() {
 213          $this->SetTextColor(0, 0, 139);
 214          $this->SetFillColor(255, 255, 255);
 215          $this->SetFont($this->phpmvFont, "U", 9);
 216      }
 217  	function setTitlePage($str) {
 218          $this->setStyleTitlePage();
 219          $w = $this->GetStringWidth($str) + 6;
 220          $this->SetX((210 - $w) / 2);
 221          $this->Cell($w, 10, $str, 0, 0, "C");
 222      }
 223  	function setStatisticStyle1() {
 224          $this->SetTextColor(0, 0, 139);
 225          $this->SetFillColor(255, 255, 255);
 226          $this->SetFont($this->phpmvFont, "B", 11);
 227      }
 228  	function setStatisticStyle2() {
 229          $this->SetTextColor(0, 0, 139);
 230          $this->SetFillColor(255, 255, 255);
 231          $this->SetFont($this->phpmvFont, "B", 11);
 232      }
 233  
 234      // Used to split page name

 235  	function truncate($str, $lg, $sep) {
 236          $ret = "";
 237          if (strlen($str) > $lg) {
 238              $ret = substr($str, 0, $lg).$sep;
 239          } else {
 240              $ret = $str;
 241          }
 242          return $ret;
 243      }
 244      // Show time HH:MM:SS

 245  	function show_time($ts) 
 246      {
 247          $h = floor($ts / 3600);
 248          $m = floor( ($ts  - $h*3600) / 60 );
 249          $s = floor( ($ts - $h*3600 - $m * 60) );
 250          return setToLength($h, 2) . ":" . setToLength($m,2) . ":" . setToLength($s,2);
 251      }
 252      
 253      // Show time HH:MM:SS

 254  	function show_time_visit($ts) {
 255          $h = floor( $ts / 3600 );
 256          $m = floor( ($ts  - $h*3600) / 60 );
 257          $s = floor( ($ts - $h*3600 - $m * 60) );
 258      
 259          if($h != 0)
 260          {
 261               $return[] = $h;
 262               $return[] = $m;
 263          }
 264          elseif($m != 0) 
 265          {
 266              $return[] = $m;
 267          }
 268          $return[] = $s;
 269          
 270          // h + min + sec

 271          if(sizeof($return)===3)
 272          {
 273              return vsprintf(setToLength($h, 2) . ":" . setToLength($m,2) . ":" . setToLength($s,2), $return);
 274          }
 275          if (sizeof($return) == 2) {
 276              $ret = vsprintf($this->pmvTranslate("generique_tempsvisite"), $return);
 277          }
 278          // only sec

 279          else {
 280              $ret = vsprintf($this->pmvTranslate("visites_sec"), $return);
 281          }
 282          return $ret;
 283      }
 284      
 285  	function setStylePercentPositif() {
 286          $this->SetTextColor(0, 128, 0);
 287          $this->SetFillColor(255, 255, 255);
 288          $this->SetFont($this->phpmvFont, "", 8);
 289      }
 290  	function setStylePercentNegatif() {
 291          $this->SetTextColor(255, 0, 0);
 292          $this->SetFillColor(255, 255, 255);
 293          $this->SetFont($this->phpmvFont, "", 8);
 294      }
 295  
 296  	function getStylePercent ($string) {
 297          if (substr($string, 0, 1) === "-") {
 298              $ret = "setStylePercentNegatif";
 299          } else {
 300              $ret = "setStylePercentPositif";
 301          }
 302          return $ret;
 303      }
 304  
 305      
 306      // Set red for negative and green for positive number

 307  	function show_percent($string) {
 308          if (substr($string, 0, 1) === "-") {
 309              $span = "negatif";
 310              $this->SetTextColor(255, 0, 0);
 311          } else {
 312              $span = "positif";
 313              $this->SetTextColor(0, 128, 0);
 314          }
 315          return $string;
 316      }
 317  
 318  	function pmvTranslate($str) {
 319          if (isset($GLOBALS["lang"][$str])) {
 320              $ret =  $GLOBALS["lang"][$str];
 321          }
 322          else {
 323              $ret = $str;
 324          }
 325          return $ret;
 326      }
 327      
 328  	function getRowHeightFromMax ($maxHeight, $width, $txt) {
 329          // Compute nb of line to write txt

 330          $strWidth = $this->GetStringWidth($txt) + 3;
 331          $nbLg = floor($strWidth / $width);
 332          if (($strWidth % $width) > 0) {
 333              $nbLg++;
 334          }
 335          if ($nbLg <= 0) {
 336              $nbLg = 1;
 337          }
 338          return $maxHeight / $nbLg;
 339      }
 340      
 341  	function GetTitleRowHeight($tabCell, $tabWidth) {
 342          $tabHeight = array ();
 343          // Get max

 344          $max = 0;
 345          //$this->setStyleLinePage();

 346          for ($i = 0; $i < count($tabCell); $i ++) {
 347              $strWidth = $this->GetStringWidth($tabCell[$i]->text) + 3;
 348              $tabHeight[$i] = floor($strWidth / $tabWidth[$i]);
 349              if (($strWidth % $tabWidth[$i]) > 0) {
 350                  $tabHeight[$i]++;
 351              }
 352              if ($tabHeight[$i] <= 0) {
 353                  $tabHeight[$i] = 1;
 354              }
 355              //$this->Cell($tabWidth[$i], PDF_DEFAULT_ROW_HEIGHT, $tabWidth[$i]. "  ". ($this->GetStringWidth($tabCell[$i]->text)) . "    " . $tabHeight[$i] . "    " . $tabCell[$i]->text);

 356              //$this->Ln();

 357              if ($tabHeight[$i] > $max) {
 358                  $max = $tabHeight[$i];
 359              }
 360          }
 361  
 362          // compute height

 363          for ($i = 0; $i < count($tabHeight); $i ++) {
 364              $tabHeight[$i] = ($max / $tabHeight[$i]) * PDF_DEFAULT_ROW_HEIGHT;
 365          }
 366  
 367          return $tabHeight;
 368      }
 369  
 370      // Compute start x for table with array of width of each columns

 371      //

 372      // @param $w : array of width of each columns

 373      //

 374      // @return value to use to SetX to center a table

 375  	function getXCenter($w) {
 376          $tot = 0;
 377          if (is_array($w)) {
 378              for ($i = 0; $i < count($w); $i ++) {
 379                  $tot += $w[$i];
 380              }
 381          } else {
 382              $tot = $w;
 383          }
 384          $tmp = (210 - $tot) / 2;
 385          if ($tmp < $this->lMargin) {
 386              $tmp = $this->lMargin;
 387          }
 388          return $tmp;
 389      }
 390  
 391      // Write a line of table in pdf

 392      //

 393      // @param $tabCell : Each cell of the line

 394      // @param $xCenter : value return by getXCenter for $tabWidth

 395      // @param $tabWidth : array of width of each columns

 396      // @param $tabHeight : array of height of each columns (only for table title)

 397  	function setTabLine($tabCell, $xCenter, $tabWidth, $tabHeight = null, $isSummPeriod = false) {
 398          if ($this->direction == "rtl") {
 399              $deb = count($tabWidth) - 1;
 400              $fin = -1;
 401              $inc = -1;
 402          } else {
 403              $deb = 0;
 404              $fin = count($tabWidth);
 405              $inc = 1;
 406          }
 407          // Test page position

 408          if (($this->GetY() + PDF_DEFAULT_ROW_HEIGHT) > PDF_DEFAULT_MAX_Y) {
 409              $this->AddPage();
 410          }
 411  
 412          //$this->Cell(10, PDF_DEFAULT_ROW_HEIGHT, "deb : $deb, fin : $fin, inc : $inc" );

 413          //$this->Ln();

 414  
 415          $oldStyle = "";
 416          $curY = $this->GetY();
 417          $curX = $xCenter;
 418  
 419          for ($i = $deb; $i != $fin; $i += $inc) {
 420              $align = $tabCell[$i]->align;
 421              if ($this->direction == "rtl") {
 422                  if ($align == "L") {
 423                      $align = "R";
 424                  } else {
 425                      if ($align == "R") {
 426                          $align = "L";
 427                      }
 428                  }
 429              }
 430  
 431              if ($oldStyle != $tabCell[$i]->styleFct) {
 432                  $oldStyle = $tabCell[$i]->styleFct;
 433                  // Execute style fct

 434                  //call_user_func(array ($this, $oldStyle));

 435                  $this-> $oldStyle ();
 436              }
 437  
 438              $this->SetXY($curX, $curY);
 439              if ($tabHeight == null) {
 440                  if (! $isSummPeriod) {
 441                      $this->Cell($tabWidth[$i], PDF_DEFAULT_ROW_HEIGHT, $tabCell[$i]->text, $tabCell[$i]->border, 0, $align, $tabCell[$i]->fill, $tabCell[$i]->url);
 442                  }
 443                  else {
 444                      $tabTxt = split ("xxx",  $tabCell[$i]->text);
 445                      
 446                      if (count($tabTxt) > 1) {
 447                          $this->Cell($tabWidth[$i], PDF_DEFAULT_ROW_HEIGHT, $tabTxt[0], "RLT", 0, $align, $tabCell[$i]->fill, $tabCell[$i]->url);
 448                          $this->SetXY($curX, $curY+PDF_DEFAULT_ROW_HEIGHT);
 449                          $this->setStyleLinePageSmall();
 450                          $oldStyle = "setStyleLinePageSmall";
 451                          $this->Cell($tabWidth[$i], PDF_DEFAULT_ROW_HEIGHT-2, $tabTxt[1], "RLB", 0, $align, $tabCell[$i]->fill, $tabCell[$i]->url);
 452                      }
 453                      else {
 454                          $rowHeight = $this->getRowHeightFromMax (2*PDF_DEFAULT_ROW_HEIGHT-2, $tabWidth[$i], $tabTxt[0]."  ");
 455                          $this->MultiCell($tabWidth[$i], $rowHeight, $tabTxt[0], "RLTB", $align, $tabCell[$i]->fill);
 456                      }
 457                  }
 458              } else {
 459                  $this->MultiCell($tabWidth[$i], $tabHeight[$i], $tabCell[$i]->text, $tabCell[$i]->border, $align, $tabCell[$i]->fill);
 460              }
 461              $curX = $curX + $tabWidth[$i];
 462          }
 463          if ($tabHeight == null) {
 464              $this->Ln();
 465          }
 466      }
 467  	function setPmvGraph($GraphType, $GraphData, $chapterTitle = null) {
 468          ob_start();
 469          $moduleGR = Module :: factory("view_graph");
 470          $moduleGR->init($this->currentModule->request, null, null, $GraphType, $GraphData);
 471          $moduleGR->showAll();
 472          $out1 = ob_get_contents();
 473          ob_end_clean();
 474  
 475          // Parse to get info

 476          $infoPNG = $this->_parsepngpmv("getDataGraph".$GraphType.$GraphData.".pngpmv", $out1);
 477          $v_w = $infoPNG["w"];
 478          $v_h = $infoPNG["h"];
 479  
 480          // Verify if there is enough place to set image

 481          $heightImg = (($v_h * 0.7) / PDF_COEF_MM_PX);
 482          if ($chapterTitle != null) {
 483              $heightImg += (PDF_DEFAULT_ROW_HEIGHT + PDF_CHAPTER_LN_SPACE);
 484          }
 485  
 486          if (($this->GetY() + $heightImg) > PDF_DEFAULT_MAX_Y) {
 487              $this->AddPage();
 488          }
 489  
 490          if ($chapterTitle != null) {
 491              $this->setTitleChapter($chapterTitle);
 492          }
 493  
 494          $xCentre = $this->getXCenter(($v_w * 0.7) / PDF_COEF_MM_PX);
 495  
 496          $this->Image("graph".$GraphType.$GraphData.".pngpmv", $xCentre, $this->GetY(), 0, ($v_h * 0.7) / PDF_COEF_MM_PX, "pngpmv", "", $out1);
 497          $this->SetY($this->GetY() + (($v_h * 0.7) / PDF_COEF_MM_PX) + PDF_DEFAULT_ROW_HEIGHT);
 498      }
 499  
 500  	function getDirById($id) {
 501          if ($id == "os") {
 502              $pathImg = DIR_IMG_OS;
 503          }
 504          elseif ($id == "browsers") {
 505              $pathImg = DIR_IMG_BROWSERS;
 506          }
 507          elseif ($id == "plugins") {
 508              //Waiting png conversion

 509              $pathImg = DIR_IMG_PLUGINS;
 510              //$pathImg = null;

 511          }
 512          elseif ($id == "screens") {
 513              //Waiting png conversion

 514              $pathImg = DIR_IMG_SCREENS;
 515              //$pathImg = null;

 516          }
 517          elseif ($id == "country") {
 518              $pathImg = DIR_IMG_COUNTRIES_FLAGS;
 519          }
 520          elseif ($id == "searchEngines") {
 521              $pathImg = DIR_IMG_SEARCH_ENGINES;
 522          } else {
 523              $pathImg = null;
 524          }
 525          return $pathImg;
 526      }
 527  
 528  	function setDisplayDataArray($id, $headline, $data, $textNoRow = "", $text1 = "", $nb1 = null, $text2 = "", $nb2 = null) {
 529          $ret = 1;
 530          if ($id != "continent") {
 531              $this->setTitleChapter($headline);
 532          } else {
 533              $this->Ln();
 534              $this->Ln();
 535          }
 536          if ($data != null) {
 537              if ($text1 != "") {
 538                  $this->setLineInfoText ($text1, $nb1);
 539              }
 540              if ($text2 != "") {
 541                  $this->setLineInfoText ($text2, $nb2);
 542              }
 543              $w = array (70, 30);
 544              //MultiCell(float w, float h, string txt [, mixed border [, string align [, int fill]]]) 

 545              $this->setStyleTitleTab();
 546              $zz = 0;
 547              $tabCellHeader[$zz ++] = new TabCell($this->pmvTranslate($headline), "1", 0, "C", "1", "setStyleTitleTab");
 548              $tabCellHeader[$zz ++] = new TabCell($this->pmvTranslate("generique_nombre"), "1", 0, "C", "1", "setStyleTitleTab");
 549  
 550              $xCenter = $this->getXCenter($w);
 551              $tabHeight = $this->GetTitleRowHeight($tabCellHeader, $w);
 552              $this->setTabLine($tabCellHeader, $xCenter, $w, $tabHeight);
 553              $widthTotal = 0;
 554              for ($i = 0; $i < count($w); $i ++) {
 555                  $widthTotal += $w[$i];
 556              }
 557  
 558              $this->setStyleLinePage();
 559  
 560              //            foreach ($data as $key => $info) {

 561              //                $this->Cell($w[0], PDF_DEFAULT_ROW_HEIGHT, "$key", "");

 562              //                $this->Ln();

 563              //                foreach ($info as $key2 => $info2) {

 564              //                    $this->Cell($w[0], PDF_DEFAULT_ROW_HEIGHT, "  $key2 : $info2", "");

 565              //                    $this->Ln();

 566              //                }

 567              //            }

 568  
 569              $pathImg = $this->getDirById($id);
 570              foreach ($data as $key => $info) {
 571                  // Test page position

 572                  if (($this->GetY() + PDF_DEFAULT_ROW_HEIGHT) > PDF_DEFAULT_MAX_Y) {
 573                      $this->AddPage();
 574                      $this->setStyleTitleTab();
 575                      $this->setTabLine($tabCellHeader, $xCenter, $w, $tabHeight);
 576                      $this->setStyleLinePage();
 577                  }
 578  
 579                  $this->SetX($xCenter);
 580  
 581                  $spaceAfter = "";
 582                  if ((isset ($info["img"])) && ($pathImg != null)) {
 583                      if (getFilenameExtension($info["img"]) != 'gif') {
 584                          if ($this->direction == "rtl") {
 585                              $this->Image($pathImg."/".$info["img"], $xCenter + $widthTotal - (11 / PDF_COEF_MM_PX) - 1, $this->GetY() + 1, 11 / PDF_COEF_MM_PX);
 586                          } else {
 587                              $this->Image($pathImg."/".$info["img"], $this->GetX() + 1, $this->GetY() + 1, 11 / PDF_COEF_MM_PX);
 588                          }
 589                      }
 590                      $spaceBefore = "          ";
 591                  } else {
 592                      if ($id = "provider") {
 593                          $spaceBefore = "  ";
 594                      } else {
 595                          $spaceBefore = "          ";
 596                      }
 597                  }
 598                  if ($this->direction == "rtl") {
 599                      $spaceAfter = $spaceBefore;
 600                      $spaceBefore = "";
 601                  }
 602                  if (isset($info["url"])) {
 603                      $infoUrl = $info["url"];
 604                  }
 605                  else {
 606                      $infoUrl = "";
 607                  }
 608  
 609                  $zz = 0;
 610                  $tabCell[$zz ++] = new TabCell($spaceBefore.$this->truncate($info["data"], 50, "...").$spaceAfter, "LTBR", 0, "L", 0, "setStyleLineCategory", $infoUrl);
 611                  $tabCell[$zz ++] = new TabCell($info["sum"]." (".sprintf("%.1f", $info["percent"])." %)", "LTBR", 0, "C", 0, "setStyleLinePage");
 612                  $this->setTabLine($tabCell, $xCenter, $w);
 613              }
 614              $this->Ln();
 615          } else {
 616              $ret = 0;
 617              $this->setLineInfoText ($textNoRow);
 618              $this->Ln();
 619          }
 620          return $ret;
 621      }
 622  	function setDisplayDataArrayInterest($id, $headline, $data) {
 623          
 624          $this->setLineInfoText ($headline, null, 30);
 625          /*

 626          $this->setStyleLinePage();

 627          $this->Cell(10, PDF_DEFAULT_ROW_HEIGHT, $this->pmvTranslate($headline), "0", "", "");

 628          $this->Ln();

 629          */
 630          $this->setStyleLineCategory();
 631          $i = 0;
 632          $w = array (60, 15, 25, 25, 25, 25);
 633          $pathImg = $this->getDirById($id);
 634          $widthTotal = 0;
 635          for ($i = 0; $i < count($w); $i ++) {
 636              $widthTotal += $w[$i];
 637          }
 638  
 639          $this->setStyleTitleTab();
 640          //$tabCell = new aray();

 641          //$tabCell[0] = new TabCell("", "", 0, "C", "1", "setStyleTitleTab");

 642          $zz = 0;
 643          $tabCellHeader[$zz ++] = new TabCell($this->pmvTranslate($headline), "1", 0, "C", "1", "setStyleTitleTab");
 644          $tabCellHeader[$zz ++] = new TabCell($this->pmvTranslate("generique_nombre"), "1", 0, "C", "1", "setStyleTitleTab");
 645          $tabCellHeader[$zz ++] = new TabCell($this->pmvTranslate("visites_pagesvisites"), "1", 0, "C", "1", "setStyleTitleTab");
 646          $tabCellHeader[$zz ++] = new TabCell($this->pmvTranslate("visites_pagesvisitessign"), "1", 0, "C", "1", "setStyleTitleTab");
 647          $tabCellHeader[$zz ++] = new TabCell($this->pmvTranslate("visites_tauxvisite"), "1", 0, "C", "1", "setStyleTitleTab");
 648          $tabCellHeader[$zz ++] = new TabCell($this->pmvTranslate("visites_tempsmoyen"), "1", 0, "C", "1", "setStyleTitleTab");
 649  
 650          $xCenter = $this->getXCenter($w);
 651          $tabHeight = $this->GetTitleRowHeight($tabCellHeader, $w);
 652          $i = 0;
 653          foreach ($data as $key => $info) {
 654              // Test page position

 655              if (($this->GetY() + 4*PDF_DEFAULT_ROW_HEIGHT) > PDF_DEFAULT_MAX_Y) {
 656                  $this->AddPage();
 657                  $this->setStyleTitleTab();
 658                  $this->setTabLine($tabCellHeader, $xCenter, $w, $tabHeight);
 659                  $this->setStyleLinePage();
 660              }
 661              elseif ($i == 0) {
 662                  // Table header

 663                  $this->setTabLine($tabCellHeader, $xCenter, $w, $tabHeight);
 664              }
 665              $this->setStyleLinePage();
 666              $this->SetX($xCenter);
 667  
 668              $spaceAfter = "";
 669              if ((isset ($info["img"])) && ($pathImg != null)) {
 670                  if (getFilenameExtension($info["img"]) != 'gif') {
 671                      if ($this->direction == "rtl") {
 672                          $this->Image($pathImg."/".$info["img"], $xCenter + $widthTotal - (11 / PDF_COEF_MM_PX) - 1, $this->GetY() + 1, 11 / PDF_COEF_MM_PX);
 673                      } else {
 674                          $this->Image($pathImg."/".$info["img"], $this->GetX() + 1, $this->GetY() + 1, 11 / PDF_COEF_MM_PX);
 675                      }
 676                  }
 677                  $spaceBefore = "          ";
 678              } else {
 679                  if ($id = "provider") {
 680                      $spaceBefore = "  ";
 681                  } else {
 682                      $spaceBefore = "          ";
 683                  }
 684              }
 685              if ($this->direction == "rtl") {
 686                  $spaceAfter = $spaceBefore;
 687                  $spaceBefore = "";
 688              }
 689              $zz = 0;
 690              $tabCell[$zz ++] = new TabCell($spaceBefore.$this->truncate($info["data"], 50, "...").$spaceAfter, "LTBR", 0, "L", 0, "setStyleLineCategory");
 691              $tabCell[$zz ++] = new TabCell($info["sum"], "LTBR", 0, "C", 0, "setStyleLinePage");
 692              $tabCell[$zz ++] = new TabCell(sprintf("%.1f", $info["page_per_visit"]), "LTBR", 0, "C", 0);
 693              $tabCell[$zz ++] = new TabCell(sprintf("%.1f", $info["page_per_visit_significant"]), "LTBR", 0, "C", 0);
 694              $tabCell[$zz ++] = new TabCell(sprintf("%.0f", $info["one_page_rate"])." %", "LTBR", 0, "C", 0);
 695              $tabCell[$zz ++] = new TabCell($info["time_per_visit"], "LTBR", 0, "C", 0);
 696              $this->setTabLine($tabCell, $xCenter, $w);
 697  
 698              $i ++;
 699          }
 700          $this->Ln();
 701      }
 702  
 703      //**********************************************************

 704      //

 705      //   TODO Provenance

 706      //

 707      //**********************************************************

 708  
 709      function setWorldMap() {
 710          $data = $this->currentModule->data->getSourceContinentCountries();
 711          $this->setTitleChapter("provenance_mappemonde");
 712  
 713          ob_start();
 714          $moduleGR = Module :: factory("view_world_map");
 715          $moduleGR->init($this->currentModule->request, null);
 716          $moduleGR->showAll();
 717          $out1 = ob_get_contents();
 718          ob_end_clean();
 719  
 720          $this->Image("ssgraphworldmap.pngpmv", 40, $this->GetY(), 0, 200 / PDF_COEF_MM_PX, "pngpmv", "", $out1);
 721          $this->SetY($this->GetY() + 73);
 722  
 723          $this->Image(DIR_IMG_MAPS."/scale.png", 60, $this->GetY(), 0, 7 / PDF_COEF_MM_PX);
 724          $this->SetY($this->GetY() + 10);
 725  
 726          $this->setDisplayDataArray("continent", "provenance_continent", $data);
 727  
 728      }
 729  
 730      function setSourceCountry($all = false) {
 731          $max = NB_ELEMENTS_TO_DISPLAY;
 732          if ($all == true) {
 733              $max = -1;
 734          }
 735          $data = $this->currentModule->data->getSourceCountries(0, $max);
 736          $dataInterest = $this->currentModule->data->getSourceCountriesInterest(0, $max);
 737          $countriesdistinct = $this->currentModule->data->getSourceCountriesDistinct();
 738          $this->setDisplayDataArray("country", "provenance_recappays", $data, "", "provenance_nbpays", $countriesdistinct);
 739  
 740          $this->setDisplayDataArrayInterest("country", "provenance_interetspays", $dataInterest);
 741  
 742          $this->setPmvGraph(3, "source_countries");
 743      }
 744  
 745      function setSourceProviders($all = false) {
 746          $max = NB_ELEMENTS_TO_DISPLAY;
 747          if ($all == true) {
 748              $max = -1;
 749          }
 750          $data = $this->currentModule->data->getSourceProviders(0, $max);
 751          $this->setDisplayDataArray("provider", "provenance_fai", $data);
 752      }
 753  
 754      //**********************************************************

 755      //

 756      //   TODO Settings

 757      //

 758      //**********************************************************

 759  
 760      function setSettingsConfig($all = false) {
 761          $max = NB_ELEMENTS_TO_DISPLAY;
 762          if ($all == true) {
 763              $max = -1;
 764          }
 765          $data = $this->currentModule->data->getSettingsConfig(0, $max);
 766          $this->setDisplayDataArray("configurations", "configurations_configurations", $data);
 767      }
 768  
 769      function setSettingsOs($all = false) {
 770          $max = NB_ELEMENTS_TO_DISPLAY;
 771          if ($all == true) {
 772              $max = -1;
 773          }
 774          $data = $this->currentModule->data->getSettingsOs(0, $max);
 775          $dataInterest = $this->currentModule->data->getSettingsOsInterest(0, $max);
 776          $this->setDisplayDataArray("os", "configurations_os", $data);
 777  
 778          $this->setDisplayDataArrayInterest("os", "configurations_os_interest", $dataInterest);
 779  
 780          $this->setPmvGraph(3, "settings_os");
 781      }
 782  
 783      function setSettingsBrowsersInterest($all = false) {
 784          $max = NB_ELEMENTS_TO_DISPLAY;
 785          if ($all == true) {
 786              $max = -1;
 787          }
 788          $data = $this->currentModule->data->getSettingsBrowsers(0, $max);
 789          $dataInterest = $this->currentModule->data->getSettingsBrowsersInterest(0, $max);
 790          $this->setDisplayDataArray("browsers", "configurations_navigateurs", $data);
 791  
 792          $this->setDisplayDataArrayInterest("browsers", "configurations_navigateurs_interest", $dataInterest);
 793  
 794          $this->setPmvGraph(3, "settings_browsers");
 795      }
 796  
 797      function setSettingsBrowsersType() {
 798          $data = $this->currentModule->data->getSettingsBrowsersType();
 799          $this->setDisplayDataArray("browsers", "configurations_navigateursbytype", $data);
 800  
 801          $this->setPmvGraph(3, "settings_browsers_type");
 802      }
 803  
 804      function setSettingsPlugins() {
 805          $data = $this->currentModule->data->getSettingsPlugins(); // NO ALL

 806          $this->setDisplayDataArray("plugins", "configurations_plugins", $data);
 807  
 808          $this->setPmvGraph(2, "settings_plugins");
 809      }
 810  
 811      function setSettingsResolutionsInterest($all = false) {
 812          $max = NB_ELEMENTS_TO_DISPLAY;
 813          if ($all == true) {
 814              $max = -1;
 815          }
 816          $data = $this->currentModule->data->getSettingsResolutions(0, $max);
 817          $dataInterest = $this->currentModule->data->getSettingsResolutionsInterest(0, $max);
 818          $this->setDisplayDataArray("screens", "configurations_resolutions", $data);
 819  
 820          $this->setDisplayDataArrayInterest("screens", "configurations_resolutions_interest", $dataInterest);
 821  
 822          $this->setPmvGraph(3, "settings_resolutions");
 823      }
 824  
 825      function setSettingsNormalWidescreen() {
 826          $data = $this->currentModule->data->getSettingsNormalWidescreen(); // NO ALL

 827          $this->setDisplayDataArray("screens", "configurations_rapport", $data);
 828      }
 829  
 830      //**********************************************************

 831      //

 832      //   TODO Referers

 833      //

 834      //**********************************************************

 835      function setReferersTypeInterest() {
 836          $dataInterest = $this->currentModule->data->getReferersTypeInterest();
 837  
 838          $this->setPmvGraph(4, "referers_summary", "affluents_recapimg");
 839  
 840          $this->setDisplayDataArrayInterest("referers", "affluents_interetstype", $dataInterest);
 841      }
 842      function setReferersSearchEnginesInterest($all = false) {
 843          $max = NB_ELEMENTS_TO_DISPLAY;
 844          if ($all == true) {
 845              $max = -1;
 846          }
 847          $data = $this->currentModule->data->getReferersSearchEngines(0, $max);
 848          $dataInterest = $this->currentModule->data->getReferersSearchEnginesInterest(0, $max);
 849          $numbers = $this->currentModule->data->getReferersNumbers();
 850          //$numbers.searchengines

 851          $ret = $this->setDisplayDataArray("searchEngines", "affluents_moteurs", $data,
 852           "affluents_aucunmoteur", "affluents_nbparmoteur", $numbers["searchengines"]);
 853          if ($ret > 0) {
 854              $this->setDisplayDataArrayInterest("searchEngines", "affluents_interetsmoteurs", $dataInterest);
 855          }
 856      }
 857  
 858      function setReferersKeywordsInterest($all = false) {
 859          $max = NB_ELEMENTS_TO_DISPLAY;
 860          if ($all == true) {
 861              $max = -1;
 862          }
 863          $data = $this->currentModule->data->getReferersKeywords(0, $max);
 864          $dataInterest = $this->currentModule->data->getReferersKeywordsInterest(0, $max);
 865          $numbers = $this->currentModule->data->getReferersNumbers();
 866          //$numbers.keywords

 867          $ret = $this->setDisplayDataArray("keywords", "affluents_motscles", $data,
 868           "affluents_aucunmoteur", "affluents_nbmotscles", $numbers["keywords"]);
 869  
 870          if ($ret > 0) {
 871              $this->setDisplayDataArrayInterest("keywords", "affluents_interetsmotscles", $dataInterest);
 872          }
 873      }
 874  
 875      function setReferersSitesInterest($all = false) {
 876          $max = NB_ELEMENTS_TO_DISPLAY;
 877          if ($all == true) {
 878              $max = -1;
 879          }
 880          $data = $this->currentModule->data->getReferersSites(0, $max);
 881          $dataInterest = $this->currentModule->data->getReferersSitesInterest(0, $max);
 882          $numbers = $this->currentModule->data->getReferersNumbers();
 883  //        {assign var=strsites value='affluents_nbautressites'|translate:$numbers.sites}

 884  //{assign var=strdistinctsites value='affluents_nbautressitesdiff'|translate:"<strong>`$numbers.distinctsites`</strong>"}

 885  
 886          $ret = $this->setDisplayDataArray("sitesinternet", "affluents_sitesinternet", $data,
 887           "affluents_aucunautresite",
 888           "affluents_nbautressites", $numbers["sites"],
 889           "affluents_nbautressitesdiff", $numbers["distinctsites"]);
 890  
 891          if ($ret > 0) {
 892              $this->setDisplayDataArrayInterest("sitesinternet", "affluents_interetssitesinternet", $dataInterest);
 893          }
 894      }
 895  
 896      function setReferersPartnersInterest($all = false) {
 897          $max = NB_ELEMENTS_TO_DISPLAY;
 898          if ($all == true) {
 899              $max = -1;
 900          }
 901          $data = $this->currentModule->data->getReferersPartners(0, $max);
 902          $dataInterest = $this->currentModule->data->getReferersPartnersInterest(0, $max);
 903          $numbers = $this->currentModule->data->getReferersNumbers();
 904          //$numbers.partners

 905          $ret = $this->setDisplayDataArray("sitesinternet", "affluents_partenaires", $data,
 906           "affluents_aucunpartenaire", "affluents_nbpartenaires", $numbers["partners"]);
 907  
 908          if ($ret > 0) {
 909              $this->setDisplayDataArrayInterest("sitesinternet", "affluents_interetspartenaires", $dataInterest);
 910          }
 911      }
 912  
 913      function setReferersNewslettersInterest($all = false) {
 914          $max = NB_ELEMENTS_TO_DISPLAY;
 915          if ($all == true) {
 916              $max = -1;
 917          }
 918          $data = $this->currentModule->data->getReferersNewsletters(0, $max);
 919          $dataInterest = $this->currentModule->data->getReferersNewslettersInterest(0, $max);
 920          $numbers = $this->currentModule->data->getReferersNumbers();
 921          //$numbers.newsletters

 922          $ret = $this->setDisplayDataArray("newsletters", "affluents_newsletters", $data,
 923           "affluents_aucunnewsletter", "affluents_nbnewsletters", $numbers["newsletters"]);
 924  
 925          if ($ret > 0) {
 926              $this->setDisplayDataArrayInterest("newsletters", "affluents_interetsnewsletters", $dataInterest);
 927          }
 928      }
 929      
 930      function setReferersDirect () {
 931          $numbers = $this->currentModule->data->getReferersNumbers();
 932          $this->setTitleChapter("affluents_entreedirecte");
 933          $this->setLineInfoText ("affluents_nbentreedirecte", $numbers["direct"]);
 934          $this->Ln();
 935      }
 936  
 937      //**********************************************************

 938      //

 939      //   TODO Visitor movement

 940      //

 941      //**********************************************************

 942  
 943      function setVisitsTimeVisitsGraph() {
 944          $this->setPmvGraph(2, "visits_time", "visites_graphtempsvisites");
 945          $this->Ln();
 946      }
 947  
 948      function setVisitsPeriodSummariesGraph() {
 949          $this->setPmvGraph(1, "visits_period_summaries", "visites_grapghrecap");
 950          $this->Ln();
 951      }
 952  
 953      function setVisitsAllPeriodSummaryGraph() {
 954          $this->setPmvGraph(1, "visits_all_period_summary", "visites_grapghrecaplongterm");
 955          $this->Ln();
 956      }
 957  
 958      function setVisitsServerTimeGraph() {
 959          $this->setPmvGraph(2, "visits_server_time", "visites_graphheureserveur");
 960          $this->Ln();
 961      }
 962  
 963      function setVisitsLocalTimeGraph() {
 964          $this->setPmvGraph(2, "visits_local_time", "visites_graphheurevisiteur");
 965          $this->Ln();
 966      }
 967  
 968      
 969      function setVisitsPeriodSummaries() {
 970          $zoom = $this->currentModule->data->getVisitsPeriodSummaries();
 971          if ($this->period == 1) {
 972              $w = array (20, 20);
 973          }
 974          elseif ($this->period == 2) {
 975              $w = array (20, 20);
 976          }
 977          elseif ($this->period == 3) {
 978              $w = array (20, 18.5);
 979          }
 980          else {
 981              $w = array (20, 20);
 982          }
 983  
 984          $mod = "notrss";
 985          $this->setTitleChapter("visites_recapperiode");
 986  
 987          // Table header

 988          $this->setStyleTitleTab();
 989          $zz = 0;
 990          $tabCellHeader[$zz ++] = new TabCell(" ");
 991          foreach ($zoom as $key => $info) {
 992              $w[$zz] = $w[1];
 993              $tabCellHeader[$zz ++] = new TabCell($info["date"], "LTBR", "", "C", 1, "setStyleTitleTab");
 994          }
 995  
 996          $xCenter = $this->getXCenter($w);
 997          $tabHeight = $this->GetTitleRowHeight($tabCellHeader, $w);
 998          $this->setTabLine($tabCellHeader, $xCenter, $w, $tabHeight);
 999  
1000          $this->setStyleLineCategory();
1001          $zz = 0;
1002          //TabCell($p_text = "", $p_border = "", $p_ln = 0, $p_align = "C", $p_fill = "", $p_styleFct = PDF_DEFAULT_STYLE, $p_url = "")

1003          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_nbvisites"), "LTBR", "", "C", 1, "setStyleLineCategory");
1004          $this->setStyleLinePage();
1005          foreach ($zoom as $key => $info) {
1006              if ($info["visits"] == 0) {
1007                  $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_aucunevivisite"), "LTBR", "", "C", 1, "setStyleLinePage");
1008              } else {
1009                  $tabCell[$zz ++] = new TabCell($info["visits_percent"]."xxx(".$info["visits"].")",
1010                   "LTBR", "", "C", 1, $this->getStylePercent($info["visits_percent"]));
1011              }
1012  
1013          }
1014          $this->setTabLine($tabCell, $xCenter, $w, null, true);
1015  
1016          $this->setStyleLineCategory();
1017          $zz = 0;
1018          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_pagesvues"), "LTBR", "", "C", 1, "setStyleLineCategory");
1019          $this->setStyleLinePage();
1020          foreach ($zoom as $key => $info) {
1021              if ($info["visits"] == 0) {
1022                  $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_aucunevivisite"), "LTBR", "", "C", 1, "setStyleLinePage");
1023              } else {
1024                  $tabCell[$zz ++] = new TabCell($info["pages_percent"]."xxx(".$info["pages"].")",
1025                   "LTBR", "", "C", 1, $this->getStylePercent($info["pages_percent"]));
1026              }
1027  
1028          }
1029          $this->setTabLine($tabCell, $xCenter, $w, null, true);
1030          $this->Ln();
1031      }
1032  
1033      function setVisitsStatistics() {
1034          $zoom = $this->currentModule->data->getVisitsStatistics();
1035          $w = array (45, 15);
1036          $mod = "notrss";
1037          $this->setTitleChapter("visites_statistiques");
1038  
1039          $xCenter = $this->getXCenter($w);
1040  
1041          // Table header

1042          $this->SetX($xCenter);
1043          $this->setStyleTitleTab();
1044          $this->Cell($w[0] + $w[1], PDF_DEFAULT_ROW_HEIGHT, $this->pmvTranslate("visites_periodesel"), "LTBR", "", "C", 1);
1045          $this->Ln();
1046  
1047          $zz = 0;
1048          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_visites"), "LTBR", "", "C", 1, "setStyleLinePage");
1049          $tabCell[$zz ++] = new TabCell($zoom["nb_vis"], "LTBR", "", "C", 1, "setStyleLineCategory");
1050          $this->setTabLine($tabCell, $xCenter, $w);
1051          
1052          $zz = 0;
1053          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_uniques"), "LTBR", "", "C", 1, "setStyleLinePage");
1054          $tabCell[$zz ++] = new TabCell($zoom["nb_uniq_vis"], "LTBR", "", "C", 1, "setStyleLineCategory");
1055          $this->setTabLine($tabCell, $xCenter, $w);
1056          $zz = 0;
1057          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_pagesvues"), "LTBR", "", "C", 1, "setStyleLinePage");
1058          $tabCell[$zz ++] = new TabCell($zoom["nb_pag"], "LTBR", "", "C", 1, "setStyleLineCategory");
1059          $this->setTabLine($tabCell, $xCenter, $w);
1060          $zz = 0;
1061          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_pagesvisiteurs"), "LTBR", "", "C", 1, "setStyleLinePage");
1062          $tabCell[$zz ++] = new TabCell(sprintf("%.1f", $zoom["nb_pag_per_vis"]), "LTBR", "", "C", 1, "setStyleLineCategory");
1063          $this->setTabLine($tabCell, $xCenter, $w);
1064          $zz = 0;
1065          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_pagesvisitessign"), "LTBR", "", "C", 1, "setStyleLinePage");
1066          $tabCell[$zz ++] = new TabCell(sprintf("%.1f", $zoom["nb_pag_per_vis_sig"]), "LTBR", "", "C", 1, "setStyleLineCategory");
1067          $this->setTabLine($tabCell, $xCenter, $w);
1068          $zz = 0;
1069          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_tempsmoyen"), "LTBR", "", "C", 1, "setStyleLinePage");
1070          $tabCell[$zz ++] = new TabCell($this->show_time_visit($zoom["time_per_vis"]), "LTBR", "", "C", 1, "setStyleLineCategory");
1071          $this->setTabLine($tabCell, $xCenter, $w);
1072          $zz = 0;
1073          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_tempsmoyenpv"), "LTBR", "", "C", 1, "setStyleLinePage");
1074          $tabCell[$zz ++] = new TabCell($this->show_time_visit($zoom["time_per_pag"]), "LTBR", "", "C", 1, "setStyleLineCategory");
1075          $this->setTabLine($tabCell, $xCenter, $w);
1076          $zz = 0;
1077          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_tauxvisite"), "LTBR", "", "C", 1, "setStyleLinePage");
1078          $tabCell[$zz ++] = new TabCell(sprintf("%.0f", $zoom["one_page_rate"])."%", "LTBR", "", "C", 1, "setStyleLineCategory");
1079          $this->setTabLine($tabCell, $xCenter, $w);
1080          if (isset ($zoom["average_visits_per_day"])) {
1081              $zz = 0;
1082              $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_average_visits_per_day"), "LTBR", "", "C", 1, "setStyleLinePage");
1083              $tabCell[$zz ++] = new TabCell(sprintf("%d", $zoom["average_visits_per_day"]), "LTBR", "", "C", 1, "setStyleLineCategory");
1084              $this->setTabLine($tabCell, $xCenter, $w);
1085          }
1086      
1087          $this->Ln();
1088      }
1089  
1090      function setFrequencyGraphNbVisitsPerVisitor() {
1091          $this->setPmvGraph(2, "visits_by_visitor", "pagesvues_vispervisgraph");
1092          $this->Ln();
1093      }
1094  
1095      function setFrequencyGraphNewReturnVisits() {
1096          $this->setPmvGraph(5, "frequency_new_vs_returning", "frequence_nouveauxconnusgraph");
1097          $this->Ln();
1098      }
1099  
1100      //**********************************************************

1101      //

1102      //   TODO Frequency

1103      //

1104      //**********************************************************

1105      
1106  
1107      function setFrequencyNewReturnVisits() {
1108          $zoom = $this->currentModule->data->getVisitsFrequencyStatistics();
1109          $w = array (40, 30, 30);
1110          $this->setTitleChapter("frequence_nouveauxconnus");
1111  
1112          $xCenter = $this->getXCenter($w);
1113  
1114          // Table header

1115          $zz = 0;
1116          $tabCell[$zz ++] = new TabCell(" ", "LTBR", "", "C", 1, "setStyleTitleTab");
1117          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("frequence_visitesconnues"), "LTBR", "", "C", 1, "setStyleTitleTab");
1118          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("frequence_nouvellesvisites"), "LTBR", "", "C", 1, "setStyleTitleTab");
1119          $this->setTabLine($tabCell, $xCenter, $w);
1120  
1121          $zz = 0;
1122          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_visites"), "LTBR", "", "", 1, "setStyleLinePage");
1123          $tabCell[$zz ++] = new TabCell($zoom["nb_vis_returning"]." (".sprintf("%.0f", $zoom["nb_vis_returning_percent"])."%)", "LTBR", "", "C", 1, "setStyleLineCategory");
1124          $tabCell[$zz ++] = new TabCell($zoom["nb_vis_new"]." (".sprintf("%.0f", $zoom["nb_vis_new_percent"])."%)", "LTBR", "", "C", 1, "setStyleLineCategory");
1125          $this->setTabLine($tabCell, $xCenter, $w);
1126          $zz = 0;
1127          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_pagesvues"), "LTBR", "", "", 1, "setStyleLinePage");
1128          $tabCell[$zz ++] = new TabCell($zoom["nb_pag_returning"]." (".sprintf("%.0f", $zoom["nb_pag_returning_percent"])."%)", "LTBR", "", "C", 1, "setStyleLineCategory");
1129          $tabCell[$zz ++] = new TabCell($zoom["nb_pag_new"]." (".sprintf("%.0f", $zoom["nb_pag_new_percent"])."%)", "LTBR", "", "C", 1, "setStyleLineCategory");
1130          $this->setTabLine($tabCell, $xCenter, $w);
1131          $zz = 0;
1132          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_pagesvisiteurs"), "LTBR", "", "", 1, "setStyleLinePage");
1133          $tabCell[$zz ++] = new TabCell(sprintf("%.1f", $zoom["nb_pag_per_vis_returning"]), "LTBR", "", "C", 1, "setStyleLineCategory");
1134          $tabCell[$zz ++] = new TabCell(sprintf("%.1f", $zoom["nb_pag_per_vis_new"]), "LTBR", "", "C", 1, "setStyleLineCategory");
1135          $this->setTabLine($tabCell, $xCenter, $w);
1136          $zz = 0;
1137          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_tempsmoyen"), "LTBR", "", "", 1, "setStyleLinePage");
1138          $tabCell[$zz ++] = new TabCell($this->show_time_visit($zoom["time_per_vis_returning"]), "LTBR", "", "C", 1, "setStyleLineCategory");
1139          $tabCell[$zz ++] = new TabCell($this->show_time_visit($zoom["time_per_vis_new"]), "LTBR", "", "C", 1, "setStyleLineCategory");
1140          $this->setTabLine($tabCell, $xCenter, $w);
1141          $zz = 0;
1142          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_tempsmoyenpv"), "LTBR", "", "", 1, "setStyleLinePage");
1143          $tabCell[$zz ++] = new TabCell($this->show_time_visit($zoom["time_per_pag_returning"]), "LTBR", "", "C", 1, "setStyleLineCategory");
1144          $tabCell[$zz ++] = new TabCell($this->show_time_visit($zoom["time_per_pag_new"]), "LTBR", "", "C", 1, "setStyleLineCategory");
1145          $this->setTabLine($tabCell, $xCenter, $w);
1146          $zz = 0;
1147          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_tauxvisite"), "LTBR", "", "", 1, "setStyleLinePage");
1148          $tabCell[$zz ++] = new TabCell(sprintf("%.0f", $zoom["one_page_rate_returning"])."%", "LTBR", "", "C", 1, "setStyleLineCategory");
1149          $tabCell[$zz ++] = new TabCell(sprintf("%.0f", $zoom["one_page_rate_new"])."%", "LTBR", "", "C", 1, "setStyleLineCategory");
1150          $this->setTabLine($tabCell, $xCenter, $w);
1151          $this->Ln();
1152      }
1153  
1154      function setFrequencyStatistics() {
1155          $zoom = $this->currentModule->data->getVisitsFrequencyStatistics();
1156          $w = array (45, 15);
1157          $this->setTitleChapter("visites_statistiques");
1158  
1159          $xCenter = $this->getXCenter($w);
1160  
1161          // Table header

1162          $this->SetX($xCenter);
1163          $this->setStyleTitleTab();
1164          $this->Cell($w[0] + $w[1], PDF_DEFAULT_ROW_HEIGHT, $this->pmvTranslate("visites_periodesel"), "LTBR", "", "C", 1, "setStyleTitleTab");
1165          $this->Ln();
1166  
1167          $zz = 0;
1168          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("frequence_nouveauxvisiteurs"), "LTBR", "", "", 1, "setStyleLinePage");
1169          $tabCell[$zz ++] = new TabCell($zoom["nb_uniq_vis_new"], "LTBR", "", "C", 1, "setStyleLinePage");
1170          $this->setTabLine($tabCell, $xCenter, $w);
1171          $zz = 0;
1172          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("frequence_visiteursconnus"), "LTBR", "", "", 1, "setStyleLinePage");
1173          $tabCell[$zz ++] = new TabCell($zoom["nb_uniq_vis_returning"], "LTBR", "", "C", 1, "setStyleLinePage");
1174          $this->setTabLine($tabCell, $xCenter, $w);
1175          $zz = 0;
1176          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("frequence_returningrate"), "LTBR", "", "", 1, "setStyleLinePage");
1177          $tabCell[$zz ++] = new TabCell(sprintf("%.0f", $zoom["returning_rate"])."%", "LTBR", "", "C", 1, "setStyleLinePage");
1178          $this->setTabLine($tabCell, $xCenter, $w);
1179          $zz = 0;
1180          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("frequence_vispervis"), "LTBR", "", "", 1, "setStyleLinePage");
1181          $tabCell[$zz ++] = new TabCell(sprintf("%.1f", $zoom["nb_vis_per_uniq_vis"])." ".$this->pmvTranslate("frequence_vis"), "LTBR", "", "C", 1, "setStyleLinePage");
1182          $this->setTabLine($tabCell, $xCenter, $w);
1183          $this->Ln();
1184  
1185      }
1186  
1187      //**********************************************************

1188      //

1189      //   TODO FollowUp

1190      //

1191      //**********************************************************

1192  
1193      function setFollowUpSinglePages($all = true) {
1194          $zoom = $this->currentModule->data->getFollowUpZoom("");
1195          $w = array (140, 30);
1196          $this->setTitleChapter("suivi_singlepage");
1197  
1198          $xCenter = $this->getXCenter($w);
1199  
1200          // Table header

1201          $this->setStyleTitleTab();
1202          $zz = 0;
1203          $tabCell[$zz ++] = new TabCell(" ", "");
1204          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("generique_hits"), "LTBR", "", "C", 1, "setStyleTitleTab");
1205          $this->setTabLine($tabCell, $xCenter, $w);
1206  
1207          if ($all == true) {
1208              $this->setPagesZoomDetail("singlepage", $zoom, $w, "getFollowUpZoom");
1209          }
1210          else {
1211              $this->setPagesZoomDetail("singlepage", $zoom, $w, "");
1212          }
1213          $this->Ln();
1214      }
1215  
1216      /**

1217       * Set follow up exit page table

1218       * 

1219       * @param $period

1220       * @param $idtouse

1221       * @param $zoom

1222       * @param $w

1223       * @param $allPage

1224       */
1225  	function setFollowUpExitPages($all = true) {
1226          $zoom = $this->currentModule->data->getFollowUpZoom("");
1227          $w = array (110, 30, 30);
1228          $this->setTitleChapter("suivi_pagesortie");
1229  
1230          $xCenter = $this->getXCenter($w);
1231  
1232          // Table header

1233          $this->setStyleTitleTab();
1234          $zz = 0;
1235          $tabCell[$zz ++] = new TabCell(" ", "");
1236          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("suivi_pagesortiehits"), "LTBR", "", "C", 1, "setStyleTitleTab");
1237          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("suivi_tauxsortie"), "LTBR", "", "C", 1, "setStyleTitleTab");
1238          $this->setTabLine($tabCell, $xCenter, $w);
1239  
1240          if ($all) {
1241              $this->setPagesZoomDetail("exit", $zoom, $w, "getFollowUpZoom");
1242          }
1243          else {
1244              $this->setPagesZoomDetail("exit", $zoom, $w, "");
1245          }
1246  
1247          $this->Ln();
1248      }
1249  
1250      // Follow up entry pages

1251  	function setFollowUpEntryPages($all = true) {
1252          $zoom = $this->currentModule->data->getFollowUpZoom("");
1253          $w = array (140, 30);
1254          $this->setTitleChapter("suivi_pageentree");
1255  
1256          $xCenter = $this->getXCenter($w);
1257          // Table header

1258          $this->setStyleTitleTab();
1259          $zz = 0;
1260          $tabCell[$zz ++] = new TabCell(" ", "");
1261          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("suivi_pageentreehits"), "LTBR", "", "C", 1, "setStyleTitleTab");
1262          $this->setTabLine($tabCell, $xCenter, $w);
1263  
1264          if ($all) {
1265              $this->setPagesZoomDetail("entry", $zoom, $w, "getFollowUpZoom");
1266          }
1267          else {
1268              $this->setPagesZoomDetail("entry", $zoom, $w, "");
1269          }
1270          $this->Ln();
1271      }
1272  
1273      //**********************************************************

1274      //

1275      //   TODO Pages View

1276      //

1277      //**********************************************************

1278  
1279      function setPagesZoomTpsParPage($all = true) {
1280          $zoom = $this->currentModule->data->getPagesZoom("");
1281          $w = array (110, 30, 30);
1282          $this->setTitleChapter("pagesvues_tempsparpage");
1283  
1284          $xCenter = $this->getXCenter($w);
1285  
1286          // Header table

1287          $this->setStyleTitleTab();
1288          $zz = 0;
1289          $tabCell[$zz ++] = new TabCell(" ", "");
1290          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("pagesvues_total_time"), "LTBR", "", "C", 1, "setStyleTitleTab");
1291          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("pagesvues_avg_time"), "LTBR", "", "C", 1, "setStyleTitleTab");
1292          $this->setTabLine($tabCell, $xCenter, $w);
1293          if ($all) {
1294              $this->setPagesZoomDetail("sumtime", $zoom, $w, "getPagesZoom");
1295          }
1296          else {
1297              $this->setPagesZoomDetail("sumtime", $zoom, $w, "");
1298          }
1299          $this->Ln();
1300      }
1301  
1302      function setPagesZoomTab2($all = true) {
1303          $zoom = $this->currentModule->data->getPagesZoom("");
1304          $w = array (80, 30, 30, 30);
1305          $this->setTitleChapter("pagesvues_pagesvues");
1306  
1307          if ($all) {
1308              $this->setPagesZoomDetail("sum", $zoom, $w, "getPagesZoom");
1309          }
1310          else {
1311              $this->setPagesZoomDetail("sum", $zoom, $w, "");
1312          }
1313          $this->Ln();
1314      }
1315  
1316      function setPagesZoomDetail($idtouse, $zoom, $w, $allPage = "", $indent = 0) {
1317          $strIndent = "";
1318          for ($i = 0; $i < $indent; $i ++) {
1319              $strIndent .= "    ";
1320          }
1321  
1322          $xCenter = $this->getXCenter($w);
1323  
1324          foreach ($zoom[$idtouse][1] as $key => $info) {
1325              $zz = 0;
1326              // Test page position

1327              if (($this->GetY() + PDF_DEFAULT_ROW_HEIGHT) > PDF_DEFAULT_MAX_Y) {
1328                  $this->AddPage();
1329              }
1330              if (!($info["type"] == "file" && $idtouse != "sum")) {
1331                  if ($info["type"] == "category") {
1332                      $styleTxt = "setStyleLineCategory";
1333                      //class="cate" 

1334                      //onclick="loadPagesDetails("{$url_pages_details}&amp;mod=view_pages_details&amp;idtouse={$idtouse}&amp;c_id_zoom={$info.id}", this);"

1335                  }
1336                  else {
1337                      $styleTxt = "setStyleLinePage";
1338                  }
1339                  
1340                  if (sizeof($info["vars"]) != 0 && $idtouse == "sum") {
1341                      //Montrer les variables

1342                      //onclick="displayVariables( findNextWithType( this.firstChild, "TD"));"

1343  
1344                  }
1345  
1346                  if ($info["type"] == "category") {
1347                      //<img src="./themes/default/images/groupa.gif">

1348                      //$this->Image("./themes/default/images/groupa.gif");

1349                  }
1350  
1351                  $infoData = str_replace("&amp;", "&", $info["data"]);
1352                  if ($info["type"] == "category") {
1353                      if ($this->direction == "rtl") {
1354                          $infoData = $infoData." +";
1355                      }
1356                      else  {
1357                          $infoData = "+ " . $infoData;
1358                      }
1359                  }
1360                  
1361                  //{$info.data|truncate:65:"..."}

1362                  $tabCell[$zz ++] = new TabCell($this->truncate($strIndent.$infoData, 50, "..."), "LTBR", "", "L", 0, $styleTxt);
1363  
1364                  if ($info["type"] == "file") {
1365                      //<img src="./themes/default/images/download.png">

1366                  }
1367  
1368                  //     {if sizeof($info.vars) != 0 && $idtouse == "sum"}

1369                  //         

1370                  //         <span style="cursor: pointer;color:red;font-size: x-small; vertical-align: 50%;" onmouseover="pointer(this)" 

1371                  //             {if $info.type == "category"}onclick="displayVariables( this.parentNode );"{/if}>

1372                  //         +

1373                  //         </span>

1374                  //         

1375                  //         <div style="display: none;">

1376                  //                 <table cellspacing=0 align="right" id="variables">

1377                  //                 <th colspan="2">

1378                  //                 {"generique_variables"|pmvTranslate}

1379                  //                 </th>

1380                  //                 {foreach from=$info.vars key=var_name item=a_var}

1381                  //                     <tr><td colspan="2" class="header">{$var_name}</td></tr>

1382                  //                     {foreach from=$a_var key=var_value item=var_count}

1383                  //                     <tr><td class="data">{$var_value}</td><td class="nb"> {$var_count}</td></tr>

1384                  //                     {/foreach}

1385                  //                 {/foreach}

1386                  //                 </table>

1387                  //         </div>

1388                  //     {/if}

1389  
1390                  //<td width="15%" class="acenter {if $idtouse == "sum" || $idtouse == "exit" || $idtouse == "sumtime"}wrb{/if} {if $cwtb==1}wtb{/if}" id="c{$idtouse}{$info.id}">

1391                  if ($idtouse == "sumtime") {
1392                      //{$info.$idtouse|time}

1393                      $tabCell[$zz ++] = new TabCell($this->show_time($info[$idtouse]), "LTBR", "", "C", 0, $styleTxt);
1394                  } else {
1395                      //{$info.$idtouse}

1396                      $tabCell[$zz ++] = new TabCell($info[$idtouse], "LTBR", "", "C", 0, $styleTxt);
1397                  }
1398  
1399                  if ($idtouse == "sum") {
1400                      //<td width="15%" class="acenter {if $cwtb==1}wtb{/if} wrb" >{$info.percentn1|print_percent} <small>({$info.sumn1})</small></td>

1401                      $tabCell[$zz ++] = new TabCell($this->show_percent($info["percentn1"])." (".$info["sumn1"].")", "LTBR", "", "C", 0, $styleTxt);
1402                      //<td width="15%" class="acenter {if $cwtb==1}wtb{/if}">{$info.percentn2|print_percent} <small>({$info.sumn2})</small></td>

1403                      $tabCell[$zz ++] = new TabCell($this->show_percent($info["percentn2"])." (".$info["sumn2"].")", "LTBR", "", "C", 0, $styleTxt);
1404                  }
1405                  if ($idtouse == "exit") {
1406                      //<td width="15%" class="acenter {if $cwtb==1}wtb{/if}">{$info.exitrate|string_format:"%.2f"} %</td>

1407                      $tabCell[$zz ++] = new TabCell(sprintf("%.2f", $info["exitrate"])." %", "LTBR", "", "C", 0, $styleTxt);
1408                  }
1409                  if ($idtouse == "sumtime") {
1410                      //<td width="15%" class="acenter {if $cwtb==1}wtb{/if}">{$info.avgtime|time}</td>

1411                      $tabCell[$zz ++] = new TabCell($this->show_time($info["avgtime"]), "LTBR", "", "C", 0, $styleTxt);
1412                  }
1413  
1414                  $this->setTabLine($tabCell, $xCenter, $w);
1415  
1416                  if (($info["type"] == "category") && ($allPage != "")) {
1417                      $zoomFils = call_user_func(array ($this->currentModule->data, $allPage), $info["id"]);
1418                      //$zoomFils = $this->currentModule->data->getPagesZoom($info["id"]);

1419                      $this->setPagesZoomDetail($idtouse, $zoomFils, $w, $allPage, $indent +1);
1420                  }
1421  
1422              }
1423          } // end for

1424      }
1425  
1426      //setPagesVuesTab1

1427      function setPagesZoomTab1() {
1428          $zoom = $this->currentModule->data->getPagesZoom("");
1429          $w = array (80, 30, 30, 30);
1430          $idtouse = "sum";
1431          $period = $this->period;
1432  
1433          $xCenter = $this->getXCenter($w);
1434  
1435          $this->setStyleTitleTab();
1436  
1437          if ($period == 1) {
1438              $borderLine1 = "LTR";
1439              $borderLine2 = "LRB";
1440              //  Header table

1441              $zz = 0;
1442              $tabCell[$zz ++] = new TabCell(" ", "");
1443              $tabCell[$zz ++] = new TabCell($this->pmvTranslate("pagesvues_joursel"), $borderLine1, "", "C", 1, "setStyleTitleTab");
1444              $tabCell[$zz ++] = new TabCell($this->pmvTranslate("pagesvues_jmoins7"), $borderLine1, "", "C", 1, "setStyleTitleTab");
1445              $tabCell[$zz ++] = new TabCell($this->pmvTranslate("pagesvues_jmoins14"), $borderLine1, "", "C", 1, "setStyleTitleTab");
1446              $this->setTabLine($tabCell, $xCenter, $w);
1447              $this->SetFont($this->phpmvFont, "", 7);
1448              $txtBefore = "(";
1449              $txtAfter = ")";
1450          } else {
1451              $borderLine1 = "LTRB";
1452              $borderLine2 = "LTRB";
1453              $txtBefore = "";
1454              $txtAfter = "";
1455          }
1456  
1457          $zz = 0;
1458          $tabCell[$zz ++] = new TabCell(" ", "");
1459          $tabCell[$zz ++] = new TabCell($txtBefore.$zoom[$idtouse][0][0].$txtAfter, $borderLine2, "", "C", 1, "setStyleTitleTab");
1460          $tabCell[$zz ++] = new TabCell($txtBefore.$zoom[$idtouse][0][1].$txtAfter, $borderLine2, "", "C", 1, "setStyleTitleTab");
1461          $tabCell[$zz ++] = new TabCell($txtBefore.$zoom[$idtouse][0][2].$txtAfter, $borderLine2, "", "C", 1, "setStyleTitleTab");
1462          $this->setTabLine($tabCell, $xCenter, $w);
1463  
1464          // Lines

1465          $this->setStyleLinePage();
1466  
1467          $zz = 0;
1468          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("pagesvues_pagesvues"), "LTRB", "", "C");
1469          $tabCell[$zz ++] = new TabCell($zoom[$idtouse][2][0]["nb_pag"], "LTRB", "", "C");
1470          $tabCell[$zz ++] = new TabCell($zoom[$idtouse][2][1]["nb_pag"], "LTRB", "", "C");
1471          $tabCell[$zz ++] = new TabCell($zoom[$idtouse][2][2]["nb_pag"], "LTRB", "", "C");
1472          $this->setTabLine($tabCell, $xCenter, $w);
1473  
1474          $zz = 0;
1475          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("pagesvues_pagesvudiff"), "LTRB", "", "C");
1476          $tabCell[$zz ++] = new TabCell($zoom[$idtouse][2][0]["nb_uniq_pag"], "LTRB", "", "C");
1477          $tabCell[$zz ++] = new TabCell($zoom[$idtouse][2][1]["nb_uniq_pag"], "LTRB", "", "C");
1478          $tabCell[$zz ++] = new TabCell($zoom[$idtouse][2][2]["nb_uniq_pag"], "LTRB", "", "C");
1479          $this->setTabLine($tabCell, $xCenter, $w);
1480  
1481          $zz = 0;
1482          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("pagesvues_recordpages"), "LTRB", "", "C");
1483          $tabCell[$zz ++] = new TabCell($zoom[$idtouse][2][0]["nb_max_pag"], "LTRB", "", "C");
1484          $tabCell[$zz ++] = new TabCell($zoom[$idtouse][2][1]["nb_max_pag"], "LTRB", "", "C");
1485          $tabCell[$zz ++] = new TabCell($zoom[$idtouse][2][2]["nb_max_pag"], "LTRB", "", "C");
1486          $this->setTabLine($tabCell, $xCenter, $w);
1487          $this->Ln();
1488  
1489      }
1490      // Show graph pages_by_visit

1491      function setPagesByVisitGraph() {
1492          $this->setPmvGraph(2, "pages_by_visit", "pagesvues_graphsnbpages");
1493          $this->Ln();
1494      }
1495      
1496      //**********************************************************

1497      //

1498      //   TODO Site summary

1499      //

1500      //**********************************************************

1501  
1502  
1503      function setSitesSummaryStatistics() {
1504          $data = $this->currentModule->data->getSitesSummaryStatistics();
1505          $w = array (50, 20, 20, 20, 25, 25);
1506  
1507          $this->Ln();
1508          // Table header

1509          $this->setStyleTitleTab();
1510  
1511          //$tabCell = new aray();

1512          //$tabCell[0] = new TabCell("", "", 0, "C", "1", "setStyleTitleTab");

1513          $zz = 0;
1514          $tabCellHead[$zz ++] = new TabCell($this->pmvTranslate("generique_site"), "1", 0, "C", "1", "setStyleTitleTab");
1515          $tabCellHead[$zz ++] = new TabCell($this->pmvTranslate("visites_visites"), "1", 0, "C", "1", "setStyleTitleTab");
1516          $tabCellHead[$zz ++] = new TabCell($this->pmvTranslate("visites_pagesvues"), "1", 0, "C", "1", "setStyleTitleTab");
1517          $tabCellHead[$zz ++] = new TabCell($this->pmvTranslate("visites_pagesvisiteurs"), "1", 0, "C", "1", "setStyleTitleTab");
1518          $tabCellHead[$zz ++] = new TabCell($this->pmvTranslate("visites_tempsmoyen"), "1", 0, "C", "1", "setStyleTitleTab");
1519          $tabCellHead[$zz ++] = new TabCell($this->pmvTranslate("visites_tauxvisite"), "1", 0, "C", "1", "setStyleTitleTab");
1520  
1521          $xCenter = $this->getXCenter($w);
1522          $tabHeight = $this->GetTitleRowHeight($tabCellHead, $w);
1523          $this->setTabLine($tabCellHead, $xCenter, $w, $tabHeight);
1524  
1525          $this->setStyleLinePage();
1526          foreach ($data["sites_info"] as $key => $info) {
1527              // Test page position

1528              if (($this->GetY() + PDF_DEFAULT_ROW_HEIGHT) > PDF_DEFAULT_MAX_Y) {
1529                  $this->AddPage();
1530                  $this->setTabLine($tabCellHead, $xCenter, $w, $tabHeight);
1531              }
1532              //$this->Cell($w[0], PDF_DEFAULT_ROW_HEIGHT, " ", "");

1533              $zz = 0;
1534              $tabCell[$zz ++] = new TabCell($info["site_name"], "LTBR", 0, "L", 0);
1535              $tabCell[$zz ++] = new TabCell($info["nb_vis"], "LTBR", 0, "C", 0);
1536              $tabCell[$zz ++] = new TabCell($info["nb_pag"], "LTBR", 0, "C", 0);
1537              $tabCell[$zz ++] = new TabCell(sprintf("%.1f", $info["nb_pag_per_vis"]), "LTBR", 0, "C", 0);
1538              $tabCell[$zz ++] = new TabCell($this->show_time_visit($info["time_per_vis"]), "LTBR", 0, "C", 0);
1539              $tabCell[$zz ++] = new TabCell(sprintf("%.0f", $info["one_page_rate"])." %", "LTBR", 0, "C", 0);
1540              $this->setTabLine($tabCell, $xCenter, $w);
1541          }
1542          $this->setStyleLineCategory();
1543          $info = $data["total"];
1544          // Test page position

1545          if (($this->GetY() + PDF_DEFAULT_ROW_HEIGHT) > PDF_DEFAULT_MAX_Y) {
1546              $this->AddPage();
1547          }
1548  
1549          $zz = 0;
1550          $tabCell[$zz ++] = new TabCell($this->pmvTranslate("generique_total"), "LTBR", 0, "L", 0, "setStyleLineCategory");
1551          $tabCell[$zz ++] = new TabCell($info["nb_vis"], "LTBR", 0, "C", 0, "setStyleLineCategory");
1552          $tabCell[$zz ++] = new TabCell($info["nb_pag"], "LTBR", 0, "C", 0, "setStyleLineCategory");
1553          $tabCell[$zz ++] = new TabCell(sprintf("%.1f", $info["nb_pag_per_vis"]), "LTBR", 0, "C", 0, "setStyleLineCategory");
1554          $tabCell[$zz ++] = new TabCell($this->show_time_visit($info["time_per_vis"]), "LTBR", 0, "C", 0, "setStyleLineCategory");
1555          $tabCell[$zz ++] = new TabCell(sprintf("%.0f", $info["one_page_rate"])." %", "LTBR", 0, "C", 0, "setStyleLineCategory");
1556          $this->setTabLine($tabCell, $xCenter, $w);
1557          //$this->Ln();

1558      }
1559  
1560  } // end class GenerePDF

1561  
1562  class ViewPdf extends ViewModule {
1563  
1564      function ViewPdf() {
1565          parent :: ViewModule("pdf");
1566      }
1567  
1568  	function process() {
1569  
1570      }
1571  
1572      // FOR TEST ONY : Show all info in datamodel

1573  	function afficheInfo($infoAff, $indentAff, $debCle, $curKey) {
1574          $ret = "";
1575  
1576          $indentStr = "    ";
1577          for ($i = 0; $i < $indentAff; $i += 1) {
1578              $indentStr = $indentStr."    ";
1579          }
1580          if (gettype($infoAff) == "array") {
1581              foreach ($infoAff as $key1 => $info1) {
1582                  $ret .= $indentStr." cle : ".$key1."<br>";
1583                  $ret .= $this->afficheInfo($info1, $indentAff +1, $debCle.".".$key1, $key1);
1584                  if (($key1 == "type") && ($info1 == "category")) {
1585                      //echo "xxxxx : " . $infoAff["id"];

1586                      $zoom2 = $this->data->getPagesZoom($infoAff["id"]);
1587                      $ret .= $this->afficheInfo($zoom2, $indentAff +3, $debCle.".[".$infoAff["id"]."]", "");
1588                  }
1589              }
1590          } else {
1591              if ($curKey == "data") {
1592                  $ret .= $indentStr.$debCle." : <b>".$infoAff."</b>";
1593              } else {
1594                  $ret .= $indentStr.$debCle." : ".$infoAff;
1595              }
1596  
1597              $ret .= "<br>";
1598          }
1599          return $ret;
1600      }
1601  
1602  	function display() {
1603          $viewAllDetail = false;
1604          $paramAll = getRequestVar( 'all', 0, 'int');
1605          if ($paramAll == 1) {
1606              $viewAllDetail = true;
1607          }
1608          
1609          $period = $this->request->getPeriod();
1610          $idSite = $this->request->getSiteId();
1611          $idSite = getRequestVar( 'site', -1, 'int');
1612          /*

1613                  $rssHash = Request :: getRssHash();

1614                  if ($rssHash == "xxx") {

1615                      $urlStartGraph = "";

1616                  } else {

1617                      $urlStartGraph = PHPMV_URL; //Request::getCurrentCompletePath();

1618                      $urlStartGraph .= "/index.php?site=".$idSite."&rss_hash=".$rssHash;

1619                      $urlStartGraph .= "&date=".getRequestVar("date", date("Y-m-d"), "string")."&period=".$period."&mod=view_graph";

1620                  }

1621          */
1622          $pdf = new GenerePDF("P", "mm");
1623  /*

1624          $pdf->AddFont("DejaVuSans", "", "DejaVuSans.php");

1625          $pdf->AddFont("DejaVuSans", "B", "DejaVuSans.php");

1626          $pdf->AddFont("DejaVuSans", "I", "DejaVuSans.php");

1627          $pdf->AddFont("DejaVuSans", "BI", "DejaVuSans.php");

1628          $pdf->phpmvFont = "DejaVuSans";

1629  */
1630  /*        

1631          $pdf->AddFont("SILEOT", "", "SILEOT.php");

1632          $pdf->AddFont("SILEOT", "B", "SILEOT.php");

1633          $pdf->AddFont("SILEOT", "I", "SILEOT.php");

1634          $pdf->AddFont("SILEOT", "BI", "SILEOT.php");

1635          $pdf->phpmvFont = "SILEOT";

1636  */        
1637          $pdf->currentModule = $this;
1638          if ($idSite > 0) {
1639              $site = new Site($idSite);
1640              $pdf->currentSite = $site;
1641          }
1642          else {
1643              $pdf->currentSite = null;
1644          }
1645          $pdf->period = $period;
1646          $pdf->literalDate = getLiteralDate($period, $this->request->getDate());
1647  
1648          if (isset ($GLOBALS["lang"]["text_dir"])) {
1649              $pdf->direction = $GLOBALS["lang"]["text_dir"];
1650          } else {
1651              $pdf->direction = "ltr";
1652          }
1653          //$pdf->direction = "rtl";

1654  
1655          // Set PDF propertes data    

1656          if ($idSite != -1){    
1657              $titre = "Statistics of ".$site->getName();
1658          }
1659          else {
1660              $titre = $pdf->pmvTranslate("summary_title");
1661          }
1662          $pdf->SetTitle($titre);
1663          $pdf->SetAuthor("phpMyVisites");
1664          $pdf->SetCreator($pdf->pmvTranslate("head_titre"));
1665          $pdf->SetKeywords($pdf->pmvTranslate("head_keywords"));
1666          $pdf->SetSubject($pdf->pmvTranslate("logo_description"));
1667  
1668          $pdf->SetFont($pdf->phpmvFont, "", 8);
1669          $pdf->SetLineWidth(0.1);
1670  
1671          // *******************************************************

1672          // Sites Summary

1673          // *******************************************************

1674          $pdf->titrePage1 = "summary_title";
1675          $pdf->AddPage();
1676  
1677          $pdf->setSitesSummaryStatistics();
1678  
1679  
1680          if ($idSite > 0) {
1681          
1682              $zoom = $this->data->getVisitsStatistics();
1683              if (! isset($zoom["nb_vis"])) {
1684                  $txtNoVisit = $pdf->pmvTranslate("aucunvisiteur_titre");
1685  
1686                  $pdf->Ln();
1687                  $pdf->Ln();
1688                  $pdf->SetFont($pdf->phpmvFont, "", 14);
1689                  $pdf->SetTextColor(255, 0, 0);
1690                  $w = $pdf->GetStringWidth($txtNoVisit) + 6;
1691  
1692                  $pdf->SetX((210 - $w) / 2);
1693                  $pdf->Cell($w, 8, $txtNoVisit, "", 0, "C", 0);
1694              }
1695              else {
1696                  // Summary Link

1697                  $pdf->setStyleSummaryLink();
1698                  
1699                  $pdf->Ln();
1700                  $linkP1 = $pdf->AddLink();
1701                  $pdf->SetX(50);
1702                  $pdf->Cell(80, PDF_DEFAULT_ROW_HEIGHT, $pdf->pmvTranslate("visites_titre"), "0", "", "L", 0, $linkP1);
1703                  $pdf->Ln();
1704                  $linkP2 = $pdf->AddLink();
1705                  $pdf->SetX(50);
1706                  $pdf->Cell(80, PDF_DEFAULT_ROW_HEIGHT, $pdf->pmvTranslate("frequence_titre"), "0", "", "L", 0, $linkP2);
1707                  $pdf->Ln();
1708                  $linkP3 = $pdf->AddLink();
1709                  $pdf->SetX(50);
1710                  $pdf->Cell(80, PDF_DEFAULT_ROW_HEIGHT, $pdf->pmvTranslate("pagesvues_titre"), "0", "", "L", 0, $linkP3);
1711                  $pdf->Ln();
1712                  $linkP4 = $pdf->AddLink();
1713                  $pdf->SetX(50);
1714                  $pdf->Cell(80, PDF_DEFAULT_ROW_HEIGHT, $pdf->pmvTranslate("suivi_titre"), "0", "", "L", 0, $linkP4);
1715                  $pdf->Ln();
1716                  $linkP5 = $pdf->AddLink();
1717                  $pdf->SetX(50);
1718                  $pdf->Cell(80, PDF_DEFAULT_ROW_HEIGHT, $pdf->pmvTranslate("provenance_titre"), "0", "", "L", 0, $linkP5);
1719                  $pdf->Ln();
1720                  $linkP6 = $pdf->AddLink();
1721                  $pdf->SetX(50);
1722                  $pdf->Cell(80, PDF_DEFAULT_ROW_HEIGHT, $pdf->pmvTranslate("configurations_titre"), "0", "", "L", 0, $linkP6);
1723                  $pdf->Ln();
1724                  $linkP7 = $pdf->AddLink();
1725                  $pdf->SetX(50);
1726                  $pdf->Cell(80, PDF_DEFAULT_ROW_HEIGHT, $pdf->pmvTranslate("affluents_titre"), "0", "", "L", 0, $linkP7);
1727                  $pdf->Ln();
1728  
1729                  // *******************************************************

1730                  // Statistics

1731                  // *******************************************************

1732                  $pdf->titrePage1 = "visites_titre";
1733                  $pdf->AddPage();
1734                  $pdf->SetLink($linkP1);
1735  
1736                  $pdf->setVisitsStatistics();
1737  
1738                  $pdf->setVisitsPeriodSummaries();
1739  
1740                  $pdf->setVisitsPeriodSummariesGraph();
1741  
1742                  $pdf->setVisitsAllPeriodSummaryGraph();
1743  
1744                  $pdf->setVisitsTimeVisitsGraph();
1745  
1746                  $pdf->setVisitsServerTimeGraph();
1747  
1748                  $pdf->setVisitsLocalTimeGraph();
1749  
1750                  // *******************************************************

1751                  // Frequency

1752                  // *******************************************************

1753                  $pdf->titrePage1 = "frequence_titre";
1754                  $pdf->AddPage();
1755                  $pdf->SetLink($linkP2);
1756  
1757                  $pdf->setFrequencyStatistics();
1758  
1759                  $pdf->setFrequencyNewReturnVisits();
1760  
1761                  $pdf->setFrequencyGraphNewReturnVisits();
1762  
1763                  $pdf->setFrequencyGraphNbVisitsPerVisitor();
1764  
1765                  // *******************************************************

1766                  //  Pages views Information

1767                  // *******************************************************

1768                  $pdf->titrePage1 = "pagesvues_titre";
1769                  $pdf->AddPage();
1770                  $pdf->SetLink($linkP3);
1771  
1772                  $pdf->setPagesZoomTab1();
1773  
1774                  $pdf->setPagesZoomTab2($viewAllDetail);
1775  
1776                  $pdf->setPagesZoomTpsParPage($viewAllDetail);
1777  
1778                  $pdf->setPagesByVisitGraph();
1779  
1780                  // *******************************************************

1781                  // Visitor movement

1782                  // *******************************************************

1783                  $pdf->titrePage1 = "suivi_titre";
1784                  $pdf->AddPage();
1785                  $pdf->SetLink($linkP4);
1786  
1787                  // Get data

1788                  $pdf->setFollowUpEntryPages($viewAllDetail);
1789  
1790                  $pdf->setFollowUpExitPages($viewAllDetail);
1791  
1792                  $pdf->setFollowUpSinglePages($viewAllDetail);
1793  
1794                  // *******************************************************

1795                  //  Provenance

1796                  // *******************************************************

1797                  $pdf->titrePage1 = "provenance_titre";
1798                  $pdf->AddPage();
1799                  $pdf->SetLink($linkP5);
1800  
1801                  $pdf->setWorldMap();
1802  
1803                  // setDisplayDataArray ($id, $headline, $data, $text)

1804                  //{pmv_data_array    data=$continentcountries id=continent template="common/display_data_array.tpl"

1805  
1806                  $pdf->setSourceCountry($viewAllDetail);
1807  
1808                  $pdf->setSourceProviders($viewAllDetail);
1809  
1810                  // *******************************************************

1811                  // Settings

1812                  // *******************************************************

1813                  $pdf->titrePage1 = "configurations_titre";
1814                  $pdf->AddPage();
1815                  $pdf->SetLink($linkP6);
1816  
1817                  $pdf->setSettingsConfig($viewAllDetail);
1818  
1819                  $pdf->setSettingsOs($viewAllDetail);
1820  
1821                  $pdf->setSettingsBrowsersType();
1822  
1823                  $pdf->setSettingsBrowsersInterest($viewAllDetail);
1824  
1825                  $pdf->setSettingsPlugins();
1826  
1827                  $pdf->setSettingsResolutionsInterest($viewAllDetail);
1828  
1829                  $pdf->setSettingsNormalWidescreen();
1830  
1831                  // *******************************************************

1832                  // Referers

1833                  // *******************************************************

1834                  $pdf->titrePage1 = "affluents_titre";
1835                  $pdf->AddPage();
1836                  $pdf->SetLink($linkP7);
1837  
1838                  $pdf->setReferersTypeInterest();
1839  
1840                  $pdf->setReferersSearchEnginesInterest($viewAllDetail);
1841  
1842                  $pdf->setReferersKeywordsInterest($viewAllDetail);
1843  
1844                  $pdf->setReferersSitesInterest($viewAllDetail);
1845  
1846                  $pdf->setReferersPartnersInterest($viewAllDetail);
1847  
1848                  $pdf->setReferersNewslettersInterest($viewAllDetail);
1849                  
1850                  $pdf->setReferersDirect ();
1851              }
1852          }
1853          $pdf->Ln(15);
1854          $pdf->SetFont($pdf->phpmvFont, "I", 6);
1855          $pdf->SetTextColor(128);
1856          $twtTime = sprintf($pdf->pmvTranslate("generique_timefooter"), getTimeElapsed());
1857          $w = $pdf->GetStringWidth($twtTime) + 6;
1858          $pdf->SetX((210 - $w) / 2);
1859          $pdf->Write(3, $twtTime);
1860          // *******************************************************

1861          // Output PDF

1862          // *******************************************************

1863          $pdf->Output("stats-site$idSite.pdf", "D");
1864  
1865      }
1866  }
1867  ?>


Généré le : Mon Nov 26 14:10:01 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics