]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 14 Sep 2010 17:31:52 +0000 (17:31 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 14 Sep 2010 17:31:52 +0000 (17:31 +0000)
inc/ws/Controlleur/class.ws.stats.php
inc/ws/Controlleur/class.ws.url.php
inc/ws/Metier/class.ws.book.parametres.php
style/ws/style.css

index 0d12662d68e7de93185518ef111a68255100f175..30d7eb889b4cde03d096abd879ec2ffd930b9b83 100644 (file)
@@ -1,21 +1,22 @@
 <?php\r
 class wsStats {\r
        public static $datestocorrect = array(array(22, 11, 2009), array(23, 11, 2009), array(8, 12, 2009), array(9, 12, 2009));\r
-       /*\r
-                       if (in_array($dd, $datestocorrect)) {\r
-                                                       $d->book = round($d->visitor * 1.2);\r
-                                               }*/\r
+\r
        public static function display($bid, $annee = null, $mois = null)\r
        {\r
-               wsDroits::viewBook($bid);\r
                cubePHP::set_memory('512M');\r
+\r
+               $res = extranetPage::barre();\r
+               $res .= extranetPage::tMain();\r
                if (is_null($annee) && is_null($mois)) {\r
-                       return self::vue_globale($bid);\r
-               }\r
-               if (is_null($mois)) {\r
-                       return self::vue_annuelle($bid, $annee);\r
+                       $res .= self::vue_globale($bid);\r
+               } elseif (is_null($mois)) {\r
+                       $res .= self::vue_annuelle($bid, $annee);\r
+               } else {\r
+                       $res .= self::vue_mensuelle($bid, $annee, $mois);\r
                }\r
-               return self::vue_mensuelle($bid, $annee, $mois);\r
+               $res .= extranetPage::bMain();\r
+               return $res;\r
        }\r
 \r
        public static function getExtra($extra)\r
@@ -58,7 +59,6 @@ class wsStats {
                        if ($date[2] != $y || $date[1] != $m) {\r
                                continue;\r
                        }\r
-                       fb($y, $m);\r
                        $days = $x->xpath("//day[@day=" . $date[0] . "]");\r
                        foreach($days as $day) {\r
                                break;\r
@@ -210,41 +210,56 @@ class wsStats {
                }\r
        }\r
 \r
-       public static function getActives($stats, $rr, &$aextra, &$adown, &$adownp, &$aprint, &$afriend)\r
+       public static function getActives($stats, $book, &$aextra, &$adown, &$adownp, &$aprint, &$afriend)\r
        {\r
-               $extra = self::getExtra($rr->extras);\r
+               $extra = self::getExtra($book->extras);\r
                $aextra = ($extra != null && $stats['extras'] > 0);\r
-               $adown = ($rr->pdf == 1 && $stats['downloads'] > 0);\r
-               $adownp = ($rr->pdf == 1 && $rr->pdfComplex == 1 && $stats['partDownloads'] > 0);\r
-               $aprint = ($rr->print == 1);\r
-               $afriend = ($rr->friend == 1);\r
+               $adown = ($book->parametres->pdf == 1 && $stats['downloads'] > 0);\r
+               $adownp = ($book->parametres->pdf == 1 && $book->parametres->pdfComplex == 1 && $stats['partDownloads'] > 0);\r
+               $aprint = ($book->parametres->print == 1);\r
+               $afriend = ($book->parametres->friend == 1);\r
        }\r
 \r
-       public static function globalDatas($date_creation, $rr, $stats, $afriend, $aprint, $adown, $adownp, $aextra)\r
+       public static function globalDatas($titre, $date_creation, $book, $stats, $afriend, $aprint, $adown, $adownp, $aextra)\r
        {\r
+               global $core;\r
                $res = '<table class="liste max">';\r
-               $res .= '<tr><td>' . $date_creation . '</td><td class="stats_col">' . date(__('d-m-Y'), $rr->date) . '</td></tr>';\r
+               $res .= '<tr><th colspan="2">' . $core->typo->Titre($titre) . '</th></tr>';\r
+               $res .= '<tr><td>' . $date_creation . '</td><td class="stats_col">' . date(__('d-m-Y'), $book->date) . '</td></tr>';\r
 \r
-               $res .= '<tr><td>' . __('Nombre de lieux de visite') . '</td><td class="stats_col">' . $stats['places'] . '</td></tr>';\r
+               $res .= '<tr class="odd"><td>' . __('Nombre de lieux de visite') . '</td><td class="stats_col">' . $stats['places'] . '</td></tr>';\r
                $res .= '<tr><td>' . __('Nombre de visiteurs uniques') . '</td><td class="stats_col">' . $stats['visitors'] . '</td></tr>';\r
-               $res .= '<tr><td>' . __('Nombre de visites') . '</td><td class="stats_col">' . $stats['visits'] . '</td></tr>';\r
+               $res .= '<tr class="odd"><td>' . __('Nombre de visites') . '</td><td class="stats_col">' . $stats['visits'] . '</td></tr>';\r
 \r
                $res .= '<tr><td>' . __('Nombre de pages vues') . '</td><td class="stats_col">' . $stats['pages'] . '</td></tr>';\r
+               $i = 1;\r
                if ($afriend) {\r
-                       $res .= '<tr><td>' . __('Nombre de liens envoyés') . '</td><td class="stats_col">' . $stats['friends'] . '</td></tr>';\r
+                       $odd = $i % 2 == 1?' class="odd"':'';\r
+                       $i++;\r
+                       $res .= '<tr' . $odd . '><td>' . __('Nombre de liens envoyés') . '</td><td class="stats_col">' . $stats['friends'] . '</td></tr>';\r
                }\r
-               $res .= '<tr><td>' . __('Nombre de liens cliqués') . '</td><td class="stats_col">' . $stats['links'] . '</td></tr>';\r
+               $odd = $i % 2 == 1?' class="odd"':'';\r
+               $i++;\r
+               $res .= '<tr' . $odd . '><td>' . __('Nombre de liens cliqués') . '</td><td class="stats_col">' . $stats['links'] . '</td></tr>';\r
                if ($aprint) {\r
-                       $res .= '<tr><td>' . __("Nombre d'impressions") . '</td><td class="stats_col">' . $stats['prints'] . '</td></tr>';\r
+                       $odd = $i % 2 == 1?' class="odd"':'';\r
+                       $i++;\r
+                       $res .= '<tr' . $odd . '><td>' . __("Nombre d'impressions") . '</td><td class="stats_col">' . $stats['prints'] . '</td></tr>';\r
                }\r
                if ($adown) {\r
-                       $res .= '<tr><td>' . __('Nombre de téléchargements') . '</td><td class="stats_col">' . $stats['downloads'] . '</td></tr>';\r
+                       $odd = $i % 2 == 1?' class="odd"':'';\r
+                       $i++;\r
+                       $res .= '<tr' . $odd . '><td>' . __('Nombre de téléchargements') . '</td><td class="stats_col">' . $stats['downloads'] . '</td></tr>';\r
                }\r
                if ($adownp) {\r
-                       $res .= '<tr><td>' . __('Nombre de téléchargements partiels') . '</td><td class="stats_col">' . $stats['partDownloads'] . '</td></tr>';\r
+                       $odd = $i % 2 == 1?' class="odd"':'';\r
+                       $i++;\r
+                       $res .= '<tr' . $odd . '><td>' . __('Nombre de téléchargements partiels') . '</td><td class="stats_col">' . $stats['partDownloads'] . '</td></tr>';\r
                }\r
                if ($aextra) {\r
-                       $res .= '<tr><td>' . __('Accès à la rubrique') . ' ' . $extra . '</td><td class="stats_col">' . $stats['extras'] . '</td></tr>';\r
+                       $odd = $i % 2 == 1?' class="odd"':'';\r
+                       $i++;\r
+                       $res .= '<tr' . $odd . '><td>' . __('Accès à la rubrique') . ' ' . $extra . '</td><td class="stats_col">' . $stats['extras'] . '</td></tr>';\r
                }\r
                $res .= '</table>';\r
                return $res;\r
@@ -252,18 +267,25 @@ class wsStats {
 \r
        public static function indisponible()\r
        {\r
-               $res = wsPage::bh('stats_global');\r
+               $res = extranetPage::bh('stats_global');\r
                $res .= '<p class="center">' . __('Les statistiques concernant cette période ne sont actuellement pas disponibles') . '</p>';\r
-               $res .= wsPage::bf();\r
+               $res .= extranetPage::bf();\r
                return $res;\r
        }\r
 \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
        {\r
                global $core;\r
-               $rr = $core->con->select('SELECT * FROM book WHERE bid=' . $bid);\r
 \r
-               $extra = self::getExtra($rr->extras);\r
+               $book = self::getBook($bid);\r
+               $extra = self::getExtra($book->extras);\r
 \r
                if (is_null($annee)) {\r
                        $stats = self::load_stats($bid);\r
@@ -275,17 +297,20 @@ class wsStats {
                        return self::indisponible();\r
                }\r
 \r
-               self::getActives($stats, $rr, $aextra, $adown, $adownp, $aprint, $afriend);\r
+               self::getActives($stats, $book, $aextra, $adown, $adownp, $aprint, $afriend);\r
+\r
+               $res = extranetPage::bh('stats_global');\r
+\r
+               $titre = __('Statistiques de la publication « %s »');\r
+               $date_creation = __('Date de création de la publication');\r
 \r
-               $res = wsPage::bh('stats_global');\r
-               $titre = ($_SESSION['white'])?__('Statistiques de la publication « %s »'):__('Statistiques du fluidbook « %s »');\r
-               $date_creation = ($_SESSION['white'])? __('Date de création de la publication'): __('Date de création du fluidbook');\r
-               $res .= cubeTypographp::typographp(array('texte' => mb_strtoupper(sprintf($titre, $rr->titre))), 'hache2');\r
-               $res .= self::globalDatas($date_creation, $rr, $stats, $afriend, $aprint, $adown, $adownp, $aextra);\r
-               $res .= wsPage::bf();\r
+               $res .= self::globalDatas(sprintf($titre, $book->nom), $date_creation, $book, $stats, $afriend, $aprint, $adown, $adownp, $aextra);\r
+               $res .= extranetPage::bf();\r
 \r
-               $res .= wsPage::bh('stats_detail_mois');\r
-               $res .= cubeTypographp::typographp(array('texte' => mb_strtoupper(sprintf(__('Détail par mois'), $rr->titre))), 'hache2');\r
+               $res .= extranetPage::bh('stats_detail_mois');\r
+               $res .= '<table class="liste max">';\r
+               $res .= '<tr><th colspan="10">' . $core->typo->Titre(__('Détail par mois')) . '</th></tr>';\r
+               $res .= '<tr><th colspan="10">';\r
                $res .= '<div class="center" style="width:944px;margin:0 auto;position:relative;">' ;\r
                if (is_null($annee)) {\r
                        $res .= self::graph_global($bid, $stats);\r
@@ -293,8 +318,9 @@ class wsStats {
                        $res .= self::graph_annuel($bid, $annee, $stats);\r
                }\r
                $res .= '</div>';\r
-               $res .= '<table class="liste max">';\r
-               $res .= '<tr><th>' . __('Période') . '</th>';\r
+               $res .= '</th></tr>';\r
+\r
+               $res .= '<tr><th class="stats_col max">' . __('Période') . '</th>';\r
                $res .= '<th class="stats_col">' . __('Lieux de visite') . '</th>';\r
                $res .= '<th class="stats_col">' . __('Visiteurs uniques') . '</th>';\r
                $res .= '<th class="stats_col">' . __('Visites') . '</th>';\r
@@ -334,7 +360,7 @@ class wsStats {
                                if ($afriend) {\r
                                        $res .= '<td class="stats_col"><strong>' . $year['friends'] . '</strong></td>';\r
                                }\r
-                               $res .= '<td class="stats_col"><strong>' . $year['links'] . '<strong></td>';\r
+                               $res .= '<td class="stats_col"><strong>' . $year['links'] . '</strong></td>';\r
                                if ($aprint) {\r
                                        $res .= '<td class="stats_col"><strong>' . $year['prints'] . '</strong></td>';\r
                                }\r
@@ -350,7 +376,7 @@ class wsStats {
                                $res .= '</tr>';\r
                        }\r
                        foreach($year->month as $month) {\r
-                               $res .= '<tr><td><a href="' . SITE_PATH . 'stats/' . $bid . '/' . $month['year'] . '/' . $month['month'] . '">' . strftime('%B %Y', mktime(0, 0, 0, (string)$month['month'], 15, (string)$month['year'])) . '</a></td>';\r
+                               $res .= '<tr class="odd"><td><a href="' . SITE_PATH . 'stats/' . $bid . '/' . $month['year'] . '/' . $month['month'] . '">' . strftime('%B %Y', mktime(0, 0, 0, (string)$month['month'], 15, (string)$month['year'])) . '</a></td>';\r
 \r
                                $res .= '<td class="stats_col">' . $month['places'] . '</td>';\r
                                $res .= '<td class="stats_col">' . $month['visitors'] . '</td>';\r
@@ -376,16 +402,15 @@ class wsStats {
                        }\r
                }\r
                $res .= '</table>';\r
-               $res .= wsPage::bf();\r
+               $res .= extranetPage::bf();\r
                return $res;\r
        }\r
 \r
        public static function graph_global($bid, $stats)\r
        {\r
-               wsDroits::viewBook($bid);\r
                global $core;\r
-               $img = ROOT . '/images/stats/global-' . $bid . '.png';\r
-               $imgw = WEBROOT . '/images/stats/global-' . $bid . '.png';\r
+               $img = SYSIMG . '/stats/global-' . $bid . '.png';\r
+               $imgw = IMG . '/stats/global-' . $bid . '.png';\r
 \r
                $s = array();\r
                foreach ($stats->year as $year) {\r
@@ -397,11 +422,9 @@ class wsStats {
                                $s[$time]['visit'] = $month['visitors'];\r
                        }\r
                }\r
-               fb($s);\r
+\r
                krsort($s);\r
                $s = array_slice($s, 0, 12, true);\r
-               // $s = array_reverse($s);\r
-               fb($s);\r
                $maxv = 0;\r
                $maxp = 0;\r
                $maxb = 0;\r
@@ -420,7 +443,7 @@ class wsStats {
                if (!file_exists($img) || filemtime($img) < cubeDate::round(null, 'H')) {\r
                        $im = imagecreatetruecolor(944, 306);\r
                        imagelayereffect($im, IMG_EFFECT_REPLACE);\r
-                       $trans = imagecolorallocatealpha($im, 244, 244, 241, 0);\r
+                       $trans = imagecolorallocatealpha($im, 255, 255, 255, 0);\r
                        imagefill($im, 0, 0, $trans);\r
                        imagelayereffect($im, IMG_EFFECT_ALPHABLEND);\r
                        $i = 1;\r
@@ -466,12 +489,12 @@ class wsStats {
                        imageline($im, 0 , $y0, 944 , $y0 , $c0);\r
                        imagepng($im, $img);\r
                }\r
-               $res = '<div style="position:absolute;top:' . $mhp . 'px;left:900px;color:#514e49;background:#f4f4f1;padding-left:2px;padding-right:2px;">' . $maxpages . '</div>';\r
-               $res .= '<div style="position:absolute;top:' . $mhb . 'px;left:900px;color:#f54d00;background:#f4f4f1;padding-left:2px;padding-right:2px;">' . $maxb . '</div>';\r
-               $res .= '<div style="position:absolute;top:' . $mhv . 'px;left:900px;color:#c2d313;background:#f4f4f1;padding-left:2px;padding-right:2px;">' . $maxv . '</div>';\r
-               $res .= '<img src="' . $imgw . '" alt="' . __('Statistiques globales') . '" />';\r
+               $res = '<div class="graphStats"><div class="graph-note" style="top:' . $mhp . 'px;color:#514e49;">' . $maxpages . '</div>';\r
+               $res .= '<div class="graph-note" style="top:' . $mhb . 'px;color:#f54d00">' . $maxb . '</div>';\r
+               $res .= '<div  class="graph-note" style="top:' . $mhv . 'px;color:#c2d313;">' . $maxv . '</div>';\r
+               $res .= '<div class="graph-container" style="background:url(' . $imgw . ')"></div>';\r
                $s = array_reverse(array_pad($s, 12, false), true);\r
-               $res .= '<table style="width:944px;max-width:944px;"><tr>';\r
+               $res .= '<table style="width:944px;max-width:944px;" class="echelle"><tr>';\r
                foreach($s as $time => $val) {\r
                        if (!$val) {\r
                                $res .= '<td style="width:75px;max-width:75px;">' . cubeMedia::spacer(75, 20) . '</td>';\r
@@ -481,11 +504,11 @@ class wsStats {
                }\r
                $res .= '<td style="width:44px;">' . cubeMedia::spacer(44, 20) . '</td>';\r
                $res .= '</tr></table>';\r
-               $res .= '<table style="margin-top:10px;margin-bottom:10px;"><tr>';\r
+               $res .= '<table class="legende"><tr>';\r
                $res .= '<td style="width:12px;background:#514e49;height:12px;"></td><td style="width:10px;"></td><td>' . __('Pages vues') . '</td><td style="width:10px;"></td>';\r
                $res .= '<td style="width:12px;background:#f54d00;height:12px;"></td><td style="width:10px;"></td><td>' . __('Visites') . '</td><td style="width:10px;"></td>';\r
                $res .= '<td style="width:12px;background:#c2d313;height:12px;"></td><td style="width:10px;"></td><td>' . __('Visiteurs uniques') . '</td><td style="width:10px;"></td>';\r
-               $res .= '</tr></table>';\r
+               $res .= '</tr></table></div>';\r
                return $res;\r
        }\r
 \r
@@ -501,12 +524,10 @@ class wsStats {
                return self::vue_globale($bid, $annee);\r
        }\r
 \r
-       public static function getQ($bid, $max, &$maxp, &$maxpages, &$s)\r
+       public static function getQ($book, $max, &$maxp, &$maxpages, &$s)\r
        {\r
-               global $core;\r
-               $rrr = $core->con->select('SELECT pages FROM book WHERE bid=' . $bid);\r
                $maxpages = $maxp;\r
-               $q = max($rrr->pages / 5, 1);\r
+               $q = max($book->pages / 5, 1);\r
                $maxp /= $q;\r
                $maxp = max($max * 4, $maxp);\r
                $q = $maxpages / $maxp;\r
@@ -517,10 +538,8 @@ class wsStats {
 \r
        public static function graph_annuel($bid, $a, $stats)\r
        {\r
-               wsDroits::viewBook($bid);\r
-               global $core;\r
-               $img = ROOT . '/images/stats/annuel-' . $a . '-' . $bid . '.png';\r
-               $imgw = WEBROOT . '/images/stats/annuel-' . $a . '-' . $bid . '.png';\r
+               $img = SYSIMG . '/stats/annuel-' . $a . '-' . $bid . '.png';\r
+               $imgw = IMG . '/stats/annuel-' . $a . '-' . $bid . '.png';\r
                $maxv = 0;\r
                $maxp = 0;\r
                $maxb = 0;\r
@@ -545,7 +564,7 @@ class wsStats {
                if (!file_exists($img) || filemtime($img) < cubeDate::round(null, 'H')) {\r
                        $im = imagecreatetruecolor(944, 306);\r
                        imagelayereffect($im, IMG_EFFECT_REPLACE);\r
-                       $trans = imagecolorallocatealpha($im, 244, 244, 241, 0);\r
+                       $trans = imagecolorallocatealpha($im, 255, 255, 255, 0);\r
                        imagefill($im, 0, 0, $trans);\r
                        imagelayereffect($im, IMG_EFFECT_ALPHABLEND);\r
                        $i = 1;\r
@@ -595,11 +614,11 @@ class wsStats {
                        imageline($im, 0 , $y0, 944 , $y0 , $c0);\r
                        imagepng($im, $img);\r
                }\r
-               $res = '<div style="position:absolute;top:' . $mhp . 'px;left:900px;color:#514e49;background:#f4f4f1;padding-left:2px;padding-right:2px;">' . $maxpages . '</div>';\r
-               $res .= '<div style="position:absolute;top:' . $mhb . 'px;left:900px;color:#f54d00;background:#f4f4f1;padding-left:2px;padding-right:2px;">' . $maxb . '</div>';\r
-               $res .= '<div style="position:absolute;top:' . $mhv . 'px;left:900px;color:#c2d313;background:#f4f4f1;padding-left:2px;padding-right:2px;">' . $maxv . '</div>';\r
-               $res .= '<img src="' . $imgw . '" alt="' . __('Statistiques annuelles') . '" />';\r
-               $res .= '<table style="width:944px;max-width:944px;table-layout:fixed;"><tr>';\r
+               $res = '<div class="graphStats"><div class="graph-note" style="top:' . $mhp . 'px;color:#514e49;">' . $maxpages . '</div>';\r
+               $res .= '<div class="graph-note" style="top:' . $mhb . 'px;color:#f54d00;">' . $maxb . '</div>';\r
+               $res .= '<div class="graph-note" style="top:' . $mhv . 'px;color:#c2d313;">' . $maxv . '</div>';\r
+               $res .= '<div class="graph-container" style="background:url(' . $imgw . ')"></div>';\r
+               $res .= '<table style="width:944px;max-width:944px;table-layout:fixed;" class="echelle"><tr>';\r
                foreach($months as $m => $t) {\r
                        $res .= '<td style="width:75px;max-width:75px;">' . strftime('%b %y', $t) . '</td>';\r
                }\r
@@ -609,37 +628,37 @@ class wsStats {
                $res .= '<td style="width:12px;background:#514e49;height:12px;"></td><td style="width:10px;"></td><td>' . __('Pages vues') . '</td><td style="width:10px;"></td>';\r
                $res .= '<td style="width:12px;background:#f54d00;height:12px;"></td><td style="width:10px;"></td><td>' . __('Visites') . '</td><td style="width:10px;"></td>';\r
                $res .= '<td style="width:12px;background:#c2d313;height:12px;"></td><td style="width:10px;"></td><td>' . __('Visiteurs uniques') . '</td><td style="width:10px;"></td>';\r
-               $res .= '</tr></table>';\r
+               $res .= '</tr></table></div>';\r
                return $res;\r
        }\r
 \r
        public static function vue_mensuelle($bid, $annee, $mois)\r
        {\r
-               wsDroits::viewBook($bid);\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
-               $rr = $core->con->select('SELECT *,book.date AS date FROM book,user WHERE user.uid=book.uid AND bid=' . $bid);\r
-               $extra = self::getExtra($rr->extras);\r
+\r
+               $book = self::getBook($bid);\r
+\r
+               $extra = self::getExtra($book->extras);\r
                $stats = self::load_stats($bid, $annee, $mois);\r
 \r
                if (is_null($stats)) {\r
                        return self::indisponible();\r
                }\r
 \r
-               self::getActives($stats, $rr, $aextra, $adown, $adownp, $aprint, $afriend);\r
+               self::getActives($stats, $book, $aextra, $adown, $adownp, $aprint, $afriend);\r
 \r
                $time_page = mktime(0, 0, 0, $mois, 15, $annee);\r
-               $res = wsPage::bh('stats_global');\r
-               $titre = ($_SESSION['white'])?__('Statistiques de la publication « %s »'):__('Statistiques du fluidbook « %s »');\r
-               $date_creation = ($_SESSION['white'])? __('Date de création de la publication'): __('Date de création du fluidbook');\r
-               $res .= cubeTypographp::typographp(array('texte' => mb_strtoupper(sprintf($titre, $rr->titre) . ' - ' . strftime('%B %Y', $time_page))), 'hache2');\r
-               $res .= self::globalDatas($date_creation, $rr, $stats, $afriend, $aprint, $adown, $adownp, $aextra);\r
-               $res .= wsPage::bf();\r
-               $res .= wsPage::bh('stats_detail_mois');\r
-               $res .= cubeTypographp::typographp(array('texte' => mb_strtoupper(__('Détail par jour') . ' - ' . strftime('%B %Y', $time_page))), 'hache2');\r
-               $res .= '<div class="center" style="width:944px;margin-top:10px;position:relative;">' . self::graph_mensuel($bid, $annee, $mois, $stats) . '</div>';\r
+               $res = extranetPage::bh('stats_global');\r
+               $titre = __('Statistiques de la publication « %s »');\r
+               $date_creation = __('Date de création de la publication');\r
+               $res .= self::globalDatas(sprintf($titre, $book->nom), $date_creation, $book, $stats, $afriend, $aprint, $adown, $adownp, $aextra);\r
+               $res .= extranetPage::bf();\r
+               $res .= extranetPage::bh('stats_detail_mois');\r
+               $res .= '<div class="center" style="width:944px;position:relative;">' . self::graph_mensuel($bid, $annee, $mois, $stats) . '</div>';\r
                $res .= '<table class="liste max">';\r
-               $res .= '<tr><th>' . __('Jour') . '</th>';\r
+               $res .= '<tr><th colspan="5">' . $core->typo->Titre(__('Détail par jour') . ' - ' . strftime('%B %Y', $time_page)) . '</th></tr>';\r
+               $res .= '<tr><th class="stats_col max">' . __('Jour') . '</th>';\r
 \r
                $res .= '<th class="stats_col">' . __('Lieux de visite') . '</th>';\r
 \r
@@ -649,8 +668,10 @@ class wsStats {
                $res .= '<th class="stats_col">' . __('Liens cliqués') . '</th>';\r
                $res .= '</tr>';\r
 \r
+               $i=0;\r
                foreach ($stats->days->day as $day) {\r
-                       $res .= '<tr><td>' . strftime('%A %d', mktime(0, 0, 0, $mois, (string)$day['day'], $annee)) . '</td>';\r
+                       $odd=cubeMath::isOdd($i)?' class="odd"':'';\r
+                       $res .= '<tr'.$odd.'><td >' . strftime('%A %d', mktime(0, 0, 0, $mois, (string)$day['day'], $annee)) . '</td>';\r
 \r
                        $res .= '<td class="stats_col">' . $day['places'] . '</td>';\r
                        $res .= '<td class="stats_col">' . $day['visitors'] . '</td>';\r
@@ -658,57 +679,61 @@ class wsStats {
                        $res .= '<td class="stats_col">' . $day['views'] . '</td>';\r
                        $res .= '<td class="stats_col">' . $day['links'] . '</td>';\r
                        $res .= '</tr>';\r
+                       $i++;\r
                }\r
                $res .= '</table>';\r
 \r
-               $res .= wsPage::bf();\r
-               $res .= wsPage::bh('stats_detail_pages');\r
-               $res .= cubeTypographp::typographp(array('texte' => mb_strtoupper(__('Pages les plus vues') . ' - ' . strftime('%B %Y', $time_page))), 'hache2');\r
+               $res .= extranetPage::bf();\r
+               $res .= extranetPage::bh('stats_detail_pages');\r
                $res .= '<table class="liste max">';\r
-               $res .= '<tr><th>' . __('Pages') . '</th>';\r
-               if ($rr->stats_score == 1) {\r
+               $res .= '<tr><th colspan="5">' . $core->typo->Titre(__('Détail par page') . ' - ' . strftime('%B %Y', $time_page)) . '</th></tr>';\r
+               $res .= '<tr><th class="stats_col max">' . __('Pages') . '</th>';\r
+               if ($book->parametres->stats_score) {\r
                        $res .= '<th class="stats_col">' . __('Score') . '</th>';\r
                }\r
                $res .= '<th class="stats_col">' . __('Vues') . '</th>';\r
                $res .= '<th class="stats_col">' . __('Zooms') . '</th>';\r
-               if ($rr->bookmark == 1) {\r
+               if ($book->parametres->bookmark) {\r
                        $res .= '<th class="stats_col">' . __('Marques-pages') . '</th>';\r
                }\r
-               if ($rr->print == 1) {\r
+               if ($book->parametres->print) {\r
                        $res .= '<th class="stats_col">' . __('Impressions') . '</th></tr>';\r
                }\r
 \r
+               $i=0;\r
                foreach ($stats->pages->page as $page) {\r
                        $p = (string)$page['page'];\r
-                       if ($p > $rr->pages || cubeMath::isOdd($p)) {\r
+                       if ($p > $book->pages || cubeMath::isOdd($p)) {\r
                                continue;\r
                        }\r
                        if ($p == 0) {\r
                                $pagen = '1';\r
-                       } elseif ($p == $rr->pages) {\r
+                       } elseif ($p == $book->parametres->pages) {\r
                                $pagen = $p;\r
                        } else {\r
                                $pagen = $p;\r
                                $pagen .= '-';\r
                                $pagen .= ($p + 1);\r
                        }\r
-                       $res .= '<tr><td>' . $pagen . '</td>';\r
-                       if ($rr->stats_score == 1) {\r
+                               $odd=cubeMath::isOdd($i)?' class="odd"':'';\r
+                       $res .= '<tr'.$odd.'><td>' . $pagen . '</td>';\r
+                       if ($book->parametres->stats_score == 1) {\r
                                $res .= '<td class="center">' . $page['score'] . '</td>';\r
                        }\r
                        $res .= '<td class="center">' . $page['views'] . '</td>';\r
                        $res .= '<td class="center">' . $page['zooms'] . '</td>';\r
-                       if ($rr->bookmark == 1) {\r
+                       if ($book->parametres->bookmark == 1) {\r
                                $res .= '<td class="center">' . $page['bookmarks'] . '</td>';\r
                        }\r
-                       if ($rr->print == 1) {\r
+                       if ($book->parametres->print == 1) {\r
                                $res .= '<td class="center">' . $page['prints'] . '</td></tr>';\r
                        }\r
+                       $i++;\r
                }\r
                $res .= '</table>';\r
 \r
-               $res .= wsPage::bf();\r
-               if ($rr->search == 0) {\r
+               $res .= extranetPage::bf();\r
+               if ($book->parametres->search == 0) {\r
                        $idl = 'stats_links_2';\r
                        $idc = 'stats_country_2';\r
                } else {\r
@@ -717,10 +742,12 @@ class wsStats {
                }\r
 \r
                $res .= '<div id="stats_30">';\r
-               $res .= wsPage::bh($idl);\r
-               $res .= cubeTypographp::typographp(array('texte' => mb_strtoupper(__('Liens les plus cliqués'))), 'hache2');\r
+               $res .= extranetPage::bh($idl);\r
+\r
                $res .= '<table class="liste max">';\r
+               $res .= '<tr><th colspan="2">' . $core->typo->Titre(__('Liens les plus cliqués')) . '</th></tr>';\r
                $res .= '<tr><th class="max">' . __('URL') . '</th><th class="nowrap">' . __('Clics') . '</th></tr>';\r
+               $i = 0;\r
                foreach ($stats->links->link as $link) {\r
                        $uurl = (string)$link['url'];\r
                        $nb = (string)$link['click'];\r
@@ -732,47 +759,58 @@ class wsStats {
                        if (strlen($url) > 30) {\r
                                $url = substr($url, 0, 30) . '...';\r
                        }\r
-                       $res .= '<tr><td class="max"><a href="' . $uurl . '" class="blank" title="' . $uurl . '">' . $url . '</a></td><td class="nowrap center">' . $nb . '</td></tr>';\r
+                       $odd = cubeMath::isOdd($i)?' class="odd"':'';\r
+                       $res .= '<tr' . $odd . '><td class="max"><a href="' . $uurl . '" class="blank" title="' . $uurl . '">' . $url . '</a></td><td class="nowrap center">' . $nb . '</td></tr>';\r
+                       $i++;\r
                }\r
                $res .= '</table>';\r
 \r
-               $res .= wsPage::bf();\r
-               if ($rr->search == 1) {\r
-                       $res .= wsPage::bh('stats_search');\r
-                       $res .= cubeTypographp::typographp(array('texte' => mb_strtoupper(__('Mots les plus recherchés'))), 'hache2');\r
+               $res .= extranetPage::bf();\r
+               if ($book->parametres->search == 1) {\r
+                       $res .= extranetPage::bh('stats_search');\r
                        $res .= '<table class="liste max">';\r
+                       $res .= '<tr><th colspan="2">' . $core->typo->Titre(__('Mots les plus recherchés')) . '</th></tr>';\r
                        $res .= '<tr><th class="max">' . __('Mot') . '</th><th class="nowrap">' . __('Recherches') . '</th></tr>';\r
+                       $i = 0;\r
                        foreach ($stats->searches->search as $search) {\r
-                               $res .= '<tr><td class="max">' . $search['query'] . '</td><td class="nowrap center">' . $search['count'] . '</td></tr>';\r
+                               $q=$search['query'];\r
+                               if(strlen($q)>25){\r
+                                       $q='<abbr title="'.$q.'">'.substr($q,0,25).' ...</abbr>';\r
+                               }\r
+\r
+                               $odd = cubeMath::isOdd($i)?' class="odd"':'';\r
+                               $res .= '<tr' . $odd . '><td class="max">' . $q . '</td><td class="nowrap center">' . $search['count'] . '</td></tr>';\r
+                               $i++;\r
                        }\r
                        $res .= '</table>';\r
-                       $res .= wsPage::bf();\r
+                       $res .= extranetPage::bf();\r
                }\r
 \r
-               $res .= wsPage::bh($idc);\r
-               $res .= cubeTypographp::typographp(array('texte' => mb_strtoupper(__('Origine des visiteurs'))), 'hache2');\r
+               $res .= extranetPage::bh($idc);\r
                $res .= '<table class="liste max">';\r
+               $res .= '<tr><th colspan="2">' . $core->typo->Titre(__('Origine des visiteurs')) . '</th></tr>';\r
                $res .= '<tr><th class="max">' . __('Pays') . '</th><th class="nowrap">' . __('Visiteurs') . '</th></tr>';\r
 \r
+               $i = 0;\r
                foreach ($stats->countries->country as $country) {\r
                        $pays = $country['code'];\r
+                       $odd = cubeMath::isOdd($i)?' class="odd"':'';\r
                        if (!$c = cubeCountry::getCountry($pays)) {\r
                                $c = __('Origine inconnue');\r
                        }\r
-                       $res .= '<tr><td class="max">' . cubeCountry::getFlag($pays) . ' ' . ucfirst(mb_strtolower($c)) . '</td><td class="nowrap center">' . $country['visitors'] . '</td></tr>';\r
+                       $res .= '<tr' . $odd . '><td class="max">' . cubeCountry::getFlag($pays) . ' ' . ucfirst(mb_strtolower($c)) . '</td><td class="nowrap center">' . $country['visitors'] . '</td></tr>';\r
+                       $i++;\r
                }\r
                $res .= '</table>';\r
-               $res .= wsPage::bf();\r
+               $res .= extranetPage::bf();\r
                $res .= '</div>';\r
                return $res;\r
        }\r
 \r
        public static function graph_mensuel($bid, $a, $m, $stats)\r
        {\r
-               wsDroits::viewBook($bid);\r
-               global $core;\r
-               $img = ROOT . '/images/stats/mensuel-' . $a . '-' . $m . '-' . $bid . '.png';\r
-               $imgw = WEBROOT . '/images/stats/mensuel-' . $a . '-' . $m . '-' . $bid . '.png';\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
                $datestocorrect = array(mktime(0, 0, 0, 11, 23, 2009), mktime(0, 0, 0, 12, 8, 2009), mktime(0, 0, 0, 12, 9, 2009));\r
                $maxv = 0;\r
@@ -801,7 +839,7 @@ class wsStats {
                        // Création de l'image\r
                        $im = imagecreatetruecolor(944, 306);\r
                        imagelayereffect($im, IMG_EFFECT_REPLACE);\r
-                       $trans = imagecolorallocatealpha($im, 244, 244, 241, 0);\r
+                       $trans = imagecolorallocatealpha($im, 255, 255, 255, 0);\r
                        imagefill($im, 0, 0, $trans);\r
                        imagelayereffect($im, IMG_EFFECT_ALPHABLEND);\r
                        $i = 1;\r
@@ -851,22 +889,22 @@ class wsStats {
                        imageline($im, 0 , $y0, 944 , $y0 , $c0);\r
                        imagepng($im, $img);\r
                }\r
-               $res = '<div style="position:absolute;top:' . $mhp . 'px;left:900px;color:#514e49;background:#f4f4f1;padding-left:2px;padding-right:2px;">' . $maxpages . '</div>';\r
-               $res .= '<div style="position:absolute;top:' . $mhb . 'px;left:900px;color:#f54d00;background:#f4f4f1;padding-left:2px;padding-right:2px;">' . $maxb . '</div>';\r
-               $res .= '<div style="position:absolute;top:' . $mhv . 'px;left:900px;color:#c2d313;background:#f4f4f1;padding-left:2px;padding-right:2px;">' . $maxv . '</div>';\r
-               $res .= '<img src="' . $imgw . '" alt="' . __('Statistiques mensuelles') . '" />';\r
-               $res .= '<table style="width:944px;max-width:944px;margin:0px;table-layout:fixed;"><tr>';\r
+               $res = '<div class="graphStats"><div class="graph-note" style="top:' . $mhp . 'px;color:#514e49;">' . $maxpages . '</div>';\r
+               $res .= '<div class="graph-note" style="top:' . $mhb . 'px;color:#f54d00;">' . $maxb . '</div>';\r
+               $res .= '<div class="graph-note" style="top:' . $mhv . 'px;color:#c2d313;">' . $maxv . '</div>';\r
+               $res .= '<div class="graph-container" style="background:url(' . $imgw . ')"></div>';\r
+               $res .= '<table style="width:944px;max-width:944px;margin:0px;table-layout:fixed;" class="echelle"><tr>';\r
                foreach($days as $d => $t) {\r
                        $res .= '<td style="width:' . (20 + $space * 2) . 'px;max-width:' . (20 + $space * 2) . 'px;text-align:center;">' . $d . '</td>';\r
                }\r
                $spacef = 944 - (count($days) * (20 + ($space * 2)));\r
                $res .= '<td style="width:' . $spacef . 'px;">' . cubeMedia::spacer($spacef, 20) . '</td>';\r
                $res .= '</tr></table>';\r
-               $res .= '<table style="margin-top:10px;margin-bottom:10px;"><tr>';\r
+               $res .= '<table style="margin-top:10px;margin-bottom:10px;" class="legende"><tr>';\r
                $res .= '<td style="width:12px;background:#514e49;height:12px;"></td><td style="width:10px;"></td><td>' . __('Pages vues') . '</td><td style="width:10px;"></td>';\r
                $res .= '<td style="width:12px;background:#f54d00;height:12px;"></td><td style="width:10px;"></td><td>' . __('Visites') . '</td><td style="width:10px;"></td>';\r
                $res .= '<td style="width:12px;background:#c2d313;height:12px;"></td><td style="width:10px;"></td><td>' . __('Visiteurs uniques') . '</td><td style="width:10px;"></td>';\r
-               $res .= '</tr></table>';\r
+               $res .= '</tr></table></div>';\r
                return $res;\r
        }\r
 }\r
index d6e88e2284f46e9c0b58f88a7d47b3a40c112883..942e6c6246c7e68182f37284920af2f871895108 100644 (file)
@@ -105,6 +105,14 @@ html{height:100%}' . "\n";
                echo $res;\r
        }\r
 \r
+       public static function stats($args)\r
+       {\r
+               $bid = (isset($args[1]))?$args[1]:null;\r
+               $annee = (isset($args[2]))?$args[2]:null;\r
+               $mois = (isset($args[3]))?$args[3]:null;\r
+               return wsStats::display($bid, $annee, $mois);\r
+       }\r
+\r
        public static function editComposition($args)\r
        {\r
                $fv = array(session_name() => session_id(),\r
index ec08478b6ac4b821c8e6858cc8328c783bbc3331..0732bdd4ab9c8064203d33027d93fff67425490d 100644 (file)
@@ -70,8 +70,10 @@ class wsBookParametres extends wsParametres {
                $this->fields['stats'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Activer les statistiques'), 'extra' => false, 'grade' => 1);\r
                $this->fields['statsWeborama'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Statistiques Weborama'), 'size' => 10, 'extra' => true, 'grade' => 1);\r
                $this->fields['googleAnalytics'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Code Google Analytics'), 'size' => 10, 'extra' => true, 'grade' => 1);\r
+               $this->fields['stats_score']= array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Affiche le score dans les statistiques'), 'extra' => false, 'grade' => 1);\r
                $this->forms['stats'] = array('label' => __('Statistiques'),\r
                        'fieldsnames' => array('stats', 'statsWeborama'));\r
+\r
                // .\r
                $this->fields['displayChaptersAtStart'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Afficher le sommaire au chargement de la publication"), 'extra' => true, 'grade' => 4);\r
                $this->fields['chaptersPosition'] = array('type' => 'combo',\r
index 172ef2931e41767e5982cdc3c8f997910ead5dc6..cd9999f47c4fd98a80eabfc3aa037e9aa878cff2 100644 (file)
@@ -434,4 +434,62 @@ display:none;
 \r
 .gris{background-color:#ecedf0;}\r
 \r
-#listeBooks{width:100%;height:100%;}
\ No newline at end of file
+#listeBooks{width:100%;height:100%;}\r
+\r
+/* Stats */\r
+.graphStats table{\r
+       width:auto !important;\r
+}\r
+.graphStats td,.graphStats th{\r
+       padding:0px;\r
+       background:none transparent;\r
+       height:auto;\r
+}\r
+.graphStats .echelle td{\r
+       text-align:center;\r
+}\r
+\r
+.graphStats .graph-note{\r
+       position:absolute;\r
+       left:900px;\r
+       color:#f54d00;\r
+       padding-left:2px;\r
+       padding-right:2px;\r
+       background:#fff;\r
+}\r
+\r
+.graphStats .legende{\r
+       margin-top:10px;\r
+       margin-bottom:10px;\r
+}\r
+\r
+.graphStats .legende td{\r
+       margin-top:10px;\r
+       margin-bottom:10px;\r
+}\r
+\r
+.graphStats .graph-container{\r
+       width:944px;\r
+       height:306px;\r
+}\r
+\r
+th.stats_col,td.stats_col{\r
+       text-align:center;\r
+}\r
+\r
+th.stats_col{\r
+       width:130px;\r
+}\r
+.stats_col.max{\r
+       width:600px;\r
+       text-align:left;\r
+}\r
+\r
+.stats_links .liste,.stats_country .liste,.stats_search .liste{\r
+       min-width:307px;width:307px;max-height:400px;\r
+}\r
+\r
+.stats_links,.stats_country,.stats_search{\r
+       float:left;\r
+       margin-left:0px;\r
+}\r