Moving pchart in vendor + updating gitignore

skala
Julio Montoya 12 years ago
parent 5588fc58c2
commit ff016ad523
  1. 3
      .gitignore
  2. 128
      .hgignore
  3. 25
      composer.json
  4. 754
      composer.lock
  5. 450
      main/inc/lib/pchart/MyHorBar.class.php
  6. 121
      main/inc/lib/pchart/pCache.class.php
  7. 3563
      main/inc/lib/pchart/pChart.class.php
  8. 262
      main/inc/lib/pchart/pData.class.php
  9. 22
      main/inc/lib/tracking.lib.php

3
.gitignore vendored

@ -3,7 +3,8 @@ main/inc/conf
# Temp directories
archive/*
!archive/.htaccess
archive/.htaccess
archive/index.html
# Courses

@ -1,128 +0,0 @@
#
#ignoring some file
syntax: glob
main/inc/conf
#main/inc/conf/*
#!main/inc/conf/index.html
#!main/inc/conf/*.dist.*
#temp dokeos directories
archive/*
!archive/.htaccess
courses/*
!courses/index.html
main/garbage/*
!main/garbage/index.html
!main/garbage/Serializer
#Home
home/*
#!home/default_platform_document
#!home/faq.html
#!home/home_menu.html
#!home/home_news.html
#!home/home_notice.html
#!home/home_top.html
#!home/index.html
#!home/large_dokeos_logo.gif
#garbage directory
#Avatar images
main/upload/users/*
!main/upload/users/index.html
#Images uploaded by user
#main/default_course_document/images/*
#!main/default_course_document/images/board.jpg
#!main/default_course_document/images/bookcase.jpg
#!main/default_course_document/images/book_highlight.jpg
#!main/default_course_document/images/book.jpg
#!main/default_course_document/images/computer.jpg
#!main/default_course_document/images/diagrams
#!main/default_course_document/images/emot_happy.jpg
#!main/default_course_document/images/emot_neutral.jpg
#!main/default_course_document/images/emot_sad.jpg
#!main/default_course_document/images/emot_wink.jpg
#!main/default_course_document/images/female.jpg
#!main/default_course_document/images/geometry.jpg
#!main/default_course_document/images/homework.jpg
#!main/default_course_document/images/idea.jpg
#!main/default_course_document/images/interaction.jpg
#!main/default_course_document/images/logo_dokeos.png
#!main/default_course_document/images/male.jpg
#!main/default_course_document/images/maths.jpg
#!main/default_course_document/images/mechanism.jpg
#!main/default_course_document/images/mouse.jpg
#!main/default_course_document/images/mr_dokeos
#!main/default_course_document/images/newspaper.jpg
#!main/default_course_document/images/note.jpg
#!main/default_course_document/images/pencil.png
#!main/default_course_document/images/presentation.jpg
#!main/default_course_document/images/redlight.jpg
#!main/default_course_document/images/science.jpg
#!main/default_course_document/images/servicesgather.png
#!main/default_course_document/images/silhouette.png
#!main/default_course_document/images/small
#!main/default_course_document/images/speech.jpg
#!main/default_course_document/images/time.jpg
#!main/default_course_document/images/trainer
#!main/default_course_document/images/tutorial.jpg
#!main/default_course_document/images/twopeople.png
#!main/default_course_document/images/world.jpg
#!main/default_course_document/images/write.jpg
#css
#main/css/*
#*.css
#!main/css/academica
#!main/css/baby_orange
#!main/css/blue_lagoon
#!main/css/cool_blue
#!main/css/corporate
#!main/css/cosmic_campus
#!main/css/csshover3.htc
#!main/css/delicious_bordeaux
#!main/css/dokeos_blue
#!main/css/dokeos_classic
#!main/css/dokeos_classic_2D
#!main/css/empire_green
#!main/css/fruity_orange
#!main/css/index.html
#!main/css/medical
#!main/css/public_admin
#!main/css/royal_purple
#!main/css/silver_line
#!main/css/sober_brown
#!main/css/steel_grey
#!main/css/tasty_olive
#plugins
#plugin/*
#!plugin/date
#!plugin/index.html
#!plugin/search
#PHP Storm settings directory
.idea
.idea/*
.idea/dictionaries/*
.idea/cssxfire.xml
# Xapian indexes directory
searchdb/*
!searchdb/index.html
main/inc/cache/*
test_laurent.php
*.orig
main/auth/shibboleth/config.php
syntax: regexp
^main/upload/users$
syntax: regexp
^\.settings$
nbproject/*
.git
tests/doctrine_console/

@ -1,4 +1,5 @@
{
"name" : "chamilo/chamilo-lms",
"autoload": {
"psr-0": {
"Entity" : "main/inc/",
@ -25,29 +26,39 @@
"symfony/config" : "dev-master",
"symfony/yaml" : "2.1.*",
"symfony/console" : "dev-master",
"twig/twig": ">=1.8,<2.0-dev",
"symfony/twig-bridge": "2.2.*@dev",
"symfony/doctrine-bridge": "2.3.*@dev",
"symfony/security": "dev-master",
"monolog/monolog" : ">=1.0.0",
"symfony/form": "2.3.*@dev",
"symfony/property-access": "dev-master",
"symfony/validator": "dev-master",
"symfony/translation": "dev-master",
"symfony/dependency-injection": "dev-master",
"symfony/browser-kit": "2.3.*@dev",
"monolog/monolog" : ">=1.0.0",
"twig/twig": ">=1.8,<2.0-dev",
"dflydev/doctrine-orm-service-provider": "1.0.*@dev",
"doctrine/migrations": "dev-master",
"swiftmailer/swiftmailer": ">=4.1.2,<4.2-dev",
"pagerfanta/pagerfanta": "dev-master",
"knplabs/knp-menu": "2.0.*@dev",
"gedmo/doctrine-extensions": "2.3.*@dev",
"symfony/web-profiler-bundle": "~2.2",
"silex/web-profiler": "~1.0",
"chamilo/chash": "dev-master",
"igorw/config-service-provider": "1.0.*@dev",
"mpdf/mpdf": "dev-master",
"ezyang/htmlpurifier": "dev-master"
"ezyang/htmlpurifier": "dev-master",
"mheap/silex-assetic": "dev-master",
"leafo/lessphp" : "dev-master",
"natxet/CssMin": "dev-master",
"realityking/pchart": "dev-master"
},
"require-dev": {
"symfony/browser-kit": "2.3.*@dev",
"symfony/web-profiler-bundle": "~2.2",
"silex/web-profiler": "~1.0"
},
"scripts": {
"post-install-cmd": "ChamiloLMS\\Composer\\Script::install",
"post-update-cmd": "ChamiloLMS\\Composer\\Script::install"
},
"minimum-stability": "stable"
}
}

754
composer.lock generated

File diff suppressed because it is too large Load Diff

@ -1,450 +0,0 @@
<?php
/*
pChart - a PHP class to build charts!
Copyright (C) 2008 Jean-Damien POGOLOTTI
Version 1.27d last updated on 09/30/08
Extension by Gabriele FERRI
http://www.gabrieleferri.it
MyHorBar.class is writen to extend pChart.class to write a horizontal bar charts
Copyright (C) 2009 Gabriele FERRI
version 1.0beta 08/05/2009
Contact me with bug reports and comments: info@gabrieleferri.it
http://pchart.sourceforge.net
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, either version 1,2,3 of the License, or
(at your option) any later version.
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, see <http://www.gnu.org/licenses/>.
Draw methods :
drawHorBarGraph($Data,$DataDescription,$Shadow=TRUE,$Alpha=100)
drawHorScale($Data,$DataDescription,$ScaleMode,$R,$G,$B,$DrawTicks=TRUE,$Angle=0,$Decimals=1,$WithMargin=FALSE,$SkipLabels=1,$RightScale=FALSE)
drawHorGrid($LineWidth,$Mosaic,$R=220,$G=220,$B=220,$Alpha=100)
drawTreshold($Value,$R,$G,$B,$ShowLabel=FALSE,$ShowOnBottom=FALSE,$TickWidth=4,$FreeText=NULL,$Angle=0)
*/
class MyHorBar extends pChart
{
/* This function draw a bar graph */
function drawHorBarGraph($Data,$DataDescription,$Shadow=TRUE,$Alpha=100)
{
/* Validate the Data and DataDescription array */
$this->validateDataDescription("drawBarGraph",$DataDescription);
$this->validateData("drawBarGraph",$Data);
$GraphID = 0;
$Series = count($DataDescription["Values"]);
$SeriesWidth = $this->DivisionWidth / ($Series+1);
$SerieYOffset = $this->DivisionWidth / 2 - $SeriesWidth * $Series / 2;
$XZero = $this->GArea_X1 + ((0-$this->VMin) * $this->DivisionRatio);
if ( $XZero < $this->GArea_X1 ) { $XZero = $this->GArea_X1; }
$SerieID = 0;
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
$ID = 0;
foreach ( $DataDescription["Description"] as $keyI => $ValueI )
{ if ( $keyI == $ColName ) { $ColorID = $ID; }; $ID++; }
$YPos = $this->GArea_Y1 + $this->GAreaXOffset + $SerieYOffset + $SeriesWidth * $SerieID;
$XLast = -1;
foreach ( $Data as $Key => $Values )
{
if ( isset($Data[$Key][$ColName]))
{
if ( is_numeric($Data[$Key][$ColName]) )
{
$Value = $Data[$Key][$ColName];
$XPos = $this->GArea_X1 + (($Value-$this->VMin) * $this->DivisionRatio);
/* Save point into the image map if option activated */
if ( $this->BuildMap )
{
$this->addToImageMap(min($XZero,$XPos),$YPos+1,max($XZero,$XPos), $YPos+$SeriesWidth-1,$DataDescription["Description"][$ColName],$Data[$Key][$ColName].$DataDescription["Unit"]["Y"],"Bar");
}
if ( $Shadow && $Alpha == 100 )
$this->drawRectangle($XZero,$YPos+1,$XPos,$YPos+$SeriesWidth-1,25,25,25,TRUE,$Alpha);
$this->drawFilledRectangle($XZero,$YPos+1,$XPos,$YPos+$SeriesWidth-1,$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"],TRUE,$Alpha);
}
}
$YPos = $YPos + $this->DivisionWidth;
}
$SerieID++;
}
}
/* Compute and draw the scale */
function drawHorScale($Data,$DataDescription,$ScaleMode,$R,$G,$B,$DrawTicks=TRUE,$Angle=0,$Decimals=1,$WithMargin=FALSE,$SkipLabels=1,$RightScale=FALSE)
{
/* Validate the Data and DataDescription array */
$this->validateData("drawScale",$Data);
$C_TextColor =$this->AllocateColor($this->Picture,$R,$G,$B);
$this->drawLine($this->GArea_X1,$this->GArea_Y1,$this->GArea_X2,$this->GArea_Y1,$R,$G,$B);
$this->drawLine($this->GArea_X1,$this->GArea_Y1,$this->GArea_X1,$this->GArea_Y2,$R,$G,$B);
if ( $this->VMin == NULL && $this->VMax == NULL)
{
if (isset($DataDescription["Values"][0]))
{
$this->VMin = $Data[0][$DataDescription["Values"][0]];
$this->VMax = $Data[0][$DataDescription["Values"][0]];
}
else { $this->VMin = 2147483647; $this->VMax = -2147483647; }
/* Compute Min and Max values */
if ( $ScaleMode == SCALE_NORMAL || $ScaleMode == SCALE_START0 )
{
if ( $ScaleMode == SCALE_START0 ) { $this->VMin = 0; }
foreach ( $Data as $Key => $Values )
{
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
if (isset($Data[$Key][$ColName]))
{
$Value = $Data[$Key][$ColName];
if ( is_numeric($Value) )
{
if ( $this->VMax < $Value) { $this->VMax = $Value; }
if ( $this->VMin > $Value) { $this->VMin = $Value; }
}
}
}
}
}
elseif ( $ScaleMode == SCALE_ADDALL || $ScaleMode == SCALE_ADDALLSTART0 ) /* Experimental */
{
if ( $ScaleMode == SCALE_ADDALLSTART0 ) { $this->VMin = 0; }
foreach ( $Data as $Key => $Values )
{
$Sum = 0;
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
if (isset($Data[$Key][$ColName]))
{
$Value = $Data[$Key][$ColName];
if ( is_numeric($Value) )
$Sum += $Value;
}
}
if ( $this->VMax < $Sum) { $this->VMax = $Sum; }
if ( $this->VMin > $Sum) { $this->VMin = $Sum; }
}
}
if ( $this->VMax > preg_replace('/\.[0-9]+/','',$this->VMax) )
$this->VMax = preg_replace('/\.[0-9]+/','',$this->VMax)+1;
/* If all values are the same */
if ( $this->VMax == $this->VMin )
{
if ( $this->VMax >= 0 ) { $this->VMax++; }
else { $this->VMin--; }
}
$DataRange = $this->VMax - $this->VMin;
if ( $DataRange == 0 ) { $DataRange = .1; }
/* Compute automatic scaling */
$ScaleOk = FALSE; $Factor = 1;
$MinDivHeight = 25;
$MaxDivs = ($this->GArea_X2 - $this->GArea_X1) / $MinDivHeight;
if ( $this->VMin == 0 && $this->VMax == 0 )
{ $this->VMin = 0; $this->VMax = 2; $Scale = 1; $Divisions = 2;}
elseif ($MaxDivs > 1)
{
while(!$ScaleOk)
{
$Scale1 = ( $this->VMax - $this->VMin ) / $Factor;
$Scale2 = ( $this->VMax - $this->VMin ) / $Factor / 2;
$Scale4 = ( $this->VMax - $this->VMin ) / $Factor / 4;
if ( $Scale1 > 1 && $Scale1 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $Divisions = floor($Scale1); $Scale = 1;}
if ( $Scale2 > 1 && $Scale2 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $Divisions = floor($Scale2); $Scale = 2;}
if (!$ScaleOk)
{
if ( $Scale2 > 1 ) { $Factor = $Factor * 10; }
if ( $Scale2 < 1 ) { $Factor = $Factor / 10; }
}
}
if ( floor($this->VMax / $Scale / $Factor) != $this->VMax / $Scale / $Factor)
{
$GridID = floor ( $this->VMax / $Scale / $Factor) + 1;
$this->VMax = $GridID * $Scale * $Factor;
$Divisions++;
}
if ( floor($this->VMin / $Scale / $Factor) != $this->VMin / $Scale / $Factor)
{
$GridID = floor( $this->VMin / $Scale / $Factor);
$this->VMin = $GridID * $Scale * $Factor;
$Divisions++;
}
}
else /* Can occurs for small graphs */
$Scale = 1;
if ( !isset($Divisions) )
$Divisions = 2;
if ($Scale == 1 && $Divisions%2 == 1)
$Divisions--;
}
else
$Divisions = $this->Divisions;
$this->DivisionCount = $Divisions;
$DataRange = $this->VMax - $this->VMin;
if ( $DataRange == 0 ) { $DataRange = .1; }
$this->DivisionHeight = ( $this->GArea_X2 - $this->GArea_X1 ) / $Divisions;
$this->DivisionRatio = ( $this->GArea_X2 - $this->GArea_X1 ) / $DataRange;
$this->GAreaYOffset = 0;
if ( count($Data) > 1 )
{
if ( $WithMargin == FALSE )
$this->DivisionWidth = ( $this->GArea_Y2 - $this->GArea_Y1 ) / (count($Data)-1);
else
{
$this->DivisionWidth = ( $this->GArea_Y2 - $this->GArea_Y1 ) / (count($Data));
$this->GAreaYOffset = $this->DivisionWidth / 2;
}
}
else
{
$this->DivisionWidth = $this->GArea_Y2 - $this->GArea_Y1;
$this->GAreaYOffset = $this->DivisionWidth / 2;
}
$this->DataCount = count($Data);
if ( $DrawTicks == FALSE )
return(0);
$XPos = $this->GArea_X1;
$YMin = NULL;
for($i=1;$i<=$Divisions+1;$i++)
{
$this->drawLine($XPos,$this->GArea_Y1,$XPos,$this->GArea_Y1-5,$R,$G,$B);
$Value = $this->VMin + ($i-1) * (( $this->VMax - $this->VMin ) / $Divisions);
$Value = round($Value * pow(10,$Decimals)) / pow(10,$Decimals);
if ( $DataDescription["Format"]["Y"] == "number" )
$Value = $Value.$DataDescription["Unit"]["Y"];
if ( $DataDescription["Format"]["Y"] == "time" )
$Value = $this->ToTime($Value);
if ( $DataDescription["Format"]["Y"] == "date" )
$Value = $this->ToDate($Value);
if ( $DataDescription["Format"]["Y"] == "metric" )
$Value = $this->ToMetric($Value);
if ( $DataDescription["Format"]["Y"] == "currency" )
$Value = $this->ToCurrency($Value);
$Position = imageftbbox($this->FontSize,0,$this->FontName,$Value);
$TextWidth = $Position[2]-$Position[0];
imagettftext($this->Picture,$this->FontSize,0,$XPos-($this->FontSize/2),$this->GArea_Y1-10,$C_TextColor,$this->FontName,$Value);
if ( $YMin > $this->GArea_Y1-10-$TextWidth || $YMin == NULL ) { $YMin = $this->GArea_Y1-10-$TextWidth; }
$XPos = $XPos + $this->DivisionHeight;
}
/* Write the Y Axis caption if set */
if ( isset($DataDescription["Axis"]["Y"]) )
{
$Position = imageftbbox($this->FontSize,90,$this->FontName,$DataDescription["Axis"]["Y"]);
$TextHeight = abs($Position[1])+abs($Position[3]);
$TextTop = (($this->GArea_X2 - $this->GArea_X1) / 2) + $this->GArea_X1 + ($TextHeight/2);
imagettftext($this->Picture,$this->FontSize,90,$YMin-$this->FontSize,$TextTop,$C_TextColor,$this->FontName,$DataDescription["Axis"]["Y"]);
}
/* Horizontal Axis */
$YPos = $this->GArea_Y1 + $this->GAreaYOffset;
$ID = 1;
$XMax = NULL;
foreach ( $Data as $Key => $Values )
{
if ( $ID % $SkipLabels == 0 )
{
$this->drawLine($this->GArea_X1,floor($YPos),$this->GArea_X1-5,floor($YPos),$R,$G,$B);
$Value = $Data[$Key][$DataDescription["Position"]];
if ( $DataDescription["Format"]["X"] == "number" )
$Value = $Value.$DataDescription["Unit"]["X"];
if ( $DataDescription["Format"]["X"] == "time" )
$Value = $this->ToTime($Value);
if ( $DataDescription["Format"]["X"] == "date" )
$Value = $this->ToDate($Value);
if ( $DataDescription["Format"]["X"] == "metric" )
$Value = $this->ToMetric($Value);
if ( $DataDescription["Format"]["X"] == "currency" )
$Value = $this->ToCurrency($Value);
$Position = imageftbbox($this->FontSize,$Angle,$this->FontName,$Value);
$TextWidth = abs($Position[2])+abs($Position[0]);
$TextHeight = abs($Position[1])+abs($Position[3]);
if ( $Angle == 0 )
{
$XPos = $this->GArea_Y2+18; imagettftext($this->Picture,$this->FontSize,$Angle,$this->GArea_X1-10-floor($TextWidth),floor($YPos)+5-floor($TextHeight/2),$C_TextColor,$this->FontName,$Value);
}
else
{
$XPos = $this->GArea_Y2+10+$TextHeight;
if ( $Angle <= 90 )
imagettftext($this->Picture,$this->FontSize,$Angle,$XPos,floor($YPos)-$TextWidth+5,$C_TextColor,$this->FontName,$Value);
else
imagettftext($this->Picture,$this->FontSize,$Angle,$XPos,floor($YPos)+$TextWidth+5,$C_TextColor,$this->FontName,$Value);
}
if ( $XMax < $XPos || $XMax == NULL ) { $XMax = $XPos; }
}
$YPos = $YPos + $this->DivisionWidth;
$ID++;
}
/* Write the X Axis caption if set */
if ( isset($DataDescription["Axis"]["Y"]) )
{
$Position = imageftbbox($this->FontSize,90,$this->FontName,$DataDescription["Axis"]["Y"]);
$TextWidth = abs($Position[2])+abs($Position[0]);
$TextLeft = (($this->GArea_Y2 - $this->GArea_Y1) / 2) + $this->GArea_Y1 + ($TextWidth/2);
imagettftext($this->Picture,$this->FontSize,0,$TextLeft,$XMax+$this->FontSize+5,$C_TextColor,$this->FontName,$DataDescription["Axis"]["Y"]);
}
}
/* Compute and draw the scale */
function drawHorGrid($LineWidth,$Mosaic=TRUE,$R=220,$G=220,$B=220,$Alpha=100)
{
/* Draw mosaic */
if ( $Mosaic )
{
$LayerWidth = $this->GArea_Y2-$this->GArea_Y1;
$LayerHeight = $this->GArea_X2-$this->GArea_X1;
$this->Layers[0] = imagecreatetruecolor($LayerWidth,$LayerHeight);
$C_White =$this->AllocateColor($this->Layers[0],255,255,255);
imagefilledrectangle($this->Layers[0],0,0,$LayerWidth,$LayerHeight,$C_White);
imagecolortransparent($this->Layers[0],$C_White);
$C_Rectangle =$this->AllocateColor($this->Layers[0],250,250,250);
$XPos = $LayerHeight;
$LastX = $XPos;
for($i=0;$i<=$this->DivisionCount;$i++)
{
$LastX = $XPos;
$XPos = $XPos - $this->DivisionHeight;
if ( $XPos <= 0 ) { $XPos = 1; }
if ( $i % 2 == 0 )
{
imagefilledrectangle($this->Layers[0],$XPos,1,$LastX,$LayerWidth-1,$C_Rectangle);
}
}
imagecopymerge($this->Picture,$this->Layers[0],$this->GArea_X1,$this->GArea_Y1,0,0,$LayerWidth,$LayerHeight,$Alpha);
imagedestroy($this->Layers[0]);
}
/* Vertical lines */
$XPos = $this->GArea_X2 - $this->DivisionHeight;
for($i=1;$i<=$this->DivisionCount;$i++)
{
if ( $XPos > $this->GArea_X1 && $XPos < $this->GArea_X2 )
$this->drawDottedLine($XPos,$this->GArea_Y1,$XPos,$this->GArea_Y2,$LineWidth,$R,$G,$B);
$XPos = $XPos - $this->DivisionHeight;
}
/* Horizontal lines */
if ( $this->GAreaYOffset == 0 )
{ $YPos = $this->GArea_Y1 + $this->DivisionWidth + $this->GAreaYOffset;
$ColCount = $this->DataCount-2; }
else
{ $YPos = $this->GArea_Y1 + $this->GAreaYOffset;
//$ColCount = floor( ($this->GArea_X2 - $this->GArea_X1) / $this->DivisionWidth );
$ColCount = $this->DataCount;
}
for($i=1;$i<=$ColCount;$i++)
{
if ( $YPos > $this->GArea_Y1 && $YPos < $this->GArea_Y2 )
$this->drawDottedLine($this->GArea_X1,floor($YPos),$this->GArea_X2,floor($YPos),$LineWidth,$R,$G,$B);
$YPos = $YPos + $this->DivisionWidth;
}
}
/* Compute and draw the scale */
function drawTreshold($Value,$R,$G,$B,$ShowLabel=FALSE,$ShowOnBottom=FALSE,$TickWidth=4,$FreeText=NULL,$Angle=0)
{
if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
$C_TextColor =$this->AllocateColor($this->Picture,$R,$G,$B);
$X = $this->GArea_X1 + ($Value - $this->VMin) * $this->DivisionRatio;
if ( $X <= $this->GArea_X1 || $X >= $this->GArea_X2 )
return(-1);
if ( $TickWidth == 0 )
$this->drawLine($X,$this->GArea_Y1,$X,$this->GArea_Y2,$R,$G,$B);
else
$this->drawDottedLine($X,$this->GArea_Y1,$X,$this->GArea_Y2,$TickWidth,$R,$G,$B);
if ( $ShowLabel )
{
if ( $FreeText == NULL )
{ $Label = $Value; } else { $Label = $FreeText; }
$Position = imageftbbox($this->FontSize,$Angle,$this->FontName,$Label);
$TextWidth = abs($Position[2])-abs($Position[0]);
$TextLeft = abs($Position[3])-abs($Position[1]);
if ( $ShowOnBottom )
imagettftext($this->Picture,$this->FontSize,$Angle,$X+9,$this->GArea_Y2,$C_TextColor,$this->FontName,$Label);
else
imagettftext($this->Picture,$this->FontSize,$Angle,$X+9,$this->GArea_Y1+$TextLeft,$C_TextColor,$this->FontName,$Label);
}
}
}
?>

