Completed
Pull Request — master (#1795)
by Christian
10:16
created
default/boinc/modules/boincstats/includes/pchart/class/pSplit.class.php 4 patches
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
- /*
2
+    /*
3 3
      pSplit - class to draw spline splitted charts
4 4
 
5 5
      Version     : 2.1.3
@@ -13,119 +13,119 @@  discard block
 block discarded – undo
13 13
      You can find the whole class documentation on the pChart web site.
14 14
  */
15 15
 
16
- define("TEXT_POS_TOP"		, 690001);
17
- define("TEXT_POS_RIGHT"	, 690002);
16
+    define("TEXT_POS_TOP"		, 690001);
17
+    define("TEXT_POS_RIGHT"	, 690002);
18 18
 
19
- /* pSplit class definition */
20
- class pSplit
21
-  {
22
-   var $pChartObject;
19
+    /* pSplit class definition */
20
+    class pSplit
21
+    {
22
+    var $pChartObject;
23 23
 
24
-   /* Class creator */
25
-   function pSplit()
24
+    /* Class creator */
25
+    function pSplit()
26 26
     { }
27 27
 
28
-   /* Create the encoded string */
29
-   function drawSplitPath($Object,$Values,$Format="")
28
+    /* Create the encoded string */
29
+    function drawSplitPath($Object,$Values,$Format="")
30 30
     {
31
-     $this->pChartObject = $Object;
32
-
33
-     $Spacing		= isset($Format["Spacing"]) ? $Format["Spacing"] : 20;
34
-     $TextPadding	= isset($Format["TextPadding"]) ? $Format["TextPadding"] : 2;
35
-     $TextPos		= isset($Format["TextPos"]) ? $Format["TextPos"] : TEXT_POS_TOP;
36
-     $Surrounding       = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
37
-     $Force		= isset($Format["Force"]) ? $Format["Force"] : 70;
38
-     $Segments		= isset($Format["Segments"]) ? $Format["Segments"] : 15;
39
-     $FontSize		= $Object->FontSize;
40
-     $X1		= $Object->GraphAreaX1;
41
-     $Y1		= $Object->GraphAreaY1;
42
-     $X2		= $Object->GraphAreaX2;
43
-     $Y2		= $Object->GraphAreaY2;
44
-
45
-     /* Data Processing */
46
-     $Data    = $Values->getData();
47
-     $Palette = $Values->getPalette();
48
-
49
-     $LabelSerie = $Data["Abscissa"];
50
-     $DataSerie  = "";
51
-
52
-     foreach($Data["Series"] as $SerieName => $Value)
53
-      { if ( $SerieName != $LabelSerie && $DataSerie == "" ) { $DataSerie = $SerieName; } }
54
-
55
-     $DataSerieSum   = array_sum($Data["Series"][$DataSerie]["Data"]);
56
-     $DataSerieCount = count($Data["Series"][$DataSerie]["Data"]);
57
-
58
-     /* Scale Processing */
59
-     if ( $TextPos == TEXT_POS_RIGHT )
60
-      $YScale     = (($Y2-$Y1) - (($DataSerieCount+1)*$Spacing)) / $DataSerieSum;
61
-     else
62
-      $YScale     = (($Y2-$Y1) - ($DataSerieCount*$Spacing)) / $DataSerieSum;
63
-     $LeftHeight = $DataSerieSum * $YScale;
64
-
65
-     /* Re-compute graph width depending of the text mode choosen */
66
-     if ( $TextPos == TEXT_POS_RIGHT )
67
-      {
68
-       $MaxWidth = 0;
69
-       foreach($Data["Series"][$LabelSerie]["Data"] as $Key => $Label)
31
+        $this->pChartObject = $Object;
32
+
33
+        $Spacing		= isset($Format["Spacing"]) ? $Format["Spacing"] : 20;
34
+        $TextPadding	= isset($Format["TextPadding"]) ? $Format["TextPadding"] : 2;
35
+        $TextPos		= isset($Format["TextPos"]) ? $Format["TextPos"] : TEXT_POS_TOP;
36
+        $Surrounding       = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
37
+        $Force		= isset($Format["Force"]) ? $Format["Force"] : 70;
38
+        $Segments		= isset($Format["Segments"]) ? $Format["Segments"] : 15;
39
+        $FontSize		= $Object->FontSize;
40
+        $X1		= $Object->GraphAreaX1;
41
+        $Y1		= $Object->GraphAreaY1;
42
+        $X2		= $Object->GraphAreaX2;
43
+        $Y2		= $Object->GraphAreaY2;
44
+
45
+        /* Data Processing */
46
+        $Data    = $Values->getData();
47
+        $Palette = $Values->getPalette();
48
+
49
+        $LabelSerie = $Data["Abscissa"];
50
+        $DataSerie  = "";
51
+
52
+        foreach($Data["Series"] as $SerieName => $Value)
53
+        { if ( $SerieName != $LabelSerie && $DataSerie == "" ) { $DataSerie = $SerieName; } }
54
+
55
+        $DataSerieSum   = array_sum($Data["Series"][$DataSerie]["Data"]);
56
+        $DataSerieCount = count($Data["Series"][$DataSerie]["Data"]);
57
+
58
+        /* Scale Processing */
59
+        if ( $TextPos == TEXT_POS_RIGHT )
60
+        $YScale     = (($Y2-$Y1) - (($DataSerieCount+1)*$Spacing)) / $DataSerieSum;
61
+        else
62
+        $YScale     = (($Y2-$Y1) - ($DataSerieCount*$Spacing)) / $DataSerieSum;
63
+        $LeftHeight = $DataSerieSum * $YScale;
64
+
65
+        /* Re-compute graph width depending of the text mode choosen */
66
+        if ( $TextPos == TEXT_POS_RIGHT )
67
+        {
68
+        $MaxWidth = 0;
69
+        foreach($Data["Series"][$LabelSerie]["Data"] as $Key => $Label)
70 70
         {
71
-         $Boundardies = $Object->getTextBox(0,0,$Object->FontName,$Object->FontSize,0,$Label);
72
-         if ( $Boundardies[1]["X"] > $MaxWidth ) { $MaxWidth = $Boundardies[1]["X"] + $TextPadding*2; }
71
+            $Boundardies = $Object->getTextBox(0,0,$Object->FontName,$Object->FontSize,0,$Label);
72
+            if ( $Boundardies[1]["X"] > $MaxWidth ) { $MaxWidth = $Boundardies[1]["X"] + $TextPadding*2; }
73
+        }
74
+        $X2 = $X2 - $MaxWidth;
73 75
         }
74
-       $X2 = $X2 - $MaxWidth;
75
-      }
76 76
 
77
-     /* Drawing */
78
-     $LeftY    = ((($Y2-$Y1) / 2) + $Y1) - ($LeftHeight/2);
79
-     $RightY   = $Y1;
80
-     $VectorX  = (($X2-$X1) / 2);
77
+        /* Drawing */
78
+        $LeftY    = ((($Y2-$Y1) / 2) + $Y1) - ($LeftHeight/2);
79
+        $RightY   = $Y1;
80
+        $VectorX  = (($X2-$X1) / 2);
81 81
 
82
-     foreach($Data["Series"][$DataSerie]["Data"] as $Key => $Value)
83
-      {
84
-       if ( isset($Data["Series"][$LabelSerie]["Data"][$Key]) )
82
+        foreach($Data["Series"][$DataSerie]["Data"] as $Key => $Value)
83
+        {
84
+        if ( isset($Data["Series"][$LabelSerie]["Data"][$Key]) )
85 85
         $Label = $Data["Series"][$LabelSerie]["Data"][$Key];
86
-       else
86
+        else
87 87
         $Label = "-";
88 88
 
89
-       $LeftY1 = $LeftY;
90
-       $LeftY2 = $LeftY + $Value * $YScale;
89
+        $LeftY1 = $LeftY;
90
+        $LeftY2 = $LeftY + $Value * $YScale;
91 91
 
92
-       $RightY1 = $RightY + $Spacing;
93
-       $RightY2 = $RightY + $Spacing + $Value * $YScale;;
92
+        $RightY1 = $RightY + $Spacing;
93
+        $RightY2 = $RightY + $Spacing + $Value * $YScale;;
94 94
 
95
-       $Settings = array("R"=>$Palette[$Key]["R"],"G"=>$Palette[$Key]["G"],"B"=>$Palette[$Key]["B"],"Alpha"=>$Palette[$Key]["Alpha"],"NoDraw"=>TRUE,"Segments"=>$Segments,"Surrounding"=>$Surrounding);
95
+        $Settings = array("R"=>$Palette[$Key]["R"],"G"=>$Palette[$Key]["G"],"B"=>$Palette[$Key]["B"],"Alpha"=>$Palette[$Key]["Alpha"],"NoDraw"=>TRUE,"Segments"=>$Segments,"Surrounding"=>$Surrounding);
96 96
 
97
-       $PolyGon = "";
97
+        $PolyGon = "";
98 98
 
99
-       $Angle    = $Object->getAngle($X2,$RightY1,$X1,$LeftY1);
100
-       $VectorX1 = cos(deg2rad($Angle+90)) * $Force + ($X2-$X1)/2 + $X1;
101
-       $VectorY1 = sin(deg2rad($Angle+90)) * $Force + ($RightY1-$LeftY1)/2 + $LeftY1;
102
-       $VectorX2 = cos(deg2rad($Angle-90)) * $Force + ($X2-$X1)/2 + $X1;
103
-       $VectorY2 = sin(deg2rad($Angle-90)) * $Force + ($RightY1-$LeftY1)/2 + $LeftY1;
99
+        $Angle    = $Object->getAngle($X2,$RightY1,$X1,$LeftY1);
100
+        $VectorX1 = cos(deg2rad($Angle+90)) * $Force + ($X2-$X1)/2 + $X1;
101
+        $VectorY1 = sin(deg2rad($Angle+90)) * $Force + ($RightY1-$LeftY1)/2 + $LeftY1;
102
+        $VectorX2 = cos(deg2rad($Angle-90)) * $Force + ($X2-$X1)/2 + $X1;
103
+        $VectorY2 = sin(deg2rad($Angle-90)) * $Force + ($RightY1-$LeftY1)/2 + $LeftY1;
104 104
 
105
-       $Points = $Object->drawBezier($X1,$LeftY1,$X2,$RightY1,$VectorX1,$VectorY1,$VectorX2,$VectorY2,$Settings);
106
-       foreach($Points as $Key => $Pos) { $PolyGon[] = $Pos["X"]; $PolyGon[] = $Pos["Y"]; }
105
+        $Points = $Object->drawBezier($X1,$LeftY1,$X2,$RightY1,$VectorX1,$VectorY1,$VectorX2,$VectorY2,$Settings);
106
+        foreach($Points as $Key => $Pos) { $PolyGon[] = $Pos["X"]; $PolyGon[] = $Pos["Y"]; }
107 107
 
108 108
 
109
-       $Angle    = $Object->getAngle($X2,$RightY2,$X1,$LeftY2);
110
-       $VectorX1 = cos(deg2rad($Angle+90)) * $Force + ($X2-$X1)/2 +$X1;
111
-       $VectorY1 = sin(deg2rad($Angle+90)) * $Force + ($RightY2-$LeftY2)/2 + $LeftY2;
112
-       $VectorX2 = cos(deg2rad($Angle-90)) * $Force + ($X2-$X1)/2 +$X1;
113
-       $VectorY2 = sin(deg2rad($Angle-90)) * $Force + ($RightY2-$LeftY2)/2 + $LeftY2;
109
+        $Angle    = $Object->getAngle($X2,$RightY2,$X1,$LeftY2);
110
+        $VectorX1 = cos(deg2rad($Angle+90)) * $Force + ($X2-$X1)/2 +$X1;
111
+        $VectorY1 = sin(deg2rad($Angle+90)) * $Force + ($RightY2-$LeftY2)/2 + $LeftY2;
112
+        $VectorX2 = cos(deg2rad($Angle-90)) * $Force + ($X2-$X1)/2 +$X1;
113
+        $VectorY2 = sin(deg2rad($Angle-90)) * $Force + ($RightY2-$LeftY2)/2 + $LeftY2;
114 114
 
115
-       $Points = $Object->drawBezier($X1,$LeftY2,$X2,$RightY2,$VectorX1,$VectorY1,$VectorX2,$VectorY2,$Settings);
116
-       $Points = array_reverse($Points);
117
-       foreach($Points as $Key => $Pos) { $PolyGon[] = $Pos["X"]; $PolyGon[] = $Pos["Y"]; }
115
+        $Points = $Object->drawBezier($X1,$LeftY2,$X2,$RightY2,$VectorX1,$VectorY1,$VectorX2,$VectorY2,$Settings);
116
+        $Points = array_reverse($Points);
117
+        foreach($Points as $Key => $Pos) { $PolyGon[] = $Pos["X"]; $PolyGon[] = $Pos["Y"]; }
118 118
 
119
-       $Object->drawPolygon($PolyGon,$Settings);
119
+        $Object->drawPolygon($PolyGon,$Settings);
120 120
 
121
-       if ( $TextPos == TEXT_POS_RIGHT )
121
+        if ( $TextPos == TEXT_POS_RIGHT )
122 122
         $Object->drawText($X2+$TextPadding,($RightY2-$RightY1)/2+$RightY1,$Label,array("Align"=>TEXT_ALIGN_MIDDLELEFT));
123
-       else
123
+        else
124 124
         $Object->drawText($X2,$RightY1-$TextPadding,$Label,array("Align"=>TEXT_ALIGN_BOTTOMRIGHT));
125 125
 
126
-       $LeftY  = $LeftY2;
127
-       $RightY = $RightY2;
128
-      }
126
+        $LeftY  = $LeftY2;
127
+        $RightY = $RightY2;
128
+        }
129
+    }
129 130
     }
130
-  }
131 131
 ?>
132 132
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  discard block
 block discarded – undo
13 13
      You can find the whole class documentation on the pChart web site.
14 14
  */
15 15
 
16
- define("TEXT_POS_TOP"		, 690001);
17
- define("TEXT_POS_RIGHT"	, 690002);
16
+ define("TEXT_POS_TOP", 690001);
17
+ define("TEXT_POS_RIGHT", 690002);
18 18
 
19 19
  /* pSplit class definition */
20 20
  class pSplit
@@ -26,15 +26,15 @@  discard block
 block discarded – undo
26 26
     { }
27 27
 
28 28
    /* Create the encoded string */
29
-   function drawSplitPath($Object,$Values,$Format="")
29
+   function drawSplitPath($Object, $Values, $Format = "")
30 30
     {
31 31
      $this->pChartObject = $Object;
32 32
 
33 33
      $Spacing		= isset($Format["Spacing"]) ? $Format["Spacing"] : 20;
34
-     $TextPadding	= isset($Format["TextPadding"]) ? $Format["TextPadding"] : 2;
34
+     $TextPadding = isset($Format["TextPadding"]) ? $Format["TextPadding"] : 2;
35 35
      $TextPos		= isset($Format["TextPos"]) ? $Format["TextPos"] : TEXT_POS_TOP;
36
-     $Surrounding       = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
37
-     $Force		= isset($Format["Force"]) ? $Format["Force"] : 70;
36
+     $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
37
+     $Force = isset($Format["Force"]) ? $Format["Force"] : 70;
38 38
      $Segments		= isset($Format["Segments"]) ? $Format["Segments"] : 15;
39 39
      $FontSize		= $Object->FontSize;
40 40
      $X1		= $Object->GraphAreaX1;
@@ -49,79 +49,79 @@  discard block
 block discarded – undo
49 49
      $LabelSerie = $Data["Abscissa"];
50 50
      $DataSerie  = "";
51 51
 
52
-     foreach($Data["Series"] as $SerieName => $Value)
53
-      { if ( $SerieName != $LabelSerie && $DataSerie == "" ) { $DataSerie = $SerieName; } }
52
+     foreach ($Data["Series"] as $SerieName => $Value)
53
+      { if ($SerieName != $LabelSerie && $DataSerie == "") { $DataSerie = $SerieName; } }
54 54
 
55 55
      $DataSerieSum   = array_sum($Data["Series"][$DataSerie]["Data"]);
56 56
      $DataSerieCount = count($Data["Series"][$DataSerie]["Data"]);
57 57
 
58 58
      /* Scale Processing */
59
-     if ( $TextPos == TEXT_POS_RIGHT )
60
-      $YScale     = (($Y2-$Y1) - (($DataSerieCount+1)*$Spacing)) / $DataSerieSum;
59
+     if ($TextPos == TEXT_POS_RIGHT)
60
+      $YScale     = (($Y2 - $Y1) - (($DataSerieCount + 1)*$Spacing))/$DataSerieSum;
61 61
      else
62
-      $YScale     = (($Y2-$Y1) - ($DataSerieCount*$Spacing)) / $DataSerieSum;
63
-     $LeftHeight = $DataSerieSum * $YScale;
62
+      $YScale     = (($Y2 - $Y1) - ($DataSerieCount*$Spacing))/$DataSerieSum;
63
+     $LeftHeight = $DataSerieSum*$YScale;
64 64
 
65 65
      /* Re-compute graph width depending of the text mode choosen */
66
-     if ( $TextPos == TEXT_POS_RIGHT )
66
+     if ($TextPos == TEXT_POS_RIGHT)
67 67
       {
68 68
        $MaxWidth = 0;
69
-       foreach($Data["Series"][$LabelSerie]["Data"] as $Key => $Label)
69
+       foreach ($Data["Series"][$LabelSerie]["Data"] as $Key => $Label)
70 70
         {
71
-         $Boundardies = $Object->getTextBox(0,0,$Object->FontName,$Object->FontSize,0,$Label);
72
-         if ( $Boundardies[1]["X"] > $MaxWidth ) { $MaxWidth = $Boundardies[1]["X"] + $TextPadding*2; }
71
+         $Boundardies = $Object->getTextBox(0, 0, $Object->FontName, $Object->FontSize, 0, $Label);
72
+         if ($Boundardies[1]["X"] > $MaxWidth) { $MaxWidth = $Boundardies[1]["X"] + $TextPadding*2; }
73 73
         }
74 74
        $X2 = $X2 - $MaxWidth;
75 75
       }
76 76
 
77 77
      /* Drawing */
78
-     $LeftY    = ((($Y2-$Y1) / 2) + $Y1) - ($LeftHeight/2);
78
+     $LeftY    = ((($Y2 - $Y1)/2) + $Y1) - ($LeftHeight/2);
79 79
      $RightY   = $Y1;
80
-     $VectorX  = (($X2-$X1) / 2);
80
+     $VectorX  = (($X2 - $X1)/2);
81 81
 
82
-     foreach($Data["Series"][$DataSerie]["Data"] as $Key => $Value)
82
+     foreach ($Data["Series"][$DataSerie]["Data"] as $Key => $Value)
83 83
       {
84
-       if ( isset($Data["Series"][$LabelSerie]["Data"][$Key]) )
84
+       if (isset($Data["Series"][$LabelSerie]["Data"][$Key]))
85 85
         $Label = $Data["Series"][$LabelSerie]["Data"][$Key];
86 86
        else
87 87
         $Label = "-";
88 88
 
89 89
        $LeftY1 = $LeftY;
90
-       $LeftY2 = $LeftY + $Value * $YScale;
90
+       $LeftY2 = $LeftY + $Value*$YScale;
91 91
 
92 92
        $RightY1 = $RightY + $Spacing;
93
-       $RightY2 = $RightY + $Spacing + $Value * $YScale;;
93
+       $RightY2 = $RightY + $Spacing + $Value*$YScale; ;
94 94
 
95
-       $Settings = array("R"=>$Palette[$Key]["R"],"G"=>$Palette[$Key]["G"],"B"=>$Palette[$Key]["B"],"Alpha"=>$Palette[$Key]["Alpha"],"NoDraw"=>TRUE,"Segments"=>$Segments,"Surrounding"=>$Surrounding);
95
+       $Settings = array("R"=>$Palette[$Key]["R"], "G"=>$Palette[$Key]["G"], "B"=>$Palette[$Key]["B"], "Alpha"=>$Palette[$Key]["Alpha"], "NoDraw"=>TRUE, "Segments"=>$Segments, "Surrounding"=>$Surrounding);
96 96
 
97 97
        $PolyGon = "";
98 98
 
99
-       $Angle    = $Object->getAngle($X2,$RightY1,$X1,$LeftY1);
100
-       $VectorX1 = cos(deg2rad($Angle+90)) * $Force + ($X2-$X1)/2 + $X1;
101
-       $VectorY1 = sin(deg2rad($Angle+90)) * $Force + ($RightY1-$LeftY1)/2 + $LeftY1;
102
-       $VectorX2 = cos(deg2rad($Angle-90)) * $Force + ($X2-$X1)/2 + $X1;
103
-       $VectorY2 = sin(deg2rad($Angle-90)) * $Force + ($RightY1-$LeftY1)/2 + $LeftY1;
99
+       $Angle    = $Object->getAngle($X2, $RightY1, $X1, $LeftY1);
100
+       $VectorX1 = cos(deg2rad($Angle + 90))*$Force + ($X2 - $X1)/2 + $X1;
101
+       $VectorY1 = sin(deg2rad($Angle + 90))*$Force + ($RightY1 - $LeftY1)/2 + $LeftY1;
102
+       $VectorX2 = cos(deg2rad($Angle - 90))*$Force + ($X2 - $X1)/2 + $X1;
103
+       $VectorY2 = sin(deg2rad($Angle - 90))*$Force + ($RightY1 - $LeftY1)/2 + $LeftY1;
104 104
 
105
-       $Points = $Object->drawBezier($X1,$LeftY1,$X2,$RightY1,$VectorX1,$VectorY1,$VectorX2,$VectorY2,$Settings);
106
-       foreach($Points as $Key => $Pos) { $PolyGon[] = $Pos["X"]; $PolyGon[] = $Pos["Y"]; }
105
+       $Points = $Object->drawBezier($X1, $LeftY1, $X2, $RightY1, $VectorX1, $VectorY1, $VectorX2, $VectorY2, $Settings);
106
+       foreach ($Points as $Key => $Pos) { $PolyGon[] = $Pos["X"]; $PolyGon[] = $Pos["Y"]; }
107 107
 
108 108
 
109
-       $Angle    = $Object->getAngle($X2,$RightY2,$X1,$LeftY2);
110
-       $VectorX1 = cos(deg2rad($Angle+90)) * $Force + ($X2-$X1)/2 +$X1;
111
-       $VectorY1 = sin(deg2rad($Angle+90)) * $Force + ($RightY2-$LeftY2)/2 + $LeftY2;
112
-       $VectorX2 = cos(deg2rad($Angle-90)) * $Force + ($X2-$X1)/2 +$X1;
113
-       $VectorY2 = sin(deg2rad($Angle-90)) * $Force + ($RightY2-$LeftY2)/2 + $LeftY2;
109
+       $Angle    = $Object->getAngle($X2, $RightY2, $X1, $LeftY2);
110
+       $VectorX1 = cos(deg2rad($Angle + 90))*$Force + ($X2 - $X1)/2 + $X1;
111
+       $VectorY1 = sin(deg2rad($Angle + 90))*$Force + ($RightY2 - $LeftY2)/2 + $LeftY2;
112
+       $VectorX2 = cos(deg2rad($Angle - 90))*$Force + ($X2 - $X1)/2 + $X1;
113
+       $VectorY2 = sin(deg2rad($Angle - 90))*$Force + ($RightY2 - $LeftY2)/2 + $LeftY2;
114 114
 
115
-       $Points = $Object->drawBezier($X1,$LeftY2,$X2,$RightY2,$VectorX1,$VectorY1,$VectorX2,$VectorY2,$Settings);
115
+       $Points = $Object->drawBezier($X1, $LeftY2, $X2, $RightY2, $VectorX1, $VectorY1, $VectorX2, $VectorY2, $Settings);
116 116
        $Points = array_reverse($Points);
117
-       foreach($Points as $Key => $Pos) { $PolyGon[] = $Pos["X"]; $PolyGon[] = $Pos["Y"]; }
117
+       foreach ($Points as $Key => $Pos) { $PolyGon[] = $Pos["X"]; $PolyGon[] = $Pos["Y"]; }
118 118
 
119
-       $Object->drawPolygon($PolyGon,$Settings);
119
+       $Object->drawPolygon($PolyGon, $Settings);
120 120
 
121
-       if ( $TextPos == TEXT_POS_RIGHT )
122
-        $Object->drawText($X2+$TextPadding,($RightY2-$RightY1)/2+$RightY1,$Label,array("Align"=>TEXT_ALIGN_MIDDLELEFT));
121
+       if ($TextPos == TEXT_POS_RIGHT)
122
+        $Object->drawText($X2 + $TextPadding, ($RightY2 - $RightY1)/2 + $RightY1, $Label, array("Align"=>TEXT_ALIGN_MIDDLELEFT));
123 123
        else
124
-        $Object->drawText($X2,$RightY1-$TextPadding,$Label,array("Align"=>TEXT_ALIGN_BOTTOMRIGHT));
124
+        $Object->drawText($X2, $RightY1 - $TextPadding, $Label, array("Align"=>TEXT_ALIGN_BOTTOMRIGHT));
125 125
 
126 126
        $LeftY  = $LeftY2;
127 127
        $RightY = $RightY2;
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@  discard block
 block discarded – undo
17 17
  define("TEXT_POS_RIGHT"	, 690002);
18 18
 
19 19
  /* pSplit class definition */
20
- class pSplit
21
-  {
20
+ class pSplit {
22 21
    var $pChartObject;
23 22
 
24 23
    /* Class creator */
@@ -26,8 +25,7 @@  discard block
 block discarded – undo
26 25
     { }
27 26
 
28 27
    /* Create the encoded string */
29
-   function drawSplitPath($Object,$Values,$Format="")
30
-    {
28
+   function drawSplitPath($Object,$Values,$Format="") {
31 29
      $this->pChartObject = $Object;
32 30
 
33 31
      $Spacing		= isset($Format["Spacing"]) ? $Format["Spacing"] : 20;
@@ -63,11 +61,9 @@  discard block
 block discarded – undo
63 61
      $LeftHeight = $DataSerieSum * $YScale;
64 62
 
65 63
      /* Re-compute graph width depending of the text mode choosen */
66
-     if ( $TextPos == TEXT_POS_RIGHT )
67
-      {
64
+     if ( $TextPos == TEXT_POS_RIGHT ) {
68 65
        $MaxWidth = 0;
69
-       foreach($Data["Series"][$LabelSerie]["Data"] as $Key => $Label)
70
-        {
66
+       foreach($Data["Series"][$LabelSerie]["Data"] as $Key => $Label) {
71 67
          $Boundardies = $Object->getTextBox(0,0,$Object->FontName,$Object->FontSize,0,$Label);
72 68
          if ( $Boundardies[1]["X"] > $MaxWidth ) { $MaxWidth = $Boundardies[1]["X"] + $TextPadding*2; }
73 69
         }
@@ -79,8 +75,7 @@  discard block
 block discarded – undo
79 75
      $RightY   = $Y1;
80 76
      $VectorX  = (($X2-$X1) / 2);
81 77
 
82
-     foreach($Data["Series"][$DataSerie]["Data"] as $Key => $Value)
83
-      {
78
+     foreach($Data["Series"][$DataSerie]["Data"] as $Key => $Value) {
84 79
        if ( isset($Data["Series"][$LabelSerie]["Data"][$Key]) )
85 80
         $Label = $Data["Series"][$LabelSerie]["Data"][$Key];
86 81
        else
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      $Spacing		= isset($Format["Spacing"]) ? $Format["Spacing"] : 20;
34 34
      $TextPadding	= isset($Format["TextPadding"]) ? $Format["TextPadding"] : 2;
35 35
      $TextPos		= isset($Format["TextPos"]) ? $Format["TextPos"] : TEXT_POS_TOP;
36
-     $Surrounding       = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
36
+     $Surrounding       = isset($Format["Surrounding"]) ? $Format["Surrounding"] : null;
37 37
      $Force		= isset($Format["Force"]) ? $Format["Force"] : 70;
38 38
      $Segments		= isset($Format["Segments"]) ? $Format["Segments"] : 15;
39 39
      $FontSize		= $Object->FontSize;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
        $RightY1 = $RightY + $Spacing;
93 93
        $RightY2 = $RightY + $Spacing + $Value * $YScale;;
94 94
 
95
-       $Settings = array("R"=>$Palette[$Key]["R"],"G"=>$Palette[$Key]["G"],"B"=>$Palette[$Key]["B"],"Alpha"=>$Palette[$Key]["Alpha"],"NoDraw"=>TRUE,"Segments"=>$Segments,"Surrounding"=>$Surrounding);
95
+       $Settings = array("R"=>$Palette[$Key]["R"],"G"=>$Palette[$Key]["G"],"B"=>$Palette[$Key]["B"],"Alpha"=>$Palette[$Key]["Alpha"],"NoDraw"=>true,"Segments"=>$Segments,"Surrounding"=>$Surrounding);
96 96
 
97 97
        $PolyGon = "";
98 98
 
Please login to merge, or discard this patch.
default/boinc/modules/boincstats/includes/pchart/class/pStock.class.php 4 patches
Indentation   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
- /*
2
+    /*
3 3
      pStock - class to draw stock charts
4 4
 
5 5
      Version     : 2.1.3
@@ -13,204 +13,204 @@  discard block
 block discarded – undo
13 13
      You can find the whole class documentation on the pChart web site.
14 14
  */
15 15
 
16
- define("STOCK_MISSING_SERIE"	, 180001);
16
+    define("STOCK_MISSING_SERIE"	, 180001);
17 17
 
18
- /* pStock class definition */
19
- class pStock
20
-  {
21
-   var $pChartObject;
22
-   var $pDataObject;
18
+    /* pStock class definition */
19
+    class pStock
20
+    {
21
+    var $pChartObject;
22
+    var $pDataObject;
23 23
 
24
-   /* Class creator */
25
-   function pStock($pChartObject,$pDataObject)
24
+    /* Class creator */
25
+    function pStock($pChartObject,$pDataObject)
26 26
     {
27
-     $this->pChartObject = $pChartObject;
28
-     $this->pDataObject  = $pDataObject;
27
+        $this->pChartObject = $pChartObject;
28
+        $this->pDataObject  = $pDataObject;
29 29
     }
30 30
 
31
-   /* Draw a stock chart */
32
-   function drawStockChart($Format="")
31
+    /* Draw a stock chart */
32
+    function drawStockChart($Format="")
33 33
     {
34
-     $SerieOpen		= isset($Format["SerieOpen"]) ? $Format["SerieOpen"] : "Open";
35
-     $SerieClose	= isset($Format["SerieClose"]) ? $Format["SerieClose"] : "Close";
36
-     $SerieMin		= isset($Format["SerieMin"]) ? $Format["SerieMin"] : "Min";
37
-     $SerieMax		= isset($Format["SerieMax"]) ? $Format["SerieMax"] : "Max";
38
-     $SerieMedian	= isset($Format["SerieMedian"]) ? $Format["SerieMedian"] : NULL;
39
-     $LineWidth		= isset($Format["LineWidth"]) ? $Format["LineWidth"] : 1;
40
-     $LineR		= isset($Format["LineR"]) ? $Format["LineR"] : 0;
41
-     $LineG		= isset($Format["LineG"]) ? $Format["LineG"] : 0;
42
-     $LineB		= isset($Format["LineB"]) ? $Format["LineB"] : 0;
43
-     $LineAlpha		= isset($Format["LineAlpha"]) ? $Format["LineAlpha"] : 100;
44
-     $ExtremityWidth	= isset($Format["ExtremityWidth"]) ? $Format["ExtremityWidth"] : 1;
45
-     $ExtremityLength	= isset($Format["ExtremityLength"]) ? $Format["ExtremityLength"] : 3;
46
-     $ExtremityR	= isset($Format["ExtremityR"]) ? $Format["ExtremityR"] : 0;
47
-     $ExtremityG	= isset($Format["ExtremityG"]) ? $Format["ExtremityG"] : 0;
48
-     $ExtremityB	= isset($Format["ExtremityB"]) ? $Format["ExtremityB"] : 0;
49
-     $ExtremityAlpha	= isset($Format["ExtremityAlpha"]) ? $Format["ExtremityAlpha"] : 100;
50
-     $BoxWidth		= isset($Format["BoxWidth"]) ? $Format["BoxWidth"] : 8;
51
-     $BoxUpR		= isset($Format["BoxUpR"]) ? $Format["BoxUpR"] : 188;
52
-     $BoxUpG		= isset($Format["BoxUpG"]) ? $Format["BoxUpG"] : 224;
53
-     $BoxUpB		= isset($Format["BoxUpB"]) ? $Format["BoxUpB"] : 46;
54
-     $BoxUpAlpha	= isset($Format["BoxUpAlpha"]) ? $Format["BoxUpAlpha"] : 100;
55
-     $BoxUpSurrounding	= isset($Format["BoxUpSurrounding"]) ? $Format["BoxUpSurrounding"] : NULL;
56
-     $BoxUpBorderR	= isset($Format["BoxUpBorderR"]) ? $Format["BoxUpBorderR"] : $BoxUpR-20;
57
-     $BoxUpBorderG	= isset($Format["BoxUpBorderG"]) ? $Format["BoxUpBorderG"] : $BoxUpG-20;
58
-     $BoxUpBorderB	= isset($Format["BoxUpBorderB"]) ? $Format["BoxUpBorderB"] : $BoxUpB-20;
59
-     $BoxUpBorderAlpha	= isset($Format["BoxUpBorderAlpha"]) ? $Format["BoxUpBorderAlpha"] : 100;
60
-     $BoxDownR		= isset($Format["BoxDownR"]) ? $Format["BoxDownR"] : 224;
61
-     $BoxDownG		= isset($Format["BoxDownG"]) ? $Format["BoxDownG"] : 100;
62
-     $BoxDownB		= isset($Format["BoxDownB"]) ? $Format["BoxDownB"] : 46;
63
-     $BoxDownAlpha	= isset($Format["BoxDownAlpha"]) ? $Format["BoxDownAlpha"] : 100;
64
-     $BoxDownSurrounding= isset($Format["BoxDownSurrounding"]) ? $Format["BoxDownSurrounding"] : NULL;
65
-     $BoxDownBorderR	= isset($Format["BoxDownBorderR"]) ? $Format["BoxDownBorderR"] : $BoxDownR-20;
66
-     $BoxDownBorderG	= isset($Format["BoxDownBorderG"]) ? $Format["BoxDownBorderG"] : $BoxDownG-20;
67
-     $BoxDownBorderB	= isset($Format["BoxDownBorderB"]) ? $Format["BoxDownBorderB"] : $BoxDownB-20;
68
-     $BoxDownBorderAlpha= isset($Format["BoxDownBorderAlpha"]) ? $Format["BoxDownBorderAlpha"] : 100;
69
-     $ShadowOnBoxesOnly	= isset($Format["ShadowOnBoxesOnly"]) ? $Format["ShadowOnBoxesOnly"] : TRUE;
70
-     $MedianR		= isset($Format["MedianR"]) ? $Format["MedianR"] : 255;
71
-     $MedianG		= isset($Format["MedianG"]) ? $Format["MedianG"] : 0;
72
-     $MedianB		= isset($Format["MedianB"]) ? $Format["MedianB"] : 0;
73
-     $MedianAlpha	= isset($Format["MedianAlpha"]) ? $Format["MedianAlpha"] : 100;
74
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
75
-     $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : "Stock Chart";
76
-
77
-
78
-     /* Data Processing */
79
-     $Data    = $this->pDataObject->getData();
80
-     $Palette = $this->pDataObject->getPalette();
81
-
82
-     if ( $BoxUpSurrounding != NULL )	{ $BoxUpBorderR = $BoxUpR + $BoxUpSurrounding; $BoxUpBorderG = $BoxUpG + $BoxUpSurrounding; $BoxUpBorderB = $BoxUpB + $BoxUpSurrounding; }
83
-     if ( $BoxDownSurrounding != NULL )	{ $BoxDownBorderR = $BoxDownR + $BoxDownSurrounding; $BoxDownBorderG = $BoxDownG + $BoxDownSurrounding; $BoxDownBorderB = $BoxDownB + $BoxDownSurrounding; }
84
-
85
-     if ( $LineWidth != 1 ) { $LineOffset = $LineWidth / 2; }
86
-     $BoxOffset = $BoxWidth / 2;
87
-
88
-     $Data = $this->pChartObject->DataSet->getData();
89
-     list($XMargin,$XDivs) = $this->pChartObject->scaleGetXSettings();
90
-
91
-     if ( !isset($Data["Series"][$SerieOpen]) || !isset($Data["Series"][$SerieClose]) || !isset($Data["Series"][$SerieMin]) || !isset($Data["Series"][$SerieMax]) )
92
-      return(STOCK_MISSING_SERIE);
93
-
94
-     $Plots = "";
95
-     foreach($Data["Series"][$SerieOpen]["Data"] as $Key => $Value)
96
-      {
97
-       $Point = "";
98
-       if ( isset($Data["Series"][$SerieClose]["Data"][$Key]) || isset($Data["Series"][$SerieMin]["Data"][$Key]) || isset($Data["Series"][$SerieMax]["Data"][$Key]) )
34
+        $SerieOpen		= isset($Format["SerieOpen"]) ? $Format["SerieOpen"] : "Open";
35
+        $SerieClose	= isset($Format["SerieClose"]) ? $Format["SerieClose"] : "Close";
36
+        $SerieMin		= isset($Format["SerieMin"]) ? $Format["SerieMin"] : "Min";
37
+        $SerieMax		= isset($Format["SerieMax"]) ? $Format["SerieMax"] : "Max";
38
+        $SerieMedian	= isset($Format["SerieMedian"]) ? $Format["SerieMedian"] : NULL;
39
+        $LineWidth		= isset($Format["LineWidth"]) ? $Format["LineWidth"] : 1;
40
+        $LineR		= isset($Format["LineR"]) ? $Format["LineR"] : 0;
41
+        $LineG		= isset($Format["LineG"]) ? $Format["LineG"] : 0;
42
+        $LineB		= isset($Format["LineB"]) ? $Format["LineB"] : 0;
43
+        $LineAlpha		= isset($Format["LineAlpha"]) ? $Format["LineAlpha"] : 100;
44
+        $ExtremityWidth	= isset($Format["ExtremityWidth"]) ? $Format["ExtremityWidth"] : 1;
45
+        $ExtremityLength	= isset($Format["ExtremityLength"]) ? $Format["ExtremityLength"] : 3;
46
+        $ExtremityR	= isset($Format["ExtremityR"]) ? $Format["ExtremityR"] : 0;
47
+        $ExtremityG	= isset($Format["ExtremityG"]) ? $Format["ExtremityG"] : 0;
48
+        $ExtremityB	= isset($Format["ExtremityB"]) ? $Format["ExtremityB"] : 0;
49
+        $ExtremityAlpha	= isset($Format["ExtremityAlpha"]) ? $Format["ExtremityAlpha"] : 100;
50
+        $BoxWidth		= isset($Format["BoxWidth"]) ? $Format["BoxWidth"] : 8;
51
+        $BoxUpR		= isset($Format["BoxUpR"]) ? $Format["BoxUpR"] : 188;
52
+        $BoxUpG		= isset($Format["BoxUpG"]) ? $Format["BoxUpG"] : 224;
53
+        $BoxUpB		= isset($Format["BoxUpB"]) ? $Format["BoxUpB"] : 46;
54
+        $BoxUpAlpha	= isset($Format["BoxUpAlpha"]) ? $Format["BoxUpAlpha"] : 100;
55
+        $BoxUpSurrounding	= isset($Format["BoxUpSurrounding"]) ? $Format["BoxUpSurrounding"] : NULL;
56
+        $BoxUpBorderR	= isset($Format["BoxUpBorderR"]) ? $Format["BoxUpBorderR"] : $BoxUpR-20;
57
+        $BoxUpBorderG	= isset($Format["BoxUpBorderG"]) ? $Format["BoxUpBorderG"] : $BoxUpG-20;
58
+        $BoxUpBorderB	= isset($Format["BoxUpBorderB"]) ? $Format["BoxUpBorderB"] : $BoxUpB-20;
59
+        $BoxUpBorderAlpha	= isset($Format["BoxUpBorderAlpha"]) ? $Format["BoxUpBorderAlpha"] : 100;
60
+        $BoxDownR		= isset($Format["BoxDownR"]) ? $Format["BoxDownR"] : 224;
61
+        $BoxDownG		= isset($Format["BoxDownG"]) ? $Format["BoxDownG"] : 100;
62
+        $BoxDownB		= isset($Format["BoxDownB"]) ? $Format["BoxDownB"] : 46;
63
+        $BoxDownAlpha	= isset($Format["BoxDownAlpha"]) ? $Format["BoxDownAlpha"] : 100;
64
+        $BoxDownSurrounding= isset($Format["BoxDownSurrounding"]) ? $Format["BoxDownSurrounding"] : NULL;
65
+        $BoxDownBorderR	= isset($Format["BoxDownBorderR"]) ? $Format["BoxDownBorderR"] : $BoxDownR-20;
66
+        $BoxDownBorderG	= isset($Format["BoxDownBorderG"]) ? $Format["BoxDownBorderG"] : $BoxDownG-20;
67
+        $BoxDownBorderB	= isset($Format["BoxDownBorderB"]) ? $Format["BoxDownBorderB"] : $BoxDownB-20;
68
+        $BoxDownBorderAlpha= isset($Format["BoxDownBorderAlpha"]) ? $Format["BoxDownBorderAlpha"] : 100;
69
+        $ShadowOnBoxesOnly	= isset($Format["ShadowOnBoxesOnly"]) ? $Format["ShadowOnBoxesOnly"] : TRUE;
70
+        $MedianR		= isset($Format["MedianR"]) ? $Format["MedianR"] : 255;
71
+        $MedianG		= isset($Format["MedianG"]) ? $Format["MedianG"] : 0;
72
+        $MedianB		= isset($Format["MedianB"]) ? $Format["MedianB"] : 0;
73
+        $MedianAlpha	= isset($Format["MedianAlpha"]) ? $Format["MedianAlpha"] : 100;
74
+        $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
75
+        $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : "Stock Chart";
76
+
77
+
78
+        /* Data Processing */
79
+        $Data    = $this->pDataObject->getData();
80
+        $Palette = $this->pDataObject->getPalette();
81
+
82
+        if ( $BoxUpSurrounding != NULL )	{ $BoxUpBorderR = $BoxUpR + $BoxUpSurrounding; $BoxUpBorderG = $BoxUpG + $BoxUpSurrounding; $BoxUpBorderB = $BoxUpB + $BoxUpSurrounding; }
83
+        if ( $BoxDownSurrounding != NULL )	{ $BoxDownBorderR = $BoxDownR + $BoxDownSurrounding; $BoxDownBorderG = $BoxDownG + $BoxDownSurrounding; $BoxDownBorderB = $BoxDownB + $BoxDownSurrounding; }
84
+
85
+        if ( $LineWidth != 1 ) { $LineOffset = $LineWidth / 2; }
86
+        $BoxOffset = $BoxWidth / 2;
87
+
88
+        $Data = $this->pChartObject->DataSet->getData();
89
+        list($XMargin,$XDivs) = $this->pChartObject->scaleGetXSettings();
90
+
91
+        if ( !isset($Data["Series"][$SerieOpen]) || !isset($Data["Series"][$SerieClose]) || !isset($Data["Series"][$SerieMin]) || !isset($Data["Series"][$SerieMax]) )
92
+        return(STOCK_MISSING_SERIE);
93
+
94
+        $Plots = "";
95
+        foreach($Data["Series"][$SerieOpen]["Data"] as $Key => $Value)
96
+        {
97
+        $Point = "";
98
+        if ( isset($Data["Series"][$SerieClose]["Data"][$Key]) || isset($Data["Series"][$SerieMin]["Data"][$Key]) || isset($Data["Series"][$SerieMax]["Data"][$Key]) )
99 99
         $Point = array($Value,$Data["Series"][$SerieClose]["Data"][$Key],$Data["Series"][$SerieMin]["Data"][$Key],$Data["Series"][$SerieMax]["Data"][$Key]);
100
-       if ( $SerieMedian != NULL && isset($Data["Series"][$SerieMedian]["Data"][$Key]) )
100
+        if ( $SerieMedian != NULL && isset($Data["Series"][$SerieMedian]["Data"][$Key]) )
101 101
         $Point[] = $Data["Series"][$SerieMedian]["Data"][$Key];
102 102
 
103
-       $Plots[] = $Point;
104
-      }
103
+        $Plots[] = $Point;
104
+        }
105 105
 
106
-     $AxisID	= $Data["Series"][$SerieOpen]["Axis"];
107
-     $Mode	= $Data["Axis"][$AxisID]["Display"];
108
-     $Format	= $Data["Axis"][$AxisID]["Format"];
109
-     $Unit	= $Data["Axis"][$AxisID]["Unit"];
106
+        $AxisID	= $Data["Series"][$SerieOpen]["Axis"];
107
+        $Mode	= $Data["Axis"][$AxisID]["Display"];
108
+        $Format	= $Data["Axis"][$AxisID]["Format"];
109
+        $Unit	= $Data["Axis"][$AxisID]["Unit"];
110 110
 
111
-     $YZero	= $this->pChartObject->scaleComputeY(0,array("AxisID"=>$AxisID));
112
-     $XStep	= ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs;
111
+        $YZero	= $this->pChartObject->scaleComputeY(0,array("AxisID"=>$AxisID));
112
+        $XStep	= ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs;
113 113
 
114
-     $X = $this->pChartObject->GraphAreaX1 + $XMargin;
115
-     $Y = $this->pChartObject->GraphAreaY1 + $XMargin;
114
+        $X = $this->pChartObject->GraphAreaX1 + $XMargin;
115
+        $Y = $this->pChartObject->GraphAreaY1 + $XMargin;
116 116
 
117
-     $LineSettings	= array("R"=>$LineR,"G"=>$LineG,"B"=>$LineB,"Alpha"=>$LineAlpha);
118
-     $ExtremitySettings	= array("R"=>$ExtremityR,"G"=>$ExtremityG,"B"=>$ExtremityB,"Alpha"=>$ExtremityAlpha);
119
-     $BoxUpSettings	= array("R"=>$BoxUpR,"G"=>$BoxUpG,"B"=>$BoxUpB,"Alpha"=>$BoxUpAlpha,"BorderR"=>$BoxUpBorderR,"BorderG"=>$BoxUpBorderG,"BorderB"=>$BoxUpBorderB,"BorderAlpha"=>$BoxUpBorderAlpha);
120
-     $BoxDownSettings	= array("R"=>$BoxDownR,"G"=>$BoxDownG,"B"=>$BoxDownB,"Alpha"=>$BoxDownAlpha,"BorderR"=>$BoxDownBorderR,"BorderG"=>$BoxDownBorderG,"BorderB"=>$BoxDownBorderB,"BorderAlpha"=>$BoxDownBorderAlpha);
121
-     $MedianSettings	= array("R"=>$MedianR,"G"=>$MedianG,"B"=>$MedianB,"Alpha"=>$MedianAlpha);
117
+        $LineSettings	= array("R"=>$LineR,"G"=>$LineG,"B"=>$LineB,"Alpha"=>$LineAlpha);
118
+        $ExtremitySettings	= array("R"=>$ExtremityR,"G"=>$ExtremityG,"B"=>$ExtremityB,"Alpha"=>$ExtremityAlpha);
119
+        $BoxUpSettings	= array("R"=>$BoxUpR,"G"=>$BoxUpG,"B"=>$BoxUpB,"Alpha"=>$BoxUpAlpha,"BorderR"=>$BoxUpBorderR,"BorderG"=>$BoxUpBorderG,"BorderB"=>$BoxUpBorderB,"BorderAlpha"=>$BoxUpBorderAlpha);
120
+        $BoxDownSettings	= array("R"=>$BoxDownR,"G"=>$BoxDownG,"B"=>$BoxDownB,"Alpha"=>$BoxDownAlpha,"BorderR"=>$BoxDownBorderR,"BorderG"=>$BoxDownBorderG,"BorderB"=>$BoxDownBorderB,"BorderAlpha"=>$BoxDownBorderAlpha);
121
+        $MedianSettings	= array("R"=>$MedianR,"G"=>$MedianG,"B"=>$MedianB,"Alpha"=>$MedianAlpha);
122 122
 
123
-     foreach($Plots as $Key =>$Points)
124
-      {
125
-       $PosArray = $this->pChartObject->scaleComputeY($Points,array("AxisID"=>$AxisID));
123
+        foreach($Plots as $Key =>$Points)
124
+        {
125
+        $PosArray = $this->pChartObject->scaleComputeY($Points,array("AxisID"=>$AxisID));
126 126
 
127
-       $Values = "Open :".$Data["Series"][$SerieOpen]["Data"][$Key]."<BR>Close : ".$Data["Series"][$SerieClose]["Data"][$Key]."<BR>Min : ".$Data["Series"][$SerieMin]["Data"][$Key]."<BR>Max : ".$Data["Series"][$SerieMax]["Data"][$Key]."<BR>";
128
-       if ( $SerieMedian != NULL ) { $Values = $Values."Median : ".$Data["Series"][$SerieMedian]["Data"][$Key]."<BR>"; }
129
-       if ( $PosArray[0] > $PosArray[1] ) { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxUpR,$BoxUpG,$BoxUpB); } else { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxDownR,$BoxDownG,$BoxDownB); } 
127
+        $Values = "Open :".$Data["Series"][$SerieOpen]["Data"][$Key]."<BR>Close : ".$Data["Series"][$SerieClose]["Data"][$Key]."<BR>Min : ".$Data["Series"][$SerieMin]["Data"][$Key]."<BR>Max : ".$Data["Series"][$SerieMax]["Data"][$Key]."<BR>";
128
+        if ( $SerieMedian != NULL ) { $Values = $Values."Median : ".$Data["Series"][$SerieMedian]["Data"][$Key]."<BR>"; }
129
+        if ( $PosArray[0] > $PosArray[1] ) { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxUpR,$BoxUpG,$BoxUpB); } else { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxDownR,$BoxDownG,$BoxDownB); } 
130 130
 
131
-       if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
131
+        if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
132 132
         {
133
-         if ( $YZero > $this->pChartObject->GraphAreaY2-1 ) { $YZero = $this->pChartObject->GraphAreaY2-1; }
134
-         if ( $YZero < $this->pChartObject->GraphAreaY1+1 ) { $YZero = $this->pChartObject->GraphAreaY1+1; }
133
+            if ( $YZero > $this->pChartObject->GraphAreaY2-1 ) { $YZero = $this->pChartObject->GraphAreaY2-1; }
134
+            if ( $YZero < $this->pChartObject->GraphAreaY1+1 ) { $YZero = $this->pChartObject->GraphAreaY1+1; }
135 135
 
136
-         if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs; }
136
+            if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs; }
137 137
 
138
-         if ( $ShadowOnBoxesOnly ) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE; }
138
+            if ( $ShadowOnBoxesOnly ) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE; }
139 139
 
140
-         if ( $LineWidth == 1 )
141
-          $this->pChartObject->drawLine($X,$PosArray[2],$X,$PosArray[3],$LineSettings);
142
-         else
143
-          $this->pChartObject->drawFilledRectangle($X-$LineOffset,$PosArray[2],$X+$LineOffset,$PosArray[3],$LineSettings);
140
+            if ( $LineWidth == 1 )
141
+            $this->pChartObject->drawLine($X,$PosArray[2],$X,$PosArray[3],$LineSettings);
142
+            else
143
+            $this->pChartObject->drawFilledRectangle($X-$LineOffset,$PosArray[2],$X+$LineOffset,$PosArray[3],$LineSettings);
144 144
 
145
-         if ( $ExtremityWidth == 1 )
146
-          {
147
-           $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[2],$X+$ExtremityLength,$PosArray[2],$ExtremitySettings);
148
-           $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[3],$X+$ExtremityLength,$PosArray[3],$ExtremitySettings);
145
+            if ( $ExtremityWidth == 1 )
146
+            {
147
+            $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[2],$X+$ExtremityLength,$PosArray[2],$ExtremitySettings);
148
+            $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[3],$X+$ExtremityLength,$PosArray[3],$ExtremitySettings);
149 149
 
150
-           if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$ExtremityLength).",".floor($PosArray[2]).",".floor($X+$ExtremityLength).",".floor($PosArray[3]),$ImageMapColor,$ImageMapTitle,$Values); }
151
-          }
152
-         else
153
-          {
154
-           $this->pChartObject->drawFilledRectangle($X-$ExtremityLength,$PosArray[2],$X+$ExtremityLength,$PosArray[2]-$ExtremityWidth,$ExtremitySettings);
155
-           $this->pChartObject->drawFilledRectangle($X-$ExtremityLength,$PosArray[3],$X+$ExtremityLength,$PosArray[3]+$ExtremityWidth,$ExtremitySettings);
150
+            if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$ExtremityLength).",".floor($PosArray[2]).",".floor($X+$ExtremityLength).",".floor($PosArray[3]),$ImageMapColor,$ImageMapTitle,$Values); }
151
+            }
152
+            else
153
+            {
154
+            $this->pChartObject->drawFilledRectangle($X-$ExtremityLength,$PosArray[2],$X+$ExtremityLength,$PosArray[2]-$ExtremityWidth,$ExtremitySettings);
155
+            $this->pChartObject->drawFilledRectangle($X-$ExtremityLength,$PosArray[3],$X+$ExtremityLength,$PosArray[3]+$ExtremityWidth,$ExtremitySettings);
156 156
 
157
-           if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$ExtremityLength).",".floor($PosArray[2]-$ExtremityWidth).",".floor($X+$ExtremityLength).",".floor($PosArray[3]+$ExtremityWidth),$ImageMapColor,$ImageMapTitle,$Values); }
158
-          }
157
+            if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$ExtremityLength).",".floor($PosArray[2]-$ExtremityWidth).",".floor($X+$ExtremityLength).",".floor($PosArray[3]+$ExtremityWidth),$ImageMapColor,$ImageMapTitle,$Values); }
158
+            }
159 159
 
