Development

Changeset 6903

You must first sign up to be able to contribute.

Changeset 6903

Show
Ignore:
Timestamp:
01/03/08 07:11:44 (1 year ago)
Author:
dwhittle
Message:

dwhittle: updated dwSwfChartPlugin, released 1.0

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/dwSwfChartPlugin/LICENSE

    r1003 r6903  
    1 Copyright (c) 2004-2006 Dustin Whittl
     1The MIT Licens
    22 
    3 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 
     3Permission is hereby granted, free of charge, to any person obtaining a copy 
     4of this software and associated documentation files (the "Software"), to deal 
     5in the Software without restriction, including without limitation the rights 
     6to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     7copies of the Software, and to permit persons to whom the Software is 
     8furnished to do so, subject to the following conditions: 
    49 
    5 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 
     10The above copyright notice and this permission notice shall be included in 
     11all copies or substantial portions of the Software. 
    612 
    7 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
     13THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     14IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     15FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
     16AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     17LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
     19THE SOFTWARE. 
  • plugins/dwSwfChartPlugin/README

    r2860 r6903  
    1 = sfSwfChartPlugin plugin = 
     1= dwSwfChartPlugin = 
    22 
    3 The `sfSwfChartPlugin` provides abstraction for the PHP/SWF Charts library. 
     3The `dwSwfChartPlugin` provides abstraction for the PHP/SWF Charts library. 
    44 
    55== Installation == 
    66 
    77  * Install the plugin 
    8    
     8 
    99  {{{ 
    10     symfony plugin-install http://plugins.symfony-project.com/sfSwfChartPlugin 
     10    symfony plugin-install http://plugins.symfony-project.org/dwSwfChartPlugin 
    1111  }}} 
    1212 
     
    1818 
    1919  * You're done. 
     20 
     21== Using the plugin == 
     22 
     23See the bundled module/action: dwSwfChart/source. 
  • plugins/dwSwfChartPlugin/lib/helper/SwfChartHelper.php

    r5385 r6903  
    22 
    33/* 
    4  * This file is part of the symfony package. 
    5  * (c) 2004-2006 Dustin Whittle <dustin.whittle@symfony-project.com> 
    6 
    7  * For the full copyright and license information, please view the LICENSE 
    8  * file that was distributed with this source code. 
    9  */ 
     4* This file is part of the symfony package. 
     5* (c) 2004-2006 Dustin Whittle <dustin.whittle@symfony-project.com> 
     6
     7* For the full copyright and license information, please view the LICENSE 
     8* file that was distributed with this source code. 
     9*/ 
    1010 
    1111/** 
    12  * @package    symfony.runtime.addon 
     12 * @package    symfony 
     13 * @subpackage dwSwfChartPlugin 
    1314 * @author     Dustin Whittle <dustin.whittle@symfony-project.com> 
    1415 * @version    SVN: $Id: sfSwfChart.class.php 1519 2006-06-24 03:44:30Z dwhittle $ 
    1516 */ 
     17function swf_chart($xml_source, $width=400, $height=250, $bg_color="#ffffff", $transparent = false, $license = null ) 
     18{ 
     19  $library_path = sfConfig::get('sf_swfchart_dir', '/dwSwfChartPlugin/swfcharts/'); 
     20  $flash_file = $library_path . 'chart.swf'; 
    1621 
    17   function swf_chart($xml_source, $width=400, $height=250, $bg_color="#ffffff", $transparent = false, $license = null ) 
    18   { 
    19     $library_path = sfConfig::get('sf_swfchart_dir', '/swfcharts/'); 
    20     $flash_file = $library_path . 'chart.swf'; 
     22  $u = (strpos($flash_file,"?") === false) ? "?" : ((substr($flash_file, -1) === "&") ? "" : "&"); 
    2123 
    22     $u = (strpos($flash_file,"?") === false) ? "?" : ((substr($flash_file, -1) === "&") ? "" : "&"); 
     24  $license_query = ($license != null) ? '&license=' . $license : '' ; 
     25  $transparent_html = ($transparent) ? '<param name="wmode" value="transparent" />' : '' ; 
     26  $movie = $flash_file.$u.'library_path='.$library_path.'&amp;php_source='.$xml_source.$license_query; 
    2327 
    24     $license_query = ($license != null) ? '&license=' . $license : '' ; 
    25     $transparent_html = ($transparent) ? '<param name="wmode" value="transparent" />' : '' ; 
    26     $movie = $flash_file.$u.'library_path='.$library_path.'&amp;php_source='.$xml_source.$license_query; 
    27  
    28     return '<object type="application/x-shockwave-flash" data="'.$movie.'" width="'.$width.'" height="'.$height.'" id="chart"> 
     28  return '<object type="application/x-shockwave-flash" data="'.$movie.'" width="'.$width.'" height="'.$height.'" id="chart"> 
    2929             <param name="movie" value="'.$movie.'" /> 
    3030             <param name="quality" value="high" /> 
    3131             <param name="bgcolor" value="'.$bg_color.'" />' 
    32             . $transparent_html. 
    33           '</object>'; 
     32          . $transparent_html. 
     33          '</object>'; 
    3434 
    35  
     35
    3636 
    3737?> 
  • plugins/dwSwfChartPlugin/lib/sfSwfChart.class.php

    r2818 r6903  
    1010 
    1111/** 
    12  * @package    symfony.runtime.addon 
    13  * @author     Dustin Whittle <dustin.whittle@symfony-project.com> 
    14  * @version    SVN: $Id$ 
    15  */ 
    16  
    17 /** 
    1812 * 
    1913 * sfSwfChart class. 
     
    2115 * This class provides an abstraction layer to the PHP SWF Charts library which provides interactive flash graphs. 
    2216 * 
    23  * @package    symfony.runtime.addon 
     17 * @package    symfony 
     18 * @subpackage dwSwfChartPlugin 
    2419 * @author     Dustin Whittle <dustin.whittle@symfony-project.com> 
    2520 * @version    SVN: $Id$ 
     
    3025{ 
    3126 
    32   public function __construct() 
    33   { 
    34  
    35   } 
    36  
    3727  public function convertArray($chart=array()) 
    3828  { 
    3929    $xml="<chart>\r\n"; 
    40     $Keys1= array_keys((array) $chart); 
    41     for ($i1=0;$i1<count($Keys1);$i1++){ 
    42       if(is_array($chart[$Keys1[$i1]])){ 
    43         $Keys2=array_keys($chart[$Keys1[$i1]]); 
    44         if(is_array($chart[$Keys1[$i1]][$Keys2[0]])){ 
    45           $xml.="\t<".$Keys1[$i1].">\r\n"; 
    46           for($i2=0;$i2<count($Keys2);$i2++){ 
    47             $Keys3=array_keys((array) $chart[$Keys1[$i1]][$Keys2[$i2]]); 
    48             switch($Keys1[$i1]){ 
     30    $keys1= array_keys((array) $chart); 
     31    for ($i1=0;$i1<count($keys1);$i1++){ 
     32      if(is_array($chart[$keys1[$i1]])){ 
     33        $keys2=array_keys($chart[$keys1[$i1]]); 
     34        if(is_array($chart[$keys1[$i1]][$keys2[0]])){ 
     35          $xml.="\t<".$keys1[$i1].">\r\n"; 
     36          for($i2=0;$i2<count($keys2);$i2++){ 
     37            $keys3=array_keys((array) $chart[$keys1[$i1]][$keys2[$i2]]); 
     38            switch($keys1[$i1]){ 
    4939              case "chart_data": 
    5040              $xml.="\t\t<row>\r\n"; 
    51               for($i3=0;$i3<count($Keys3);$i3++){ 
     41              for($i3=0;$i3<count($keys3);$i3++){ 
    5242                switch(true){ 
    53                   case ($chart[$Keys1[$i1]][$Keys2[$i2]][$Keys3[$i3]]===null): 
     43                  case ($chart[$keys1[$i1]][$keys2[$i2]][$keys3[$i3]]===null): 
    5444                  $xml.="\t\t\t<null/>\r\n"; 
    5545                  break; 
    5646 
    57                   case ($Keys2[$i2]>0 and $Keys3[$i3]>0): 
    58                   $xml.="\t\t\t<number>".$chart[$Keys1[$i1]][$Keys2[$i2]][$Keys3[$i3]]."</number>\r\n"; 
     47                  case ($keys2[$i2]>0 and $keys3[$i3]>0): 
     48                  $xml.="\t\t\t<number>".$chart[$keys1[$i1]][$keys2[$i2]][$keys3[$i3]]."</number>\r\n"; 
    5949                  break; 
    6050 
    6151                  default: 
    62                   $xml.="\t\t\t<string>".$chart[$Keys1[$i1]][$Keys2[$i2]][$Keys3[$i3]]."</string>\r\n"; 
     52                  $xml.="\t\t\t<string>".$chart[$keys1[$i1]][$keys2[$i2]][$keys3[$i3]]."</string>\r\n"; 
    6353                  break; 
    6454                } 
     
    7060              $xml.="\t\t<row>\r\n"; 
    7161              $count=0; 
    72               for($i3=0;$i3<count($Keys3);$i3++){ 
    73                 if($chart[$Keys1[$i1]][$Keys2[$i2]][$Keys3[$i3]]===null){$xml.="\t\t\t<null/>\r\n";} 
    74                 else{$xml.="\t\t\t<string>".$chart[$Keys1[$i1]][$Keys2[$i2]][$Keys3[$i3]]."</string>\r\n";} 
     62              for($i3=0;$i3<count($keys3);$i3++){ 
     63                if($chart[$keys1[$i1]][$keys2[$i2]][$keys3[$i3]]===null){$xml.="\t\t\t<null/>\r\n";} 
     64                else{$xml.="\t\t\t<string>".$chart[$keys1[$i1]][$keys2[$i2]][$keys3[$i3]]."</string>\r\n";} 
    7565              } 
    7666              $xml.="\t\t</row>\r\n"; 
     
    8070              $xml.="\t\t<row>\r\n"; 
    8171              $count=0; 
    82               for($i3=0;$i3<count($Keys3);$i3++){ 
    83                 if($chart[$Keys1[$i1]][$Keys2[$i2]][$Keys3[$i3]]===null){$xml.="\t\t\t<null/>\r\n";} 
    84                 else{$xml.="\t\t\t<string>".$chart[$Keys1[$i1]][$Keys2[$i2]][$Keys3[$i3]]."</string>\r\n";} 
     72              for($i3=0;$i3<count($keys3);$i3++){ 
     73                if($chart[$keys1[$i1]][$keys2[$i2]][$keys3[$i3]]===null){$xml.="\t\t\t<null/>\r\n";} 
     74                else{$xml.="\t\t\t<string>".$chart[$keys1[$i1]][$keys2[$i2]][$keys3[$i3]]."</string>\r\n";} 
    8575              } 
    8676              $xml.="\t\t</row>\r\n"; 
     
    8979              case "draw": 
    9080              $text=""; 
    91               $xml.="\t\t<".$chart[$Keys1[$i1]][$Keys2[$i2]]['type']; 
    92               for($i3=0;$i3<count($Keys3);$i3++){ 
    93                 if($Keys3[$i3]!="type"){ 
    94                   if($Keys3[$i3]=="text"){$text=$chart[$Keys1[$i1]][$Keys2[$i2]][$Keys3[$i3]];} 
    95                   else{$xml.=" ".$Keys3[$i3]."=\"".$chart[$Keys1[$i1]][$Keys2[$i2]][$Keys3[$i3]]."\"";} 
     81              $xml.="\t\t<".$chart[$keys1[$i1]][$keys2[$i2]]['type']; 
     82              for($i3=0;$i3<count($keys3);$i3++){ 
     83                if($keys3[$i3]!="type"){ 
     84                  if($keys3[$i3]=="text"){$text=$chart[$keys1[$i1]][$keys2[$i2]][$keys3[$i3]];} 
     85                  else{$xml.=" ".$keys3[$i3]."=\"".$chart[$keys1[$i1]][$keys2[$i2]][$keys3[$i3]]."\"";} 
    9686                } 
    9787              } 
     
    10393              default://link, etc. 
    10494              $xml.="\t\t<value"; 
    105               for($i3=0;$i3<count($Keys3);$i3++){ 
    106                 $xml.=" ".$Keys3[$i3]."=\"".$chart[$Keys1[$i1]][$Keys2[$i2]][$Keys3[$i3]]."\""; 
     95              for($i3=0;$i3<count($keys3);$i3++){ 
     96                $xml.=" ".$keys3[$i3]."=\"".$chart[$keys1[$i1]][$keys2[$i2]][$keys3[$i3]]."\""; 
    10797              } 
    10898              $xml.=" />\r\n"; 
     
    110100            } 
    111101          } 
    112           $xml.="\t</".$Keys1[$i1].">\r\n"; 
     102          $xml.="\t</".$keys1[$i1].">\r\n"; 
    113103        }else{ 
    114           if($Keys1[$i1]=="chart_type" or $Keys1[$i1]=="series_color" or $Keys1[$i1]=="series_image" or $Keys1[$i1]=="series_explode" or $Keys1[$i1]=="axis_value_text"){ 
    115             $xml.="\t<".$Keys1[$i1].">\r\n"; 
    116             for($i2=0;$i2<count($Keys2);$i2++){ 
    117               if($chart[$Keys1[$i1]][$Keys2[$i2]]===null){$xml.="\t\t<null/>\r\n";} 
    118               else{$xml.="\t\t<value>".$chart[$Keys1[$i1]][$Keys2[$i2]]."</value>\r\n";} 
     104          if($keys1[$i1]=="chart_type" or $keys1[$i1]=="series_color" or $keys1[$i1]=="series_image" or $keys1[$i1]=="series_explode" or $keys1[$i1]=="axis_value_text"){ 
     105            $xml.="\t<".$keys1[$i1].">\r\n"; 
     106            for($i2=0;$i2<count($keys2);$i2++){ 
     107              if($chart[$keys1[$i1]][$keys2[$i2]]===null){$xml.="\t\t<null/>\r\n";} 
     108              else{$xml.="\t\t<value>".$chart[$keys1[$i1]][$keys2[$i2]]."</value>\r\n";} 
    119109            } 
    120             $xml.="\t</".$Keys1[$i1].">\r\n"; 
     110            $xml.="\t</".$keys1[$i1].">\r\n"; 
    121111          }else{//axis_category, etc. 
    122             $xml.="\t<".$Keys1[$i1]; 
    123             for($i2=0;$i2<count($Keys2);$i2++){ 
    124               $xml.=" ".$Keys2[$i2]."=\"".$chart[$Keys1[$i1]][$Keys2[$i2]]."\""; 
     112            $xml.="\t<".$keys1[$i1]; 
     113            for($i2=0;$i2<count($keys2);$i2++){ 
     114              $xml.=" ".$keys2[$i2]."=\"".$chart[$keys1[$i1]][$keys2[$i2]]."\""; 
    125115            } 
    126116            $xml.=" />\r\n"; 
     
    128118        } 
    129119      }else{//chart type, etc. 
    130         $xml.="\t<".$Keys1[$i1].">".$chart[$Keys1[$i1]]."</".$Keys1[$i1].">\r\n"; 
     120        $xml.="\t<".$keys1[$i1].">".$chart[$keys1[$i1]]."</".$keys1[$i1].">\r\n"; 
    131121      } 
    132122    } 
     
    134124    return $xml; 
    135125  } 
    136  
    137   public function __destruct() 
    138   { 
    139  
    140   } 
    141  
    142126} 
    143127 
  • plugins/dwSwfChartPlugin/modules/dwSwfChart/actions/actions.class.php

    r2818 r6903  
    22 
    33/** 
    4  * sfSwfChart actions. 
     4 * dwSwfChart actions. 
    55 * 
    6  * @package    sfSwfChartPlugin 
     6 * @package    symfony 
     7 * @subpackage dwSwfChartPlugin 
    78 * @author     Dustin Whittle 
    89 * @version    SVN: $Id$ 
    910 */ 
    10 class sfSwfChartActions extends sfActions 
     11class dwSwfChartActions extends sfActions 
    1112{ 
    1213  /** 
  • plugins/dwSwfChartPlugin/modules/dwSwfChart/templates/testSuccess.php

    r2818 r6903  
    33use_helper('SwfChart'); 
    44 
    5 echo swf_chart("/sfSwfChart/source", 400, 250); 
     5echo swf_chart("/dwSwfChart/source", 400, 250); 
    66 
    77?> 
  • plugins/dwSwfChartPlugin/package.xml

    r5385 r6903  
    11<?xml version="1.0" encoding="UTF-8"?> 
    22<package packagerversion="1.4.9" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> 
    3  <name>sfSwfChartPlugin</name> 
    4  <channel>pear.symfony-project.com</channel> 
    5  <summary>symfony sfSwfChart plugin</summary> 
    6  <description>symfony sfSwfChart plugin is for dynamically generating interactive flash chart via PHP/SWF Charts.</description> 
     3 <name>dwSwfChartPlugin</name> 
     4 <channel>pear.symfony-project.org</channel> 
     5 <summary>dwSwfChartPlugin</summary> 
     6 <description>dwSwfChartPlugin is for dynamically generating interactive flash chart via PHP/SWF Charts.</description> 
    77 <lead> 
    88  <name>Dustin Whittle</name> 
    99  <user>dwhittle</user> 
    10   <email>dustin.whittle@symfony-project.com</email> 
     10  <email>dustin.whittle@symfony-project.org</email> 
    1111  <active>yes</active> 
    1212 </lead> 
    13  <date>2007-10-05</date> 
     13 <date>2008-01-01</date> 
    1414 <version> 
    15   <release>1.0.4</release> 
    16   <api>1.0.4</api> 
     15  <release>1.0.0</release> 
     16  <api>1.0.0</api> 
    1717 </version> 
    1818 <stability> 
     
    2020  <api>stable</api> 
    2121 </stability> 
    22  <license uri="http://www.symfony-project.com/license">MIT license</license> 
     22 <license uri="http://www.symfony-project.org/content/license">MIT license</license> 
    2323 <notes>-</notes> 
    2424 <contents> 
     
    6363   <package> 
    6464    <name>symfony</name> 
    65     <channel>pear.symfony-project.com</channel> 
     65    <channel>pear.symfony-project.org</channel> 
    6666    <min>1.0.0</min> 
    67     <max>1.1.0</max> 
    68     <exclude>1.1.0</exclude> 
     67    <max>1.2.0</max> 
    6968   </package> 
    7069  </required> 
    7170 </dependencies> 
    72  <phprelease /> 
    73  <changelog /> 
     71 
     72 <phprelease> 
     73 </phprelease> 
     74 
     75 <changelog> 
     76 </changelog> 
    7477</package>