]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 15 Sep 2010 15:34:06 +0000 (15:34 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 15 Sep 2010 15:34:06 +0000 (15:34 +0000)
inc/extranet/Controlleur/_common.php
inc/extranet/Controlleur/class.extranet.page.php
inc/extranet/Controlleur/class.extranet.shortcuts.php [new file with mode: 0644]
inc/ws/Controlleur/class.ws.stats.php
style/ws/style.css

index 04d56d838b5fcf4253a7dfc1037f92be9540bdf2..d1da641e714f02d53dbbc886770d41a349d63604 100644 (file)
@@ -6,6 +6,7 @@ $__autoload['extranetPage'] = dirname(__FILE__) . '/class.extranet.page.php';
 $__autoload['extranetUrl'] = dirname(__FILE__) . '/class.extranet.url.php';\r
 $__autoload['extranetDroits'] = dirname(__FILE__) . '/class.extranet.droits.php';\r
 $__autoload['extranetFiltre'] = dirname(__FILE__) . '/class.extranet.filtre.php';\r
+$__autoload['extranetShortcuts'] = dirname(__FILE__) . '/class.extranet.shortcuts.php';\r
 $__autoload['extranetPageChiffres'] = dirname(__FILE__) . '/class.extranet.page.chiffres.php';\r
 \r
 ?>
\ No newline at end of file
index 00d7fa6d4311800b9753efb70e384f4b3b681ad4..4497bfdcc7860960143c38cae917304f5fc8ab19 100644 (file)
@@ -98,10 +98,16 @@ class extranetPage {
 \r
                if (!is_null($filtres) && is_array($filtres)) {\r
                        $res .= '<form action="' . $action . '" method="post" class="submitonchange">';\r
+                       $hasRealFilters = false;\r
                        foreach($filtres as $filtre) {\r
                                $res .= $filtre->display();\r
+                               if ($filtre instanceof extranetFiltre) {\r
+                                       $hasRealFilters = true;\r
+                               }\r
+                       }\r
+                       if ($hasRealFilters) {\r
+                               $res .= '<div class="efface_filtres"><a href="#" class="ajax" id="efface_filtres" rel="' . $action . '/efface">' . __('Effacer les filtres') . '</a><br /><a href="#" class="popup" rel="formDashboard/' . $dashboard . '">' . __('Ajouter à mon tableau de bord') . '</a></div>';\r
                        }\r
-                       $res .= '<div class="efface_filtres"><a href="#" class="ajax" id="efface_filtres" rel="' . $action . '/efface">' . __('Effacer les filtres') . '</a><br /><a href="#" class="popup" rel="formDashboard/' . $dashboard . '">' . __('Ajouter à mon tableau de bord') . '</a></div>';\r
                        $res .= '</form>';\r
                }\r
                $res .= '</div>';\r
diff --git a/inc/extranet/Controlleur/class.extranet.shortcuts.php b/inc/extranet/Controlleur/class.extranet.shortcuts.php
new file mode 100644 (file)
index 0000000..dbb2487
--- /dev/null
@@ -0,0 +1,38 @@
+<?php\r
+\r
+class extranetShortcuts {\r
+       public $titre;\r
+       public $values;\r
+       public $selectedValue;\r
+\r
+       public function __construct($titre, $values,$selectedValue)\r
+       {\r
+               $this->titre = $titre;\r
+               $this->values = $values;\r
+               $this->selectedValue=$selectedValue;\r
+       }\r
+\r
+       public function display()\r
+       {\r
+               // $limit = 20;\r
+               // $t = (mb_strlen($titre) > $limit)?mb_substr($titre, 0, $limit-4) . '...':$titre;\r
+               $res = '<div class="filtre">';\r
+               $res .= '<span>' . $this->titre . '</span>';\r
+               $res .= '<div class="input' . $class . '"><span><strong>'.$this->selectedValue.'</strong></span>' ;\r
+               $res .= '<a href="#" class="bt" title="' . $titre . '">' . cubeMedia::spacer(155, 18) . '</a>';\r
+               $res .= '</div>';\r
+               $res .= '<ul>';\r
+               $last = count($this->values)-1;\r
+               $i = 0;\r
+               foreach($this->values as $v => $k) {\r
+                       $l = ($i == $last)?' class="last"':'';\r
+                       $res .= '<li' . $l . '>'.cubeMedia::spacer(1,17).'<a href="' . $k . '">' . $v . '</a></li>';\r
+                       $i++;\r
+               }\r
+               $res .= '</ul>';\r
+               $res .= '</div>';\r
+               return $res;\r
+       }\r
+}\r
+\r
+?>
\ No newline at end of file
index 30d7eb889b4cde03d096abd879ec2ffd930b9b83..8ba76213227a7cc7c505f0ae7a721a55aa17e8ab 100644 (file)
@@ -4,9 +4,47 @@ class wsStats {
 \r
        public static function display($bid, $annee = null, $mois = null)\r
        {\r
+               global $core;\r
+\r
                cubePHP::set_memory('512M');\r
 \r
-               $res = extranetPage::barre();\r
+               $global = self::load_stats($bid);\r
+\r
+               $actions = array();\r
+               $actions[] = '<a href="' . SITE_PATH . 'stats/' . $bid . '/exportExcel' . '">' . $core->typo->Ajouter('Exporter au format Excel') . '</a>';\r
+\r
+               $years = $global->year;\r
+               $annees = array('<em>' . __('Toutes') . '</em>' => SITE_PATH . 'stats/' . $bid);\r
+\r
+               $listeShortcuts = array();\r
+\r
+               $listeMois = null;\r
+               foreach($years as $y) {\r
+                       $selectedYear = __('Toutes');\r
+                       if (!is_null($annee) && $annee == (string)$y['year']) {\r
+                               $months = $y->month;\r
+                               $moiss = array('<em>' . __('Tous') . '</em>' => SITE_PATH . 'stats/' . $bid . '/' . (string)$y['year']);\r
+                               $selectedMonth = __('Tous');\r
+                               foreach($months as $m) {\r
+                                       if ((string)$m['month'] == $mois) {\r
+                                               $selectedMonth = cubeDate::getMonth((string)$m['month']);\r
+                                       }\r
+                                       $moiss[cubeDate::getMonth((string)$m['month'])] = SITE_PATH . 'stats/' . $bid . '/' . (string)$y['year'] . '/' . (string)$m['month'];\r
+                               }\r
+                               $listeMois = new extranetShortcuts(__('Mois'), $moiss, $selectedMonth);\r
+                       }\r
+                       if ((string)$y['year'] == $annee) {\r
+                               $selectedYear = $annee;\r
+                       }\r
+                       $annees[(string)$y['year']] = SITE_PATH . 'stats/' . $bid . '/' . (string)$y['year'];\r
+               }\r
+               $listeAnnees = new extranetShortcuts(__('Année'), $annees, $selectedYear);\r
+               $listeShortcuts[] = $listeAnnees;\r
+               if (!is_null($listeMois)) {\r
+                       $listeShortcuts[] = $listeMois;\r
+               }\r
+\r
+               $res = extranetPage::barre($listeShortcuts, 'filtreStats', 'stats'/*, $actions*/);\r
                $res .= extranetPage::tMain();\r
                if (is_null($annee) && is_null($mois)) {\r
                        $res .= self::vue_globale($bid);\r
@@ -123,7 +161,6 @@ class wsStats {
                self::linksSort($xml, $res);\r
                self::searchesSort($xml, $res);\r
                self::countriesSort($xml, $res);\r
-\r
                return $res;\r
        }\r
 \r
@@ -226,11 +263,9 @@ class wsStats {
                $res = '<table class="liste max">';\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 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 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
@@ -283,10 +318,8 @@ class wsStats {
        public static function vue_globale($bid, $annee = null)\r
        {\r
                global $core;\r
-\r
                $book = self::getBook($bid);\r
                $extra = self::getExtra($book->extras);\r
-\r
                if (is_null($annee)) {\r
                        $stats = self::load_stats($bid);\r
                } else {\r
@@ -298,52 +331,56 @@ class wsStats {
                }\r
 \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 .= self::globalDatas(sprintf($titre, $book->nom), $date_creation, $book, $stats, $afriend, $aprint, $adown, $adownp, $aextra);\r
                $res .= extranetPage::bf();\r
-\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
-               } else {\r
-                       $res .= self::graph_annuel($bid, $annee, $stats);\r
-               }\r
-               $res .= '</div>';\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
-               $res .= '<th class="stats_col">' . __('Pages vues') . '</th>';\r
+               $tcol = '';\r
+               $cols = 0;\r
+               $tcol .= '<tr><th class="stats_col max">' . __('Période') . '</th>';\r
+               $tcol .= '<th class="stats_col">' . __('Lieux de visite') . '</th>';\r
+               $tcol .= '<th class="stats_col">' . __('Visiteurs uniques') . '</th>';\r
+               $tcol .= '<th class="stats_col">' . __('Visites') . '</th>';\r
+               $tcol .= '<th class="stats_col">' . __('Pages vues') . '</th>';\r
+               $cols = 5;\r
                if ($afriend) {\r
-                       $res .= '<th class="stats_col">' . __('Liens envoyés') . '</th>';\r
+                       $tcol .= '<th class="stats_col">' . __('Liens envoyés') . '</th>';\r
+                       $cols++;\r
                }\r
-               $res .= '<th class="stats_col">' . __('Liens cliqués') . '</th>';\r
+               $tcol .= '<th class="stats_col">' . __('Liens cliqués') . '</th>';\r
+               $cols++;\r
                if ($aprint) {\r
-                       $res .= '<th class="stats_col">' . __('Impressions') . '</th>';\r
+                       $tcol .= '<th class="stats_col">' . __('Impressions') . '</th>';\r
+                       $cols++;\r
                }\r
                if ($adown) {\r
-                       $res .= '<th class="stats_col">' . __('Téléchargements') . '</th>';\r
+                       $tcol .= '<th class="stats_col">' . __('Téléchargements') . '</th>';\r
+                       $cols++;\r
                }\r
                if ($adownp) {\r
-                       $res .= '<th class="stats_col">' . __('Téléchargements partiels') . '</th>';\r
+                       $tcol .= '<th class="stats_col">' . __('Téléchargements partiels') . '</th>';\r
+                       $cols++;\r
                }\r
                if ($aextra) {\r
-                       $res .= '<th class="stats_col">' . $extra . '</th>';\r
+                       $tcol .= '<th class="stats_col">' . $extra . '</th>';\r
+                       $cols++;\r
                }\r
 \r
-               $res .= '</tr>';\r
-\r
+               $tcol .= '</tr>';\r
+               $res .= extranetPage::bh('stats_detail_mois');\r
+               $res .= '<table class="liste max">';\r
+               $res .= '<tr><th colspan="' . $cols . '">' . $core->typo->Titre(__('Détail par mois')) . '</th></tr>';\r
+               $res .= '<tr><th colspan="' . $cols . '">';\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
+               } else {\r
+                       $res .= self::graph_annuel($bid, $annee, $stats);\r
+               }\r
+               $res .= '</div>';\r
+               $res .= '</th></tr>';\r
+               $res .= $tcol;\r
                if (is_null($annee)) {\r
                        $years = $stats->year;\r
                } else {\r
@@ -377,7 +414,6 @@ class wsStats {
                        }\r
                        foreach($year->month as $month) {\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
                                $res .= '<td class="stats_col">' . $month['visits'] . '</td>';\r
@@ -411,7 +447,6 @@ class wsStats {
                global $core;\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
                        foreach($year->month as $month) {\r
@@ -636,18 +671,14 @@ class wsStats {
        {\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
-\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, $book, $aextra, $adown, $adownp, $aprint, $afriend);\r
-\r
                $time_page = mktime(0, 0, 0, $mois, 15, $annee);\r
                $res = extranetPage::bh('stats_global');\r
                $titre = __('Statistiques de la publication « %s »');\r
@@ -659,20 +690,16 @@ class wsStats {
                $res .= '<table class="liste max">';\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
                $res .= '<th class="stats_col">' . __('Visiteurs uniques') . '</th>';\r
                $res .= '<th class="stats_col">' . __('Visites') . '</th>';\r
                $res .= '<th class="stats_col">' . __('Pages vues') . '</th>';\r
                $res .= '<th class="stats_col">' . __('Liens cliqués') . '</th>';\r
                $res .= '</tr>';\r
-\r
-               $i=0;\r
+               $i = 0;\r
                foreach ($stats->days->day as $day) {\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
+                       $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
                        $res .= '<td class="stats_col">' . $day['places'] . '</td>';\r
                        $res .= '<td class="stats_col">' . $day['visitors'] . '</td>';\r
                        $res .= '<td class="stats_col">' . $day['visits'] . '</td>';\r
@@ -682,7 +709,6 @@ class wsStats {
                        $i++;\r
                }\r
                $res .= '</table>';\r
-\r
                $res .= extranetPage::bf();\r
                $res .= extranetPage::bh('stats_detail_pages');\r
                $res .= '<table class="liste max">';\r
@@ -700,7 +726,7 @@ class wsStats {
                        $res .= '<th class="stats_col">' . __('Impressions') . '</th></tr>';\r
                }\r
 \r
-               $i=0;\r
+               $i = 0;\r
                foreach ($stats->pages->page as $page) {\r
                        $p = (string)$page['page'];\r
                        if ($p > $book->pages || cubeMath::isOdd($p)) {\r
@@ -715,8 +741,8 @@ class wsStats {
                                $pagen .= '-';\r
                                $pagen .= ($p + 1);\r
                        }\r
-                               $odd=cubeMath::isOdd($i)?' class="odd"':'';\r
-                       $res .= '<tr'.$odd.'><td>' . $pagen . '</td>';\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
@@ -731,7 +757,6 @@ class wsStats {
                        $i++;\r
                }\r
                $res .= '</table>';\r
-\r
                $res .= extranetPage::bf();\r
                if ($book->parametres->search == 0) {\r
                        $idl = 'stats_links_2';\r
@@ -743,7 +768,6 @@ class wsStats {
 \r
                $res .= '<div id="stats_30">';\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
@@ -764,7 +788,6 @@ class wsStats {
                        $i++;\r
                }\r
                $res .= '</table>';\r
-\r
                $res .= extranetPage::bf();\r
                if ($book->parametres->search == 1) {\r
                        $res .= extranetPage::bh('stats_search');\r
@@ -773,9 +796,9 @@ class wsStats {
                        $res .= '<tr><th class="max">' . __('Mot') . '</th><th class="nowrap">' . __('Recherches') . '</th></tr>';\r
                        $i = 0;\r
                        foreach ($stats->searches->search as $search) {\r
-                               $q=$search['query'];\r
-                               if(strlen($q)>25){\r
-                                       $q='<abbr title="'.$q.'">'.substr($q,0,25).' ...</abbr>';\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
@@ -790,7 +813,6 @@ class wsStats {
                $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
index cd9999f47c4fd98a80eabfc3aa037e9aa878cff2..7b1e5667a680daf1f8645b0173e4adde86a57f1b 100644 (file)
@@ -310,6 +310,12 @@ input[type="text"],input[type="password"],select,textarea{
 .filtre .input.active{\r
        font-weight:bold;\r
 }\r
+.filtre a{\r
+       color:#5f6162;\r
+       text-decoration:none;\r
+       height:23px;\r
+}\r
+\r
 .filtre ul{\r
        display:none;\r
        position:absolute;\r