From: vincent@cubedesigners.com Date: Mon, 18 Jun 2018 13:43:31 +0000 (+0000) Subject: done #2102 @1.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=00a98d1e966b588aaf0cb33be61d9d631477da74;p=cubeextranet.git done #2102 @1.5 --- diff --git a/inc/ws/Controlleur/class.ws.stats.php b/inc/ws/Controlleur/class.ws.stats.php index aa8e6ff4b..2894b2a75 100644 --- a/inc/ws/Controlleur/class.ws.stats.php +++ b/inc/ws/Controlleur/class.ws.stats.php @@ -1,6 +1,7 @@ ' . $extra . ''); if ((string)$xml->extraName != '') { return (string)$xml->extraName; @@ -139,7 +144,8 @@ class wsStats { return null; } - public static function load_stats($bid, $annee = null, $mois = null) { + public static function load_stats($bid, $annee = null, $mois = null) + { $e = explode('_', $bid, 2); $bid = $e[0]; @@ -168,7 +174,9 @@ class wsStats { return null; } - public static function correctValues($x, $y, $m) { + public static function correctValues($x, $y, $m) + { + return; foreach (self::$datestocorrect as $date) { if ($date[2] != $y || $date[1] != $m) { continue; @@ -186,11 +194,13 @@ class wsStats { } } - public static function correctPlaces($x) { + public static function correctPlaces($x) + { } - public static function globalSort($xml, $root = 'stats') { + public static function globalSort($xml, $root = 'stats') + { $res = simplexml_load_string('<' . $root . ' />'); foreach ($xml->attributes() as $k => $v) { $res->addAttribute($k, $v); @@ -206,7 +216,8 @@ class wsStats { return $res; } - public static function yearSort($xml, $root = 'stats') { + public static function yearSort($xml, $root = 'stats') + { $res = simplexml_load_string('<' . $root . ' />'); foreach ($xml->attributes() as $k => $v) { $res->addAttribute($k, $v); @@ -224,7 +235,8 @@ class wsStats { return $res; } - public static function monthSort($xml, $root = 'stats') { + public static function monthSort($xml, $root = 'stats') + { $res = simplexml_load_string('<' . $root . ' />'); foreach ($xml->attributes() as $k => $v) { $res->addAttribute($k, $v); @@ -237,7 +249,8 @@ class wsStats { return $res; } - public static function daysSort($xml, $res) { + public static function daysSort($xml, $res) + { $x = $res->addChild('days'); $days = array(); foreach ($xml->days->day as $day) { @@ -257,7 +270,8 @@ class wsStats { } } - public static function pagesSort($xml, $res) { + public static function pagesSort($xml, $res) + { $xpages = $res->addChild('pages'); $pages = array(); $trans = array(); @@ -271,7 +285,8 @@ class wsStats { } } - public static function linksSort($xml, $res) { + public static function linksSort($xml, $res) + { $x = $res->addChild('links'); $links = array(); $trans = array(); @@ -286,7 +301,8 @@ class wsStats { } } - public static function searchesSort($xml, $res) { + public static function searchesSort($xml, $res) + { $x = $res->addChild('searches'); $searches = array(); $trans = array(); @@ -301,7 +317,8 @@ class wsStats { } } - public static function countriesSort($xml, $res) { + public static function countriesSort($xml, $res) + { $x = $res->addChild('countries'); $countries = array(); $trans = array(); @@ -315,7 +332,8 @@ class wsStats { } } - public static function getActives($stats, $book, &$aextra, &$adown, &$adownp, &$aprint, &$afriend) { + public static function getActives($stats, $book, &$aextra, &$adown, &$adownp, &$aprint, &$afriend) + { $extra = self::getExtra($book->extras); $aextra = ($extra != null && $stats['extras'] > 0); $adown = ($book->parametres->pdf == 1 && $stats['downloads'] > 0); @@ -324,7 +342,8 @@ class wsStats { $afriend = ($book->parametres->friend == 1); } - public static function table($title, $colsTitles, $lines, $class, $firstColMax = true, $firstLineBold = false, $noOdd = false) { + public static function table($title, $colsTitles, $lines, $class, $firstColMax = true, $firstLineBold = false, $noOdd = false) + { global $core; if (is_string($class)) { $class = array($class); @@ -373,13 +392,15 @@ class wsStats { * @param string $name * @return PHPExcel_Worksheet */ - protected static function _createSheet($name) { + protected static function _createSheet($name) + { $s = self::$xls->createSheet(); $s->setTitle($name); return $s; } - public static function globalDatas($titre, $date_creation, $book, $stats, $afriend, $aprint, $adown, $adownp, $aextra) { + public static function globalDatas($titre, $date_creation, $book, $stats, $afriend, $aprint, $adown, $adownp, $aextra) + { global $xls; $colsTitles = array('', ''); @@ -387,7 +408,7 @@ class wsStats { $class = array('liste', 'max'); $lines[] = array($date_creation, date(__('d-m-Y'), $book->date)); - $lines[] = array(__('Nombre de lieux de visite'), $stats['places']); + //$lines[] = array(__('Nombre de lieux de visite'), $stats['places']); $lines[] = array(__('Nombre de visiteurs uniques'), $stats['visitors']); $lines[] = array(__('Nombre de visites'), $stats['visits']); $lines[] = array(__('Nombre de pages vues'), $stats['pages']); @@ -413,20 +434,23 @@ class wsStats { return self::table($titre, $colsTitles, $lines, $class); } - public static function indisponible() { + public static function indisponible() + { $res = commonPage::bh('stats_global'); $res .= '

