Ignore:
Timestamp:
2012/02/06 11:05:15 (14 years ago)
Author:
Seasoft
Message:

#1613 (ソース整形・ソースコメントの改善)

  • Zend Framework PHP 標準コーディング規約への準拠を高めた
Location:
branches/version-2_12-dev/data/class/graph
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/class/graph/SC_GraphBar.php

    r21420 r21441  
    4040 
    4141        // 棒グラフの描画 
    42         for($i = 0; $i < $this->line_max; $i++) { 
     42        for ($i = 0; $i < $this->line_max; $i++) { 
    4343            $this->drawBar($i); 
    4444        } 
    4545 
    4646        // ラベルの描画 
    47         for($i = 0; $i < $this->line_max; $i++) { 
     47        for ($i = 0; $i < $this->line_max; $i++) { 
    4848            $this->drawLabel($i); 
    4949        } 
     
    6666        // 色数の取得 
    6767        $c_max = count($this->arrColor); 
    68         for($i = 0; $i < $count; $i++) { 
     68        for ($i = 0; $i < $count; $i++) { 
    6969            $left = $arrPointList[$i][0] - $half_scale + BAR_PAD + ($bar_width * $line_no); 
    7070            $top = $arrPointList[$i][1]; 
     
    7373 
    7474            // 影の描画 
    75             if($this->shade_on) { 
     75            if ($this->shade_on) { 
    7676                imagefilledrectangle($this->image, $left + 2, $top + 2, $right + 2, $bottom, $this->shade_color); 
    7777            } 
     
    8787        $arrPointList = $this->arrPointList[$line_no]; 
    8888        $count = count($arrPointList); 
    89         for($i = 0; $i < $count; $i++) { 
     89        for ($i = 0; $i < $count; $i++) { 
    9090            $x = $arrPointList[$i][0]; 
    9191            $y = $arrPointList[$i][1]; 
  • branches/version-2_12-dev/data/class/graph/SC_GraphBase.php

    r21420 r21441  
    215215        $new_height = $this->bgh * 0.8; 
    216216        $tmp_image = imagecreatetruecolor($new_width, $new_height); 
    217         if(imagecopyresampled($tmp_image, $this->image, 0, 0, 0, 0, $new_width, $new_height, $this->bgw, $this->bgh)) { 
     217        if (imagecopyresampled($tmp_image, $this->image, 0, 0, 0, 0, $new_width, $new_height, $this->bgw, $this->bgh)) { 
    218218            $this->image = $tmp_image; 
    219219        } 
     
    225225        $count = count($this->arrRGB); 
    226226        // 通常色の設定 
    227         for($i = 0; $i < $count; $i++) { 
     227        for ($i = 0; $i < $count; $i++) { 
    228228            $this->arrColor[$i] = $this->lfGetImageColor($this->image, $this->arrRGB[$i]); 
    229229        } 
    230230        // 暗色の設定 
    231         for($i = 0; $i < $count; $i++) { 
     231        for ($i = 0; $i < $count; $i++) { 
    232232            $this->arrDarkColor[$i] = $this->lfGetImageDarkColor($this->image, $this->arrRGB[$i]); 
    233233        } 
     
    241241    // 画像を出力する 
    242242    function outputGraph($header = true, $filename = "") { 
    243         if($header) { 
     243        if ($header) { 
    244244            header('Content-type: image/png'); 
    245245        } 
     
    247247        if ($filename != "") { 
    248248            imagepng($this->image, $filename); 
    249         }else{ 
     249        } else { 
    250250            imagepng($this->image); 
    251251        } 
     
    272272        $angle = -$angle; 
    273273        // ラベル背景 
    274         if($labelbg) { 
     274        if ($labelbg) { 
    275275            $text_width = $this->getTextWidth($text, $font_size); 
    276276            imagefilledrectangle($this->image, $left - 2, $top - 2, $left + $text_width + 2, $top + $font_size + 2, $this->labelbg_color); 
     
    292292        $text = mb_convert_encoding($text, "EUC-JP", CHAR_CODE); 
    293293        //$text = mb_convert_encoding($text, CHAR_CODE); 
    294         if($color != NULL) { 
     294        if ($color != NULL) { 
    295295            ImageTTFText($this->image, $font_size, $angle, $left, $top + $font_size, $color, FONT_REALFILE, $text); 
    296296        } else { 
     
    311311    function debugPrint($text) { 
    312312        $text = mb_convert_encoding($text, "UTF-8", CHAR_CODE); 
    313         if(!isset($this->text_top)) { 
     313        if (!isset($this->text_top)) { 
    314314            $this->text_top = FONT_SIZE + LINE_PAD; 
    315315        } 
     
    322322    function drawLegend($legend_max = "", $clabelbg = true) { 
    323323        // 凡例が登録されていなければ中止 
    324         if(count($this->arrLegend) <= 0) { 
     324        if (count($this->arrLegend) <= 0) { 
    325325            return; 
    326326        } 
    327327 
    328         if($legend_max != "") { 
     328        if ($legend_max != "") { 
    329329            $label_max = $legend_max; 
    330330        } else { 
     
    337337 
    338338        // 一番文字数が多いものを取得 
    339         for($i = 0; $i < $label_max; $i++) { 
     339        for ($i = 0; $i < $label_max; $i++) { 
    340340            $text_len = strlen($this->arrLegend[$i]); 
    341             if($text_max < $text_len) { 
     341            if ($text_max < $text_len) { 
    342342                $text_max = $text_len; 
    343343            } 
     
    351351        $top = LEGEND_TOP; 
    352352        // カラーラベル背景の描画 
    353         if($clabelbg) { 
     353        if ($clabelbg) { 
    354354            $this->drawClabelBG($left - LINE_PAD, $top, $left + $width_max, $top + $height_max + LINE_PAD); 
    355355        } 
     
    358358        // 色数の取得 
    359359        $c_max = count($this->arrColor); 
    360         for($i = 0; $i < $label_max; $i++) { 
     360        for ($i = 0; $i < $label_max; $i++) { 
    361361            // カラーアイコンの表示 
    362362            imagerectangle($this->image, $left, $top, $left + FONT_SIZE, $top + FONT_SIZE, $this->flame_color); 
     
    371371    function drawClabelBG($left, $top, $right, $bottom) { 
    372372        // 影の描画 
    373         if($this->shade_on) { 
     373        if ($this->shade_on) { 
    374374            imagefilledrectangle($this->image, $left + 2, $top + 2, $right + 2, $bottom + 2, $this->shade_color); 
    375375        } 
     
    459459    /** 表示色の取得 */ 
    460460    function lfGetImageColor($image, $array) { 
    461         if(count($array) != 3) { 
     461        if (count($array) != 3) { 
    462462            return NULL; 
    463463        } 
     
    468468    /** 影用表示色の取得 */ 
    469469    function lfGetImageDarkColor($image, $array) { 
    470         if(count($array) != 3) { 
     470        if (count($array) != 3) { 
    471471            return NULL; 
    472472        } 
    473473        $i = 0; 
    474         foreach($array as $val) { 
     474        foreach ($array as $val) { 
    475475            $dark[$i] = $val - 45; 
    476             if($dark[$i] < 0) { 
     476            if ($dark[$i] < 0) { 
    477477                $dark[$i] = 0; 
    478478            } 
  • branches/version-2_12-dev/data/class/graph/SC_GraphLine.php

    r21420 r21441  
    6565    function drawYTitle() { 
    6666        // Y軸にタイトルを入れる 
    67         if($this->YTitle != "") { 
     67        if ($this->YTitle != "") { 
    6868            $text_width = $this->getTextWidth($this->YTitle, FONT_SIZE); 
    6969            $x_pos = $this->left - ($text_width / 2); 
     
    7676    function drawXTitle() { 
    7777        // Y軸にタイトルを入れる 
    78         if($this->XTitle != "") { 
     78        if ($this->XTitle != "") { 
    7979            $text_width = $this->getTextWidth($this->XTitle, FONT_SIZE); 
    8080            $x_pos = $this->left + $this->area_width - ($text_width / 2) + 30; 
     
    9191        // 上から目盛りを入れていく 
    9292        $pos = 0; 
    93         for($i = 0; $i < (LINE_Y_SCALE * 2); $i++) { 
     93        for ($i = 0; $i < (LINE_Y_SCALE * 2); $i++) { 
    9494            // 目盛り幅 
    95             if(($i % 2) == 0) { 
     95            if (($i % 2) == 0) { 
    9696                $sw = LINE_SCALE_SIZE; 
    97                 if($this->ygrid_on) { 
     97                if ($this->ygrid_on) { 
    9898                    imageline($this->image, $this->left, $this->top + $pos, $this->left + $this->area_width, $this->top + $pos, $this->grid_color); 
    9999                } 
     
    116116 
    117117        // 棒グラフの場合は半目盛りずらす 
    118         if($bar) { 
     118        if ($bar) { 
    119119            $half_scale = intval($this->area_width / ($count + 1) / 2); 
    120120        } else { 
     
    124124        // ラベルの表示インターバルを算出 
    125125        $interval = ceil($count / LINE_XLABEL_MAX); // 切り上げ 
    126         for($i = 0; $i < $count; $i++) { 
     126        for ($i = 0; $i < $count; $i++) { 
    127127            // X軸に目盛りを入れる 
    128128            $x = $arrPointList[$i][0]; 
     
    130130            imageline($this->image, $x - $half_scale, $pos, $x - $half_scale, $pos - LINE_SCALE_SIZE,  $this->flame_color); 
    131131            // ラベルを入れる 
    132             if(($i % $interval) == 0) { 
     132            if (($i % $interval) == 0) { 
    133133                $text_width = $this->getTextWidth($this->arrXLabel[$i], FONT_SIZE); 
    134134                $x_pos = $x; 
     
    145145 
    146146        // 棒グラフの場合は最後の目盛りを一つ追加する 
    147         if($bar) { 
     147        if ($bar) { 
    148148            imageline($this->image, $x + $half_scale, $pos, $x + $half_scale, $pos - LINE_SCALE_SIZE,  $this->flame_color); 
    149149        } 
     
    179179        $size = $this->area_height / LINE_Y_SCALE; 
    180180        $pos = 0; 
    181         for($i = 0; $i <= LINE_Y_SCALE; $i++) { 
     181        for ($i = 0; $i <= LINE_Y_SCALE; $i++) { 
    182182            $snumber = $number * (LINE_Y_SCALE - $i); 
    183183            $disp_number = number_format($snumber); 
     
    199199        $this->graph_max = $tenval * (intval($data_max / $tenval) + 1); 
    200200        // 最大値が10未満の場合の対応 
    201         if($this->graph_max < 10) { 
     201        if ($this->graph_max < 10) { 
    202202            $this->graph_max = 10; 
    203203        } 
     
    211211 
    212212        // 折れ線グラフ描画 
    213         for($i = 0; $i < $this->line_max; $i++) { 
     213        for ($i = 0; $i < $this->line_max; $i++) { 
    214214            $this->drawLine($i); 
    215215        } 
    216216 
    217217        // マークを描画 
    218         for($i = 0; $i < $this->line_max; $i++) { 
     218        for ($i = 0; $i < $this->line_max; $i++) { 
    219219            $this->drawMark($i); 
    220220        } 
    221221 
    222222        // ラベルを描画 
    223         for($i = 0; $i < $this->line_max; $i++) { 
     223        for ($i = 0; $i < $this->line_max; $i++) { 
    224224            $this->drawLabel($i); 
    225225        } 
     
    234234 
    235235        $count = count($arrPointList); 
    236         for($i = 0; $i < $count; $i++) { 
     236        for ($i = 0; $i < $count; $i++) { 
    237237            $x = $arrPointList[$i][0]; 
    238238            $y = $arrPointList[$i][1]; 
    239             if(isset($arrPointList[$i + 1])) { 
     239            if (isset($arrPointList[$i + 1])) { 
    240240                $next_x = $arrPointList[$i + 1][0]; 
    241241                $next_y = $arrPointList[$i + 1][1]; 
     
    249249        $arrPointList = $this->arrPointList[$line_no]; 
    250250        $count = count($arrPointList); 
    251         for($i = 0; $i < $count; $i++) { 
     251        for ($i = 0; $i < $count; $i++) { 
    252252            $x = $arrPointList[$i][0]; 
    253253            $y = $arrPointList[$i][1]; 
     
    261261        $arrPointList = $this->arrPointList[$line_no]; 
    262262        $count = count($arrPointList); 
    263         for($i = 0; $i < $count; $i++) { 
     263        for ($i = 0; $i < $count; $i++) { 
    264264            $x = $arrPointList[$i][0]; 
    265265            $y = $arrPointList[$i][1]; 
     
    281281        $scale_width = $this->area_width / ($count + 1); 
    282282        $this->arrPointList[$this->line_max] = array(); 
    283         for($i = 0; $i < $count; $i++) { 
     283        for ($i = 0; $i < $count; $i++) { 
    284284            // X座標を求める 
    285285            $x = intval($this->left + ($scale_width * ($i + 1))); 
  • branches/version-2_12-dev/data/class/graph/SC_GraphPie.php

    r21420 r21441  
    4848        $total = ""; 
    4949        $new_total = ""; 
    50         if(!is_array($array)) { 
     50        if (!is_array($array)) { 
    5151            return; 
    5252        } 
    5353        $arrRet = array(); 
    54         foreach($array as $val) { 
     54        foreach ($array as $val) { 
    5555            $total += $val; 
    5656        } 
    57         if($total <= 0) { 
     57        if ($total <= 0) { 
    5858            return; 
    5959        } 
     
    6262        $p_rate = 100 / $total; 
    6363        $cnt = 0; 
    64         foreach($array as $val) { 
     64        foreach ($array as $val) { 
    6565            $ret = round($val * $rate); 
    6666            $new_total+= $ret; 
     
    9191    function drawShade() { 
    9292        $move = 1; 
    93         for($i = ($this->cy + $this->cz); $i <= ($this->cy + $this->cz + ($this->cz * PIE_SHADE_IMPACT)); $i++) { 
     93        for ($i = ($this->cy + $this->cz); $i <= ($this->cy + $this->cz + ($this->cz * PIE_SHADE_IMPACT)); $i++) { 
    9494            imagefilledarc($this->image, $this->cx + $move, $i, $this->cw, $this->ch, 0, 360, $this->shade_color, IMG_ARC_PIE); 
    9595            $move += 0.5; 
     
    115115 
    116116        // データが存在しない場合 
    117         if($rd_max <= 0) { 
     117        if ($rd_max <= 0) { 
    118118            return; 
    119119        } 
    120120 
    121121        // 影の描画 
    122         if($this->shade_on) { 
     122        if ($this->shade_on) { 
    123123            $this->drawShade(); 
    124124        } 
     
    131131        for ($i = ($y + $z - 1); $i >= $y; $i--) { 
    132132            $start = 0; 
    133             for($j = 0; $j < $rd_max; $j++) { 
     133            for ($j = 0; $j < $rd_max; $j++) { 
    134134                // 角度が0度以上の場合のみ側面を描画する。 
    135                 if($arrRad[$j] > 0) { 
     135                if ($arrRad[$j] > 0) { 
    136136                    $end = $start + $arrRad[$j]; 
    137                     if($start == 0 && $end == 360) { 
     137                    if ($start == 0 && $end == 360) { 
    138138                        // -90~270で指定すると円が描画できないので0~360に指定 
    139139                        imagearc($this->image, $x, $i, $w, $h, 0, 360, $this->arrDarkColor[($j % $dc_max)]); 
     
    151151        // 上面の描画 
    152152        $start = 0; 
    153         for($i = 0; $i < $rd_max; $i++) { 
    154             $end = $start + $arrRad[$i]; 
    155             if($start == 0 && $end == 360) { 
     153        for ($i = 0; $i < $rd_max; $i++) { 
     154            $end = $start + $arrRad[$i]; 
     155            if ($start == 0 && $end == 360) { 
    156156                // -90~270で指定すると円が描画できないので0~360に指定 
    157157                imagefilledarc($this->image, $x, $y, $w, $h, 0, 360, $this->arrColor[($i % $c_max)], IMG_ARC_PIE); 
     
    165165        // 上面の縁取り 
    166166        $start = 0; 
    167         for($i = 0; $i < $rd_max; $i++) { 
    168             $end = $start + $arrRad[$i]; 
    169             if($start == 0 && $end == 360) { 
     167        for ($i = 0; $i < $rd_max; $i++) { 
     168            $end = $start + $arrRad[$i]; 
     169            if ($start == 0 && $end == 360) { 
    170170                // -90~270で指定すると円が描画できないので0~360に指定 
    171171                imagearc($this->image, $x, $y, $w, $h, 0, 360 , $this->flame_color); 
     
    180180        imageline($this->image, $x - ($w / 2), $y, $x - ($w / 2), $y + $z, $this->flame_color); 
    181181        $start = 0; 
    182         for($i = 0; $i < $rd_max; $i++) { 
     182        for ($i = 0; $i < $rd_max; $i++) { 
    183183            $end = $start + $arrRad[$i]; 
    184184            // 前面のみ 
    185             if($end > 90 && $end < 270) { 
     185            if ($end > 90 && $end < 270) { 
    186186                list($ax, $ay) = $this->lfGetArcPos($x, $y, $w, $h, $end); 
    187187                // ラインのずれを補正する 
    188                 if($end > 180) { 
     188                if ($end > 180) { 
    189189                    $ax = $ax + 1; 
    190190                } 
     
    204204        $rd_max = count($arrRad); 
    205205        $start = 0; 
    206         for($i = 0; $i < $rd_max; $i++) { 
     206        for ($i = 0; $i < $rd_max; $i++) { 
    207207            $center = $start + ($arrRad[$i] / 2); 
    208208            $end = $start + $arrRad[$i]; 
Note: See TracChangeset for help on using the changeset viewer.