@ -1,121 +0,0 @@
<?php
/*
pCache - Faster renderding using data cache
Copyright (C) 2008 Jean-Damien POGOLOTTI
Version 1.1.2 last updated on 06/17/08
http://pchart.sourceforge.net
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, either version 1,2,3 of the License, or
(at your option) any later version.
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, see <http://www.gnu.org/licenses/>.
Class initialisation :
pCache($CacheFolder="Cache/")
Cache management :
IsInCache($Data)
GetFromCache($ID,$Data)
WriteToCache($ID,$Data,$Picture)
DeleteFromCache($ID,$Data)
ClearCache()
Inner functions :
GetHash($ID,$Data)
*/
/* pCache class definition */
require_once dirname(__FILE__) . '/../../global.inc.php';
//the cache default folder was changed
class pCache
{
var $HashKey = "";
var $CacheFolder = "";
/* Create the pCache object */
function pCache($CacheFolder="Cache/")
{
$this->CacheFolder = api_get_path(SYS_ARCHIVE_PATH);
}
/* This function is clearing the cache folder */
function ClearCache()
{
if ($handle = opendir($this->CacheFolder))
{
while (false !== ($file = readdir($handle)))
{
if ( $file != "." && $file != ".." )
unlink($this->CacheFolder.$file);
}
closedir($handle);
}
}
/* This function is checking if we have an offline version of this chart */
function IsInCache($ID,$Data,$Hash="")
{
if ( $Hash == "" )
$Hash = $this->GetHash($ID,$Data);
if ( file_exists($this->CacheFolder.$Hash) )
return(TRUE);
else
return(FALSE);
}
/* This function is making a copy of drawn chart in the cache folder */
function WriteToCache($ID,$Data,$Picture)
{
$Hash = $this->GetHash($ID,$Data);
$FileName = $this->CacheFolder.$Hash;
imagepng($Picture->Picture,$FileName);
}
/* This function is removing any cached copy of this chart */
function DeleteFromCache($ID,$Data)
{
$Hash = $this->GetHash($ID,$Data);
$FileName = $this->CacheFolder.$Hash;
if ( file_exists($FileName ) )
unlink($FileName);
}
/* This function is retrieving the cached picture if applicable */
function GetFromCache($ID,$Data)
{
$Hash = $this->GetHash($ID,$Data);
if ( $this->IsInCache("","",$Hash ) )
{
$FileName = $this->CacheFolder.$Hash;
header('Content-type: image/png');
@readfile($FileName);
exit();
}
}
/* This function is building the graph unique hash key */
function GetHash($ID,$Data)
{
$mKey = "$ID";
foreach($Data as $key => $Values)
{
$tKey = "";
foreach($Values as $Serie => $Value)
$tKey = $tKey.$Serie.$Value;
$mKey = $mKey.md5($tKey);
}
return(md5($mKey));
}
}
?>

