[ Index ] |
|
Code source de phpMyVisites 2.3 |
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 63 2006-08-26 08:42:05Z cmil $ 11 //define ("INCLUDE_PATH", "../.."); 12 require_once INCLUDE_PATH."/core/include/ViewModule.class.php"; 13 require_once INCLUDE_PATH."/core/include/PdfConfigDb.class.php"; 14 15 // patch by HonestQiao 16 if($GLOBALS['lang']['lang_iso']=='zh'){ 17 require_once INCLUDE_PATH."/core/include/fpdf/myFpdfChinese.php"; 18 } 19 else 20 { 21 require_once INCLUDE_PATH."/core/include/fpdf/myFpdf.php"; 22 } 23 // patch by HonestQiao 24 25 26 define("PDF_COEF_MM_PX", 72 / 25.4); 27 define("PDF_CHAPTER_LN_SPACE", 8); 28 define("PDF_DEFAULT_ROW_HEIGHT", 6); 29 define("PDF_DEFAULT_STYLE", "setStyleLinePage"); 30 define("PDF_DEFAULT_MAX_Y", 280); 31 32 define ("PDF_TAB_SUM_PERIOD", 1); 33 define ("PDF_TAB_PAGE_ZOOM", 2); 34 35 class TabCell { 36 var $text = ""; 37 var $border = ""; 38 var $ln = 0; 39 var $align = "C"; 40 var $fill = ""; 41 var $styleFct = PDF_DEFAULT_STYLE; 42 var $url = ""; 43 var $typeInfo = ""; 44 45 function TabCell($p_text = "", $p_border = "", $p_ln = 0, $p_align = "C", $p_fill = "", $p_styleFct = PDF_DEFAULT_STYLE, $p_url = "", $p_typeInfo = "") { 46 $this->text = $p_text; 47 $this->border = $p_border; 48 $this->ln = $p_ln; 49 $this->align = $p_align; 50 $this->fill = $p_fill; 51 $this->styleFct = $p_styleFct; 52 $this->url = $p_url; 53 $this->typeInfo = $p_typeInfo; 54 } 55 } 56 57 class GenerePDF extends myFPDF { 58 // Current col 59 var $col = 0; 60 //Ordonnee du debut des colonnes 61 var $y0; 62 // Current module 63 var $currentModule; 64 // Current site for heder of pdf 65 var $currentSite; 66 67 var $request; 68 69 var $titrePage1; 70 71 var $direction; 72 73 var $phpmvFont = "Arial"; 74 // var $phpmvFont = "FreeSerif"; 75 76 var $period; 77 78 var $date; 79 80 var $literalDate; 81 82 var $setUrlChapter = false; 83 84 /** 85 * variable for trace 86 */ 87 var $traceMsg = ""; 88 89 function debugTrace ($msg) { 90 $this->traceMsg .= $msg. "\n"; 91 } 92 93 // Header of each page 94 function Header() { 95 // //En-tete 96 // $LeTitre = $this->pmvTranslate("visites_titre") . " - " . $this->currentSite->getName(); 97 if ($this->currentSite != null) { 98 if ($this->direction == "rtl") { 99 $LeTitre = $this->pmvTranslate($this->titrePage1." - ".$this->currentSite->getName()); 100 } else { 101 $LeTitre = $this->currentSite->getName()." - ".$this->pmvTranslate($this->titrePage1); 102 } 103 } else { 104 $LeTitre = $this->pmvTranslate($this->titrePage1); 105 } 106 107 //$this->Image(INCLUDE_PATH."/themes/default/images/phpmv.png", 10, 5, 50); 108 109 $this->SetTextColor(0, 0, 139); 110 $this->SetFillColor(255, 255, 255); 111 $this->SetFont($this->phpmvFont, "B", 11); 112 113 $w = $this->GetStringWidth($LeTitre) + 6; 114 if ($w < $this->GetStringWidth($this->literalDate)) { 115 $w = $this->GetStringWidth($this->literalDate); 116 } 117 118 $this->SetX((210 - $w) / 2); 119 $this->SetDrawColor(0, 0, 139); 120 $this->SetFillColor(255, 255, 255); 121 122 $this->SetLineWidth(0.2); 123 $this->Cell($w, 8, $LeTitre, "LTR", 0, "C", 0); 124 $this->Ln(); 125 $this->SetFont($this->phpmvFont, "", 8); 126 $this->SetX((210 - $w) / 2); 127 $this->Cell($w, 6, $this->literalDate, "LBR", 1, "C", 0); 128 $this->Ln(5); 129 130 /* 131 $txtBeta = "PDF generation is a Beta feature of phpMyVisites! It is not complete yet. Please submit your suggestions / bugs report to the forums"; 132 $this->SetTextColor(255, 0, 0); 133 $this->SetFont($this->phpmvFont, "U", 8); 134 $w = $this->GetStringWidth($txtBeta) + 6; 135 $this->SetX((210 - $w) / 2); 136 $this->Cell($w, 2, $txtBeta, 0, 0, "C", 0, "http://www.phpmyvisites.us/forums/index.php/m/13258/"); 137 $this->Ln(5); 138 */ 139 //Sauvegarde de l"ordonn�e 140 $this->y0 = $this->GetY(); 141 142 } 143 144 // Footer of each page 145 function Footer() { 146 //Pied de page 147 $this->SetY(-15); 148 $this->SetFont($this->phpmvFont, "I", 8); 149 $this->SetTextColor(128); 150 $this->Cell(40, 10, "Powered by phpMyVisites", 0, 0, "C", 0, "http://www.phpmyvisites.us/"); 151 $w = $this->GetStringWidth("Page ".$this->PageNo()) + 6; 152 $this->SetX((210 - $w) / 2); 153 $this->Cell($w, 10, "Page ".$this->PageNo(), 0, 0, "C"); 154 } 155 156 // Rewrtie Cell for utf8 157 158 function Cell($w, $h = 0, $txt = "", $border = 0, $ln = 0, $align = "", $fill = 0, $link = "") { 159 // patch by HonestQiao 160 if($GLOBALS['lang']['lang_iso']=='zh' && mb_detect_encoding($txt,'auto')){ 161 FPDF :: Cell($w, $h, mb_convert_encoding($txt,'GBK','auto'), $border, $ln, $align, $fill, $link); 162 } 163 else 164 { 165 FPDF :: Cell($w, $h, utf8_decode($txt), $border, $ln, $align, $fill, $link); 166 } 167 // patch by HonestQiao 168 // FPDF :: Cell($w, $h, $txt, $border, $ln, $align, $fill, $link); 169 // UFPDF :: Cell($w, $h, $txt, $border, $ln, $align, $fill, $link); 170 } 171 172 173 function setStyleTitleTab() { 174 $this->SetTextColor(255, 255, 255); 175 $this->SetFillColor(96, 115, 165); 176 $this->SetFont($this->phpmvFont, "B", 8); 177 } 178 179 function setStyleLinePage() { 180 $this->SetTextColor(0, 0, 139); 181 $this->SetFillColor(255, 255, 255); 182 $this->SetFont($this->phpmvFont, "", 8); 183 } 184 function setStyleLinePageSmall() { 185 $this->SetTextColor(0, 0, 139); 186 $this->SetFillColor(255, 255, 255); 187 $this->SetFont($this->phpmvFont, "", 6); 188 } 189 190 function setStyleLineCategory() { 191 $this->SetTextColor(0, 0, 139); 192 $this->SetFillColor(255, 255, 255); 193 $this->SetFont($this->phpmvFont, "B", 8); 194 } 195 function setTitleChapter($keyChapter, $url = "", $YJump = 40) { 196 $this->SetTextColor(0, 0, 139); 197 $this->SetFillColor(255, 255, 255); 198 $this->SetFont($this->phpmvFont, "B", 9); 199 if ($this->GetY() > (PDF_DEFAULT_MAX_Y - $YJump)) { 200 $this->AddPage(); 201 } 202 // $this->Cell(80, PDF_DEFAULT_ROW_HEIGHT, $this->pmvTranslate($keyChapter), "0", "", ""); 203 $urlLoc = ""; 204 if (! $this->setUrlChapter) { 205 $urlLoc = ""; 206 } 207 elseif ($url != "") { 208 $urlLoc = PHPMV_URL 209 ."/index.php?site=".$this->currentSite->id 210 ."&period=".$this->period 211 ."&date=".$this->date 212 ."&mod=".$url; 213 } 214 if ($this->direction == "rtl") { 215 $this->Cell(190, PDF_DEFAULT_ROW_HEIGHT, $this->pmvTranslate($keyChapter), "0", 0, "R", 0, $urlLoc); 216 } else { 217 $this->Cell(190, PDF_DEFAULT_ROW_HEIGHT, $this->pmvTranslate($keyChapter), "0", 0, "L", 0, $urlLoc); 218 // $this->Write(PDF_DEFAULT_ROW_HEIGHT, $this->pmvTranslate($keyChapter)); 219 } 220 $this->Ln(PDF_CHAPTER_LN_SPACE); 221 } 222 223 function setLineInfoText($keyText, $nb = null, $YJump = 10) { 224 $this->setStyleLinePage(); 225 if ($this->GetY() > (PDF_DEFAULT_MAX_Y - $YJump)) { 226 $this->AddPage(); 227 } 228 229 if (isset ($nb)) { 230 // Clean nb to pdf : <strong> 87 </strong> <small>(33%)</small> 231 $src = array ("<strong>", "</strong>", "<small>", "</small>"); 232 $dst = array ("", "", "", ""); 233 $tmpNb = str_replace($src, $dst, $nb); 234 235 $txtWrite = sprintf($this->pmvTranslate($keyText), $tmpNb); 236 //$this->Write(PDF_DEFAULT_ROW_HEIGHT, sprintf($this->pmvTranslate($keyText), $tmpNb)); 237 } else { 238 $txtWrite = $this->pmvTranslate($keyText); 239 //$this->Write(PDF_DEFAULT_ROW_HEIGHT, $this->pmvTranslate($keyText)); 240 } 241 if ($this->direction == "rtl") { 242 //Cell($w, $h = 0, $txt = "", $border = 0, $ln = 0, $align = "", $fill = 0, $link = "") 243 $this->Cell(190, PDF_DEFAULT_ROW_HEIGHT, $txtWrite, "0", 0, "R"); 244 } else { 245 $this->Cell(190, PDF_DEFAULT_ROW_HEIGHT, $txtWrite, "0", 0, "L"); 246 // $this->Write(PDF_DEFAULT_ROW_HEIGHT, $this->pmvTranslate($keyChapter)); 247 } 248 249 // $this->Cell(80, PDF_DEFAULT_ROW_HEIGHT, $this->pmvTranslate($keyChapter), "0", "", ""); 250 $this->Ln(); 251 } 252 function setStyleTitlePage() { 253 $this->SetTextColor(0, 0, 139); 254 $this->SetFillColor(255, 255, 255); 255 $this->SetFont($this->phpmvFont, "B", 11); 256 } 257 function setStyleSummaryLink() { 258 $this->SetTextColor(0, 0, 139); 259 $this->SetFillColor(255, 255, 255); 260 $this->SetFont($this->phpmvFont, "U", 9); 261 } 262 function setTitlePage($str) { 263 $this->setStyleTitlePage(); 264 $w = $this->GetStringWidth($str) + 6; 265 $this->SetX((210 - $w) / 2); 266 $this->Cell($w, 10, $str, 0, 0, "C"); 267 } 268 function setStatisticStyle1() { 269 $this->SetTextColor(0, 0, 139); 270 $this->SetFillColor(255, 255, 255); 271 $this->SetFont($this->phpmvFont, "B", 11); 272 } 273 function setStatisticStyle2() { 274 $this->SetTextColor(0, 0, 139); 275 $this->SetFillColor(255, 255, 255); 276 $this->SetFont($this->phpmvFont, "B", 11); 277 } 278 279 // Used to split page name 280 function truncate($str, $lg, $sep) { 281 $ret = ""; 282 if (strlen($str) > $lg) { 283 $ret = substr($str, 0, $lg).$sep; 284 } else { 285 $ret = $str; 286 } 287 return $ret; 288 } 289 290 // Show time HH:MM:SS 291 function show_time($ts) 292 { 293 $h = floor($ts / 3600); 294 $m = floor( ($ts - $h*3600) / 60 ); 295 $s = floor( ($ts - $h*3600 - $m * 60) ); 296 return setToLength($h, 2) . ":" . setToLength($m,2) . ":" . setToLength($s,2); 297 } 298 299 // Show time HH:MM:SS 300 function show_time_visit($ts) { 301 $h = floor( $ts / 3600 ); 302 $m = floor( ($ts - $h*3600) / 60 ); 303 $s = floor( ($ts - $h*3600 - $m * 60) ); 304 305 if($h != 0) 306 { 307 $return[] = $h; 308 $return[] = $m; 309 } 310 elseif($m != 0) 311 { 312 $return[] = $m; 313 } 314 $return[] = $s; 315 316 // h + min + sec 317 if(sizeof($return)===3) 318 { 319 return vsprintf(setToLength($h, 2) . ":" . setToLength($m,2) . ":" . setToLength($s,2), $return); 320 } 321 if (sizeof($return) == 2) { 322 $ret = vsprintf($this->pmvTranslate("generique_tempsvisite"), $return); 323 } 324 // only sec 325 else { 326 $ret = vsprintf($this->pmvTranslate("visites_sec"), $return); 327 } 328 return $ret; 329 } 330 331 function setStylePercentPositif() { 332 $this->SetTextColor(0, 128, 0); 333 $this->SetFillColor(255, 255, 255); 334 $this->SetFont($this->phpmvFont, "", 8); 335 } 336 function setStylePercentNegatif() { 337 $this->SetTextColor(255, 0, 0); 338 $this->SetFillColor(255, 255, 255); 339 $this->SetFont($this->phpmvFont, "", 8); 340 } 341 342 function getStylePercent($string) { 343 if (substr($string, 0, 1) === "-") { 344 $ret = "setStylePercentNegatif"; 345 } else { 346 $ret = "setStylePercentPositif"; 347 } 348 return $ret; 349 } 350 351 // Set red for negative and green for positive number 352 function show_percent($string) { 353 if (substr($string, 0, 1) === "-") { 354 $span = "negatif"; 355 $this->SetTextColor(255, 0, 0); 356 } else { 357 $span = "positif"; 358 $this->SetTextColor(0, 128, 0); 359 } 360 return $string; 361 } 362 363 function pmvTranslate($str) { 364 if (isset ($GLOBALS["lang"][$str])) { 365 $ret = $GLOBALS["lang"][$str]; 366 } else { 367 $ret = $str; 368 } 369 return $ret; 370 } 371 372 function getRowHeightFromMax($maxHeight, $width, $txt) { 373 // Compute nb of line to write txt 374 $strWidth = $this->GetStringWidth($txt) + 3; 375 $nbLg = floor($strWidth / $width); 376 if (($strWidth % $width) > 0) { 377 $nbLg ++; 378 } 379 if ($nbLg <= 0) { 380 $nbLg = 1; 381 } 382 return $maxHeight / $nbLg; 383 } 384 385 function GetTitleRowHeight($tabCell, $tabWidth) { 386 $tabHeight = array (); 387 // Get max 388 $max = 0; 389 //$this->setStyleLinePage(); 390 for ($i = 0; $i < count($tabCell); $i ++) { 391 $strWidth = $this->GetStringWidth($tabCell[$i]->text) + 3; 392 $tabHeight[$i] = floor($strWidth / $tabWidth[$i]); 393 if (($strWidth % $tabWidth[$i]) > 0) { 394 $tabHeight[$i]++; 395 } 396 if ($tabHeight[$i] <= 0) { 397 $tabHeight[$i] = 1; 398 } 399 //$this->Cell($tabWidth[$i], PDF_DEFAULT_ROW_HEIGHT, $tabWidth[$i]. " ". ($this->GetStringWidth($tabCell[$i]->text)) . " " . $tabHeight[$i] . " " . $tabCell[$i]->text); 400 //$this->Ln(); 401 if ($tabHeight[$i] > $max) { 402 $max = $tabHeight[$i]; 403 } 404 } 405 406 // compute height 407 for ($i = 0; $i < count($tabHeight); $i ++) { 408 $tabHeight[$i] = ($max / $tabHeight[$i]) * PDF_DEFAULT_ROW_HEIGHT; 409 } 410 411 return $tabHeight; 412 } 413 414 /** 415 * Compute start x for table with array of width of each columns 416 * 417 * @param $w : array of width of each columns 418 * 419 * @return value to use to SetX to center a table 420 **/ 421 function getXCenter($w) { 422 $tot = 0; 423 if (is_array($w)) { 424 for ($i = 0; $i < count($w); $i ++) { 425 $tot += $w[$i]; 426 } 427 } else { 428 $tot = $w; 429 } 430 $tmp = (210 - $tot) / 2; 431 if ($tmp < $this->lMargin) { 432 $tmp = $this->lMargin; 433 } 434 return $tmp; 435 } 436 437 // Write a line of table in pdf 438 // 439 // @param $tabCell : Each cell of the line 440 // @param $xCenter : value return by getXCenter for $tabWidth 441 // @param $tabWidth : array of width of each columns 442 // @param $tabHeight : array of height of each columns (only for table title) 443 // @param $typeTab : type of table for specific elements 444 function setTabLine($tabCell, $xCenter, $tabWidth, $tabHeight = null, $typeTab = 0) { 445 if ($this->direction == "rtl") { 446 $deb = count($tabWidth) - 1; 447 $fin = -1; 448 $inc = -1; 449 } else { 450 $deb = 0; 451 $fin = count($tabWidth); 452 $inc = 1; 453 } 454 if ($this->currentSite != null) { 455 $pathImage = "./themes/".$this->currentSite->getPathTheme()."/images/"; 456 } 457 else { 458 $pathImage = "./themes/".THEME_DEFAULT."/images/"; 459 } 460 461 // Test page position 462 if (($this->GetY() + PDF_DEFAULT_ROW_HEIGHT) > PDF_DEFAULT_MAX_Y) { 463 $this->AddPage(); 464 } 465 466 //$this->Cell(10, PDF_DEFAULT_ROW_HEIGHT, "deb : $deb, fin : $fin, inc : $inc" ); 467 //$this->Ln(); 468 469 $oldStyle = ""; 470 $curY = $this->GetY(); 471 $curX = $xCenter; 472 473 for ($i = $deb; $i != $fin; $i += $inc) { 474 $align = $tabCell[$i]->align; 475 if ($this->direction == "rtl") { 476 if ($align == "L") { 477 $align = "R"; 478 } else { 479 if ($align == "R") { 480 $align = "L"; 481 } 482 } 483 } 484 485 if ($oldStyle != $tabCell[$i]->styleFct) { 486 $oldStyle = $tabCell[$i]->styleFct; 487 // Execute style fct 488 //call_user_func(array ($this, $oldStyle)); 489 $this-> $oldStyle (); 490 } 491 492 $this->SetXY($curX, $curY); 493 if ($tabHeight == null) { 494 495 if ($typeTab == PDF_TAB_SUM_PERIOD) { 496 $tabTxt = split("xxx", $tabCell[$i]->text); 497 498 if (count($tabTxt) > 1) { 499 $this->Cell($tabWidth[$i], PDF_DEFAULT_ROW_HEIGHT, $tabTxt[0], "RLT", 0, $align, $tabCell[$i]->fill, $tabCell[$i]->url); 500 $this->SetXY($curX, $curY +PDF_DEFAULT_ROW_HEIGHT); 501 $this->setStyleLinePageSmall(); 502 $oldStyle = "setStyleLinePageSmall"; 503 $this->Cell($tabWidth[$i], PDF_DEFAULT_ROW_HEIGHT - 2, $tabTxt[1], "RLB", 0, $align, $tabCell[$i]->fill, $tabCell[$i]->url); 504 } else { 505 $rowHeight = $this->getRowHeightFromMax(2 * PDF_DEFAULT_ROW_HEIGHT - 2, $tabWidth[$i], $tabTxt[0]); //." "); 506 $this->MultiCell($tabWidth[$i], $rowHeight, $tabTxt[0], "RLTB", $align, $tabCell[$i]->fill); 507 } 508 } 509 elseif ($typeTab == PDF_TAB_PAGE_ZOOM) { 510 $saveX = $this->GetX(); 511 $this->Cell($tabWidth[$i], PDF_DEFAULT_ROW_HEIGHT, $tabCell[$i]->text, $tabCell[$i]->border, 0, $align, $tabCell[$i]->fill, $tabCell[$i]->url); 512 $imgName = ""; 513 if (($this->direction == "ltr") && ($i == $deb)) { 514 $imgX = $saveX + $this->GetStringWidth($tabCell[$i]->text)+2; 515 $imgY = $this->GetY()+0.5; 516 if ($tabCell[$i]->typeInfo == "file") { 517 $imgName = $pathImage."download.png"; 518 } 519 elseif ($tabCell[$i]->typeInfo == "rss") { 520 $imgName = $pathImage."rss.png"; 521 } 522 elseif ($tabCell[$i]->typeInfo == "podcast") { 523 $imgName = $pathImage."podcast.png"; 524 } 525 } 526 elseif (($this->direction == "rtl") && ($i == $fin+1) && ($tabCell[$i]->typeInfo == "file")) { 527 $imgX = $this->GetX() - $this->GetStringWidth($tabCell[$i]->text)- 6; 528 $imgY = $this->GetY()+0.5; 529 if ($tabCell[$i]->typeInfo == "file") { 530 $imgName = $pathImage."download.png"; 531 } 532 elseif ($tabCell[$i]->typeInfo == "rss") { 533 $imgName = $pathImage."rss.png"; 534 } 535 elseif ($tabCell[$i]->typeInfo == "podcast") { 536 $imgName = $pathImage."podcast.png"; 537 } 538 } 539 if ($imgName != "") { 540 $this->Image($imgName, $imgX, $imgY, 0, 4); 541 } 542 543 } 544 else { 545 $this->Cell($tabWidth[$i], PDF_DEFAULT_ROW_HEIGHT, $tabCell[$i]->text, $tabCell[$i]->border, 0, $align, $tabCell[$i]->fill, $tabCell[$i]->url); 546 } 547 } else { 548 $this->MultiCell($tabWidth[$i], $tabHeight[$i], $tabCell[$i]->text, $tabCell[$i]->border, $align, $tabCell[$i]->fill); 549 } 550 $curX = $curX + $tabWidth[$i]; 551 } 552 if ($tabHeight == null) { 553 $this->Ln(); 554 } 555 } 556 557 function setPmvGraph($GraphType, $GraphData, $chapterTitle = null) { 558 ob_start(); 559 $moduleGR = Module :: factory("view_graph"); 560 $moduleGR->init($this->currentModule->request, null, null, $GraphType, $GraphData); 561 $moduleGR->showAll(); 562 $out1 = ob_get_contents(); 563 ob_end_clean(); 564 565 // Parse to get info 566 $infoPNG = $this->_parsepngpmv("getDataGraph".$GraphType.$GraphData.".pngpmv", $out1); 567 if (! is_array($infoPNG)) { 568 if ($chapterTitle != null) { 569 $this->setTitleChapter($chapterTitle); 570 } 571 $this->setErrorMessage($infoPNG); 572 return; 573 } 574 $v_w = $infoPNG["w"]; 575 $v_h = $infoPNG["h"]; 576 577 // Verify if there is enough place to set image 578 $heightImg = (($v_h * 0.7) / PDF_COEF_MM_PX); 579 if ($chapterTitle != null) { 580 $heightImg += (PDF_DEFAULT_ROW_HEIGHT + PDF_CHAPTER_LN_SPACE); 581 } 582 583 if (($this->GetY() + $heightImg) > PDF_DEFAULT_MAX_Y) { 584 $this->AddPage(); 585 } 586 587 if ($chapterTitle != null) { 588 $this->setTitleChapter($chapterTitle); 589 } 590 591 $xCentre = $this->getXCenter(($v_w * 0.7) / PDF_COEF_MM_PX); 592 593 $this->Image("graph".$GraphType.$GraphData.".pngpmv", $xCentre, $this->GetY(), 0, ($v_h * 0.7) / PDF_COEF_MM_PX, "pngpmv", "", $out1); 594 $this->SetY($this->GetY() + (($v_h * 0.7) / PDF_COEF_MM_PX) + PDF_DEFAULT_ROW_HEIGHT); 595 } 596 597 function getDirById($id) { 598 if ($id == "os") { 599 $pathImg = DIR_IMG_OS; 600 } 601 elseif ($id == "browsers") { 602 $pathImg = DIR_IMG_BROWSERS; 603 } 604 elseif ($id == "plugins") { 605 //Waiting png conversion 606 $pathImg = DIR_IMG_PLUGINS; 607 //$pathImg = null; 608 } 609 elseif ($id == "screens") { 610 //Waiting png conversion 611 $pathImg = DIR_IMG_SCREENS; 612 //$pathImg = null; 613 } 614 elseif ($id == "country") { 615 $pathImg = DIR_IMG_COUNTRIES_FLAGS; 616 } 617 elseif ($id == "searchEngines") { 618 $pathImg = DIR_IMG_SEARCH_ENGINES; 619 } else { 620 $pathImg = null; 621 } 622 return $pathImg; 623 } 624 625 function setDisplayDataArray($id, $headline, $data, $textNoRow = "", $text1 = "", $nb1 = null, $text2 = "", $nb2 = null) { 626 $ret = 1; 627 if ($id != "continent") { 628 if ($data != null) { 629 $this->setTitleChapter($headline); 630 } 631 else { 632 $this->setTitleChapter($headline, "", PDF_DEFAULT_ROW_HEIGHT*3); 633 } 634 } else { 635 $this->Ln(); 636 $this->Ln(); 637 } 638 if ($data != null) { 639 if ($text1 != "") { 640 $this->setLineInfoText($text1, $nb1); 641 } 642 if ($text2 != "") { 643 $this->setLineInfoText($text2, $nb2); 644 } 645 $w = array (70, 30); 646 //MultiCell(float w, float h, string txt [, mixed border [, string align [, int fill]]]) 647 $this->setStyleTitleTab(); 648 $zz = 0; 649 $tabCellHeader[$zz ++] = new TabCell($this->pmvTranslate($headline), "1", 0, "C", "1", "setStyleTitleTab"); 650 $tabCellHeader[$zz ++] = new TabCell($this->pmvTranslate("generique_nombre"), "1", 0, "C", "1", "setStyleTitleTab"); 651 652 $xCenter = $this->getXCenter($w); 653 $tabHeight = $this->GetTitleRowHeight($tabCellHeader, $w); 654 $this->setTabLine($tabCellHeader, $xCenter, $w, $tabHeight); 655 $widthTotal = 0; 656 for ($i = 0; $i < count($w); $i ++) { 657 $widthTotal += $w[$i]; 658 } 659 660 $this->setStyleLinePage(); 661 662 // foreach ($data as $key => $info) { 663 // $this->Cell($w[0], PDF_DEFAULT_ROW_HEIGHT, "$key", ""); 664 // $this->Ln(); 665 // foreach ($info as $key2 => $info2) { 666 // $this->Cell($w[0], PDF_DEFAULT_ROW_HEIGHT, " $key2 : $info2", ""); 667 // $this->Ln(); 668 // } 669 // } 670 671 $pathImg = $this->getDirById($id); 672 foreach ($data as $key => $info) { 673 // Test page position 674 if (($this->GetY() + PDF_DEFAULT_ROW_HEIGHT) > PDF_DEFAULT_MAX_Y) { 675 $this->AddPage(); 676 $this->setStyleTitleTab(); 677 $this->setTabLine($tabCellHeader, $xCenter, $w, $tabHeight); 678 $this->setStyleLinePage(); 679 } 680 681 $this->SetX($xCenter); 682 683 $spaceAfter = ""; 684 if ((isset ($info["img"])) && ($pathImg != null)) { 685 if (getFilenameExtension($info["img"]) != 'gif') { 686 if ($this->direction == "rtl") { 687 $this->Image($pathImg."/".$info["img"], $xCenter + $widthTotal - (11 / PDF_COEF_MM_PX) - 1, $this->GetY() + 1, 11 / PDF_COEF_MM_PX); 688 } else { 689 $this->Image($pathImg."/".$info["img"], $this->GetX() + 1, $this->GetY() + 1, 11 / PDF_COEF_MM_PX); 690 } 691 } 692 $spaceBefore = " "; 693 } else { 694 if ($id = "provider") { 695 $spaceBefore = " "; 696 } else { 697 $spaceBefore = " "; 698 } 699 } 700 if ($this->direction == "rtl") { 701 $spaceAfter = $spaceBefore; 702 $spaceBefore = ""; 703 } 704 if (isset ($info["url"])) { 705 $infoUrl = $info["url"]; 706 } else { 707 $infoUrl = ""; 708 } 709 710 $zz = 0; 711 $tabCell[$zz ++] = new TabCell($spaceBefore.$this->truncate($info["data"], 50, "...").$spaceAfter, "LTBR", 0, "L", 0, "setStyleLineCategory", $infoUrl); 712 $tabCell[$zz ++] = new TabCell($info["sum"]." (".sprintf("%.1f", $info["percent"])." %)", "LTBR", 0, "C", 0, "setStyleLinePage"); 713 $this->setTabLine($tabCell, $xCenter, $w); 714 } 715 $this->Ln(); 716 } else { 717 $ret = 0; 718 $this->setLineInfoText($textNoRow); 719 $this->Ln(); 720 } 721 return $ret; 722 } 723 function setDisplayDataArrayInterest($id, $headline, $data) { 724 725 $this->setLineInfoText($headline, null, 30); 726 /* 727 $this->setStyleLinePage(); 728 $this->Cell(10, PDF_DEFAULT_ROW_HEIGHT, $this->pmvTranslate($headline), "0", "", ""); 729 $this->Ln(); 730 */ 731 $this->setStyleLineCategory(); 732 $i = 0; 733 $w = array (60, 15, 25, 25, 25, 25); 734 $pathImg = $this->getDirById($id); 735 $widthTotal = 0; 736 for ($i = 0; $i < count($w); $i ++) { 737 $widthTotal += $w[$i]; 738 } 739 740 $this->setStyleTitleTab(); 741 //$tabCell = new aray(); 742 //$tabCell[0] = new TabCell("", "", 0, "C", "1", "setStyleTitleTab"); 743 $zz = 0; 744 $tabCellHeader[$zz ++] = new TabCell($this->pmvTranslate($headline), "1", 0, "C", "1", "setStyleTitleTab"); 745 $tabCellHeader[$zz ++] = new TabCell($this->pmvTranslate("generique_nombre"), "1", 0, "C", "1", "setStyleTitleTab"); 746 $tabCellHeader[$zz ++] = new TabCell($this->pmvTranslate("visites_pagesvisites"), "1", 0, "C", "1", "setStyleTitleTab"); 747 $tabCellHeader[$zz ++] = new TabCell($this->pmvTranslate("visites_pagesvisitessign"), "1", 0, "C", "1", "setStyleTitleTab"); 748 $tabCellHeader[$zz ++] = new TabCell($this->pmvTranslate("visites_tauxvisite"), "1", 0, "C", "1", "setStyleTitleTab"); 749 $tabCellHeader[$zz ++] = new TabCell($this->pmvTranslate("visites_tempsmoyen"), "1", 0, "C", "1", "setStyleTitleTab"); 750 751 $xCenter = $this->getXCenter($w); 752 $tabHeight = $this->GetTitleRowHeight($tabCellHeader, $w); 753 $i = 0; 754 foreach ($data as $key => $info) { 755 // Test page position 756 if (($this->GetY() + 4 * PDF_DEFAULT_ROW_HEIGHT) > PDF_DEFAULT_MAX_Y) { 757 $this->AddPage(); 758 $this->setStyleTitleTab(); 759 $this->setTabLine($tabCellHeader, $xCenter, $w, $tabHeight); 760 $this->setStyleLinePage(); 761 } 762 elseif ($i == 0) { 763 // Table header 764 $this->setTabLine($tabCellHeader, $xCenter, $w, $tabHeight); 765 } 766 $this->setStyleLinePage(); 767 $this->SetX($xCenter); 768 769 $spaceAfter = ""; 770 if ((isset ($info["img"])) && ($pathImg != null)) { 771 if (getFilenameExtension($info["img"]) != 'gif') { 772 if ($this->direction == "rtl") { 773 $this->Image($pathImg."/".$info["img"], $xCenter + $widthTotal - (11 / PDF_COEF_MM_PX) - 1, $this->GetY() + 1, 11 / PDF_COEF_MM_PX); 774 } else { 775 $this->Image($pathImg."/".$info["img"], $this->GetX() + 1, $this->GetY() + 1, 11 / PDF_COEF_MM_PX); 776 } 777 } 778 $spaceBefore = " "; 779 } else { 780 if ($id = "provider") { 781 $spaceBefore = " "; 782 } else { 783 $spaceBefore = " "; 784 } 785 } 786 if ($this->direction == "rtl") { 787 $spaceAfter = $spaceBefore; 788 $spaceBefore = ""; 789 } 790 $zz = 0; 791 $tabCell[$zz ++] = new TabCell($spaceBefore.$this->truncate($info["data"], 50, "...").$spaceAfter, "LTBR", 0, "L", 0, "setStyleLineCategory"); 792 $tabCell[$zz ++] = new TabCell($info["sum"], "LTBR", 0, "C", 0, "setStyleLinePage"); 793 $tabCell[$zz ++] = new TabCell(sprintf("%.1f", $info["page_per_visit"]), "LTBR", 0, "C", 0); 794 $tabCell[$zz ++] = new TabCell(sprintf("%.1f", $info["page_per_visit_significant"]), "LTBR", 0, "C", 0); 795 $tabCell[$zz ++] = new TabCell(sprintf("%.0f", $info["one_page_rate"])." %", "LTBR", 0, "C", 0); 796 $tabCell[$zz ++] = new TabCell($info["time_per_visit"], "LTBR", 0, "C", 0); 797 $this->setTabLine($tabCell, $xCenter, $w); 798 799 $i ++; 800 } 801 $this->Ln(); 802 } 803 804 //********************************************************** 805 // 806 // TODO Provenance 807 // 808 //********************************************************** 809 810 function setWorldMap($idcont = "") { 811 $data = $this->currentModule->data->getSourceContinentCountries($idcont); 812 813 $this->debugTrace ("cont : $idcont"); 814 //echo "cont : $idcont <br>"; 815 //$this->Cell(80, PDF_DEFAULT_ROW_HEIGHT, $idcont, "0", "", "L", 0); 816 //&id_details_continent=eur 817 818 ob_start(); 819 $moduleGR = Module::factory("view_world_map"); 820 $moduleGR->init($this->currentModule->request, null); 821 $moduleGR->m_idDetailsCont = $idcont; 822 $moduleGR->showAll(); 823 $out1 = ob_get_contents(); 824 ob_end_clean(); 825 826 // Parse to get info 827 $infoPNG = $this->_parsepngpmv("getssgraphworldmap".$idcont.".pngpmv", $out1); 828 if (! is_array($infoPNG)) { 829 $this->setTitleChapter("provenance_mappemonde", "view_source#a1"); 830 $this->setErrorMessage($infoPNG); 831 return; 832 } 833 834 $v_w = $infoPNG["w"]; 835 $v_h = $infoPNG["h"]; 836 837 // Verify if there is enough place to set image 838 $heightImg = (($v_h * 0.7) / PDF_COEF_MM_PX); 839 $heightImg += (PDF_DEFAULT_ROW_HEIGHT + PDF_CHAPTER_LN_SPACE + 10); 840 841 if (($this->GetY() + $heightImg) > PDF_DEFAULT_MAX_Y) { 842 $this->AddPage(); 843 } 844 845 $this->setTitleChapter("provenance_mappemonde", "view_source#a1"); 846 847 $xCentre = $this->getXCenter(($v_w * 0.7) / PDF_COEF_MM_PX); 848 849 $this->Image("ssgraphworldmap".$idcont.".pngpmv", $xCentre, $this->GetY(), 0, ($v_h * 0.7) / PDF_COEF_MM_PX, "pngpmv", "", $out1); 850 $this->SetY($this->GetY() + (($v_h * 0.7) / PDF_COEF_MM_PX) + PDF_DEFAULT_ROW_HEIGHT); 851 852 $this->Image(DIR_IMG_MAPS."/scale.png", 70, $this->GetY(), 0, 7 / PDF_COEF_MM_PX); 853 $this->SetY($this->GetY() + 10); 854 855 if ($idcont == "") { 856 $this->setDisplayDataArray("continent", "provenance_continent", $data); 857 } else { 858 $this->setDisplayDataArray("country", "provenance_recappays", $data); 859 } 860 } 861 862 function setSourceCountry($all = false, $showInterest = true) { 863 $max = NB_ELEMENTS_TO_DISPLAY; 864 if ($all == true) { 865 $max = -1; 866 } 867 $data = $this->currentModule->data->getSourceCountries(0, $max); 868 $countriesdistinct = $this->currentModule->data->getSourceCountriesDistinct(); 869 $this->setDisplayDataArray("country", "provenance_recappays", $data, "", "provenance_nbpays", $countriesdistinct); 870 871 if ($showInterest) { 872 $dataInterest = $this->currentModule->data->getSourceCountriesInterest(0, $max); 873 $this->setDisplayDataArrayInterest("country", "provenance_interetspays", $dataInterest); 874 } 875 876 $this->setPmvGraph(3, "source_countries"); 877 } 878 879 function setSourceProviders($all = false) { 880 $max = NB_ELEMENTS_TO_DISPLAY; 881 if ($all == true) { 882 $max = -1; 883 } 884 $data = $this->currentModule->data->getSourceProviders(0, $max); 885 $this->setDisplayDataArray("provider", "provenance_fai", $data); 886 } 887 888 //********************************************************** 889 // 890 // TODO Settings 891 // 892 //********************************************************** 893 894 function setSettingsConfig($all = false) { 895 $max = NB_ELEMENTS_TO_DISPLAY; 896 if ($all == true) { 897 $max = -1; 898 } 899 $data = $this->currentModule->data->getSettingsConfig(0, $max); 900 $this->setDisplayDataArray("configurations", "configurations_configurations", $data); 901 } 902 903 function setSettingsOs($all = false, $showInterest = true) { 904 $max = NB_ELEMENTS_TO_DISPLAY; 905 if ($all == true) { 906 $max = -1; 907 } 908 $data = $this->currentModule->data->getSettingsOs(0, $max); 909 $this->setDisplayDataArray("os", "configurations_os", $data); 910 911 if ($showInterest) { 912 $dataInterest = $this->currentModule->data->getSettingsOsInterest(0, $max); 913 $this->setDisplayDataArrayInterest("os", "configurations_os_interest", $dataInterest); 914 } 915 916 $this->setPmvGraph(3, "settings_os"); 917 } 918 919 function setSettingsBrowsersInterest($all = false, $showInterest = true) { 920 $max = NB_ELEMENTS_TO_DISPLAY; 921 if ($all == true) { 922 $max = -1; 923 } 924 $data = $this->currentModule->data->getSettingsBrowsers(0, $max); 925 $this->setDisplayDataArray("browsers", "configurations_navigateurs", $data); 926 927 if ($showInterest) { 928 $dataInterest = $this->currentModule->data->getSettingsBrowsersInterest(0, $max); 929 $this->setDisplayDataArrayInterest("browsers", "configurations_navigateurs_interest", $dataInterest); 930 } 931 932 $this->setPmvGraph(3, "settings_browsers"); 933 } 934 935 function setSettingsBrowsersType() { 936 $data = $this->currentModule->data->getSettingsBrowsersType(); 937 $this->setDisplayDataArray("browsers", "configurations_navigateursbytype", $data); 938 939 $this->setPmvGraph(3, "settings_browsers_type"); 940 } 941 942 function setSettingsPlugins() { 943 $data = $this->currentModule->data->getSettingsPlugins(); // NO ALL 944 $this->setDisplayDataArray("plugins", "configurations_plugins", $data); 945 946 $this->setPmvGraph(2, "settings_plugins"); 947 } 948 949 function setSettingsResolutionsInterest($all = false, $showInterest = true) { 950 $max = NB_ELEMENTS_TO_DISPLAY; 951 if ($all == true) { 952 $max = -1; 953 } 954 $data = $this->currentModule->data->getSettingsResolutions(0, $max); 955 $this->setDisplayDataArray("screens", "configurations_resolutions", $data); 956 957 if ($showInterest) { 958 $dataInterest = $this->currentModule->data->getSettingsResolutionsInterest(0, $max); 959 $this->setDisplayDataArrayInterest("screens", "configurations_resolutions_interest", $dataInterest); 960 } 961 962 $this->setPmvGraph(3, "settings_resolutions"); 963 } 964 965 function setSettingsNormalWidescreen() { 966 $data = $this->currentModule->data->getSettingsNormalWidescreen(); // NO ALL 967 $this->setDisplayDataArray("screens", "configurations_rapport", $data); 968 } 969 970 //********************************************************** 971 // 972 // TODO Referers 973 // 974 //********************************************************** 975 function setReferersTypeInterest($showInterest = true) { 976 977 $this->setPmvGraph(4, "referers_summary", "affluents_recapimg"); 978 if ($showInterest) { 979 $dataInterest = $this->currentModule->data->getReferersTypeInterest(); 980 $this->setDisplayDataArrayInterest("referers", "affluents_interetstype", $dataInterest); 981 } 982 } 983 function setReferersSearchEnginesInterest($all = false, $showInterest = true) { 984 $max = NB_ELEMENTS_TO_DISPLAY; 985 if ($all == true) { 986 $max = -1; 987 } 988 $data = $this->currentModule->data->getReferersSearchEngines(0, $max); 989 $numbers = $this->currentModule->data->getReferersNumbers(); 990 //$numbers.searchengines 991 $ret = $this->setDisplayDataArray("searchEngines", "affluents_moteurs", $data, "affluents_aucunmoteur", "affluents_nbparmoteur", $numbers["searchengines"]); 992 if (($ret > 0) && ($showInterest)) { 993 $dataInterest = $this->currentModule->data->getReferersSearchEnginesInterest(0, $max); 994 $this->setDisplayDataArrayInterest("searchEngines", "affluents_interetsmoteurs", $dataInterest); 995 } 996 } 997 998 function setReferersKeywordsInterest($all = false, $showInterest = true) { 999 $max = NB_ELEMENTS_TO_DISPLAY; 1000 if ($all == true) { 1001 $max = -1; 1002 } 1003 $data = $this->currentModule->data->getReferersKeywords(0, $max); 1004 $numbers = $this->currentModule->data->getReferersNumbers(); 1005 //$numbers.keywords 1006 $ret = $this->setDisplayDataArray("keywords", "affluents_motscles", $data, "affluents_aucunmoteur", "affluents_nbmotscles", $numbers["keywords"]); 1007 1008 if (($ret > 0) && ($showInterest)) { 1009 $dataInterest = $this->currentModule->data->getReferersKeywordsInterest(0, $max); 1010 $this->setDisplayDataArrayInterest("keywords", "affluents_interetsmotscles", $dataInterest); 1011 } 1012 } 1013 1014 function setReferersSitesInterest($all = false, $showInterest = true) { 1015 $max = NB_ELEMENTS_TO_DISPLAY; 1016 if ($all == true) { 1017 $max = -1; 1018 } 1019 $data = $this->currentModule->data->getReferersSites(0, $max); 1020 $numbers = $this->currentModule->data->getReferersNumbers(); 1021 // {assign var=strsites value='affluents_nbautressites'|translate:$numbers.sites} 1022 //{assign var=strdistinctsites value='affluents_nbautressitesdiff'|translate:"<strong>`$numbers.distinctsites`</strong>"} 1023 1024 $ret = $this->setDisplayDataArray("sitesinternet", "affluents_sitesinternet", $data, "affluents_aucunautresite", "affluents_nbautressites", $numbers["sites"], "affluents_nbautressitesdiff", $numbers["distinctsites"]); 1025 1026 if (($ret > 0) && ($showInterest)) { 1027 $dataInterest = $this->currentModule->data->getReferersSitesInterest(0, $max); 1028 $this->setDisplayDataArrayInterest("sitesinternet", "affluents_interetssitesinternet", $dataInterest); 1029 } 1030 } 1031 1032 function setReferersPartnersInterest($all = false, $showInterest = true) { 1033 $max = NB_ELEMENTS_TO_DISPLAY; 1034 if ($all == true) { 1035 $max = -1; 1036 } 1037 $data = $this->currentModule->data->getReferersPartners(0, $max); 1038 $numbers = $this->currentModule->data->getReferersNumbers(); 1039 //$numbers.partners 1040 $ret = $this->setDisplayDataArray("sitesinternet", "affluents_partenaires", $data, "affluents_aucunpartenaire", "affluents_nbpartenaires", $numbers["partners"]); 1041 1042 if (($ret > 0) && ($showInterest)) { 1043 $dataInterest = $this->currentModule->data->getReferersPartnersInterest(0, $max); 1044 $this->setDisplayDataArrayInterest("sitesinternet", "affluents_interetspartenaires", $dataInterest); 1045 } 1046 } 1047 1048 function setReferersNewslettersInterest($all = false, $showInterest = true) { 1049 $max = NB_ELEMENTS_TO_DISPLAY; 1050 if ($all == true) { 1051 $max = -1; 1052 } 1053 $data = $this->currentModule->data->getReferersNewsletters(0, $max); 1054 $numbers = $this->currentModule->data->getReferersNumbers(); 1055 //$numbers.newsletters 1056 $ret = $this->setDisplayDataArray("newsletters", "affluents_newsletters", $data, "affluents_aucunnewsletter", "affluents_nbnewsletters", $numbers["newsletters"]); 1057 1058 if (($ret > 0) && ($showInterest)) { 1059 $dataInterest = $this->currentModule->data->getReferersNewslettersInterest(0, $max); 1060 $this->setDisplayDataArrayInterest("newsletters", "affluents_interetsnewsletters", $dataInterest); 1061 } 1062 } 1063 1064 function setReferersDirect() { 1065 $numbers = $this->currentModule->data->getReferersNumbers(); 1066 $this->setTitleChapter("affluents_entreedirecte", "view_referers#a7"); 1067 $this->setLineInfoText("affluents_nbentreedirecte", $numbers["direct"]); 1068 $this->Ln(); 1069 } 1070 1071 //********************************************************** 1072 // 1073 // TODO Visitor movement 1074 // 1075 //********************************************************** 1076 1077 function setVisitsTimeVisitsGraph() { 1078 $this->setPmvGraph(2, "visits_time", "visites_graphtempsvisites"); 1079 $this->Ln(); 1080 } 1081 1082 function setVisitsPeriodSummariesGraph() { 1083 $this->setPmvGraph(1, "visits_period_summaries", "visites_grapghrecap"); 1084 $this->Ln(); 1085 } 1086 1087 function setVisitsAllPeriodSummaryGraph() { 1088 $this->setPmvGraph(1, "visits_all_period_summary", "visites_grapghrecaplongterm"); 1089 $this->Ln(); 1090 } 1091 1092 function setVisitsServerTimeGraph() { 1093 $this->setPmvGraph(2, "visits_server_time", "visites_graphheureserveur"); 1094 $this->Ln(); 1095 } 1096 1097 function setVisitsLocalTimeGraph() { 1098 $this->setPmvGraph(2, "visits_local_time", "visites_graphheurevisiteur"); 1099 $this->Ln(); 1100 } 1101 1102 function setVisitsPeriodSummaries() { 1103 $zoom = $this->currentModule->data->getVisitsPeriodSummaries(); 1104 if ($this->period == 1) { 1105 $w = array (20, 20); 1106 } 1107 elseif ($this->period == 2) { 1108 $w = array (20, 20); 1109 } 1110 elseif ($this->period == 3) { 1111 $w = array (20, 18.5); 1112 } else { 1113 $w = array (20, 20); 1114 } 1115 1116 $mod = "notrss"; 1117 $this->setTitleChapter("visites_recapperiode", "view_visits#a2"); 1118 1119 // Table header 1120 $this->setStyleTitleTab(); 1121 $zz = 0; 1122 $tabCellHeader[$zz ++] = new TabCell(" "); 1123 foreach ($zoom as $key => $info) { 1124 $w[$zz] = $w[1]; 1125 $tabCellHeader[$zz ++] = new TabCell($info["date"], "LTBR", "", "C", 1, "setStyleTitleTab"); 1126 } 1127 1128 $xCenter = $this->getXCenter($w); 1129 $tabHeight = $this->GetTitleRowHeight($tabCellHeader, $w); 1130 $this->setTabLine($tabCellHeader, $xCenter, $w, $tabHeight); 1131 1132 $this->setStyleLineCategory(); 1133 $zz = 0; 1134 //TabCell($p_text = "", $p_border = "", $p_ln = 0, $p_align = "C", $p_fill = "", $p_styleFct = PDF_DEFAULT_STYLE, $p_url = "") 1135 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_nbvisites"), "LTBR", "", "C", 1, "setStyleLineCategory"); 1136 $this->setStyleLinePage(); 1137 foreach ($zoom as $key => $info) { 1138 if ($info["visits"] == 0) { 1139 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_aucunevivisite"), "LTBR", "", "C", 1, "setStyleLinePage"); 1140 } else { 1141 $tabCell[$zz ++] = new TabCell($info["visits_percent"]."xxx(".$info["visits"].")", "LTBR", "", "C", 1, $this->getStylePercent($info["visits_percent"])); 1142 } 1143 1144 } 1145 $this->setTabLine($tabCell, $xCenter, $w, null, PDF_TAB_SUM_PERIOD); 1146 1147 $this->setStyleLineCategory(); 1148 $zz = 0; 1149 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_pagesvues"), "LTBR", "", "C", 1, "setStyleLineCategory"); 1150 $this->setStyleLinePage(); 1151 foreach ($zoom as $key => $info) { 1152 if ($info["visits"] == 0) { 1153 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_aucunevivisite"), "LTBR", "", "C", 1, "setStyleLinePage"); 1154 } else { 1155 $tabCell[$zz ++] = new TabCell($info["pages_percent"]."xxx(".$info["pages"].")", "LTBR", "", "C", 1, $this->getStylePercent($info["pages_percent"])); 1156 } 1157 1158 } 1159 $this->setTabLine($tabCell, $xCenter, $w, null, PDF_TAB_SUM_PERIOD); 1160 $this->Ln(); 1161 } 1162 1163 function setVisitsStatistics() { 1164 $zoom = $this->currentModule->data->getVisitsStatistics(); 1165 $w = array (45, 15); 1166 $mod = "notrss"; 1167 $this->setTitleChapter("visites_statistiques", "view_visits#a1"); 1168 1169 $xCenter = $this->getXCenter($w); 1170 1171 // Table header 1172 $this->SetX($xCenter); 1173 $this->setStyleTitleTab(); 1174 $this->Cell($w[0] + $w[1], PDF_DEFAULT_ROW_HEIGHT, $this->pmvTranslate("visites_periodesel"), "LTBR", "", "C", 1); 1175 $this->Ln(); 1176 1177 $zz = 0; 1178 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_visites"), "LTBR", "", "C", 1, "setStyleLinePage"); 1179 $tabCell[$zz ++] = new TabCell($zoom["nb_vis"], "LTBR", "", "C", 1, "setStyleLineCategory"); 1180 $this->setTabLine($tabCell, $xCenter, $w); 1181 1182 $zz = 0; 1183 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_uniques"), "LTBR", "", "C", 1, "setStyleLinePage"); 1184 $tabCell[$zz ++] = new TabCell($zoom["nb_uniq_vis"], "LTBR", "", "C", 1, "setStyleLineCategory"); 1185 $this->setTabLine($tabCell, $xCenter, $w); 1186 $zz = 0; 1187 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_pagesvues"), "LTBR", "", "C", 1, "setStyleLinePage"); 1188 $tabCell[$zz ++] = new TabCell($zoom["nb_pag"], "LTBR", "", "C", 1, "setStyleLineCategory"); 1189 $this->setTabLine($tabCell, $xCenter, $w); 1190 $zz = 0; 1191 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_pagesvisiteurs"), "LTBR", "", "C", 1, "setStyleLinePage"); 1192 $tabCell[$zz ++] = new TabCell(sprintf("%.1f", $zoom["nb_pag_per_vis"]), "LTBR", "", "C", 1, "setStyleLineCategory"); 1193 $this->setTabLine($tabCell, $xCenter, $w); 1194 $zz = 0; 1195 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_pagesvisitessign"), "LTBR", "", "C", 1, "setStyleLinePage"); 1196 $tabCell[$zz ++] = new TabCell(sprintf("%.1f", $zoom["nb_pag_per_vis_sig"]), "LTBR", "", "C", 1, "setStyleLineCategory"); 1197 $this->setTabLine($tabCell, $xCenter, $w); 1198 $zz = 0; 1199 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_tempsmoyen"), "LTBR", "", "C", 1, "setStyleLinePage"); 1200 $tabCell[$zz ++] = new TabCell($this->show_time_visit($zoom["time_per_vis"]), "LTBR", "", "C", 1, "setStyleLineCategory"); 1201 $this->setTabLine($tabCell, $xCenter, $w); 1202 $zz = 0; 1203 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_tempsmoyenpv"), "LTBR", "", "C", 1, "setStyleLinePage"); 1204 $tabCell[$zz ++] = new TabCell($this->show_time_visit($zoom["time_per_pag"]), "LTBR", "", "C", 1, "setStyleLineCategory"); 1205 $this->setTabLine($tabCell, $xCenter, $w); 1206 $zz = 0; 1207 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_tauxvisite"), "LTBR", "", "C", 1, "setStyleLinePage"); 1208 $tabCell[$zz ++] = new TabCell(sprintf("%.0f", $zoom["one_page_rate"])."%", "LTBR", "", "C", 1, "setStyleLineCategory"); 1209 $this->setTabLine($tabCell, $xCenter, $w); 1210 if (isset ($zoom["average_visits_per_day"])) { 1211 $zz = 0; 1212 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_average_visits_per_day"), "LTBR", "", "C", 1, "setStyleLinePage"); 1213 $tabCell[$zz ++] = new TabCell(sprintf("%d", $zoom["average_visits_per_day"]), "LTBR", "", "C", 1, "setStyleLineCategory"); 1214 $this->setTabLine($tabCell, $xCenter, $w); 1215 } 1216 $this->Ln(); 1217 } 1218 1219 function setFrequencyGraphNbVisitsPerVisitor() { 1220 $this->setPmvGraph(2, "visits_by_visitor", "pagesvues_vispervisgraph"); 1221 $this->Ln(); 1222 } 1223 1224 function setFrequencyGraphNewReturnVisits() { 1225 $this->setPmvGraph(5, "frequency_new_vs_returning", "frequence_nouveauxconnusgraph"); 1226 $this->Ln(); 1227 } 1228 1229 //********************************************************** 1230 // 1231 // TODO Frequency 1232 // 1233 //********************************************************** 1234 1235 function setFrequencyNewReturnVisits() { 1236 $zoom = $this->currentModule->data->getVisitsFrequencyStatistics(); 1237 $w = array (40, 30, 30); 1238 $this->setTitleChapter("frequence_nouveauxconnus", "view_frequency#a2"); 1239 1240 $xCenter = $this->getXCenter($w); 1241 1242 // Table header 1243 $zz = 0; 1244 $tabCell[$zz ++] = new TabCell(" ", "LTBR", "", "C", 1, "setStyleTitleTab"); 1245 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("frequence_visitesconnues"), "LTBR", "", "C", 1, "setStyleTitleTab"); 1246 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("frequence_nouvellesvisites"), "LTBR", "", "C", 1, "setStyleTitleTab"); 1247 $this->setTabLine($tabCell, $xCenter, $w); 1248 1249 $zz = 0; 1250 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_visites"), "LTBR", "", "", 1, "setStyleLinePage"); 1251 $tabCell[$zz ++] = new TabCell($zoom["nb_vis_returning"]." (".sprintf("%.0f", $zoom["nb_vis_returning_percent"])."%)", "LTBR", "", "C", 1, "setStyleLineCategory"); 1252 $tabCell[$zz ++] = new TabCell($zoom["nb_vis_new"]." (".sprintf("%.0f", $zoom["nb_vis_new_percent"])."%)", "LTBR", "", "C", 1, "setStyleLineCategory"); 1253 $this->setTabLine($tabCell, $xCenter, $w); 1254 $zz = 0; 1255 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_pagesvues"), "LTBR", "", "", 1, "setStyleLinePage"); 1256 $tabCell[$zz ++] = new TabCell($zoom["nb_pag_returning"]." (".sprintf("%.0f", $zoom["nb_pag_returning_percent"])."%)", "LTBR", "", "C", 1, "setStyleLineCategory"); 1257 $tabCell[$zz ++] = new TabCell($zoom["nb_pag_new"]." (".sprintf("%.0f", $zoom["nb_pag_new_percent"])."%)", "LTBR", "", "C", 1, "setStyleLineCategory"); 1258 $this->setTabLine($tabCell, $xCenter, $w); 1259 $zz = 0; 1260 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_pagesvisiteurs"), "LTBR", "", "", 1, "setStyleLinePage"); 1261 $tabCell[$zz ++] = new TabCell(sprintf("%.1f", $zoom["nb_pag_per_vis_returning"]), "LTBR", "", "C", 1, "setStyleLineCategory"); 1262 $tabCell[$zz ++] = new TabCell(sprintf("%.1f", $zoom["nb_pag_per_vis_new"]), "LTBR", "", "C", 1, "setStyleLineCategory"); 1263 $this->setTabLine($tabCell, $xCenter, $w); 1264 $zz = 0; 1265 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_tempsmoyen"), "LTBR", "", "", 1, "setStyleLinePage"); 1266 $tabCell[$zz ++] = new TabCell($this->show_time_visit($zoom["time_per_vis_returning"]), "LTBR", "", "C", 1, "setStyleLineCategory"); 1267 $tabCell[$zz ++] = new TabCell($this->show_time_visit($zoom["time_per_vis_new"]), "LTBR", "", "C", 1, "setStyleLineCategory"); 1268 $this->setTabLine($tabCell, $xCenter, $w); 1269 $zz = 0; 1270 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_tempsmoyenpv"), "LTBR", "", "", 1, "setStyleLinePage"); 1271 $tabCell[$zz ++] = new TabCell($this->show_time_visit($zoom["time_per_pag_returning"]), "LTBR", "", "C", 1, "setStyleLineCategory"); 1272 $tabCell[$zz ++] = new TabCell($this->show_time_visit($zoom["time_per_pag_new"]), "LTBR", "", "C", 1, "setStyleLineCategory"); 1273 $this->setTabLine($tabCell, $xCenter, $w); 1274 $zz = 0; 1275 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("visites_tauxvisite"), "LTBR", "", "", 1, "setStyleLinePage"); 1276 $tabCell[$zz ++] = new TabCell(sprintf("%.0f", $zoom["one_page_rate_returning"])."%", "LTBR", "", "C", 1, "setStyleLineCategory"); 1277 $tabCell[$zz ++] = new TabCell(sprintf("%.0f", $zoom["one_page_rate_new"])."%", "LTBR", "", "C", 1, "setStyleLineCategory"); 1278 $this->setTabLine($tabCell, $xCenter, $w); 1279 $this->Ln(); 1280 } 1281 1282 function setFrequencyStatistics() { 1283 $zoom = $this->currentModule->data->getVisitsFrequencyStatistics(); 1284 $w = array (45, 15); 1285 $this->setTitleChapter("visites_statistiques", "view_frequency#a1"); 1286 1287 $xCenter = $this->getXCenter($w); 1288 1289 // Table header 1290 $this->SetX($xCenter); 1291 $this->setStyleTitleTab(); 1292 $this->Cell($w[0] + $w[1], PDF_DEFAULT_ROW_HEIGHT, $this->pmvTranslate("visites_periodesel"), "LTBR", "", "C", 1, "setStyleTitleTab"); 1293 $this->Ln(); 1294 1295 $zz = 0; 1296 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("frequence_nouveauxvisiteurs"), "LTBR", "", "", 1, "setStyleLinePage"); 1297 $tabCell[$zz ++] = new TabCell($zoom["nb_uniq_vis_new"], "LTBR", "", "C", 1, "setStyleLinePage"); 1298 $this->setTabLine($tabCell, $xCenter, $w); 1299 $zz = 0; 1300 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("frequence_visiteursconnus"), "LTBR", "", "", 1, "setStyleLinePage"); 1301 $tabCell[$zz ++] = new TabCell($zoom["nb_uniq_vis_returning"], "LTBR", "", "C", 1, "setStyleLinePage"); 1302 $this->setTabLine($tabCell, $xCenter, $w); 1303 $zz = 0; 1304 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("frequence_returningrate"), "LTBR", "", "", 1, "setStyleLinePage"); 1305 $tabCell[$zz ++] = new TabCell(sprintf("%.0f", $zoom["returning_rate"])."%", "LTBR", "", "C", 1, "setStyleLinePage"); 1306 $this->setTabLine($tabCell, $xCenter, $w); 1307 $zz = 0; 1308 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("frequence_vispervis"), "LTBR", "", "", 1, "setStyleLinePage"); 1309 $tabCell[$zz ++] = new TabCell(sprintf("%.1f", $zoom["nb_vis_per_uniq_vis"])." ".$this->pmvTranslate("frequence_vis"), "LTBR", "", "C", 1, "setStyleLinePage"); 1310 $this->setTabLine($tabCell, $xCenter, $w); 1311 $this->Ln(); 1312 1313 } 1314 1315 //********************************************************** 1316 // 1317 // TODO FollowUp 1318 // 1319 //********************************************************** 1320 1321 function setFollowUpSinglePages($all = true) { 1322 $zoom = $this->currentModule->data->getFollowUpZoom(""); 1323 $w = array (140, 30); 1324 $this->setTitleChapter("suivi_singlepage", "view_followup#a3"); 1325 1326 $xCenter = $this->getXCenter($w); 1327 1328 // Table header 1329 $this->setStyleTitleTab(); 1330 $zz = 0; 1331 $tabCell[$zz ++] = new TabCell(" ", ""); 1332 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("generique_hits"), "LTBR", "", "C", 1, "setStyleTitleTab"); 1333 $this->setTabLine($tabCell, $xCenter, $w); 1334 1335 if ($all == true) { 1336 $this->setPagesZoomDetail("singlepage", $zoom, $w, "getFollowUpZoom"); 1337 } else { 1338 $this->setPagesZoomDetail("singlepage", $zoom, $w, ""); 1339 } 1340 $this->Ln(); 1341 } 1342 1343 /** 1344 * Set follow up exit page table 1345 * 1346 * @param $period 1347 * @param $idtouse 1348 * @param $zoom 1349 * @param $w 1350 * @param $allPage 1351 */ 1352 function setFollowUpExitPages($all = true) { 1353 $zoom = $this->currentModule->data->getFollowUpZoom(""); 1354 $w = array (110, 30, 30); 1355 $this->setTitleChapter("suivi_pagesortie", "view_followup#a2"); 1356 1357 $xCenter = $this->getXCenter($w); 1358 1359 // Table header 1360 $this->setStyleTitleTab(); 1361 $zz = 0; 1362 $tabCell[$zz ++] = new TabCell(" ", ""); 1363 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("suivi_pagesortiehits"), "LTBR", "", "C", 1, "setStyleTitleTab"); 1364 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("suivi_tauxsortie"), "LTBR", "", "C", 1, "setStyleTitleTab"); 1365 $this->setTabLine($tabCell, $xCenter, $w); 1366 1367 if ($all) { 1368 $this->setPagesZoomDetail("exit", $zoom, $w, "getFollowUpZoom"); 1369 } else { 1370 $this->setPagesZoomDetail("exit", $zoom, $w, ""); 1371 } 1372 1373 $this->Ln(); 1374 } 1375 1376 // Follow up entry pages 1377 function setFollowUpEntryPages($all = true) { 1378 //echo "setFollowUpEntryPages : $all\n"; 1379 1380 $zoom = $this->currentModule->data->getFollowUpZoom(""); 1381 $w = array (140, 30); 1382 $this->setTitleChapter("suivi_pageentree", "view_followup#a1"); 1383 1384 $xCenter = $this->getXCenter($w); 1385 // Table header 1386 $this->setStyleTitleTab(); 1387 $zz = 0; 1388 $tabCell[$zz ++] = new TabCell(" ", ""); 1389 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("suivi_pageentreehits"), "LTBR", "", "C", 1, "setStyleTitleTab"); 1390 $this->setTabLine($tabCell, $xCenter, $w); 1391 1392 if ($all) { 1393 //echo "setFollowUpEntryPages : detail\n"; 1394 $this->setPagesZoomDetail("entry", $zoom, $w, "getFollowUpZoom"); 1395 } else { 1396 //echo "setFollowUpEntryPages : light\n"; 1397 $this->setPagesZoomDetail("entry", $zoom, $w, ""); 1398 } 1399 $this->Ln(); 1400 } 1401 1402 //********************************************************** 1403 // 1404 // TODO Pages View 1405 // 1406 //********************************************************** 1407 1408 function setPagesZoomTpsParPage($all = true) { 1409 $zoom = $this->currentModule->data->getPagesZoom(""); 1410 $w = array (110, 30, 30); 1411 $this->setTitleChapter("pagesvues_tempsparpage", "view_pages#a2"); 1412 1413 $xCenter = $this->getXCenter($w); 1414 1415 // Header table 1416 $this->setStyleTitleTab(); 1417 $zz = 0; 1418 $tabCell[$zz ++] = new TabCell(" ", ""); 1419 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("pagesvues_total_time"), "LTBR", "", "C", 1, "setStyleTitleTab"); 1420 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("pagesvues_avg_time"), "LTBR", "", "C", 1, "setStyleTitleTab"); 1421 $this->setTabLine($tabCell, $xCenter, $w); 1422 if ($all) { 1423 $this->setPagesZoomDetail("sumtime", $zoom, $w, "getPagesZoom"); 1424 } else { 1425 $this->setPagesZoomDetail("sumtime", $zoom, $w, ""); 1426 } 1427 $this->Ln(); 1428 } 1429 1430 function setPagesZoomTab2($all = true) { 1431 $zoom = $this->currentModule->data->getPagesZoom(""); 1432 $w = array (80, 30, 30, 30); 1433 $this->setTitleChapter("pagesvues_pagesvues", "view_pages#a1"); 1434 1435 if ($all) { 1436 $this->setPagesZoomDetail("sum", $zoom, $w, "getPagesZoom"); 1437 } else { 1438 $this->setPagesZoomDetail("sum", $zoom, $w, ""); 1439 } 1440 $this->Ln(); 1441 } 1442 1443 function setPagesZoomDetail($idtouse, $zoom, $w, $allPage = "", $indent = 0) { 1444 $strIndent = ""; 1445 for ($i = 0; $i < $indent; $i ++) { 1446 $strIndent .= " "; 1447 } 1448 1449 $xCenter = $this->getXCenter($w); 1450 1451 foreach ($zoom[$idtouse][1] as $key => $info) { 1452 $zz = 0; 1453 // Test page position 1454 if (($this->GetY() + PDF_DEFAULT_ROW_HEIGHT) > PDF_DEFAULT_MAX_Y) { 1455 $this->AddPage(); 1456 } 1457 if (!($info["type"] == "file" && $idtouse != "sum")) { 1458 if ($info["type"] == "category") { 1459 $styleTxt = "setStyleLineCategory"; 1460 //class="cate" 1461 //onclick="loadPagesDetails("{$url_pages_details}&mod=view_pages_details&idtouse={$idtouse}&c_id_zoom={$info.id}", this);" 1462 } else { 1463 $styleTxt = "setStyleLinePage"; 1464 } 1465 1466 if (sizeof($info["vars"]) != 0 && $idtouse == "sum") { 1467 //Montrer les variables 1468 //onclick="displayVariables( findNextWithType( this.firstChild, "TD"));" 1469 1470 } 1471 1472 if ($info["type"] == "category") { 1473 //<img src="./themes/default/images/groupa.gif"> 1474 //$this->Image("./themes/default/images/groupa.gif"); 1475 } 1476 1477 $infoData = str_replace("&", "&", $info["data"]); 1478 if ($info["type"] == "category") { 1479 if ($this->direction == "rtl") { 1480 $infoData = $infoData." +"; 1481 } else { 1482 $infoData = "+ ".$infoData; 1483 } 1484 } 1485 1486 //{$info.data|truncate:65:"..."} 1487 $tabCell[$zz ++] = new TabCell($this->truncate($strIndent.$infoData, 50, "..."), "LTBR", "", "L", 0, $styleTxt, "", $info["type"]); 1488 1489 if ($info["type"] == "file") { 1490 //<img src="./themes/default/images/download.png"> 1491 } 1492 1493 // {if sizeof($info.vars) != 0 && $idtouse == "sum"} 1494 // 1495 // <span style="cursor: pointer;color:red;font-size: x-small; vertical-align: 50%;" onmouseover="pointer(this)" 1496 // {if $info.type == "category"}onclick="displayVariables( this.parentNode );"{/if}> 1497 // + 1498 // </span> 1499 // 1500 // <div style="display: none;"> 1501 // <table cellspacing=0 align="right" id="variables"> 1502 // <th colspan="2"> 1503 // {"generique_variables"|pmvTranslate} 1504 // </th> 1505 // {foreach from=$info.vars key=var_name item=a_var} 1506 // <tr><td colspan="2" class="header">{$var_name}</td></tr> 1507 // {foreach from=$a_var key=var_value item=var_count} 1508 // <tr><td class="data">{$var_value}</td><td class="nb"> {$var_count}</td></tr> 1509 // {/foreach} 1510 // {/foreach} 1511 // </table> 1512 // </div> 1513 // {/if} 1514 1515 //<td width="15%" class="acenter {if $idtouse == "sum" || $idtouse == "exit" || $idtouse == "sumtime"}wrb{/if} {if $cwtb==1}wtb{/if}" id="c{$idtouse}{$info.id}"> 1516 if ($idtouse == "sumtime") { 1517 //{$info.$idtouse|time} 1518 $tabCell[$zz ++] = new TabCell($this->show_time($info[$idtouse]), "LTBR", "", "C", 0, $styleTxt, "", $info["type"]); 1519 } else { 1520 //{$info.$idtouse} 1521 $tabCell[$zz ++] = new TabCell($info[$idtouse], "LTBR", "", "C", 0, $styleTxt, "", $info["type"]); 1522 } 1523 1524 if ($idtouse == "sum") { 1525 //<td width="15%" class="acenter {if $cwtb==1}wtb{/if} wrb" >{$info.percentn1|print_percent} <small>({$info.sumn1})</small></td> 1526 $tabCell[$zz ++] = new TabCell($this->show_percent($info["percentn1"])." (".$info["sumn1"].")", "LTBR", "", "C", 0, $styleTxt, "", $info["type"]); 1527 //<td width="15%" class="acenter {if $cwtb==1}wtb{/if}">{$info.percentn2|print_percent} <small>({$info.sumn2})</small></td> 1528 $tabCell[$zz ++] = new TabCell($this->show_percent($info["percentn2"])." (".$info["sumn2"].")", "LTBR", "", "C", 0, $styleTxt, "", $info["type"]); 1529 } 1530 if ($idtouse == "exit") { 1531 //<td width="15%" class="acenter {if $cwtb==1}wtb{/if}">{$info.exitrate|string_format:"%.2f"} %</td> 1532 $tabCell[$zz ++] = new TabCell(sprintf("%.2f", $info["exitrate"])." %", "LTBR", "", "C", 0, $styleTxt, "", $info["type"]); 1533 } 1534 if ($idtouse == "sumtime") { 1535 //<td width="15%" class="acenter {if $cwtb==1}wtb{/if}">{$info.avgtime|time}</td> 1536 $tabCell[$zz ++] = new TabCell($this->show_time($info["avgtime"]), "LTBR", "", "C", 0, $styleTxt, "", $info["type"]); 1537 } 1538 1539 $this->setTabLine($tabCell, $xCenter, $w, null, PDF_TAB_PAGE_ZOOM); 1540 1541 if (($info["type"] == "category") && ($allPage != "")) { 1542 $zoomFils = call_user_func(array ($this->currentModule->data, $allPage), $info["id"]); 1543 //$zoomFils = $this->currentModule->data->getPagesZoom($info["id"]); 1544 $this->setPagesZoomDetail($idtouse, $zoomFils, $w, $allPage, $indent +1); 1545 } 1546 1547 } 1548 } // end for 1549 } 1550 1551 //setPagesVuesTab1 1552 function setPagesZoomTab1() { 1553 $zoom = $this->currentModule->data->getPagesZoom(""); 1554 $w = array (80, 30, 30, 30); 1555 $idtouse = "sum"; 1556 $period = $this->period; 1557 1558 $xCenter = $this->getXCenter($w); 1559 1560 $this->setStyleTitleTab(); 1561 1562 if ($period == 1) { 1563 $borderLine1 = "LTR"; 1564 $borderLine2 = "LRB"; 1565 // Header table 1566 $zz = 0; 1567 $tabCell[$zz ++] = new TabCell(" ", ""); 1568 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("pagesvues_joursel"), $borderLine1, "", "C", 1, "setStyleTitleTab"); 1569 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("pagesvues_jmoins7"), $borderLine1, "", "C", 1, "setStyleTitleTab"); 1570 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("pagesvues_jmoins14"), $borderLine1, "", "C", 1, "setStyleTitleTab"); 1571 $this->setTabLine($tabCell, $xCenter, $w); 1572 $this->SetFont($this->phpmvFont, "", 7); 1573 $txtBefore = "("; 1574 $txtAfter = ")"; 1575 } else { 1576 $borderLine1 = "LTRB"; 1577 $borderLine2 = "LTRB"; 1578 $txtBefore = ""; 1579 $txtAfter = ""; 1580 } 1581 1582 $zz = 0; 1583 $tabCell[$zz ++] = new TabCell(" ", ""); 1584 $tabCell[$zz ++] = new TabCell($txtBefore.$zoom[$idtouse][0][0].$txtAfter, $borderLine2, "", "C", 1, "setStyleTitleTab"); 1585 $tabCell[$zz ++] = new TabCell($txtBefore.$zoom[$idtouse][0][1].$txtAfter, $borderLine2, "", "C", 1, "setStyleTitleTab"); 1586 $tabCell[$zz ++] = new TabCell($txtBefore.$zoom[$idtouse][0][2].$txtAfter, $borderLine2, "", "C", 1, "setStyleTitleTab"); 1587 $this->setTabLine($tabCell, $xCenter, $w); 1588 1589 // Lines 1590 $this->setStyleLinePage(); 1591 1592 $zz = 0; 1593 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("pagesvues_pagesvues"), "LTRB", "", "C"); 1594 $tabCell[$zz ++] = new TabCell($zoom[$idtouse][2][0]["nb_pag"], "LTRB", "", "C"); 1595 $tabCell[$zz ++] = new TabCell($zoom[$idtouse][2][1]["nb_pag"], "LTRB", "", "C"); 1596 $tabCell[$zz ++] = new TabCell($zoom[$idtouse][2][2]["nb_pag"], "LTRB", "", "C"); 1597 $this->setTabLine($tabCell, $xCenter, $w); 1598 1599 $zz = 0; 1600 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("pagesvues_pagesvudiff"), "LTRB", "", "C"); 1601 $tabCell[$zz ++] = new TabCell($zoom[$idtouse][2][0]["nb_uniq_pag"], "LTRB", "", "C"); 1602 $tabCell[$zz ++] = new TabCell($zoom[$idtouse][2][1]["nb_uniq_pag"], "LTRB", "", "C"); 1603 $tabCell[$zz ++] = new TabCell($zoom[$idtouse][2][2]["nb_uniq_pag"], "LTRB", "", "C"); 1604 $this->setTabLine($tabCell, $xCenter, $w); 1605 1606 $zz = 0; 1607 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("pagesvues_recordpages"), "LTRB", "", "C"); 1608 $tabCell[$zz ++] = new TabCell($zoom[$idtouse][2][0]["nb_max_pag"], "LTRB", "", "C"); 1609 $tabCell[$zz ++] = new TabCell($zoom[$idtouse][2][1]["nb_max_pag"], "LTRB", "", "C"); 1610 $tabCell[$zz ++] = new TabCell($zoom[$idtouse][2][2]["nb_max_pag"], "LTRB", "", "C"); 1611 $this->setTabLine($tabCell, $xCenter, $w); 1612 $this->Ln(); 1613 1614 } 1615 // Show graph pages_by_visit 1616 function setPagesByVisitGraph() { 1617 $this->setPmvGraph(2, "pages_by_visit", "pagesvues_graphsnbpages"); 1618 $this->Ln(); 1619 } 1620 1621 //********************************************************** 1622 // 1623 // TODO Site summary 1624 // 1625 //********************************************************** 1626 1627 function setSitesSummaryStatistics() { 1628 $data = $this->currentModule->data->getSitesSummaryStatistics(); 1629 $w = array (50, 20, 20, 20, 25, 25); 1630 1631 $this->Ln(); 1632 // Table header 1633 $this->setStyleTitleTab(); 1634 1635 //$tabCell = new aray(); 1636 //$tabCell[0] = new TabCell("", "", 0, "C", "1", "setStyleTitleTab"); 1637 $zz = 0; 1638 $tabCellHead[$zz ++] = new TabCell($this->pmvTranslate("generique_site"), "1", 0, "C", "1", "setStyleTitleTab"); 1639 $tabCellHead[$zz ++] = new TabCell($this->pmvTranslate("visites_visites"), "1", 0, "C", "1", "setStyleTitleTab"); 1640 $tabCellHead[$zz ++] = new TabCell($this->pmvTranslate("visites_pagesvues"), "1", 0, "C", "1", "setStyleTitleTab"); 1641 $tabCellHead[$zz ++] = new TabCell($this->pmvTranslate("visites_pagesvisiteurs"), "1", 0, "C", "1", "setStyleTitleTab"); 1642 $tabCellHead[$zz ++] = new TabCell($this->pmvTranslate("visites_tempsmoyen"), "1", 0, "C", "1", "setStyleTitleTab"); 1643 $tabCellHead[$zz ++] = new TabCell($this->pmvTranslate("visites_tauxvisite"), "1", 0, "C", "1", "setStyleTitleTab"); 1644 1645 $xCenter = $this->getXCenter($w); 1646 $tabHeight = $this->GetTitleRowHeight($tabCellHead, $w); 1647 $this->setTabLine($tabCellHead, $xCenter, $w, $tabHeight); 1648 1649 $this->setStyleLinePage(); 1650 foreach ($data["sites_info"] as $key => $info) { 1651 // Test page position 1652 if (($this->GetY() + PDF_DEFAULT_ROW_HEIGHT) > PDF_DEFAULT_MAX_Y) { 1653 $this->AddPage(); 1654 $this->setTabLine($tabCellHead, $xCenter, $w, $tabHeight); 1655 } 1656 //$this->Cell($w[0], PDF_DEFAULT_ROW_HEIGHT, " ", ""); 1657 $zz = 0; 1658 $tabCell[$zz ++] = new TabCell($info["site_name"], "LTBR", 0, "L", 0); 1659 $tabCell[$zz ++] = new TabCell($info["nb_vis"], "LTBR", 0, "C", 0); 1660 $tabCell[$zz ++] = new TabCell($info["nb_pag"], "LTBR", 0, "C", 0); 1661 $tabCell[$zz ++] = new TabCell(sprintf("%.1f", $info["nb_pag_per_vis"]), "LTBR", 0, "C", 0); 1662 $tabCell[$zz ++] = new TabCell($this->show_time_visit($info["time_per_vis"]), "LTBR", 0, "C", 0); 1663 $tabCell[$zz ++] = new TabCell(sprintf("%.0f", $info["one_page_rate"])." %", "LTBR", 0, "C", 0); 1664 $this->setTabLine($tabCell, $xCenter, $w); 1665 } 1666 $this->setStyleLineCategory(); 1667 $info = $data["total"]; 1668 // Test page position 1669 if (($this->GetY() + PDF_DEFAULT_ROW_HEIGHT) > PDF_DEFAULT_MAX_Y) { 1670 $this->AddPage(); 1671 } 1672 1673 $zz = 0; 1674 $tabCell[$zz ++] = new TabCell($this->pmvTranslate("generique_total"), "LTBR", 0, "L", 0, "setStyleLineCategory"); 1675 $tabCell[$zz ++] = new TabCell($info["nb_vis"], "LTBR", 0, "C", 0, "setStyleLineCategory"); 1676 $tabCell[$zz ++] = new TabCell($info["nb_pag"], "LTBR", 0, "C", 0, "setStyleLineCategory"); 1677 $tabCell[$zz ++] = new TabCell(sprintf("%.1f", $info["nb_pag_per_vis"]), "LTBR", 0, "C", 0, "setStyleLineCategory"); 1678 $tabCell[$zz ++] = new TabCell($this->show_time_visit($info["time_per_vis"]), "LTBR", 0, "C", 0, "setStyleLineCategory"); 1679 $tabCell[$zz ++] = new TabCell(sprintf("%.0f", $info["one_page_rate"])." %", "LTBR", 0, "C", 0, "setStyleLineCategory"); 1680 $this->setTabLine($tabCell, $xCenter, $w); 1681 //$this->Ln(); 1682 } 1683 1684 function setNewPage($keyTitle = "") { 1685 if ($keyTitle != "") { 1686 $this->titrePage1 = $keyTitle; 1687 $this->AddPage(); 1688 } 1689 } 1690 1691 function setPersonalChapter($key = "") { 1692 if ($key != "") { 1693 $this->setTitleChapter($key); 1694 } 1695 } 1696 1697 function setPageBreak() { 1698 $this->AddPage(); 1699 } 1700 1701 function setPageSummary($paramShowPdf, $confShowPdf, $pdfLink, $firstPageOk) { 1702 // Generate summary link 1703 $this->setStyleSummaryLink(); 1704 foreach ($paramShowPdf as $keyTab => $info) { 1705 $key = $info[PDF_INDEX_KEY]; 1706 if ($key == "PG0") { 1707 /* 1708 $this->titrePage1 = "summary_title"; 1709 $this->AddPage(); 1710 $firstPageOk = true; 1711 $this->setSitesSummaryStatistics(); 1712 $this->Ln(); 1713 */ 1714 //$pdf->Cell(80, PDF_DEFAULT_ROW_HEIGHT, "test PG0", "0", "", "L", 0); 1715 1716 // Summary Link 1717 // $this->setStyleSummaryLink(); 1718 } else 1719 if (isset ($confShowPdf[$key]["PAG"])) { 1720 if (!$firstPageOk) { 1721 $this->AddPage(); 1722 $this->setStyleSummaryLink(); 1723 $firstPageOk = true; 1724 } 1725 $this->SetX(50); 1726 if (isset ($info[PDF_INDEX_AUTRE])) { 1727 $lib = $info[PDF_INDEX_AUTRE]; 1728 } else { 1729 $lib = $confShowPdf[$key]["TIT"]; 1730 } 1731 $this->Cell(80, PDF_DEFAULT_ROW_HEIGHT, $this->pmvTranslate($lib), "0", "", "L", 0, $pdfLink[$key]); 1732 $this->Ln(); 1733 } 1734 } 1735 return $firstPageOk; 1736 1737 } 1738 1739 function setErrorMessage ($txt) { 1740 $this->Ln(); 1741 $this->Ln(); 1742 $this->SetFont($this->phpmvFont, "", 14); 1743 $this->SetTextColor(255, 0, 0); 1744 $w = $this->GetStringWidth($txt) + 6; 1745 $this->SetX((210 - $w) / 2); 1746 $this->Cell($w, 8, $txt, "", 0, "C", 0); 1747 $this->Ln(); 1748 $this->Ln(); 1749 } 1750 1751 } // end class GenerePDF 1752 1753 class ViewPdfV2 extends ViewModule { 1754 1755 function ViewPdfV2() { 1756 parent :: ViewModule("pdf"); 1757 } 1758 1759 function process() { 1760 1761 } 1762 1763 // FOR TEST ONY : Show all info in datamodel 1764 function afficheInfo($infoAff, $indentAff, $debCle, $curKey) { 1765 $ret = ""; 1766 1767 $indentStr = " "; 1768 for ($i = 0; $i < $indentAff; $i += 1) { 1769 $indentStr = $indentStr." "; 1770 } 1771 if (gettype($infoAff) == "array") { 1772 foreach ($infoAff as $key1 => $info1) { 1773 $ret .= $indentStr." cle : ".$key1."<br>"; 1774 $ret .= $this->afficheInfo($info1, $indentAff +1, $debCle.".".$key1, $key1); 1775 if (($key1 == "type") && ($info1 == "category")) { 1776 //echo "xxxxx : " . $infoAff["id"]; 1777 $zoom2 = $this->data->getPagesZoom($infoAff["id"]); 1778 $ret .= $this->afficheInfo($zoom2, $indentAff +3, $debCle.".[".$infoAff["id"]."]", ""); 1779 } 1780 } 1781 } else { 1782 if ($curKey == "data") { 1783 $ret .= $indentStr.$debCle." : <b>".$infoAff."</b>"; 1784 } else { 1785 $ret .= $indentStr.$debCle." : ".$infoAff; 1786 } 1787 1788 $ret .= "<br>"; 1789 } 1790 return $ret; 1791 } 1792 1793 function display() { 1794 $viewAllDetail = false; 1795 $paramAll = getRequestVar('all', 0, 'int'); 1796 if ($paramAll == 1) { 1797 $viewAllDetail = true; 1798 } 1799 1800 $period = $this->request->getPeriod(); 1801 $idSite = $this->request->getSiteId(); 1802 $idSite = getRequestVar('site', -1, 'int'); 1803 $idPdf = getRequestVar('idPdf', -2, 'int'); 1804 1805 //$pdf = new GenerePDF("P", "mm"); 1806 $pdf = new GenerePDF('P', 'mm', 'A4', true, "UTF-8"); 1807 // patch by HonestQiao 1808 if($GLOBALS['lang']['lang_iso']=='zh'){ 1809 $pdf->phpmvFont = "GB"; 1810 $pdf->AddGBFont(); 1811 } 1812 // patch by HonestQiao 1813 if (isset ($GLOBALS["lang"]["text_dir"])) { 1814 $pdf->direction = $GLOBALS["lang"]["text_dir"]; 1815 } else { 1816 $pdf->direction = "ltr"; 1817 } 1818 // ENGLISH 1819 /* SPECIFIC TCPDF 1820 $l = Array(); 1821 1822 // PAGE META DESCRIPTORS -------------------------------------- 1823 1824 $l['a_meta_charset'] = "UTF-16"; 1825 $l['a_meta_dir'] = $pdf->direction; 1826 $l['a_meta_language'] = "jp"; 1827 1828 // TRANSLATIONS -------------------------------------- 1829 $l['w_page'] = "page"; 1830 1831 $pdf->setLanguageArray($l); //set language items 1832 */ 1833 // fin specifique TCPDF 1834 1835 // 1836 $pdf->currentModule = $this; 1837 if ($idSite > 0) { 1838 $site = new Site($idSite); 1839 $pdf->currentSite = $site; 1840 } else { 1841 $pdf->currentSite = null; 1842 } 1843 $pdf->period = $period; 1844 $pdf->date = $this->request->getDate(); 1845 $pdf->literalDate = getLiteralDate($period, $this->request->getDate()); 1846 1847 1848 // Set PDF propertes data 1849 if ($idSite != -1) { 1850 $titre = "Statistics of ".$site->getName(); 1851 } else { 1852 $titre = $pdf->pmvTranslate("summary_title"); 1853 } 1854 $pdf->SetTitle($titre); 1855 $pdf->SetAuthor("phpMyVisites"); 1856 $pdf->SetCreator($pdf->pmvTranslate("head_titre")); 1857 $pdf->SetKeywords($pdf->pmvTranslate("head_keywords")); 1858 $pdf->SetSubject($pdf->pmvTranslate("logo_description")); 1859 1860 $pdf->SetFont($pdf->phpmvFont, "", 8); 1861 $pdf->SetLineWidth(0.1); 1862 1863 $firstPageOk = false; 1864 1865 if ($idSite <= 0) { 1866 // ******************************************************* 1867 // Sites Summary 1868 // ******************************************************* 1869 $pdf->titrePage1 = "summary_title"; 1870 $pdf->AddPage(); 1871 $firstPageOk = true; 1872 1873 $pdf->setSitesSummaryStatistics(); 1874 $pdf->Ln(); 1875 } else { 1876 $zoom = $this->data->getVisitsStatistics(); 1877 if (!isset ($zoom["nb_vis"])) { 1878 $pdf->titrePage1 = "summary_title"; 1879 $pdf->AddPage(); 1880 $firstPageOk = true; 1881 $txtNoVisit = $pdf->pmvTranslate("aucunvisiteur_titre"); 1882 $pdf->setErrorMessage($txtNoVisit); 1883 } else { 1884 1885 $confPf = new PdfConfigDb($idSite, true); 1886 if ($idPdf == -2) { // No PDF 1887 // Get default site pdf 1888 $idPdf = $site->getIdPdf(); 1889 } 1890 1891 $paramShowPdf = $confPf->getPdf($idPdf); 1892 if ($paramShowPdf == null) { 1893 //print("take defaut<br>"); 1894 $paramShowPdf = $confPf->getDefaultPdf(); 1895 } else { 1896 $paramShowPdf = $paramShowPdf->pdfParam; 1897 } 1898 $confShowPdf = $confPf->getChoixPdf(); 1899 1900 $pdfLink = array (); 1901 // Create all links object 1902 foreach ($paramShowPdf as $keyTab => $info) { 1903 $key = $info[PDF_INDEX_KEY]; 1904 if ($key == "PG0") { 1905 1906 } 1907 elseif (isset ($confShowPdf[$key]["PAG"])) { 1908 $pdfLink[$key] = $pdf->AddLink(); 1909 } 1910 } 1911 1912 //$pdf->Cell(80, PDF_DEFAULT_ROW_HEIGHT, "test", "0", "", "L", 0); 1913 // Generate page 1914 foreach ($paramShowPdf as $keyTab => $info) { 1915 $key = $info[PDF_INDEX_KEY]; 1916 if ($key == "PG0") { 1917 $pdf->titrePage1 = "summary_title"; 1918 $pdf->AddPage(); 1919 $firstPageOk = true; 1920 $pdf->setSitesSummaryStatistics(); 1921 $pdf->Ln(); 1922 } 1923 elseif ($key == "SUM") { 1924 $firstPageOk = $pdf->setPageSummary($paramShowPdf, $confShowPdf, $pdfLink, $firstPageOk); 1925 } 1926 elseif (isset ($confShowPdf[$key]["PAG"])) { 1927 if (isset ($info[PDF_INDEX_AUTRE])) { 1928 $lib = $info[PDF_INDEX_AUTRE]; 1929 } else { 1930 $lib = $confShowPdf[$key]["TIT"]; 1931 } 1932 $pdf->titrePage1 = $lib; 1933 $pdf->AddPage(); 1934 $firstPageOk = true; 1935 $pdf->SetLink($pdfLink[$key]); 1936 } else { 1937 if (!$firstPageOk) { 1938 $pdf->AddPage(); 1939 $firstPageOk = true; 1940 } 1941 //echo "$key : PAR1 : ".$confShowPdf[$key]["PAR1"]." : ".$info[PDF_INDEX_AUTRE]."<br>"; 1942 //print("xx : z" . $key . "z : w" . $info . "w : " . $confShowPdf[$key]["FCT"] . "<br>"); 1943 //$pdf->$confShowPdf[$key]["FCT"]($info[0], $info[1]); 1944 if (($confShowPdf[$key]["INT"] == "true") && ($confShowPdf[$key]["ALL"] == "true")) { 1945 //echo "int all<br>"; 1946 $pdf-> $confShowPdf[$key]["FCT"] ($info[PDF_INDEX_ALL] == "true", $info[PDF_INDEX_INT] == "true"); 1947 } 1948 elseif ($confShowPdf[$key]["INT"] == "true") { 1949 //echo "int<br>"; 1950 $pdf-> $confShowPdf[$key]["FCT"] ($info[PDF_INDEX_INT] == "true"); 1951 } 1952 elseif ($confShowPdf[$key]["ALL"] == "true") { 1953 //echo "all<br>"; 1954 $pdf-> $confShowPdf[$key]["FCT"] ($info[PDF_INDEX_ALL] == "true"); 1955 } 1956 elseif ((isset ($confShowPdf[$key]["PAR1"])) && (isset ($info[PDF_INDEX_AUTRE]))) { 1957 //echo "PAR1<br>"; 1958 $pdf-> $confShowPdf[$key]["FCT"] ($info[PDF_INDEX_AUTRE]); 1959 } else { 1960 //echo "Vide<br>"; 1961 $pdf-> $confShowPdf[$key]["FCT"] (); 1962 } 1963 } 1964 } 1965 } 1966 } 1967 if (!$firstPageOk) { 1968 $pdf->AddPage(); 1969 $firstPageOk = true; 1970 } 1971 $pdf->Ln(15); 1972 $pdf->SetFont($pdf->phpmvFont, "I", 6); 1973 $pdf->SetTextColor(128); 1974 $twtTime = sprintf($pdf->pmvTranslate("generique_timefooter"), getTimeElapsed()); 1975 $w = $pdf->GetStringWidth($twtTime) + 6; 1976 $pdf->SetX((210 - $w) / 2); 1977 $pdf->Write(3, $twtTime); 1978 // ******************************************************* 1979 // Output PDF 1980 // ******************************************************* 1981 //echo "fin : " . $pdf->traceMsg; 1982 // stats-siteX.pdf 1983 $pdf->Output("stats-site$idSite.pdf", "D"); 1984 1985 } 1986 } 1987 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 14:10:01 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |