function process()
 {
     // general input
     $tmpImg = isset($this->valueLogo) && $this->valueLogo != 'pixel.gif' ? $this->valueLogo : '1.png';
     $formElements = array(array('text', 'form_name', $GLOBALS['lang']['admin_site_name'], 'value="' . str_replace('"', "'", $this->valueName) . '"'), array('text', 'form_url', $GLOBALS['lang']['admin_site_url'], 'value="' . $this->valueMainUrl . '"'), array('radio', 'form_logo', sprintf($GLOBALS['lang']['install_afficherlogo'], '<img alt="logo" name="logo_phpmv" src="' . DIR_IMG_LOGOS . '/' . $tmpImg . '"/> '), $GLOBALS['lang']['install_oui'] . '<br><br><a href="javascript:popup(\'index.php?mod=list_logos\');">-> ' . $GLOBALS['lang']['install_logodispo'] . '</a>', 'yes'), array('radio', 'form_logo', null, $GLOBALS['lang']['install_non'], 'no'), array('hidden', 'form_logo_no', $tmpImg));
     $this->addElements($formElements, 'General');
     // Prepare PDF list
     $listPdf = array();
     $listPdfOption = array();
     $listPdf["-1"] = $GLOBALS['lang']['admin_get_default_pdfdefault'];
     if (isset($this->siteAdmin)) {
         $pdfDb = new PdfConfigDb($this->siteAdmin);
         $tmpLstPdf = $pdfDb->getListPdf();
         foreach ($tmpLstPdf as $key => $info) {
             $listPdf[$key] = $info->pdfName . " (" . PARAM_URL_NEWSLETTER . "=" . $key . ")";
         }
     }
     // Get List of theme
     $dir = INCLUDE_PATH . "/themes/";
     $d = dir($dir);
     $arDir = array();
     while (false !== ($entry = $d->read())) {
         if (is_dir($dir . $entry) && $entry[0] != '.') {
             $arDir[$entry] = ucfirst($entry);
         }
     }
     $d->close();
     // optional input (relative to GET variable recording)
     $formElements = array(array('radio', 'form_params', $GLOBALS['lang']['admin_get_question'], $GLOBALS['lang']['admin_get_a1'], 'all'), array('radio', 'form_params', null, $GLOBALS['lang']['admin_get_a2'], 'none'), array('radio', 'form_params', null, $GLOBALS['lang']['admin_get_a3'], 'only'), array('radio', 'form_params', null, $GLOBALS['lang']['admin_get_a4'], 'except'), array('text', 'form_params_names', sprintf($GLOBALS['lang']['admin_get_list'], GET_LIST_EXAMPLE), 'value="' . $this->valueVariableNames . '"'), array('select', 'form_idpdf'), array('select', 'form_path_theme'));
     $this->addElements($formElements, $GLOBALS['lang']['install_utilisateursavances']);
     // Set list PDF with default value
     $s =& $this->createElement('select', 'form_idpdf', $GLOBALS['lang']['admin_get_default_pdf']);
     $s->loadArray($listPdf, $this->idPdf);
     // Default value
     $this->addElement($s);
     // Set list theme with default value
     $s =& $this->createElement('select', 'form_path_theme', $GLOBALS['lang']['admin_get_default_theme']);
     $s->loadArray($arDir, $this->pathTheme);
     // Default value
     $this->addElement($s);
     // set first radio checked for variables recording
     //$radio =& $this->getElement('form_params');
     //$radio->_attributes['checked'] = 'checked';
     $this->setChecked('form_params', $this->valueRecordGet);
     // set first radio checked for logo display
     $this->setChecked('form_logo', $this->valueLogo == 'pixel.gif' ? 'no' : 'yes');
     // validation rules
     $formRules = array(array('form_name', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['admin_site_name']), 'required'), array('form_url', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['admin_site_url']), 'required'), $this->getRuleCheckUrl('form_url'), array('form_logo', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['admin_logo_question']), 'required'), array('form_params', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['admin_get_question']), 'required'));
     $this->addRules($formRules);
     // launche process
     return parent::process('admin_configetperso');
 }
 function needAPdf($idSite)
 {
     $idPdf = getRequestVar('idPdf', false, 'int');
     if (!$idPdf) {
         $pdfDb = new PdfConfigDb($idSite);
         $this->tpl->assign('pdf_available', $pdfDb->getListPdf());
         $this->tpl->template = "admin/site_pdf_selection.tpl";
         $ret = false;
     } else {
         $ret = $idPdf;
     }
     return $ret;
 }
 function needConfirmation($type, $idDependOnType)
 {
     $confirmed = $this->request->getConfirmedState();
     if ($confirmed == 1) {
         return true;
     } else {
         switch ($type) {
             case 'site':
                 $o_site = new Site($idDependOnType);
                 $subStr = sprintf($GLOBALS['lang']['generique_siteno'], '<b>"' . $o_site->getName() . '"</b>');
                 break;
             case 'newsletter':
                 $subStr = sprintf($GLOBALS['lang']['generique_newsletterno'], '<b>"' . $this->site->getNewsletterName($idDependOnType) . '"</b>');
                 break;
             case 'partner':
                 $subStr = sprintf($GLOBALS['lang']['generique_partnerno'], '<b>"' . $this->site->getPartnerNameFromId($idDependOnType) . '"</b>');
                 break;
             case 'user':
                 $subStr = sprintf($GLOBALS['lang']['generique_user'], '<b>"' . $idDependOnType . '"</b>');
                 break;
             case 'pdf':
                 $pdfDb = new PdfConfigDb($this->site->id);
                 $o_pdf = $pdfDb->getPdf($idDependOnType);
                 $subStr = sprintf($GLOBALS['lang']['generique_pdfno'], '<b>"' . $o_pdf->pdfName . '"</b>');
                 break;
         }
         $this->tpl->assign('message', sprintf($GLOBALS['lang']['admin_deleteconfirm'], $subStr));
         $this->tpl->assign("confirmation", $type);
         // flag smarty
         $this->tpl->template = "admin/ask_confirmation.tpl";
         return false;
     }
 }
 function postProcess()
 {
     $idSite = $this->getSubmitValue('form_site_admin');
     $confPdf = new PdfConfigDb($idSite);
     $listChoix = $confPdf->getChoixPdf();
     $paramElem = $this->getSubmitValue('param_pdf_result');
     //print ("debut : ".$paramElem."<br>");
     $tabLine = split("@@", $paramElem);
     $param = array();
     $i = 0;
     foreach ($tabLine as $key => $info) {
         //print ("Get : ".$key." : int : ".$info."<br>");
         $tmpLine = split("#", $info);
         //$param[$tmpLine[0]] = array_slice ($tmpLine, 1);
         $param[$i] = $tmpLine;
         $i++;
     }
     /*
     foreach ($param as $key => $info) {
     	print ("Select : ".$key." : int : ".$info[PDF_INDEX_INT]." all : ".$info[PDF_INDEX_ALL]);
     	if (isset($info[PDF_INDEX_AUTRE])) {
     		print(", autre : ".$info[PDF_INDEX_AUTRE]);
     	}
     	print("<br>");
     //			print (" Result Select : ".$key." : int : ".$info."<br>");
     }
     */
     /*		
     $param = array();
     foreach ($listChoix as $key => $info) {
     	$selCh =  $this->getSubmitValue($key);
     	$selInt = "false";
     	$selAll = "false";
     	if ($selCh == 1) {
     	//print ("$key : $selCh<br>");
     		if (! isset($info["PAG"])) {
     			if ($info["INT"] == "true") {
     				if ($this->getSubmitValue($key."I") == 1) {
     					$selInt = "true";
     				}
     			}
     			if ($info["ALL"] == "true") {
     				if ($this->getSubmitValue($key."A") == 1) {
     					$selAll = "true";
     				}
     			}
     		}
     		$param[$key] = array ($selInt, $selAll);
     	}
     }
     */
     /*
     foreach ($param as $key => $info) {
     	print ("Select : ".$key." : int : ".$info[0]." all : ".$info[1]."<br>");
     }
     */
     // add a new pdf
     if ($this->pdfId == -1) {
         $confPdf->addPdf($this->getSubmitValue('form_name'), $param, $this->getSubmitValue('form_public_pdf') == 'yes');
     } else {
         $confPdf->updatePdf($this->getSubmitValue('form_id'), $this->getSubmitValue('form_name'), $param, $this->getSubmitValue('form_public_pdf') == 'yes');
     }
     //$confPdf->savePdf ();
 }
 /**
  * Big job, assign all vars... 
  * Too much vars, those tasks should be splitted into more atomic methods
  * 
  * @param object o_site
  * @param object o_data
  * @param object request
  * 
  * @return void
  */
 function processDatas(&$o_site, &$o_data, $request = null)
 {
     $ctrl =& ApplicationController::getInstance();
     if (is_null($request)) {
         $o_request =& $ctrl->getRequest();
     } else {
         $o_request =& $request;
     }
     $o_lang =& $ctrl->getLang();
     if (!is_a($o_data, "DataModel")) {
         //trigger_error("\$o_data is not an object DataModel! Maybe its because this is not a
         //ViewModule and so you don't really need DataModel, you have to do without it...");
     }
     printTime('Begin Smarty display');
     /*
      * @todo , extact this from method!!
      */
     $ajax_views = array("common/data_array_details.tpl", "common/data_array_interest.tpl", "common/data_array.tpl");
     // Add path to theme
     $this->assign("PMV_THEME", $this->template_dir[0]);
     $this->assign("PMV_THEME_DEFAULT", $this->template_dir[1]);
     $this->assign("PMV_STAT_ID_SITE", PMV_STAT_ID_SITE);
     $this->assign("PMV_STAT_SAVE_USER", PMV_STAT_SAVE_USER);
     // case we load a subtemplate with AJAX
     if (in_array($this->template, $ajax_views)) {
         $this->mainTemplate = $this->template;
     } elseif ($o_request->isCategoryZoom()) {
         $this->mainTemplate = "common/viewpages_details.tpl";
         //	printDebug($this->get_template_vars( "zoom"));
         $t = $this->get_template_vars("zoomsorted");
         //printDebug($t);
         $this->assign("zoom", $t);
     } else {
         // case there are no visit for this period
         if (is_a($o_data, "DataModel") && $o_request->getModuleName() !== 'view_sites_summary' && $o_data->getContent('nb_vis') == 0) {
             $this->setTemplate("common/error.tpl");
             if ($o_request->getModuleName() !== 'view_visits_rss') {
                 $this->assign("error_message_bis", sprintf($GLOBALS['lang']['generique_help_novisits'], "<a href='index.php?mod=admin_site_javascript_code'>", "</a>"));
             }
         }
         // assign period, used in pages table to print the period text
         $this->assign("period", $o_request->getPeriod());
         if (is_a($o_site, 'Site')) {
             // compute and assign calendar
             $o_dasked = new Date($o_request->getDate());
             $o_minDay = $o_site->getMinDay();
             if ($o_dasked->getTimestamp() < $o_minDay->getTimestamp()) {
                 $s_dateAsked = $o_minDay->get();
             } else {
                 $s_dateAsked = $o_dasked->get();
             }
             $a_calendar = getTemplateArrayCalendar($o_minDay, $s_dateAsked, $o_request->getPeriod());
             $this->assign("calendar", $a_calendar);
             // first day letters for calendar first line
             if (!defined('MONDAY_FIRST') || MONDAY_FIRST == 'yes') {
                 $dayFirstLetter = $GLOBALS['lang']['calendrier_jours'];
             } else {
                 for ($i = 0; $i < 7; $i++) {
                     $dayFirstLetter[$i == 6 ? 0 : $i + 1] = $GLOBALS['lang']['calendrier_jours'][$i];
                 }
                 ksort($dayFirstLetter);
             }
             $this->assign("day_first_letter", $dayFirstLetter);
             // litteral date for display below the menu
             $this->assign("date_litteral", getLiteralDate($o_request->getPeriod(), $s_dateAsked));
             $this->assign("date_ask", $s_dateAsked);
             // months info for SELECT months generation
             $months_info = getTemplateArrayMonth($o_site->getMinDay(), $o_request);
             $this->assign("months_available", $months_info[0]);
             $this->assign("month_selected", $months_info[1]);
             // sites info for SELECT sites generation
             $this->assign("sites_view_available", $o_site->getAllowedSites('view'));
             $this->assign("sites_admin_available", $o_site->getAllowedSites('admin'));
             $this->assign("site_selected", $o_request->getSiteId(false));
             $this->assign("site_selected_name", $o_site->getName());
             // pdf list
             $pdfConf = new PdfConfigDb($o_request->getSiteId(false), true);
             $this->assign("site_pdf_list", $pdfConf->getListPdf());
         }
         // langs info for SELECT langs generation
         $this->assign("langs_available", $o_lang->getArrayLangs());
         $this->assign("lang_selected", $o_lang->getFileName());
         // require menu definition and assign for menu display
         $menu = array();
         if (is_file(INCLUDE_PATH . '/themes/' . THEME . '/datas/MenuDefinition.php')) {
             require INCLUDE_PATH . '/themes/' . THEME . '/datas/MenuDefinition.php';
         } else {
             require INCLUDE_PATH . '/themes/' . THEME_DEFAULT . '/datas/MenuDefinition.php';
         }
         //require INCLUDE_PATH . "/core/include/MenuDefinition.php";
         // Add plugin menus
         $installedPlugin = new PmvConfig("plugin.php", false);
         foreach ($installedPlugin->content as $key => $value) {
             // Load lang for plugin
             if (isset($value['langPath']) && $value['langPath'] != "") {
                 Lang::addPluginLangFile($key . "/" . $value['langPath'], $value['defaultLang']);
             }
             if ($value['type'] == "menu") {
                 // Set plugin in menu list
                 $menuModName = $value['menuModName'];
                 for ($i = 0; $i < count($menu); $i++) {
                     if ($menu[$i]['modname'] == $menuModName) {
                         $menu[$i]['plugins'][$key] = $value;
                     }
                 }
             }
         }
         $this->assign("menu", $menu);
         // To select menu
         $this->assign("page", $o_request->getModuleName());
     }
     // interest sorting info
     if (is_a($o_data, "DataModel")) {
         //printDebug($o_request->getArrayInfoSort( $o_data->arraySumInfo));
         $this->assign("info_sort", $o_request->getArrayInfoSort($o_data->arraySumInfo));
     }
     /**
      * display a previous assigned template variable
      */
     //printDebug($this->get_template_vars( "countries"));
     // url with main variables
     $this->assign("url", $o_request->getUrl());
     // current exact url
     $this->assign("url_current", $o_request->getCurrentUrl());
     // url without offset info
     $this->assign("url_offset", $o_request->getUrl('offset'));
     // url without interest info
     $this->assign("url_a_int_sort", $o_request->getUrl('a_int_sort'));
     $this->assign("url_a_exit_sort", $o_request->getUrl('a_exit_sort'));
     $this->assign("url_a_entry_sort", $o_request->getUrl('a_entry_sort'));
     // url without module
     $this->assign("url_mod", $o_request->getUrl(array('mod', 'a_int_sort')));
     // url without site
     $this->assign("url_site", $o_request->getUrl('site'));
     // url without date
     $this->assign("url_date", $o_request->getUrl('date'));
     // url without period
     $this->assign("url_period", $o_request->getUrl('period'));
     // url without lang
     //		$this->assign("url_lang", Request::getCurrentCompleteUrl());
     $this->assign("url_lang", $o_request->getUrl('lang'));
     // url without mod & site, used for summary SELECT choice (because we change mod=viewsummary and site=-1)
     $this->assign("url_mod_site", $o_request->getUrl(array('mod', 'a_int_sort', 'site')));
     $this->assign("url_pages_details", $o_request->getUrl('mod_sort_means_details'));
     // if there is an "error" message to print in red
     if (isset($GLOBALS['content_message_tpl'])) {
         // assign the message
         $this->assign("content_message", $GLOBALS['content_message_tpl']);
         // and the content template, error.tpl which will print in red the message
         $this->setTemplate('common/error.tpl');
     }
     // assign an header message (archive ok, archive temp, etc.)
     $this->assign("header_message", $GLOBALS['header_message_tpl']);
     // assign an error header message
     $this->assign("header_error_message", $GLOBALS['header_error_message_tpl']);
     // assign text direction info (rtl, ltr)
     $this->assign("dir", $GLOBALS['lang']['text_dir']);
     // assign footer info
     //$time =  getMicrotime()-$GLOBALS['time_start'];
     //$this->assign("generation_time", $time);
     //$this->assign("query_count", $GLOBALS['query_count']);
     // image dir
     //$this->assign("img_dir", DIR_IMG_THEMES);
     $this->assign("img_dir", $this->template_dir . "images/");
     // links for the documentation
     $this->assign("link_doc", array(HREF_DOC_OPEN, HREF_DOC_CLOSE));
     // phpmyvisites version to print in meta and footer
     $this->assign("PHPMV_VERSION", PHPMV_VERSION);
     $this->assign("PHP_VERSION_NEEDED", PHP_VERSION_NEEDED);
     $this->assign("PARAM_URL_NEWSLETTER", PARAM_URL_NEWSLETTER);
     $this->assign("PARAM_URL_PARTNER", PARAM_URL_PARTNER);
     //should we include internal stats in the application footer
     if (defined('INTERNAL_STATS') && INTERNAL_STATS == 1) {
         $this->assign('internal_stats', true);
     }
     $user =& User::getInstance();
     $this->assign('user_alias', $user->getAlias());
     $this->assign('user_login', $user->getLogin());
     $this->assign('user_is_su', $user->suPermission);
     $this->assign('user_is_admin_site', $user->isSiteAllowedAdmin($o_request->getSiteId(false)));
     $this->assign("rss_hash", $user->getRssHash());
     $this->assign('a_link_phpmv', array('<a class="bleu" link="web statistics" href="http://www.phpmyvisites.us/">', '</a>'));
     $this->assign("contentpage", $this->template);
     printTime('After Smarty pre computing');
 }
 function display()
 {
     $viewAllDetail = false;
     $paramAll = getRequestVar('all', 0, 'int');
     if ($paramAll == 1) {
         $viewAllDetail = true;
     }
     $period = $this->request->getPeriod();
     $idSite = $this->request->getSiteId();
     $idSite = getRequestVar('site', -1, 'int');
     $idPdf = getRequestVar('idPdf', -2, 'int');
     //$pdf = new GenerePDF("P", "mm");
     $pdf = new GenerePDF('P', 'mm', 'A4', true, "UTF-8");
     // patch by HonestQiao
     if ($GLOBALS['lang']['lang_iso'] == 'zh') {
         $pdf->phpmvFont = "GB";
         $pdf->AddGBFont();
     }
     // patch by HonestQiao
     if (isset($GLOBALS["lang"]["text_dir"])) {
         $pdf->direction = $GLOBALS["lang"]["text_dir"];
     } else {
         $pdf->direction = "ltr";
     }
     // ENGLISH
     /* SPECIFIC TCPDF
     		$l = Array();
     		
     		// PAGE META DESCRIPTORS --------------------------------------
     		
     		$l['a_meta_charset'] = "UTF-16";
     		$l['a_meta_dir'] = $pdf->direction;
     		$l['a_meta_language'] = "jp";
     		
     		// TRANSLATIONS --------------------------------------
     		$l['w_page'] = "page";
     		
     		$pdf->setLanguageArray($l); //set language items
     */
     //  fin specifique TCPDF
     //
     $pdf->currentModule = $this;
     if ($idSite > 0) {
         $site = new Site($idSite);
         $pdf->currentSite = $site;
     } else {
         $pdf->currentSite = null;
     }
     $pdf->period = $period;
     $pdf->date = $this->request->getDate();
     $pdf->literalDate = getLiteralDate($period, $this->request->getDate());
     // Set PDF propertes data
     if ($idSite != -1) {
         $titre = "Statistics of " . $site->getName();
     } else {
         $titre = $pdf->pmvTranslate("summary_title");
     }
     $pdf->SetTitle($titre);
     $pdf->SetAuthor("phpMyVisites");
     $pdf->SetCreator($pdf->pmvTranslate("head_titre"));
     $pdf->SetKeywords($pdf->pmvTranslate("head_keywords"));
     $pdf->SetSubject($pdf->pmvTranslate("logo_description"));
     $pdf->SetFont($pdf->phpmvFont, "", 8);
     $pdf->SetLineWidth(0.1);
     $firstPageOk = false;
     if ($idSite <= 0) {
         // *******************************************************
         // Sites Summary
         // *******************************************************
         $pdf->titrePage1 = "summary_title";
         $pdf->AddPage();
         $firstPageOk = true;
         $pdf->setSitesSummaryStatistics();
         $pdf->Ln();
     } else {
         $zoom = $this->data->getVisitsStatistics();
         if (!isset($zoom["nb_vis"])) {
             $pdf->titrePage1 = "summary_title";
             $pdf->AddPage();
             $firstPageOk = true;
             $txtNoVisit = $pdf->pmvTranslate("aucunvisiteur_titre");
             $pdf->setErrorMessage($txtNoVisit);
         } else {
             $confPf = new PdfConfigDb($idSite, true);
             if ($idPdf == -2) {
                 // No PDF
                 // Get default site pdf
                 $idPdf = $site->getIdPdf();
             }
             $paramShowPdf = $confPf->getPdf($idPdf);
             if ($paramShowPdf == null) {
                 //print("take defaut<br>");
                 $paramShowPdf = $confPf->getDefaultPdf();
             } else {
                 $paramShowPdf = $paramShowPdf->pdfParam;
             }
             $confShowPdf = $confPf->getChoixPdf();
             $pdfLink = array();
             // Create all links object
             foreach ($paramShowPdf as $keyTab => $info) {
                 $key = $info[PDF_INDEX_KEY];
                 if ($key == "PG0") {
                 } elseif (isset($confShowPdf[$key]["PAG"])) {
                     $pdfLink[$key] = $pdf->AddLink();
                 }
             }
             //$pdf->Cell(80, PDF_DEFAULT_ROW_HEIGHT, "test", "0", "", "L", 0);
             // Generate page
             foreach ($paramShowPdf as $keyTab => $info) {
                 $key = $info[PDF_INDEX_KEY];
                 if ($key == "PG0") {
                     $pdf->titrePage1 = "summary_title";
                     $pdf->AddPage();
                     $firstPageOk = true;
                     $pdf->setSitesSummaryStatistics();
                     $pdf->Ln();
                 } elseif ($key == "SUM") {
                     $firstPageOk = $pdf->setPageSummary($paramShowPdf, $confShowPdf, $pdfLink, $firstPageOk);
                 } elseif (isset($confShowPdf[$key]["PAG"])) {
                     if (isset($info[PDF_INDEX_AUTRE])) {
                         $lib = $info[PDF_INDEX_AUTRE];
                     } else {
                         $lib = $confShowPdf[$key]["TIT"];
                     }
                     $pdf->titrePage1 = $lib;
                     $pdf->AddPage();
                     $firstPageOk = true;
                     $pdf->SetLink($pdfLink[$key]);
                 } else {
                     if (!$firstPageOk) {
                         $pdf->AddPage();
                         $firstPageOk = true;
                     }
                     //echo "$key : PAR1 : ".$confShowPdf[$key]["PAR1"]." : ".$info[PDF_INDEX_AUTRE]."<br>";
                     //print("xx : z" . $key . "z : w" . $info . "w : " . $confShowPdf[$key]["FCT"] . "<br>");
                     //$pdf->$confShowPdf[$key]["FCT"]($info[0], $info[1]);
                     if ($confShowPdf[$key]["INT"] == "true" && $confShowPdf[$key]["ALL"] == "true") {
                         //echo "int all<br>";
                         $pdf->{$confShowPdf}[$key]["FCT"]($info[PDF_INDEX_ALL] == "true", $info[PDF_INDEX_INT] == "true");
                     } elseif ($confShowPdf[$key]["INT"] == "true") {
                         //echo "int<br>";
                         $pdf->{$confShowPdf}[$key]["FCT"]($info[PDF_INDEX_INT] == "true");
                     } elseif ($confShowPdf[$key]["ALL"] == "true") {
                         //echo "all<br>";
                         $pdf->{$confShowPdf}[$key]["FCT"]($info[PDF_INDEX_ALL] == "true");
                     } elseif (isset($confShowPdf[$key]["PAR1"]) && isset($info[PDF_INDEX_AUTRE])) {
                         //echo "PAR1<br>";
                         $pdf->{$confShowPdf}[$key]["FCT"]($info[PDF_INDEX_AUTRE]);
                     } else {
                         //echo "Vide<br>";
                         $pdf->{$confShowPdf}[$key]["FCT"]();
                     }
                 }
             }
         }
     }
     if (!$firstPageOk) {
         $pdf->AddPage();
         $firstPageOk = true;
     }
     $pdf->Ln(15);
     $pdf->SetFont($pdf->phpmvFont, "I", 6);
     $pdf->SetTextColor(128);
     $twtTime = sprintf($pdf->pmvTranslate("generique_timefooter"), getTimeElapsed());
     $w = $pdf->GetStringWidth($twtTime) + 6;
     $pdf->SetX((210 - $w) / 2);
     $pdf->Write(3, $twtTime);
     // *******************************************************
     // Output PDF
     // *******************************************************
     //echo "fin : " . $pdf->traceMsg;
     // stats-siteX.pdf
     $pdf->Output("stats-site{$idSite}.pdf", "D");
 }