File diff suppressed because it is too large Load Diff

@ -1,262 +0,0 @@
<?php
/*
pData - Simplifying data population for pChart
Copyright (C) 2008 Jean-Damien POGOLOTTI
Version 1.13 last updated on 08/17/08
http://pchart.sourceforge.net
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, either version 1,2,3 of the License, or
(at your option) any later version.
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, see <http://www.gnu.org/licenses/>.
Class initialisation :
pData()
Data populating methods :
ImportFromCSV($FileName,$Delimiter=",",$DataColumns=-1,$HasHeader=FALSE,$DataName=-1)
AddPoint($Value,$Serie="Serie1",$Description="")
Series manipulation methods :
AddSerie($SerieName="Serie1")
AddAllSeries()
RemoveSerie($SerieName="Serie1")
SetAbsciseLabelSerie($SerieName = "Name")
SetSerieName($Name,$SerieName="Serie1")
+ SetSerieSymbol($Name,$Symbol)
SetXAxisName($Name="X Axis")
SetYAxisName($Name="Y Axis")
SetXAxisFormat($Format="number")
SetYAxisFormat($Format="number")
SetXAxisUnit($Unit="")
SetYAxisUnit($Unit="")
removeSerieName($SerieName)
removeAllSeries()
Data retrieval methods :
GetData()
GetDataDescription()
*/
/* pData class definition */
class pData
{
var $Data;
var $DataDescription;
function pData()
{
$this->Data = "";
$this->DataDescription = "";
$this->DataDescription["Position"] = "Name";
$this->DataDescription["Format"]["X"] = "number";
$this->DataDescription["Format"]["Y"] = "number";
$this->DataDescription["Unit"]["X"] = NULL;
$this->DataDescription["Unit"]["Y"] = NULL;
}
function ImportFromCSV($FileName,$Delimiter=",",$DataColumns=-1,$HasHeader=FALSE,$DataName=-1)
{
$handle = @fopen($FileName,"r");
if ($handle)
{
$HeaderParsed = FALSE;
while (!feof($handle))
{
$buffer = fgets($handle, 4096);
$buffer = str_replace(chr(10),"",$buffer);
$buffer = str_replace(chr(13),"",$buffer);
$Values = split($Delimiter,$buffer);
if ( $buffer != "" )
{
if ( $HasHeader == TRUE && $HeaderParsed == FALSE )
{
if ( $DataColumns == -1 )
{
$ID = 1;
foreach($Values as $key => $Value)
{ $this->SetSerieName($Value,"Serie".$ID); $ID++; }
}
else
{
$SerieName = "";
foreach($DataColumns as $key => $Value)
$this->SetSerieName($Values[$Value],"Serie".$Value);
}
$HeaderParsed = TRUE;
}
else
{
if ( $DataColumns == -1 )
{
$ID = 1;
foreach($Values as $key => $Value)
{ $this->AddPoint(intval($Value),"Serie".$ID); $ID++; }
}
else
{
$SerieName = "";
if ( $DataName != -1 )
$SerieName = $Values[$DataName];
foreach($DataColumns as $key => $Value)
$this->AddPoint($Values[$Value],"Serie".$Value,$SerieName);
}
}
}
}
fclose($handle);
}
}
function AddPoint($Value,$Serie="Serie1",$Description="") {
if (is_array($Value) && count($Value) == 1)
$Value = $Value[0];
$ID = 0;
for ($i=0;$i<=count($this->Data);$i++) {
if(isset($this->Data[$i][$Serie])) { $ID = $i+1; }
}
if ( count($Value) == 1 ) {
$this->Data[$ID][$Serie] = $Value;
if ( $Description != "" ) $this->Data[$ID]["Name"] = $Description;
elseif (!isset($this->Data[$ID]["Name"])) $this->Data[$ID]["Name"] = $ID;
} else {
foreach ($Value as $key => $Val) {
$this->Data[$ID][$Serie] = $Val;
if (!isset($this->Data[$ID]["Name"]))
$this->Data[$ID]["Name"] = $ID;
$ID++;
}
}
}
function AddSerie($SerieName="Serie1")
{
if ( !isset($this->DataDescription["Values"]) )
{
$this->DataDescription["Values"][] = $SerieName;
}
else
{
$Found = FALSE;
foreach($this->DataDescription["Values"] as $key => $Value )
if ( $Value == $SerieName ) { $Found = TRUE; }
if ( !$Found )
$this->DataDescription["Values"][] = $SerieName;
}
}
function AddAllSeries()
{
unset($this->DataDescription["Values"]);
if ( isset($this->Data[0]) )
{
foreach($this->Data[0] as $Key => $Value)
{
if ( $Key != "Name" )
$this->DataDescription["Values"][] = $Key;
}
}
}
function RemoveSerie($SerieName="Serie1")
{
if ( !isset($this->DataDescription["Values"]) )
return(0);
$Found = FALSE;
foreach($this->DataDescription["Values"] as $key => $Value )
{
if ( $Value == $SerieName )
unset($this->DataDescription["Values"][$key]);
}
}
function SetAbsciseLabelSerie($SerieName = "Name")
{
$this->DataDescription["Position"] = $SerieName;
}
function SetSerieName($Name,$SerieName="Serie1")
{
$this->DataDescription["Description"][$SerieName] = $Name;
}
function SetXAxisName($Name="X Axis")
{
$this->DataDescription["Axis"]["X"] = $Name;
}
function SetYAxisName($Name="Y Axis")
{
$this->DataDescription["Axis"]["Y"] = $Name;
}
function SetXAxisFormat($Format="number")
{
$this->DataDescription["Format"]["X"] = $Format;
}
function SetYAxisFormat($Format="number")
{
$this->DataDescription["Format"]["Y"] = $Format;
}
function SetXAxisUnit($Unit="")
{
$this->DataDescription["Unit"]["X"] = $Unit;
}
function SetYAxisUnit($Unit="")
{
$this->DataDescription["Unit"]["Y"] = $Unit;
}
function SetSerieSymbol($Name,$Symbol)
{
$this->DataDescription["Symbol"][$Name] = $Symbol;
}
function removeSerieName($SerieName)
{
if ( isset($this->DataDescription["Description"][$SerieName]) )
unset($this->DataDescription["Description"][$SerieName]);
}
function removeAllSeries()
{
foreach($this->DataDescription["Values"] as $Key => $Value)
unset($this->DataDescription["Values"][$Key]);
}
function GetData()
{
return($this->Data);
}
function GetDataDescription()
{
return($this->DataDescription);
}
}
?>