160
-         if ( $ShadowOnBoxesOnly ) { $this->pChartObject->Shadow = $RestoreShadow; }
160
+            if ( $ShadowOnBoxesOnly ) { $this->pChartObject->Shadow = $RestoreShadow; }
161 161
 
162
-         if ( $PosArray[0] > $PosArray[1] )
163
-          $this->pChartObject->drawFilledRectangle($X-$BoxOffset,$PosArray[0],$X+$BoxOffset,$PosArray[1],$BoxUpSettings);
164
-         else
165
-          $this->pChartObject->drawFilledRectangle($X-$BoxOffset,$PosArray[0],$X+$BoxOffset,$PosArray[1],$BoxDownSettings);
162
+            if ( $PosArray[0] > $PosArray[1] )
163
+            $this->pChartObject->drawFilledRectangle($X-$BoxOffset,$PosArray[0],$X+$BoxOffset,$PosArray[1],$BoxUpSettings);
164
+            else
165
+            $this->pChartObject->drawFilledRectangle($X-$BoxOffset,$PosArray[0],$X+$BoxOffset,$PosArray[1],$BoxDownSettings);
166 166
 
167
-         if ( isset($PosArray[4]) )
168
-          $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[4],$X+$ExtremityLength,$PosArray[4],$MedianSettings);
167
+            if ( isset($PosArray[4]) )
168
+            $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[4],$X+$ExtremityLength,$PosArray[4],$MedianSettings);
169 169
 
170
-         $X = $X + $XStep;
170
+            $X = $X + $XStep;
171 171
         }
172
-       elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM )
172
+        elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM )
173 173
         {
174
-         if ( $YZero > $this->pChartObject->GraphAreaX2-1 ) { $YZero = $this->pChartObject->GraphAreaX2-1; }
175
-         if ( $YZero < $this->pChartObject->GraphAreaX1+1 ) { $YZero = $this->pChartObject->GraphAreaX1+1; }
174
+            if ( $YZero > $this->pChartObject->GraphAreaX2-1 ) { $YZero = $this->pChartObject->GraphAreaX2-1; }
175
+            if ( $YZero < $this->pChartObject->GraphAreaX1+1 ) { $YZero = $this->pChartObject->GraphAreaX1+1; }
176 176
 
177
-         if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1-$XMargin*2)/$XDivs; }
177
+            if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1-$XMargin*2)/$XDivs; }
178 178
 
179
-         if ( $LineWidth == 1 )
180
-          $this->pChartObject->drawLine($PosArray[2],$Y,$PosArray[3],$Y,$LineSettings);
181
-         else
182
-          $this->pChartObject->drawFilledRectangle($PosArray[2],$Y-$LineOffset,$PosArray[3],$Y+$LineOffset,$LineSettings);
179
+            if ( $LineWidth == 1 )
180
+            $this->pChartObject->drawLine($PosArray[2],$Y,$PosArray[3],$Y,$LineSettings);
181
+            else
182
+            $this->pChartObject->drawFilledRectangle($PosArray[2],$Y-$LineOffset,$PosArray[3],$Y+$LineOffset,$LineSettings);
183 183
 
184
-         if ( $ShadowOnBoxesOnly ) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE; }
184
+            if ( $ShadowOnBoxesOnly ) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE; }
185 185
 
186
-         if ( $ExtremityWidth == 1 )
187
-          {
188
-           $this->pChartObject->drawLine($PosArray[2],$Y-$ExtremityLength,$PosArray[2],$Y+$ExtremityLength,$ExtremitySettings);
189
-           $this->pChartObject->drawLine($PosArray[3],$Y-$ExtremityLength,$PosArray[3],$Y+$ExtremityLength,$ExtremitySettings);
186
+            if ( $ExtremityWidth == 1 )
187
+            {
188
+            $this->pChartObject->drawLine($PosArray[2],$Y-$ExtremityLength,$PosArray[2],$Y+$ExtremityLength,$ExtremitySettings);
189
+            $this->pChartObject->drawLine($PosArray[3],$Y-$ExtremityLength,$PosArray[3],$Y+$ExtremityLength,$ExtremitySettings);
190 190
 
191
-           if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($PosArray[2]).",".floor($Y-$ExtremityLength).",".floor($PosArray[3]).",".floor($Y+$ExtremityLength),$ImageMapColor,$ImageMapTitle,$Values); }
192
-          }
193
-         else
194
-          {
195
-           $this->pChartObject->drawFilledRectangle($PosArray[2],$Y-$ExtremityLength,$PosArray[2]-$ExtremityWidth,$Y+$ExtremityLength,$ExtremitySettings);
196
-           $this->pChartObject->drawFilledRectangle($PosArray[3],$Y-$ExtremityLength,$PosArray[3]+$ExtremityWidth,$Y+$ExtremityLength,$ExtremitySettings);
191
+            if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($PosArray[2]).",".floor($Y-$ExtremityLength).",".floor($PosArray[3]).",".floor($Y+$ExtremityLength),$ImageMapColor,$ImageMapTitle,$Values); }
192
+            }
193
+            else
194
+            {
195
+            $this->pChartObject->drawFilledRectangle($PosArray[2],$Y-$ExtremityLength,$PosArray[2]-$ExtremityWidth,$Y+$ExtremityLength,$ExtremitySettings);
196
+            $this->pChartObject->drawFilledRectangle($PosArray[3],$Y-$ExtremityLength,$PosArray[3]+$ExtremityWidth,$Y+$ExtremityLength,$ExtremitySettings);
197 197
 
198
-           if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($PosArray[2]-$ExtremityWidth).",".floor($Y-$ExtremityLength).",".floor($PosArray[3]+$ExtremityWidth).",".floor($Y+$ExtremityLength),$ImageMapColor,$ImageMapTitle,$Values); }
199
-          }
198
+            if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($PosArray[2]-$ExtremityWidth).",".floor($Y-$ExtremityLength).",".floor($PosArray[3]+$ExtremityWidth).",".floor($Y+$ExtremityLength),$ImageMapColor,$ImageMapTitle,$Values); }
199
+            }
200 200
 
201
-         if ( $ShadowOnBoxesOnly ) { $this->pChartObject->Shadow = $RestoreShadow; }
201
+            if ( $ShadowOnBoxesOnly ) { $this->pChartObject->Shadow = $RestoreShadow; }
202 202
 
203
-         if ( $PosArray[0] < $PosArray[1] )
204
-          $this->pChartObject->drawFilledRectangle($PosArray[0],$Y-$BoxOffset,$PosArray[1],$Y+$BoxOffset,$BoxUpSettings);
205
-         else
206
-          $this->pChartObject->drawFilledRectangle($PosArray[0],$Y-$BoxOffset,$PosArray[1],$Y+$BoxOffset,$BoxDownSettings);
203
+            if ( $PosArray[0] < $PosArray[1] )
204
+            $this->pChartObject->drawFilledRectangle($PosArray[0],$Y-$BoxOffset,$PosArray[1],$Y+$BoxOffset,$BoxUpSettings);
205
+            else
206
+            $this->pChartObject->drawFilledRectangle($PosArray[0],$Y-$BoxOffset,$PosArray[1],$Y+$BoxOffset,$BoxDownSettings);
207 207
 
208
-         if ( isset($PosArray[4]) )
209
-          $this->pChartObject->drawLine($PosArray[4],$Y-$ExtremityLength,$PosArray[4],$Y+$ExtremityLength,$MedianSettings);
208
+            if ( isset($PosArray[4]) )
209
+            $this->pChartObject->drawLine($PosArray[4],$Y-$ExtremityLength,$PosArray[4],$Y+$ExtremityLength,$MedianSettings);
210 210
 
211
-         $Y = $Y + $XStep;
211
+            $Y = $Y + $XStep;
212
+        }
212 213
         }
213
-      }
214 214
     }
215
-  }
215
+    }
216 216
 ?>
217 217
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
      You can find the whole class documentation on the pChart web site.
14 14
  */
15 15
 
16
- define("STOCK_MISSING_SERIE"	, 180001);
16
+ define("STOCK_MISSING_SERIE", 180001);
17 17
 
18 18
  /* pStock class definition */
19 19
  class pStock
@@ -22,82 +22,82 @@  discard block
 block discarded – undo
22 22
    var $pDataObject;
23 23
 
24 24
    /* Class creator */
25
-   function pStock($pChartObject,$pDataObject)
25
+   function pStock($pChartObject, $pDataObject)
26 26
     {
27 27
      $this->pChartObject = $pChartObject;
28 28
      $this->pDataObject  = $pDataObject;
29 29
     }
30 30
 
31 31
    /* Draw a stock chart */
32
-   function drawStockChart($Format="")
32
+   function drawStockChart($Format = "")
33 33
     {
34 34
      $SerieOpen		= isset($Format["SerieOpen"]) ? $Format["SerieOpen"] : "Open";
35 35
      $SerieClose	= isset($Format["SerieClose"]) ? $Format["SerieClose"] : "Close";
36 36
      $SerieMin		= isset($Format["SerieMin"]) ? $Format["SerieMin"] : "Min";
37 37
      $SerieMax		= isset($Format["SerieMax"]) ? $Format["SerieMax"] : "Max";
38
-     $SerieMedian	= isset($Format["SerieMedian"]) ? $Format["SerieMedian"] : NULL;
39
-     $LineWidth		= isset($Format["LineWidth"]) ? $Format["LineWidth"] : 1;
38
+     $SerieMedian = isset($Format["SerieMedian"]) ? $Format["SerieMedian"] : NULL;
39
+     $LineWidth = isset($Format["LineWidth"]) ? $Format["LineWidth"] : 1;
40 40
      $LineR		= isset($Format["LineR"]) ? $Format["LineR"] : 0;
41 41
      $LineG		= isset($Format["LineG"]) ? $Format["LineG"] : 0;
42 42
      $LineB		= isset($Format["LineB"]) ? $Format["LineB"] : 0;
43 43
      $LineAlpha		= isset($Format["LineAlpha"]) ? $Format["LineAlpha"] : 100;
44
-     $ExtremityWidth	= isset($Format["ExtremityWidth"]) ? $Format["ExtremityWidth"] : 1;
45
-     $ExtremityLength	= isset($Format["ExtremityLength"]) ? $Format["ExtremityLength"] : 3;
44
+     $ExtremityWidth = isset($Format["ExtremityWidth"]) ? $Format["ExtremityWidth"] : 1;
45
+     $ExtremityLength = isset($Format["ExtremityLength"]) ? $Format["ExtremityLength"] : 3;
46 46
      $ExtremityR	= isset($Format["ExtremityR"]) ? $Format["ExtremityR"] : 0;
47 47
      $ExtremityG	= isset($Format["ExtremityG"]) ? $Format["ExtremityG"] : 0;
48 48
      $ExtremityB	= isset($Format["ExtremityB"]) ? $Format["ExtremityB"] : 0;
49
-     $ExtremityAlpha	= isset($Format["ExtremityAlpha"]) ? $Format["ExtremityAlpha"] : 100;
50
-     $BoxWidth		= isset($Format["BoxWidth"]) ? $Format["BoxWidth"] : 8;
49
+     $ExtremityAlpha = isset($Format["ExtremityAlpha"]) ? $Format["ExtremityAlpha"] : 100;
50
+     $BoxWidth = isset($Format["BoxWidth"]) ? $Format["BoxWidth"] : 8;
51 51
      $BoxUpR		= isset($Format["BoxUpR"]) ? $Format["BoxUpR"] : 188;
52 52
      $BoxUpG		= isset($Format["BoxUpG"]) ? $Format["BoxUpG"] : 224;
53 53
      $BoxUpB		= isset($Format["BoxUpB"]) ? $Format["BoxUpB"] : 46;
54
-     $BoxUpAlpha	= isset($Format["BoxUpAlpha"]) ? $Format["BoxUpAlpha"] : 100;
55
-     $BoxUpSurrounding	= isset($Format["BoxUpSurrounding"]) ? $Format["BoxUpSurrounding"] : NULL;
56
-     $BoxUpBorderR	= isset($Format["BoxUpBorderR"]) ? $Format["BoxUpBorderR"] : $BoxUpR-20;
57
-     $BoxUpBorderG	= isset($Format["BoxUpBorderG"]) ? $Format["BoxUpBorderG"] : $BoxUpG-20;
58
-     $BoxUpBorderB	= isset($Format["BoxUpBorderB"]) ? $Format["BoxUpBorderB"] : $BoxUpB-20;
59
-     $BoxUpBorderAlpha	= isset($Format["BoxUpBorderAlpha"]) ? $Format["BoxUpBorderAlpha"] : 100;
54
+     $BoxUpAlpha = isset($Format["BoxUpAlpha"]) ? $Format["BoxUpAlpha"] : 100;
55
+     $BoxUpSurrounding = isset($Format["BoxUpSurrounding"]) ? $Format["BoxUpSurrounding"] : NULL;
56
+     $BoxUpBorderR	= isset($Format["BoxUpBorderR"]) ? $Format["BoxUpBorderR"] : $BoxUpR - 20;
57
+     $BoxUpBorderG	= isset($Format["BoxUpBorderG"]) ? $Format["BoxUpBorderG"] : $BoxUpG - 20;
58
+     $BoxUpBorderB	= isset($Format["BoxUpBorderB"]) ? $Format["BoxUpBorderB"] : $BoxUpB - 20;
59
+     $BoxUpBorderAlpha = isset($Format["BoxUpBorderAlpha"]) ? $Format["BoxUpBorderAlpha"] : 100;
60 60
      $BoxDownR		= isset($Format["BoxDownR"]) ? $Format["BoxDownR"] : 224;
61 61
      $BoxDownG		= isset($Format["BoxDownG"]) ? $Format["BoxDownG"] : 100;
62 62
      $BoxDownB		= isset($Format["BoxDownB"]) ? $Format["BoxDownB"] : 46;
63
-     $BoxDownAlpha	= isset($Format["BoxDownAlpha"]) ? $Format["BoxDownAlpha"] : 100;
64
-     $BoxDownSurrounding= isset($Format["BoxDownSurrounding"]) ? $Format["BoxDownSurrounding"] : NULL;
65
-     $BoxDownBorderR	= isset($Format["BoxDownBorderR"]) ? $Format["BoxDownBorderR"] : $BoxDownR-20;
66
-     $BoxDownBorderG	= isset($Format["BoxDownBorderG"]) ? $Format["BoxDownBorderG"] : $BoxDownG-20;
67
-     $BoxDownBorderB	= isset($Format["BoxDownBorderB"]) ? $Format["BoxDownBorderB"] : $BoxDownB-20;
68
-     $BoxDownBorderAlpha= isset($Format["BoxDownBorderAlpha"]) ? $Format["BoxDownBorderAlpha"] : 100;
63
+     $BoxDownAlpha = isset($Format["BoxDownAlpha"]) ? $Format["BoxDownAlpha"] : 100;
64
+     $BoxDownSurrounding = isset($Format["BoxDownSurrounding"]) ? $Format["BoxDownSurrounding"] : NULL;
65
+     $BoxDownBorderR	= isset($Format["BoxDownBorderR"]) ? $Format["BoxDownBorderR"] : $BoxDownR - 20;
66
+     $BoxDownBorderG	= isset($Format["BoxDownBorderG"]) ? $Format["BoxDownBorderG"] : $BoxDownG - 20;
67
+     $BoxDownBorderB	= isset($Format["BoxDownBorderB"]) ? $Format["BoxDownBorderB"] : $BoxDownB - 20;
68
+     $BoxDownBorderAlpha = isset($Format["BoxDownBorderAlpha"]) ? $Format["BoxDownBorderAlpha"] : 100;
69 69
      $ShadowOnBoxesOnly	= isset($Format["ShadowOnBoxesOnly"]) ? $Format["ShadowOnBoxesOnly"] : TRUE;
70 70
      $MedianR		= isset($Format["MedianR"]) ? $Format["MedianR"] : 255;
71 71
      $MedianG		= isset($Format["MedianG"]) ? $Format["MedianG"] : 0;
72 72
      $MedianB		= isset($Format["MedianB"]) ? $Format["MedianB"] : 0;
73
-     $MedianAlpha	= isset($Format["MedianAlpha"]) ? $Format["MedianAlpha"] : 100;
74
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
75
-     $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : "Stock Chart";
73
+     $MedianAlpha = isset($Format["MedianAlpha"]) ? $Format["MedianAlpha"] : 100;
74
+     $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
75
+     $ImageMapTitle = isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : "Stock Chart";
76 76
 
77 77
 
78 78
      /* Data Processing */
79 79
      $Data    = $this->pDataObject->getData();
80 80
      $Palette = $this->pDataObject->getPalette();
81 81
 
82
-     if ( $BoxUpSurrounding != NULL )	{ $BoxUpBorderR = $BoxUpR + $BoxUpSurrounding; $BoxUpBorderG = $BoxUpG + $BoxUpSurrounding; $BoxUpBorderB = $BoxUpB + $BoxUpSurrounding; }
83
-     if ( $BoxDownSurrounding != NULL )	{ $BoxDownBorderR = $BoxDownR + $BoxDownSurrounding; $BoxDownBorderG = $BoxDownG + $BoxDownSurrounding; $BoxDownBorderB = $BoxDownB + $BoxDownSurrounding; }
82
+     if ($BoxUpSurrounding != NULL) { $BoxUpBorderR = $BoxUpR + $BoxUpSurrounding; $BoxUpBorderG = $BoxUpG + $BoxUpSurrounding; $BoxUpBorderB = $BoxUpB + $BoxUpSurrounding; }
83
+     if ($BoxDownSurrounding != NULL) { $BoxDownBorderR = $BoxDownR + $BoxDownSurrounding; $BoxDownBorderG = $BoxDownG + $BoxDownSurrounding; $BoxDownBorderB = $BoxDownB + $BoxDownSurrounding; }
84 84
 
85
-     if ( $LineWidth != 1 ) { $LineOffset = $LineWidth / 2; }
86
-     $BoxOffset = $BoxWidth / 2;
85
+     if ($LineWidth != 1) { $LineOffset = $LineWidth/2; }
86
+     $BoxOffset = $BoxWidth/2;
87 87
 
88 88
      $Data = $this->pChartObject->DataSet->getData();
89
-     list($XMargin,$XDivs) = $this->pChartObject->scaleGetXSettings();
89
+     list($XMargin, $XDivs) = $this->pChartObject->scaleGetXSettings();
90 90
 
91
-     if ( !isset($Data["Series"][$SerieOpen]) || !isset($Data["Series"][$SerieClose]) || !isset($Data["Series"][$SerieMin]) || !isset($Data["Series"][$SerieMax]) )
91
+     if (!isset($Data["Series"][$SerieOpen]) || !isset($Data["Series"][$SerieClose]) || !isset($Data["Series"][$SerieMin]) || !isset($Data["Series"][$SerieMax]))
92 92
       return(STOCK_MISSING_SERIE);
93 93
 
94 94
      $Plots = "";
95
-     foreach($Data["Series"][$SerieOpen]["Data"] as $Key => $Value)
95
+     foreach ($Data["Series"][$SerieOpen]["Data"] as $Key => $Value)
96 96
       {
97 97
        $Point = "";
98
-       if ( isset($Data["Series"][$SerieClose]["Data"][$Key]) || isset($Data["Series"][$SerieMin]["Data"][$Key]) || isset($Data["Series"][$SerieMax]["Data"][$Key]) )
99
-        $Point = array($Value,$Data["Series"][$SerieClose]["Data"][$Key],$Data["Series"][$SerieMin]["Data"][$Key],$Data["Series"][$SerieMax]["Data"][$Key]);
100
-       if ( $SerieMedian != NULL && isset($Data["Series"][$SerieMedian]["Data"][$Key]) )
98
+       if (isset($Data["Series"][$SerieClose]["Data"][$Key]) || isset($Data["Series"][$SerieMin]["Data"][$Key]) || isset($Data["Series"][$SerieMax]["Data"][$Key]))
99
+        $Point = array($Value, $Data["Series"][$SerieClose]["Data"][$Key], $Data["Series"][$SerieMin]["Data"][$Key], $Data["Series"][$SerieMax]["Data"][$Key]);
100
+       if ($SerieMedian != NULL && isset($Data["Series"][$SerieMedian]["Data"][$Key]))
101 101
         $Point[] = $Data["Series"][$SerieMedian]["Data"][$Key];
102 102
 
103 103
        $Plots[] = $Point;
@@ -108,105 +108,105 @@  discard block
 block discarded – undo
108 108
      $Format	= $Data["Axis"][$AxisID]["Format"];
109 109
      $Unit	= $Data["Axis"][$AxisID]["Unit"];
110 110
 
111
-     $YZero	= $this->pChartObject->scaleComputeY(0,array("AxisID"=>$AxisID));
112
-     $XStep	= ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs;
111
+     $YZero	= $this->pChartObject->scaleComputeY(0, array("AxisID"=>$AxisID));
112
+     $XStep	= ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1 - $XMargin*2)/$XDivs;
113 113
 
114 114
      $X = $this->pChartObject->GraphAreaX1 + $XMargin;
115 115
      $Y = $this->pChartObject->GraphAreaY1 + $XMargin;
116 116
 
117
-     $LineSettings	= array("R"=>$LineR,"G"=>$LineG,"B"=>$LineB,"Alpha"=>$LineAlpha);
118
-     $ExtremitySettings	= array("R"=>$ExtremityR,"G"=>$ExtremityG,"B"=>$ExtremityB,"Alpha"=>$ExtremityAlpha);
119
-     $BoxUpSettings	= array("R"=>$BoxUpR,"G"=>$BoxUpG,"B"=>$BoxUpB,"Alpha"=>$BoxUpAlpha,"BorderR"=>$BoxUpBorderR,"BorderG"=>$BoxUpBorderG,"BorderB"=>$BoxUpBorderB,"BorderAlpha"=>$BoxUpBorderAlpha);
120
-     $BoxDownSettings	= array("R"=>$BoxDownR,"G"=>$BoxDownG,"B"=>$BoxDownB,"Alpha"=>$BoxDownAlpha,"BorderR"=>$BoxDownBorderR,"BorderG"=>$BoxDownBorderG,"BorderB"=>$BoxDownBorderB,"BorderAlpha"=>$BoxDownBorderAlpha);
121
-     $MedianSettings	= array("R"=>$MedianR,"G"=>$MedianG,"B"=>$MedianB,"Alpha"=>$MedianAlpha);
117
+     $LineSettings = array("R"=>$LineR, "G"=>$LineG, "B"=>$LineB, "Alpha"=>$LineAlpha);
118
+     $ExtremitySettings = array("R"=>$ExtremityR, "G"=>$ExtremityG, "B"=>$ExtremityB, "Alpha"=>$ExtremityAlpha);
119
+     $BoxUpSettings = array("R"=>$BoxUpR, "G"=>$BoxUpG, "B"=>$BoxUpB, "Alpha"=>$BoxUpAlpha, "BorderR"=>$BoxUpBorderR, "BorderG"=>$BoxUpBorderG, "BorderB"=>$BoxUpBorderB, "BorderAlpha"=>$BoxUpBorderAlpha);
120
+     $BoxDownSettings = array("R"=>$BoxDownR, "G"=>$BoxDownG, "B"=>$BoxDownB, "Alpha"=>$BoxDownAlpha, "BorderR"=>$BoxDownBorderR, "BorderG"=>$BoxDownBorderG, "BorderB"=>$BoxDownBorderB, "BorderAlpha"=>$BoxDownBorderAlpha);
121
+     $MedianSettings = array("R"=>$MedianR, "G"=>$MedianG, "B"=>$MedianB, "Alpha"=>$MedianAlpha);
122 122
 
123
-     foreach($Plots as $Key =>$Points)
123
+     foreach ($Plots as $Key =>$Points)
124 124
       {
125
-       $PosArray = $this->pChartObject->scaleComputeY($Points,array("AxisID"=>$AxisID));
125
+       $PosArray = $this->pChartObject->scaleComputeY($Points, array("AxisID"=>$AxisID));
126 126
 
127 127
        $Values = "Open :".$Data["Series"][$SerieOpen]["Data"][$Key]."<BR>Close : ".$Data["Series"][$SerieClose]["Data"][$Key]."<BR>Min : ".$Data["Series"][$SerieMin]["Data"][$Key]."<BR>Max : ".$Data["Series"][$SerieMax]["Data"][$Key]."<BR>";
128
-       if ( $SerieMedian != NULL ) { $Values = $Values."Median : ".$Data["Series"][$SerieMedian]["Data"][$Key]."<BR>"; }
129
-       if ( $PosArray[0] > $PosArray[1] ) { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxUpR,$BoxUpG,$BoxUpB); } else { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxDownR,$BoxDownG,$BoxDownB); } 
128
+       if ($SerieMedian != NULL) { $Values = $Values."Median : ".$Data["Series"][$SerieMedian]["Data"][$Key]."<BR>"; }
129
+       if ($PosArray[0] > $PosArray[1]) { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxUpR, $BoxUpG, $BoxUpB); } else { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxDownR, $BoxDownG, $BoxDownB); } 
130 130
 
