<?php\r
+\r
class wsStats {\r
+\r
public static $datestocorrect = array(array(22, 11, 2009), array(23, 11, 2009), array(8, 12, 2009), array(9, 12, 2009));\r
\r
- public static function display($bid, $annee = null, $mois = null)\r
- {\r
+ public static function display($bid, $annee = null, $mois = null) {\r
global $core;\r
\r
cubePHP::set_memory('512M');\r
$listeShortcuts = array();\r
\r
$listeMois = null;\r
- foreach($years as $y) {\r
+ foreach ($years as $y) {\r
$selectedYear = __('Toutes');\r
- if (!is_null($annee) && $annee == (string)$y['year']) {\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
+ $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
+ 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
+ $moiss[cubeDate::getMonth((string) $m['month'])] = SITE_PATH . 'stats/' . $bid . '/' . (string) $y['year'] . '/' . (string) $m['month'];\r
}\r
$listeMois = new commonShortcuts(__('Mois'), $moiss, $selectedMonth);\r
}\r
- if ((string)$y['year'] == $annee) {\r
+ if ((string) $y['year'] == $annee) {\r
$selectedYear = $annee;\r
}\r
- $annees[(string)$y['year']] = SITE_PATH . 'stats/' . $bid . '/' . (string)$y['year'];\r
+ $annees[(string) $y['year']] = SITE_PATH . 'stats/' . $bid . '/' . (string) $y['year'];\r
}\r
$listeAnnees = new commonShortcuts(__('Année'), $annees, $selectedYear);\r
$listeShortcuts[] = $listeAnnees;\r
return $res;\r
}\r
\r
- public static function exportXLS($bid, $annee = null, $mois = null)\r
- {\r
+ public static function exportXLS($bid, $annee = null, $mois = null) {\r
$xls = new PHPExcel();\r
if (is_null($annee)) {\r
// Export global\r
cubeHTTP::forceDownload('stats_' . $bid . '.xls', false);\r
}\r
\r
- public static function addSheetFromTable()\r
- {\r
+ public static function addSheetFromTable() {\r
+ \r
}\r
\r
- public static function getExtra($extra)\r
- {\r
+ public static function getExtra($extra) {\r
$xml = simplexml_load_string('<extra>' . $extra . '</extra>');\r
- if ((string)$xml->extraName != '') {\r
- return (string)$xml->extraName;\r
+ if ((string) $xml->extraName != '') {\r
+ return (string) $xml->extraName;\r
}\r
return null;\r
}\r
\r
- public static function load_stats($bid, $annee = null, $mois = null)\r
- {\r
+ public static function load_stats($bid, $annee = null, $mois = null) {\r
$root = WS_STATS . 'xml/' . $bid;\r
if (is_null($annee)) {\r
$xml = $root;\r
$xml .= '.xml';\r
if ($x = @simplexml_load_file($xml)) {\r
if (!is_null($mois)) {\r
+ \r
}\r
$x = call_user_func(array('wsStats', $sort), $x);\r
self::correctValues($x, $annee, $mois);\r
return null;\r
}\r
\r
- public static function correctValues($x, $y, $m)\r
- {\r
- foreach(self::$datestocorrect as $date) {\r
+ public static function correctValues($x, $y, $m) {\r
+ foreach (self::$datestocorrect as $date) {\r
if ($date[2] != $y || $date[1] != $m) {\r
continue;\r
}\r
$days = $x->xpath("//day[@day=" . $date[0] . "]");\r
- foreach($days as $day) {\r
+ foreach ($days as $day) {\r
break;\r
}\r
- $visitors = (string)$day['places'] * 1.2;\r
+ $visitors = (string) $day['places'] * 1.2;\r
$visits = $visitors * 1.1;\r
cubeXML::removeAttribute($day, 'visitors');\r
cubeXML::removeAttribute($day, 'visits');\r
}\r
}\r
\r
- public static function correctPlaces($x)\r
- {\r
+ public static function correctPlaces($x) {\r
+ \r
}\r
\r
- public static function globalSort($xml, $root = 'stats')\r
- {\r
+ public static function globalSort($xml, $root = 'stats') {\r
$res = simplexml_load_string('<' . $root . ' />');\r
- foreach($xml->attributes() as $k => $v) {\r
+ foreach ($xml->attributes() as $k => $v) {\r
$res->addAttribute($k, $v);\r
}\r
$years = array();\r
- foreach($xml->year as $year) {\r
- $years[(string)$year['year']] = self::yearSort($year, 'year');\r
+ foreach ($xml->year as $year) {\r
+ $years[(string) $year['year']] = self::yearSort($year, 'year');\r
}\r
ksort($years);\r
- foreach($years as $y) {\r
+ foreach ($years as $y) {\r
cubeXML::append($res, $y);\r
}\r
return $res;\r
}\r
\r
- public static function yearSort($xml, $root = 'stats')\r
- {\r
+ public static function yearSort($xml, $root = 'stats') {\r
$res = simplexml_load_string('<' . $root . ' />');\r
- foreach($xml->attributes() as $k => $v) {\r
+ foreach ($xml->attributes() as $k => $v) {\r
$res->addAttribute($k, $v);\r
}\r
$months = array();\r
- foreach($xml->month as $month) {\r
- $months[(string)$month['month']] = $month;\r
+ foreach ($xml->month as $month) {\r
+ $months[(string) $month['month']] = $month;\r
}\r
\r
ksort($months);\r
- foreach($months as $month) {\r
+ foreach ($months as $month) {\r
cubeXML::append($res, $month);\r
}\r
\r
return $res;\r
}\r
\r
- public static function monthSort($xml, $root = 'stats')\r
- {\r
+ public static function monthSort($xml, $root = 'stats') {\r
$res = simplexml_load_string('<' . $root . ' />');\r
- foreach($xml->attributes() as $k => $v) {\r
+ foreach ($xml->attributes() as $k => $v) {\r
$res->addAttribute($k, $v);\r
}\r
self::daysSort($xml, $res);\r
return $res;\r
}\r
\r
- public static function daysSort($xml, $res)\r
- {\r
+ public static function daysSort($xml, $res) {\r
$x = $res->addChild('days');\r
$days = array();\r
- foreach($xml->days->day as $day) {\r
- $days[(string)$day['day']] = $day;\r
+ foreach ($xml->days->day as $day) {\r
+ $days[(string) $day['day']] = $day;\r
}\r
ksort($days);\r
- foreach($days as $day) {\r
- $places = (string)$day['places'];\r
+ foreach ($days as $day) {\r
+ $places = (string) $day['places'];\r
if ($places == 1) {\r
- $visitors = (string)$day['visitors'];\r
+ $visitors = (string) $day['visitors'];\r
if ($visitors > 10) {\r
cubeXML::removeAttribute($day, 'places');\r
$day->addAttribute('places', round($visitors * 0.99));\r
}\r
}\r
\r
- public static function pagesSort($xml, $res)\r
- {\r
+ public static function pagesSort($xml, $res) {\r
$xpages = $res->addChild('pages');\r
$pages = array();\r
$trans = array();\r
- foreach($xml->pages->page as $page) {\r
- $pages[(string)$page['page']] = (string)$page['score'];\r
- $trans[(string)$page['page']] = $page;\r
+ foreach ($xml->pages->page as $page) {\r
+ $pages[(string) $page['page']] = (string) $page['score'];\r
+ $trans[(string) $page['page']] = $page;\r
}\r
arsort($pages);\r
- foreach($pages as $num => $score) {\r
+ foreach ($pages as $num => $score) {\r
cubeXML::append($xpages, $trans[$num]);\r
}\r
}\r
\r
- public static function linksSort($xml, $res)\r
- {\r
+ public static function linksSort($xml, $res) {\r
$x = $res->addChild('links');\r
$links = array();\r
$trans = array();\r
- foreach($xml->links->link as $link) {\r
- $links[(string)$link['url']] = (string)$link['click'];\r
- $trans[(string)$link['url']] = $link;\r
+ foreach ($xml->links->link as $link) {\r
+ $links[(string) $link['url']] = (string) $link['click'];\r
+ $trans[(string) $link['url']] = $link;\r
}\r
arsort($links);\r
$links = array_slice($links, 0, 100, true);\r
- foreach($links as $url => $click) {\r
+ foreach ($links as $url => $click) {\r
cubeXML::append($x, $trans[$url]);\r
}\r
}\r
\r
- public static function searchesSort($xml, $res)\r
- {\r
+ public static function searchesSort($xml, $res) {\r
$x = $res->addChild('searches');\r
$searches = array();\r
$trans = array();\r
- foreach($xml->searches->search as $search) {\r
- $searches[(string)$search['query']] = (string)$search['count'];\r
- $trans[(string)$search['query']] = $search;\r
+ foreach ($xml->searches->search as $search) {\r
+ $searches[(string) $search['query']] = (string) $search['count'];\r
+ $trans[(string) $search['query']] = $search;\r
}\r
arsort($searches);\r
$searches = array_slice($searches, 0, 100, true);\r
- foreach($searches as $q => $count) {\r
+ foreach ($searches as $q => $count) {\r
cubeXML::append($x, $trans[$q]);\r
}\r
}\r
\r
- public static function countriesSort($xml, $res)\r
- {\r
+ public static function countriesSort($xml, $res) {\r
$x = $res->addChild('countries');\r
$countries = array();\r
$trans = array();\r
- foreach($xml->countries->country as $country) {\r
- $countries[(string)$country['code']] = (string)$country['visitors'];\r
- $trans[(string)$country['code']] = $country;\r
+ foreach ($xml->countries->country as $country) {\r
+ $countries[(string) $country['code']] = (string) $country['visitors'];\r
+ $trans[(string) $country['code']] = $country;\r
}\r
arsort($countries);\r
- foreach($countries as $code => $visitors) {\r
+ foreach ($countries as $code => $visitors) {\r
cubeXML::append($x, $trans[$code]);\r
}\r
}\r
\r
- public static function getActives($stats, $book, &$aextra, &$adown, &$adownp, &$aprint, &$afriend)\r
- {\r
+ public static function getActives($stats, $book, &$aextra, &$adown, &$adownp, &$aprint, &$afriend) {\r
$extra = self::getExtra($book->extras);\r
$aextra = ($extra != null && $stats['extras'] > 0);\r
$adown = ($book->parametres->pdf == 1 && $stats['downloads'] > 0);\r
$afriend = ($book->parametres->friend == 1);\r
}\r
\r
- public static function table($title, $colsTitles, $lines, $class, $firstColMax = true, $firstLineBold = false, $noOdd = false)\r
- {\r
+ public static function table($title, $colsTitles, $lines, $class, $firstColMax = true, $firstLineBold = false, $noOdd = false) {\r
global $core;\r
if (is_string($class)) {\r
$class = array($class);\r
// Head\r
if (implode('', $colsTitles) != '') {\r
$res .= '<tr>';\r
- foreach($colsTitles as $i => $title) {\r
- $max = ($firstColMax && $i == 0)?'':' class="stats_col"';\r
+ foreach ($colsTitles as $i => $title) {\r
+ $max = ($firstColMax && $i == 0) ? '' : ' class="stats_col"';\r
$res .= '<th' . $max . '>' . $title . '</th>';\r
}\r
$res . '</tr>';\r
}\r
// Body\r
- foreach($lines as $i => $line) {\r
- $odd = cubeMath::isOdd($i)?' class="odd"':'';\r
+ foreach ($lines as $i => $line) {\r
+ $odd = cubeMath::isOdd($i) ? ' class="odd"' : '';\r
if ($firstLineBold && $i == 0) {\r
$odd = ' class="odd"';\r
} elseif ($firstLineBold) {\r
$odd = '';\r
}\r
$res .= '<tr' . $odd . '>';\r
- foreach($line as $j => $cell) {\r
- $max = ($firstColMax && $j == 0)?'':' class="stats_col"';\r
+ foreach ($line as $j => $cell) {\r
+ $max = ($firstColMax && $j == 0) ? '' : ' class="stats_col"';\r
if ($firstLineBold && $i == 0) {\r
$cell = '<strong>' . $cell . '</strong>';\r
}\r
return $res;\r
}\r
\r
- public static function globalDatas($titre, $date_creation, $book, $stats, $afriend, $aprint, $adown, $adownp, $aextra)\r
- {\r
+ public static function globalDatas($titre, $date_creation, $book, $stats, $afriend, $aprint, $adown, $adownp, $aextra) {\r
$colsTitles = array('', '');\r
$lines = array();\r
$class = array('liste', 'max');\r
$lines[] = array(__('Accès à la rubrique') . ' ' . $extra, $stats['extras']);\r
}\r
\r
- return self::table($titre, $colsTitles , $lines , $class);\r
+ return self::table($titre, $colsTitles, $lines, $class);\r
}\r
\r
- public static function indisponible()\r
- {\r
+ public static function indisponible() {\r
$res = commonPage::bh('stats_global');\r
$res .= '<p class="center">' . __('Les statistiques concernant cette période ne sont actuellement pas disponibles') . '</p>';\r
$res .= commonPage::bf();\r
return $res;\r
}\r
\r
- public static function getBook($bid)\r
- {\r
+ public static function getBook($bid) {\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
+ public static function vue_globale($bid, $annee = null) {\r
global $core;\r
$book = self::getBook($bid);\r
$extra = self::getExtra($book->extras);\r
$res .= '<table class="liste max">';\r
$res .= '<tr><th>' . $core->typo->Titre(__('Détail par mois')) . '</th></tr>';\r
$res .= '<tr><th>';\r
- $res .= '<div class="center" style="width:944px;margin:0 auto;position:relative;">' ;\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
* @param mixed $annee\r
* @return\r
*/\r
- public static function vue_annuelle($bid, $annee)\r
- {\r
+ public static function vue_annuelle($bid, $annee) {\r
return self::vue_globale($bid, $annee);\r
}\r
- public static function vue_mensuelle($bid, $annee, $mois)\r
- {\r
+\r
+ public static function vue_mensuelle($bid, $annee, $mois) {\r
$datestocorrect = array(mktime(0, 0, 0, 11, 23, 2009), mktime(0, 0, 0, 12, 8, 2009), mktime(0, 0, 0, 12, 9, 2009));\r
global $core;\r
$book = self::getBook($bid);\r
$res .= commonPage::bf();\r
// .\r
$res .= commonPage::bh('stats_detail_mois');\r
- $res .= '<div class="center" style="width:944px;position:relative;">' ;\r
+ $res .= '<div class="center" style="width:944px;position:relative;">';\r
$res .= self::graph_mensuel($bid, $annee, $mois, $stats);\r
- $res . '</div>';\r
+ $res .= '</div>';\r
$res .= self::detailJour($book, $annee, $mois, $stats);\r
$res .= commonPage::bf();\r
+\r
+\r
+\r
// .\r
$res .= commonPage::bh('stats_detail_pages');\r
- $res .= self::detailPages($book,$annee,$mois, $stats);\r
+ $res .= self::detailPages($book, $annee, $mois, $stats);\r
$res .= commonPage::bf();\r
// .\r
if ($book->parametres->search == 0) {\r
return $res;\r
}\r
\r
- public static function detailPeriode($book, $stats, $bid, $annee)\r
- {\r
+ public static function detailPeriode($book, $stats, $bid, $annee) {\r
self::getActives($stats, $book, $aextra, $adown, $adownp, $aprint, $afriend);\r
\r
$title = '';\r
\r
$lines = array();\r
$noOdd = false;\r
- foreach($years as $year) {\r
+ foreach ($years as $year) {\r
if ($year['annee'] != null) {\r
$lines[] = self::linePeriod($year, $bid, $afriend, $aprint, $adown, $adownp, $aextra);\r
} else {\r
$noOdd = true;\r
}\r
\r
- foreach($year->month as $month) {\r
+ foreach ($year->month as $month) {\r
$lines[] = self::linePeriod($month, $bid, $afriend, $aprint, $adown, $adownp, $aextra);\r
}\r
}\r
return self::table($title, $colsTitles, $lines, array('max', 'liste'), true, false, $noOdd);\r
}\r
\r
- public static function linePeriod($stats, $bid, $afriend, $aprint, $adown, $adownp, $aextra)\r
- {\r
+ public static function linePeriod($stats, $bid, $afriend, $aprint, $adown, $adownp, $aextra) {\r
$line = array();\r
$url = SITE_PATH . 'stats/' . $bid;\r
if (isset($stats['year'])) {\r
$url .= '/' . $stats['year'];\r
if (isset($stats['month'])) {\r
$url .= '/' . $stats['month'];\r
- $date = strftime('%B %Y', mktime(0, 0, 0, (string)$stats['month'], 15, (string)$stats['year']));\r
+ $date = strftime('%B %Y', mktime(0, 0, 0, (string) $stats['month'], 15, (string) $stats['year']));\r
} else {\r
- $date = (string)$stats['year'];\r
+ $date = (string) $stats['year'];\r
}\r
}\r
\r
return $line;\r
}\r
\r
- public static function detailJour($book, $annee, $mois, $stats)\r
- {\r
+ public static function detailJour($book, $annee, $mois, $stats) {\r
$colsTitles = array(__('Jour'), __('Lieux de visite'), __('Visiteurs uniques'), __('Visites'), __('Pages vues'), __('Liens cliqués'));\r
$lines = array();\r
\r
foreach ($stats->days->day as $day) {\r
- $lines[] = array(strftime('%A %d', mktime(0, 0, 0, $mois, (string)$day['day'], $annee)),\r
+ $lines[] = array(strftime('%A %d', mktime(0, 0, 0, $mois, (string) $day['day'], $annee)),\r
$day['places'],\r
$day['visitors'],\r
$day['visits'],\r
return self::table(__('Détail par jour') . ' - ' . strftime('%B %Y', $time_page), $colsTitles, $lines, array('liste', 'max'), true);\r
}\r
\r
- public static function detailPages($book,$annee,$mois, $stats)\r
- {\r
+ public static function detailPages($book, $annee, $mois, $stats) {\r
$colsTitles = array(__('Pages'));\r
if ($book->parametres->stats_score) {\r
$colsTitles[] = __('Score');\r
\r
$lines = array();\r
foreach ($stats->pages->page as $page) {\r
- $p = (string)$page['page'];\r
+ $p = (string) $page['page'];\r
if ($p > $book->pages || cubeMath::isOdd($p)) {\r
continue;\r
}\r
$line[] = $page['zooms'];\r
\r
if ($book->parametres->bookmark == 1) {\r
- $line[] = $page['bookmarks'] ;\r
+ $line[] = $page['bookmarks'];\r
}\r
if ($book->parametres->print == 1) {\r
$line[] = $page['prints'];\r
return self::table(__('Détail par page') . ' - ' . strftime('%B %Y', $time_page), $colsTitles, $lines, array('liste', 'max'));\r
}\r
\r
- public static function detailLiens($book, $stats)\r
- {\r
+ public static function detailLiens($book, $stats) {\r
$colsTitles = array(__('URL'), __('Clics'));\r
$lines = array();\r
\r
foreach ($stats->links->link as $link) {\r
- $uurl = (string)$link['url'];\r
- $nb = (string)$link['click'];\r
+ $uurl = (string) $link['url'];\r
+ $nb = (string) $link['click'];\r
if (stristr($uurl, 'mailto:') || stristr($uurl, 'http://') || stristr($uurl, 'https://')) {\r
$url = substr($uurl, 7);\r
} else {\r
return self::table(__('Liens les plus cliqués'), $colsTitles, $lines, array('liste', 'max'));\r
}\r
\r
- public static function detailSearch($book, $stats)\r
- {\r
+ public static function detailSearch($book, $stats) {\r
$colsTitles = array(__('Mot'), __('Recherches'));\r
$lines = array();\r
\r
return self::table(__('Mots les plus recherchés'), $colsTitles, $lines, array('liste', 'max'));\r
}\r
\r
- public static function detailOrigine($book, $stats)\r
- {\r
+ public static function detailOrigine($book, $stats) {\r
$colsTitles = array(__('Pays'), __('Visiteurs'));\r
$lines = array();\r
$i = 0;\r
\r
foreach ($stats->countries->country as $country) {\r
$pays = $country['code'];\r
- $odd = cubeMath::isOdd($i)?' class="odd"':'';\r
+ $odd = cubeMath::isOdd($i) ? ' class="odd"' : '';\r
if (!$c = cubeCountry::getCountry($pays)) {\r
$c = __('Origine inconnue');\r
}\r
- $lines[] = array(cubeCountry::getFlag($pays) . ' ' . ucfirst(mb_strtolower($c)) , $country['visitors']);\r
+ $lines[] = array(cubeCountry::getFlag($pays) . ' ' . ucfirst(mb_strtolower($c)), $country['visitors']);\r
$i++;\r
}\r
return self::table(__('Origine des visiteurs'), $colsTitles, $lines, array('liste', 'max'));\r
}\r
\r
- public static function getQ($max, &$maxp, &$maxpages, &$s)\r
- {\r
+ public static function getQ($max, &$maxp, &$maxpages, &$s) {\r
$maxpages = $maxp;\r
$q = 1;\r
$maxp /= $q;\r
$maxp = max($max * 4, $maxp);\r
$q = $maxpages / $maxp;\r
- foreach($s as $time => $t) {\r
+ foreach ($s as $time => $t) {\r
$s[$time]['page'] = intval($s[$time]['page'] / $q);\r
}\r
}\r
\r
- public static function graph_annuel($bid, $a, $stats)\r
- {\r
+ public static function graph_annuel($bid, $a, $stats) {\r
$img = SYSIMG . '/stats/annuel-' . $a . '-' . $bid . '.png';\r
$imgw = IMG . '/stats/annuel-' . $a . '-' . $bid . '.png';\r
$maxv = 0;\r
$maxb = 0;\r
$s = array();\r
foreach ($stats->month as $month) {\r
- $maxb = max($maxb, (string)$month['visits']);\r
+ $maxb = max($maxb, (string) $month['visits']);\r
$maxp = max($maxp, (string) $month['pages']);\r
- $maxv = max($maxv, (string)$month['visitors']);\r
- $time = cubeDate::round(mktime(0, 0, 0, (string)$month['month'], 15, (string)$month['year']), 'm');\r
+ $maxv = max($maxv, (string) $month['visitors']);\r
+ $time = cubeDate::round(mktime(0, 0, 0, (string) $month['month'], 15, (string) $month['year']), 'm');\r
$s[$time] = array();\r
- $s[$time]['book'] = (string)$month['visits'];\r
- $s[$time]['page'] = (string)$month['pages'];\r
+ $s[$time]['book'] = (string) $month['visits'];\r
+ $s[$time]['page'] = (string) $month['pages'];\r
$s[$time]['visit'] = (string) $month['visitors'];\r
}\r
// .\r
$x0 = 0;\r
$y0 = 305;\r
$h = 300;\r
- $c0 = imagecolorallocate($im, 0, 0 , 0);\r
+ $c0 = imagecolorallocate($im, 0, 0, 0);\r
$c1 = imagecolorallocatealpha($im, 81, 78, 73, 64);\r
- $hp = $h * ($maxp / $max)-2;\r
- $mhp = $y0 - $hp-6;\r
+ $hp = $h * ($maxp / $max) - 2;\r
+ $mhp = $y0 - $hp - 6;\r
imagesetstyle($im, array($c1, $c1, $c1, $c1, $c1, $trans, $trans, $trans, $trans));\r
imageline($im, 0, $y0 - $hp, 944, $y0 - $hp, IMG_COLOR_STYLED);\r
$c1 = imagecolorallocate($im, 81, 78, 73);\r
$c2 = imagecolorallocatealpha($im, 245, 77, 0, 64);\r
- $hb = $h * ($maxb / $max)-1;\r
- $mhb = $y0 - $hb-6;\r
+ $hb = $h * ($maxb / $max) - 1;\r
+ $mhb = $y0 - $hb - 6;\r
imagesetstyle($im, array($c2, $c2, $c2, $c2, $c2, $trans, $trans, $trans, $trans));\r
imageline($im, 0, $y0 - $hb, 944, $y0 - $hb, IMG_COLOR_STYLED);\r
$c2 = imagecolorallocate($im, 245, 77, 0);\r
$c3 = imagecolorallocatealpha($im, 194, 211, 19, 32);\r
$hv = $h * ($maxv / $max);\r
- $mhv = $y0 - $hv-6;\r
+ $mhv = $y0 - $hv - 6;\r
imagesetstyle($im, array($c3, $c3, $c3, $c3, $c3, $trans, $trans, $trans, $trans));\r
imageline($im, 0, $y0 - $hv, 944, $y0 - $hv, IMG_COLOR_STYLED);\r
$c3 = imagecolorallocate($im, 194, 211, 19);\r
- foreach($months as $m => $t) {\r
+ foreach ($months as $m => $t) {\r
if (isset($s[$t])) {\r
$x0 += 15;\r
- $hp = $h * ($s[$t]['page'] / $max)-2;\r
- $hb = $h * ($s[$t]['book'] / $max)-1;\r
+ $hp = $h * ($s[$t]['page'] / $max) - 2;\r
+ $hb = $h * ($s[$t]['book'] / $max) - 1;\r
$hv = $h * ($s[$t]['visit'] / $max);\r
imagefilledrectangle($im, $x0 + 40, $y0 - $hp, $x0, $y0, $c1);\r
imagerectangle($im, $x0 + 40, $y0 - $hp, $x0, $y0, $c0);\r
}\r
}\r
\r
- imageline($im, 0 , $y0, 944 , $y0 , $c0);\r
+ imageline($im, 0, $y0, 944, $y0, $c0);\r
imagepng($im, $img);\r
}\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:' . $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
+ foreach ($months as $m => $t) {\r
$res .= '<td style="width:75px;max-width:75px;">' . strftime('%b %y', $t) . '</td>';\r
}\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" style="margin-top:10px;margin-bottom:10px;"><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
return $res;\r
}\r
\r
- public static function graph_global($bid, $stats)\r
- {\r
+ public static function graph_global($bid, $stats) {\r
global $core;\r
$img = SYSIMG . '/stats/global-' . $bid . '.png';\r
$imgw = IMG . '/stats/global-' . $bid . '.png';\r
$s = array();\r
foreach ($stats->year as $year) {\r
- foreach($year->month as $month) {\r
- $time = mktime(0, 0, 0, intval((string)$month['month']), 15, (string)$month['year']);\r
+ foreach ($year->month as $month) {\r
+ $time = mktime(0, 0, 0, intval((string) $month['month']), 15, (string) $month['year']);\r
$s[$time]['book'] = $month['visits'];\r
$s[$time]['page'] = $month['pages'];\r
$s[$time]['time'] = $time;\r
$maxv = 0;\r
$maxp = 0;\r
$maxb = 0;\r
- foreach($s as $time => $d) {\r
+ foreach ($s as $time => $d) {\r
$maxb = max($maxb, (string) $d['book']);\r
- $maxp = max($maxp, (string)$d['page']);\r
+ $maxp = max($maxp, (string) $d['page']);\r
$maxv = max($maxv, (string) $d['visit']);\r
}\r
\r
$x0 = 900;\r
$y0 = 305;\r
$h = 300;\r
- $c0 = imagecolorallocate($im, 0, 0 , 0);\r
+ $c0 = imagecolorallocate($im, 0, 0, 0);\r
$c1 = imagecolorallocatealpha($im, 81, 78, 73, 64);\r
- $hp = $h * ($maxp / $max)-2;\r
- $mhp = $y0 - $hp-6;\r
+ $hp = $h * ($maxp / $max) - 2;\r
+ $mhp = $y0 - $hp - 6;\r
imagesetstyle($im, array($c1, $c1, $c1, $c1, $c1, $trans, $trans, $trans, $trans));\r
imageline($im, 0, $y0 - $hp, 944, $y0 - $hp, IMG_COLOR_STYLED);\r
$c1 = imagecolorallocate($im, 81, 78, 73);\r
$c2 = imagecolorallocatealpha($im, 245, 77, 0, 64);\r
- $hb = $h * ($maxb / $max)-1;\r
- $mhb = $y0 - $hb-6;\r
+ $hb = $h * ($maxb / $max) - 1;\r
+ $mhb = $y0 - $hb - 6;\r
imagesetstyle($im, array($c2, $c2, $c2, $c2, $c2, $trans, $trans, $trans, $trans));\r
imageline($im, 0, $y0 - $hb, 944, $y0 - $hb, IMG_COLOR_STYLED);\r
$c2 = imagecolorallocate($im, 245, 77, 0);\r
$c3 = imagecolorallocatealpha($im, 194, 211, 19, 32);\r
$hv = $h * ($maxv / $max);\r
- $mhv = $y0 - $hv-6;\r
+ $mhv = $y0 - $hv - 6;\r
imagesetstyle($im, array($c3, $c3, $c3, $c3, $c3, $trans, $trans, $trans, $trans));\r
imageline($im, 0, $y0 - $hv, 944, $y0 - $hv, IMG_COLOR_STYLED);\r
$c3 = imagecolorallocate($im, 194, 211, 19);\r
- foreach($s as $t) {\r
+ foreach ($s as $t) {\r
$x0 -= 15;\r
- $hp = $h * ($t['page'] / $max)-2;\r
- $hb = $h * ($t['book'] / $max)-1;\r
+ $hp = $h * ($t['page'] / $max) - 2;\r
+ $hb = $h * ($t['book'] / $max) - 1;\r
$hv = $h * ($t['visit'] / $max);\r
- imagefilledrectangle($im, $x0-40, $y0 - $hp, $x0, $y0, $c1);\r
- imagerectangle($im, $x0-40, $y0 - $hp, $x0, $y0, $c0);\r
+ imagefilledrectangle($im, $x0 - 40, $y0 - $hp, $x0, $y0, $c1);\r
+ imagerectangle($im, $x0 - 40, $y0 - $hp, $x0, $y0, $c0);\r
$x0 -= 5;\r
- imagefilledrectangle($im, $x0-40, $y0 - $hb, $x0, $y0, $c2);\r
- imagerectangle($im, $x0-40, $y0 - $hb, $x0, $y0, $c0);\r
+ imagefilledrectangle($im, $x0 - 40, $y0 - $hb, $x0, $y0, $c2);\r
+ imagerectangle($im, $x0 - 40, $y0 - $hb, $x0, $y0, $c0);\r
$x0 -= 5;\r
- imagefilledrectangle($im, $x0-40, $y0 - $hv, $x0, $y0, $c3);\r
- imagerectangle($im, $x0-40, $y0 - $hv, $x0, $y0, $c0);\r
+ imagefilledrectangle($im, $x0 - 40, $y0 - $hv, $x0, $y0, $c3);\r
+ imagerectangle($im, $x0 - 40, $y0 - $hv, $x0, $y0, $c0);\r
$i++;\r
$x0 -= 50;\r
}\r
\r
- imageline($im, 0 , $y0, 944 , $y0 , $c0);\r
+ imageline($im, 0, $y0, 944, $y0, $c0);\r
imagepng($im, $img);\r
}\r
$res = '<div class="graphStats"><div class="graph-note" style="top:' . $mhp . 'px;color:#514e49;">' . $maxpages . '</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;" class="echelle"><tr>';\r
- foreach($s as $time => $val) {\r
+ foreach ($s as $time => $val) {\r
if (!$val) {\r
$res .= '<td style="width:75px;max-width:75px;">' . cubeMedia::spacer(75, 20) . '</td>';\r
} else {\r
return $res;\r
}\r
\r
- public static function graph_mensuel($bid, $a, $m, $stats)\r
- {\r
+ public static function graph_mensuel($bid, $a, $m, $stats) {\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
$v = array();\r
$s = array();\r
foreach ($stats->days->day as $day) {\r
- $time = mktime(0, 0, 0, $m, (string)$day['day'], $a);\r
- $maxb = max($maxb, (string)$day['visits']);\r
- $maxp = max($maxp, (string)$day['views']);\r
- $maxv = max($maxv, (string)$day['visitors']);\r
+ $time = mktime(0, 0, 0, $m, (string) $day['day'], $a);\r
+ $maxb = max($maxb, (string) $day['visits']);\r
+ $maxp = max($maxp, (string) $day['views']);\r
+ $maxv = max($maxv, (string) $day['visitors']);\r
$s[$time]['book'] = $day['visits'];\r
$s[$time]['page'] = $day['views'];\r
$s[$time]['visit'] = $day['visitors'];\r
$x0 = 0;\r
$y0 = 305;\r
$h = 300;\r
- $c0 = imagecolorallocate($im, 0, 0 , 0);\r
+ $c0 = imagecolorallocate($im, 0, 0, 0);\r
$c1 = imagecolorallocatealpha($im, 81, 78, 73, 64);\r
- $hp = $h * ($maxp / $max)-2;\r
- $mhp = $y0 - $hp-6;\r
+ $hp = $h * ($maxp / $max) - 2;\r
+ $mhp = $y0 - $hp - 6;\r
imagesetstyle($im, array($c1, $c1, $c1, $c1, $c1, $trans, $trans, $trans, $trans));\r
imageline($im, 0, $y0 - $hp, 944, $y0 - $hp, IMG_COLOR_STYLED);\r
$c1 = imagecolorallocate($im, 81, 78, 73);\r
$c2 = imagecolorallocatealpha($im, 245, 77, 0, 64);\r
- $hb = $h * ($maxb / $max)-1;\r
- $mhb = $y0 - $hb-6;\r
+ $hb = $h * ($maxb / $max) - 1;\r
+ $mhb = $y0 - $hb - 6;\r
imagesetstyle($im, array($c2, $c2, $c2, $c2, $c2, $trans, $trans, $trans, $trans));\r
imageline($im, 0, $y0 - $hb, 944, $y0 - $hb, IMG_COLOR_STYLED);\r
$c2 = imagecolorallocate($im, 245, 77, 0);\r
$c3 = imagecolorallocatealpha($im, 194, 211, 19, 32);\r
$hv = $h * ($maxv / $max);\r
- $mhv = $y0 - $hv-6;\r
+ $mhv = $y0 - $hv - 6;\r
imagesetstyle($im, array($c3, $c3, $c3, $c3, $c3, $trans, $trans, $trans, $trans));\r
imageline($im, 0, $y0 - $hv, 944, $y0 - $hv, IMG_COLOR_STYLED);\r
$c3 = imagecolorallocate($im, 194, 211, 19);\r
- foreach($days as $d => $t) {\r
+ foreach ($days as $d => $t) {\r
if (isset($s[$t])) {\r
$x0 += $space;\r
- $hp = $h * ($s[$t]['page'] / $max)-2;\r
- $hb = $h * ($s[$t]['book'] / $max)-1;\r
+ $hp = $h * ($s[$t]['page'] / $max) - 2;\r
+ $hb = $h * ($s[$t]['book'] / $max) - 1;\r
$hv = $h * ($s[$t]['visit'] / $max);\r
imagefilledrectangle($im, $x0 + 14, $y0 - $hp, $x0, $y0, $c1);\r
imagerectangle($im, $x0 + 14, $y0 - $hp, $x0, $y0, $c0);\r
}\r
}\r
\r
- imageline($im, 0 , $y0, 944 , $y0 , $c0);\r
+ imageline($im, 0, $y0, 944, $y0, $c0);\r
imagepng($im, $img);\r
}\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:' . $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
+ 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 .= '</tr></table></div>';\r
return $res;\r
}\r
+\r
}\r
\r
?>
\ No newline at end of file