Passed
Branch develop (66e4de)
by Laurent
33:03
created
htdocs/core/class/dolgraph.class.php 1 patch
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		$this->datacolor = array(array(120, 130, 150), array(160, 160, 180), array(190, 190, 220));
104 104
 		$this->bgcolor = array(235, 235, 224);
105 105
 
106
-		$color_file = DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/theme_vars.inc.php';
106
+		$color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
107 107
 		if (is_readable($color_file)) {
108 108
 			include_once $color_file;
109 109
 			if (isset($theme_bordercolor)) $this->bordercolor = $theme_bordercolor;
@@ -626,19 +626,19 @@  discard block
 block discarded – undo
626 626
 	{
627 627
 		if (empty($file)) {
628 628
 			$this->error = "Call to draw method was made with empty value for parameter file.";
629
-			dol_syslog(get_class($this) . "::draw " . $this->error, LOG_ERR);
629
+			dol_syslog(get_class($this)."::draw ".$this->error, LOG_ERR);
630 630
 			return -2;
631 631
 		}
632 632
 		if (!is_array($this->data)) {
633 633
 			$this->error = "Call to draw method was made but SetData was not called or called with an empty dataset for parameters";
634
-			dol_syslog(get_class($this) . "::draw " . $this->error, LOG_ERR);
634
+			dol_syslog(get_class($this)."::draw ".$this->error, LOG_ERR);
635 635
 			return -1;
636 636
 		}
637 637
 		if (count($this->data) < 1) {
638 638
 			$this->error = "Call to draw method was made but SetData was is an empty dataset";
639
-			dol_syslog(get_class($this) . "::draw " . $this->error, LOG_WARNING);
639
+			dol_syslog(get_class($this)."::draw ".$this->error, LOG_WARNING);
640 640
 		}
641
-		$call = "draw_" . $this->_library;
641
+		$call = "draw_".$this->_library;
642 642
 		call_user_func_array(array($this, $call), array($file, $fileurl));
643 643
 	}
644 644
 
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 		// phpcs:enable
665 665
 		global $conf, $langs;
666 666
 
667
-		dol_syslog(get_class($this) . "::draw_jflot this->type=" . join(',', $this->type) . " this->MaxValue=" . $this->MaxValue);
667
+		dol_syslog(get_class($this)."::draw_jflot this->type=".join(',', $this->type)." this->MaxValue=".$this->MaxValue);
668 668
 
669 669
 		if (empty($this->width) && empty($this->height)) {
670 670
 			print 'Error width or height not set';
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 		while ($i < $nblot)	// Loop on each serie
687 687
 		{
688 688
 			$values = array(); // Array with horizontal y values (specific values of a serie) for each abscisse x
689
-			$serie[$i] = "var d" . $i . " = [];\n";
689
+			$serie[$i] = "var d".$i." = [];\n";
690 690
 
691 691
 			// Fill array $values
692 692
 			$x = 0;
@@ -699,11 +699,11 @@  discard block
 block discarded – undo
699 699
 
700 700
 			if (isset($this->type[$firstlot]) && in_array($this->type[$firstlot], array('pie', 'piesemicircle', 'polar'))) {
701 701
 				foreach ($values as $x => $y) {
702
-					if (isset($y)) $serie[$i] .= 'd' . $i . '.push({"label":"' . dol_escape_js($legends[$x]) . '", "data":' . $y . '});' . "\n";
702
+					if (isset($y)) $serie[$i] .= 'd'.$i.'.push({"label":"'.dol_escape_js($legends[$x]).'", "data":'.$y.'});'."\n";
703 703
 				}
704 704
 			} else {
705 705
 				foreach ($values as $x => $y) {
706
-					if (isset($y)) $serie[$i] .= 'd' . $i . '.push([' . $x . ', ' . $y . ']);' . "\n";
706
+					if (isset($y)) $serie[$i] .= 'd'.$i.'.push(['.$x.', '.$y.']);'."\n";
707 707
 				}
708 708
 			}
709 709
 
@@ -712,28 +712,28 @@  discard block
 block discarded – undo
712 712
 		}
713 713
 		$tag = dol_escape_htmltag(dol_string_unaccent(dol_string_nospecial(basename($file), '_', array('-', '.'))));
714 714
 
715
-		$this->stringtoshow = '<!-- Build using jflot -->' . "\n";
716
-		if (!empty($this->title)) $this->stringtoshow .= '<div class="center dolgraphtitle' . (empty($this->cssprefix) ? '' : ' dolgraphtitle' . $this->cssprefix) . '">' . $this->title . '</div>';
715
+		$this->stringtoshow = '<!-- Build using jflot -->'."\n";
716
+		if (!empty($this->title)) $this->stringtoshow .= '<div class="center dolgraphtitle'.(empty($this->cssprefix) ? '' : ' dolgraphtitle'.$this->cssprefix).'">'.$this->title.'</div>';
717 717
 		if (!empty($this->shownographyet)) {
718
-			$this->stringtoshow .= '<div style="width:' . $this->width . 'px;height:' . $this->height . 'px;" class="nographyet"></div>';
719
-			$this->stringtoshow .= '<div class="nographyettext margintoponly">' . $langs->trans("NotEnoughDataYet") . '...</div>';
718
+			$this->stringtoshow .= '<div style="width:'.$this->width.'px;height:'.$this->height.'px;" class="nographyet"></div>';
719
+			$this->stringtoshow .= '<div class="nographyettext margintoponly">'.$langs->trans("NotEnoughDataYet").'...</div>';
720 720
 			return;
721 721
 		}
722 722
 
723 723
 		// Start the div that will contains all the graph
724 724
 		$dolxaxisvertical = '';
725 725
 		if (count($this->data) > 20) $dolxaxisvertical = 'dol-xaxis-vertical';
726
-		$this->stringtoshow .= '<div id="placeholder_' . $tag . '" style="width:' . $this->width . 'px;height:' . $this->height . 'px;" class="dolgraph' . (empty($dolxaxisvertical) ? '' : ' ' . $dolxaxisvertical) . (empty($this->cssprefix) ? '' : ' dolgraph' . $this->cssprefix) . ' center"></div>' . "\n";
726
+		$this->stringtoshow .= '<div id="placeholder_'.$tag.'" style="width:'.$this->width.'px;height:'.$this->height.'px;" class="dolgraph'.(empty($dolxaxisvertical) ? '' : ' '.$dolxaxisvertical).(empty($this->cssprefix) ? '' : ' dolgraph'.$this->cssprefix).' center"></div>'."\n";
727 727
 
728
-		$this->stringtoshow .= '<script id="' . $tag . '">' . "\n";
729
-		$this->stringtoshow .= '$(function () {' . "\n";
728
+		$this->stringtoshow .= '<script id="'.$tag.'">'."\n";
729
+		$this->stringtoshow .= '$(function () {'."\n";
730 730
 		$i = $firstlot;
731 731
 		if ($nblot < 0) {
732
-			$this->stringtoshow .= '<!-- No series of data -->' . "\n";
732
+			$this->stringtoshow .= '<!-- No series of data -->'."\n";
733 733
 		} else {
734 734
 			while ($i < $nblot) {
735
-				$this->stringtoshow .= '<!-- Serie ' . $i . ' -->' . "\n";
736
-				$this->stringtoshow .= $serie[$i] . "\n";
735
+				$this->stringtoshow .= '<!-- Serie '.$i.' -->'."\n";
736
+				$this->stringtoshow .= $serie[$i]."\n";
737 737
 				$i++;
738 738
 			}
739 739
 		}
@@ -743,8 +743,8 @@  discard block
 block discarded – undo
743 743
 		if (isset($this->type[$firstlot]) && in_array($this->type[$firstlot], array('pie', 'piesemicircle', 'polar'))) {
744 744
 			$datacolor = array();
745 745
 			foreach ($this->datacolor as $val) {
746
-				if (is_array($val)) $datacolor[] = "#" . sprintf("%02x%02x%02x", $val[0], $val[1], $val[2]); // If datacolor is array(R, G, B)
747
-				else $datacolor[] = "#" . str_replace(array('#', '-'), '', $val); // If $val is '124' or '#124'
746
+				if (is_array($val)) $datacolor[] = "#".sprintf("%02x%02x%02x", $val[0], $val[1], $val[2]); // If datacolor is array(R, G, B)
747
+				else $datacolor[] = "#".str_replace(array('#', '-'), '', $val); // If $val is '124' or '#124'
748 748
 			}
749 749
 
750 750
 			$urltemp = ''; // TODO Add support for url link into labels
@@ -753,8 +753,8 @@  discard block
 block discarded – undo
753 753
 			$showpercent = $this->showpercent;
754 754
 
755 755
 			$this->stringtoshow .= '
756
-			function plotWithOptions_' . $tag . '() {
757
-			$.plot($("#placeholder_' . $tag . '"), d0,
756
+			function plotWithOptions_' . $tag.'() {
757
+			$.plot($("#placeholder_' . $tag.'"), d0,
758 758
 			{
759 759
 				series: {
760 760
 					pie: {
@@ -762,8 +762,8 @@  discard block
 block discarded – undo
762 762
 						radius: 0.8,
763 763
 						' . ($this->combine ? '
764 764
 						combine: {
765
-						 	threshold: ' . $this->combine . '
766
-						},' : '') . '
765
+						 	threshold: ' . $this->combine.'
766
+						},' : '').'
767 767
 						label: {
768 768
 							show: true,
769 769
 							radius: 0.9,
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
 								var number=series.data[0][1];
773 773
 								return \'';
774 774
 			$this->stringtoshow .= '<span style="font-size:8pt;text-align:center;padding:2px;color:black;">';
775
-			if ($urltemp) $this->stringtoshow .= '<a style="color: #FFFFFF;" border="0" href="' . $urltemp . '">';
775
+			if ($urltemp) $this->stringtoshow .= '<a style="color: #FFFFFF;" border="0" href="'.$urltemp.'">';
776 776
 			$this->stringtoshow .= '\'+';
777 777
 			$this->stringtoshow .= ($showlegend ? '' : 'label+\' \'+'); // Hide label if already shown in legend
778 778
 			$this->stringtoshow .= ($showpointvalue ? 'number+' : '');
@@ -795,9 +795,9 @@  discard block
 block discarded – undo
795 795
 				interactive: true
796 796
 			},';
797 797
 			if (count($datacolor)) {
798
-				$this->stringtoshow .= 'colors: ' . (!empty($data['seriescolor']) ? json_encode($data['seriescolor']) : json_encode($datacolor)) . ',';
798
+				$this->stringtoshow .= 'colors: '.(!empty($data['seriescolor']) ? json_encode($data['seriescolor']) : json_encode($datacolor)).',';
799 799
 			}
800
-			$this->stringtoshow .= 'legend: {show: ' . ($showlegend ? 'true' : 'false') . ', position: \'ne\' }
800
+			$this->stringtoshow .= 'legend: {show: '.($showlegend ? 'true' : 'false').', position: \'ne\' }
801 801
 		});
802 802
 		}' . "\n";
803 803
 		}
@@ -806,8 +806,8 @@  discard block
 block discarded – undo
806 806
 			// Add code to support tooltips
807 807
 			// TODO: remove js css and use graph-tooltip-inner class instead by adding css in each themes
808 808
 			$this->stringtoshow .= '
809
-			function showTooltip_' . $tag . '(x, y, contents) {
810
-				$(\'<div class="graph-tooltip-inner" id="tooltip_' . $tag . '">\' + contents + \'</div>\').css({
809
+			function showTooltip_' . $tag.'(x, y, contents) {
810
+				$(\'<div class="graph-tooltip-inner" id="tooltip_' . $tag.'">\' + contents + \'</div>\').css({
811 811
 					position: \'absolute\',
812 812
 					display: \'none\',
813 813
 					top: y + 10,
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
 			}
824 824
 
825 825
 			var previousPoint = null;
826
-			$("#placeholder_' . $tag . '").bind("plothover", function (event, pos, item) {
826
+			$("#placeholder_' . $tag.'").bind("plothover", function (event, pos, item) {
827 827
 				$("#x").text(pos.x.toFixed(2));
828 828
 				$("#y").text(pos.y.toFixed(2));
829 829
 
@@ -838,25 +838,25 @@  discard block
 block discarded – undo
838 838
 						var z = item.series.xaxis.ticks[item.dataIndex].label;
839 839
 						';
840 840
 			if ($this->showpointvalue > 0) $this->stringtoshow .= '
841
-							showTooltip_' . $tag . '(item.pageX, item.pageY, item.series.label + "<br>" + z + " => " + y);
841
+							showTooltip_' . $tag.'(item.pageX, item.pageY, item.series.label + "<br>" + z + " => " + y);
842 842
 						';
843 843
 			$this->stringtoshow .= '
844 844
 					}
845 845
 				}
846 846
 				else {
847
-					$("#tooltip_' . $tag . '").remove();
847
+					$("#tooltip_' . $tag.'").remove();
848 848
 					previousPoint = null;
849 849
 				}
850 850
 			});
851 851
 			';
852 852
 
853
-			$this->stringtoshow .= 'var stack = null, steps = false;' . "\n";
853
+			$this->stringtoshow .= 'var stack = null, steps = false;'."\n";
854 854
 
855
-			$this->stringtoshow .= 'function plotWithOptions_' . $tag . '() {' . "\n";
856
-			$this->stringtoshow .= '$.plot($("#placeholder_' . $tag . '"), [ ' . "\n";
855
+			$this->stringtoshow .= 'function plotWithOptions_'.$tag.'() {'."\n";
856
+			$this->stringtoshow .= '$.plot($("#placeholder_'.$tag.'"), [ '."\n";
857 857
 			$i = $firstlot;
858 858
 			while ($i < $nblot) {
859
-				if ($i > $firstlot) $this->stringtoshow .= ', ' . "\n";
859
+				if ($i > $firstlot) $this->stringtoshow .= ', '."\n";
860 860
 				$color = sprintf("%02x%02x%02x", $this->datacolor[$i][0], $this->datacolor[$i][1], $this->datacolor[$i][2]);
861 861
 				$this->stringtoshow .= '{ ';
862 862
 				if (!isset($this->type[$i]) || $this->type[$i] == 'bars') {
@@ -864,41 +864,41 @@  discard block
 block discarded – undo
864 864
 						if ($i == $firstlot) $align = 'right';
865 865
 						elseif ($i == $firstlot + 1) $align = 'center';
866 866
 						else $align = 'left';
867
-						$this->stringtoshow .= 'bars: { lineWidth: 1, show: true, align: "' . $align . '", barWidth: 0.45 }, ';
868
-					} else $this->stringtoshow .= 'bars: { lineWidth: 1, show: true, align: "' . ($i == $firstlot ? 'center' : 'left') . '", barWidth: 0.5 }, ';
867
+						$this->stringtoshow .= 'bars: { lineWidth: 1, show: true, align: "'.$align.'", barWidth: 0.45 }, ';
868
+					} else $this->stringtoshow .= 'bars: { lineWidth: 1, show: true, align: "'.($i == $firstlot ? 'center' : 'left').'", barWidth: 0.5 }, ';
869 869
 				}
870
-				if (isset($this->type[$i]) && ($this->type[$i] == 'lines' || $this->type[$i] == 'linesnopoint')) $this->stringtoshow .= 'lines: { show: true, fill: false }, points: { show: ' . ($this->type[$i] == 'linesnopoint' ? 'false' : 'true') . ' }, ';
871
-				$this->stringtoshow .= 'color: "#' . $color . '", label: "' . (isset($this->Legend[$i]) ? dol_escape_js($this->Legend[$i]) : '') . '", data: d' . $i . ' }';
870
+				if (isset($this->type[$i]) && ($this->type[$i] == 'lines' || $this->type[$i] == 'linesnopoint')) $this->stringtoshow .= 'lines: { show: true, fill: false }, points: { show: '.($this->type[$i] == 'linesnopoint' ? 'false' : 'true').' }, ';
871
+				$this->stringtoshow .= 'color: "#'.$color.'", label: "'.(isset($this->Legend[$i]) ? dol_escape_js($this->Legend[$i]) : '').'", data: d'.$i.' }';
872 872
 				$i++;
873 873
 			}
874 874
 			// shadowSize: 0 -> Drawing is faster without shadows
875
-			$this->stringtoshow .= "\n" . ' ], { series: { shadowSize: 0, stack: stack, lines: { fill: false, steps: steps }, bars: { barWidth: 0.6,  fillColor: { colors: [{opacity: 0.9 }, {opacity: 0.85}] }} }' . "\n";
875
+			$this->stringtoshow .= "\n".' ], { series: { shadowSize: 0, stack: stack, lines: { fill: false, steps: steps }, bars: { barWidth: 0.6,  fillColor: { colors: [{opacity: 0.9 }, {opacity: 0.85}] }} }'."\n";
876 876
 
877 877
 			// Xaxis
878
-			$this->stringtoshow .= ', xaxis: { ticks: [' . "\n";
878
+			$this->stringtoshow .= ', xaxis: { ticks: ['."\n";
879 879
 			$x = 0;
880 880
 			foreach ($this->data as $key => $valarray) {
881
-				if ($x > 0) $this->stringtoshow .= ', ' . "\n";
882
-				$this->stringtoshow .= ' [' . $x . ', "' . $valarray[0] . '"]';
881
+				if ($x > 0) $this->stringtoshow .= ', '."\n";
882
+				$this->stringtoshow .= ' ['.$x.', "'.$valarray[0].'"]';
883 883
 				$x++;
884 884
 			}
885
-			$this->stringtoshow .= '] }' . "\n";
885
+			$this->stringtoshow .= '] }'."\n";
886 886
 
887 887
 			// Yaxis
888
-			$this->stringtoshow .= ', yaxis: { min: ' . $this->MinValue . ', max: ' . ($this->MaxValue) . ' }' . "\n";
888
+			$this->stringtoshow .= ', yaxis: { min: '.$this->MinValue.', max: '.($this->MaxValue).' }'."\n";
889 889
 
890 890
 			// Background color
891 891
 			$color1 = sprintf("%02x%02x%02x", $this->bgcolorgrid[0], $this->bgcolorgrid[0], $this->bgcolorgrid[2]);
892 892
 			$color2 = sprintf("%02x%02x%02x", $this->bgcolorgrid[0], $this->bgcolorgrid[1], $this->bgcolorgrid[2]);
893
-			$this->stringtoshow .= ', grid: { hoverable: true, backgroundColor: { colors: ["#' . $color1 . '", "#' . $color2 . '"] }, borderWidth: 1, borderColor: \'#e6e6e6\', tickColor  : \'#e6e6e6\' }' . "\n";
893
+			$this->stringtoshow .= ', grid: { hoverable: true, backgroundColor: { colors: ["#'.$color1.'", "#'.$color2.'"] }, borderWidth: 1, borderColor: \'#e6e6e6\', tickColor  : \'#e6e6e6\' }'."\n";
894 894
 			//$this->stringtoshow.=', shadowSize: 20'."\n";    TODO Uncommet this
895
-			$this->stringtoshow .= '});' . "\n";
896
-			$this->stringtoshow .= '}' . "\n";
895
+			$this->stringtoshow .= '});'."\n";
896
+			$this->stringtoshow .= '}'."\n";
897 897
 		}
898 898
 
899
-		$this->stringtoshow .= 'plotWithOptions_' . $tag . '();' . "\n";
900
-		$this->stringtoshow .= '});' . "\n";
901
-		$this->stringtoshow .= '</script>' . "\n";
899
+		$this->stringtoshow .= 'plotWithOptions_'.$tag.'();'."\n";
900
+		$this->stringtoshow .= '});'."\n";
901
+		$this->stringtoshow .= '</script>'."\n";
902 902
 	}
903 903
 
904 904
 
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
 		// phpcs:enable
925 925
 		global $conf, $langs;
926 926
 
927
-		dol_syslog(get_class($this) . "::draw_chart this->type=" . join(',', $this->type) . " this->MaxValue=" . $this->MaxValue);
927
+		dol_syslog(get_class($this)."::draw_chart this->type=".join(',', $this->type)." this->MaxValue=".$this->MaxValue);
928 928
 
929 929
 		if (empty($this->width) && empty($this->height)) {
930 930
 			print 'Error width or height not set';
@@ -966,15 +966,15 @@  discard block
 block discarded – undo
966 966
 				$alabelexists = 1;
967 967
 				$tmpykey = explode('_', ($array_of_ykeys[$i + ($alabelexists ? 1 : 0)]), 3);
968 968
 				if (!empty($tmpykey[2]) || $tmpykey[2] == '0') {		// This is a 'Group by' array
969
-					$tmpvalue = (array_key_exists('y_' . $tmpykey[1] . '_' . $tmpykey[2], $valarray) ? $valarray['y_' . $tmpykey[1] . '_' . $tmpykey[2]] : $valarray[$i + 1]);
969
+					$tmpvalue = (array_key_exists('y_'.$tmpykey[1].'_'.$tmpykey[2], $valarray) ? $valarray['y_'.$tmpykey[1].'_'.$tmpykey[2]] : $valarray[$i + 1]);
970 970
 					$values[$x] = (is_numeric($tmpvalue) ? $tmpvalue : null);
971 971
 					$arrayofgroupslegend[$i] = array(
972 972
 						'stacknum' => $tmpykey[1],
973 973
 						'legend' => $this->Legend[$tmpykey[1]],
974
-						'legendwithgroup' => $this->Legend[$tmpykey[1]] . ' - ' . $tmpykey[2]
974
+						'legendwithgroup' => $this->Legend[$tmpykey[1]].' - '.$tmpykey[2]
975 975
 					);
976 976
 				} else {
977
-					$tmpvalue = (array_key_exists('y_' . $i, $valarray) ? $valarray['y_' . $i] : $valarray[$i + 1]);
977
+					$tmpvalue = (array_key_exists('y_'.$i, $valarray) ? $valarray['y_'.$i] : $valarray[$i + 1]);
978 978
 					//var_dump($i.'_'.$x.'_'.$tmpvalue);
979 979
 					$values[$x] = (is_numeric($tmpvalue) ? $tmpvalue : null);
980 980
 				}
@@ -984,9 +984,9 @@  discard block
 block discarded – undo
984 984
 			$j = 0;
985 985
 			foreach ($values as $x => $y) {
986 986
 				if (isset($y)) {
987
-					$serie[$i] .= ($j > 0 ? ", " : "") . $y;
987
+					$serie[$i] .= ($j > 0 ? ", " : "").$y;
988 988
 				} else {
989
-					$serie[$i] .= ($j > 0 ? ", " : "") . 'null';
989
+					$serie[$i] .= ($j > 0 ? ", " : "").'null';
990 990
 				}
991 991
 				$j++;
992 992
 			}
@@ -999,11 +999,11 @@  discard block
 block discarded – undo
999 999
 
1000 1000
 		$tag = dol_escape_htmltag(dol_string_unaccent(dol_string_nospecial(basename($file), '_', array('-', '.'))));
1001 1001
 
1002
-		$this->stringtoshow = '<!-- Build using chart -->' . "\n";
1003
-		if (!empty($this->title)) $this->stringtoshow .= '<div class="center dolgraphtitle' . (empty($this->cssprefix) ? '' : ' dolgraphtitle' . $this->cssprefix) . '">' . $this->title . '</div>';
1002
+		$this->stringtoshow = '<!-- Build using chart -->'."\n";
1003
+		if (!empty($this->title)) $this->stringtoshow .= '<div class="center dolgraphtitle'.(empty($this->cssprefix) ? '' : ' dolgraphtitle'.$this->cssprefix).'">'.$this->title.'</div>';
1004 1004
 		if (!empty($this->shownographyet)) {
1005
-			$this->stringtoshow .= '<div style="width:' . $this->width . (strpos($this->width, '%') > 0 ? '' : 'px') . '; height:' . $this->height . 'px;" class="nographyet"></div>';
1006
-			$this->stringtoshow .= '<div class="nographyettext margintoponly">' . $langs->trans("NotEnoughDataYet") . '...</div>';
1005
+			$this->stringtoshow .= '<div style="width:'.$this->width.(strpos($this->width, '%') > 0 ? '' : 'px').'; height:'.$this->height.'px;" class="nographyet"></div>';
1006
+			$this->stringtoshow .= '<div class="nographyettext margintoponly">'.$langs->trans("NotEnoughDataYet").'...</div>';
1007 1007
 			return;
1008 1008
 		}
1009 1009
 
@@ -1012,10 +1012,10 @@  discard block
 block discarded – undo
1012 1012
 		if (count($this->data) > 20) $dolxaxisvertical = 'dol-xaxis-vertical';
1013 1013
 		// No height for the pie grah
1014 1014
 		$cssfordiv = 'dolgraphchart';
1015
-		if (isset($this->type[$firstlot])) $cssfordiv .= ' dolgraphchar' . $this->type[$firstlot];
1016
-		$this->stringtoshow .= '<div id="placeholder_' . $tag . '" style="min-height: ' . $this->height . (strpos($this->height, '%') > 0 ? '' : 'px') . '; width:' . $this->width . (strpos($this->width, '%') > 0 ? '' : 'px') . ';" class="' . $cssfordiv . ' dolgraph' . (empty($dolxaxisvertical) ? '' : ' ' . $dolxaxisvertical) . (empty($this->cssprefix) ? '' : ' dolgraph' . $this->cssprefix) . ' center"><canvas id="canvas_' . $tag . '"></canvas></div>' . "\n";
1015
+		if (isset($this->type[$firstlot])) $cssfordiv .= ' dolgraphchar'.$this->type[$firstlot];
1016
+		$this->stringtoshow .= '<div id="placeholder_'.$tag.'" style="min-height: '.$this->height.(strpos($this->height, '%') > 0 ? '' : 'px').'; width:'.$this->width.(strpos($this->width, '%') > 0 ? '' : 'px').';" class="'.$cssfordiv.' dolgraph'.(empty($dolxaxisvertical) ? '' : ' '.$dolxaxisvertical).(empty($this->cssprefix) ? '' : ' dolgraph'.$this->cssprefix).' center"><canvas id="canvas_'.$tag.'"></canvas></div>'."\n";
1017 1017
 
1018
-		$this->stringtoshow .= '<script id="' . $tag . '">' . "\n";
1018
+		$this->stringtoshow .= '<script id="'.$tag.'">'."\n";
1019 1019
 		$i = $firstlot;
1020 1020
 		if ($nblot < 0) {
1021 1021
 			$this->stringtoshow .= '<!-- No series of data -->';
@@ -1031,67 +1031,67 @@  discard block
 block discarded – undo
1031 1031
 		// Special case for Graph of type 'pie', 'piesemicircle', or 'polar'
1032 1032
 		if (isset($this->type[$firstlot]) && (in_array($this->type[$firstlot], array('pie', 'polar', 'piesemicircle')))) {
1033 1033
 			$type = $this->type[$firstlot]; // pie or polar
1034
-			$this->stringtoshow .= 'var options = {' . "\n";
1034
+			$this->stringtoshow .= 'var options = {'."\n";
1035 1035
 			$legendMaxLines = 0; // Does not work
1036 1036
 			if (empty($showlegend)) {
1037 1037
 				$this->stringtoshow .= 'legend: { display: false }, ';
1038 1038
 			} else {
1039
-				$this->stringtoshow .= 'legend: { position: \'' . ($showlegend == 2 ? 'right' : 'top') . '\'';
1039
+				$this->stringtoshow .= 'legend: { position: \''.($showlegend == 2 ? 'right' : 'top').'\'';
1040 1040
 				if (!empty($legendMaxLines)) {
1041
-					$this->stringtoshow .= ', maxLines: ' . $legendMaxLines . '';
1041
+					$this->stringtoshow .= ', maxLines: '.$legendMaxLines.'';
1042 1042
 				}
1043
-				$this->stringtoshow .= ' }, ' . "\n";
1043
+				$this->stringtoshow .= ' }, '."\n";
1044 1044
 			}
1045 1045
 
1046 1046
 			if ($this->type[$firstlot] == 'piesemicircle') {
1047
-				$this->stringtoshow .= 'circumference: Math.PI,' . "\n";
1048
-				$this->stringtoshow .= 'rotation: -Math.PI,' . "\n";
1047
+				$this->stringtoshow .= 'circumference: Math.PI,'."\n";
1048
+				$this->stringtoshow .= 'rotation: -Math.PI,'."\n";
1049 1049
 			}
1050
-			$this->stringtoshow .= 'elements: { arc: {' . "\n";
1050
+			$this->stringtoshow .= 'elements: { arc: {'."\n";
1051 1051
 			// Color of earch arc
1052 1052
 			$this->stringtoshow .= 'backgroundColor: [';
1053 1053
 			$i = 0;
1054 1054
 			$foundnegativecolor = 0;
1055 1055
 			foreach ($legends as $val)	// Loop on each serie
1056 1056
 			{
1057
-				if ($i > 0) $this->stringtoshow .= ', ' . "\n";
1058
-				if (is_array($this->datacolor[$i])) $color = 'rgb(' . $this->datacolor[$i][0] . ', ' . $this->datacolor[$i][1] . ', ' . $this->datacolor[$i][2] . ')'; // If datacolor is array(R, G, B)
1057
+				if ($i > 0) $this->stringtoshow .= ', '."\n";
1058
+				if (is_array($this->datacolor[$i])) $color = 'rgb('.$this->datacolor[$i][0].', '.$this->datacolor[$i][1].', '.$this->datacolor[$i][2].')'; // If datacolor is array(R, G, B)
1059 1059
 				else {
1060 1060
 					$tmp = str_replace('#', '', $this->datacolor[$i]);
1061 1061
 					if (strpos($tmp, '-') !== false) {
1062 1062
 						$foundnegativecolor++;
1063 1063
 						$color = '#FFFFFF'; // If $val is '-123'
1064
-					} else $color = "#" . $tmp; // If $val is '123' or '#123'
1064
+					} else $color = "#".$tmp; // If $val is '123' or '#123'
1065 1065
 				}
1066
-				$this->stringtoshow .= "'" . $color . "'";
1066
+				$this->stringtoshow .= "'".$color."'";
1067 1067
 				$i++;
1068 1068
 			}
1069
-			$this->stringtoshow .= '], ' . "\n";
1069
+			$this->stringtoshow .= '], '."\n";
1070 1070
 			// Border color
1071 1071
 			if ($foundnegativecolor) {
1072 1072
 				$this->stringtoshow .= 'borderColor: [';
1073 1073
 				$i = 0;
1074 1074
 				foreach ($legends as $val)	// Loop on each serie
1075 1075
 				{
1076
-					if ($i > 0) $this->stringtoshow .= ', ' . "\n";
1076
+					if ($i > 0) $this->stringtoshow .= ', '."\n";
1077 1077
 					if (is_array($this->datacolor[$i])) $color = 'null'; // If datacolor is array(R, G, B)
1078 1078
 					else {
1079 1079
 						$tmp = str_replace('#', '', $this->datacolor[$i]);
1080
-						if (strpos($tmp, '-') !== false) $color = '#' . str_replace('-', '', $tmp); // If $val is '-123'
1080
+						if (strpos($tmp, '-') !== false) $color = '#'.str_replace('-', '', $tmp); // If $val is '-123'
1081 1081
 						else $color = 'null'; // If $val is '123' or '#123'
1082 1082
 					}
1083
-					$this->stringtoshow .= ($color == 'null' ? "'rgba(0,0,0,0.2)'" : "'" . $color . "'");
1083
+					$this->stringtoshow .= ($color == 'null' ? "'rgba(0,0,0,0.2)'" : "'".$color."'");
1084 1084
 					$i++;
1085 1085
 				}
1086 1086
 				$this->stringtoshow .= ']';
1087 1087
 			}
1088
-			$this->stringtoshow .= '} } };' . "\n";
1088
+			$this->stringtoshow .= '} } };'."\n";
1089 1089
 
1090 1090
 			$this->stringtoshow .= '
1091
-				var ctx = document.getElementById("canvas_' . $tag . '").getContext("2d");
1091
+				var ctx = document.getElementById("canvas_' . $tag.'").getContext("2d");
1092 1092
 				var chart = new Chart(ctx, {
1093 1093
 			    // The type of chart we want to create
1094
-    			type: \'' . (in_array($type, array('pie', 'piesemicircle')) ? 'doughnut' : 'polarArea') . '\',
1094
+    			type: \'' . (in_array($type, array('pie', 'piesemicircle')) ? 'doughnut' : 'polarArea').'\',
1095 1095
 				// Configuration options go here
1096 1096
     			options: options,
1097 1097
 				data: {
@@ -1101,7 +1101,7 @@  discard block
 block discarded – undo
1101 1101
 			foreach ($legends as $val)	// Loop on each serie
1102 1102
 			{
1103 1103
 				if ($i > 0) $this->stringtoshow .= ', ';
1104
-				$this->stringtoshow .= "'" . dol_escape_js(dol_trunc($val, 32)) . "'";
1104
+				$this->stringtoshow .= "'".dol_escape_js(dol_trunc($val, 32))."'";
1105 1105
 				$i++;
1106 1106
 			}
1107 1107
 
@@ -1111,20 +1111,20 @@  discard block
 block discarded – undo
1111 1111
 			$i = 0;
1112 1112
 			while ($i < $nblot)	// Loop on each serie
1113 1113
 			{
1114
-				$color = 'rgb(' . $this->datacolor[$i][0] . ', ' . $this->datacolor[$i][1] . ', ' . $this->datacolor[$i][2] . ')';
1114
+				$color = 'rgb('.$this->datacolor[$i][0].', '.$this->datacolor[$i][1].', '.$this->datacolor[$i][2].')';
1115 1115
 				//$color = (!empty($data['seriescolor']) ? json_encode($data['seriescolor']) : json_encode($datacolor));
1116 1116
 
1117
-				if ($i > 0) $this->stringtoshow .= ', ' . "\n";
1118
-				$this->stringtoshow .= '{' . "\n";
1117
+				if ($i > 0) $this->stringtoshow .= ', '."\n";
1118
+				$this->stringtoshow .= '{'."\n";
1119 1119
 				//$this->stringtoshow .= 'borderColor: \''.$color.'\', ';
1120 1120
 				//$this->stringtoshow .= 'backgroundColor: \''.$color.'\', ';
1121
-				$this->stringtoshow .= '  data: [' . $serie[$i] . ']';
1122
-				$this->stringtoshow .= '}' . "\n";
1121
+				$this->stringtoshow .= '  data: ['.$serie[$i].']';
1122
+				$this->stringtoshow .= '}'."\n";
1123 1123
 				$i++;
1124 1124
 			}
1125
-			$this->stringtoshow .= ']' . "\n";
1126
-			$this->stringtoshow .= '}' . "\n";
1127
-			$this->stringtoshow .= '});' . "\n";
1125
+			$this->stringtoshow .= ']'."\n";
1126
+			$this->stringtoshow .= '}'."\n";
1127
+			$this->stringtoshow .= '});'."\n";
1128 1128
 		}
1129 1129
 		// Other cases, graph of type 'bars', 'lines', 'linesnopoint'
1130 1130
 		else {
@@ -1170,10 +1170,10 @@  discard block
 block discarded – undo
1170 1170
 			}
1171 1171
 			$this->stringtoshow .= '};';
1172 1172
 			$this->stringtoshow .= '
1173
-				var ctx = document.getElementById("canvas_' . $tag . '").getContext("2d");
1173
+				var ctx = document.getElementById("canvas_' . $tag.'").getContext("2d");
1174 1174
 				var chart = new Chart(ctx, {
1175 1175
 			    // The type of chart we want to create
1176
-    			type: \'' . $type . '\',
1176
+    			type: \'' . $type.'\',
1177 1177
 				// Configuration options go here
1178 1178
     			options: options,
1179 1179
 				data: {
@@ -1238,12 +1238,12 @@  discard block
 block discarded – undo
1238 1238
 					}
1239 1239
 					$oldstacknum = $arrayofgroupslegend[$i]['stacknum'];
1240 1240
 
1241
-					$color = 'rgb(' . $newcolor[0] . ', ' . $newcolor[1] . ', ' . $newcolor[2] . ', 0.9)';
1242
-					$bordercolor = 'rgb(' . $newcolor[0] . ', ' . $newcolor[1] . ', ' . $newcolor[2] . ')';
1241
+					$color = 'rgb('.$newcolor[0].', '.$newcolor[1].', '.$newcolor[2].', 0.9)';
1242
+					$bordercolor = 'rgb('.$newcolor[0].', '.$newcolor[1].', '.$newcolor[2].')';
1243 1243
 				} else { // We do not use a 'group by'
1244 1244
 					if ($isfunnel) {
1245 1245
 						if (is_array($this->datacolor[$i])) {
1246
-							$color = 'rgb(' . $this->datacolor[$i][0] . ', ' . $this->datacolor[$i][1] . ', ' . $this->datacolor[$i][2] . ', 0.9)'; // If datacolor is array(R, G, B)
1246
+							$color = 'rgb('.$this->datacolor[$i][0].', '.$this->datacolor[$i][1].', '.$this->datacolor[$i][2].', 0.9)'; // If datacolor is array(R, G, B)
1247 1247
 						} else {
1248 1248
 							// TODO FIXME This logic must be in the caller that set $this->datacolor
1249 1249
 							$tmp = str_replace('#', '', $this->datacolor[$i]);
@@ -1251,17 +1251,17 @@  discard block
 block discarded – undo
1251 1251
 								$foundnegativecolor++;
1252 1252
 								$color = '#FFFFFF'; // If $val is '-123'
1253 1253
 							} else {
1254
-								$color = "#" . $tmp; // If $val is '123' or '#123'
1254
+								$color = "#".$tmp; // If $val is '123' or '#123'
1255 1255
 								$bordercolor = $color;
1256 1256
 							}
1257 1257
 							if ($foundnegativecolor) {
1258 1258
 								if (is_array($this->datacolor[$i])) $color = 'null'; // If datacolor is array(R, G, B)
1259 1259
 								else {
1260 1260
 									$tmp = str_replace('#', '', $this->datacolor[$i]);
1261
-									if (strpos($tmp, '-') !== false) $bordercolor = '#' . str_replace('-', '', $tmp); // If $val is '-123'
1261
+									if (strpos($tmp, '-') !== false) $bordercolor = '#'.str_replace('-', '', $tmp); // If $val is '-123'
1262 1262
 									else $bordercolor = 'null'; // If $val is '123' or '#123'
1263 1263
 								}
1264
-								$bordercolor == 'null' ? "'rgba(0,0,0,0.2)'" : "'" . $bordercolor . "'";
1264
+								$bordercolor == 'null' ? "'rgba(0,0,0,0.2)'" : "'".$bordercolor."'";
1265 1265
 							}
1266 1266
 						}
1267 1267
 					} else {
@@ -1274,36 +1274,36 @@  discard block
 block discarded – undo
1274 1274
 				if ($i > 0) $this->stringtoshow .= ', ';
1275 1275
 				$this->stringtoshow .= "\n";
1276 1276
 				$this->stringtoshow .= '{';
1277
-				$this->stringtoshow .= 'dolibarrinfo: \'y_' . $i . '\', ';
1278
-				$this->stringtoshow .= 'label: \'' . dol_escape_js(dol_string_nohtmltag($textoflegend)) . '\', ';
1279
-				$this->stringtoshow .= 'pointStyle: \'' . ($this->type[$i] == 'linesnopoint' ? 'line' : 'circle') . '\', ';
1280
-				$this->stringtoshow .= 'fill: ' . ($type == 'bar' ? 'true' : 'false') . ', ';
1277
+				$this->stringtoshow .= 'dolibarrinfo: \'y_'.$i.'\', ';
1278
+				$this->stringtoshow .= 'label: \''.dol_escape_js(dol_string_nohtmltag($textoflegend)).'\', ';
1279
+				$this->stringtoshow .= 'pointStyle: \''.($this->type[$i] == 'linesnopoint' ? 'line' : 'circle').'\', ';
1280
+				$this->stringtoshow .= 'fill: '.($type == 'bar' ? 'true' : 'false').', ';
1281 1281
 				if ($isfunnel) {
1282 1282
 					$this->stringtoshow .= 'borderWidth: \'2\', ';
1283 1283
 				} elseif ($type == 'bar' || $type == 'horizontalBar') {
1284 1284
 					$this->stringtoshow .= 'borderWidth: \'1\', ';
1285 1285
 				}
1286
-				$this->stringtoshow .= 'borderColor: \'' . $bordercolor . '\', ';
1287
-				$this->stringtoshow .= 'backgroundColor: \'' . $color . '\', ';
1288
-				if ($arrayofgroupslegend[$i]) $this->stringtoshow .= 'stack: \'' . $arrayofgroupslegend[$i]['stacknum'] . '\', ';
1289
-				$this->stringtoshow .='data: [';
1286
+				$this->stringtoshow .= 'borderColor: \''.$bordercolor.'\', ';
1287
+				$this->stringtoshow .= 'backgroundColor: \''.$color.'\', ';
1288
+				if ($arrayofgroupslegend[$i]) $this->stringtoshow .= 'stack: \''.$arrayofgroupslegend[$i]['stacknum'].'\', ';
1289
+				$this->stringtoshow .= 'data: [';
1290 1290
 				if ($isfunnel) {
1291 1291
 					$this->stringtoshow .= '['.-$serie[$i].','.$serie[$i].']';
1292 1292
 				} else {
1293 1293
 					$this->stringtoshow .= $serie[$i];
1294 1294
 				}
1295
-				$this->stringtoshow .=']';
1296
-				$this->stringtoshow .= '}' . "\n";
1295
+				$this->stringtoshow .= ']';
1296
+				$this->stringtoshow .= '}'."\n";
1297 1297
 
1298 1298
 				$i++;
1299 1299
 				$iinstack++;
1300 1300
 			}
1301
-			$this->stringtoshow .= ']' . "\n";
1302
-			$this->stringtoshow .= '}' . "\n";
1303
-			$this->stringtoshow .= '});' . "\n";
1301
+			$this->stringtoshow .= ']'."\n";
1302
+			$this->stringtoshow .= '}'."\n";
1303
+			$this->stringtoshow .= '});'."\n";
1304 1304
 		}
1305 1305
 
1306
-		$this->stringtoshow .= '</script>' . "\n";
1306
+		$this->stringtoshow .= '</script>'."\n";
1307 1307
 	}
1308 1308
 
1309 1309
 
@@ -1333,12 +1333,12 @@  discard block
 block discarded – undo
1333 1333
 		global $langs;
1334 1334
 
1335 1335
 		if ($shownographyet) {
1336
-			$s = '<div class="nographyet" style="width:' . (preg_match('/%/', $this->width) ? $this->width : $this->width . 'px') . '; height:' . (preg_match('/%/', $this->height) ? $this->height : $this->height . 'px') . ';"></div>';
1336
+			$s = '<div class="nographyet" style="width:'.(preg_match('/%/', $this->width) ? $this->width : $this->width.'px').'; height:'.(preg_match('/%/', $this->height) ? $this->height : $this->height.'px').';"></div>';
1337 1337
 			$s .= '<div class="nographyettext margintoponly">';
1338 1338
 			if (is_numeric($shownographyet)) {
1339
-				$s .= $langs->trans("NotEnoughDataYet") . '...';
1339
+				$s .= $langs->trans("NotEnoughDataYet").'...';
1340 1340
 			} else {
1341
-				$s .= $shownographyet . '...';
1341
+				$s .= $shownographyet.'...';
1342 1342
 			}
1343 1343
 			$s .= '</div>';
1344 1344
 			return $s;
Please login to merge, or discard this patch.