131
-       if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
131
+       if ($Data["Orientation"] == SCALE_POS_LEFTRIGHT)
132 132
         {
133
-         if ( $YZero > $this->pChartObject->GraphAreaY2-1 ) { $YZero = $this->pChartObject->GraphAreaY2-1; }
134
-         if ( $YZero < $this->pChartObject->GraphAreaY1+1 ) { $YZero = $this->pChartObject->GraphAreaY1+1; }
133
+         if ($YZero > $this->pChartObject->GraphAreaY2 - 1) { $YZero = $this->pChartObject->GraphAreaY2 - 1; }
134
+         if ($YZero < $this->pChartObject->GraphAreaY1 + 1) { $YZero = $this->pChartObject->GraphAreaY1 + 1; }
135 135
 
136
-         if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs; }
136
+         if ($XDivs == 0) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1 - $XMargin*2)/$XDivs; }
137 137
 
138
-         if ( $ShadowOnBoxesOnly ) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE; }
138
+         if ($ShadowOnBoxesOnly) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE; }
139 139
 
140
-         if ( $LineWidth == 1 )
141
-          $this->pChartObject->drawLine($X,$PosArray[2],$X,$PosArray[3],$LineSettings);
140
+         if ($LineWidth == 1)
141
+          $this->pChartObject->drawLine($X, $PosArray[2], $X, $PosArray[3], $LineSettings);
142 142
          else
143
-          $this->pChartObject->drawFilledRectangle($X-$LineOffset,$PosArray[2],$X+$LineOffset,$PosArray[3],$LineSettings);
143
+          $this->pChartObject->drawFilledRectangle($X - $LineOffset, $PosArray[2], $X + $LineOffset, $PosArray[3], $LineSettings);
144 144
 
145
-         if ( $ExtremityWidth == 1 )
145
+         if ($ExtremityWidth == 1)
146 146
           {
147
-           $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[2],$X+$ExtremityLength,$PosArray[2],$ExtremitySettings);
148
-           $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[3],$X+$ExtremityLength,$PosArray[3],$ExtremitySettings);
147
+           $this->pChartObject->drawLine($X - $ExtremityLength, $PosArray[2], $X + $ExtremityLength, $PosArray[2], $ExtremitySettings);
148
+           $this->pChartObject->drawLine($X - $ExtremityLength, $PosArray[3], $X + $ExtremityLength, $PosArray[3], $ExtremitySettings);
149 149
 
150
-           if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$ExtremityLength).",".floor($PosArray[2]).",".floor($X+$ExtremityLength).",".floor($PosArray[3]),$ImageMapColor,$ImageMapTitle,$Values); }
150
+           if ($RecordImageMap) { $this->pChartObject->addToImageMap("RECT", floor($X - $ExtremityLength).",".floor($PosArray[2]).",".floor($X + $ExtremityLength).",".floor($PosArray[3]), $ImageMapColor, $ImageMapTitle, $Values); }
151 151
           }
152 152
          else
153 153
           {
154
-           $this->pChartObject->drawFilledRectangle($X-$ExtremityLength,$PosArray[2],$X+$ExtremityLength,$PosArray[2]-$ExtremityWidth,$ExtremitySettings);
155
-           $this->pChartObject->drawFilledRectangle($X-$ExtremityLength,$PosArray[3],$X+$ExtremityLength,$PosArray[3]+$ExtremityWidth,$ExtremitySettings);
154
+           $this->pChartObject->drawFilledRectangle($X - $ExtremityLength, $PosArray[2], $X + $ExtremityLength, $PosArray[2] - $ExtremityWidth, $ExtremitySettings);
155
+           $this->pChartObject->drawFilledRectangle($X - $ExtremityLength, $PosArray[3], $X + $ExtremityLength, $PosArray[3] + $ExtremityWidth, $ExtremitySettings);
156 156
 
157
-           if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$ExtremityLength).",".floor($PosArray[2]-$ExtremityWidth).",".floor($X+$ExtremityLength).",".floor($PosArray[3]+$ExtremityWidth),$ImageMapColor,$ImageMapTitle,$Values); }
157
+           if ($RecordImageMap) { $this->pChartObject->addToImageMap("RECT", floor($X - $ExtremityLength).",".floor($PosArray[2] - $ExtremityWidth).",".floor($X + $ExtremityLength).",".floor($PosArray[3] + $ExtremityWidth), $ImageMapColor, $ImageMapTitle, $Values); }
158 158
           }
159 159
 
160
-         if ( $ShadowOnBoxesOnly ) { $this->pChartObject->Shadow = $RestoreShadow; }
160
+         if ($ShadowOnBoxesOnly) { $this->pChartObject->Shadow = $RestoreShadow; }
161 161
 
162
-         if ( $PosArray[0] > $PosArray[1] )
163
-          $this->pChartObject->drawFilledRectangle($X-$BoxOffset,$PosArray[0],$X+$BoxOffset,$PosArray[1],$BoxUpSettings);
162
+         if ($PosArray[0] > $PosArray[1])
163
+          $this->pChartObject->drawFilledRectangle($X - $BoxOffset, $PosArray[0], $X + $BoxOffset, $PosArray[1], $BoxUpSettings);
164 164
          else
165
-          $this->pChartObject->drawFilledRectangle($X-$BoxOffset,$PosArray[0],$X+$BoxOffset,$PosArray[1],$BoxDownSettings);
165
+          $this->pChartObject->drawFilledRectangle($X - $BoxOffset, $PosArray[0], $X + $BoxOffset, $PosArray[1], $BoxDownSettings);
166 166
 
167
-         if ( isset($PosArray[4]) )
168
-          $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[4],$X+$ExtremityLength,$PosArray[4],$MedianSettings);
167
+         if (isset($PosArray[4]))
168
+          $this->pChartObject->drawLine($X - $ExtremityLength, $PosArray[4], $X + $ExtremityLength, $PosArray[4], $MedianSettings);
169 169
 
170 170
          $X = $X + $XStep;
171 171
         }
172
-       elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM )
172
+       elseif ($Data["Orientation"] == SCALE_POS_TOPBOTTOM)
173 173
         {
174
-         if ( $YZero > $this->pChartObject->GraphAreaX2-1 ) { $YZero = $this->pChartObject->GraphAreaX2-1; }
175
-         if ( $YZero < $this->pChartObject->GraphAreaX1+1 ) { $YZero = $this->pChartObject->GraphAreaX1+1; }
174
+         if ($YZero > $this->pChartObject->GraphAreaX2 - 1) { $YZero = $this->pChartObject->GraphAreaX2 - 1; }
175
+         if ($YZero < $this->pChartObject->GraphAreaX1 + 1) { $YZero = $this->pChartObject->GraphAreaX1 + 1; }
176 176
 
177
-         if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1-$XMargin*2)/$XDivs; }
177
+         if ($XDivs == 0) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1 - $XMargin*2)/$XDivs; }
178 178
 
179
-         if ( $LineWidth == 1 )
180
-          $this->pChartObject->drawLine($PosArray[2],$Y,$PosArray[3],$Y,$LineSettings);
179
+         if ($LineWidth == 1)
180
+          $this->pChartObject->drawLine($PosArray[2], $Y, $PosArray[3], $Y, $LineSettings);
181 181
          else
182
-          $this->pChartObject->drawFilledRectangle($PosArray[2],$Y-$LineOffset,$PosArray[3],$Y+$LineOffset,$LineSettings);
182
+          $this->pChartObject->drawFilledRectangle($PosArray[2], $Y - $LineOffset, $PosArray[3], $Y + $LineOffset, $LineSettings);
183 183
 
184
-         if ( $ShadowOnBoxesOnly ) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE; }
184
+         if ($ShadowOnBoxesOnly) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE; }
185 185
 
186
-         if ( $ExtremityWidth == 1 )
186
+         if ($ExtremityWidth == 1)
187 187
           {
188
-           $this->pChartObject->drawLine($PosArray[2],$Y-$ExtremityLength,$PosArray[2],$Y+$ExtremityLength,$ExtremitySettings);
189
-           $this->pChartObject->drawLine($PosArray[3],$Y-$ExtremityLength,$PosArray[3],$Y+$ExtremityLength,$ExtremitySettings);
188
+           $this->pChartObject->drawLine($PosArray[2], $Y - $ExtremityLength, $PosArray[2], $Y + $ExtremityLength, $ExtremitySettings);
189
+           $this->pChartObject->drawLine($PosArray[3], $Y - $ExtremityLength, $PosArray[3], $Y + $ExtremityLength, $ExtremitySettings);
190 190
 
191
-           if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($PosArray[2]).",".floor($Y-$ExtremityLength).",".floor($PosArray[3]).",".floor($Y+$ExtremityLength),$ImageMapColor,$ImageMapTitle,$Values); }
191
+           if ($RecordImageMap) { $this->pChartObject->addToImageMap("RECT", floor($PosArray[2]).",".floor($Y - $ExtremityLength).",".floor($PosArray[3]).",".floor($Y + $ExtremityLength), $ImageMapColor, $ImageMapTitle, $Values); }
192 192
           }
193 193
          else
194 194
           {
195
-           $this->pChartObject->drawFilledRectangle($PosArray[2],$Y-$ExtremityLength,$PosArray[2]-$ExtremityWidth,$Y+$ExtremityLength,$ExtremitySettings);
196
-           $this->pChartObject->drawFilledRectangle($PosArray[3],$Y-$ExtremityLength,$PosArray[3]+$ExtremityWidth,$Y+$ExtremityLength,$ExtremitySettings);
195
+           $this->pChartObject->drawFilledRectangle($PosArray[2], $Y - $ExtremityLength, $PosArray[2] - $ExtremityWidth, $Y + $ExtremityLength, $ExtremitySettings);
196
+           $this->pChartObject->drawFilledRectangle($PosArray[3], $Y - $ExtremityLength, $PosArray[3] + $ExtremityWidth, $Y + $ExtremityLength, $ExtremitySettings);
197 197
 
198
-           if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($PosArray[2]-$ExtremityWidth).",".floor($Y-$ExtremityLength).",".floor($PosArray[3]+$ExtremityWidth).",".floor($Y+$ExtremityLength),$ImageMapColor,$ImageMapTitle,$Values); }
198
+           if ($RecordImageMap) { $this->pChartObject->addToImageMap("RECT", floor($PosArray[2] - $ExtremityWidth).",".floor($Y - $ExtremityLength).",".floor($PosArray[3] + $ExtremityWidth).",".floor($Y + $ExtremityLength), $ImageMapColor, $ImageMapTitle, $Values); }
199 199
           }
200 200
 
201
-         if ( $ShadowOnBoxesOnly ) { $this->pChartObject->Shadow = $RestoreShadow; }
201
+         if ($ShadowOnBoxesOnly) { $this->pChartObject->Shadow = $RestoreShadow; }
202 202
 
203
-         if ( $PosArray[0] < $PosArray[1] )
204
-          $this->pChartObject->drawFilledRectangle($PosArray[0],$Y-$BoxOffset,$PosArray[1],$Y+$BoxOffset,$BoxUpSettings);
203
+         if ($PosArray[0] < $PosArray[1])
204
+          $this->pChartObject->drawFilledRectangle($PosArray[0], $Y - $BoxOffset, $PosArray[1], $Y + $BoxOffset, $BoxUpSettings);
205 205
          else
206
-          $this->pChartObject->drawFilledRectangle($PosArray[0],$Y-$BoxOffset,$PosArray[1],$Y+$BoxOffset,$BoxDownSettings);
206
+          $this->pChartObject->drawFilledRectangle($PosArray[0], $Y - $BoxOffset, $PosArray[1], $Y + $BoxOffset, $BoxDownSettings);
207 207
 
208
-         if ( isset($PosArray[4]) )
209
-          $this->pChartObject->drawLine($PosArray[4],$Y-$ExtremityLength,$PosArray[4],$Y+$ExtremityLength,$MedianSettings);
208
+         if (isset($PosArray[4]))
209
+          $this->pChartObject->drawLine($PosArray[4], $Y - $ExtremityLength, $PosArray[4], $Y + $ExtremityLength, $MedianSettings);
210 210
 
211 211
          $Y = $Y + $XStep;
212 212
         }
Please login to merge, or discard this patch.
Braces   +11 added lines, -25 removed lines patch added patch discarded remove patch
@@ -16,21 +16,18 @@  discard block
 block discarded – undo
16 16
  define("STOCK_MISSING_SERIE"	, 180001);
17 17
 
18 18
  /* pStock class definition */
19
- class pStock
20
-  {
19
+ class pStock {
21 20
    var $pChartObject;
22 21
    var $pDataObject;
23 22
 
24 23
    /* Class creator */
25
-   function pStock($pChartObject,$pDataObject)
26
-    {
24
+   function pStock($pChartObject,$pDataObject) {
27 25
      $this->pChartObject = $pChartObject;
28 26
      $this->pDataObject  = $pDataObject;
29 27
     }
30 28
 
31 29
    /* Draw a stock chart */
32
-   function drawStockChart($Format="")
33
-    {
30
+   function drawStockChart($Format="") {
34 31
      $SerieOpen		= isset($Format["SerieOpen"]) ? $Format["SerieOpen"] : "Open";
35 32
      $SerieClose	= isset($Format["SerieClose"]) ? $Format["SerieClose"] : "Close";
36 33
      $SerieMin		= isset($Format["SerieMin"]) ? $Format["SerieMin"] : "Min";
@@ -92,8 +89,7 @@  discard block
 block discarded – undo
92 89
       return(STOCK_MISSING_SERIE);
93 90
 
94 91
      $Plots = "";
95
-     foreach($Data["Series"][$SerieOpen]["Data"] as $Key => $Value)
96
-      {
92
+     foreach($Data["Series"][$SerieOpen]["Data"] as $Key => $Value) {
97 93
        $Point = "";
98 94
        if ( isset($Data["Series"][$SerieClose]["Data"][$Key]) || isset($Data["Series"][$SerieMin]["Data"][$Key]) || isset($Data["Series"][$SerieMax]["Data"][$Key]) )
99 95
         $Point = array($Value,$Data["Series"][$SerieClose]["Data"][$Key],$Data["Series"][$SerieMin]["Data"][$Key],$Data["Series"][$SerieMax]["Data"][$Key]);
@@ -120,16 +116,14 @@  discard block
 block discarded – undo
120 116
      $BoxDownSettings	= array("R"=>$BoxDownR,"G"=>$BoxDownG,"B"=>$BoxDownB,"Alpha"=>$BoxDownAlpha,"BorderR"=>$BoxDownBorderR,"BorderG"=>$BoxDownBorderG,"BorderB"=>$BoxDownBorderB,"BorderAlpha"=>$BoxDownBorderAlpha);
121 117
      $MedianSettings	= array("R"=>$MedianR,"G"=>$MedianG,"B"=>$MedianB,"Alpha"=>$MedianAlpha);
122 118
 
123
-     foreach($Plots as $Key =>$Points)
124
-      {
119
+     foreach($Plots as $Key =>$Points) {
125 120
        $PosArray = $this->pChartObject->scaleComputeY($Points,array("AxisID"=>$AxisID));
126 121
 
127 122
        $Values = "Open :".$Data["Series"][$SerieOpen]["Data"][$Key]."<BR>Close : ".$Data["Series"][$SerieClose]["Data"][$Key]."<BR>Min : ".$Data["Series"][$SerieMin]["Data"][$Key]."<BR>Max : ".$Data["Series"][$SerieMax]["Data"][$Key]."<BR>";
128 123
        if ( $SerieMedian != NULL ) { $Values = $Values."Median : ".$Data["Series"][$SerieMedian]["Data"][$Key]."<BR>"; }
129 124
        if ( $PosArray[0] > $PosArray[1] ) { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxUpR,$BoxUpG,$BoxUpB); } else { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxDownR,$BoxDownG,$BoxDownB); } 
130 125
 
131
-       if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
132
-        {
126
+       if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
133 127
          if ( $YZero > $this->pChartObject->GraphAreaY2-1 ) { $YZero = $this->pChartObject->GraphAreaY2-1; }
134 128
          if ( $YZero < $this->pChartObject->GraphAreaY1+1 ) { $YZero = $this->pChartObject->GraphAreaY1+1; }
135 129
 
@@ -142,15 +136,12 @@  discard block
 block discarded – undo
142 136
          else
143 137
           $this->pChartObject->drawFilledRectangle($X-$LineOffset,$PosArray[2],$X+$LineOffset,$PosArray[3],$LineSettings);
144 138
 
145
-         if ( $ExtremityWidth == 1 )
146
-          {
139
+         if ( $ExtremityWidth == 1 ) {
147 140
            $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[2],$X+$ExtremityLength,$PosArray[2],$ExtremitySettings);
148 141
            $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[3],$X+$ExtremityLength,$PosArray[3],$ExtremitySettings);
149 142
 
150 143
            if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$ExtremityLength).",".floor($PosArray[2]).",".floor($X+$ExtremityLength).",".floor($PosArray[3]),$ImageMapColor,$ImageMapTitle,$Values); }
151
-          }
152
-         else
153
-          {
144
+          } else {
154 145
            $this->pChartObject->drawFilledRectangle($X-$ExtremityLength,$PosArray[2],$X+$ExtremityLength,$PosArray[2]-$ExtremityWidth,$ExtremitySettings);
155 146
            $this->pChartObject->drawFilledRectangle($X-$ExtremityLength,$PosArray[3],$X+$ExtremityLength,$PosArray[3]+$ExtremityWidth,$ExtremitySettings);
156 147
 
@@ -168,9 +159,7 @@  discard block
 block discarded – undo
168 159
           $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[4],$X+$ExtremityLength,$PosArray[4],$MedianSettings);
169 160
 
170 161
          $X = $X + $XStep;
171
-        }
172
-       elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM )
173
-        {
162
+        } elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM ) {
174 163
          if ( $YZero > $this->pChartObject->GraphAreaX2-1 ) { $YZero = $this->pChartObject->GraphAreaX2-1; }
175 164
          if ( $YZero < $this->pChartObject->GraphAreaX1+1 ) { $YZero = $this->pChartObject->GraphAreaX1+1; }
176 165
 
@@ -183,15 +172,12 @@  discard block
 block discarded – undo
183 172
 
184 173
          if ( $ShadowOnBoxesOnly ) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE; }
185 174
 
186
-         if ( $ExtremityWidth == 1 )
187
-          {
175
+         if ( $ExtremityWidth == 1 ) {
188 176
            $this->pChartObject->drawLine($PosArray[2],$Y-$ExtremityLength,$PosArray[2],$Y+$ExtremityLength,$ExtremitySettings);
189 177
            $this->pChartObject->drawLine($PosArray[3],$Y-$ExtremityLength,$PosArray[3],$Y+$ExtremityLength,$ExtremitySettings);
190 178
 
191 179
            if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($PosArray[2]).",".floor($Y-$ExtremityLength).",".floor($PosArray[3]).",".floor($Y+$ExtremityLength),$ImageMapColor,$ImageMapTitle,$Values); }
192
-          }
193
-         else
194
-          {
180
+          } else {
195 181
            $this->pChartObject->drawFilledRectangle($PosArray[2],$Y-$ExtremityLength,$PosArray[2]-$ExtremityWidth,$Y+$ExtremityLength,$ExtremitySettings);
196 182
            $this->pChartObject->drawFilledRectangle($PosArray[3],$Y-$ExtremityLength,$PosArray[3]+$ExtremityWidth,$Y+$ExtremityLength,$ExtremitySettings);
197 183
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      $SerieClose	= isset($Format["SerieClose"]) ? $Format["SerieClose"] : "Close";
36 36
      $SerieMin		= isset($Format["SerieMin"]) ? $Format["SerieMin"] : "Min";
37 37
      $SerieMax		= isset($Format["SerieMax"]) ? $Format["SerieMax"] : "Max";
38
-     $SerieMedian	= isset($Format["SerieMedian"]) ? $Format["SerieMedian"] : NULL;
38
+     $SerieMedian	= isset($Format["SerieMedian"]) ? $Format["SerieMedian"] : null;
39 39
      $LineWidth		= isset($Format["LineWidth"]) ? $Format["LineWidth"] : 1;
40 40
      $LineR		= isset($Format["LineR"]) ? $Format["LineR"] : 0;
41 41
      $LineG		= isset($Format["LineG"]) ? $Format["LineG"] : 0;
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      $BoxUpG		= isset($Format["BoxUpG"]) ? $Format["BoxUpG"] : 224;
53 53
      $BoxUpB		= isset($Format["BoxUpB"]) ? $Format["BoxUpB"] : 46;
54 54
      $BoxUpAlpha	= isset($Format["BoxUpAlpha"]) ? $Format["BoxUpAlpha"] : 100;
55
-     $BoxUpSurrounding	= isset($Format["BoxUpSurrounding"]) ? $Format["BoxUpSurrounding"] : NULL;
55
+     $BoxUpSurrounding	= isset($Format["BoxUpSurrounding"]) ? $Format["BoxUpSurrounding"] : null;
56 56
      $BoxUpBorderR	= isset($Format["BoxUpBorderR"]) ? $Format["BoxUpBorderR"] : $BoxUpR-20;
57 57
      $BoxUpBorderG	= isset($Format["BoxUpBorderG"]) ? $Format["BoxUpBorderG"] : $BoxUpG-20;
58 58
      $BoxUpBorderB	= isset($Format["BoxUpBorderB"]) ? $Format["BoxUpBorderB"] : $BoxUpB-20;
@@ -61,17 +61,17 @@  discard block
 block discarded – undo
61 61
      $BoxDownG		= isset($Format["BoxDownG"]) ? $Format["BoxDownG"] : 100;
62 62
      $BoxDownB		= isset($Format["BoxDownB"]) ? $Format["BoxDownB"] : 46;
63 63
      $BoxDownAlpha	= isset($Format["BoxDownAlpha"]) ? $Format["BoxDownAlpha"] : 100;
64
-     $BoxDownSurrounding= isset($Format["BoxDownSurrounding"]) ? $Format["BoxDownSurrounding"] : NULL;
64
+     $BoxDownSurrounding= isset($Format["BoxDownSurrounding"]) ? $Format["BoxDownSurrounding"] : null;
65 65
      $BoxDownBorderR	= isset($Format["BoxDownBorderR"]) ? $Format["BoxDownBorderR"] : $BoxDownR-20;
66 66
      $BoxDownBorderG	= isset($Format["BoxDownBorderG"]) ? $Format["BoxDownBorderG"] : $BoxDownG-20;
67 67
      $BoxDownBorderB	= isset($Format["BoxDownBorderB"]) ? $Format["BoxDownBorderB"] : $BoxDownB-20;
68 68
      $BoxDownBorderAlpha= isset($Format["BoxDownBorderAlpha"]) ? $Format["BoxDownBorderAlpha"] : 100;
69
-     $ShadowOnBoxesOnly	= isset($Format["ShadowOnBoxesOnly"]) ? $Format["ShadowOnBoxesOnly"] : TRUE;
69
+     $ShadowOnBoxesOnly	= isset($Format["ShadowOnBoxesOnly"]) ? $Format["ShadowOnBoxesOnly"] : true;
70 70
      $MedianR		= isset($Format["MedianR"]) ? $Format["MedianR"] : 255;
71 71
      $MedianG		= isset($Format["MedianG"]) ? $Format["MedianG"] : 0;
72 72
      $MedianB		= isset($Format["MedianB"]) ? $Format["MedianB"] : 0;
73 73
      $MedianAlpha	= isset($Format["MedianAlpha"]) ? $Format["MedianAlpha"] : 100;
74
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
74
+     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : false;
75 75
      $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : "Stock Chart";
76 76
 
77 77
 
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
      $Data    = $this->pDataObject->getData();
80 80
      $Palette = $this->pDataObject->getPalette();
81 81
 
82
-     if ( $BoxUpSurrounding != NULL )	{ $BoxUpBorderR = $BoxUpR + $BoxUpSurrounding; $BoxUpBorderG = $BoxUpG + $BoxUpSurrounding; $BoxUpBorderB = $BoxUpB + $BoxUpSurrounding; }
83
-     if ( $BoxDownSurrounding != NULL )	{ $BoxDownBorderR = $BoxDownR + $BoxDownSurrounding; $BoxDownBorderG = $BoxDownG + $BoxDownSurrounding; $BoxDownBorderB = $BoxDownB + $BoxDownSurrounding; }
82
+     if ( $BoxUpSurrounding != null )	{ $BoxUpBorderR = $BoxUpR + $BoxUpSurrounding; $BoxUpBorderG = $BoxUpG + $BoxUpSurrounding; $BoxUpBorderB = $BoxUpB + $BoxUpSurrounding; }
83
+     if ( $BoxDownSurrounding != null )	{ $BoxDownBorderR = $BoxDownR + $BoxDownSurrounding; $BoxDownBorderG = $BoxDownG + $BoxDownSurrounding; $BoxDownBorderB = $BoxDownB + $BoxDownSurrounding; }
84 84
 
85 85
      if ( $LineWidth != 1 ) { $LineOffset = $LineWidth / 2; }
86 86
      $BoxOffset = $BoxWidth / 2;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
        $Point = "";
98 98
        if ( isset($Data["Series"][$SerieClose]["Data"][$Key]) || isset($Data["Series"][$SerieMin]["Data"][$Key]) || isset($Data["Series"][$SerieMax]["Data"][$Key]) )
99 99
         $Point = array($Value,$Data["Series"][$SerieClose]["Data"][$Key],$Data["Series"][$SerieMin]["Data"][$Key],$Data["Series"][$SerieMax]["Data"][$Key]);
100
-       if ( $SerieMedian != NULL && isset($Data["Series"][$SerieMedian]["Data"][$Key]) )
100
+       if ( $SerieMedian != null && isset($Data["Series"][$SerieMedian]["Data"][$Key]) )
101 101
         $Point[] = $Data["Series"][$SerieMedian]["Data"][$Key];
102 102
 
103 103
        $Plots[] = $Point;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
        $PosArray = $this->pChartObject->scaleComputeY($Points,array("AxisID"=>$AxisID));
126 126
 
127 127
        $Values = "Open :".$Data["Series"][$SerieOpen]["Data"][$Key]."<BR>Close : ".$Data["Series"][$SerieClose]["Data"][$Key]."<BR>Min : ".$Data["Series"][$SerieMin]["Data"][$Key]."<BR>Max : ".$Data["Series"][$SerieMax]["Data"][$Key]."<BR>";
128
-       if ( $SerieMedian != NULL ) { $Values = $Values."Median : ".$Data["Series"][$SerieMedian]["Data"][$Key]."<BR>"; }
128
+       if ( $SerieMedian != null ) { $Values = $Values."Median : ".$Data["Series"][$SerieMedian]["Data"][$Key]."<BR>"; }
129 129
        if ( $PosArray[0] > $PosArray[1] ) { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxUpR,$BoxUpG,$BoxUpB); } else { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxDownR,$BoxDownG,$BoxDownB); } 
130 130
 
131 131
        if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
          if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs; }
137 137
 
138
-         if ( $ShadowOnBoxesOnly ) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE; }
138
+         if ( $ShadowOnBoxesOnly ) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = false; }
139 139
 
140 140
          if ( $LineWidth == 1 )
141 141
           $this->pChartObject->drawLine($X,$PosArray[2],$X,$PosArray[3],$LineSettings);
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
          else
182 182
           $this->pChartObject->drawFilledRectangle($PosArray[2],$Y-$LineOffset,$PosArray[3],$Y+$LineOffset,$LineSettings);
183 183
 
184
-         if ( $ShadowOnBoxesOnly ) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE; }
184
+         if ( $ShadowOnBoxesOnly ) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = false; }
185 185
 
