<?php\r
\r
-class wsStats {\r
+class wsStats\r
+{\r
\r
public static $datestocorrect = array(array(22, 11, 2009), array(23, 11, 2009), array(8, 12, 2009), array(9, 12, 2009));\r
\r
*/\r
public static $xls;\r
\r
- public static function exportXLS($bid, $annee = null, $mois = null) {\r
+ public static function exportXLS($bid, $annee = null, $mois = null)\r
+ {\r
$xname = self::_getXLSFile($bid, $annee, $mois);\r
$fname = 'stats_' . $bid;\r
if (!is_null($annee)) {\r
cubeHTTP::downloadFile($xname, $fname);\r
}\r
\r
- protected static function _getXLSFile($bid, $annee = null, $mois = null) {\r
+ protected static function _getXLSFile($bid, $annee = null, $mois = null)\r
+ {\r
self::forceComputation($bid);\r
$e = explode('_', $bid);\r
$bid = $e[0];\r
return $xname;\r
}\r
\r
- public static function display($bid, $annee = null, $mois = null) {\r
+ public static function display($bid, $annee = null, $mois = null)\r
+ {\r
global $core;\r
\r
self::forceComputation($bid);\r
return $res;\r
}\r
\r
- public static function getExtra($extra) {\r
+ public static function getExtra($extra)\r
+ {\r
$xml = simplexml_load_string('<extra>' . $extra . '</extra>');\r
if ((string)$xml->extraName != '') {\r
return (string)$xml->extraName;\r
return null;\r
}\r
\r
- public static function load_stats($bid, $annee = null, $mois = null) {\r
+ public static function load_stats($bid, $annee = null, $mois = null)\r
+ {\r
\r
$e = explode('_', $bid, 2);\r
$bid = $e[0];\r
return null;\r
}\r
\r
- public static function correctValues($x, $y, $m) {\r
+ public static function correctValues($x, $y, $m)\r
+ {\r
+ return;\r
foreach (self::$datestocorrect as $date) {\r
if ($date[2] != $y || $date[1] != $m) {\r
continue;\r
}\r
}\r
\r
- public static function correctPlaces($x) {\r
+ public static function correctPlaces($x)\r
+ {\r
\r
}\r
\r
- public static function globalSort($xml, $root = 'stats') {\r
+ public static function globalSort($xml, $root = 'stats')\r
+ {\r
$res = simplexml_load_string('<' . $root . ' />');\r
foreach ($xml->attributes() as $k => $v) {\r
$res->addAttribute($k, $v);\r
return $res;\r
}\r
\r
- public static function yearSort($xml, $root = 'stats') {\r
+ public static function yearSort($xml, $root = 'stats')\r
+ {\r
$res = simplexml_load_string('<' . $root . ' />');\r
foreach ($xml->attributes() as $k => $v) {\r
$res->addAttribute($k, $v);\r
return $res;\r
}\r
\r
- public static function monthSort($xml, $root = 'stats') {\r
+ public static function monthSort($xml, $root = 'stats')\r
+ {\r
$res = simplexml_load_string('<' . $root . ' />');\r
foreach ($xml->attributes() as $k => $v) {\r
$res->addAttribute($k, $v);\r
return $res;\r
}\r
\r
- public static function daysSort($xml, $res) {\r
+ public static function daysSort($xml, $res)\r
+ {\r
$x = $res->addChild('days');\r
$days = array();\r
foreach ($xml->days->day as $day) {\r
}\r
}\r
\r
- public static function pagesSort($xml, $res) {\r
+ public static function pagesSort($xml, $res)\r
+ {\r
$xpages = $res->addChild('pages');\r
$pages = array();\r
$trans = array();\r
}\r
}\r
\r
- public static function linksSort($xml, $res) {\r
+ public static function linksSort($xml, $res)\r
+ {\r
$x = $res->addChild('links');\r
$links = array();\r
$trans = array();\r
}\r
}\r
\r
- public static function searchesSort($xml, $res) {\r
+ public static function searchesSort($xml, $res)\r
+ {\r
$x = $res->addChild('searches');\r
$searches = array();\r
$trans = array();\r
}\r
}\r
\r
- public static function countriesSort($xml, $res) {\r
+ public static function countriesSort($xml, $res)\r
+ {\r
$x = $res->addChild('countries');\r
$countries = array();\r
$trans = array();\r
}\r
}\r
\r
- public static function getActives($stats, $book, &$aextra, &$adown, &$adownp, &$aprint, &$afriend) {\r
+ public static function getActives($stats, $book, &$aextra, &$adown, &$adownp, &$aprint, &$afriend)\r
+ {\r
$extra = self::getExtra($book->extras);\r
$aextra = ($extra != null && $stats['extras'] > 0);\r
$adown = ($book->parametres->pdf == 1 && $stats['downloads'] > 0);\r
$afriend = ($book->parametres->friend == 1);\r
}\r
\r
- public static function table($title, $colsTitles, $lines, $class, $firstColMax = true, $firstLineBold = false, $noOdd = false) {\r
+ public static function table($title, $colsTitles, $lines, $class, $firstColMax = true, $firstLineBold = false, $noOdd = false)\r
+ {\r
global $core;\r
if (is_string($class)) {\r
$class = array($class);\r
* @param string $name\r
* @return PHPExcel_Worksheet\r
*/\r
- protected static function _createSheet($name) {\r
+ protected static function _createSheet($name)\r
+ {\r
$s = self::$xls->createSheet();\r
$s->setTitle($name);\r
return $s;\r
}\r
\r
- public static function globalDatas($titre, $date_creation, $book, $stats, $afriend, $aprint, $adown, $adownp, $aextra) {\r
+ public static function globalDatas($titre, $date_creation, $book, $stats, $afriend, $aprint, $adown, $adownp, $aextra)\r
+ {\r
global $xls;\r
\r
$colsTitles = array('', '');\r
$class = array('liste', 'max');\r
\r
$lines[] = array($date_creation, date(__('d-m-Y'), $book->date));\r
- $lines[] = array(__('Nombre de lieux de visite'), $stats['places']);\r
+ //$lines[] = array(__('Nombre de lieux de visite'), $stats['places']);\r
$lines[] = array(__('Nombre de visiteurs uniques'), $stats['visitors']);\r
$lines[] = array(__('Nombre de visites'), $stats['visits']);\r
$lines[] = array(__('Nombre de pages vues'), $stats['pages']);\r
return self::table($titre, $colsTitles, $lines, $class);\r
}\r
\r
- public static function indisponible() {\r
+ public static function indisponible()\r
+ {\r
$res = commonPage::bh('stats_global');\r
$res .= '<p class="center">' . __('Les statistiques concernant cette période ne sont actuellement pas disponibles') . '</p>';\r
$res .= commonPage::bf();\r
return $res;\r
}\r
\r
- public static function getBook($bid) {\r
+ public static function getBook($bid)\r
+ {\r
global $core;\r
$daoBook = new wsDAOBook($core->con);\r
return $daoBook->selectById($bid);\r
}\r
\r
- public static function vue_globale($bid, $annee = null) {\r
+ public static function vue_globale($bid, $annee = null)\r
+ {\r
global $core;\r
$book = self::getBook($bid);\r
$extra = self::getExtra($book->extras);\r
* @param mixed $annee\r
* @return\r
*/\r
- public static function vue_annuelle($bid, $annee) {\r
+ public static function vue_annuelle($bid, $annee)\r
+ {\r
return self::vue_globale($bid, $annee);\r
}\r
\r
- public static function vue_mensuelle($bid, $annee, $mois) {\r
+ public static function vue_mensuelle($bid, $annee, $mois)\r
+ {\r
$datestocorrect = array(mktime(0, 0, 0, 11, 23, 2009), mktime(0, 0, 0, 12, 8, 2009), mktime(0, 0, 0, 12, 9, 2009));\r
global $core;\r
$book = self::getBook($bid);\r
return $res;\r
}\r
\r
- public static function detailPeriode($book, $stats, $bid, $annee) {\r
+ public static function detailPeriode($book, $stats, $bid, $annee)\r
+ {\r
self::getActives($stats, $book, $aextra, $adown, $adownp, $aprint, $afriend);\r
$title = '';\r
\r
- $colsTitles = array(__('Période'), __('Lieux de visite'), __('Visiteurs uniques'), __('Visites'), __('Pages vues'));\r
+ $colsTitles = array(__('Période'), /*__('Lieux de visite'),*/\r
+ __('Visiteurs uniques'), __('Visites'), __('Pages vues'));\r
if ($afriend) {\r
$colsTitles[] = __('Liens envoyés');\r
}\r
return self::table($title, $colsTitles, $lines, array('max', 'liste'), true, false, $noOdd);\r
}\r
\r
- protected static function setSheetFromDatas($title, $columns, $lines) {\r
+ protected static function setSheetFromDatas($title, $columns, $lines)\r
+ {\r
$s = self::_createSheet($title);\r
$offset = 1;\r
if (!is_null($columns)) {\r
}\r
}\r
\r
- public static function linePeriod($stats, $bid, $afriend, $aprint, $adown, $adownp, $aextra) {\r
+ public static function linePeriod($stats, $bid, $afriend, $aprint, $adown, $adownp, $aextra)\r
+ {\r
$line = array();\r
$url = SITE_PATH . 'stats/' . $bid;\r
if (isset($stats['year'])) {\r
}\r
\r
$line[] = '<a href="' . $url . '">' . $date . '</a>';\r
- $line[] = $stats['places'];\r
+ //$line[] = $stats['places'];\r
$line[] = $stats['visitors'];\r
$line[] = $stats['visits'];\r
$line[] = $stats['pages'];\r
return $line;\r
}\r
\r
- public static function detailJour($book, $annee, $mois, $stats) {\r
- $colsTitles = array(__('Jour'), __('Lieux de visite'), __('Visiteurs uniques'), __('Visites'), __('Pages vues'), __('Liens cliqués'));\r
+ public static function detailJour($book, $annee, $mois, $stats)\r
+ {\r
+ $colsTitles = array(__('Jour'), /*__('Lieux de visite'),*/\r
+ __('Visiteurs uniques'), __('Visites'), __('Pages vues'), __('Liens cliqués'));\r
$lines = array();\r
$xlines = array();\r
\r
foreach ($stats->days->day as $day) {\r
$lines[] = array(strftime('%A %d', mktime(0, 0, 0, $mois, (string)$day['day'], $annee)),\r
- $day['places'],\r
- $day['visitors'],\r
- $day['visits'],\r
- $day['views'],\r
- $day['links']);\r
+ // $day['places'],\r
+ $day['visitors'],\r
+ $day['visits'],\r
+ $day['views'],\r
+ $day['links']);\r
$xlines[] = array(strftime('%d', mktime(0, 0, 0, $mois, (string)$day['day'], $annee)),\r
- $day['places'],\r
- $day['visitors'],\r
- $day['visits'],\r
- $day['views'],\r
- $day['links']);\r
+ //$day['places'],\r
+ $day['visitors'],\r
+ $day['visits'],\r
+ $day['views'],\r
+ $day['links']);\r
}\r
$time_page = mktime(0, 0, 0, $mois, 15, $annee);\r
\r
return self::table(__('Détail par jour') . ' - ' . strftime('%B %Y', $time_page), $colsTitles, $lines, array('liste', 'max'), true);\r
}\r
\r
- public static function detailPages($book, $annee, $mois, $stats) {\r
+ public static function detailPages($book, $annee, $mois, $stats)\r
+ {\r
$colsTitles = array(__('Pages'));\r
if ($book->parametres->stats_score) {\r
$colsTitles[] = __('Score');\r
return self::table(__('Détail par page') . ' - ' . strftime('%B %Y', $time_page), $colsTitles, $lines, array('liste', 'max'));\r
}\r
\r
- public static function detailLiens($book, $stats) {\r
+ public static function detailLiens($book, $stats)\r
+ {\r
$colsTitles = array(__('URL'), __('Clics'));\r
$lines = array();\r
$xlines = array();\r
return self::table(__('Liens les plus cliqués'), $colsTitles, $lines, array('liste', 'max'));\r
}\r
\r
- public static function detailSearch($book, $stats) {\r
+ public static function detailSearch($book, $stats)\r
+ {\r
$colsTitles = array(__('Mot'), __('Recherches'));\r
$lines = array();\r
\r
return self::table(__('Mots les plus recherchés'), $colsTitles, $lines, array('liste', 'max'));\r
}\r
\r
- public static function detailOrigine($book, $stats) {\r
+ public static function detailOrigine($book, $stats)\r
+ {\r
$colsTitles = array(__('Pays'), __('Visiteurs'));\r
$lines = array();\r
$xlines = array();\r
return self::table(__('Origine des visiteurs'), $colsTitles, $lines, array('liste', 'max'));\r
}\r
\r
- public static function getQ($max, &$maxp, &$maxpages, &$s) {\r
+ public static function getQ($max, &$maxp, &$maxpages, &$s)\r
+ {\r
$maxpages = $maxp;\r
$q = 1;\r
$maxp /= $q;\r
}\r
}\r
\r
- public static function graph_annuel($bid, $a, $stats) {\r
+ public static function graph_annuel($bid, $a, $stats)\r
+ {\r
$img = SYSIMG . '/stats/annuel-' . $a . '-' . $bid . '.png';\r
$imgw = IMG . '/stats/annuel-' . $a . '-' . $bid . '.png';\r
$maxv = 0;\r
return $res;\r
}\r
\r
- public static function graph_global($bid, $stats) {\r
+ public static function graph_global($bid, $stats)\r
+ {\r
global $core;\r
$img = SYSIMG . '/stats/global-' . $bid . '.png';\r
$imgw = IMG . '/stats/global-' . $bid . '.png';\r
return $res;\r
}\r
\r
- public static function graph_mensuel($bid, $a, $m, $stats) {\r
+ public static function graph_mensuel($bid, $a, $m, $stats)\r
+ {\r
$img = SYSIMG . '/stats/mensuel-' . $a . '-' . $m . '-' . $bid . '.png';\r
$imgw = IMG . '/stats/mensuel-' . $a . '-' . $m . '-' . $bid . '.png';\r
$lm = cubeDate::limitMonth($a, $m);\r
return $res;\r
}\r
\r
- public static function forceComputation($id) {\r
+ public static function forceComputation($id)\r
+ {\r
`/home/stats/www/FWStats.sh /home/stats/www onlybook=$id`;\r
}\r
}
\ No newline at end of file