[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/inc/_ext/ -> _swfcharts.php (source)

   1  <?php
   2  /**

   3   * charts.php v1.6

   4   * ------------------------------------------------------------------------

   5   * Copyright (c) 2004, maani.us

   6   * ------------------------------------------------------------------------

   7   * This file is part of "PHP/SWF Charts"

   8   *

   9   * PHP/SWF Charts is a shareware. See http://www.maani.us/charts/ for

  10   * more information.

  11   * ------------------------------------------------------------------------

  12   * @package libs

  13   */
  14  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  15  
  16  
  17  /**

  18   * This function draws the SWF chart.

  19   *

  20   * @param array

  21   */
  22  function DrawChart($chart)
  23  {
  24      // fplanque:

  25      global $rsc_url;
  26      $path = $rsc_url;
  27  
  28      //defaults

  29      if(!isset($chart[ 'canvas_bg' ]['width' ])){$chart[ 'canvas_bg' ]['width' ] =400;}
  30      if(!isset($chart[ 'canvas_bg' ]['height' ])){$chart[ 'canvas_bg' ]['height' ] =250;}
  31      if(!isset($chart[ 'canvas_bg' ]['color' ])){$chart[ 'canvas_bg' ]['color' ] = "666666";}
  32  
  33      $params="";
  34      $allKeys= array_keys($chart);
  35      for ($i=0;$i<count($allKeys);$i++)
  36      {
  37          switch($allKeys[$i]){
  38              case "chart_data":
  39              $params=$params."rows=".count($chart[ 'chart_data' ])."&";
  40              $params=$params."cols=".count($chart[ 'chart_data' ][0])."&";
  41              for ($r=0;$r<count($chart[ 'chart_data' ]);$r++){
  42                  $params=$params."r".$r."=";
  43                  for ($c=0;$c<count($chart[ 'chart_data' ][$r]);$c++)
  44                  {
  45                      $params=$params.$chart[ 'chart_data' ][$r][$c];
  46                      if($c==count($chart[ 'chart_data' ][$r])-1){$params=$params."&";}
  47                      else{$params=$params.";";}
  48                  }
  49              }
  50              break;
  51  
  52              case "draw_text":
  53              for ($r=0;$r<count($chart[ 'draw_text' ]);$r++){
  54                  $params=$params."text_".$r."=";
  55                  $allKeys2= array_keys($chart[ 'draw_text' ][$r]);
  56                  for ($k2=0;$k2<count($allKeys2);$k2++){
  57                      $params=$params.$allKeys2[$k2].":".$chart[ 'draw_text' ][$r][$allKeys2[$k2]];
  58                      if($k2<count($allKeys2)-1){$params=$params.";";}
  59                  }
  60                  $params=$params."&";
  61              }
  62              break;
  63  
  64              case "link":
  65              for ($r=0;$r<count($chart[ 'link' ]);$r++){
  66                  $params=$params."link_".$r."=";
  67                  $allKeys2= array_keys($chart[ 'link' ][$r]);
  68                  for ($k2=0;$k2<count($allKeys2);$k2++){
  69                      $params=$params.$allKeys2[$k2].":".$chart[ 'link' ][$r][$allKeys2[$k2]];
  70                      if($k2<count($allKeys2)-1){$params=$params.";";}
  71                  }
  72                  $params=$params."&";
  73              }
  74              break;
  75  
  76              default:
  77              if(gettype($chart[$allKeys[$i]])=="array" ){
  78                  $params=$params.$allKeys[$i]."=";
  79                  $allKeys2= array_keys($chart[$allKeys[$i]]);
  80                  for ($k2=0;$k2<count($allKeys2);$k2++){
  81                      $params=$params.$allKeys2[$k2].":".$chart[$allKeys[$i]][$allKeys2[$k2]];
  82                      if($k2<count($allKeys2)-1){$params=$params.";";}
  83                  }
  84                  $params=$params."&";
  85              }else{
  86                  $params=$params.$allKeys[$i]."=".$chart[$allKeys[$i]]."&";
  87              }
  88          }
  89      }
  90  ?>
  91  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
  92                  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
  93                  width="<?php print $chart[ 'canvas_bg' ]['width' ]; ?>"
  94                  height="<?php print $chart[ 'canvas_bg' ]['height' ]; ?>"
  95                  id="charts">
  96  
  97      <PARAM NAME="movie" VALUE="<?php print $path."charts.swf"; ?>?<?php print $params; ?>" />
  98      <PARAM NAME="quality" VALUE="high" />
  99      <PARAM NAME="bgcolor" VALUE="<?php print $chart[ 'canvas_bg' ]['color' ]; ?>" />
 100  
 101      <EMBED src="<?php print $path."charts.swf"; ?>?<?php print $params; ?>"
 102                  quality="high"
 103                  NAME="charts"
 104                  TYPE="application/x-shockwave-flash"
 105                  PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"
 106                  bgcolor="<?php print $chart[ 'canvas_bg' ]['color' ]; ?>"
 107                  WIDTH="<?php print $chart[ 'canvas_bg' ]['width' ]; ?>"
 108                  HEIGHT="<?php print $chart[ 'canvas_bg' ]['height' ]; ?>"></EMBED>
 109  
 110  </object>
 111  
 112  <?php
 113  }
 114  ?>


Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics