diff options
author | plegall <plg@piwigo.org> | 2007-01-17 23:06:24 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2007-01-17 23:06:24 +0000 |
commit | 8e43a0fec128ad379bcdf432ddb034db66097c7e (patch) | |
tree | e0204bca4bc45a0cc9a981a2b39f506fc9e35f9a | |
parent | 94755e7bd764e2e4ccfa6cbc146b324ac27dc116 (diff) |
Modification: the history summary graph does not use a true image anymore,
CSS divs are faster and don't require GD library.
git-svn-id: http://piwigo.org/svn/trunk@1729 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | admin/images/phpBarGraph.php | 391 | ||||
-rw-r--r-- | admin/images/stats.img.php | 241 | ||||
-rw-r--r-- | admin/stats.php | 118 | ||||
-rw-r--r-- | template/yoga/admin/default-layout.css | 7 | ||||
-rw-r--r-- | template/yoga/admin/stats.tpl | 8 |
5 files changed, 84 insertions, 681 deletions
diff --git a/admin/images/phpBarGraph.php b/admin/images/phpBarGraph.php deleted file mode 100644 index c88c482f0..000000000 --- a/admin/images/phpBarGraph.php +++ /dev/null @@ -1,391 +0,0 @@ -<?php -// +-----------------------------------------------------------------------+ -// | PhpWebGallery - a PHP based picture gallery | -// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | -// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net | -// +-----------------------------------------------------------------------+ -// | branch : BSF (Best So Far) -// | file : $RCSfile$ -// | last update : $Date$ -// | last modifier : $Author$ -// | revision : $Revision$ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -// Original PhpBarGraph Version 2.3 -// Written By TJ Hunter (tjhunter@ruistech.com) -// http://www.ruistech.com/phpBarGraph -// This class has been adapted to fill phpWG requirements - -class PhpBarGraph -{ - /* -------------------------------- */ - /* Preference Variables */ - /* -------------------------------- */ - var $_debug; - var $_image; // The image to print the bargraph too. - var $_x; // The starting column of the bargraph - var $_y; // The starting row of the bargraph - var $_width; // The width of the bargraph - var $_height; // The height of the bargraph - var $_startBarColorHex; // The top color of the bargraph - var $_endBarColorHex; // The bottom color of the bargraph - var $_lineColorHex; // The color of the lines and text - var $_barSpacing; // The spacing width in between each bar - var $_numOfValueTicks; // The number of horizontal rule ticks - var $_values; // An array of arrays of the values of each bargraph and it's label - var $_showLabels; // If true, print the labels to the image - var $_showValues; // If true, print the values to the image - var $_showBarBorder; // If true, draws a box of around each bar - var $_showFade; // If true, draws each bar with a gradient - var $_showOuterBox; // If true, draws the box on the outside of the bargraph - - /* -------------------------------- */ - /* Private Variables */ - /* -------------------------------- */ - var $_topMargin; - var $_bottomMargin; - var $_leftMargin; - var $_rightMargin; - var $_barWidth; - var $_minBarHeight; - var $_maxBarHeight; - var $_realMinBarHeight; - var $_realMaxBarHeight; - var $_buffer; - - function PhpBarGraph() - { - $this->_debug = false; - $this->_values = array(); - $this->_startBarColorHex = "0000ff"; - $this->_endBarColorHex = "ffffff"; - $this->_lineColorHex = "000000"; - $this->_barSpacing = 10; - $this->_numOfValueTicks = 4; - $this->_buffer = .5; - $this->_showLabels = true; - $this->_showValues = true; - $this->_showBarBorder = true; - $this->_showFade = true; - $this->_showOuterBox = true; - } - - function AddValue($labelName, $theValue) - { - array_push($this->_values, array("label" => $labelName, "value" => $theValue)); - } - - function SetDebug($debug) - { - $this->_debug = $debug; - } - - function SetX($x) - { - $this->_x = $x; - } - - function SetY($y) - { - $this->_y = $y; - } - - function SetWidth($width) - { - $this->_width = $width; - } - - function SetHeight($height) - { - $this->_height = $height; - } - - function SetStartBarColor($color) - { - $this->_startBarColorHex = $color; - } - - function SetEndBarColor($color) - { - $this->_endBarColorHex = $color; - } - - function SetLineColor($color) - { - $this->_lineColorHex = $color; - } - - function SetBarSpacing($barSpacing) - { - $this->_barSpacing = $barSpacing; - } - - function SetNumOfValueTicks($ticks) - { - $this->_numOfValueTicks = $ticks; - } - - function SetShowLabels($labels) - { - $this->_showLabels = $labels; - } - - function SetShowValues($values) - { - $this->_showValues = $values; - } - - function SetBarBorder($border) - { - $this->_showBarBorder = $border; - } - - function SetShowFade($fade) - { - $this->_showFade = $fade; - } - - function SetShowOuterBox($box) - { - $this->_showOuterBox = $box; - } - - - function RGBColor($hexColor) // Returns an array of decimal values from a hex color - { - $r = hexdec(substr($hexColor, 0, 2)); - $g = hexdec(substr($hexColor, 2, 2)); - $b = hexdec(substr($hexColor, 4, 2)); - - $RGBColors = array("red" => $r, "green" => $g, "blue" => $b); - - return $RGBColors; - } - - function DebugPrint() // Prints a bunch of debug information. - { - foreach($this->_values as $value) - { - echo $value["label"] . "=" . $value["value"] . "<br>\n"; - } - - $startColor = $this->RGBColor($this->_startBarColorHex); - echo "StartColor: " . $startColor["red"] . ", " . $startColor["green"] . ", " . $startColor["blue"] . "<br>\n"; - - $endColor = $this->RGBColor($this->_endBarColorHex); - echo "EndColor: " . $endColor["red"] . ", " . $endColor["green"] . ", " . $endColor["blue"] . "<br>\n"; - - $lineColor = $this->RGBColor($this->_lineColorHex); - echo "LineColor: " . $lineColor["red"] . ", " . $lineColor["green"] . ", " . $lineColor["blue"] . "<br>\n"; - - echo "x=" . $this->_x . "<br>\n"; - echo "y=" . $this->_y . "<br>\n"; - echo "width=" . $this->_width . "<br>\n"; - echo "height=" . $this->_height . "<br>\n"; - echo "startBarColorHex=" . $this->_startBarColorHex . "<br>\n"; - echo "endBarColorHex=" . $this->_endBarColorHex . "<br>\n"; - echo "lineColorHex=" . $this->_lineColorHex . "<br>\n"; - echo "barSpacing=" . $this->_barSpacing . "<br>\n"; - echo "numOfValueTicks=" . $this->_numOfValueTicks . "<br>\n"; - - } - - function dif ($start,$end) - { - if ($start >= $end) - $dif = $start - $end; - else - $dif = $end - $start; - - return $dif; - } - - function draw($start,$end,$pos,$step_width) - { - if ($start > $end) - $color = $start - $step_width * $pos; - else - $color = $start + $step_width * $pos; - - return $color; - } - - function fadeBar($image, $x1, $y1, $x2, $y2, $colorsStart, $colorsEnd, $height, $width) // Draws a rectangle with a gradient - { - $startColor = $this->RGBColor($colorsStart); - $red_start = $startColor["red"]; - $green_start = $startColor["green"]; - $blue_start = $startColor["blue"]; - - $endColor = $this->RGBColor($colorsEnd); - $red_end = $endColor["red"]; - $green_end = $endColor["green"]; - $blue_end = $endColor["blue"]; - - // difference between start and end - $dif_red = $this->dif($red_start,$red_end); - $dif_green = $this->dif($green_start,$green_end); - $dif_blue = $this->dif($blue_start,$blue_end); - - $height = $height + 1; - - // width of one color step - $step_red = $dif_red / $height; - $step_green = $dif_green / $height; - $step_blue = $dif_blue / $height; - $width = $width - 1; - - - for ($pos=0; $pos<=$height; $pos++) - { - $color = imagecolorexact ($image, $this->draw($red_start,$red_end,$pos,$step_red), - $this->draw($green_start,$green_end,$pos,$step_green), - $this->draw($blue_start,$blue_end,$pos,$step_blue)); - if ($color == -1) // If this color is already allocatated, don't allocate it again. - { - $color = ImageColorAllocate($image,$this->draw($red_start,$red_end,$pos,$step_red), - $this->draw($green_start,$green_end,$pos,$step_green), - $this->draw($blue_start,$blue_end,$pos,$step_blue)); - } - imageline($image,$x1,$pos+$y1,$x1+$width,$pos+$y1,$color); - - } - - } - - function DrawBarGraph($image) - { - if ($this->_debug) - $this->DebugPrint(); - - // Setup the margins - $this->_topMargin = 0; - $this->_bottomMargin = 30; - $this->_leftMargin = 20; - $this->_rightMargin = $this->_barSpacing + 1 + 10; - - // setup the color for the lines - $tempLineColor = $this->RGBColor($this->_lineColorHex); - $lineColor = ImageColorAllocate($image, $tempLineColor["red"], $tempLineColor["green"], $tempLineColor["blue"]); - - $tempStartColor = $this->RGBColor($this->_startBarColorHex); - $startColor = ImageColorAllocate($image, $tempStartColor["red"], $tempStartColor["green"], $tempStartColor["blue"]); - - // Figure out how wide each bar is going to be. - $this->_barWidth = ($this->_width - ($this->_leftMargin + $this->_rightMargin + 1) - (count($this->_values) * $this->_barSpacing)) / count($this->_values); - - // Find out what the smallest and largest amount is. - $this->_minBarHeight = $this->_values[0]["value"]; - $this->_maxBarHeight = $this->_values[0]["value"]; - for ($i=1; $i < count($this->_values); $i++) - { - if ($this->_minBarHeight > $this->_values[$i]["value"]) - { - $this->_minBarHeight = $this->_values[$i]["value"]; - } - if ($this->_maxBarHeight < $this->_values[$i]["value"]) - { - $this->_maxBarHeight = $this->_values[$i]["value"]; - } - } - - if ($this->_minBarHeight == 0 && $this->_maxBarHeight > 0) // Having the min value as 0 looks funny - { - $this->_minBarHeight = 1; - } - $buff = 1; - // Figure out how tall the tallest and smallest bar are going to be. - $this->_realMinBarHeight = $this->_minBarHeight - ($this->_minBarHeight * $buff + 1); - $this->_realMaxBarHeight = $this->_maxBarHeight * ($this->_buffer + 1); - $workArea = $this->_height - $this->_bottomMargin - $this->_topMargin - 1; - - // Print out all the ticks - if ($this->_numOfValueTicks > $this->_maxBarHeight) - { - $this->_numOfValueTicks = $this->_maxBarHeight; - } - - for ($i=1; $i<=$this->_numOfValueTicks; $i++) - { - $thisBarValue = floor((($this->_maxBarHeight - $this->_minBarHeight) / $this->_numOfValueTicks) * $i) + $this->_minBarHeight; - $myTickheight = ($workArea / ($this->_maxBarHeight - $this->_realMinBarHeight) * ($thisBarValue - $this->_realMinBarHeight)); - - // Figure out where we're going to put this tick.. - $y1 = $this->_height - $this->_bottomMargin - 1 - ($myTickheight); - - if ($thisBarValue >= $this->_minBarHeight) - { - imageline($image, $this->_leftMargin - 5 + $this->_x, $y1 + $this->_y, $this->_width - $this->_rightMargin + $this->_barSpacing + $this->_x, $y1 + $this->_y, $lineColor); - Imagestring($image, 1, $this->_leftMargin + $this->_x - 15, $y1 + $this->_y + 2, $thisBarValue, $lineColor); - } - } - - // Print out all the bars - for ($i=1; $i<=count($this->_values); $i++) - { - // Get the bar height for this bar. - $myBarheight = ($workArea / ($this->_maxBarHeight - $this->_realMinBarHeight) * ($this->_values[$i-1]["value"] - $this->_realMinBarHeight)); - - // Figure out where we're going to put this bar.. - $x1 = $this->_leftMargin + 1 + (($i-1) * $this->_barWidth) + ($i * $this->_barSpacing); - $y1 = $this->_height - $this->_bottomMargin - 1 - ($myBarheight); - $x2 = $this->_leftMargin + (($i-1) * $this->_barWidth) + ($i * $this->_barSpacing) + $this->_barWidth; - $y2 = $this->_height - $this->_bottomMargin - 1; - - if ($this->_values[$i-1]["value"] != 0) // Don't print a bar if the value is 0 - { - // Print the bar - if ($this->_showFade) - { - $this->fadeBar($image, $x1 + $this->_x, $y1 + $this->_y, $x2 + $this->_x, $y2 + $this->_y, $this->_startBarColorHex, $this->_endBarColorHex, $myBarheight, $this->_barWidth); - } - else - { - ImageFilledRectangle($image, $x1 + $this->_x, $y1 + $this->_y, $x2 + $this->_x, $y2 + $this->_y, $startColor); - } - - if ($this->_showBarBorder) - { - ImageRectangle($image, $x1 + $this->_x, $y1 + $this->_y, $x2 + $this->_x, $y2 + $this->_y + 1, $lineColor); - } - } - // Print the amount of the bar - if ($this->_showValues) - { - Imagestring($image, 2, $x1 + $this->_x, $this->_height-($this->_bottomMargin/2)-10 + $this->_y, $this->_values[$i-1]["value"], $lineColor); - } - - // Print out the label of the bar. - if ($this->_showLabels) - { - Imagestring($image, 2, $x1 + $this->_x, $this->_height-($this->_bottomMargin/2) + $this->_y, $this->_values[$i-1]["label"], $lineColor); - } - } - - // draw the border box - if ($this->_showOuterBox) - { - ImageRectangle($image, $this->_leftMargin + $this->_x, $this->_topMargin + $this->_y, $this->_width - $this->_rightMargin + $this->_barSpacing + $this->_x, $this->_height - $this->_bottomMargin + $this->_y, $lineColor); - } - - - - } -} - - -?> diff --git a/admin/images/stats.img.php b/admin/images/stats.img.php deleted file mode 100644 index 7a9d676a8..000000000 --- a/admin/images/stats.img.php +++ /dev/null @@ -1,241 +0,0 @@ -<?php -// +-----------------------------------------------------------------------+ -// | PhpWebGallery - a PHP based picture gallery | -// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | -// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net | -// +-----------------------------------------------------------------------+ -// | branch : BSF (Best So Far) -// | file : $RCSfile$ -// | last update : $Date: 2006-12-04 23:08:35 +0100 (lun, 04 déc 2006) $ -// | last modifier : $Author: rub $ -// | revision : $Revision: 1635 $ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ -//----------------------------------------------------------- include -define('PHPWG_ROOT_PATH','../../'); -define('IN_ADMIN', true); -include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); -include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); -include_once( 'phpBarGraph.php' ); - -// +-----------------------------------------------------------------------+ -// | Check Access and exit when user status is not ok | -// +-----------------------------------------------------------------------+ -check_status(ACCESS_ADMINISTRATOR); - -//------------------------------------------------ variable definition -$outputFormat = "png"; -$legend = $lang['stats_global_graph_title']; -$imageHeight = 256; -$imageWidth = 500; - -foreach (array('day', 'month', 'year') as $key) -{ - if (isset($_GET[$key])) - { - $page[$key] = (int)$_GET[$key]; - } -} - -if (isset($page['day'])) -{ - if (!isset($page['month'])) - { - die('[stats.img.php] month is missing in URL'); - } -} - -if (isset($page['month'])) -{ - if (!isset($page['year'])) - { - die('[stats.img.php] year is missing in URL'); - } -} - -$query = ' -SELECT - nb_pages AS y,'; - -$min_x = null; -$max_x = null; - -if (isset($page['day'])) -{ - $query.= ' - hour AS x - FROM '.HISTORY_SUMMARY_TABLE.' - WHERE year = '.$page['year'].' - AND month = '.$page['month'].' - AND day = '.$page['day'].' - AND hour IS NOT NULL - ORDER BY hour ASC -'; - - $min_x = 0; - $max_x = 23; -} -elseif (isset($page['month'])) -{ - $query.= ' - day AS x - FROM '.HISTORY_SUMMARY_TABLE.' - WHERE year = '.$page['year'].' - AND month = '.$page['month'].' - AND day IS NOT NULL - AND hour IS NULL - ORDER BY day ASC -'; - - $min_x = 1; - $max_x = 31; -} -elseif (isset($page['year'])) -{ - $query.= ' - month AS x - FROM '.HISTORY_SUMMARY_TABLE.' - WHERE year = '.$page['year'].' - AND month IS NOT NULL - AND day IS NULL - ORDER BY month ASC -'; - - $min_x = 1; - $max_x = 12; -} -else -{ - $query.= ' - year AS x - FROM '.HISTORY_SUMMARY_TABLE.' - WHERE year IS NOT NULL - AND month IS NULL - ORDER BY year ASC -'; -} - -//------------------------------------------------ Image definition -$image = ImageCreate($imageWidth, $imageHeight); - -// Fill it with your favorite background color.. -$backgroundColor = ImageColorAllocate($image, 184, 184, 184); -ImageFill($image, 0, 0, $backgroundColor); -$white = ImageColorAllocate($image, 0, 0, 0); - -// Interlace the image.. -Imageinterlace($image, 1); - -// Create a new BarGraph.. -$myBarGraph = new PhpBarGraph; - -// Set the starting x position -$myBarGraph->SetX(10); - -// Set the starting y position -$myBarGraph->SetY(10); - -// Set how wide the bargraph will be -$myBarGraph->SetWidth($imageWidth-20); - -// Set how tall the bargraph will be -$myBarGraph->SetHeight($imageHeight-20); - -// Set this to zero if you don't want to show any. These are the vertical -// bars to help see the values. -// $myBarGraph->SetNumOfValueTicks(3); - - -// You can try uncommenting these lines below for different looks. -// -// The default is true. Setting this to false will cause phpBarGraph to not -// print the labels of each bar. -$myBarGraph->SetShowLabels(true); - -// The default is true. Setting this to false will cause phpBarGraph to not -// print the values of each bar. -$myBarGraph->SetShowValues(false); - -// The default is true. Setting this to false will cause phpBarGraph to not -// print the border of each bar. -$myBarGraph->SetBarBorder(true); - -// The default is true. Setting this to false will cause phpBarGraph to not -// print each bar as a gradient. -$myBarGraph->SetShowFade(true); - -// The default is true. Setting this to false will cause phpBarGraph to not -// print the outside box. -$myBarGraph->SetShowOuterBox(true); - -// The default is 10. This changes the space inbetween each bar. -$myBarGraph->SetBarSpacing(5); - - -// Add Values to the bargraph.. -$result = pwg_query($query); -$datas = array(); -while ($row = mysql_fetch_array($result)) -{ - $datas[$row['x']] = $row['y']; -} - -if (!isset($min_x) and !isset($max_x)) -{ - $min_x = min(array_keys($datas)); - $max_x = max(array_keys($datas)); -} - -for ($i = $min_x; $i <= $max_x; $i++) -{ - if (!isset($datas[$i])) - { - $datas[$i] = 0; - } - - $myBarGraph->AddValue($i, $datas[$i]); -} - -// Set the colors of the bargraph.. -// -// This is the color on the top of every bar. -$myBarGraph->SetStartBarColor("6666ff"); - -// This is the color on the bottom of every bar. This is not used when -// SetShowFade() is set to false. -$myBarGraph->SetEndBarColor("2222aa"); - -// This is the color all the lines and text are printed out with. -$myBarGraph->SetLineColor("000000"); - -// Print the BarGraph to the image.. -$myBarGraph->DrawBarGraph($image); -Imagestring($image, 2, 2, $imageHeight-14, $legend, $white); - -//------------------------------------------------ Image output -if ($outputFormat == "png") -{ - header("Content-type: image/png"); - ImagePNG($image); -} -else if (in_array($outputFormat, array("jpg", "jpeg"))) -{ - header("Content-type: image/jpeg"); - Imagejpeg($image); -} -// Destroy the image. -Imagedestroy($image); -?>
\ No newline at end of file diff --git a/admin/stats.php b/admin/stats.php index 228860b9c..1030c5f45 100644 --- a/admin/stats.php +++ b/admin/stats.php @@ -317,23 +317,6 @@ if (isset($page['month'])) } } -$url_img = PHPWG_ROOT_PATH.'admin/images/stats.img.php'; - -if (isset($page['year'])) -{ - $url_img.= '?year='.$page['year']; -} - -if (isset($page['month'])) -{ - $url_img.= '&month='.$page['month']; -} - -if (isset($page['day'])) -{ - $url_img.= '&day='.$page['day']; -} - $summary_lines = get_summary( @$page['year'], @$page['month'], @@ -405,7 +388,6 @@ $template->set_filenames(array('stats'=>'admin/stats.tpl')); $template->assign_vars( array( 'L_STAT_TITLE' => implode($conf['level_separator'], $title_parts), - 'SRC_REPORT' => $url_img, 'PERIOD_LABEL' => $period_label, ) ); @@ -414,46 +396,90 @@ $template->assign_vars( // | Display statistic rows | // +-----------------------------------------------------------------------+ -$i = 1; +$max_width = 400; + +$datas = array(); +if (isset($page['day'])) +{ + $key = 'hour'; + $min_x = 0; + $max_x = 23; +} +elseif (isset($page['month'])) +{ + $key = 'day'; + $min_x = 1; + $max_x = date( + 't', + mktime(12, 0, 0, $page['month'], 1, $page['year']) + ); +} +elseif (isset($page['year'])) +{ + $key = 'month'; + $min_x = 1; + $max_x = 12; +} +else +{ + $key = 'year'; +} + +$max_pages = 1; foreach ($summary_lines as $line) { - // echo '<pre>'; print_r($line); echo '</pre>'; + if ($line['nb_pages'] > $max_pages) + { + $max_pages = $line['nb_pages']; + } - $value = ''; - - if (isset($line['hour'])) + $datas[ $line[$key] ] = $line['nb_pages']; +} + +if (!isset($min_x) and !isset($max_x)) +{ + $min_x = min(array_keys($datas)); + $max_x = max(array_keys($datas)); +} + +for ($i = $min_x; $i <= $max_x; $i++) +{ + if (!isset($datas[$i])) + { + $datas[$i] = 0; + } + + $url = null; + + if (isset($page['day'])) { - $value.= $line['hour'].' '.l10n('hour'); + $value = $i.' '.l10n('hour'); } - else if (isset($line['day'])) + else if (isset($page['month'])) { $url = PHPWG_ROOT_PATH.'admin.php' .'?page=stats' - .'&year='.$line['year'] - .'&month='.$line['month'] - .'&day='.$line['day'] + .'&year='.$page['year'] + .'&month='.$page['month'] + .'&day='.$i ; - $time = mktime(12, 0, 0, $line['month'], $line['day'], $line['year']); + $time = mktime(12, 0, 0, $page['month'], $i, $page['year']); - $value = '<a href="'.$url.'">'; - $value.= $line['day'].' ('.$lang['day'][date('w', $time)].')'; - $value.= "</a>"; + $value = $i.' ('.$lang['day'][date('w', $time)].')'; } - else if (isset($line['month'])) + else if (isset($page['year'])) { $url = PHPWG_ROOT_PATH.'admin.php' .'?page=stats' - .'&year='.$line['year'] - .'&month='.$line['month'] + .'&year='.$page['year'] + .'&month='.$i ; - $value = '<a href="'.$url.'">'; - $value.= $lang['month'][$line['month']]; - $value.= "</a>"; + $value = $lang['month'][$i]; } else { @@ -461,21 +487,23 @@ foreach ($summary_lines as $line) $url = PHPWG_ROOT_PATH.'admin.php' .'?page=stats' - .'&year='.$line['year'] + .'&year='.$i ; - $value = '<a href="'.$url.'">'; - $value.= $line['year']; - $value.= "</a>"; + $value = $i; + } + + if ($datas[$i] != 0 and isset($url)) + { + $value = '<a href="'.$url.'">'.$value.'</a>'; } $template->assign_block_vars( 'statrow', array( 'VALUE' => $value, - 'PAGES' => $line['nb_pages'], - - 'T_CLASS' => ($i++ % 2) ? 'row1' : 'row2' + 'PAGES' => $datas[$i], + 'WIDTH' => ceil(($datas[$i] * $max_width) / $max_pages ), ) ); } diff --git a/template/yoga/admin/default-layout.css b/template/yoga/admin/default-layout.css index 0f82bee63..6d916d555 100644 --- a/template/yoga/admin/default-layout.css +++ b/template/yoga/admin/default-layout.css @@ -143,3 +143,10 @@ FIELDSET#generalConf TEXTAREA.description { background: #f92; color: white; } /* PWG Graphic charts */ + + +.statBar { + height: 10px; + background-color: #66f; + border: 1px solid black; +}
\ No newline at end of file diff --git a/template/yoga/admin/stats.tpl b/template/yoga/admin/stats.tpl index edf7d9a3c..3f1b90fe8 100644 --- a/template/yoga/admin/stats.tpl +++ b/template/yoga/admin/stats.tpl @@ -3,17 +3,17 @@ <h3>{L_STAT_TITLE}</h3> -<img class="image" src="{SRC_REPORT}" alt="{lang:history chart}" /> - <table class="table2" id="dailyStats"> <tr class="throw"> <th>{PERIOD_LABEL}</th> <th>{lang:Pages seen}</th> + <th></th> </tr> <!-- BEGIN statrow --> - <tr class="{statrow.T_CLASS}"> - <td>{statrow.VALUE}</td> + <tr> + <td style="white-space: nowrap">{statrow.VALUE}</td> <td class="number">{statrow.PAGES}</td> + <td><div class="statBar" style="width:{statrow.WIDTH}px" /></td> </tr> <!-- END statrow --> </table> |