b2evolution PHP Cross Reference Blogging Systems

Source: /inc/_ext/_swfcharts.php - 147 lines - 3329 bytes - Summary - Text - Print

Description: charts.php v1.6 ------------------------------------------------------------------------ Copyright (c) 2004, maani.us ------------------------------------------------------------------------ This file is part of "PHP/SWF Charts" PHP/SWF Charts is a shareware. See http://www.maani.us/charts/ for more information. ------------------------------------------------------------------------

   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   * @version $Id: _swfcharts.php 3328 2013-03-26 11:44:11Z yura $
  13   * @package libs
  14   */
  15  if( ! defined( 'EVO_MAIN_INIT' ) ) die( 'Please, do not access this page directly.' );
  16  
  17  /**
  18   * Draw the SWF chart.
  19   *
  20   * @param array Chart data
  21   */
  22  function DrawChart( $chart )
  23  {
  24      // by fplanque:
  25      global $rsc_url;
  26      $path = $rsc_url;
  27  
  28      // defaults:
  29      if ( ! isset( $chart['canvas_bg']['width'] ) )
  30      {
  31          $chart['canvas_bg']['width'] = 400;
  32      }
  33      if ( ! isset( $chart['canvas_bg']['height'] ) )
  34      {
  35          $chart['canvas_bg']['height'] = 250;
  36      }
  37      if ( ! isset( $chart['canvas_bg']['color'] ) )
  38      {
  39          $chart['canvas_bg']['color'] = '666666';
  40      }
  41  
  42      $params  = '';
  43      foreach ( $chart as $k => $v )
  44      {
  45          $count = is_array( $v ) ? count( $v ) : 0;
  46          switch( $k )
  47          {
  48              case 'chart_data':
  49                  $params .= 'rows='.$count.'&'
  50                            .'cols='.count( $v[0] ).'&';
  51                  for ( $r = 0; $r < $count; ++$r )
  52                  {
  53                      $params .= 'r'.$r.'='.implode( ';', $v[$r] ).'&';
  54                  }
  55                  break;
  56  
  57              case 'draw_text':
  58                  for ( $r = 0; $r < $count; ++$r )
  59                  {
  60                      $params .= 'text_'.$r.'=';
  61                      $first   = true;
  62                      foreach ( $v[$r] as $tk => $tv )
  63                      {
  64                          if ( $first )
  65                          {
  66                              $first = false;
  67                          }
  68                          else
  69                          {
  70                              $params .= ';';
  71                          }
  72                          $params .= $tk.':'.$tv;
  73                      }
  74                      $params .= '&';
  75                  }
  76                  break;
  77  
  78              case 'link':
  79                  for ( $r = 0; $r < $count; ++$r )
  80                  {
  81                      $params .= 'link_'.$r.'=';
  82                      $first   = true;
  83                      foreach ( $v as $lk => $lt )
  84                      {
  85                          if ( $first )
  86                          {
  87                              $first = false;
  88                          }
  89                          else
  90                          {
  91                              $params .= ';';
  92                          }
  93                          $params .= $lk.':'.$lt;
  94                      }
  95                      $params .= '&';
  96                  }
  97                  break;
  98  
  99              default:
 100                  if ( is_array( $v ) )
 101                  {
 102                      $params .= $k.'=';
 103                      $first   = true;
 104                      foreach( $v as $dk => $dv )
 105                      {
 106                          if ( $first )
 107                          {
 108                              $first = false;
 109                          }
 110                          else
 111                          {
 112                              $params .= ';';
 113                          }
 114                          $params .= $dk.':'.$dv;
 115                      }
 116                      $params .= '&';
 117                  }
 118                  else
 119                  {
 120                      $params .= $k.'='.$v.'&';
 121                  }
 122                  break;
 123          }
 124      }
 125  ?>
 126  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
 127          codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
 128          width="<?php echo $chart['canvas_bg']['width']; ?>"
 129          height="<?php echo $chart['canvas_bg']['height']; ?>"
 130          id="charts">
 131      <PARAM NAME="movie" VALUE="<?php echo $path.'charts.swf'; ?>?<?php echo $params; ?>" />
 132      <PARAM NAME="quality" VALUE="high" />
 133      <PARAM NAME="bgcolor" VALUE="<?php echo $chart['canvas_bg']['color']; ?>" />
 134  
 135      <EMBED src="<?php echo $path.'charts.swf'; ?>?<?php echo $params; ?>"
 136              quality="high"
 137              NAME="charts"
 138              TYPE="application/x-shockwave-flash"
 139              PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"
 140              bgcolor="<?php echo $chart['canvas_bg']['color']; ?>"
 141              WIDTH="<?php echo $chart['canvas_bg']['width']; ?>"
 142              HEIGHT="<?php echo $chart['canvas_bg']['height']; ?>"></EMBED>
 143  </object>
 144  <?php
 145  }
 146  
 147  ?>

title

Description

title

Description

title

Description

title

title

Body