@ -2895,11 +2895,8 @@ class Tracking
*/
static function generate_session_exercise_graph($names, $my_results, $average)
{
require_once api_get_path(LIBRARY_PATH).'pchart/pData.class.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pChart.class.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pCache.class.php';
$cache = new pCache();
$cache = new pCache(api_get_path(SYS_ARCHIVE_PATH));
// Dataset definition
$data_set = new pData();
@ -2979,13 +2976,10 @@ class Tracking
*/
static function generate_exercise_result_thumbnail_graph($attempts)
{
require_once api_get_path(LIBRARY_PATH).'pchart/pData.class.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pChart.class.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pCache.class.php';
$exercise_title = $attempts['title'];
$attempts = $attempts['data'];
$my_exercise_result_array = $exercise_result = array();
if (empty($attempts)) {
return null;
}
@ -3054,10 +3048,8 @@ class Tracking
$final_array[$i] = 0;
}
}
//var_dump($my_final_array, $final_array); echo '<br />';
//echo '<pre>'; var_dump($my_exercise_result, $exercise_result,$x_axis);
$cache = new pCache();
$cache = new pCache(api_get_path(SYS_ARCHIVE_PATH));
// Dataset definition
$data_set = new pData();
@ -3110,10 +3102,6 @@ class Tracking
static function generate_exercise_result_graph($attempts)
{
require_once api_get_path(LIBRARY_PATH).'pchart/pData.class.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pChart.class.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pCache.class.php';
$exercise_title = strip_tags($attempts['title']);
$attempts = $attempts['data'];
$my_exercise_result_array = $exercise_result = array();
@ -3184,10 +3172,8 @@ class Tracking
$final_array[$i] = 0;
}
}
//var_dump($my_final_array, $final_array); echo '<br />';
//echo '<pre>'; var_dump($my_exercise_result, $exercise_result,$x_axis);
$cache = new pCache();
$cache = new pCache(api_get_path(SYS_ARCHIVE_PATH));
// Dataset definition
$data_set = new pData();

Loading…
Cancel
Save