' . __('Les statistiques concernant cette période ne sont actuellement pas disponibles') . '

'; $res .= commonPage::bf(); return $res; } - public static function getBook($bid) { + public static function getBook($bid) + { global $core; $daoBook = new wsDAOBook($core->con); return $daoBook->selectById($bid); } - public static function vue_globale($bid, $annee = null) { + public static function vue_globale($bid, $annee = null) + { global $core; $book = self::getBook($bid); $extra = self::getExtra($book->extras); @@ -471,11 +495,13 @@ class wsStats { * @param mixed $annee * @return */ - public static function vue_annuelle($bid, $annee) { + public static function vue_annuelle($bid, $annee) + { return self::vue_globale($bid, $annee); } - public static function vue_mensuelle($bid, $annee, $mois) { + public static function vue_mensuelle($bid, $annee, $mois) + { $datestocorrect = array(mktime(0, 0, 0, 11, 23, 2009), mktime(0, 0, 0, 12, 8, 2009), mktime(0, 0, 0, 12, 9, 2009)); global $core; $book = self::getBook($bid); @@ -531,11 +557,13 @@ class wsStats { return $res; } - public static function detailPeriode($book, $stats, $bid, $annee) { + public static function detailPeriode($book, $stats, $bid, $annee) + { self::getActives($stats, $book, $aextra, $adown, $adownp, $aprint, $afriend); $title = ''; - $colsTitles = array(__('Période'), __('Lieux de visite'), __('Visiteurs uniques'), __('Visites'), __('Pages vues')); + $colsTitles = array(__('Période'), /*__('Lieux de visite'),*/ + __('Visiteurs uniques'), __('Visites'), __('Pages vues')); if ($afriend) { $colsTitles[] = __('Liens envoyés'); } @@ -578,7 +606,8 @@ class wsStats { return self::table($title, $colsTitles, $lines, array('max', 'liste'), true, false, $noOdd); } - protected static function setSheetFromDatas($title, $columns, $lines) { + protected static function setSheetFromDatas($title, $columns, $lines) + { $s = self::_createSheet($title); $offset = 1; if (!is_null($columns)) { @@ -609,7 +638,8 @@ class wsStats { } } - public static function linePeriod($stats, $bid, $afriend, $aprint, $adown, $adownp, $aextra) { + public static function linePeriod($stats, $bid, $afriend, $aprint, $adown, $adownp, $aextra) + { $line = array(); $url = SITE_PATH . 'stats/' . $bid; if (isset($stats['year'])) { @@ -623,7 +653,7 @@ class wsStats { } $line[] = '' . $date . ''; - $line[] = $stats['places']; + //$line[] = $stats['places']; $line[] = $stats['visitors']; $line[] = $stats['visits']; $line[] = $stats['pages']; @@ -647,24 +677,26 @@ class wsStats { return $line; } - public static function detailJour($book, $annee, $mois, $stats) { - $colsTitles = array(__('Jour'), __('Lieux de visite'), __('Visiteurs uniques'), __('Visites'), __('Pages vues'), __('Liens cliqués')); + public static function detailJour($book, $annee, $mois, $stats) + { + $colsTitles = array(__('Jour'), /*__('Lieux de visite'),*/ + __('Visiteurs uniques'), __('Visites'), __('Pages vues'), __('Liens cliqués')); $lines = array(); $xlines = array(); foreach ($stats->days->day as $day) { $lines[] = array(strftime('%A %d', mktime(0, 0, 0, $mois, (string)$day['day'], $annee)), - $day['places'], - $day['visitors'], - $day['visits'], - $day['views'], - $day['links']); + // $day['places'], + $day['visitors'], + $day['visits'], + $day['views'], + $day['links']); $xlines[] = array(strftime('%d', mktime(0, 0, 0, $mois, (string)$day['day'], $annee)), - $day['places'], - $day['visitors'], - $day['visits'], - $day['views'], - $day['links']); + //$day['places'], + $day['visitors'], + $day['visits'], + $day['views'], + $day['links']); } $time_page = mktime(0, 0, 0, $mois, 15, $annee); @@ -673,7 +705,8 @@ class wsStats { return self::table(__('Détail par jour') . ' - ' . strftime('%B %Y', $time_page), $colsTitles, $lines, array('liste', 'max'), true); } - public static function detailPages($book, $annee, $mois, $stats) { + public static function detailPages($book, $annee, $mois, $stats) + { $colsTitles = array(__('Pages')); if ($book->parametres->stats_score) { $colsTitles[] = __('Score'); @@ -726,7 +759,8 @@ class wsStats { return self::table(__('Détail par page') . ' - ' . strftime('%B %Y', $time_page), $colsTitles, $lines, array('liste', 'max')); } - public static function detailLiens($book, $stats) { + public static function detailLiens($book, $stats) + { $colsTitles = array(__('URL'), __('Clics')); $lines = array(); $xlines = array(); @@ -751,7 +785,8 @@ class wsStats { return self::table(__('Liens les plus cliqués'), $colsTitles, $lines, array('liste', 'max')); } - public static function detailSearch($book, $stats) { + public static function detailSearch($book, $stats) + { $colsTitles = array(__('Mot'), __('Recherches')); $lines = array(); @@ -766,7 +801,8 @@ class wsStats { return self::table(__('Mots les plus recherchés'), $colsTitles, $lines, array('liste', 'max')); } - public static function detailOrigine($book, $stats) { + public static function detailOrigine($book, $stats) + { $colsTitles = array(__('Pays'), __('Visiteurs')); $lines = array(); $xlines = array(); @@ -786,7 +822,8 @@ class wsStats { return self::table(__('Origine des visiteurs'), $colsTitles, $lines, array('liste', 'max')); } - public static function getQ($max, &$maxp, &$maxpages, &$s) { + public static function getQ($max, &$maxp, &$maxpages, &$s) + { $maxpages = $maxp; $q = 1; $maxp /= $q; @@ -797,7 +834,8 @@ class wsStats { } } - public static function graph_annuel($bid, $a, $stats) { + public static function graph_annuel($bid, $a, $stats) + { $img = SYSIMG . '/stats/annuel-' . $a . '-' . $bid . '.png'; $imgw = IMG . '/stats/annuel-' . $a . '-' . $bid . '.png'; $maxv = 0; @@ -892,7 +930,8 @@ class wsStats { return $res; } - public static function graph_global($bid, $stats) { + public static function graph_global($bid, $stats) + { global $core; $img = SYSIMG . '/stats/global-' . $bid . '.png'; $imgw = IMG . '/stats/global-' . $bid . '.png'; @@ -996,7 +1035,8 @@ class wsStats { return $res; } - public static function graph_mensuel($bid, $a, $m, $stats) { + public static function graph_mensuel($bid, $a, $m, $stats) + { $img = SYSIMG . '/stats/mensuel-' . $a . '-' . $m . '-' . $bid . '.png'; $imgw = IMG . '/stats/mensuel-' . $a . '-' . $m . '-' . $bid . '.png'; $lm = cubeDate::limitMonth($a, $m); @@ -1096,7 +1136,8 @@ class wsStats { return $res; } - public static function forceComputation($id) { + public static function forceComputation($id) + { `/home/stats/www/FWStats.sh /home/stats/www onlybook=$id`; } } \ No newline at end of file