]> _ Git - cubeextranet.git/commitdiff
done #2102 @1.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 18 Jun 2018 13:43:31 +0000 (13:43 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 18 Jun 2018 13:43:31 +0000 (13:43 +0000)
inc/ws/Controlleur/class.ws.stats.php

index aa8e6ff4b129ddd60e84b5770ad366b461efc61b..2894b2a759c1add8a16cff8e3eaa037e0b8d1439 100644 (file)
@@ -1,6 +1,7 @@
 <?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
@@ -9,7 +10,8 @@ class wsStats {
         */\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
@@ -25,7 +27,8 @@ class wsStats {
                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
@@ -47,7 +50,8 @@ class wsStats {
                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
@@ -131,7 +135,8 @@ class wsStats {
                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
@@ -139,7 +144,8 @@ class wsStats {
                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
@@ -168,7 +174,9 @@ class wsStats {
                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
@@ -186,11 +194,13 @@ class wsStats {
                }\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
@@ -206,7 +216,8 @@ class wsStats {
                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
@@ -224,7 +235,8 @@ class wsStats {
                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
@@ -237,7 +249,8 @@ class wsStats {
                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
@@ -257,7 +270,8 @@ class wsStats {
                }\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
@@ -271,7 +285,8 @@ class wsStats {
                }\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
@@ -286,7 +301,8 @@ class wsStats {
                }\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
@@ -301,7 +317,8 @@ class wsStats {
                }\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
@@ -315,7 +332,8 @@ class wsStats {
                }\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
@@ -324,7 +342,8 @@ class wsStats {
                $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
@@ -373,13 +392,15 @@ class wsStats {
         * @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
@@ -387,7 +408,7 @@ class wsStats {
                $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
@@ -413,20 +434,23 @@ class wsStats {
                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
@@ -471,11 +495,13 @@ class wsStats {
         * @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
@@ -531,11 +557,13 @@ class wsStats {
                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
@@ -578,7 +606,8 @@ class wsStats {
                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
@@ -609,7 +638,8 @@ class wsStats {
                }\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
@@ -623,7 +653,7 @@ class wsStats {
                }\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
@@ -647,24 +677,26 @@ class wsStats {
                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
@@ -673,7 +705,8 @@ class wsStats {
                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
@@ -726,7 +759,8 @@ class wsStats {
                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
@@ -751,7 +785,8 @@ class wsStats {
                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
@@ -766,7 +801,8 @@ class wsStats {
                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
@@ -786,7 +822,8 @@ class wsStats {
                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
@@ -797,7 +834,8 @@ class wsStats {
                }\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
@@ -892,7 +930,8 @@ class wsStats {
                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
@@ -996,7 +1035,8 @@ class wsStats {
                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
@@ -1096,7 +1136,8 @@ class wsStats {
                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