From f6a50950a24b63f685f25278503c49760b286a73 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Mon, 13 Feb 2012 10:40:01 +0000 Subject: [PATCH] --- inc/ws/Controlleur/class.ws.stats.php | 352 ++++++++++++-------------- style/common.css | 5 + style/ws/style.css | 6 +- 3 files changed, 174 insertions(+), 189 deletions(-) diff --git a/inc/ws/Controlleur/class.ws.stats.php b/inc/ws/Controlleur/class.ws.stats.php index 135e7ccef..9e4575a31 100644 --- a/inc/ws/Controlleur/class.ws.stats.php +++ b/inc/ws/Controlleur/class.ws.stats.php @@ -1,9 +1,10 @@ month; - $moiss = array('' . __('Tous') . '' => SITE_PATH . 'stats/' . $bid . '/' . (string)$y['year']); + $moiss = array('' . __('Tous') . '' => SITE_PATH . 'stats/' . $bid . '/' . (string) $y['year']); $selectedMonth = __('Tous'); - foreach($months as $m) { - if ((string)$m['month'] == $mois) { - $selectedMonth = cubeDate::getMonth((string)$m['month']); + foreach ($months as $m) { + if ((string) $m['month'] == $mois) { + $selectedMonth = cubeDate::getMonth((string) $m['month']); } - $moiss[cubeDate::getMonth((string)$m['month'])] = SITE_PATH . 'stats/' . $bid . '/' . (string)$y['year'] . '/' . (string)$m['month']; + $moiss[cubeDate::getMonth((string) $m['month'])] = SITE_PATH . 'stats/' . $bid . '/' . (string) $y['year'] . '/' . (string) $m['month']; } $listeMois = new commonShortcuts(__('Mois'), $moiss, $selectedMonth); } - if ((string)$y['year'] == $annee) { + if ((string) $y['year'] == $annee) { $selectedYear = $annee; } - $annees[(string)$y['year']] = SITE_PATH . 'stats/' . $bid . '/' . (string)$y['year']; + $annees[(string) $y['year']] = SITE_PATH . 'stats/' . $bid . '/' . (string) $y['year']; } $listeAnnees = new commonShortcuts(__('Année'), $annees, $selectedYear); $listeShortcuts[] = $listeAnnees; @@ -65,8 +66,7 @@ class wsStats { return $res; } - public static function exportXLS($bid, $annee = null, $mois = null) - { + public static function exportXLS($bid, $annee = null, $mois = null) { $xls = new PHPExcel(); if (is_null($annee)) { // Export global @@ -79,21 +79,19 @@ class wsStats { cubeHTTP::forceDownload('stats_' . $bid . '.xls', false); } - public static function addSheetFromTable() - { + public static function addSheetFromTable() { + } - public static function getExtra($extra) - { + public static function getExtra($extra) { $xml = simplexml_load_string('' . $extra . ''); - if ((string)$xml->extraName != '') { - return (string)$xml->extraName; + if ((string) $xml->extraName != '') { + return (string) $xml->extraName; } return null; } - public static function load_stats($bid, $annee = null, $mois = null) - { + public static function load_stats($bid, $annee = null, $mois = null) { $root = WS_STATS . 'xml/' . $bid; if (is_null($annee)) { $xml = $root; @@ -109,6 +107,7 @@ class wsStats { $xml .= '.xml'; if ($x = @simplexml_load_file($xml)) { if (!is_null($mois)) { + } $x = call_user_func(array('wsStats', $sort), $x); self::correctValues($x, $annee, $mois); @@ -117,17 +116,16 @@ class wsStats { return null; } - public static function correctValues($x, $y, $m) - { - foreach(self::$datestocorrect as $date) { + public static function correctValues($x, $y, $m) { + foreach (self::$datestocorrect as $date) { if ($date[2] != $y || $date[1] != $m) { continue; } $days = $x->xpath("//day[@day=" . $date[0] . "]"); - foreach($days as $day) { + foreach ($days as $day) { break; } - $visitors = (string)$day['places'] * 1.2; + $visitors = (string) $day['places'] * 1.2; $visits = $visitors * 1.1; cubeXML::removeAttribute($day, 'visitors'); cubeXML::removeAttribute($day, 'visits'); @@ -136,50 +134,47 @@ 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) { + foreach ($xml->attributes() as $k => $v) { $res->addAttribute($k, $v); } $years = array(); - foreach($xml->year as $year) { - $years[(string)$year['year']] = self::yearSort($year, 'year'); + foreach ($xml->year as $year) { + $years[(string) $year['year']] = self::yearSort($year, 'year'); } ksort($years); - foreach($years as $y) { + foreach ($years as $y) { cubeXML::append($res, $y); } 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) { + foreach ($xml->attributes() as $k => $v) { $res->addAttribute($k, $v); } $months = array(); - foreach($xml->month as $month) { - $months[(string)$month['month']] = $month; + foreach ($xml->month as $month) { + $months[(string) $month['month']] = $month; } ksort($months); - foreach($months as $month) { + foreach ($months as $month) { cubeXML::append($res, $month); } 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) { + foreach ($xml->attributes() as $k => $v) { $res->addAttribute($k, $v); } self::daysSort($xml, $res); @@ -190,18 +185,17 @@ 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) { - $days[(string)$day['day']] = $day; + foreach ($xml->days->day as $day) { + $days[(string) $day['day']] = $day; } ksort($days); - foreach($days as $day) { - $places = (string)$day['places']; + foreach ($days as $day) { + $places = (string) $day['places']; if ($places == 1) { - $visitors = (string)$day['visitors']; + $visitors = (string) $day['visitors']; if ($visitors > 10) { cubeXML::removeAttribute($day, 'places'); $day->addAttribute('places', round($visitors * 0.99)); @@ -211,70 +205,65 @@ class wsStats { } } - public static function pagesSort($xml, $res) - { + public static function pagesSort($xml, $res) { $xpages = $res->addChild('pages'); $pages = array(); $trans = array(); - foreach($xml->pages->page as $page) { - $pages[(string)$page['page']] = (string)$page['score']; - $trans[(string)$page['page']] = $page; + foreach ($xml->pages->page as $page) { + $pages[(string) $page['page']] = (string) $page['score']; + $trans[(string) $page['page']] = $page; } arsort($pages); - foreach($pages as $num => $score) { + foreach ($pages as $num => $score) { cubeXML::append($xpages, $trans[$num]); } } - public static function linksSort($xml, $res) - { + public static function linksSort($xml, $res) { $x = $res->addChild('links'); $links = array(); $trans = array(); - foreach($xml->links->link as $link) { - $links[(string)$link['url']] = (string)$link['click']; - $trans[(string)$link['url']] = $link; + foreach ($xml->links->link as $link) { + $links[(string) $link['url']] = (string) $link['click']; + $trans[(string) $link['url']] = $link; } arsort($links); $links = array_slice($links, 0, 100, true); - foreach($links as $url => $click) { + foreach ($links as $url => $click) { cubeXML::append($x, $trans[$url]); } } - public static function searchesSort($xml, $res) - { + public static function searchesSort($xml, $res) { $x = $res->addChild('searches'); $searches = array(); $trans = array(); - foreach($xml->searches->search as $search) { - $searches[(string)$search['query']] = (string)$search['count']; - $trans[(string)$search['query']] = $search; + foreach ($xml->searches->search as $search) { + $searches[(string) $search['query']] = (string) $search['count']; + $trans[(string) $search['query']] = $search; } arsort($searches); $searches = array_slice($searches, 0, 100, true); - foreach($searches as $q => $count) { + foreach ($searches as $q => $count) { cubeXML::append($x, $trans[$q]); } } - public static function countriesSort($xml, $res) - { + public static function countriesSort($xml, $res) { $x = $res->addChild('countries'); $countries = array(); $trans = array(); - foreach($xml->countries->country as $country) { - $countries[(string)$country['code']] = (string)$country['visitors']; - $trans[(string)$country['code']] = $country; + foreach ($xml->countries->country as $country) { + $countries[(string) $country['code']] = (string) $country['visitors']; + $trans[(string) $country['code']] = $country; } arsort($countries); - foreach($countries as $code => $visitors) { + foreach ($countries as $code => $visitors) { cubeXML::append($x, $trans[$code]); } } - 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); @@ -283,8 +272,7 @@ 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); @@ -295,15 +283,15 @@ class wsStats { // Head if (implode('', $colsTitles) != '') { $res .= ''; - foreach($colsTitles as $i => $title) { - $max = ($firstColMax && $i == 0)?'':' class="stats_col"'; + foreach ($colsTitles as $i => $title) { + $max = ($firstColMax && $i == 0) ? '' : ' class="stats_col"'; $res .= '' . $title . ''; } $res . ''; } // Body - foreach($lines as $i => $line) { - $odd = cubeMath::isOdd($i)?' class="odd"':''; + foreach ($lines as $i => $line) { + $odd = cubeMath::isOdd($i) ? ' class="odd"' : ''; if ($firstLineBold && $i == 0) { $odd = ' class="odd"'; } elseif ($firstLineBold) { @@ -313,8 +301,8 @@ class wsStats { $odd = ''; } $res .= ''; - foreach($line as $j => $cell) { - $max = ($firstColMax && $j == 0)?'':' class="stats_col"'; + foreach ($line as $j => $cell) { + $max = ($firstColMax && $j == 0) ? '' : ' class="stats_col"'; if ($firstLineBold && $i == 0) { $cell = '' . $cell . ''; } @@ -328,8 +316,7 @@ class wsStats { return $res; } - 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) { $colsTitles = array('', ''); $lines = array(); $class = array('liste', 'max'); @@ -356,26 +343,23 @@ class wsStats { $lines[] = array(__('Accès à la rubrique') . ' ' . $extra, $stats['extras']); } - return self::table($titre, $colsTitles , $lines , $class); + 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); @@ -399,7 +383,7 @@ class wsStats { $res .= ''; $res .= ''; $res .= '
' . $core->typo->Titre(__('Détail par mois')) . '
'; - $res .= '
' ; + $res .= '
'; if (is_null($annee)) { $res .= self::graph_global($bid, $stats); } else { @@ -420,12 +404,11 @@ 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); @@ -444,14 +427,17 @@ class wsStats { $res .= commonPage::bf(); // . $res .= commonPage::bh('stats_detail_mois'); - $res .= '
' ; + $res .= '
'; $res .= self::graph_mensuel($bid, $annee, $mois, $stats); - $res . '
'; + $res .= '
'; $res .= self::detailJour($book, $annee, $mois, $stats); $res .= commonPage::bf(); + + + // . $res .= commonPage::bh('stats_detail_pages'); - $res .= self::detailPages($book,$annee,$mois, $stats); + $res .= self::detailPages($book, $annee, $mois, $stats); $res .= commonPage::bf(); // . if ($book->parametres->search == 0) { @@ -479,8 +465,7 @@ 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 = ''; @@ -511,14 +496,14 @@ class wsStats { $lines = array(); $noOdd = false; - foreach($years as $year) { + foreach ($years as $year) { if ($year['annee'] != null) { $lines[] = self::linePeriod($year, $bid, $afriend, $aprint, $adown, $adownp, $aextra); } else { $noOdd = true; } - foreach($year->month as $month) { + foreach ($year->month as $month) { $lines[] = self::linePeriod($month, $bid, $afriend, $aprint, $adown, $adownp, $aextra); } } @@ -526,17 +511,16 @@ class wsStats { return self::table($title, $colsTitles, $lines, array('max', 'liste'), true, false, $noOdd); } - 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'])) { $url .= '/' . $stats['year']; if (isset($stats['month'])) { $url .= '/' . $stats['month']; - $date = strftime('%B %Y', mktime(0, 0, 0, (string)$stats['month'], 15, (string)$stats['year'])); + $date = strftime('%B %Y', mktime(0, 0, 0, (string) $stats['month'], 15, (string) $stats['year'])); } else { - $date = (string)$stats['year']; + $date = (string) $stats['year']; } } @@ -565,13 +549,12 @@ class wsStats { return $line; } - public static function detailJour($book, $annee, $mois, $stats) - { + public static function detailJour($book, $annee, $mois, $stats) { $colsTitles = array(__('Jour'), __('Lieux de visite'), __('Visiteurs uniques'), __('Visites'), __('Pages vues'), __('Liens cliqués')); $lines = array(); foreach ($stats->days->day as $day) { - $lines[] = array(strftime('%A %d', mktime(0, 0, 0, $mois, (string)$day['day'], $annee)), + $lines[] = array(strftime('%A %d', mktime(0, 0, 0, $mois, (string) $day['day'], $annee)), $day['places'], $day['visitors'], $day['visits'], @@ -583,8 +566,7 @@ 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'); @@ -600,7 +582,7 @@ class wsStats { $lines = array(); foreach ($stats->pages->page as $page) { - $p = (string)$page['page']; + $p = (string) $page['page']; if ($p > $book->pages || cubeMath::isOdd($p)) { continue; } @@ -623,7 +605,7 @@ class wsStats { $line[] = $page['zooms']; if ($book->parametres->bookmark == 1) { - $line[] = $page['bookmarks'] ; + $line[] = $page['bookmarks']; } if ($book->parametres->print == 1) { $line[] = $page['prints']; @@ -634,14 +616,13 @@ 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(); foreach ($stats->links->link as $link) { - $uurl = (string)$link['url']; - $nb = (string)$link['click']; + $uurl = (string) $link['url']; + $nb = (string) $link['click']; if (stristr($uurl, 'mailto:') || stristr($uurl, 'http://') || stristr($uurl, 'https://')) { $url = substr($uurl, 7); } else { @@ -657,8 +638,7 @@ 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(); @@ -672,38 +652,35 @@ 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(); $i = 0; foreach ($stats->countries->country as $country) { $pays = $country['code']; - $odd = cubeMath::isOdd($i)?' class="odd"':''; + $odd = cubeMath::isOdd($i) ? ' class="odd"' : ''; if (!$c = cubeCountry::getCountry($pays)) { $c = __('Origine inconnue'); } - $lines[] = array(cubeCountry::getFlag($pays) . ' ' . ucfirst(mb_strtolower($c)) , $country['visitors']); + $lines[] = array(cubeCountry::getFlag($pays) . ' ' . ucfirst(mb_strtolower($c)), $country['visitors']); $i++; } 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; $maxp = max($max * 4, $maxp); $q = $maxpages / $maxp; - foreach($s as $time => $t) { + foreach ($s as $time => $t) { $s[$time]['page'] = intval($s[$time]['page'] / $q); } } - 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; @@ -711,13 +688,13 @@ class wsStats { $maxb = 0; $s = array(); foreach ($stats->month as $month) { - $maxb = max($maxb, (string)$month['visits']); + $maxb = max($maxb, (string) $month['visits']); $maxp = max($maxp, (string) $month['pages']); - $maxv = max($maxv, (string)$month['visitors']); - $time = cubeDate::round(mktime(0, 0, 0, (string)$month['month'], 15, (string)$month['year']), 'm'); + $maxv = max($maxv, (string) $month['visitors']); + $time = cubeDate::round(mktime(0, 0, 0, (string) $month['month'], 15, (string) $month['year']), 'm'); $s[$time] = array(); - $s[$time]['book'] = (string)$month['visits']; - $s[$time]['page'] = (string)$month['pages']; + $s[$time]['book'] = (string) $month['visits']; + $s[$time]['page'] = (string) $month['pages']; $s[$time]['visit'] = (string) $month['visitors']; } // . @@ -737,30 +714,30 @@ class wsStats { $x0 = 0; $y0 = 305; $h = 300; - $c0 = imagecolorallocate($im, 0, 0 , 0); + $c0 = imagecolorallocate($im, 0, 0, 0); $c1 = imagecolorallocatealpha($im, 81, 78, 73, 64); - $hp = $h * ($maxp / $max)-2; - $mhp = $y0 - $hp-6; + $hp = $h * ($maxp / $max) - 2; + $mhp = $y0 - $hp - 6; imagesetstyle($im, array($c1, $c1, $c1, $c1, $c1, $trans, $trans, $trans, $trans)); imageline($im, 0, $y0 - $hp, 944, $y0 - $hp, IMG_COLOR_STYLED); $c1 = imagecolorallocate($im, 81, 78, 73); $c2 = imagecolorallocatealpha($im, 245, 77, 0, 64); - $hb = $h * ($maxb / $max)-1; - $mhb = $y0 - $hb-6; + $hb = $h * ($maxb / $max) - 1; + $mhb = $y0 - $hb - 6; imagesetstyle($im, array($c2, $c2, $c2, $c2, $c2, $trans, $trans, $trans, $trans)); imageline($im, 0, $y0 - $hb, 944, $y0 - $hb, IMG_COLOR_STYLED); $c2 = imagecolorallocate($im, 245, 77, 0); $c3 = imagecolorallocatealpha($im, 194, 211, 19, 32); $hv = $h * ($maxv / $max); - $mhv = $y0 - $hv-6; + $mhv = $y0 - $hv - 6; imagesetstyle($im, array($c3, $c3, $c3, $c3, $c3, $trans, $trans, $trans, $trans)); imageline($im, 0, $y0 - $hv, 944, $y0 - $hv, IMG_COLOR_STYLED); $c3 = imagecolorallocate($im, 194, 211, 19); - foreach($months as $m => $t) { + foreach ($months as $m => $t) { if (isset($s[$t])) { $x0 += 15; - $hp = $h * ($s[$t]['page'] / $max)-2; - $hb = $h * ($s[$t]['book'] / $max)-1; + $hp = $h * ($s[$t]['page'] / $max) - 2; + $hb = $h * ($s[$t]['book'] / $max) - 1; $hv = $h * ($s[$t]['visit'] / $max); imagefilledrectangle($im, $x0 + 40, $y0 - $hp, $x0, $y0, $c1); imagerectangle($im, $x0 + 40, $y0 - $hp, $x0, $y0, $c0); @@ -777,7 +754,7 @@ class wsStats { } } - imageline($im, 0 , $y0, 944 , $y0 , $c0); + imageline($im, 0, $y0, 944, $y0, $c0); imagepng($im, $img); } $res = '
' . $maxpages . '
'; @@ -785,12 +762,12 @@ class wsStats { $res .= '
' . $maxv . '
'; $res .= '
'; $res .= ''; - foreach($months as $m => $t) { + foreach ($months as $m => $t) { $res .= ''; } $res .= ''; $res .= '
' . strftime('%b %y', $t) . '' . cubeMedia::spacer(44, 20) . '
'; - $res .= ''; + $res .= '
'; $res .= ''; $res .= ''; $res .= ''; @@ -798,15 +775,14 @@ 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'; $s = array(); foreach ($stats->year as $year) { - foreach($year->month as $month) { - $time = mktime(0, 0, 0, intval((string)$month['month']), 15, (string)$month['year']); + foreach ($year->month as $month) { + $time = mktime(0, 0, 0, intval((string) $month['month']), 15, (string) $month['year']); $s[$time]['book'] = $month['visits']; $s[$time]['page'] = $month['pages']; $s[$time]['time'] = $time; @@ -819,9 +795,9 @@ class wsStats { $maxv = 0; $maxp = 0; $maxb = 0; - foreach($s as $time => $d) { + foreach ($s as $time => $d) { $maxb = max($maxb, (string) $d['book']); - $maxp = max($maxp, (string)$d['page']); + $maxp = max($maxp, (string) $d['page']); $maxv = max($maxv, (string) $d['visit']); } @@ -841,43 +817,43 @@ class wsStats { $x0 = 900; $y0 = 305; $h = 300; - $c0 = imagecolorallocate($im, 0, 0 , 0); + $c0 = imagecolorallocate($im, 0, 0, 0); $c1 = imagecolorallocatealpha($im, 81, 78, 73, 64); - $hp = $h * ($maxp / $max)-2; - $mhp = $y0 - $hp-6; + $hp = $h * ($maxp / $max) - 2; + $mhp = $y0 - $hp - 6; imagesetstyle($im, array($c1, $c1, $c1, $c1, $c1, $trans, $trans, $trans, $trans)); imageline($im, 0, $y0 - $hp, 944, $y0 - $hp, IMG_COLOR_STYLED); $c1 = imagecolorallocate($im, 81, 78, 73); $c2 = imagecolorallocatealpha($im, 245, 77, 0, 64); - $hb = $h * ($maxb / $max)-1; - $mhb = $y0 - $hb-6; + $hb = $h * ($maxb / $max) - 1; + $mhb = $y0 - $hb - 6; imagesetstyle($im, array($c2, $c2, $c2, $c2, $c2, $trans, $trans, $trans, $trans)); imageline($im, 0, $y0 - $hb, 944, $y0 - $hb, IMG_COLOR_STYLED); $c2 = imagecolorallocate($im, 245, 77, 0); $c3 = imagecolorallocatealpha($im, 194, 211, 19, 32); $hv = $h * ($maxv / $max); - $mhv = $y0 - $hv-6; + $mhv = $y0 - $hv - 6; imagesetstyle($im, array($c3, $c3, $c3, $c3, $c3, $trans, $trans, $trans, $trans)); imageline($im, 0, $y0 - $hv, 944, $y0 - $hv, IMG_COLOR_STYLED); $c3 = imagecolorallocate($im, 194, 211, 19); - foreach($s as $t) { + foreach ($s as $t) { $x0 -= 15; - $hp = $h * ($t['page'] / $max)-2; - $hb = $h * ($t['book'] / $max)-1; + $hp = $h * ($t['page'] / $max) - 2; + $hb = $h * ($t['book'] / $max) - 1; $hv = $h * ($t['visit'] / $max); - imagefilledrectangle($im, $x0-40, $y0 - $hp, $x0, $y0, $c1); - imagerectangle($im, $x0-40, $y0 - $hp, $x0, $y0, $c0); + imagefilledrectangle($im, $x0 - 40, $y0 - $hp, $x0, $y0, $c1); + imagerectangle($im, $x0 - 40, $y0 - $hp, $x0, $y0, $c0); $x0 -= 5; - imagefilledrectangle($im, $x0-40, $y0 - $hb, $x0, $y0, $c2); - imagerectangle($im, $x0-40, $y0 - $hb, $x0, $y0, $c0); + imagefilledrectangle($im, $x0 - 40, $y0 - $hb, $x0, $y0, $c2); + imagerectangle($im, $x0 - 40, $y0 - $hb, $x0, $y0, $c0); $x0 -= 5; - imagefilledrectangle($im, $x0-40, $y0 - $hv, $x0, $y0, $c3); - imagerectangle($im, $x0-40, $y0 - $hv, $x0, $y0, $c0); + imagefilledrectangle($im, $x0 - 40, $y0 - $hv, $x0, $y0, $c3); + imagerectangle($im, $x0 - 40, $y0 - $hv, $x0, $y0, $c0); $i++; $x0 -= 50; } - imageline($im, 0 , $y0, 944 , $y0 , $c0); + imageline($im, 0, $y0, 944, $y0, $c0); imagepng($im, $img); } $res = '
' . $maxpages . '
'; @@ -886,7 +862,7 @@ class wsStats { $res .= '
'; $s = array_reverse(array_pad($s, 12, false), true); $res .= '
' . __('Pages vues') . '' . __('Visites') . '' . __('Visiteurs uniques') . '
'; - foreach($s as $time => $val) { + foreach ($s as $time => $val) { if (!$val) { $res .= ''; } else { @@ -903,8 +879,7 @@ 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); @@ -915,10 +890,10 @@ class wsStats { $v = array(); $s = array(); foreach ($stats->days->day as $day) { - $time = mktime(0, 0, 0, $m, (string)$day['day'], $a); - $maxb = max($maxb, (string)$day['visits']); - $maxp = max($maxp, (string)$day['views']); - $maxv = max($maxv, (string)$day['visitors']); + $time = mktime(0, 0, 0, $m, (string) $day['day'], $a); + $maxb = max($maxb, (string) $day['visits']); + $maxp = max($maxp, (string) $day['views']); + $maxv = max($maxv, (string) $day['visitors']); $s[$time]['book'] = $day['visits']; $s[$time]['page'] = $day['views']; $s[$time]['visit'] = $day['visitors']; @@ -942,30 +917,30 @@ class wsStats { $x0 = 0; $y0 = 305; $h = 300; - $c0 = imagecolorallocate($im, 0, 0 , 0); + $c0 = imagecolorallocate($im, 0, 0, 0); $c1 = imagecolorallocatealpha($im, 81, 78, 73, 64); - $hp = $h * ($maxp / $max)-2; - $mhp = $y0 - $hp-6; + $hp = $h * ($maxp / $max) - 2; + $mhp = $y0 - $hp - 6; imagesetstyle($im, array($c1, $c1, $c1, $c1, $c1, $trans, $trans, $trans, $trans)); imageline($im, 0, $y0 - $hp, 944, $y0 - $hp, IMG_COLOR_STYLED); $c1 = imagecolorallocate($im, 81, 78, 73); $c2 = imagecolorallocatealpha($im, 245, 77, 0, 64); - $hb = $h * ($maxb / $max)-1; - $mhb = $y0 - $hb-6; + $hb = $h * ($maxb / $max) - 1; + $mhb = $y0 - $hb - 6; imagesetstyle($im, array($c2, $c2, $c2, $c2, $c2, $trans, $trans, $trans, $trans)); imageline($im, 0, $y0 - $hb, 944, $y0 - $hb, IMG_COLOR_STYLED); $c2 = imagecolorallocate($im, 245, 77, 0); $c3 = imagecolorallocatealpha($im, 194, 211, 19, 32); $hv = $h * ($maxv / $max); - $mhv = $y0 - $hv-6; + $mhv = $y0 - $hv - 6; imagesetstyle($im, array($c3, $c3, $c3, $c3, $c3, $trans, $trans, $trans, $trans)); imageline($im, 0, $y0 - $hv, 944, $y0 - $hv, IMG_COLOR_STYLED); $c3 = imagecolorallocate($im, 194, 211, 19); - foreach($days as $d => $t) { + foreach ($days as $d => $t) { if (isset($s[$t])) { $x0 += $space; - $hp = $h * ($s[$t]['page'] / $max)-2; - $hb = $h * ($s[$t]['book'] / $max)-1; + $hp = $h * ($s[$t]['page'] / $max) - 2; + $hb = $h * ($s[$t]['book'] / $max) - 1; $hv = $h * ($s[$t]['visit'] / $max); imagefilledrectangle($im, $x0 + 14, $y0 - $hp, $x0, $y0, $c1); imagerectangle($im, $x0 + 14, $y0 - $hp, $x0, $y0, $c0); @@ -982,7 +957,7 @@ class wsStats { } } - imageline($im, 0 , $y0, 944 , $y0 , $c0); + imageline($im, 0, $y0, 944, $y0, $c0); imagepng($im, $img); } $res = '
' . $maxpages . '
'; @@ -990,7 +965,7 @@ class wsStats { $res .= '
' . $maxv . '
'; $res .= '
'; $res .= '
' . cubeMedia::spacer(75, 20) . '
'; - foreach($days as $d => $t) { + foreach ($days as $d => $t) { $res .= ''; } $spacef = 944 - (count($days) * (20 + ($space * 2))); @@ -1003,6 +978,7 @@ class wsStats { $res .= '
' . $d . '
'; return $res; } + } ?> \ No newline at end of file diff --git a/style/common.css b/style/common.css index 541b075e9..807bf3458 100644 --- a/style/common.css +++ b/style/common.css @@ -51,6 +51,11 @@ select{ border-radius:0 0 6px 0; } +.b table.legende tr td, +.b table.legende tr th{ + border-radius: 0 !important; +} + .b h1{ border-radius:6px 6px 0 0; } diff --git a/style/ws/style.css b/style/ws/style.css index 26cee48ab..2956a4ba9 100644 --- a/style/ws/style.css +++ b/style/ws/style.css @@ -462,7 +462,7 @@ th.stats_col{ } .stats_links .liste,.stats_country .liste,.stats_search .liste{ - min-width:307px;width:307px;max-height:400px; + min-width:315px;width:315px;max-width: 315px;max-height:400px; } .stats_links,.stats_country,.stats_search{ @@ -470,6 +470,10 @@ th.stats_col{ margin-left:0px; } +.stats_country,.stats_search{ + margin-left:13px; +} + /* Download book contextMenu */ .downbookContextMenu li{ height:auto; -- 2.39.5