186 186
          if ( $ExtremityWidth == 1 )
187 187
           {
Please login to merge, or discard this patch.
default/boinc/modules/boincstats/includes/pchart/class/pSurface.class.php 4 patches
Indentation   +234 added lines, -234 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
- /*
2
+    /*
3 3
      pSurface - class to draw surface charts
4 4
 
5 5
      Version     : 2.1.3
@@ -13,303 +13,303 @@  discard block
 block discarded – undo
13 13
      You can find the whole class documentation on the pChart web site.
14 14
  */
15 15
 
16
- define("UNKNOWN"		, 0.123456789);
17
- define("IGNORED"		, -1);
16
+    define("UNKNOWN"		, 0.123456789);
17
+    define("IGNORED"		, -1);
18 18
 
19
- define("LABEL_POSITION_LEFT"	, 880001);
20
- define("LABEL_POSITION_RIGHT"	, 880002);
21
- define("LABEL_POSITION_TOP"	, 880003);
22
- define("LABEL_POSITION_BOTTOM"	, 880004);
19
+    define("LABEL_POSITION_LEFT"	, 880001);
20
+    define("LABEL_POSITION_RIGHT"	, 880002);
21
+    define("LABEL_POSITION_TOP"	, 880003);
22
+    define("LABEL_POSITION_BOTTOM"	, 880004);
23 23
 
24
- /* pStock class definition */
25
- class pSurface
26
-  {
27
-   var $pChartObject;
28
-   var $GridSizeX;
29
-   var $GridSizeY;
30
-   var $Points;
24
+    /* pStock class definition */
25
+    class pSurface
26
+    {
27
+    var $pChartObject;
28
+    var $GridSizeX;
29
+    var $GridSizeY;
30
+    var $Points;
31 31
 
32
-   /* Class creator */
33
-   function pSurface($pChartObject)
32
+    /* Class creator */
33
+    function pSurface($pChartObject)
34 34
     {
35
-     $this->pChartObject = $pChartObject;
36
-     $this->GridSize     = 10;
37
-     $this->Points       = "";
35
+        $this->pChartObject = $pChartObject;
36
+        $this->GridSize     = 10;
37
+        $this->Points       = "";
38 38
     }
39 39
 
40
-   /* Define the grid size and initialise the 2D matrix */
41
-   function setGrid($XSize=10,$YSize=10)
40
+    /* Define the grid size and initialise the 2D matrix */
41
+    function setGrid($XSize=10,$YSize=10)
42 42
     {
43
-     for($X=0; $X<=$XSize; $X++) { for($Y=0; $Y<=$YSize; $Y++) { $this->Points[$X][$Y]=UNKNOWN; } } 
43
+        for($X=0; $X<=$XSize; $X++) { for($Y=0; $Y<=$YSize; $Y++) { $this->Points[$X][$Y]=UNKNOWN; } } 
44 44
 
45
-     $this->GridSizeX = $XSize;
46
-     $this->GridSizeY = $YSize;
45
+        $this->GridSizeX = $XSize;
46
+        $this->GridSizeY = $YSize;
47 47
     }
48 48
 
49
-   /* Add a point on the grid */
50
-   function addPoint($X,$Y,$Value,$Force=TRUE)
49
+    /* Add a point on the grid */
50
+    function addPoint($X,$Y,$Value,$Force=TRUE)
51 51
     {
52
-     if ( $X < 0 || $X >$this->GridSizeX ) { return(0); }
53
-     if ( $Y < 0 || $Y >$this->GridSizeY ) { return(0); }
54
-
55
-     if ( $this->Points[$X][$Y] == UNKNOWN || $Force )
56
-      $this->Points[$X][$Y] = $Value;
57
-     elseif ( $this->Points[$X][$Y] == UNKNOWN )
58
-      $this->Points[$X][$Y] = $Value;
59
-     else
60
-      $this->Points[$X][$Y] = ($this->Points[$X][$Y] + $Value)/2;
52
+        if ( $X < 0 || $X >$this->GridSizeX ) { return(0); }
53
+        if ( $Y < 0 || $Y >$this->GridSizeY ) { return(0); }
54
+
55
+        if ( $this->Points[$X][$Y] == UNKNOWN || $Force )
56
+        $this->Points[$X][$Y] = $Value;
57
+        elseif ( $this->Points[$X][$Y] == UNKNOWN )
58
+        $this->Points[$X][$Y] = $Value;
59
+        else
60
+        $this->Points[$X][$Y] = ($this->Points[$X][$Y] + $Value)/2;
61 61
     }
62 62
 
63
-   /* Write the X labels */
64
-   function writeXLabels($Format="")
63
+    /* Write the X labels */
64
+    function writeXLabels($Format="")
65 65
     {
66
-     $R			= isset($Format["R"]) ? $Format["R"] : $this->pChartObject->FontColorR;
67
-     $G			= isset($Format["G"]) ? $Format["G"] : $this->pChartObject->FontColorG;
68
-     $B			= isset($Format["B"]) ? $Format["B"] : $this->pChartObject->FontColorB;
69
-     $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : $this->pChartObject->FontColorA;
70
-     $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
71
-     $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 5;
72
-     $Position		= isset($Format["Position"]) ? $Format["Position"] : LABEL_POSITION_TOP;
73
-     $Labels		= isset($Format["Labels"]) ? $Format["Labels"] : NULL;
74
-     $CountOffset	= isset($Format["CountOffset"]) ? $Format["CountOffset"] : 0;
75
-
76
-     if ( $Labels != NULL && !is_array($Labels) ) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
77
-
78
-     $X0    = $this->pChartObject->GraphAreaX1;
79
-     $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
80
-
81
-     $Settings = array("Angle"=>$Angle,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
82
-     if ( $Position == LABEL_POSITION_TOP )
83
-      {
84
-       $YPos  = $this->pChartObject->GraphAreaY1 - $Padding;
85
-       if ($Angle == 0 ) { $Settings["Align"] = TEXT_ALIGN_BOTTOMMIDDLE; }
86
-       if ($Angle != 0 ) { $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
87
-      }
88
-     elseif ( $Position == LABEL_POSITION_BOTTOM )
89
-      {
90
-       $YPos  = $this->pChartObject->GraphAreaY2 + $Padding;
91
-       if ($Angle == 0 ) { $Settings["Align"] = TEXT_ALIGN_TOPMIDDLE; }
92
-       if ($Angle != 0 ) { $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
93
-      }
94
-     else
95
-      return(-1);
96
-
97
-     for($X=0;$X<=$this->GridSizeX;$X++)
98
-      {
99
-       $XPos = floor($X0+$X*$XSize + $XSize/2);
100
-
101
-       if( $Labels == NULL || !isset($Labels[$X]) )
66
+        $R			= isset($Format["R"]) ? $Format["R"] : $this->pChartObject->FontColorR;
67
+        $G			= isset($Format["G"]) ? $Format["G"] : $this->pChartObject->FontColorG;
68
+        $B			= isset($Format["B"]) ? $Format["B"] : $this->pChartObject->FontColorB;
69
+        $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : $this->pChartObject->FontColorA;
70
+        $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
71
+        $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 5;
72
+        $Position		= isset($Format["Position"]) ? $Format["Position"] : LABEL_POSITION_TOP;
73
+        $Labels		= isset($Format["Labels"]) ? $Format["Labels"] : NULL;
74
+        $CountOffset	= isset($Format["CountOffset"]) ? $Format["CountOffset"] : 0;
75
+
76
+        if ( $Labels != NULL && !is_array($Labels) ) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
77
+
78
+        $X0    = $this->pChartObject->GraphAreaX1;
79
+        $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
80
+
81
+        $Settings = array("Angle"=>$Angle,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
82
+        if ( $Position == LABEL_POSITION_TOP )
83
+        {
84
+        $YPos  = $this->pChartObject->GraphAreaY1 - $Padding;
85
+        if ($Angle == 0 ) { $Settings["Align"] = TEXT_ALIGN_BOTTOMMIDDLE; }
86
+        if ($Angle != 0 ) { $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
87
+        }
88
+        elseif ( $Position == LABEL_POSITION_BOTTOM )
89
+        {
90
+        $YPos  = $this->pChartObject->GraphAreaY2 + $Padding;
91
+        if ($Angle == 0 ) { $Settings["Align"] = TEXT_ALIGN_TOPMIDDLE; }
92
+        if ($Angle != 0 ) { $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
93
+        }
94
+        else
95
+        return(-1);
96
+
97
+        for($X=0;$X<=$this->GridSizeX;$X++)
98
+        {
99
+        $XPos = floor($X0+$X*$XSize + $XSize/2);
100
+
101
+        if( $Labels == NULL || !isset($Labels[$X]) )
102 102
         $Value = $X+$CountOffset;
103
-       else
103
+        else
104 104
         $Value = $Labels[$X];
105 105
 
106
-       $this->pChartObject->drawText($XPos,$YPos,$Value,$Settings);
107
-      }
106
+        $this->pChartObject->drawText($XPos,$YPos,$Value,$Settings);
107
+        }
108 108
     }
109 109
 
110
-   /* Write the Y labels */
111
-   function writeYLabels($Format="")
110
+    /* Write the Y labels */
111
+    function writeYLabels($Format="")
112 112
     {
113
-     $R			= isset($Format["R"]) ? $Format["R"] : $this->pChartObject->FontColorR;
114
-     $G			= isset($Format["G"]) ? $Format["G"] : $this->pChartObject->FontColorG;
115
-     $B			= isset($Format["B"]) ? $Format["B"] : $this->pChartObject->FontColorB;
116
-     $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : $this->pChartObject->FontColorA;
117
-     $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
118
-     $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 5;
119
-     $Position		= isset($Format["Position"]) ? $Format["Position"] : LABEL_POSITION_LEFT;
120
-     $Labels		= isset($Format["Labels"]) ? $Format["Labels"] : NULL;
121
-     $CountOffset	= isset($Format["CountOffset"]) ? $Format["CountOffset"] : 0;
122
-
123
-     if ( $Labels != NULL && !is_array($Labels) ) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
124
-
125
-     $Y0    = $this->pChartObject->GraphAreaY1;
126
-     $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
127
-
128
-     $Settings = array("Angle"=>$Angle,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
129
-     if ( $Position == LABEL_POSITION_LEFT )
130
-      { $XPos  = $this->pChartObject->GraphAreaX1 - $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
131
-     elseif ( $Position == LABEL_POSITION_RIGHT )
132
-      { $XPos  = $this->pChartObject->GraphAreaX2 + $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
133
-     else
134
-      return(-1);
135
-
136
-     for($Y=0;$Y<=$this->GridSizeY;$Y++)
137
-      {
138
-       $YPos = floor($Y0+$Y*$YSize + $YSize/2);
139
-
140
-       if( $Labels == NULL || !isset($Labels[$Y]) )
113
+        $R			= isset($Format["R"]) ? $Format["R"] : $this->pChartObject->FontColorR;
114
+        $G			= isset($Format["G"]) ? $Format["G"] : $this->pChartObject->FontColorG;
115
+        $B			= isset($Format["B"]) ? $Format["B"] : $this->pChartObject->FontColorB;
116
+        $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : $this->pChartObject->FontColorA;
117
+        $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
118
+        $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 5;
119
+        $Position		= isset($Format["Position"]) ? $Format["Position"] : LABEL_POSITION_LEFT;
120
+        $Labels		= isset($Format["Labels"]) ? $Format["Labels"] : NULL;
121
+        $CountOffset	= isset($Format["CountOffset"]) ? $Format["CountOffset"] : 0;
122
+
123
+        if ( $Labels != NULL && !is_array($Labels) ) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
124
+
125
+        $Y0    = $this->pChartObject->GraphAreaY1;
126
+        $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
127
+
128
+        $Settings = array("Angle"=>$Angle,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
129
+        if ( $Position == LABEL_POSITION_LEFT )
130
+        { $XPos  = $this->pChartObject->GraphAreaX1 - $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
131
+        elseif ( $Position == LABEL_POSITION_RIGHT )
132
+        { $XPos  = $this->pChartObject->GraphAreaX2 + $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
133
+        else
134
+        return(-1);
135
+
136
+        for($Y=0;$Y<=$this->GridSizeY;$Y++)
137
+        {
138
+        $YPos = floor($Y0+$Y*$YSize + $YSize/2);
139
+
140
+        if( $Labels == NULL || !isset($Labels[$Y]) )
141 141
         $Value = $Y+$CountOffset;
142
-       else
142
+        else
143 143
         $Value = $Labels[$Y];
144 144
 
145
-       $this->pChartObject->drawText($XPos,$YPos,$Value,$Settings);
146
-      }
145
+        $this->pChartObject->drawText($XPos,$YPos,$Value,$Settings);
146
+        }
147 147
     }
148 148
 
149
-   /* Draw the area arround the specified Threshold */
150
-   function drawContour($Threshold,$Format="")
149
+    /* Draw the area arround the specified Threshold */
150
+    function drawContour($Threshold,$Format="")
151 151
     {
152
-     $R		= isset($Format["R"]) ? $Format["R"] : 0;
153
-     $G		= isset($Format["G"]) ? $Format["G"] : 0;
154
-     $B		= isset($Format["B"]) ? $Format["B"] : 0;
155
-     $Alpha	= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
156
-     $Ticks	= isset($Format["Ticks"]) ? $Format["Ticks"] : 3;
157
-     $Padding	= isset($Format["Padding"]) ? $Format["Padding"] : 0;
158
-
159
-     $X0    = $this->pChartObject->GraphAreaX1;
160
-     $Y0    = $this->pChartObject->GraphAreaY1;
161
-     $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
162
-     $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
163
-
164
-     $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks);
165
-
166
-     for($X=0;$X<=$this->GridSizeX;$X++)
167
-      {
168
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
152
+        $R		= isset($Format["R"]) ? $Format["R"] : 0;
153
+        $G		= isset($Format["G"]) ? $Format["G"] : 0;
154
+        $B		= isset($Format["B"]) ? $Format["B"] : 0;
155
+        $Alpha	= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
156
+        $Ticks	= isset($Format["Ticks"]) ? $Format["Ticks"] : 3;
157
+        $Padding	= isset($Format["Padding"]) ? $Format["Padding"] : 0;
158
+
159
+        $X0    = $this->pChartObject->GraphAreaX1;
160
+        $Y0    = $this->pChartObject->GraphAreaY1;
161
+        $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
162
+        $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
163
+
164
+        $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks);
165
+
166
+        for($X=0;$X<=$this->GridSizeX;$X++)
169 167
         {
170
-         $Value = $this->Points[$X][$Y];
168
+        for($Y=0;$Y<=$this->GridSizeY;$Y++)
169
+        {
170
+            $Value = $this->Points[$X][$Y];
171 171
 
172
-         if ( $Value != UNKNOWN && $Value != IGNORED && $Value >= $Threshold)
173
-          {
174
-           $X1 = floor($X0+$X*$XSize)+$Padding;
175
-           $Y1 = floor($Y0+$Y*$YSize)+$Padding;
176
-           $X2 = floor($X0+$X*$XSize+$XSize);
177
-           $Y2 = floor($Y0+$Y*$YSize+$YSize);
172
+            if ( $Value != UNKNOWN && $Value != IGNORED && $Value >= $Threshold)
173
+            {
174
+            $X1 = floor($X0+$X*$XSize)+$Padding;
175
+            $Y1 = floor($Y0+$Y*$YSize)+$Padding;
176
+            $X2 = floor($X0+$X*$XSize+$XSize);
177
+            $Y2 = floor($Y0+$Y*$YSize+$YSize);
178 178
 
179
-           if ( $X > 0 && $this->Points[$X-1][$Y] != UNKNOWN && $this->Points[$X-1][$Y] != IGNORED && $this->Points[$X-1][$Y] < $Threshold)
179
+            if ( $X > 0 && $this->Points[$X-1][$Y] != UNKNOWN && $this->Points[$X-1][$Y] != IGNORED && $this->Points[$X-1][$Y] < $Threshold)
180 180
             $this->pChartObject->drawLine($X1,$Y1,$X1,$Y2,$Color);
181
-           if ( $Y > 0 && $this->Points[$X][$Y-1] != UNKNOWN && $this->Points[$X][$Y-1] != IGNORED && $this->Points[$X][$Y-1] < $Threshold)
181
+            if ( $Y > 0 && $this->Points[$X][$Y-1] != UNKNOWN && $this->Points[$X][$Y-1] != IGNORED && $this->Points[$X][$Y-1] < $Threshold)
182 182
             $this->pChartObject->drawLine($X1,$Y1,$X2,$Y1,$Color);
183
-           if ( $X < $this->GridSizeX && $this->Points[$X+1][$Y] != UNKNOWN && $this->Points[$X+1][$Y] != IGNORED && $this->Points[$X+1][$Y] < $Threshold)
183
+            if ( $X < $this->GridSizeX && $this->Points[$X+1][$Y] != UNKNOWN && $this->Points[$X+1][$Y] != IGNORED && $this->Points[$X+1][$Y] < $Threshold)
184 184
             $this->pChartObject->drawLine($X2,$Y1,$X2,$Y2,$Color);
185
-           if ( $Y < $this->GridSizeY && $this->Points[$X][$Y+1] != UNKNOWN && $this->Points[$X][$Y+1] != IGNORED && $this->Points[$X][$Y+1] < $Threshold)
185
+            if ( $Y < $this->GridSizeY && $this->Points[$X][$Y+1] != UNKNOWN && $this->Points[$X][$Y+1] != IGNORED && $this->Points[$X][$Y+1] < $Threshold)
186 186
             $this->pChartObject->drawLine($X1,$Y2,$X2,$Y2,$Color);
187
-          }
187
+            }
188
+        }
188 189
         }
189
-      }
190 190
     }
191 191
 
192
-   /* Draw the surface chart */
193
-   function drawSurface($Format="")
192
+    /* Draw the surface chart */
193
+    function drawSurface($Format="")
194 194
     {
195
-     $Palette		= isset($Format["Palette"]) ? $Format["Palette"] : NULL;
196
-     $ShadeR1		= isset($Format["ShadeR1"]) ? $Format["ShadeR1"] : 77;
197
-     $ShadeG1		= isset($Format["ShadeG1"]) ? $Format["ShadeG1"] : 205;
198
-     $ShadeB1		= isset($Format["ShadeB1"]) ? $Format["ShadeB1"] : 21;
199
-     $ShadeA1		= isset($Format["ShadeA1"]) ? $Format["ShadeA1"] : 40;
200
-     $ShadeR2		= isset($Format["ShadeR2"]) ? $Format["ShadeR2"] : 227;
201
-     $ShadeG2		= isset($Format["ShadeG2"]) ? $Format["ShadeG2"] : 135;
202
-     $ShadeB2		= isset($Format["ShadeB2"]) ? $Format["ShadeB2"] : 61;
203
-     $ShadeA2		= isset($Format["ShadeA2"]) ? $Format["ShadeA2"] : 100;
204
-     $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
205
-     $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 0;
206
-     $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 0;
207
-     $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 0;
208
-     $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : -1;
209
-     $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 1;
210
-
211
-     $X0    = $this->pChartObject->GraphAreaX1;
212
-     $Y0    = $this->pChartObject->GraphAreaY1;
213
-     $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
214
-     $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
215
-
216
-     for($X=0;$X<=$this->GridSizeX;$X++)
217
-      {
218
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
195
+        $Palette		= isset($Format["Palette"]) ? $Format["Palette"] : NULL;
196
+        $ShadeR1		= isset($Format["ShadeR1"]) ? $Format["ShadeR1"] : 77;
197
+        $ShadeG1		= isset($Format["ShadeG1"]) ? $Format["ShadeG1"] : 205;
198
+        $ShadeB1		= isset($Format["ShadeB1"]) ? $Format["ShadeB1"] : 21;
199
+        $ShadeA1		= isset($Format["ShadeA1"]) ? $Format["ShadeA1"] : 40;
200
+        $ShadeR2		= isset($Format["ShadeR2"]) ? $Format["ShadeR2"] : 227;
201
+        $ShadeG2		= isset($Format["ShadeG2"]) ? $Format["ShadeG2"] : 135;
202
+        $ShadeB2		= isset($Format["ShadeB2"]) ? $Format["ShadeB2"] : 61;
203
+        $ShadeA2		= isset($Format["ShadeA2"]) ? $Format["ShadeA2"] : 100;
204
+        $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
205
+        $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 0;
206
+        $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 0;
207
+        $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 0;
208
+        $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : -1;
209
+        $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 1;
210
+
211
+        $X0    = $this->pChartObject->GraphAreaX1;
212
+        $Y0    = $this->pChartObject->GraphAreaY1;
213
+        $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
214
+        $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
215
+
216
+        for($X=0;$X<=$this->GridSizeX;$X++)
217
+        {
218
+        for($Y=0;$Y<=$this->GridSizeY;$Y++)
219 219
         {
220
-         $Value = $this->Points[$X][$Y];
220
+            $Value = $this->Points[$X][$Y];
221 221
 
222
-         if ( $Value != UNKNOWN && $Value != IGNORED )
223
-          {
224
-           $X1 = floor($X0+$X*$XSize)+$Padding;
225
-           $Y1 = floor($Y0+$Y*$YSize)+$Padding;
226
-           $X2 = floor($X0+$X*$XSize+$XSize);
227
-           $Y2 = floor($Y0+$Y*$YSize+$YSize);
222
+            if ( $Value != UNKNOWN && $Value != IGNORED )
223
+            {
224
+            $X1 = floor($X0+$X*$XSize)+$Padding;
225
+            $Y1 = floor($Y0+$Y*$YSize)+$Padding;
226
+            $X2 = floor($X0+$X*$XSize+$XSize);
227
+            $Y2 = floor($Y0+$Y*$YSize+$YSize);
228 228
 
229
-           if ( $Palette != NULL )
229
+            if ( $Palette != NULL )
230 230
             {
231
-             if ( isset($Palette[$Value]) && isset($Palette[$Value]["R"]) ) { $R = $Palette[$Value]["R"]; } else { $R = 0; }
232
-             if ( isset($Palette[$Value]) && isset($Palette[$Value]["G"]) ) { $G = $Palette[$Value]["G"]; } else { $G = 0; }
233
-             if ( isset($Palette[$Value]) && isset($Palette[$Value]["B"]) ) { $B = $Palette[$Value]["B"]; } else { $B = 0; }
234
-             if ( isset($Palette[$Value]) && isset($Palette[$Value]["Alpha"]) ) { $Alpha = $Palette[$Value]["Alpha"]; } else { $Alpha = 1000; }
231
+                if ( isset($Palette[$Value]) && isset($Palette[$Value]["R"]) ) { $R = $Palette[$Value]["R"]; } else { $R = 0; }
232
+                if ( isset($Palette[$Value]) && isset($Palette[$Value]["G"]) ) { $G = $Palette[$Value]["G"]; } else { $G = 0; }
233
+                if ( isset($Palette[$Value]) && isset($Palette[$Value]["B"]) ) { $B = $Palette[$Value]["B"]; } else { $B = 0; }
234
+                if ( isset($Palette[$Value]) && isset($Palette[$Value]["Alpha"]) ) { $Alpha = $Palette[$Value]["Alpha"]; } else { $Alpha = 1000; }
235 235
             }
236
-           else
236
+            else
237 237
             {
238
-             $R = (($ShadeR2-$ShadeR1)/100)*$Value + $ShadeR1;
239
-             $G = (($ShadeG2-$ShadeG1)/100)*$Value + $ShadeG1;
240
-             $B = (($ShadeB2-$ShadeB1)/100)*$Value + $ShadeB1;
241
-             $Alpha = (($ShadeA2-$ShadeA1)/100)*$Value + $ShadeA1;
238
+                $R = (($ShadeR2-$ShadeR1)/100)*$Value + $ShadeR1;
239
+                $G = (($ShadeG2-$ShadeG1)/100)*$Value + $ShadeG1;
240
+                $B = (($ShadeB2-$ShadeB1)/100)*$Value + $ShadeB1;
241
+                $Alpha = (($ShadeA2-$ShadeA1)/100)*$Value + $ShadeA1;
242 242
             }
243 243
 
244
-           $Settings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
245
-           if ( $Border ) { $Settings["BorderR"] = $BorderR; $Settings["BorderG"] = $BorderG; $Settings["BorderB"] = $BorderB; }
246
-           if ( $Surrounding != -1 ) { $Settings["BorderR"] = $R+$Surrounding; $Settings["BorderG"] = $G+$Surrounding; $Settings["BorderB"] = $B+$Surrounding; }
244
+            $Settings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
245
+            if ( $Border ) { $Settings["BorderR"] = $BorderR; $Settings["BorderG"] = $BorderG; $Settings["BorderB"] = $BorderB; }
246
+            if ( $Surrounding != -1 ) { $Settings["BorderR"] = $R+$Surrounding; $Settings["BorderG"] = $G+$Surrounding; $Settings["BorderB"] = $B+$Surrounding; }
247 247
 
248
-           $this->pChartObject->drawFilledRectangle($X1,$Y1,$X2-1,$Y2-1,$Settings);
249
-          }
248
+            $this->pChartObject->drawFilledRectangle($X1,$Y1,$X2-1,$Y2-1,$Settings);
249
+            }
250
+        }
250 251
         }
251
-      }
252 252
     }
253 253
 
254
-   /* Compute the missing points */
255
-   function computeMissing()
254
+    /* Compute the missing points */
255
+    function computeMissing()
256 256
     {
257
-     $Missing = "";
258
-     for($X=0;$X<=$this->GridSizeX;$X++)
259
-      {
260
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
257
+        $Missing = "";
258
+        for($X=0;$X<=$this->GridSizeX;$X++)
259
+        {
260
+        for($Y=0;$Y<=$this->GridSizeY;$Y++)
261 261
         {
262
-         if ( $this->Points[$X][$Y] == UNKNOWN )
263
-          $Missing[] = $X.",".$Y;
262
+            if ( $this->Points[$X][$Y] == UNKNOWN )
263
+            $Missing[] = $X.",".$Y;
264 264
         }
265
-      }
266
-     shuffle($Missing);
265
+        }
266
+        shuffle($Missing);
267 267
      
268
-     foreach($Missing as $Key => $Pos)
269
-      {
270
-       $Pos = preg_split("/,/",$Pos);
271
-       $X   = $Pos[0];
272
-       $Y   = $Pos[1];
268
+        foreach($Missing as $Key => $Pos)
269
+        {
270
+        $Pos = preg_split("/,/",$Pos);
271
+        $X   = $Pos[0];
272
+        $Y   = $Pos[1];
273 273
 
274
-       if ( $this->Points[$X][$Y] == UNKNOWN )
274
+        if ( $this->Points[$X][$Y] == UNKNOWN )
275 275
         {
276
-         $NearestNeighbor = $this->getNearestNeighbor($X,$Y);
276
+            $NearestNeighbor = $this->getNearestNeighbor($X,$Y);
277 277
 
278
-         $Value = 0; $Points = 0;
279
-         for($Xi=$X-$NearestNeighbor;$Xi<=$X+$NearestNeighbor;$Xi++)
280
-          {
281
-           for($Yi=$Y-$NearestNeighbor;$Yi<=$Y+$NearestNeighbor;$Yi++)
278
+            $Value = 0; $Points = 0;
279
+            for($Xi=$X-$NearestNeighbor;$Xi<=$X+$NearestNeighbor;$Xi++)
282 280
             {
283
-             if ($Xi >=0 && $Yi >= 0 && $Xi <= $this->GridSizeX && $Yi <= $this->GridSizeY && $this->Points[$Xi][$Yi] != UNKNOWN && $this->Points[$Xi][$Yi] != IGNORED)
284
-              {
285
-               $Value = $Value + $this->Points[$Xi][$Yi]; $Points++;
286
-              }
281
+            for($Yi=$Y-$NearestNeighbor;$Yi<=$Y+$NearestNeighbor;$Yi++)
282
+            {
283
+                if ($Xi >=0 && $Yi >= 0 && $Xi <= $this->GridSizeX && $Yi <= $this->GridSizeY && $this->Points[$Xi][$Yi] != UNKNOWN && $this->Points[$Xi][$Yi] != IGNORED)
284
+                {
285
+                $Value = $Value + $this->Points[$Xi][$Yi]; $Points++;
286
+                }
287
+            }
287 288
             }
288
-          }
289 289
 
290
-         if ( $Points != 0 ) { $this->Points[$X][$Y] = $Value / $Points; }
290
+            if ( $Points != 0 ) { $this->Points[$X][$Y] = $Value / $Points; }
291
+        }
291 292
         }
292
-      }
293 293
     }
294 294
 
295
-   /* Return the nearest Neighbor distance of a point */
296
-   function getNearestNeighbor($Xp,$Yp)
295
+    /* Return the nearest Neighbor distance of a point */
296
+    function getNearestNeighbor($Xp,$Yp)
297 297
     {
298
-     $Nearest = UNKNOWN;
299
-     for($X=0;$X<=$this->GridSizeX;$X++)
300
-      {
301
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
298
+        $Nearest = UNKNOWN;
299
+        for($X=0;$X<=$this->GridSizeX;$X++)
300
+        {
301
+        for($Y=0;$Y<=$this->GridSizeY;$Y++)
302 302
         {
303
-         if ( $this->Points[$X][$Y] != UNKNOWN && $this->Points[$X][$Y] != IGNORED )
304
-          {
305
-           $DistanceX = max($Xp,$X)-min($Xp,$X);
306
-           $DistanceY = max($Yp,$Y)-min($Yp,$Y);
307
-           $Distance  = max($DistanceX,$DistanceY);
308
-           if ( $Distance < $Nearest || $Nearest == UNKNOWN ) { $Nearest = $Distance; }
309
-          }
303
+            if ( $this->Points[$X][$Y] != UNKNOWN && $this->Points[$X][$Y] != IGNORED )
304
+            {
305
+            $DistanceX = max($Xp,$X)-min($Xp,$X);
306
+            $DistanceY = max($Yp,$Y)-min($Yp,$Y);
307
+            $Distance  = max($DistanceX,$DistanceY);
308
+            if ( $Distance < $Nearest || $Nearest == UNKNOWN ) { $Nearest = $Distance; }
309
+            }
310 310
         }
311
-      }
312
-     return($Nearest);
311
+        }
312
+        return($Nearest);
313
+    }
313 314
     }
314
-  }
315 315
 ?>
316 316
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@  discard block
 block discarded – undo
13 13
      You can find the whole class documentation on the pChart web site.
14 14
  */
15 15
 
16
- define("UNKNOWN"		, 0.123456789);
17
- define("IGNORED"		, -1);
16
+ define("UNKNOWN", 0.123456789);
17
+ define("IGNORED", -1);
18 18
 
19
- define("LABEL_POSITION_LEFT"	, 880001);
20
- define("LABEL_POSITION_RIGHT"	, 880002);
21
- define("LABEL_POSITION_TOP"	, 880003);
22
- define("LABEL_POSITION_BOTTOM"	, 880004);
19
+ define("LABEL_POSITION_LEFT", 880001);
20
+ define("LABEL_POSITION_RIGHT", 880002);
21
+ define("LABEL_POSITION_TOP", 880003);
22
+ define("LABEL_POSITION_BOTTOM", 880004);
23 23
 
24 24
  /* pStock class definition */
25 25
  class pSurface
@@ -38,159 +38,159 @@  discard block
 block discarded – undo
38 38
     }
39 39
 
40 40
    /* Define the grid size and initialise the 2D matrix */
41
-   function setGrid($XSize=10,$YSize=10)
41
+   function setGrid($XSize = 10, $YSize = 10)
42 42
     {
43
-     for($X=0; $X<=$XSize; $X++) { for($Y=0; $Y<=$YSize; $Y++) { $this->Points[$X][$Y]=UNKNOWN; } } 
43
+     for ($X = 0; $X <= $XSize; $X++) { for ($Y = 0; $Y <= $YSize; $Y++) { $this->Points[$X][$Y] = UNKNOWN; } } 
44 44
 
45 45
      $this->GridSizeX = $XSize;
46 46
      $this->GridSizeY = $YSize;
47 47
     }
48 48
 
49 49
    /* Add a point on the grid */
50
-   function addPoint($X,$Y,$Value,$Force=TRUE)
50
+   function addPoint($X, $Y, $Value, $Force = TRUE)
51 51
     {
52
-     if ( $X < 0 || $X >$this->GridSizeX ) { return(0); }
53
-     if ( $Y < 0 || $Y >$this->GridSizeY ) { return(0); }
52
+     if ($X < 0 || $X > $this->GridSizeX) { return(0); }
53
+     if ($Y < 0 || $Y > $this->GridSizeY) { return(0); }
54 54
 
55
-     if ( $this->Points[$X][$Y] == UNKNOWN || $Force )
55
+     if ($this->Points[$X][$Y] == UNKNOWN || $Force)
56 56
       $this->Points[$X][$Y] = $Value;
57
-     elseif ( $this->Points[$X][$Y] == UNKNOWN )
57
+     elseif ($this->Points[$X][$Y] == UNKNOWN)
58 58
       $this->Points[$X][$Y] = $Value;
59 59
      else
60 60
       $this->Points[$X][$Y] = ($this->Points[$X][$Y] + $Value)/2;
61 61
     }
62 62
 
63 63
    /* Write the X labels */
64
-   function writeXLabels($Format="")
64
+   function writeXLabels($Format = "")
65 65
     {
66 66
      $R			= isset($Format["R"]) ? $Format["R"] : $this->pChartObject->FontColorR;
67 67
      $G			= isset($Format["G"]) ? $Format["G"] : $this->pChartObject->FontColorG;
68 68
      $B			= isset($Format["B"]) ? $Format["B"] : $this->pChartObject->FontColorB;
69 69
      $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : $this->pChartObject->FontColorA;
70 70
      $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
71
-     $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 5;
72
-     $Position		= isset($Format["Position"]) ? $Format["Position"] : LABEL_POSITION_TOP;
73
-     $Labels		= isset($Format["Labels"]) ? $Format["Labels"] : NULL;
74
-     $CountOffset	= isset($Format["CountOffset"]) ? $Format["CountOffset"] : 0;
71
+     $Padding = isset($Format["Padding"]) ? $Format["Padding"] : 5;
72
+     $Position = isset($Format["Position"]) ? $Format["Position"] : LABEL_POSITION_TOP;
73
+     $Labels = isset($Format["Labels"]) ? $Format["Labels"] : NULL;
74
+     $CountOffset = isset($Format["CountOffset"]) ? $Format["CountOffset"] : 0;
75 75
 
76
-     if ( $Labels != NULL && !is_array($Labels) ) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
76
+     if ($Labels != NULL && !is_array($Labels)) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
77 77
 
78 78
      $X0    = $this->pChartObject->GraphAreaX1;
79
-     $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
79
+     $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1)/($this->GridSizeX + 1);
80 80
 
81
-     $Settings = array("Angle"=>$Angle,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
82
-     if ( $Position == LABEL_POSITION_TOP )
81
+     $Settings = array("Angle"=>$Angle, "R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha);
82
+     if ($Position == LABEL_POSITION_TOP)
83 83
       {
84
-       $YPos  = $this->pChartObject->GraphAreaY1 - $Padding;
85
-       if ($Angle == 0 ) { $Settings["Align"] = TEXT_ALIGN_BOTTOMMIDDLE; }
86
-       if ($Angle != 0 ) { $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
84
+       $YPos = $this->pChartObject->GraphAreaY1 - $Padding;
85
+       if ($Angle == 0) { $Settings["Align"] = TEXT_ALIGN_BOTTOMMIDDLE; }
86
+       if ($Angle != 0) { $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
87 87
       }
88
-     elseif ( $Position == LABEL_POSITION_BOTTOM )
88
+     elseif ($Position == LABEL_POSITION_BOTTOM)
89 89
       {
90
-       $YPos  = $this->pChartObject->GraphAreaY2 + $Padding;
91
-       if ($Angle == 0 ) { $Settings["Align"] = TEXT_ALIGN_TOPMIDDLE; }
92
-       if ($Angle != 0 ) { $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
90
+       $YPos = $this->pChartObject->GraphAreaY2 + $Padding;
91
+       if ($Angle == 0) { $Settings["Align"] = TEXT_ALIGN_TOPMIDDLE; }
92
+       if ($Angle != 0) { $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
93 93
       }
94 94
      else
95 95
       return(-1);
96 96
 
97
-     for($X=0;$X<=$this->GridSizeX;$X++)
97
+     for ($X = 0; $X <= $this->GridSizeX; $X++)
98 98
       {
99
-       $XPos = floor($X0+$X*$XSize + $XSize/2);
99
+       $XPos = floor($X0 + $X*$XSize + $XSize/2);
100 100
 
101
-       if( $Labels == NULL || !isset($Labels[$X]) )
102
-        $Value = $X+$CountOffset;
101
+       if ($Labels == NULL || !isset($Labels[$X]))
102
+        $Value = $X + $CountOffset;
103 103
        else
104 104
         $Value = $Labels[$X];
105 105
 
106
-       $this->pChartObject->drawText($XPos,$YPos,$Value,$Settings);
106
+       $this->pChartObject->drawText($XPos, $YPos, $Value, $Settings);
107 107
       }
108 108
     }
109 109
 
110 110
    /* Write the Y labels */
111
-   function writeYLabels($Format="")
111
+   function writeYLabels($Format = "")
112 112
     {
113 113
      $R			= isset($Format["R"]) ? $Format["R"] : $this->pChartObject->FontColorR;
114 114
      $G			= isset($Format["G"]) ? $Format["G"] : $this->pChartObject->FontColorG;
115 115
      $B			= isset($Format["B"]) ? $Format["B"] : $this->pChartObject->FontColorB;
116 116
      $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : $this->pChartObject->FontColorA;
117 117
      $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
118
-     $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 5;
119
-     $Position		= isset($Format["Position"]) ? $Format["Position"] : LABEL_POSITION_LEFT;
120
-     $Labels		= isset($Format["Labels"]) ? $Format["Labels"] : NULL;
121
-     $CountOffset	= isset($Format["CountOffset"]) ? $Format["CountOffset"] : 0;
118
+     $Padding = isset($Format["Padding"]) ? $Format["Padding"] : 5;
119
+     $Position = isset($Format["Position"]) ? $Format["Position"] : LABEL_POSITION_LEFT;
120
+     $Labels = isset($Format["Labels"]) ? $Format["Labels"] : NULL;
121
+     $CountOffset = isset($Format["CountOffset"]) ? $Format["CountOffset"] : 0;
122 122
 
123
-     if ( $Labels != NULL && !is_array($Labels) ) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
123
+     if ($Labels != NULL && !is_array($Labels)) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
124 124
 
125 125
      $Y0    = $this->pChartObject->GraphAreaY1;
126
-     $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
126
+     $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1)/($this->GridSizeY + 1);
127 127
 
128
-     $Settings = array("Angle"=>$Angle,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
129
-     if ( $Position == LABEL_POSITION_LEFT )
128
+     $Settings = array("Angle"=>$Angle, "R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha);
129
+     if ($Position == LABEL_POSITION_LEFT)
130 130
       { $XPos  = $this->pChartObject->GraphAreaX1 - $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
131
-     elseif ( $Position == LABEL_POSITION_RIGHT )
131
+     elseif ($Position == LABEL_POSITION_RIGHT)
132 132
       { $XPos  = $this->pChartObject->GraphAreaX2 + $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
133 133
      else
134 134
       return(-1);
135 135
 
136
-     for($Y=0;$Y<=$this->GridSizeY;$Y++)
136
+     for ($Y = 0; $Y <= $this->GridSizeY; $Y++)
137 137
       {
138
-       $YPos = floor($Y0+$Y*$YSize + $YSize/2);
138
+       $YPos = floor($Y0 + $Y*$YSize + $YSize/2);
139 139
 
140
-       if( $Labels == NULL || !isset($Labels[$Y]) )
141
-        $Value = $Y+$CountOffset;
140
+       if ($Labels == NULL || !isset($Labels[$Y]))
141
+        $Value = $Y + $CountOffset;
142 142
        else
143 143
         $Value = $Labels[$Y];
144 144
 
145
-       $this->pChartObject->drawText($XPos,$YPos,$Value,$Settings);
145
+       $this->pChartObject->drawText($XPos, $YPos, $Value, $Settings);
146 146
       }
147 147
     }
148 148
 
149 149
    /* Draw the area arround the specified Threshold */
150
-   function drawContour($Threshold,$Format="")
150
+   function drawContour($Threshold, $Format = "")
151 151
     {
152 152
      $R		= isset($Format["R"]) ? $Format["R"] : 0;
153 153
      $G		= isset($Format["G"]) ? $Format["G"] : 0;
154 154
      $B		= isset($Format["B"]) ? $Format["B"] : 0;
155 155
      $Alpha	= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
156 156
      $Ticks	= isset($Format["Ticks"]) ? $Format["Ticks"] : 3;
157
-     $Padding	= isset($Format["Padding"]) ? $Format["Padding"] : 0;
157
+     $Padding = isset($Format["Padding"]) ? $Format["Padding"] : 0;
158 158
 
159 159
      $X0    = $this->pChartObject->GraphAreaX1;
160 160
      $Y0    = $this->pChartObject->GraphAreaY1;
161
-     $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
162
-     $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
161
+     $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1)/($this->GridSizeX + 1);
162
+     $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1)/($this->GridSizeY + 1);
163 163
 
164
-     $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks);
164
+     $Color = array("R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha, "Ticks"=>$Ticks);
165 165
 
166
-     for($X=0;$X<=$this->GridSizeX;$X++)
166
+     for ($X = 0; $X <= $this->GridSizeX; $X++)
167 167
       {
168
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
168
+       for ($Y = 0; $Y <= $this->GridSizeY; $Y++)
169 169
         {
170 170
          $Value = $this->Points[$X][$Y];
171 171
 
172
-         if ( $Value != UNKNOWN && $Value != IGNORED && $Value >= $Threshold)
172
+         if ($Value != UNKNOWN && $Value != IGNORED && $Value >= $Threshold)
173 173
           {
174
-           $X1 = floor($X0+$X*$XSize)+$Padding;
175
-           $Y1 = floor($Y0+$Y*$YSize)+$Padding;
176
-           $X2 = floor($X0+$X*$XSize+$XSize);
177
-           $Y2 = floor($Y0+$Y*$YSize+$YSize);
178
-
179
-           if ( $X > 0 && $this->Points[$X-1][$Y] != UNKNOWN && $this->Points[$X-1][$Y] != IGNORED && $this->Points[$X-1][$Y] < $Threshold)
180
-            $this->pChartObject->drawLine($X1,$Y1,$X1,$Y2,$Color);
181
-           if ( $Y > 0 && $this->Points[$X][$Y-1] != UNKNOWN && $this->Points[$X][$Y-1] != IGNORED && $this->Points[$X][$Y-1] < $Threshold)
182
-            $this->pChartObject->drawLine($X1,$Y1,$X2,$Y1,$Color);
183
-           if ( $X < $this->GridSizeX && $this->Points[$X+1][$Y] != UNKNOWN && $this->Points[$X+1][$Y] != IGNORED && $this->Points[$X+1][$Y] < $Threshold)
184
-            $this->pChartObject->drawLine($X2,$Y1,$X2,$Y2,$Color);
185
-           if ( $Y < $this->GridSizeY && $this->Points[$X][$Y+1] != UNKNOWN && $this->Points[$X][$Y+1] != IGNORED && $this->Points[$X][$Y+1] < $Threshold)
186
-            $this->pChartObject->drawLine($X1,$Y2,$X2,$Y2,$Color);
174
+           $X1 = floor($X0 + $X*$XSize) + $Padding;
175
+           $Y1 = floor($Y0 + $Y*$YSize) + $Padding;
176
+           $X2 = floor($X0 + $X*$XSize + $XSize);
177
+           $Y2 = floor($Y0 + $Y*$YSize + $YSize);
178
+
179
+           if ($X > 0 && $this->Points[$X - 1][$Y] != UNKNOWN && $this->Points[$X - 1][$Y] != IGNORED && $this->Points[$X - 1][$Y] < $Threshold)
180
+            $this->pChartObject->drawLine($X1, $Y1, $X1, $Y2, $Color);
181
+           if ($Y > 0 && $this->Points[$X][$Y - 1] != UNKNOWN && $this->Points[$X][$Y - 1] != IGNORED && $this->Points[$X][$Y - 1] < $Threshold)
182
+            $this->pChartObject->drawLine($X1, $Y1, $X2, $Y1, $Color);
183
+           if ($X < $this->GridSizeX && $this->Points[$X + 1][$Y] != UNKNOWN && $this->Points[$X + 1][$Y] != IGNORED && $this->Points[$X + 1][$Y] < $Threshold)
184
+            $this->pChartObject->drawLine($X2, $Y1, $X2, $Y2, $Color);
185
+           if ($Y < $this->GridSizeY && $this->Points[$X][$Y + 1] != UNKNOWN && $this->Points[$X][$Y + 1] != IGNORED && $this->Points[$X][$Y + 1] < $Threshold)
186
+            $this->pChartObject->drawLine($X1, $Y2, $X2, $Y2, $Color);
187 187
           }
188 188
         }
189 189
       }
190 190
     }
191 191
 
192 192
    /* Draw the surface chart */
193
-   function drawSurface($Format="")
193
+   function drawSurface($Format = "")
194 194
     {
195 195
      $Palette		= isset($Format["Palette"]) ? $Format["Palette"] : NULL;
196 196
      $ShadeR1		= isset($Format["ShadeR1"]) ? $Format["ShadeR1"] : 77;
@@ -201,51 +201,51 @@  discard block
 block discarded – undo
201 201
      $ShadeG2		= isset($Format["ShadeG2"]) ? $Format["ShadeG2"] : 135;
202 202
      $ShadeB2		= isset($Format["ShadeB2"]) ? $Format["ShadeB2"] : 61;
203 203
      $ShadeA2		= isset($Format["ShadeA2"]) ? $Format["ShadeA2"] : 100;
204
-     $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
204
+     $Border = isset($Format["Border"]) ? $Format["Border"] : FALSE;
205 205
      $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 0;
206 206
      $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 0;
207 207
      $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 0;
208
-     $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : -1;
208
+     $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : -1;
209 209
      $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 1;
210 210
 
211 211
      $X0    = $this->pChartObject->GraphAreaX1;
212 212
      $Y0    = $this->pChartObject->GraphAreaY1;
213
-     $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
214
-     $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
213
+     $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1)/($this->GridSizeX + 1);
214
+     $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1)/($this->GridSizeY + 1);
215 215
 
216
-     for($X=0;$X<=$this->GridSizeX;$X++)
216
+     for ($X = 0; $X <= $this->GridSizeX; $X++)
217 217
       {
218
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
218
+       for ($Y = 0; $Y <= $this->GridSizeY; $Y++)
219 219
         {
220 220
          $Value = $this->Points[$X][$Y];
221 221
 
222
-         if ( $Value != UNKNOWN && $Value != IGNORED )
222
+         if ($Value != UNKNOWN && $Value != IGNORED)
223 223
           {
224
-           $X1 = floor($X0+$X*$XSize)+$Padding;
225
-           $Y1 = floor($Y0+$Y*$YSize)+$Padding;
226
-           $X2 = floor($X0+$X*$XSize+$XSize);
227
-           $Y2 = floor($Y0+$Y*$YSize+$YSize);
224
+           $X1 = floor($X0 + $X*$XSize) + $Padding;
225
+           $Y1 = floor($Y0 + $Y*$YSize) + $Padding;
226
+           $X2 = floor($X0 + $X*$XSize + $XSize);
227
+           $Y2 = floor($Y0 + $Y*$YSize + $YSize);
228 228
 
229
-           if ( $Palette != NULL )
229
+           if ($Palette != NULL)
230 230
             {
231
-             if ( isset($Palette[$Value]) && isset($Palette[$Value]["R"]) ) { $R = $Palette[$Value]["R"]; } else { $R = 0; }
232
-             if ( isset($Palette[$Value]) && isset($Palette[$Value]["G"]) ) { $G = $Palette[$Value]["G"]; } else { $G = 0; }
233
-             if ( isset($Palette[$Value]) && isset($Palette[$Value]["B"]) ) { $B = $Palette[$Value]["B"]; } else { $B = 0; }
234
-             if ( isset($Palette[$Value]) && isset($Palette[$Value]["Alpha"]) ) { $Alpha = $Palette[$Value]["Alpha"]; } else { $Alpha = 1000; }
231
+             if (isset($Palette[$Value]) && isset($Palette[$Value]["R"])) { $R = $Palette[$Value]["R"]; } else { $R = 0; }
232
+             if (isset($Palette[$Value]) && isset($Palette[$Value]["G"])) { $G = $Palette[$Value]["G"]; } else { $G = 0; }
233
+             if (isset($Palette[$Value]) && isset($Palette[$Value]["B"])) { $B = $Palette[$Value]["B"]; } else { $B = 0; }
234
+             if (isset($Palette[$Value]) && isset($Palette[$Value]["Alpha"])) { $Alpha = $Palette[$Value]["Alpha"]; } else { $Alpha = 1000; }
235 235
             }
236 236
            else
237 237
             {
238
-             $R = (($ShadeR2-$ShadeR1)/100)*$Value + $ShadeR1;
239
-             $G = (($ShadeG2-$ShadeG1)/100)*$Value + $ShadeG1;
240
-             $B = (($ShadeB2-$ShadeB1)/100)*$Value + $ShadeB1;
241
-             $Alpha = (($ShadeA2-$ShadeA1)/100)*$Value + $ShadeA1;
238
+             $R = (($ShadeR2 - $ShadeR1)/100)*$Value + $ShadeR1;
239
+             $G = (($ShadeG2 - $ShadeG1)/100)*$Value + $ShadeG1;
240
+             $B = (($ShadeB2 - $ShadeB1)/100)*$Value + $ShadeB1;
241
+             $Alpha = (($ShadeA2 - $ShadeA1)/100)*$Value + $ShadeA1;
242 242
             }
243 243
 
244
-           $Settings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
245
-           if ( $Border ) { $Settings["BorderR"] = $BorderR; $Settings["BorderG"] = $BorderG; $Settings["BorderB"] = $BorderB; }
246
-           if ( $Surrounding != -1 ) { $Settings["BorderR"] = $R+$Surrounding; $Settings["BorderG"] = $G+$Surrounding; $Settings["BorderB"] = $B+$Surrounding; }
244
+           $Settings = array("R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha);
245
+           if ($Border) { $Settings["BorderR"] = $BorderR; $Settings["BorderG"] = $BorderG; $Settings["BorderB"] = $BorderB; }
246
+           if ($Surrounding != -1) { $Settings["BorderR"] = $R + $Surrounding; $Settings["BorderG"] = $G + $Surrounding; $Settings["BorderB"] = $B + $Surrounding; }
247 247
 
248
-           $this->pChartObject->drawFilledRectangle($X1,$Y1,$X2-1,$Y2-1,$Settings);
248
+           $this->pChartObject->drawFilledRectangle($X1, $Y1, $X2 - 1, $Y2 - 1, $Settings);
249 249
           }
250 250
         }
251 251
       }
@@ -255,57 +255,57 @@  discard block
 block discarded – undo
255 255
    function computeMissing()
256 256
     {
257 257
      $Missing = "";
258
-     for($X=0;$X<=$this->GridSizeX;$X++)
258
+     for ($X = 0; $X <= $this->GridSizeX; $X++)
259 259
       {
260
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
260
+       for ($Y = 0; $Y <= $this->GridSizeY; $Y++)
261 261
         {
262
-         if ( $this->Points[$X][$Y] == UNKNOWN )
262
+         if ($this->Points[$X][$Y] == UNKNOWN)
263 263
           $Missing[] = $X.",".$Y;
264 264
         }
265 265
       }
266 266
      shuffle($Missing);
267 267
      
268
-     foreach($Missing as $Key => $Pos)
268
+     foreach ($Missing as $Key => $Pos)
269 269
       {
270
-       $Pos = preg_split("/,/",$Pos);
270
+       $Pos = preg_split("/,/", $Pos);
271 271
        $X   = $Pos[0];
272 272
        $Y   = $Pos[1];
273 273
 
274
-       if ( $this->Points[$X][$Y] == UNKNOWN )
274
+       if ($this->Points[$X][$Y] == UNKNOWN)
275 275
         {
276
-         $NearestNeighbor = $this->getNearestNeighbor($X,$Y);
276
+         $NearestNeighbor = $this->getNearestNeighbor($X, $Y);
277 277
 
278 278
          $Value = 0; $Points = 0;
279
-         for($Xi=$X-$NearestNeighbor;$Xi<=$X+$NearestNeighbor;$Xi++)
279
+         for ($Xi = $X - $NearestNeighbor; $Xi <= $X + $NearestNeighbor; $Xi++)
280 280
           {
281
-           for($Yi=$Y-$NearestNeighbor;$Yi<=$Y+$NearestNeighbor;$Yi++)
281
+           for ($Yi = $Y - $NearestNeighbor; $Yi <= $Y + $NearestNeighbor; $Yi++)
282 282
             {
283
-             if ($Xi >=0 && $Yi >= 0 && $Xi <= $this->GridSizeX && $Yi <= $this->GridSizeY && $this->Points[$Xi][$Yi] != UNKNOWN && $this->Points[$Xi][$Yi] != IGNORED)
283
+             if ($Xi >= 0 && $Yi >= 0 && $Xi <= $this->GridSizeX && $Yi <= $this->GridSizeY && $this->Points[$Xi][$Yi] != UNKNOWN && $this->Points[$Xi][$Yi] != IGNORED)
284 284
               {
285 285
                $Value = $Value + $this->Points[$Xi][$Yi]; $Points++;
286 286
               }
287 287
             }
288 288
           }
289 289
 
290
-         if ( $Points != 0 ) { $this->Points[$X][$Y] = $Value / $Points; }
290
+         if ($Points != 0) { $this->Points[$X][$Y] = $Value/$Points; }
291 291
         }
292 292
       }
293 293
     }
294 294
 
295 295
    /* Return the nearest Neighbor distance of a point */
296
-   function getNearestNeighbor($Xp,$Yp)
296
+   function getNearestNeighbor($Xp, $Yp)
297 297
     {
298 298
      $Nearest = UNKNOWN;
299
-     for($X=0;$X<=$this->GridSizeX;$X++)
299
+     for ($X = 0; $X <= $this->GridSizeX; $X++)
300 300
       {
301
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
301
+       for ($Y = 0; $Y <= $this->GridSizeY; $Y++)
302 302
         {
303
-         if ( $this->Points[$X][$Y] != UNKNOWN && $this->Points[$X][$Y] != IGNORED )
303
+         if ($this->Points[$X][$Y] != UNKNOWN && $this->Points[$X][$Y] != IGNORED)
304 304
           {
305
-           $DistanceX = max($Xp,$X)-min($Xp,$X);
306
-           $DistanceY = max($Yp,$Y)-min($Yp,$Y);
307
-           $Distance  = max($DistanceX,$DistanceY);
308
-           if ( $Distance < $Nearest || $Nearest == UNKNOWN ) { $Nearest = $Distance; }
305
+           $DistanceX = max($Xp, $X) - min($Xp, $X);
306
+           $DistanceY = max($Yp, $Y) - min($Yp, $Y);
307
+           $Distance  = max($DistanceX, $DistanceY);
308
+           if ($Distance < $Nearest || $Nearest == UNKNOWN) { $Nearest = $Distance; }
309 309
           }
310 310
         }
311 311
       }
Please login to merge, or discard this patch.
Braces   +35 added lines, -72 removed lines patch added patch discarded remove patch
@@ -22,24 +22,21 @@  discard block
 block discarded – undo
22 22
  define("LABEL_POSITION_BOTTOM"	, 880004);
23 23
 
24 24
  /* pStock class definition */
25
- class pSurface
26
-  {
25
+ class pSurface {
27 26
    var $pChartObject;
28 27
    var $GridSizeX;
29 28
    var $GridSizeY;
30 29
    var $Points;
31 30
 
32 31
    /* Class creator */
33
-   function pSurface($pChartObject)
34
-    {
32
+   function pSurface($pChartObject) {
35 33
      $this->pChartObject = $pChartObject;
36 34
      $this->GridSize     = 10;
37 35
      $this->Points       = "";
38 36
     }
39 37
 
40 38
    /* Define the grid size and initialise the 2D matrix */
41
-   function setGrid($XSize=10,$YSize=10)
42
-    {
39
+   function setGrid($XSize=10,$YSize=10) {
43 40
      for($X=0; $X<=$XSize; $X++) { for($Y=0; $Y<=$YSize; $Y++) { $this->Points[$X][$Y]=UNKNOWN; } } 
44 41
 
45 42
      $this->GridSizeX = $XSize;
@@ -47,8 +44,7 @@  discard block
 block discarded – undo
47 44
     }
48 45
 
49 46
    /* Add a point on the grid */
50
-   function addPoint($X,$Y,$Value,$Force=TRUE)
51
-    {
47
+   function addPoint($X,$Y,$Value,$Force=TRUE) {
52 48
      if ( $X < 0 || $X >$this->GridSizeX ) { return(0); }
53 49
      if ( $Y < 0 || $Y >$this->GridSizeY ) { return(0); }
54 50
 
@@ -61,8 +57,7 @@  discard block
 block discarded – undo
61 57
     }
62 58
 
63 59
    /* Write the X labels */
64
-   function writeXLabels($Format="")
65
-    {
60
+   function writeXLabels($Format="") {
66 61
      $R			= isset($Format["R"]) ? $Format["R"] : $this->pChartObject->FontColorR;
67 62
      $G			= isset($Format["G"]) ? $Format["G"] : $this->pChartObject->FontColorG;
68 63
      $B			= isset($Format["B"]) ? $Format["B"] : $this->pChartObject->FontColorB;
@@ -79,23 +74,18 @@  discard block
 block discarded – undo
79 74
      $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
80 75
 
81 76
      $Settings = array("Angle"=>$Angle,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
82
-     if ( $Position == LABEL_POSITION_TOP )
83
-      {
77
+     if ( $Position == LABEL_POSITION_TOP ) {
84 78
        $YPos  = $this->pChartObject->GraphAreaY1 - $Padding;
85 79
        if ($Angle == 0 ) { $Settings["Align"] = TEXT_ALIGN_BOTTOMMIDDLE; }
86 80
        if ($Angle != 0 ) { $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
87
-      }
88
-     elseif ( $Position == LABEL_POSITION_BOTTOM )
89
-      {
81
+      } elseif ( $Position == LABEL_POSITION_BOTTOM ) {
90 82
        $YPos  = $this->pChartObject->GraphAreaY2 + $Padding;
91 83
        if ($Angle == 0 ) { $Settings["Align"] = TEXT_ALIGN_TOPMIDDLE; }
92 84
        if ($Angle != 0 ) { $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
93
-      }
94
-     else
85
+      } else
95 86
       return(-1);
96 87
 
97
-     for($X=0;$X<=$this->GridSizeX;$X++)
98
-      {
88
+     for($X=0;$X<=$this->GridSizeX;$X++) {
99 89
        $XPos = floor($X0+$X*$XSize + $XSize/2);
100 90
 
101 91
        if( $Labels == NULL || !isset($Labels[$X]) )
@@ -108,8 +98,7 @@  discard block
 block discarded – undo
108 98
     }
109 99
 
110 100
    /* Write the Y labels */
111
-   function writeYLabels($Format="")
112
-    {
101
+   function writeYLabels($Format="") {
113 102
      $R			= isset($Format["R"]) ? $Format["R"] : $this->pChartObject->FontColorR;
114 103
      $G			= isset($Format["G"]) ? $Format["G"] : $this->pChartObject->FontColorG;
115 104
      $B			= isset($Format["B"]) ? $Format["B"] : $this->pChartObject->FontColorB;
@@ -127,14 +116,11 @@  discard block
 block discarded – undo
127 116
 
128 117
      $Settings = array("Angle"=>$Angle,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
129 118
      if ( $Position == LABEL_POSITION_LEFT )
130
-      { $XPos  = $this->pChartObject->GraphAreaX1 - $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
131
-     elseif ( $Position == LABEL_POSITION_RIGHT )
132
-      { $XPos  = $this->pChartObject->GraphAreaX2 + $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
133
-     else
119
+      { $XPos  = $this->pChartObject->GraphAreaX1 - $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT; } elseif ( $Position == LABEL_POSITION_RIGHT )
120
+      { $XPos  = $this->pChartObject->GraphAreaX2 + $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT; } else
134 121
       return(-1);
135 122
 
136
-     for($Y=0;$Y<=$this->GridSizeY;$Y++)
137
-      {
123
+     for($Y=0;$Y<=$this->GridSizeY;$Y++) {
138 124
        $YPos = floor($Y0+$Y*$YSize + $YSize/2);
139 125
 
140 126
        if( $Labels == NULL || !isset($Labels[$Y]) )
@@ -147,8 +133,7 @@  discard block
 block discarded – undo
147 133
     }
148 134
 
149 135
    /* Draw the area arround the specified Threshold */
150
-   function drawContour($Threshold,$Format="")
151
-    {
136
+   function drawContour($Threshold,$Format="") {
152 137
      $R		= isset($Format["R"]) ? $Format["R"] : 0;
153 138
      $G		= isset($Format["G"]) ? $Format["G"] : 0;
154 139
      $B		= isset($Format["B"]) ? $Format["B"] : 0;
@@ -163,14 +148,11 @@  discard block
 block discarded – undo
163 148
 
164 149
      $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks);
165 150
 
166
-     for($X=0;$X<=$this->GridSizeX;$X++)
167
-      {
168
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
169
-        {
151
+     for($X=0;$X<=$this->GridSizeX;$X++) {
152
+       for($Y=0;$Y<=$this->GridSizeY;$Y++) {
170 153
          $Value = $this->Points[$X][$Y];
171 154
 
172
-         if ( $Value != UNKNOWN && $Value != IGNORED && $Value >= $Threshold)
173
-          {
155
+         if ( $Value != UNKNOWN && $Value != IGNORED && $Value >= $Threshold) {
174 156
            $X1 = floor($X0+$X*$XSize)+$Padding;
175 157
            $Y1 = floor($Y0+$Y*$YSize)+$Padding;
176 158
            $X2 = floor($X0+$X*$XSize+$XSize);
@@ -190,8 +172,7 @@  discard block
 block discarded – undo
190 172
     }
191 173
 
192 174
    /* Draw the surface chart */
193
-   function drawSurface($Format="")
194
-    {
175
+   function drawSurface($Format="") {
195 176
      $Palette		= isset($Format["Palette"]) ? $Format["Palette"] : NULL;
196 177
      $ShadeR1		= isset($Format["ShadeR1"]) ? $Format["ShadeR1"] : 77;
197 178
      $ShadeG1		= isset($Format["ShadeG1"]) ? $Format["ShadeG1"] : 205;
@@ -213,28 +194,22 @@  discard block
 block discarded – undo
213 194
      $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
214 195
      $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
215 196
 
216
-     for($X=0;$X<=$this->GridSizeX;$X++)
217
-      {
218
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
219
-        {
197
+     for($X=0;$X<=$this->GridSizeX;$X++) {
198
+       for($Y=0;$Y<=$this->GridSizeY;$Y++) {
220 199
          $Value = $this->Points[$X][$Y];
221 200
 
222
-         if ( $Value != UNKNOWN && $Value != IGNORED )
223
-          {
201
+         if ( $Value != UNKNOWN && $Value != IGNORED ) {
224 202
            $X1 = floor($X0+$X*$XSize)+$Padding;
225 203
            $Y1 = floor($Y0+$Y*$YSize)+$Padding;
226 204
            $X2 = floor($X0+$X*$XSize+$XSize);
227 205
            $Y2 = floor($Y0+$Y*$YSize+$YSize);
228 206
 
229
-           if ( $Palette != NULL )
230
-            {
207
+           if ( $Palette != NULL ) {
231 208
              if ( isset($Palette[$Value]) && isset($Palette[$Value]["R"]) ) { $R = $Palette[$Value]["R"]; } else { $R = 0; }
232 209
              if ( isset($Palette[$Value]) && isset($Palette[$Value]["G"]) ) { $G = $Palette[$Value]["G"]; } else { $G = 0; }
233 210
              if ( isset($Palette[$Value]) && isset($Palette[$Value]["B"]) ) { $B = $Palette[$Value]["B"]; } else { $B = 0; }
234 211
              if ( isset($Palette[$Value]) && isset($Palette[$Value]["Alpha"]) ) { $Alpha = $Palette[$Value]["Alpha"]; } else { $Alpha = 1000; }
235
-            }
236
-           else
237
-            {
212
+            } else {
238 213
              $R = (($ShadeR2-$ShadeR1)/100)*$Value + $ShadeR1;
239 214
              $G = (($ShadeG2-$ShadeG1)/100)*$Value + $ShadeG1;
240 215
              $B = (($ShadeB2-$ShadeB1)/100)*$Value + $ShadeB1;
@@ -252,36 +227,28 @@  discard block
 block discarded – undo
252 227
     }
253 228
 
254 229
    /* Compute the missing points */
255
-   function computeMissing()
256
-    {
230
+   function computeMissing() {
257 231
      $Missing = "";
258
-     for($X=0;$X<=$this->GridSizeX;$X++)
259
-      {
260
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
261
-        {
232
+     for($X=0;$X<=$this->GridSizeX;$X++) {
233
+       for($Y=0;$Y<=$this->GridSizeY;$Y++) {
262 234
          if ( $this->Points[$X][$Y] == UNKNOWN )
263 235
           $Missing[] = $X.",".$Y;
264 236
         }
265 237
       }
266 238
      shuffle($Missing);
267 239
      
268
-     foreach($Missing as $Key => $Pos)
269
-      {
240
+     foreach($Missing as $Key => $Pos) {
270 241
        $Pos = preg_split("/,/",$Pos);
271 242
        $X   = $Pos[0];
272 243
        $Y   = $Pos[1];
273 244
 
274
-       if ( $this->Points[$X][$Y] == UNKNOWN )
275
-        {
245
+       if ( $this->Points[$X][$Y] == UNKNOWN ) {
276 246
          $NearestNeighbor = $this->getNearestNeighbor($X,$Y);
277 247
 
278 248
          $Value = 0; $Points = 0;
279
-         for($Xi=$X-$NearestNeighbor;$Xi<=$X+$NearestNeighbor;$Xi++)
280
-          {
281
-           for($Yi=$Y-$NearestNeighbor;$Yi<=$Y+$NearestNeighbor;$Yi++)
282
-            {
283
-             if ($Xi >=0 && $Yi >= 0 && $Xi <= $this->GridSizeX && $Yi <= $this->GridSizeY && $this->Points[$Xi][$Yi] != UNKNOWN && $this->Points[$Xi][$Yi] != IGNORED)
284
-              {
249
+         for($Xi=$X-$NearestNeighbor;$Xi<=$X+$NearestNeighbor;$Xi++) {
250
+           for($Yi=$Y-$NearestNeighbor;$Yi<=$Y+$NearestNeighbor;$Yi++) {
251
+             if ($Xi >=0 && $Yi >= 0 && $Xi <= $this->GridSizeX && $Yi <= $this->GridSizeY && $this->Points[$Xi][$Yi] != UNKNOWN && $this->Points[$Xi][$Yi] != IGNORED) {
285 252
                $Value = $Value + $this->Points[$Xi][$Yi]; $Points++;
286 253
               }
287 254
             }
@@ -293,15 +260,11 @@  discard block
 block discarded – undo
293 260
     }
294 261
 
295 262
    /* Return the nearest Neighbor distance of a point */
296
-   function getNearestNeighbor($Xp,$Yp)
297
-    {
263
+   function getNearestNeighbor($Xp,$Yp) {
298 264
      $Nearest = UNKNOWN;
299
-     for($X=0;$X<=$this->GridSizeX;$X++)
300
-      {
301
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
302
-        {
303
-         if ( $this->Points[$X][$Y] != UNKNOWN && $this->Points[$X][$Y] != IGNORED )
304
-          {
265
+     for($X=0;$X<=$this->GridSizeX;$X++) {
266
+       for($Y=0;$Y<=$this->GridSizeY;$Y++) {
267
+         if ( $this->Points[$X][$Y] != UNKNOWN && $this->Points[$X][$Y] != IGNORED ) {
305 268
            $DistanceX = max($Xp,$X)-min($Xp,$X);
306 269
            $DistanceY = max($Yp,$Y)-min($Yp,$Y);
307 270
            $Distance  = max($DistanceX,$DistanceY);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     }
48 48
 
49 49
    /* Add a point on the grid */
50
-   function addPoint($X,$Y,$Value,$Force=TRUE)
50
+   function addPoint($X,$Y,$Value,$Force=true)
51 51
     {
52 52
      if ( $X < 0 || $X >$this->GridSizeX ) { return(0); }
53 53
      if ( $Y < 0 || $Y >$this->GridSizeY ) { return(0); }
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
      $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
71 71
      $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 5;
72 72
      $Position		= isset($Format["Position"]) ? $Format["Position"] : LABEL_POSITION_TOP;
73
-     $Labels		= isset($Format["Labels"]) ? $Format["Labels"] : NULL;
73
+     $Labels		= isset($Format["Labels"]) ? $Format["Labels"] : null;
74 74
      $CountOffset	= isset($Format["CountOffset"]) ? $Format["CountOffset"] : 0;
75 75
 
76
-     if ( $Labels != NULL && !is_array($Labels) ) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
76
+     if ( $Labels != null && !is_array($Labels) ) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
77 77
 
78 78
      $X0    = $this->pChartObject->GraphAreaX1;
79 79
      $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
       {
99 99
        $XPos = floor($X0+$X*$XSize + $XSize/2);
100 100
 
101
-       if( $Labels == NULL || !isset($Labels[$X]) )
101
+       if( $Labels == null || !isset($Labels[$X]) )
102 102
         $Value = $X+$CountOffset;
103 103
        else
104 104
         $Value = $Labels[$X];
@@ -117,10 +117,10 @@  discard block
 block discarded – undo
117 117
      $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
118 118
      $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 5;
119 119
      $Position		= isset($Format["Position"]) ? $Format["Position"] : LABEL_POSITION_LEFT;
120
-     $Labels		= isset($Format["Labels"]) ? $Format["Labels"] : NULL;
120
+     $Labels		= isset($Format["Labels"]) ? $Format["Labels"] : null;
121 121
      $CountOffset	= isset($Format["CountOffset"]) ? $Format["CountOffset"] : 0;
122 122
 
123
-     if ( $Labels != NULL && !is_array($Labels) ) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
123
+     if ( $Labels != null && !is_array($Labels) ) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
124 124
 
125 125
      $Y0    = $this->pChartObject->GraphAreaY1;
126 126
      $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
       {
138 138
        $YPos = floor($Y0+$Y*$YSize + $YSize/2);
139 139
 
140
-       if( $Labels == NULL || !isset($Labels[$Y]) )
140
+       if( $Labels == null || !isset($Labels[$Y]) )
141 141
         $Value = $Y+$CountOffset;
142 142
        else
143 143
         $Value = $Labels[$Y];
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
    /* Draw the surface chart */
193 193
    function drawSurface($Format="")
194 194
     {
195
-     $Palette		= isset($Format["Palette"]) ? $Format["Palette"] : NULL;
195
+     $Palette		= isset($Format["Palette"]) ? $Format["Palette"] : null;
196 196
      $ShadeR1		= isset($Format["ShadeR1"]) ? $Format["ShadeR1"] : 77;
197 197
      $ShadeG1		= isset($Format["ShadeG1"]) ? $Format["ShadeG1"] : 205;
198 198
      $ShadeB1		= isset($Format["ShadeB1"]) ? $Format["ShadeB1"] : 21;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
      $ShadeG2		= isset($Format["ShadeG2"]) ? $Format["ShadeG2"] : 135;
202 202
      $ShadeB2		= isset($Format["ShadeB2"]) ? $Format["ShadeB2"] : 61;
203 203
      $ShadeA2		= isset($Format["ShadeA2"]) ? $Format["ShadeA2"] : 100;
204
-     $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
204
+     $Border		= isset($Format["Border"]) ? $Format["Border"] : false;
205 205
      $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 0;
206 206
      $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 0;
207 207
      $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 0;
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
            $X2 = floor($X0+$X*$XSize+$XSize);
227 227
            $Y2 = floor($Y0+$Y*$YSize+$YSize);
228 228
 
229
-           if ( $Palette != NULL )
229
+           if ( $Palette != null )
230 230
             {
231 231
              if ( isset($Palette[$Value]) && isset($Palette[$Value]["R"]) ) { $R = $Palette[$Value]["R"]; } else { $R = 0; }
232 232
              if ( isset($Palette[$Value]) && isset($Palette[$Value]["G"]) ) { $G = $Palette[$Value]["G"]; } else { $G = 0; }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincstats/boincstats.admin.inc 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -8,38 +8,38 @@  discard block
 block discarded – undo
8 8
 
9 9
 
10 10
 /**
11
-  * The BOINC stats configuration determines where statistics are sourced
12
-  */
11
+ * The BOINC stats configuration determines where statistics are sourced
12
+ */
13 13
 function boincstats_admin_stats_system(&$form_state) {
14
-  $form = array();
15
-  $default = array(
14
+    $form = array();
15
+    $default = array(
16 16
     'boinc_stats_server' => variable_get('boinc_stats_server', 'stats.gridrepublic.org'),
17 17
     'boinc_stats_project_list_rpc' => variable_get('boinc_stats_project_list_rpc', 'rpc/get_projects.php'),
18 18
     'boinc_stats_project_credit_history_rpc' => variable_get('boinc_stats_project_credit_history_rpc', 'rpc/get_project_tc_history.php'),
19 19
     'boinc_stats_user_credit_history_rpc' => variable_get('boinc_stats_user_credit_history_rpc', 'rpc/get_user_credit_history_by_project.php'),
20 20
     'boinc_stats_remote_project_id' => variable_get('boinc_stats_remote_project_id', ''),
21
-  );
22
-  // Define the form
23
-  $form['boinc_stats_server'] = array(
21
+    );
22
+    // Define the form
23
+    $form['boinc_stats_server'] = array(
24 24
     '#type' => 'value',
25 25
     '#value' => $default['boinc_stats_server']
26
-  );
27
-  $form['boinc_stats_project_list_rpc'] = array(
26
+    );
27
+    $form['boinc_stats_project_list_rpc'] = array(
28 28
     '#type' => 'value',
29 29
     '#value' => $default['boinc_stats_project_list_rpc']
30
-  );
31
-  $form['boinc_stats_project_credit_history_rpc'] = array(
30
+    );
31
+    $form['boinc_stats_project_credit_history_rpc'] = array(
32 32
     '#type' => 'value',
33 33
     '#value' => $default['boinc_stats_project_credit_history_rpc']
34
-  );
35
-  $form['boinc_stats_user_credit_history_rpc'] = array(
34
+    );
35
+    $form['boinc_stats_user_credit_history_rpc'] = array(
36 36
     '#type' => 'value',
37 37
     '#value' => $default['boinc_stats_user_credit_history_rpc']
38
-  );
39
-  $form['boinc_stats_remote_project_id'] = array(
38
+    );
39
+    $form['boinc_stats_remote_project_id'] = array(
40 40
     '#type' => 'textfield',
41 41
     '#title' => t('Stats ID for @project', array(
42
-      '@project' => variable_get('site_name', t('this project')))),
42
+        '@project' => variable_get('site_name', t('this project')))),
43 43
     '#default_value' => $default['boinc_stats_remote_project_id'], 
44 44
     '#description' => t('This project must be registered with a stats system in
45 45
       order for some statistics to be available. Currently only one system is
@@ -47,26 +47,26 @@  discard block
 block discarded – undo
47 47
         '!find_project_id' => l(t('Find your project ID'),
48 48
         "http://{$default['boinc_stats_server']}/{$default['boinc_stats_project_list_rpc']}",
49 49
         array('attributes' => array('target' => 'external')))
50
-      )
50
+        )
51 51
     )
52
-  );
53
-  return system_settings_form($form);
52
+    );
53
+    return system_settings_form($form);
54 54
 }
55 55
 
56 56
 /**
57
-  * Validate the BOINC stats form.
58
-  */
57
+ * Validate the BOINC stats form.
58
+ */
59 59
 function boincstats_admin_stats_system_validate($form, &$form_state) {
60
-  $values = $form_state['values'];
61
-  if (!$values['boinc_stats_remote_project_id']) {
60
+    $values = $form_state['values'];
61
+    if (!$values['boinc_stats_remote_project_id']) {
62 62
     form_set_error('boinc_stats_remote_project_id',
63
-      t('Stats may not work without a valid stats ID configured!'));
64
-  }
63
+        t('Stats may not work without a valid stats ID configured!'));
64
+    }
65 65
 }
66 66
 
67 67
 /**
68
-  * Handle post-validation submission of BOINC stats form.
69
-  */
68
+ * Handle post-validation submission of BOINC stats form.
69
+ */
70 70
 function boincstats_admin_stats_system_submit($form, &$form_state) {
71
-  drupal_set_message(t('Stats system configuration has been updated.'));
71
+    drupal_set_message(t('Stats system configuration has been updated.'));
72 72
 }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincteam/includes/boincteam.forms.inc 4 patches
Indentation   +234 added lines, -234 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
  * The definition of the create team form
15 15
  */
16 16
 function boincteam_create_form(&$form_state) {
17
-  $form = array();
17
+    $form = array();
18 18
   
19
-  $default = array(
19
+    $default = array(
20 20
     'name' => '',
21 21
     'name_html' => '',
22 22
     'website' => '',
@@ -24,105 +24,105 @@  discard block
 block discarded – undo
24 24
     'country' => 0,
25 25
     'joinable' => TRUE,
26 26
     'description' => '',
27
-  );
27
+    );
28 28
   
29
-  // Standard option sets
30
-  $form['boolean_options'] = array(
29
+    // Standard option sets
30
+    $form['boolean_options'] = array(
31 31
     '#type' => 'value',
32 32
     '#value' => array(1 => bts('yes'), 0 => bts('no')),
33
-  );
33
+    );
34 34
   
35
-  // Vocabulary based option sets
36
-  $form['type_options'] = array(
35
+    // Vocabulary based option sets
36
+    $form['type_options'] = array(
37 37
     '#type' => 'value',
38 38
     '#value' => array(0 => bts('Choose type'))
39
-  );
40
-  $vocabs = taxonomy_get_vocabularies(NULL);
41
-  foreach ($vocabs as $vocab) {
39
+    );
40
+    $vocabs = taxonomy_get_vocabularies(NULL);
41
+    foreach ($vocabs as $vocab) {
42 42
     switch ($vocab->name) {
43 43
     case 'Teams':
44 44
       $team_types = taxonomy_get_tree($vocab->vid);
45
-      if (module_exists('internationalization')) {
45
+        if (module_exists('internationalization')) {
46 46
         $team_types = i18ntaxonomy_localize_terms($team_types);
47
-      }
48
-      foreach ($team_types as $team_type) {
47
+        }
48
+        foreach ($team_types as $team_type) {
49 49
         $form['type_options']['#value'][$team_type->tid] = $team_type->name;
50
-      }
51
-      break;
50
+        }
51
+        break;
52 52
     default:
53 53
     }
54
-  }
55
-  $form['country_options'] = array(
54
+    }
55
+    $form['country_options'] = array(
56 56
     '#type' => 'value',
57 57
     '#value' => boinccore_get_country_list(),
58
-  );
58
+    );
59 59
   
60
-  // Form elements
61
-  $form['name'] = array(
60
+    // Form elements
61
+    $form['name'] = array(
62 62
     '#title' => bts('Team name'),
63 63
     '#type' => 'textfield',
64 64
     '#default_value' => $default['name'],
65 65
     '#size' => 34,
66 66
     '#description' => bts('Text only, no HTML tags'),
67
-  );
68
-  $form['name_html'] = array(
67
+    );
68
+    $form['name_html'] = array(
69 69
     '#title' => bts('Team name -- HTML version (optional)'),
70 70
     '#type' => 'textfield',
71 71
     '#default_value' => $default['name_html'],
72 72
     '#size' => 34,
73 73
     '#description' => bts('You may use limited HTML tags'),
74
-  );
75
-  $form['website'] = array(
74
+    );
75
+    $form['website'] = array(
76 76
     '#title' => bts('Team website (optional)'),
77 77
     '#type' => 'textfield',
78 78
     '#default_value' => $default['website'],
79 79
     '#size' => 34,
80 80
     '#description' => bts("Displayed on the team's page"),
81
-  );
82
-  $form['type'] = array(
81
+    );
82
+    $form['type'] = array(
83 83
     '#title' => bts('Type of team'),
84 84
     '#type' => 'select',
85 85
     '#options' => $form['type_options']['#value'],
86 86
     '#default_value' => $default['type'],
87
-  );
88
-  $form['country'] = array(
87
+    );
88
+    $form['country'] = array(
89 89
     '#title' => bts('Country'),
90 90
     '#type' => 'select',
91 91
     '#options' => $form['country_options']['#value'],
92 92
     '#default_value' => $default['country'],
93
-  );
94
-  $form['joinable'] = array(
93
+    );
94
+    $form['joinable'] = array(
95 95
     '#title' => bts('Accept new members?'),
96 96
     '#type' => 'radios',
97 97
     '#options' => $form['boolean_options']['#value'],
98 98
     '#attributes' => array('class' => 'fancy'),
99 99
     '#default_value' => $default['joinable'],
100 100
     '#size' => 34,
101
-  );
102
-  $form['description'] = array(
101
+    );
102
+    $form['description'] = array(
103 103
     '#title' => bts('Description of team'),
104 104
     '#type' => 'textarea',
105 105
     '#default_value' => $default['description'],
106 106
     '#size' => 5,
107 107
     '#description' => NULL,
108
-  );
109
-  $form['format'] = filter_form();
108
+    );
109
+    $form['format'] = filter_form();
110 110
   
111
-  // Form control
112
-  $form['form control tabs prefix'] = array(
111
+    // Form control
112
+    $form['form control tabs prefix'] = array(
113 113
     '#value' => '<ul class="form-control tab-list">'
114
-  );
115
-  $form['submit'] = array(
114
+    );
115
+    $form['submit'] = array(
116 116
     '#prefix' => '<li class="first tab">',
117 117
     '#type' => 'submit',
118 118
     '#value' => bts('Save team'),
119 119
     '#suffix' => '</li>',
120
-  );
121
-  $form['form control tabs'] = array(
120
+    );
121
+    $form['form control tabs'] = array(
122 122
     '#value' => '<li class="tab">' . l(bts('Cancel'), $_GET['q']) . '</li>'
123
-  );
123
+    );
124 124
   
125
-  return $form;
125
+    return $form;
126 126
 }
127 127
 
128 128
 /**
@@ -130,41 +130,41 @@  discard block
 block discarded – undo
130 130
  */
131 131
 function boincteam_create_form_validate($form, &$form_state) {
132 132
 
133
-  $values = $form_state['values'];
134
-  $name = $values['name'];
133
+    $values = $form_state['values'];
134
+    $name = $values['name'];
135 135
   
136
-  if (!$name) {
136
+    if (!$name) {
137 137
     form_set_error('name', bts('Team name is required.'));
138
-  }
139
-  else {
138
+    }
139
+    else {
140 140
     require_boinc('boinc_db');
141 141
     if (BoincTeam::lookup_name($name)) {
142
-      form_set_error('name', bts('A team named "@name" already exists.',
142
+        form_set_error('name', bts('A team named "@name" already exists.',
143 143
         array('@name' => $name)));
144 144
     }
145
-  }
145
+    }
146 146
   
147
-  if (!$values['type'] OR !isset($values['type_options'][$values['type']])) {
147
+    if (!$values['type'] OR !isset($values['type_options'][$values['type']])) {
148 148
     form_set_error('type', bts('Please select a team type.'));
149
-  }
149
+    }
150 150
 }
151 151
 
152 152
 /**
153 153
  * The create team submit handler
154 154
  */
155 155
 function boincteam_create_form_submit($form, &$form_state) {
156
-  global $user;
157
-  $account = user_load($user->uid);
158
-  $values = $form_state['values'];
159
-  //drupal_set_message('<pre>' . print_r($values,true) . '</pre>');
156
+    global $user;
157
+    $account = user_load($user->uid);
158
+    $values = $form_state['values'];
159
+    //drupal_set_message('<pre>' . print_r($values,true) . '</pre>');
160 160
   
161
-  $input_format = !empty($values['format']) ? $values['format'] : 4;
162
-  $values['description'] = check_markup($values['description'], $input_format);
161
+    $input_format = !empty($values['format']) ? $values['format'] : 4;
162
+    $values['description'] = check_markup($values['description'], $input_format);
163 163
   
164
-  // Create the team in the BOINC db
164
+    // Create the team in the BOINC db
165 165
   
166
-  require_boinc(array('user','team'));
167
-  $boinc_team = make_team(
166
+    require_boinc(array('user','team'));
167
+    $boinc_team = make_team(
168 168
     $account->boincuser_id,
169 169
     $values['name'],
170 170
     $values['website'],
@@ -172,27 +172,27 @@  discard block
 block discarded – undo
172 172
     $values['name_html'],
173 173
     $values['description'],
174 174
     $values['country']
175
-  );
175
+    );
176 176
 
177
-  if ($boinc_team) {
177
+    if ($boinc_team) {
178 178
     $boinc_user = BoincUser::lookup_id($account->boincuser_id);
179 179
     user_join_team($boinc_team, $boinc_user);
180
-  }
181
-  else {
180
+    }
181
+    else {
182 182
     drupal_set_message(t('Teams cannot be created at this time. Please 
183 183
       contact the @project administrators!', array('@project' => PROJECT)));
184 184
     watchdog('BOINC team', 'BOINC teams cannot be created for an unknown
185 185
       reason.', 'error');
186 186
     return FALSE;
187
-  }
187
+    }
188 188
   
189
-  // Create the team node in Drupal
189
+    // Create the team node in Drupal
190 190
   
191
-  $teaser = node_teaser($values['description']);
192
-  $created_time = time();
193
-  $input_format = variable_get('filter_default_format', 1);
191
+    $teaser = node_teaser($values['description']);
192
+    $created_time = time();
193
+    $input_format = variable_get('filter_default_format', 1);
194 194
   
195
-  $node = array(
195
+    $node = array(
196 196
     'type' => 'team',
197 197
     'title' => $values['name'],
198 198
     'body' => $values['description'],
@@ -206,21 +206,21 @@  discard block
 block discarded – undo
206 206
     'moderate' => 0,
207 207
     'sticky' => 0,
208 208
     'format' => $input_format
209
-  );
209
+    );
210 210
   
211
-  // Use pathauto function, if available, to clean up the path
212
-  if (module_exists('pathauto')) {
211
+    // Use pathauto function, if available, to clean up the path
212
+    if (module_exists('pathauto')) {
213 213
     module_load_include('inc', 'pathauto', 'pathauto');
214 214
     $node['path'] = pathauto_cleanstring($values['name']);
215
-  }
216
-  else {
215
+    }
216
+    else {
217 217
     drupal_set_message(t('Teams cannot be created at this time. Please 
218 218
       contact the @project administrators!', array('@project' => PROJECT)));
219 219
     watchdog('BOINC team', 'BOINC teams require the Pathauto module. Teams
220 220
       cannot be created.', 'error');
221
-  }
221
+    }
222 222
   
223
-  /*
223
+    /*
224 224
   // Add special organic group properties
225 225
   $node['og_description'] = strip_tags($boincteam->description);
226 226
   $node['og_selective'] = OG_OPEN;
@@ -229,26 +229,26 @@  discard block
 block discarded – undo
229 229
   $node['og_private'] = 0;
230 230
   */
231 231
   
232
-  $node = (object) $node; // node_save requires an object form
232
+    $node = (object) $node; // node_save requires an object form
233 233
   
234
-  /*
234
+    /*
235 235
   $node->field_description[]['value'] = $boincteam->description;
236 236
   $node->field_url[]['value'] = $boincteam->url;
237 237
   $node->field_country[]['value'] = $boincteam->country;
238 238
   */
239 239
   
240
-  $node->taxonomy[] = taxonomy_get_term($values['type']);
240
+    $node->taxonomy[] = taxonomy_get_term($values['type']);
241 241
   
242
-  // Save the team node
243
-  node_save($node);
242
+    // Save the team node
243
+    node_save($node);
244 244
   
245
-  // Save the team IDs to a BOINC <--> Drupal reference table.
246
-  db_query('INSERT INTO {boincteam} (team_id, nid) VALUES (%d, %d)', $boinc_team->id, $node->nid);
245
+    // Save the team IDs to a BOINC <--> Drupal reference table.
246
+    db_query('INSERT INTO {boincteam} (team_id, nid) VALUES (%d, %d)', $boinc_team->id, $node->nid);
247 247
   
248
-  drupal_set_message(t('Team "@name" has been created.', 
248
+    drupal_set_message(t('Team "@name" has been created.', 
249 249
     array('@name' => $values['name'])));
250 250
   
251
-  $form_state['redirect'] = "community/teams/{$node->nid}";
251
+    $form_state['redirect'] = "community/teams/{$node->nid}";
252 252
 }
253 253
 
254 254
 /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
@@ -259,17 +259,17 @@  discard block
 block discarded – undo
259 259
  * The definition of the edit team form
260 260
  */
261 261
 function boincteam_edit_form(&$form_state, $team_id) {
262
-  $form = array();
262
+    $form = array();
263 263
   
264
-  $team = node_load($team_id);
265
-  $boincteam = boincteam_load(boincteam_lookup_id($team_id));
264
+    $team = node_load($team_id);
265
+    $boincteam = boincteam_load(boincteam_lookup_id($team_id));
266 266
   
267
-  $is_boinc_wide = ($boincteam->seti_id > 0) ? TRUE : FALSE;
267
+    $is_boinc_wide = ($boincteam->seti_id > 0) ? TRUE : FALSE;
268 268
   
269
-  $form_state['storage']['team_id'] = $team_id;
270
-  $form_state['storage']['is_boinc_wide'] = $is_boinc_wide;
269
+    $form_state['storage']['team_id'] = $team_id;
270
+    $form_state['storage']['is_boinc_wide'] = $is_boinc_wide;
271 271
   
272
-  $default = array(
272
+    $default = array(
273 273
     'name' => $boincteam->name,
274 274
     'name_html' => $boincteam->name_html,
275 275
     'website' => $boincteam->url,
@@ -277,79 +277,79 @@  discard block
 block discarded – undo
277 277
     'country' => $boincteam->country,
278 278
     'joinable' => $boincteam->joinable,
279 279
     'description' => $boincteam->description,
280
-  );
280
+    );
281 281
   
282
-  // Standard option sets
283
-  $form['boolean_options'] = array(
282
+    // Standard option sets
283
+    $form['boolean_options'] = array(
284 284
     '#type' => 'value',
285 285
     '#value' => array(1 => bts('yes'), 0 => bts('no')),
286
-  );
286
+    );
287 287
   
288
-  // Vocabulary based option sets
289
-  $form['type_options'] = array(
288
+    // Vocabulary based option sets
289
+    $form['type_options'] = array(
290 290
     '#type' => 'value',
291 291
     '#value' => array(0 => bts('Choose type'))
292
-  );
293
-  $vocabs = taxonomy_get_vocabularies(NULL);
294
-  foreach ($vocabs as $vocab) {
292
+    );
293
+    $vocabs = taxonomy_get_vocabularies(NULL);
294
+    foreach ($vocabs as $vocab) {
295 295
     switch ($vocab->name) {
296 296
     case 'Teams':
297 297
       $team_types = taxonomy_get_tree($vocab->vid);
298
-      if (module_exists('internationalization')) {
298
+        if (module_exists('internationalization')) {
299 299
         $team_types = i18ntaxonomy_localize_terms($team_types);
300
-      }
301
-      foreach ($team_types as $team_type) {
300
+        }
301
+        foreach ($team_types as $team_type) {
302 302
         $form['type_options']['#value'][$team_type->tid] = $team_type->name;
303
-      }
304
-      break;
303
+        }
304
+        break;
305 305
     default:
306 306
     }
307
-  }
308
-  $form['country_options'] = array(
307
+    }
308
+    $form['country_options'] = array(
309 309
     '#type' => 'value',
310 310
     '#value' => boinccore_get_country_list(),
311
-  );
311
+    );
312 312
   
313
-  // Form elements
314
-  $form['name'] = array(
313
+    // Form elements
314
+    $form['name'] = array(
315 315
     '#title' => bts('Team name'),
316 316
     '#type' => 'textfield',
317 317
     '#default_value' => $default['name'],
318 318
     '#size' => 34,
319 319
     '#description' => bts('Text only, no HTML tags'),
320 320
     '#disabled' => $is_boinc_wide,
321
-  );
322
-  $form['name_html'] = array(
321
+    );
322
+    $form['name_html'] = array(
323 323
     '#title' => bts('Team name -- HTML version (optional)'),
324 324
     '#type' => 'textfield',
325 325
     '#default_value' => $default['name_html'],
326 326
     '#size' => 34,
327 327
     '#description' => bts('You may use limited HTML tags'),
328 328
     '#disabled' => $is_boinc_wide,
329
-  );
330
-  $form['website'] = array(
329
+    );
330
+    $form['website'] = array(
331 331
     '#title' => bts('Team website (optional)'),
332 332
     '#type' => 'textfield',
333 333
     '#default_value' => $default['website'],
334 334
     '#size' => 34,
335 335
     '#description' => bts("Displayed on the team's page"),
336 336
     '#disabled' => $is_boinc_wide,
337
-  );
338
-  $form['type'] = array(
337
+    );
338
+    $form['type'] = array(
339 339
     '#title' => bts('Type of team'),
340 340
     '#type' => 'select',
341 341
     '#options' => $form['type_options']['#value'],
342 342
     '#default_value' => $default['type'],
343 343
     '#disabled' => $is_boinc_wide,
344
-  );
345
-  $form['country'] = array(
344
+    );
345
+    $form['country'] = array(
346 346
     '#title' => bts('Country'),
347 347
     '#type' => 'select',
348 348
     '#options' => $form['country_options']['#value'],
349 349
     '#default_value' => $default['country'],
350 350
     '#disabled' => $is_boinc_wide,
351
-  );
352
-  $form['joinable'] = array(
351
+    );
352
+    $form['joinable'] = array(
353 353
     '#title' => bts('Accept new members?'),
354 354
     '#type' => 'radios',
355 355
     '#options' => $form['boolean_options']['#value'],
@@ -357,49 +357,49 @@  discard block
 block discarded – undo
357 357
     '#default_value' => $default['joinable'],
358 358
     '#size' => 34,
359 359
     '#disabled' => $is_boinc_wide,
360
-  );
361
-  if (!$is_boinc_wide) {
360
+    );
361
+    if (!$is_boinc_wide) {
362 362
     $form['description'] = array(
363
-      '#title' => bts('Description of team'),
364
-      '#type' => 'textarea',
365
-      '#default_value' => $default['description'],
366
-      '#size' => 5,
367
-      '#description' => NULL,
363
+        '#title' => bts('Description of team'),
364
+        '#type' => 'textarea',
365
+        '#default_value' => $default['description'],
366
+        '#size' => 5,
367
+        '#description' => NULL,
368 368
     );
369 369
     $form['format'] = filter_form();
370 370
     
371 371
     // Form control
372 372
     $form['form control tabs prefix'] = array(
373
-      '#value' => '<ul class="form-control tab-list">'
373
+        '#value' => '<ul class="form-control tab-list">'
374 374
     );
375 375
     $form['submit'] = array(
376
-      '#prefix' => '<li class="first tab">',
377
-      '#type' => 'submit',
378
-      '#value' => bts('Save changes'),
379
-      '#suffix' => '</li>',
376
+        '#prefix' => '<li class="first tab">',
377
+        '#type' => 'submit',
378
+        '#value' => bts('Save changes'),
379
+        '#suffix' => '</li>',
380 380
     );
381 381
     $form['form control tabs'] = array(
382
-      '#value' => '<li class="tab">' . l(bts('Cancel'), strstr($_GET['q'], '/edit', TRUE)) . '</li>'
382
+        '#value' => '<li class="tab">' . l(bts('Cancel'), strstr($_GET['q'], '/edit', TRUE)) . '</li>'
383 383
     );
384
-  }
385
-  else {
384
+    }
385
+    else {
386 386
     $form['description'] = array(
387
-      '#prefix' => '<div class="form-item"><label>' . bts('Description') . ':</label></div><div class="form-item">',
388
-      '#value' => $default['description'],
389
-      '#suffix' => '</div>',
387
+        '#prefix' => '<div class="form-item"><label>' . bts('Description') . ':</label></div><div class="form-item">',
388
+        '#value' => $default['description'],
389
+        '#suffix' => '</div>',
390 390
     );
391 391
     drupal_set_message(
392
-      bts('This is a BOINC-wide team. Changes can be made at the !site.',
392
+        bts('This is a BOINC-wide team. Changes can be made at the !site.',
393 393
         array('!site' => l(bts('BOINC-wide teams site'),
394
-          'http://boinc.berkeley.edu/teams/'
394
+            'http://boinc.berkeley.edu/teams/'
395 395
         ))
396
-      ),
397
-      'warning');
398
-  }
396
+        ),
397
+        'warning');
398
+    }
399 399
   
400
-  $form['#redirect'] = "community/teams/{$team_id}";
400
+    $form['#redirect'] = "community/teams/{$team_id}";
401 401
   
402
-  return $form;
402
+    return $form;
403 403
 }
404 404
 
405 405
 /**
@@ -407,32 +407,32 @@  discard block
 block discarded – undo
407 407
  */
408 408
 function boincteam_edit_form_validate($form, &$form_state) {
409 409
 
410
-  $values = $form_state['values'];
411
-  $name = $values['name'];
410
+    $values = $form_state['values'];
411
+    $name = $values['name'];
412 412
   
413
-  if ($form_state['storage']['is_boinc_wide']) {
413
+    if ($form_state['storage']['is_boinc_wide']) {
414 414
     form_set_error('none', bts('This team is managed by the BOINC-wide teams system and cannot be updated here.'));
415
-  }
416
-  else {
415
+    }
416
+    else {
417 417
     if (!$name) {
418
-      form_set_error('name', bts('Team name is required.'));
418
+        form_set_error('name', bts('Team name is required.'));
419 419
     }
420 420
     else {
421
-      $team = node_load($form_state['storage']['team_id']);
422
-      if ($name != $team->title) {
421
+        $team = node_load($form_state['storage']['team_id']);
422
+        if ($name != $team->title) {
423 423
         // If changing the name ("title" in Drupal terms), check that the new name is available
424 424
         require_boinc('boinc_db');
425 425
         if (BoincTeam::lookup_name($name)) {
426
-          form_set_error('name', bts('A team named "@name" already exists.',
426
+            form_set_error('name', bts('A team named "@name" already exists.',
427 427
             array('@name' => $name)));
428 428
         }
429
-      }
429
+        }
430 430
     }
431 431
   
432 432
     if (!$values['type'] OR !isset($values['type_options'][$values['type']])) {
433
-      form_set_error('type', bts('Please select a team type.'));
433
+        form_set_error('type', bts('Please select a team type.'));
434
+    }
434 435
     }
435
-  }
436 436
 }
437 437
 
438 438
 /**
@@ -440,18 +440,18 @@  discard block
 block discarded – undo
440 440
  */
441 441
 function boincteam_edit_form_submit($form, &$form_state) {
442 442
   
443
-  $team_id = $form_state['storage']['team_id'];
444
-  $values = $form_state['values'];
443
+    $team_id = $form_state['storage']['team_id'];
444
+    $values = $form_state['values'];
445 445
   
446
-  $team = node_load($team_id);
447
-  $boincteam_id = boincteam_lookup_id($team_id);
446
+    $team = node_load($team_id);
447
+    $boincteam_id = boincteam_lookup_id($team_id);
448 448
   
449
-  $input_format = !empty($values['format']) ? $values['format'] : 4;
450
-  $values['description'] = check_markup($values['description'], $input_format);
449
+    $input_format = !empty($values['format']) ? $values['format'] : 4;
450
+    $values['description'] = check_markup($values['description'], $input_format);
451 451
   
452
-  // Update the team in the BOINC db
453
-  db_set_active('boinc');
454
-  db_query("
452
+    // Update the team in the BOINC db
453
+    db_set_active('boinc');
454
+    db_query("
455 455
     UPDATE {team} SET
456 456
       name = '%s',
457 457
       name_lc = '%s',
@@ -471,32 +471,32 @@  discard block
 block discarded – undo
471 471
     $values['country'],
472 472
     $values['joinable'],
473 473
     $boincteam_id
474
-  );
475
-  db_set_active('default');
474
+    );
475
+    db_set_active('default');
476 476
   
477
-  // Update the team node in Drupal
477
+    // Update the team node in Drupal
478 478
   
479
-  $team->title = $values['name'];
480
-  $team->body = $values['description'];
481
-  $team->teaser = node_teaser($values['description']);
479
+    $team->title = $values['name'];
480
+    $team->body = $values['description'];
481
+    $team->teaser = node_teaser($values['description']);
482 482
   
483
-  /*
483
+    /*
484 484
   $node->field_description[]['value'] = $boincteam->description;
485 485
   $node->field_url[]['value'] = $boincteam->url;
486 486
   $node->field_country[]['value'] = $boincteam->country;
487 487
   */
488 488
   
489
-  // Replace any existing taxonomy with the new one
490
-  $team->taxonomy = array(taxonomy_get_term($values['type']));
489
+    // Replace any existing taxonomy with the new one
490
+    $team->taxonomy = array(taxonomy_get_term($values['type']));
491 491
   
492
-  // Save the team node
493
-  node_save($team);
492
+    // Save the team node
493
+    node_save($team);
494 494
   
495
-  drupal_set_message(t('Details for "@team" have been updated.', 
495
+    drupal_set_message(t('Details for "@team" have been updated.', 
496 496
     array('@team' => $values['name'])));
497 497
     
498
-  // The storage variable quietly kills redirection for some reason... unset it
499
-  unset($form_state['storage']);
498
+    // The storage variable quietly kills redirection for some reason... unset it
499
+    unset($form_state['storage']);
500 500
 }
501 501
 
502 502
 
@@ -508,42 +508,42 @@  discard block
 block discarded – undo
508 508
  * The definition of the add team admin form
509 509
  */
510 510
 function boincteam_add_admin_form(&$form_state, $team_id) {
511
-  $form = array();
511
+    $form = array();
512 512
   
513
-  $team = node_load($team_id);
514
-  $boincteam = boincteam_load(boincteam_lookup_id($team_id));
513
+    $team = node_load($team_id);
514
+    $boincteam = boincteam_load(boincteam_lookup_id($team_id));
515 515
   
516
-  $form_state['storage']['team_id'] = $team_id;
516
+    $form_state['storage']['team_id'] = $team_id;
517 517
   
518
-  $default = array(
518
+    $default = array(
519 519
     'email' => '',
520
-  );
520
+    );
521 521
   
522
-  // Form elements
523
-  $form['email'] = array(
522
+    // Form elements
523
+    $form['email'] = array(
524 524
     '#title' => bts('Enter email address'),
525 525
     '#type' => 'textfield',
526 526
     '#default_value' => $default['email'],
527 527
     '#size' => 34,
528
-  );
528
+    );
529 529
   
530
-  // Form control
531
-  $form['form control tabs prefix'] = array(
530
+    // Form control
531
+    $form['form control tabs prefix'] = array(
532 532
     '#value' => '<ul class="form-control tab-list">'
533
-  );
534
-  $form['submit'] = array(
533
+    );
534
+    $form['submit'] = array(
535 535
     '#prefix' => '<li class="first tab">',
536 536
     '#type' => 'submit',
537 537
     '#value' => bts('Add'),
538 538
     '#suffix' => '</li>',
539
-  );
540
-  $form['form control tabs'] = array(
539
+    );
540
+    $form['form control tabs'] = array(
541 541
     '#value' => '<li class="tab">' . l(bts('Cancel'), strstr($_GET['q'], '/edit', TRUE)) . '</li>'
542
-  );
542
+    );
543 543
   
544
-  //$form['#redirect'] = "community/teams/{$team_id}";
544
+    //$form['#redirect'] = "community/teams/{$team_id}";
545 545
   
546
-  return $form;
546
+    return $form;
547 547
 }
548 548
 
549 549
 /**
@@ -551,40 +551,40 @@  discard block
 block discarded – undo
551 551
  */
552 552
 function boincteam_add_admin_form_validate($form, &$form_state) {
553 553
 
554
-  $team_id = $form_state['storage']['team_id'];
555
-  $values = $form_state['values'];
554
+    $team_id = $form_state['storage']['team_id'];
555
+    $values = $form_state['values'];
556 556
   
557
-  $team = node_load($team_id);
557
+    $team = node_load($team_id);
558 558
   
559
-  if (!$values['email']) {
559
+    if (!$values['email']) {
560 560
     form_set_error('email', bts('Email address is required.'));
561
-  }
562
-  else {
561
+    }
562
+    else {
563 563
     $account = user_load(array('mail' => $values['email']));
564 564
     if ((!$account) OR ($account->team != $team_id)) {
565
-      form_set_error('email', bts('There is no user on your team with that email address.'));
565
+        form_set_error('email', bts('There is no user on your team with that email address.'));
566 566
     }
567 567
     elseif (boincteam_is_founder($team_id, $account->uid)) {
568
-      form_set_error('email', bts('@user is the founder of @team!',
568
+        form_set_error('email', bts('@user is the founder of @team!',
569 569
         array(
570
-          '@user' => $account->boincuser_name,
571
-          '@team' => $team->title,
570
+            '@user' => $account->boincuser_name,
571
+            '@team' => $team->title,
572 572
         )
573
-      ));
573
+        ));
574 574
     }
575 575
     elseif (boincteam_is_admin($team_id, $account->uid)) {
576
-      form_set_error('email', bts('@user is already an admin of @team.',
576
+        form_set_error('email', bts('@user is already an admin of @team.',
577 577
         array(
578
-          '@user' => $account->boincuser_name,
579
-          '@team' => $team->title,
578
+            '@user' => $account->boincuser_name,
579
+            '@team' => $team->title,
580 580
         )
581
-      ));
581
+        ));
582 582
     }
583 583
     else {
584
-      $form_state['storage']['boincuser_id'] = $account->boincuser_id;
585
-      $form_state['storage']['boincuser_name'] = $account->boincuser_name;
584
+        $form_state['storage']['boincuser_id'] = $account->boincuser_id;
585
+        $form_state['storage']['boincuser_name'] = $account->boincuser_name;
586
+    }
586 587
     }
587
-  }
588 588
 }
589 589
 
590 590
 /**
@@ -592,17 +592,17 @@  discard block
 block discarded – undo
592 592
  */
593 593
 function boincteam_add_admin_form_submit($form, &$form_state) {
594 594
   
595
-  $team_id = $form_state['storage']['team_id'];
596
-  $boincuser_id = $form_state['storage']['boincuser_id'];
597
-  $user_name = $form_state['storage']['boincuser_name'];
598
-  $values = $form_state['values'];
595
+    $team_id = $form_state['storage']['team_id'];
596
+    $boincuser_id = $form_state['storage']['boincuser_id'];
597
+    $user_name = $form_state['storage']['boincuser_name'];
598
+    $values = $form_state['values'];
599 599
   
600
-  $team = node_load($team_id);
601
-  $boincteam_id = boincteam_lookup_id($team_id);
600
+    $team = node_load($team_id);
601
+    $boincteam_id = boincteam_lookup_id($team_id);
602 602
   
603
-  // Update the team in the BOINC db
604
-  db_set_active('boinc');
605
-  db_query("
603
+    // Update the team in the BOINC db
604
+    db_set_active('boinc');
605
+    db_query("
606 606
     INSERT INTO {team_admin} SET
607 607
       teamid = '%d',
608 608
       userid = '%d',
@@ -610,15 +610,15 @@  discard block
 block discarded – undo
610 610
     $boincteam_id,
611 611
     $boincuser_id,
612 612
     time()
613
-  );
614
-  db_set_active('default');
613
+    );
614
+    db_set_active('default');
615 615
   
616
-  // Could assign a role in Drupal here, as needed
616
+    // Could assign a role in Drupal here, as needed
617 617
   
618 618
   
619
-  drupal_set_message(t('@user has been added as an admin.', 
619
+    drupal_set_message(t('@user has been added as an admin.', 
620 620
     array('@user' => $user_name)));
621 621
     
622
-  // The storage variable quietly kills redirection for some reason... unset it
623
-  unset($form_state['storage']);
622
+    // The storage variable quietly kills redirection for some reason... unset it
623
+    unset($form_state['storage']);
624 624
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     '#suffix' => '</li>',
120 120
   );
121 121
   $form['form control tabs'] = array(
122
-    '#value' => '<li class="tab">' . l(bts('Cancel'), $_GET['q']) . '</li>'
122
+    '#value' => '<li class="tab">'.l(bts('Cancel'), $_GET['q']).'</li>'
123 123
   );
124 124
   
125 125
   return $form;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
   
164 164
   // Create the team in the BOINC db
165 165
   
166
-  require_boinc(array('user','team'));
166
+  require_boinc(array('user', 'team'));
167 167
   $boinc_team = make_team(
168 168
     $account->boincuser_id,
169 169
     $values['name'],
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
     'teaser' => $teaser,
200 200
     'uid' => $user->uid,
201 201
     'path' => null,
202
-    'status' => 1,  // published or not - always publish
202
+    'status' => 1, // published or not - always publish
203 203
     'promote' => 0,
204 204
     'created' => $created_time,
205
-    'comment' => 0,  // comments disabled
205
+    'comment' => 0, // comments disabled
206 206
     'moderate' => 0,
207 207
     'sticky' => 0,
208 208
     'format' => $input_format
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
   $node['og_private'] = 0;
230 230
   */
231 231
   
232
-  $node = (object) $node; // node_save requires an object form
232
+  $node = (object)$node; // node_save requires an object form
233 233
   
234 234
   /*
235 235
   $node->field_description[]['value'] = $boincteam->description;
@@ -379,12 +379,12 @@  discard block
 block discarded – undo
379 379
       '#suffix' => '</li>',
380 380
     );
381 381
     $form['form control tabs'] = array(
382
-      '#value' => '<li class="tab">' . l(bts('Cancel'), strstr($_GET['q'], '/edit', TRUE)) . '</li>'
382
+      '#value' => '<li class="tab">'.l(bts('Cancel'), strstr($_GET['q'], '/edit', TRUE)).'</li>'
383 383
     );
384 384
   }
385 385
   else {
386 386
     $form['description'] = array(
387
-      '#prefix' => '<div class="form-item"><label>' . bts('Description') . ':</label></div><div class="form-item">',
387
+      '#prefix' => '<div class="form-item"><label>'.bts('Description').':</label></div><div class="form-item">',
388 388
       '#value' => $default['description'],
389 389
       '#suffix' => '</div>',
390 390
     );
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
     '#suffix' => '</li>',
539 539
   );
540 540
   $form['form control tabs'] = array(
541
-    '#value' => '<li class="tab">' . l(bts('Cancel'), strstr($_GET['q'], '/edit', TRUE)) . '</li>'
541
+    '#value' => '<li class="tab">'.l(bts('Cancel'), strstr($_GET['q'], '/edit', TRUE)).'</li>'
542 542
   );
543 543
   
544 544
   //$form['#redirect'] = "community/teams/{$team_id}";
Please login to merge, or discard this patch.
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -135,8 +135,7 @@  discard block
 block discarded – undo
135 135
   
136 136
   if (!$name) {
137 137
     form_set_error('name', bts('Team name is required.'));
138
-  }
139
-  else {
138
+  } else {
140 139
     require_boinc('boinc_db');
141 140
     if (BoincTeam::lookup_name($name)) {
142 141
       form_set_error('name', bts('A team named "@name" already exists.',
@@ -177,8 +176,7 @@  discard block
 block discarded – undo
177 176
   if ($boinc_team) {
178 177
     $boinc_user = BoincUser::lookup_id($account->boincuser_id);
179 178
     user_join_team($boinc_team, $boinc_user);
180
-  }
181
-  else {
179
+  } else {
182 180
     drupal_set_message(t('Teams cannot be created at this time. Please 
183 181
       contact the @project administrators!', array('@project' => PROJECT)));
184 182
     watchdog('BOINC team', 'BOINC teams cannot be created for an unknown
@@ -212,8 +210,7 @@  discard block
 block discarded – undo
212 210
   if (module_exists('pathauto')) {
213 211
     module_load_include('inc', 'pathauto', 'pathauto');
214 212
     $node['path'] = pathauto_cleanstring($values['name']);
215
-  }
216
-  else {
213
+  } else {
217 214
     drupal_set_message(t('Teams cannot be created at this time. Please 
218 215
       contact the @project administrators!', array('@project' => PROJECT)));
219 216
     watchdog('BOINC team', 'BOINC teams require the Pathauto module. Teams
@@ -381,8 +378,7 @@  discard block
 block discarded – undo
381 378
     $form['form control tabs'] = array(
382 379
       '#value' => '<li class="tab">' . l(bts('Cancel'), strstr($_GET['q'], '/edit', TRUE)) . '</li>'
383 380
     );
384
-  }
385
-  else {
381
+  } else {
386 382
     $form['description'] = array(
387 383
       '#prefix' => '<div class="form-item"><label>' . bts('Description') . ':</label></div><div class="form-item">',
388 384
       '#value' => $default['description'],
@@ -412,12 +408,10 @@  discard block
 block discarded – undo
412 408
   
413 409
   if ($form_state['storage']['is_boinc_wide']) {
414 410
     form_set_error('none', bts('This team is managed by the BOINC-wide teams system and cannot be updated here.'));
415
-  }
416
-  else {
411
+  } else {
417 412
     if (!$name) {
418 413
       form_set_error('name', bts('Team name is required.'));
419
-    }
420
-    else {
414
+    } else {
421 415
       $team = node_load($form_state['storage']['team_id']);
422 416
       if ($name != $team->title) {
423 417
         // If changing the name ("title" in Drupal terms), check that the new name is available
@@ -558,29 +552,25 @@  discard block
 block discarded – undo
558 552
   
559 553
   if (!$values['email']) {
560 554
     form_set_error('email', bts('Email address is required.'));
561
-  }
562
-  else {
555
+  } else {
563 556
     $account = user_load(array('mail' => $values['email']));
564 557
     if ((!$account) OR ($account->team != $team_id)) {
565 558
       form_set_error('email', bts('There is no user on your team with that email address.'));
566
-    }
567
-    elseif (boincteam_is_founder($team_id, $account->uid)) {
559
+    } elseif (boincteam_is_founder($team_id, $account->uid)) {
568 560
       form_set_error('email', bts('@user is the founder of @team!',
569 561
         array(
570 562
           '@user' => $account->boincuser_name,
571 563
           '@team' => $team->title,
572 564
         )
573 565
       ));
574
-    }
575
-    elseif (boincteam_is_admin($team_id, $account->uid)) {
566
+    } elseif (boincteam_is_admin($team_id, $account->uid)) {
576 567
       form_set_error('email', bts('@user is already an admin of @team.',
577 568
         array(
578 569
           '@user' => $account->boincuser_name,
579 570
           '@team' => $team->title,
580 571
         )
581 572
       ));
582
-    }
583
-    else {
573
+    } else {
584 574
       $form_state['storage']['boincuser_id'] = $account->boincuser_id;
585 575
       $form_state['storage']['boincuser_name'] = $account->boincuser_name;
586 576
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     'website' => '',
23 23
     'type' => 0,
24 24
     'country' => 0,
25
-    'joinable' => TRUE,
25
+    'joinable' => true,
26 26
     'description' => '',
27 27
   );
28 28
   
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     '#type' => 'value',
38 38
     '#value' => array(0 => bts('Choose type'))
39 39
   );
40
-  $vocabs = taxonomy_get_vocabularies(NULL);
40
+  $vocabs = taxonomy_get_vocabularies(null);
41 41
   foreach ($vocabs as $vocab) {
42 42
     switch ($vocab->name) {
43 43
     case 'Teams':
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     '#type' => 'textarea',
105 105
     '#default_value' => $default['description'],
106 106
     '#size' => 5,
107
-    '#description' => NULL,
107
+    '#description' => null,
108 108
   );
109 109
   $form['format'] = filter_form();
110 110
   
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     }
145 145
   }
146 146
   
147
-  if (!$values['type'] OR !isset($values['type_options'][$values['type']])) {
147
+  if (!$values['type'] or !isset($values['type_options'][$values['type']])) {
148 148
     form_set_error('type', bts('Please select a team type.'));
149 149
   }
150 150
 }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
       contact the @project administrators!', array('@project' => PROJECT)));
184 184
     watchdog('BOINC team', 'BOINC teams cannot be created for an unknown
185 185
       reason.', 'error');
186
-    return FALSE;
186
+    return false;
187 187
   }
188 188
   
189 189
   // Create the team node in Drupal
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
   $team = node_load($team_id);
265 265
   $boincteam = boincteam_load(boincteam_lookup_id($team_id));
266 266
   
267
-  $is_boinc_wide = ($boincteam->seti_id > 0) ? TRUE : FALSE;
267
+  $is_boinc_wide = ($boincteam->seti_id > 0) ? true : false;
268 268
   
269 269
   $form_state['storage']['team_id'] = $team_id;
270 270
   $form_state['storage']['is_boinc_wide'] = $is_boinc_wide;
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     '#type' => 'value',
291 291
     '#value' => array(0 => bts('Choose type'))
292 292
   );
293
-  $vocabs = taxonomy_get_vocabularies(NULL);
293
+  $vocabs = taxonomy_get_vocabularies(null);
294 294
   foreach ($vocabs as $vocab) {
295 295
     switch ($vocab->name) {
296 296
     case 'Teams':
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
       '#type' => 'textarea',
365 365
       '#default_value' => $default['description'],
366 366
       '#size' => 5,
367
-      '#description' => NULL,
367
+      '#description' => null,
368 368
     );
369 369
     $form['format'] = filter_form();
370 370
     
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
       '#suffix' => '</li>',
380 380
     );
381 381
     $form['form control tabs'] = array(
382
-      '#value' => '<li class="tab">' . l(bts('Cancel'), strstr($_GET['q'], '/edit', TRUE)) . '</li>'
382
+      '#value' => '<li class="tab">' . l(bts('Cancel'), strstr($_GET['q'], '/edit', true)) . '</li>'
383 383
     );
384 384
   }
385 385
   else {
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
       }
430 430
     }
431 431
   
432
-    if (!$values['type'] OR !isset($values['type_options'][$values['type']])) {
432
+    if (!$values['type'] or !isset($values['type_options'][$values['type']])) {
433 433
       form_set_error('type', bts('Please select a team type.'));
434 434
     }
435 435
   }
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
     '#suffix' => '</li>',
539 539
   );
540 540
   $form['form control tabs'] = array(
541
-    '#value' => '<li class="tab">' . l(bts('Cancel'), strstr($_GET['q'], '/edit', TRUE)) . '</li>'
541
+    '#value' => '<li class="tab">' . l(bts('Cancel'), strstr($_GET['q'], '/edit', true)) . '</li>'
542 542
   );
543 543
   
544 544
   //$form['#redirect'] = "community/teams/{$team_id}";
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
   }
562 562
   else {
563 563
     $account = user_load(array('mail' => $values['email']));
564
-    if ((!$account) OR ($account->team != $team_id)) {
564
+    if ((!$account) or ($account->team != $team_id)) {
565 565
       form_set_error('email', bts('There is no user on your team with that email address.'));
566 566
     }
567 567
     elseif (boincteam_is_founder($team_id, $account->uid)) {
Please login to merge, or discard this patch.
boinc/modules/boincteam/includes/views_handler_argument_boincteam_id.inc 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@
 block discarded – undo
7 7
  */
8 8
 
9 9
 class views_handler_argument_boincteam_id extends views_handler_argument_numeric {
10
-  function construct() {
10
+    function construct() {
11 11
     parent::construct();
12
-  }
12
+    }
13 13
 
14
-  function set_argument($arg) {
14
+    function set_argument($arg) {
15 15
     // When setting the ID argument, convert to BOINC ID
16 16
     $id = is_numeric($arg) ? $arg : 0;
17 17
     $boinc_id = db_result(db_query("SELECT team_id FROM {boincteam} WHERE nid = %d", $id));
18 18
     $this->argument = $boinc_id;
19 19
     return $this->validate_arg($boinc_id);
20
-  }
20
+    }
21 21
 }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincteam/includes/boincteam.helpers.inc 4 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -15,41 +15,41 @@  discard block
 block discarded – undo
15 15
  */
16 16
 function boincteam_sync() {
17 17
   
18
-  // Get the list of teams to import
19
-  db_set_active('boinc');
20
-  $boinc_teams = db_query('
18
+    // Get the list of teams to import
19
+    db_set_active('boinc');
20
+    $boinc_teams = db_query('
21 21
     SELECT id, name, description, userid, create_time, seti_id
22 22
     FROM team
23 23
     WHERE mod_time > FROM_UNIXTIME(%d)',
24 24
     variable_get('boincteam_last_sync', 0)
25
-  );
26
-  db_set_active('default');
25
+    );
26
+    db_set_active('default');
27 27
   
28
-  $existing_teams = array();
28
+    $existing_teams = array();
29 29
   
30
-  // Get the list of teams already in Drupal to be sure we're not importing
31
-  // any twice
32
-  $result = db_query('
30
+    // Get the list of teams already in Drupal to be sure we're not importing
31
+    // any twice
32
+    $result = db_query('
33 33
     SELECT nid, team_id FROM {boincteam}'
34
-  );
35
-  while ($row = db_fetch_object($result)) {
34
+    );
35
+    while ($row = db_fetch_object($result)) {
36 36
     $existing_teams[$row->team_id] = $row->nid;
37
-  }
37
+    }
38 38
   
39
-  while ($boinc_team = db_fetch_object($boinc_teams)) {
39
+    while ($boinc_team = db_fetch_object($boinc_teams)) {
40 40
     $success = NULL;
41 41
     if (isset($existing_teams[$boinc_team->id])) {
42
-      if ($boinc_team->seti_id > 0) {
42
+        if ($boinc_team->seti_id > 0) {
43 43
         // Sync BOINC-wide teams
44 44
         $nid = $existing_teams[$boinc_team->id];
45 45
         $success = boincteam_import($boinc_team, $nid);
46
-      }
46
+        }
47 47
     }
48 48
     else {
49
-      // Import new teams created by RPC or ops/team_import.php
50
-      $success = boincteam_import($boinc_team);
49
+        // Import new teams created by RPC or ops/team_import.php
50
+        $success = boincteam_import($boinc_team);
51
+    }
51 52
     }
52
-  }
53 53
 }
54 54
 
55 55
 
@@ -58,56 +58,56 @@  discard block
 block discarded – undo
58 58
  */
59 59
 function boincteam_import($boincteam, $nid = NULL) {
60 60
   
61
-  $input_format = variable_get('boincimport_input_format', 0);
62
-  $team_type_map = variable_get('boincimport_team_types', array()); 
61
+    $input_format = variable_get('boincimport_input_format', 0);
62
+    $team_type_map = variable_get('boincimport_team_types', array()); 
63 63
   
64
-  // Save the team type affiliation
65
-  $team_type_tid = $team_type_map[$boincteam->type];
64
+    // Save the team type affiliation
65
+    $team_type_tid = $team_type_map[$boincteam->type];
66 66
   
67
-  $boincteam->description = html_entity_decode($boincteam->description, ENT_QUOTES, 'utf-8');
68
-  // Be sure the text is filtered for the default input format
69
-  $boincteam->description = check_markup($boincteam->description, $input_format);
67
+    $boincteam->description = html_entity_decode($boincteam->description, ENT_QUOTES, 'utf-8');
68
+    // Be sure the text is filtered for the default input format
69
+    $boincteam->description = check_markup($boincteam->description, $input_format);
70 70
   
71
-  $teaser = node_teaser($boincteam->description);
71
+    $teaser = node_teaser($boincteam->description);
72 72
   
73
-  if ($nid) {
73
+    if ($nid) {
74 74
     // Update an existing node
75 75
     $node = node_load($nid);
76 76
     $node->title = $boincteam->name;
77 77
     $node->body = $boincteam->description;
78 78
     $node->teaser = $teaser;
79 79
     $node->uid = boincuser_lookup_uid($boincteam->userid);
80
-  }
81
-  else {
80
+    }
81
+    else {
82 82
     // Construct the team as a new node
83 83
     $node = array(
84
-      'type' => 'team',
85
-      'title' => $boincteam->name,
86
-      'body' => $boincteam->description,
87
-      'teaser' => $teaser,
88
-      'uid' => boincuser_lookup_uid($boincteam->userid),
89
-      'path' => null,
90
-      'status' => 1,  // published or not - always publish
91
-      'promote' => 0,
92
-      'created' => $boincteam->create_time,
93
-      'comment' => 0,  // comments disabled
94
-      'moderate' => 0,
95
-      'sticky' => 0,
96
-      'format' => $input_format
84
+        'type' => 'team',
85
+        'title' => $boincteam->name,
86
+        'body' => $boincteam->description,
87
+        'teaser' => $teaser,
88
+        'uid' => boincuser_lookup_uid($boincteam->userid),
89
+        'path' => null,
90
+        'status' => 1,  // published or not - always publish
91
+        'promote' => 0,
92
+        'created' => $boincteam->create_time,
93
+        'comment' => 0,  // comments disabled
94
+        'moderate' => 0,
95
+        'sticky' => 0,
96
+        'format' => $input_format
97 97
     );
98 98
     $node = (object) $node; // node_save requires an object form
99
-  }
99
+    }
100 100
   
101
-  $node->taxonomy[] = taxonomy_get_term($team_type_tid);
101
+    $node->taxonomy[] = taxonomy_get_term($team_type_tid);
102 102
   
103
-  // Save the team node
104
-  node_save($node);
105
-  $success = ($node->nid) ? TRUE : FALSE;
103
+    // Save the team node
104
+    node_save($node);
105
+    $success = ($node->nid) ? TRUE : FALSE;
106 106
   
107
-  if (!$nid) {
107
+    if (!$nid) {
108 108
     // Save the team IDs to a BOINC <--> Drupal reference table, if needed
109 109
     db_query('INSERT INTO {boincteam} (team_id, nid) VALUES (%d, %d)', $boincteam->id, $node->nid);
110
-  }
110
+    }
111 111
   
112
-  return $success;
112
+    return $success;
113 113
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -87,15 +87,15 @@
 block discarded – undo
87 87
       'teaser' => $teaser,
88 88
       'uid' => boincuser_lookup_uid($boincteam->userid),
89 89
       'path' => null,
90
-      'status' => 1,  // published or not - always publish
90
+      'status' => 1, // published or not - always publish
91 91
       'promote' => 0,
92 92
       'created' => $boincteam->create_time,
93
-      'comment' => 0,  // comments disabled
93
+      'comment' => 0, // comments disabled
94 94
       'moderate' => 0,
95 95
       'sticky' => 0,
96 96
       'format' => $input_format
97 97
     );
98
-    $node = (object) $node; // node_save requires an object form
98
+    $node = (object)$node; // node_save requires an object form
99 99
   }
100 100
   
101 101
   $node->taxonomy[] = taxonomy_get_term($team_type_tid);
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,8 +44,7 @@  discard block
 block discarded – undo
44 44
         $nid = $existing_teams[$boinc_team->id];
45 45
         $success = boincteam_import($boinc_team, $nid);
46 46
       }
47
-    }
48
-    else {
47
+    } else {
49 48
       // Import new teams created by RPC or ops/team_import.php
50 49
       $success = boincteam_import($boinc_team);
51 50
     }
@@ -77,8 +76,7 @@  discard block
 block discarded – undo
77 76
     $node->body = $boincteam->description;
78 77
     $node->teaser = $teaser;
79 78
     $node->uid = boincuser_lookup_uid($boincteam->userid);
80
-  }
81
-  else {
79
+  } else {
82 80
     // Construct the team as a new node
83 81
     $node = array(
84 82
       'type' => 'team',
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
   }
38 38
   
39 39
   while ($boinc_team = db_fetch_object($boinc_teams)) {
40
-    $success = NULL;
40
+    $success = null;
41 41
     if (isset($existing_teams[$boinc_team->id])) {
42 42
       if ($boinc_team->seti_id > 0) {
43 43
         // Sync BOINC-wide teams
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 /**
57 57
  * Import a given BOINC team object into Drupal
58 58
  */
59
-function boincteam_import($boincteam, $nid = NULL) {
59
+function boincteam_import($boincteam, $nid = null) {
60 60
   
61 61
   $input_format = variable_get('boincimport_input_format', 0);
62 62
   $team_type_map = variable_get('boincimport_team_types', array()); 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
   
103 103
   // Save the team node
104 104
   node_save($node);
105
-  $success = ($node->nid) ? TRUE : FALSE;
105
+  $success = ($node->nid) ? true : false;
106 106
   
107 107
   if (!$nid) {
108 108
     // Save the team IDs to a BOINC <--> Drupal reference table, if needed
Please login to merge, or discard this patch.
sites/default/boinc/modules/boincteam/includes/boincteam_forum.forms.inc 3 patches
Indentation   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -14,84 +14,84 @@  discard block
 block discarded – undo
14 14
  * The definition of the create team form
15 15
  */
16 16
 function boincteam_forum_create_form(&$form_state) {
17
-  $form = array();
17
+    $form = array();
18 18
   
19
-  global $user;
20
-  $account = user_load($user->uid);
19
+    global $user;
20
+    $account = user_load($user->uid);
21 21
   
22
-  $default = array(
22
+    $default = array(
23 23
     'title' => '',
24 24
     'min_time_between_posts' => '',
25 25
     'min_total_credit_to_post' => '',
26 26
     'min_avg_credit_to_post' => '',
27 27
     'public' => 0,
28 28
     'description' => '',
29
-  );
29
+    );
30 30
   
31
-  // Standard option sets
32
-  $form['boolean_options'] = array(
31
+    // Standard option sets
32
+    $form['boolean_options'] = array(
33 33
     '#type' => 'value',
34 34
     '#value' => array(1 => bts('yes'), 0 => bts('no')),
35
-  );
35
+    );
36 36
   
37
-  // Form elements
38
-  $form['title'] = array(
37
+    // Form elements
38
+    $form['title'] = array(
39 39
     '#title' => bts('Message board title'),
40 40
     '#type' => 'textfield',
41 41
     '#default_value' => $default['title'],
42 42
     '#size' => 34,
43 43
     '#description' => bts('Text only, no HTML tags'),
44
-  );
45
-  $form['min_time_between_posts'] = array(
44
+    );
45
+    $form['min_time_between_posts'] = array(
46 46
     '#title' => bts('Minimum time between posts'),
47 47
     '#type' => 'textfield',
48 48
     '#default_value' => $default['min_time_between_posts'],
49 49
     '#size' => 12,
50 50
     '#description' => bts('Seconds'),
51
-  );
52
-  $form['min_total_credit_to_post'] = array(
51
+    );
52
+    $form['min_total_credit_to_post'] = array(
53 53
     '#title' => bts('Minimum total credit to post'),
54 54
     '#type' => 'textfield',
55 55
     '#default_value' => $default['min_total_credit_to_post'],
56 56
     '#size' => 12,
57
-  );
58
-  $form['min_avg_credit_to_post'] = array(
57
+    );
58
+    $form['min_avg_credit_to_post'] = array(
59 59
     '#title' => bts('Minimum avg credit to post'),
60 60
     '#type' => 'textfield',
61 61
     '#default_value' => $default['min_avg_credit_to_post'],
62 62
     '#size' => 12,
63
-  );
64
-  $form['public'] = array(
63
+    );
64
+    $form['public'] = array(
65 65
     '#title' => bts('Allow public to read board?'),
66 66
     '#type' => 'radios',
67 67
     '#options' => $form['boolean_options']['#value'],
68 68
     '#attributes' => array('class' => 'fancy'),
69 69
     '#default_value' => $default['public'],
70
-  );
71
-  $form['description'] = array(
70
+    );
71
+    $form['description'] = array(
72 72
     '#title' => bts('Description'),
73 73
     '#type' => 'textarea',
74 74
     '#default_value' => $default['description'],
75 75
     '#size' => 5,
76
-  );
76
+    );
77 77
   
78
-  // Form control
79
-  $form['form control tabs prefix'] = array(
78
+    // Form control
79
+    $form['form control tabs prefix'] = array(
80 80
     '#value' => '<ul class="form-control tab-list">'
81
-  );
82
-  $form['submit'] = array(
81
+    );
82
+    $form['submit'] = array(
83 83
     '#prefix' => '<li class="first tab">',
84 84
     '#type' => 'submit',
85 85
     '#value' => bts('Create message board'),
86 86
     '#suffix' => '</li>',
87
-  );
88
-  $form['form control tabs'] = array(
87
+    );
88
+    $form['form control tabs'] = array(
89 89
     '#value' => '<li class="tab">' . l(bts('Cancel'), strstr($_GET['q'], '/forum/add', TRUE)) . '</li>'
90
-  );
90
+    );
91 91
   
92
-  $form['#redirect'] = "community/teams/{$account->team}";
92
+    $form['#redirect'] = "community/teams/{$account->team}";
93 93
   
94
-  return $form;
94
+    return $form;
95 95
 }
96 96
 
97 97
 /**
@@ -99,33 +99,33 @@  discard block
 block discarded – undo
99 99
  */
100 100
 function boincteam_forum_create_form_validate($form, &$form_state) {
101 101
 
102
-  $values = $form_state['values'];
102
+    $values = $form_state['values'];
103 103
   
104
-  if (!$values['title']) {
104
+    if (!$values['title']) {
105 105
     form_set_error('name', bts('Message board title is required.'));
106
-  }
107
-  if (!is_numeric($values['min_time_between_posts']) OR
106
+    }
107
+    if (!is_numeric($values['min_time_between_posts']) OR
108 108
       $values['min_time_between_posts'] < 0) {
109 109
     form_set_error('min_time_between_posts',
110
-      bts('Please set the minimum time required between posts.')
110
+        bts('Please set the minimum time required between posts.')
111 111
     );
112
-  }
113
-  if (!is_numeric($values['min_total_credit_to_post']) OR
112
+    }
113
+    if (!is_numeric($values['min_total_credit_to_post']) OR
114 114
       $values['min_total_credit_to_post'] < 0) {
115 115
     form_set_error('min_total_credit_to_post',
116
-      bts('Please set the minimum total credit that a user'
116
+        bts('Please set the minimum total credit that a user'
117 117
         . ' must earn in order to post to this message board.'
118
-      )
118
+        )
119 119
     );
120
-  }
121
-  if (!is_numeric($values['min_avg_credit_to_post']) OR
120
+    }
121
+    if (!is_numeric($values['min_avg_credit_to_post']) OR
122 122
       $values['min_avg_credit_to_post'] < 0) {
123 123
     form_set_error('min_avg_credit_to_post',
124
-      bts('Please set the minimum average credit that a user'
124
+        bts('Please set the minimum average credit that a user'
125 125
         . ' is required to have in order to post to this message board.'
126
-      )
126
+        )
127 127
     );
128
-  }
128
+    }
129 129
 }
130 130
 
131 131
 /**
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
  */
134 134
 function boincteam_forum_create_form_submit($form, &$form_state) {
135 135
   
136
-  $values = $form_state['values'];
136
+    $values = $form_state['values'];
137 137
   
138
-  global $user;
139
-  $account = user_load($user->uid);
138
+    global $user;
139
+    $account = user_load($user->uid);
140 140
   
141
-  // Add the team forum to the db
142
-  db_query("
141
+    // Add the team forum to the db
142
+    db_query("
143 143
     INSERT INTO {boincteam_forum} SET
144 144
       nid = %d,
145 145
       title = '%s',
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
     (int) $values['min_avg_credit_to_post'],
158 158
     ($values['public']) ? 1 : 0,
159 159
     $values['description']
160
-  );
160
+    );
161 161
   
162
-  drupal_set_message(t('Message board "@forum" has been created.',
162
+    drupal_set_message(t('Message board "@forum" has been created.',
163 163
     array('@forum' => $values['title'])));
164 164
 }
165 165
 
@@ -171,84 +171,84 @@  discard block
 block discarded – undo
171 171
  * The definition of the edit team forum form
172 172
  */
173 173
 function boincteam_forum_edit_form(&$form_state, $tfid) {
174
-  $form = array();
175
-  $boincteam_forum = boincteam_forum_load($tfid);
174
+    $form = array();
175
+    $boincteam_forum = boincteam_forum_load($tfid);
176 176
   
177
-  $form_state['storage']['tfid'] = $tfid;
177
+    $form_state['storage']['tfid'] = $tfid;
178 178
   
179
-  $default = array(
179
+    $default = array(
180 180
     'title' => $boincteam_forum->title,
181 181
     'min_time_between_posts' => $boincteam_forum->min_time_between_posts,
182 182
     'min_total_credit_to_post' => $boincteam_forum->min_total_credit_to_post,
183 183
     'min_avg_credit_to_post' => $boincteam_forum->min_avg_credit_to_post,
184 184
     'public' => ($boincteam_forum->public) ? 1 : 0,
185 185
     'description' => $boincteam_forum->description,
186
-  );
186
+    );
187 187
   
188
-  // Standard option sets
189
-  $form['boolean_options'] = array(
188
+    // Standard option sets
189
+    $form['boolean_options'] = array(
190 190
     '#type' => 'value',
191 191
     '#value' => array(1 => bts('yes'), 0 => bts('no')),
192
-  );
192
+    );
193 193
   
194
-  // Form elements
195
-  $form['title'] = array(
194
+    // Form elements
195
+    $form['title'] = array(
196 196
     '#title' => bts('Message board title'),
197 197
     '#type' => 'textfield',
198 198
     '#default_value' => $default['title'],
199 199
     '#size' => 34,
200 200
     '#description' => bts('Text only, no HTML tags'),
201
-  );
202
-  $form['min_time_between_posts'] = array(
201
+    );
202
+    $form['min_time_between_posts'] = array(
203 203
     '#title' => bts('Minimum time between posts'),
204 204
     '#type' => 'textfield',
205 205
     '#default_value' => $default['min_time_between_posts'],
206 206
     '#size' => 12,
207 207
     '#description' => bts('Seconds'),
208
-  );
209
-  $form['min_total_credit_to_post'] = array(
208
+    );
209
+    $form['min_total_credit_to_post'] = array(
210 210
     '#title' => bts('Minimum total credit to post'),
211 211
     '#type' => 'textfield',
212 212
     '#default_value' => $default['min_total_credit_to_post'],
213 213
     '#size' => 12,
214
-  );
215
-  $form['min_avg_credit_to_post'] = array(
214
+    );
215
+    $form['min_avg_credit_to_post'] = array(
216 216
     '#title' => bts('Minimum avg credit to post'),
217 217
     '#type' => 'textfield',
218 218
     '#default_value' => $default['min_avg_credit_to_post'],
219 219
     '#size' => 12,
220
-  );
221
-  $form['public'] = array(
220
+    );
221
+    $form['public'] = array(
222 222
     '#title' => bts('Allow public to read board?'),
223 223
     '#type' => 'radios',
224 224
     '#options' => $form['boolean_options']['#value'],
225 225
     '#attributes' => array('class' => 'fancy'),
226 226
     '#default_value' => $default['public'],
227
-  );
228
-  $form['description'] = array(
227
+    );
228
+    $form['description'] = array(
229 229
     '#title' => bts('Description'),
230 230
     '#type' => 'textarea',
231 231
     '#default_value' => $default['description'],
232 232
     '#size' => 5,
233
-  );
233
+    );
234 234
   
235
-  // Form control
236
-  $form['form control tabs prefix'] = array(
235
+    // Form control
236
+    $form['form control tabs prefix'] = array(
237 237
     '#value' => '<ul class="form-control tab-list">'
238
-  );
239
-  $form['submit'] = array(
238
+    );
239
+    $form['submit'] = array(
240 240
     '#prefix' => '<li class="first tab">',
241 241
     '#type' => 'submit',
242 242
     '#value' => bts('Save message board'),
243 243
     '#suffix' => '</li>',
244
-  );
245
-  $form['form control tabs'] = array(
244
+    );
245
+    $form['form control tabs'] = array(
246 246
     '#value' => '<li class="tab">' . l(bts('Cancel'), strstr($_GET['q'], '/forum', TRUE)) . '</li>'
247
-  );
247
+    );
248 248
   
249
-  $form['#redirect'] = "community/teams/{$boincteam_forum->nid}";
249
+    $form['#redirect'] = "community/teams/{$boincteam_forum->nid}";
250 250
   
251
-  return $form;
251
+    return $form;
252 252
 }
253 253
 
254 254
 /**
@@ -256,33 +256,33 @@  discard block
 block discarded – undo
256 256
  */
257 257
 function boincteam_forum_edit_form_validate($form, &$form_state) {
258 258
 
259
-  $values = $form_state['values'];
259
+    $values = $form_state['values'];
260 260
   
261
-  if (!$values['title']) {
261
+    if (!$values['title']) {
262 262
     form_set_error('name', bts('Message board title is required.'));
263
-  }
264
-  if (!is_numeric($values['min_time_between_posts']) OR
263
+    }
264
+    if (!is_numeric($values['min_time_between_posts']) OR
265 265
       $values['min_time_between_posts'] < 0) {
266 266
     form_set_error('min_time_between_posts', 
267
-      bts('Please set the minimum time required between posts.')
267
+        bts('Please set the minimum time required between posts.')
268 268
     );
269
-  }
270
-  if (!is_numeric($values['min_total_credit_to_post']) OR
269
+    }
270
+    if (!is_numeric($values['min_total_credit_to_post']) OR
271 271
       $values['min_total_credit_to_post'] < 0) {
272 272
     form_set_error('min_total_credit_to_post',
273
-      bts('Please set the minimum total credit that a user'
273
+        bts('Please set the minimum total credit that a user'
274 274
         . ' must earn in order to post to this message board.'
275
-      )
275
+        )
276 276
     );
277
-  }
278
-  if (!is_numeric($values['min_avg_credit_to_post']) OR
277
+    }
278
+    if (!is_numeric($values['min_avg_credit_to_post']) OR
279 279
       $values['min_avg_credit_to_post'] < 0) {
280 280
     form_set_error('min_avg_credit_to_post', 
281
-      bts('Please set the minimum average credit that a user'
281
+        bts('Please set the minimum average credit that a user'
282 282
         . ' is required to have in order to post to this message board.'
283
-      )
283
+        )
284 284
     );
285
-  }
285
+    }
286 286
 }
287 287
 
288 288
 /**
@@ -290,11 +290,11 @@  discard block
 block discarded – undo
290 290
  */
291 291
 function boincteam_forum_edit_form_submit($form, &$form_state) {
292 292
   
293
-  $tfid = $form_state['storage']['tfid'];
294
-  $values = $form_state['values'];
293
+    $tfid = $form_state['storage']['tfid'];
294
+    $values = $form_state['values'];
295 295
   
296
-  // Update the team forum in the db
297
-  db_query("
296
+    // Update the team forum in the db
297
+    db_query("
298 298
     UPDATE {boincteam_forum} SET
299 299
       title = '%s',
300 300
       min_time_between_posts = '%d',
@@ -311,11 +311,11 @@  discard block
 block discarded – undo
311 311
     ($values['public']) ? 1 : 0,
312 312
     $values['description'],
313 313
     $tfid
314
-  );
314
+    );
315 315
   
316
-  drupal_set_message(t('Details for message board "@forum" have been updated.',
316
+    drupal_set_message(t('Details for message board "@forum" have been updated.',
317 317
     array('@forum' => $values['title'])));
318 318
   
319
-  // The storage variable quietly kills redirection for some reason... unset it
320
-  unset($form_state['storage']);
319
+    // The storage variable quietly kills redirection for some reason... unset it
320
+    unset($form_state['storage']);
321 321
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     '#suffix' => '</li>',
87 87
   );
88 88
   $form['form control tabs'] = array(
89
-    '#value' => '<li class="tab">' . l(bts('Cancel'), strstr($_GET['q'], '/forum/add', TRUE)) . '</li>'
89
+    '#value' => '<li class="tab">'.l(bts('Cancel'), strstr($_GET['q'], '/forum/add', TRUE)).'</li>'
90 90
   );
91 91
   
92 92
   $form['#redirect'] = "community/teams/{$account->team}";
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
       updated = UNIX_TIMESTAMP()",
153 153
     $account->team,
154 154
     $values['title'],
155
-    (int) $values['min_time_between_posts'],
156
-    (int) $values['min_total_credit_to_post'],
157
-    (int) $values['min_avg_credit_to_post'],
155
+    (int)$values['min_time_between_posts'],
156
+    (int)$values['min_total_credit_to_post'],
157
+    (int)$values['min_avg_credit_to_post'],
158 158
     ($values['public']) ? 1 : 0,
159 159
     $values['description']
160 160
   );
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
     '#suffix' => '</li>',
244 244
   );
245 245
   $form['form control tabs'] = array(
246
-    '#value' => '<li class="tab">' . l(bts('Cancel'), strstr($_GET['q'], '/forum', TRUE)) . '</li>'
246
+    '#value' => '<li class="tab">'.l(bts('Cancel'), strstr($_GET['q'], '/forum', TRUE)).'</li>'
247 247
   );
248 248
   
249 249
   $form['#redirect'] = "community/teams/{$boincteam_forum->nid}";
@@ -305,9 +305,9 @@  discard block
 block discarded – undo
305 305
       updated = UNIX_TIMESTAMP()
306 306
     WHERE tfid='%d'",
307 307
     $values['title'],
308
-    (int) $values['min_time_between_posts'],
309
-    (int) $values['min_total_credit_to_post'],
310
-    (int) $values['min_avg_credit_to_post'],
308
+    (int)$values['min_time_between_posts'],
309
+    (int)$values['min_total_credit_to_post'],
310
+    (int)$values['min_avg_credit_to_post'],
311 311
     ($values['public']) ? 1 : 0,
312 312
     $values['description'],
313 313
     $tfid
Please login to merge, or discard this patch.
Upper-Lower-Casing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     '#suffix' => '</li>',
87 87
   );
88 88
   $form['form control tabs'] = array(
89
-    '#value' => '<li class="tab">' . l(bts('Cancel'), strstr($_GET['q'], '/forum/add', TRUE)) . '</li>'
89
+    '#value' => '<li class="tab">' . l(bts('Cancel'), strstr($_GET['q'], '/forum/add', true)) . '</li>'
90 90
   );
91 91
   
92 92
   $form['#redirect'] = "community/teams/{$account->team}";
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
   if (!$values['title']) {
105 105
     form_set_error('name', bts('Message board title is required.'));
106 106
   }
107
-  if (!is_numeric($values['min_time_between_posts']) OR
107
+  if (!is_numeric($values['min_time_between_posts']) or
108 108
       $values['min_time_between_posts'] < 0) {
109 109
     form_set_error('min_time_between_posts',
110 110
       bts('Please set the minimum time required between posts.')
111 111
     );
112 112
   }
113
-  if (!is_numeric($values['min_total_credit_to_post']) OR
113
+  if (!is_numeric($values['min_total_credit_to_post']) or
114 114
       $values['min_total_credit_to_post'] < 0) {
115 115
     form_set_error('min_total_credit_to_post',
116 116
       bts('Please set the minimum total credit that a user'
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
       )
119 119
     );
120 120
   }
121
-  if (!is_numeric($values['min_avg_credit_to_post']) OR
121
+  if (!is_numeric($values['min_avg_credit_to_post']) or
122 122
       $values['min_avg_credit_to_post'] < 0) {
123 123
     form_set_error('min_avg_credit_to_post',
124 124
       bts('Please set the minimum average credit that a user'
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
     '#suffix' => '</li>',
244 244
   );
245 245
   $form['form control tabs'] = array(
246
-    '#value' => '<li class="tab">' . l(bts('Cancel'), strstr($_GET['q'], '/forum', TRUE)) . '</li>'
246
+    '#value' => '<li class="tab">' . l(bts('Cancel'), strstr($_GET['q'], '/forum', true)) . '</li>'
247 247
   );
248 248
   
249 249
   $form['#redirect'] = "community/teams/{$boincteam_forum->nid}";
@@ -261,13 +261,13 @@  discard block
 block discarded – undo
261 261
   if (!$values['title']) {
262 262
     form_set_error('name', bts('Message board title is required.'));
263 263
   }
264
-  if (!is_numeric($values['min_time_between_posts']) OR
264
+  if (!is_numeric($values['min_time_between_posts']) or
265 265
       $values['min_time_between_posts'] < 0) {
266 266
     form_set_error('min_time_between_posts', 
267 267
       bts('Please set the minimum time required between posts.')
268 268
     );
269 269
   }
270
-  if (!is_numeric($values['min_total_credit_to_post']) OR
270
+  if (!is_numeric($values['min_total_credit_to_post']) or
271 271
       $values['min_total_credit_to_post'] < 0) {
272 272
     form_set_error('min_total_credit_to_post',
273 273
       bts('Please set the minimum total credit that a user'
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
       )
276 276
     );
277 277
   }
278
-  if (!is_numeric($values['min_avg_credit_to_post']) OR
278
+  if (!is_numeric($values['min_avg_credit_to_post']) or
279 279
       $values['min_avg_credit_to_post'] < 0) {
280 280
     form_set_error('min_avg_credit_to_post', 
281 281
       bts('Please set the minimum average credit that a user'
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincteam/boincteam_forum.module 4 patches
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -25,29 +25,29 @@  discard block
 block discarded – undo
25 25
  * Implementation of hook_menu()
26 26
  */
27 27
 function boincteam_forum_menu() {
28
-  $items = array();
28
+    $items = array();
29 29
 
30
-  return $items;
30
+    return $items;
31 31
 }
32 32
 
33 33
 /**
34 34
 * Implementation of hook_form_alter()
35 35
 */
36 36
 function boincteam_forum_form_alter(&$form, $form_state, $form_id) {
37
-  switch ($form_id) {
38
-  // Team forum node edit form
39
-  case 'team_forum_node_form':
37
+    switch ($form_id) {
38
+    // Team forum node edit form
39
+    case 'team_forum_node_form':
40 40
     
41 41
     // Internal fields to indicate where these changes are taking place
42 42
     array_unshift($form, array(
43
-      'tfid' => array(
43
+        'tfid' => array(
44 44
         '#type' => 'hidden',
45 45
         '#value' => arg(3),
46
-      ),
46
+        ),
47 47
     ));
48 48
     break;
49 49
   
50
-  default:
50
+    default:
51 51
   }
52 52
 }
53 53
 
@@ -56,26 +56,26 @@  discard block
 block discarded – undo
56 56
  * Obsolete in Drupal 7...
57 57
  */
58 58
 function boincteam_forum_nodeapi(&$node, $op, $a3 = null, $a4 = null) {
59
-  // In Drupal 7, these operation cases will all exist as their own hooks,
60
-  // so let's approximate that here so that this function can simply be removed
61
-  // upon migration to 7
62
-  switch($op) {
63
-  case 'insert':
59
+    // In Drupal 7, these operation cases will all exist as their own hooks,
60
+    // so let's approximate that here so that this function can simply be removed
61
+    // upon migration to 7
62
+    switch($op) {
63
+    case 'insert':
64 64
     boincteam_forum_node_insert($node);
65 65
     break;
66
-  case 'load':
66
+    case 'load':
67 67
     boincteam_forum_node_load($node);
68 68
     break;
69
-  case 'update':
69
+    case 'update':
70 70
     boincteam_forum_node_update($node);
71 71
     break;
72
-  case 'validate':
72
+    case 'validate':
73 73
     boincteam_forum_node_validate($node);
74 74
     break;
75
-  case 'view':
75
+    case 'view':
76 76
     boincteam_forum_node_view($node);
77 77
     break;
78
-  default:
78
+    default:
79 79
   }
80 80
 }
81 81
 
@@ -84,21 +84,21 @@  discard block
 block discarded – undo
84 84
  * is inserted (forward compatible to Drupal 7)
85 85
  */
86 86
 function boincteam_forum_node_insert($node) {
87
-  switch($node->type) {
88
-  case 'team_forum':
87
+    switch($node->type) {
88
+    case 'team_forum':
89 89
     $account = user_load($node->uid);
90 90
     $team_id = boincteam_forum_lookup_nid($node->tfid);
91 91
     if ($account->team == $team_id) {
92
-      db_query("
92
+        db_query("
93 93
         INSERT INTO {boincteam_forum_node} SET
94 94
           nid = %d,
95 95
           tfid = %d",
96 96
         $node->nid, $node->tfid
97
-      );
97
+        );
98 98
     }
99 99
     unset($node->tfid);
100 100
     break;
101
-  default:
101
+    default:
102 102
   }
103 103
 }
104 104
 
@@ -107,15 +107,15 @@  discard block
 block discarded – undo
107 107
  * is loaded (forward compatible to Drupal 7)
108 108
  */
109 109
 function boincteam_forum_node_load($node) {
110
-  switch($node->type) {
111
-  case 'team_forum':
110
+    switch($node->type) {
111
+    case 'team_forum':
112 112
     $node->tfid = db_result(db_query("
113 113
       SELECT tfid FROM {boincteam_forum_node}
114 114
       WHERE nid = %d", $node->nid
115 115
     ));
116 116
     break;
117 117
     
118
-  default:
118
+    default:
119 119
     
120 120
   }
121 121
 }
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
  * is updated (forward compatible to Drupal 7)
126 126
  */
127 127
 function boincteam_forum_node_update($node) {
128
-  switch($node->type) {
129
-  case 'team_forum':
128
+    switch($node->type) {
129
+    case 'team_forum':
130 130
     
131 131
     break;
132 132
     
133
-  default:
133
+    default:
134 134
     
135 135
   }
136 136
 }
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
  * is validated (forward compatible to Drupal 7)
141 141
  */
142 142
 function boincteam_forum_node_validate($node) {
143
-  switch($node->type) {
144
-  case 'team_forum':
143
+    switch($node->type) {
144
+    case 'team_forum':
145 145
     $account = user_load($node->uid);
146 146
     // Get tfid from node, but if empty/null, get it from the database
147 147
     if (!($node->tfid)) {
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
     }
155 155
     $team_id = boincteam_forum_lookup_nid($tfid);
156 156
     if (!$account->team OR $account->team != $team_id) {
157
-      drupal_set_message(t('Failed to add team forum topic.'), 'error');
158
-      drupal_goto('community/forum');
157
+        drupal_set_message(t('Failed to add team forum topic.'), 'error');
158
+        drupal_goto('community/forum');
159 159
     }
160 160
     break;
161
-  default:
161
+    default:
162 162
   }
163 163
 }
164 164
 
@@ -167,19 +167,19 @@  discard block
 block discarded – undo
167 167
  * is viewed (forward compatible to Drupal 7)
168 168
  */
169 169
 function boincteam_forum_node_view($node) {
170
-  switch($node->type) {
171
-  case 'team_forum':
170
+    switch($node->type) {
171
+    case 'team_forum':
172 172
     $team_id = boincteam_forum_lookup_nid($node->tfid);
173 173
     $public_forum = boincteam_forum_is_public($node->tfid);
174 174
     $is_member = boincteam_is_member($team_id);
175 175
     $is_global_moderator = boincteam_forum_is_global_moderator();
176 176
     if (!$public_forum AND !$is_member AND !$is_global_moderator) {
177
-      drupal_not_found();
178
-      module_invoke_all('exit');
179
-      exit();
177
+        drupal_not_found();
178
+        module_invoke_all('exit');
179
+        exit();
180 180
     }
181 181
     break;
182
-  default:
182
+    default:
183 183
   }
184 184
 }
185 185
 
@@ -187,17 +187,17 @@  discard block
 block discarded – undo
187 187
 * Implementation of hook_views_api().
188 188
 */
189 189
 function boincteam_forum_views_api() {
190
-  return array(
190
+    return array(
191 191
     'api' => 2.0,
192 192
     'path' => drupal_get_path('module', 'boincteam_forum')
193
-  );
193
+    );
194 194
 }
195 195
 
196 196
 /**
197 197
  * Implementation of hook_perm()
198 198
  */
199 199
 function boincteam_forum_perm() {
200
-  return array('manage boincteam forum');
200
+    return array('manage boincteam forum');
201 201
 }
202 202
 
203 203
 
@@ -209,43 +209,43 @@  discard block
 block discarded – undo
209 209
  * Check if the user has global access to moderate team forums
210 210
  */
211 211
 function boincteam_forum_is_global_moderator() {
212
-  global $user;
213
-  return user_access('manage boincteam forum');
212
+    global $user;
213
+    return user_access('manage boincteam forum');
214 214
 }
215 215
 
216 216
 /*
217 217
  * Check if any forums for a team are public
218 218
  */
219 219
 function boincteam_forum_is_any_public($team_id) {
220
-  $forums = boincteam_forum_list($team_id);
221
-  foreach ($forums as $forum) {
220
+    $forums = boincteam_forum_list($team_id);
221
+    foreach ($forums as $forum) {
222 222
     if ($forum->public) {
223
-      return TRUE;
223
+        return TRUE;
224 224
     }
225
-  }
226
-  return FALSE;
225
+    }
226
+    return FALSE;
227 227
 }
228 228
 
229 229
 /*
230 230
  * Check if a team forum should be visible to everyone
231 231
  */
232 232
 function boincteam_forum_is_public($tfid) {
233
-  return db_result(db_query("
233
+    return db_result(db_query("
234 234
     SELECT public FROM {boincteam_forum} WHERE tfid=%d", $tfid
235
-  ));
235
+    ));
236 236
 }
237 237
 
238 238
 /*
239 239
  * Load the forums for a team, if any exist
240 240
  */
241 241
 function boincteam_forum_list($team_id = NULL) {
242
-  if (!$team_id) {
242
+    if (!$team_id) {
243 243
     global $user;
244 244
     $account = user_load($user->uid);
245 245
     $team_id = $account->team;
246
-  }
247
-  $team_forums = array();
248
-  if ($team_id) {
246
+    }
247
+    $team_forums = array();
248
+    if ($team_id) {
249 249
     // Load any team forum objects for the user's team
250 250
     $result = db_query("
251 251
       SELECT tfid, nid, title, description, created, updated, public,
@@ -255,26 +255,26 @@  discard block
 block discarded – undo
255 255
     $row = 0;
256 256
     while ($team_forum = db_fetch_object($result)) {
257 257
       
258
-      $team_forum->link = url("community/teams/{$team_id}/forum/{$team_forum->tfid}");
259
-      $team_forum->zebra = $row % 2 ? 'even' : 'odd';
260
-      $team_forum->new_topics = 0; // TODO: Track user views of team topics
261
-      $team_forum->new_text = '';
262
-      $team_forum->new_url = '';
263
-      $team_forum->num_topics = db_result(db_query("
258
+        $team_forum->link = url("community/teams/{$team_id}/forum/{$team_forum->tfid}");
259
+        $team_forum->zebra = $row % 2 ? 'even' : 'odd';
260
+        $team_forum->new_topics = 0; // TODO: Track user views of team topics
261
+        $team_forum->new_text = '';
262
+        $team_forum->new_url = '';
263
+        $team_forum->num_topics = db_result(db_query("
264 264
         SELECT COUNT(nid) FROM {boincteam_forum_node}
265 265
         WHERE tfid = %d",
266 266
         $team_forum->tfid
267
-      ));
268
-      $team_forum->num_posts = db_result(db_query("
267
+        ));
268
+        $team_forum->num_posts = db_result(db_query("
269 269
         SELECT COALESCE(SUM(ncs.comment_count),0) + COUNT(ncs.nid)
270 270
         FROM {boincteam_forum_node} bfn
271 271
         JOIN {node_comment_statistics} ncs ON ncs.nid = bfn.nid
272 272
         JOIN {node} n ON n.nid = ncs.nid
273 273
         WHERE bfn.tfid = %d AND n.status = 1",
274 274
         $team_forum->tfid
275
-      ));
276
-      $last_post = new stdClass();
277
-      $last_post->timestamp = db_result(db_query("
275
+        ));
276
+        $last_post = new stdClass();
277
+        $last_post->timestamp = db_result(db_query("
278 278
         SELECT ncs.last_comment_timestamp FROM {node} n
279 279
         INNER JOIN {boincteam_forum_node} bfn
280 280
         INNER JOIN {node_comment_statistics} ncs ON n.nid = bfn.nid AND n.nid = ncs.nid
@@ -282,36 +282,36 @@  discard block
 block discarded – undo
282 282
         ORDER BY ncs.last_comment_timestamp DESC
283 283
         LIMIT 1",
284 284
         $team_forum->tfid
285
-      ));
286
-      $team_forum->last_reply = theme('forum_submitted', ($last_post->timestamp) ? $last_post : NULL);
287
-      $team_forums[$team_forum->tfid] = $team_forum;
288
-      $row++;
285
+        ));
286
+        $team_forum->last_reply = theme('forum_submitted', ($last_post->timestamp) ? $last_post : NULL);
287
+        $team_forums[$team_forum->tfid] = $team_forum;
288
+        $row++;
289 289
     }
290
-  }
291
-  return $team_forums;
290
+    }
291
+    return $team_forums;
292 292
 }
293 293
 
294 294
 /*
295 295
  * Load a team forum by ID
296 296
  */
297 297
 function boincteam_forum_load($tfid) {
298
-  // Load any team forum objects for the user's team
299
-  $result = db_query("
298
+    // Load any team forum objects for the user's team
299
+    $result = db_query("
300 300
     SELECT tfid, nid, title, description, created, updated, public,
301 301
       min_time_between_posts, min_total_credit_to_post, min_avg_credit_to_post
302 302
     FROM {boincteam_forum} WHERE tfid=%d", $tfid
303
-  );
304
-  return db_fetch_object($result);
303
+    );
304
+    return db_fetch_object($result);
305 305
 }
306 306
 
307 307
 /*
308 308
  * Look up the team ID for a given team forum
309 309
  */
310 310
 function boincteam_forum_lookup_nid($tfid) {
311
-  return db_result(db_query("
311
+    return db_result(db_query("
312 312
     SELECT nid FROM {boincteam_forum}
313 313
     WHERE tfid=%d", $tfid
314
-  ));
314
+    ));
315 315
 }
316 316
 
317 317
 
@@ -323,80 +323,80 @@  discard block
 block discarded – undo
323 323
  * Create team forum form
324 324
  */
325 325
 function boincteam_forum_create_form_panel() {
326
-  $output = '';
327
-  $output .= '<h2 class="pane-title">' . bts('Create team message board')
326
+    $output = '';
327
+    $output .= '<h2 class="pane-title">' . bts('Create team message board')
328 328
     . '</h2>';
329
-  $output .= drupal_get_form('boincteam_forum_create_form');
329
+    $output .= drupal_get_form('boincteam_forum_create_form');
330 330
   
331
-  return $output;
331
+    return $output;
332 332
 }
333 333
 
334 334
 /**
335 335
  * Edit team forum form
336 336
  */
337 337
 function boincteam_forum_edit_form_panel($tfid) {
338
-  $team_forum = boincteam_forum_load($tfid);
339
-  $output = '';
340
-  $output .= '<h2 class="pane-title">' . bts('Edit message board') . ': ' . 
338
+    $team_forum = boincteam_forum_load($tfid);
339
+    $output = '';
340
+    $output .= '<h2 class="pane-title">' . bts('Edit message board') . ': ' . 
341 341
     $team_forum->title . '</h2>';
342
-  $output .= drupal_get_form('boincteam_forum_edit_form', $tfid);
342
+    $output .= drupal_get_form('boincteam_forum_edit_form', $tfid);
343 343
   
344
-  return $output;
344
+    return $output;
345 345
 }
346 346
 
347 347
 /**
348 348
  * Link to team forums
349 349
  */
350 350
 function boincteam_forum_link_panel($team_id) {
351
-  $show_public_only = (
351
+    $show_public_only = (
352 352
     !boincteam_is_member($team_id) AND
353 353
     !boincteam_forum_is_global_moderator()
354
-  );
355
-  $forums = boincteam_forum_list($team_id);
356
-  $output = '';
357
-  $output .= '<h2 class="pane-title">' . bts('Team forum') . '</h2>';
358
-  $output .= '<p>'
354
+    );
355
+    $forums = boincteam_forum_list($team_id);
356
+    $output = '';
357
+    $output .= '<h2 class="pane-title">' . bts('Team forum') . '</h2>';
358
+    $output .= '<p>'
359 359
     . bts('A discussion forum has been set up for team members.')
360 360
     . '</p>';
361
-  $output .= '<ul class="tab-list action-list">';
362
-  foreach ($forums as $forum) {
361
+    $output .= '<ul class="tab-list action-list">';
362
+    foreach ($forums as $forum) {
363 363
     if (!$show_public_only OR $forum->public) {
364
-      $output .= '  <li class="tab primary">' . 
364
+        $output .= '  <li class="tab primary">' . 
365 365
         l(
366
-          //$forum->title,
367
-          bts('Enter forum'),
368
-          "community/teams/{$team_id}/forum/{$forum->tfid}"
366
+            //$forum->title,
367
+            bts('Enter forum'),
368
+            "community/teams/{$team_id}/forum/{$forum->tfid}"
369 369
         ) . '</li>';
370
-      // Since we're only supporting one team forum for now, we've labeled the
371
-      // link in a generic way above and will now just break out of the loop
372
-      break;
370
+        // Since we're only supporting one team forum for now, we've labeled the
371
+        // link in a generic way above and will now just break out of the loop
372
+        break;
373 373
     }
374
-  }
375
-  $output .= '</ul>';
376
-  return $output;
374
+    }
375
+    $output .= '</ul>';
376
+    return $output;
377 377
 }
378 378
 
379 379
 /**
380 380
  * General info about team forums
381 381
  */                                         
382 382
 function boincteam_forum_topic_overview_panel($nid = NULL) {
383
-  $output = '';
384
-  $output .= '<h2 class="pane-title">' . bts('About message boards') . '</h2>';
385
-  $output .= '<div>';
386
-  if ($nid) {
383
+    $output = '';
384
+    $output .= '<h2 class="pane-title">' . bts('About message boards') . '</h2>';
385
+    $output .= '<div>';
386
+    if ($nid) {
387 387
     $team = node_load($nid);
388 388
     $output .= '<p>' . bts('You may create a message board for use by @team',
389
-      array('@team' => $team->title)) . ':</p>';
390
-  }
391
-  else {
389
+        array('@team' => $team->title)) . ':</p>';
390
+    }
391
+    else {
392 392
     $output .= '<p>' . bts('This is a team-only message board') . ':</p>';
393
-  }
394
-  $output .= '<ul>';
395
-  $output .= '  <li>' . bts('Only members may post') . '</li>';
396
-  $output .= '  <li>' . bts('Only members may read (optional)') . '</li>';
397
-  $output .= '  <li>' . bts('Founder & Team Admins have moderator privileges') .
393
+    }
394
+    $output .= '<ul>';
395
+    $output .= '  <li>' . bts('Only members may post') . '</li>';
396
+    $output .= '  <li>' . bts('Only members may read (optional)') . '</li>';
397
+    $output .= '  <li>' . bts('Founder & Team Admins have moderator privileges') .
398 398
     '</li>';
399
-  $output .= '</ul>';
400
-  $output .= '</div>';
401
-  return $output;
399
+    $output .= '</ul>';
400
+    $output .= '</div>';
401
+    return $output;
402 402
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
   // In Drupal 7, these operation cases will all exist as their own hooks,
60 60
   // so let's approximate that here so that this function can simply be removed
61 61
   // upon migration to 7
62
-  switch($op) {
62
+  switch ($op) {
63 63
   case 'insert':
64 64
     boincteam_forum_node_insert($node);
65 65
     break;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
  * is inserted (forward compatible to Drupal 7)
85 85
  */
86 86
 function boincteam_forum_node_insert($node) {
87
-  switch($node->type) {
87
+  switch ($node->type) {
88 88
   case 'team_forum':
89 89
     $account = user_load($node->uid);
90 90
     $team_id = boincteam_forum_lookup_nid($node->tfid);
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
  * is loaded (forward compatible to Drupal 7)
108 108
  */
109 109
 function boincteam_forum_node_load($node) {
110
-  switch($node->type) {
110
+  switch ($node->type) {
111 111
   case 'team_forum':
112 112
     $node->tfid = db_result(db_query("
113 113
       SELECT tfid FROM {boincteam_forum_node}
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
  * is updated (forward compatible to Drupal 7)
126 126
  */
127 127
 function boincteam_forum_node_update($node) {
128
-  switch($node->type) {
128
+  switch ($node->type) {
129 129
   case 'team_forum':
130 130
     
131 131
     break;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
  * is validated (forward compatible to Drupal 7)
141 141
  */
142 142
 function boincteam_forum_node_validate($node) {
143
-  switch($node->type) {
143
+  switch ($node->type) {
144 144
   case 'team_forum':
145 145
     $account = user_load($node->uid);
146 146
     // Get tfid from node, but if empty/null, get it from the database
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
  * is viewed (forward compatible to Drupal 7)
168 168
  */
169 169
 function boincteam_forum_node_view($node) {
170
-  switch($node->type) {
170
+  switch ($node->type) {
171 171
   case 'team_forum':
172 172
     $team_id = boincteam_forum_lookup_nid($node->tfid);
173 173
     $public_forum = boincteam_forum_is_public($node->tfid);
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     while ($team_forum = db_fetch_object($result)) {
257 257
       
258 258
       $team_forum->link = url("community/teams/{$team_id}/forum/{$team_forum->tfid}");
259
-      $team_forum->zebra = $row % 2 ? 'even' : 'odd';
259
+      $team_forum->zebra = $row%2 ? 'even' : 'odd';
260 260
       $team_forum->new_topics = 0; // TODO: Track user views of team topics
261 261
       $team_forum->new_text = '';
262 262
       $team_forum->new_url = '';
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
  */
325 325
 function boincteam_forum_create_form_panel() {
326 326
   $output = '';
327
-  $output .= '<h2 class="pane-title">' . bts('Create team message board')
327
+  $output .= '<h2 class="pane-title">'.bts('Create team message board')
328 328
     . '</h2>';
329 329
   $output .= drupal_get_form('boincteam_forum_create_form');
330 330
   
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
 function boincteam_forum_edit_form_panel($tfid) {
338 338
   $team_forum = boincteam_forum_load($tfid);
339 339
   $output = '';
340
-  $output .= '<h2 class="pane-title">' . bts('Edit message board') . ': ' . 
341
-    $team_forum->title . '</h2>';
340
+  $output .= '<h2 class="pane-title">'.bts('Edit message board').': '. 
341
+    $team_forum->title.'</h2>';
342 342
   $output .= drupal_get_form('boincteam_forum_edit_form', $tfid);
343 343
   
344 344
   return $output;
@@ -354,19 +354,19 @@  discard block
 block discarded – undo
354 354
   );
355 355
   $forums = boincteam_forum_list($team_id);
356 356
   $output = '';
357
-  $output .= '<h2 class="pane-title">' . bts('Team forum') . '</h2>';
357
+  $output .= '<h2 class="pane-title">'.bts('Team forum').'</h2>';
358 358
   $output .= '<p>'
359 359
     . bts('A discussion forum has been set up for team members.')
360 360
     . '</p>';
361 361
   $output .= '<ul class="tab-list action-list">';
362 362
   foreach ($forums as $forum) {
363 363
     if (!$show_public_only OR $forum->public) {
364
-      $output .= '  <li class="tab primary">' . 
364
+      $output .= '  <li class="tab primary">'. 
365 365
         l(
366 366
           //$forum->title,
367 367
           bts('Enter forum'),
368 368
           "community/teams/{$team_id}/forum/{$forum->tfid}"
369
-        ) . '</li>';
369
+        ).'</li>';
370 370
       // Since we're only supporting one team forum for now, we've labeled the
371 371
       // link in a generic way above and will now just break out of the loop
372 372
       break;
@@ -381,20 +381,20 @@  discard block
 block discarded – undo
381 381
  */                                         
382 382
 function boincteam_forum_topic_overview_panel($nid = NULL) {
383 383
   $output = '';
384
-  $output .= '<h2 class="pane-title">' . bts('About message boards') . '</h2>';
384
+  $output .= '<h2 class="pane-title">'.bts('About message boards').'</h2>';
385 385
   $output .= '<div>';
386 386
   if ($nid) {
387 387
     $team = node_load($nid);
388
-    $output .= '<p>' . bts('You may create a message board for use by @team',
389
-      array('@team' => $team->title)) . ':</p>';
388
+    $output .= '<p>'.bts('You may create a message board for use by @team',
389
+      array('@team' => $team->title)).':</p>';
390 390
   }
391 391
   else {
392
-    $output .= '<p>' . bts('This is a team-only message board') . ':</p>';
392
+    $output .= '<p>'.bts('This is a team-only message board').':</p>';
393 393
   }
394 394
   $output .= '<ul>';
395
-  $output .= '  <li>' . bts('Only members may post') . '</li>';
396
-  $output .= '  <li>' . bts('Only members may read (optional)') . '</li>';
397
-  $output .= '  <li>' . bts('Founder & Team Admins have moderator privileges') .
395
+  $output .= '  <li>'.bts('Only members may post').'</li>';
396
+  $output .= '  <li>'.bts('Only members may read (optional)').'</li>';
397
+  $output .= '  <li>'.bts('Founder & Team Admins have moderator privileges').
398 398
     '</li>';
399 399
   $output .= '</ul>';
400 400
   $output .= '</div>';
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -387,8 +387,7 @@
 block discarded – undo
387 387
     $team = node_load($nid);
388 388
     $output .= '<p>' . bts('You may create a message board for use by @team',
389 389
       array('@team' => $team->title)) . ':</p>';
390
-  }
391
-  else {
390
+  } else {
392 391
     $output .= '<p>' . bts('This is a team-only message board') . ':</p>';
393 392
   }
394 393
   $output .= '<ul>';
Please login to merge, or discard this patch.
Upper-Lower-Casing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         $tfid = $node->tfid;
154 154
     }
155 155
     $team_id = boincteam_forum_lookup_nid($tfid);
156
-    if (!$account->team OR $account->team != $team_id) {
156
+    if (!$account->team or $account->team != $team_id) {
157 157
       drupal_set_message(t('Failed to add team forum topic.'), 'error');
158 158
       drupal_goto('community/forum');
159 159
     }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
     $public_forum = boincteam_forum_is_public($node->tfid);
174 174
     $is_member = boincteam_is_member($team_id);
175 175
     $is_global_moderator = boincteam_forum_is_global_moderator();
176
-    if (!$public_forum AND !$is_member AND !$is_global_moderator) {
176
+    if (!$public_forum and !$is_member and !$is_global_moderator) {
177 177
       drupal_not_found();
178 178
       module_invoke_all('exit');
179 179
       exit();
@@ -220,10 +220,10 @@  discard block
 block discarded – undo
220 220
   $forums = boincteam_forum_list($team_id);
221 221
   foreach ($forums as $forum) {
222 222
     if ($forum->public) {
223
-      return TRUE;
223
+      return true;
224 224
     }
225 225
   }
226
-  return FALSE;
226
+  return false;
227 227
 }
228 228
 
229 229
 /*
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 /*
239 239
  * Load the forums for a team, if any exist
240 240
  */
241
-function boincteam_forum_list($team_id = NULL) {
241
+function boincteam_forum_list($team_id = null) {
242 242
   if (!$team_id) {
243 243
     global $user;
244 244
     $account = user_load($user->uid);
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
         LIMIT 1",
284 284
         $team_forum->tfid
285 285
       ));
286
-      $team_forum->last_reply = theme('forum_submitted', ($last_post->timestamp) ? $last_post : NULL);
286
+      $team_forum->last_reply = theme('forum_submitted', ($last_post->timestamp) ? $last_post : null);
287 287
       $team_forums[$team_forum->tfid] = $team_forum;
288 288
       $row++;
289 289
     }
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
  */
350 350
 function boincteam_forum_link_panel($team_id) {
351 351
   $show_public_only = (
352
-    !boincteam_is_member($team_id) AND
352
+    !boincteam_is_member($team_id) and
353 353
     !boincteam_forum_is_global_moderator()
354 354
   );
355 355
   $forums = boincteam_forum_list($team_id);
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
     . '</p>';
361 361
   $output .= '<ul class="tab-list action-list">';
362 362
   foreach ($forums as $forum) {
363
-    if (!$show_public_only OR $forum->public) {
363
+    if (!$show_public_only or $forum->public) {
364 364
       $output .= '  <li class="tab primary">' . 
365 365
         l(
366 366
           //$forum->title,
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 /**
380 380
  * General info about team forums
381 381
  */                                         
382
-function boincteam_forum_topic_overview_panel($nid = NULL) {
382
+function boincteam_forum_topic_overview_panel($nid = null) {
383 383
   $output = '';
384 384
   $output .= '<h2 class="pane-title">' . bts('About message boards') . '</h2>';
385 385
   $output .= '<div>';
Please login to merge, or discard this patch.