PageRenderTime 139ms CodeModel.GetById 56ms app.highlight 64ms RepoModel.GetById 1ms app.codeStats 1ms

/app/protected/extensions/fusioncharts/FusionChartMaker.php

https://bitbucket.org/mstowe/zurmo
PHP | 2136 lines | 1699 code | 201 blank | 236 comment | 94 complexity | 91bcac6eb6f287e0938da7de419d81af MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1<?php
   2class FusionChartMaker
   3{
   4
   5    var $chartType;               # Chart Friendly Name
   6    var $chartID;				  # ID of the Chart for JS interactivity(optional)
   7    var $SWFFile; 				  # Name of the required FusionCharts SWF file
   8    var $SWFPath;                 # relative path of FusionCharts SWF files
   9    var $width;                   # FusionCharts width
  10    var $height;                  # FusionCharts height
  11
  12    # attribute Delimiter
  13    var $del;
  14
  15    # Chart XML string
  16    var $strXML;
  17
  18    # Chart Series Types : 1 => single series, 2=> multi-series, 5=>Gantt (
  19    # For Future Use : 3=> scatter and bubble, 4=> MSStacked
  20     var $seriesType;
  21
  22    # Charts Atribute array
  23    var $chartParams = array();     #List of Chart Parameters
  24    var $chartParamsCounter;		#Number of Chart parameters
  25
  26    var $categoriesParam;           # Categories Parameter Setting
  27    var $categoryNames = array();   # Category array for storing Category set
  28    var $categoryNamesCounter;      # Category array counter
  29
  30    var $dataset = array();         # dataset array
  31    var $datasetParam = array();    # dataset parameter setting array
  32    var $datasetCounter;            # dataset array counter
  33    var $setCounter;                # set array counter
  34
  35
  36    # trendLines array
  37    var $trendLines = array();      # trendLines array
  38    var $tLineCounter;              # trendLines array counter
  39
  40    #chart messages
  41    var $chartMSG;
  42
  43    var $chartSWF = array();		# Charts SWF array
  44    var $arr_FCColors = array(); 	# Color Set to be applied to dataplots
  45    var $UserColorON;               # User define color define true or false
  46    var $userColorCounter;
  47
  48    // Cache Control
  49    var $noCache;
  50
  51    var $DataBaseType;             # DataBase Type
  52
  53    var $encodeChars;               # XML for dataXML or dataURL
  54
  55#############============ For Gantt Chart  ============================
  56    # Gantt categories
  57    var $GT_categories = array();
  58    var $GT_categories_Counter;
  59    var $GT_categoriesParam = array();
  60
  61    var $GT_subcategories_Counter;
  62
  63    # Gantt processes
  64    var $GT_processes = array();
  65    var $GT_processes_Counter;
  66    var $GT_processes_Param;
  67
  68    # Gantt Tasks
  69    var $GT_Tasks = array();
  70    var $GT_Tasks_Counter;
  71    var $GT_Tasks_Param;
  72
  73    # Gantt Connectors
  74    var $GT_Connectors = array();
  75    var $GT_Connectors_Counter;
  76    var $GT_Connectors_Param;
  77
  78    # Gantt Milestones
  79    var $GT_Milestones = array();
  80    var $GT_Milestones_Counter;
  81    var $GT_Milestones_Param;
  82
  83    # Gantt datatable
  84    var $GT_datatable = array();
  85    var $GT_datatable_Counter;
  86    var $GT_datatableParam;
  87    var $GT_dataColumnParam = array();
  88
  89    var $GT_subdatatable_Counter;
  90
  91    #------- For Futute Use (start)----------------
  92    # Gantt legend
  93    var $GT_legend = array();
  94    var $GT_legend_Counter;
  95    var $GT_legend_Param;
  96    #------- For Futute Use (end)----------------
  97
  98    var $wMode;
  99
 100    # Advanced Chart settings
 101    var $JSC = array();
 102
 103#############============ For Future Use (start)============================
 104    # dataset for MSStackedColumn2D
 105
 106    var $MSSDataset = array();       # dataset array for MSStackedColumn2D
 107    var $MSSDatasetParams = array();  # MSSDataset parameter setting
 108
 109    var $MSSDatasetCounter;          # MSSDataset array counter
 110     var $MSSSubDatasetCounter;       # ms sub dataset array counter
 111    var $MSSSetCounter;              # msset array counter
 112
 113    # lineset
 114    var $lineSet = array();         # lineSet array
 115    var $lineSetParam = array();    # lineSet Parameter setting array
 116
 117    var $lineCounter;               # line array counter
 118    var $lineSetCounter;            # lineset array counter
 119    var $lineIDCounter;             # lineID counter;
 120
 121    # vtrendLines array
 122    var $vtrendLines = array();     # vtrendLines array
 123    var $vtLineCounter;             # vtrendLines array counter
 124
 125    # style array
 126    var $styles = array();           # styles array
 127    var $styleDefCounter;                # define counter
 128    var $styleAppCounter;                # apply counter
 129
 130
 131#############============ For Future Use (end)============================
 132
 133
 134     # FusionCharts Constructor, its take 4  Parameters.
 135     # when we create object of FusionCharts, then Constructor will auto run and initialize
 136     # chats array parameter like chartType, width, height, chartsID
 137     function FusionChartMaker($chartType="column2d",$width="400",$height="300",$chartID="",$isTransparent=""){
 138          $this->wMode=$isTransparent;
 139          # Setting All Charts Array
 140          $this->setChartArrays();
 141
 142          #initialise colorList
 143          $this->colorInit();
 144
 145          # Setting Chart name
 146          $this->chartType=strtolower($chartType);
 147          # Getting Charts Series Type
 148          $this->getSeriesType();
 149
 150          # Setting Charts Width and Height
 151          $this->width=$width;
 152          $this->height=$height;
 153
 154          # Setting ChartID, Defult is Charts Name
 155          if ($chartID==""){
 156              $chartCounter=@$_SESSION['chartcount'];
 157            if($chartCounter<=0 || $chartCounter==null){
 158                $chartCounter=1;
 159            }
 160
 161            $this->chartID=$chartType . $chartCounter;
 162            $_SESSION['chartcount']=++$chartCounter;
 163
 164          }else{
 165            $this->chartID=$chartID;
 166          }
 167
 168          # Setting Defult Parameter Delimiter  to ';'
 169          $this->del=";";
 170
 171          # Setting Default SWF Path
 172          $this->SWFPath="";
 173          $this->SWFFile=$this->SWFPath . "FCF_" . $this->chartSWF[$this->chartType][0]  . ".swf";
 174          # Initialize categoriesParam
 175          $this->categoriesParam="";
 176          $this->categoryNamesCounter=1;
 177
 178          # Creating Category Array
 179          $this->createCategory($this->categoryNamesCounter);
 180
 181          # Initialize Dataset Variables
 182          $this->datasetCounter=0;
 183          $this->setCounter= 0;
 184          if($this->seriesType>1){
 185            $this->setCounter++;
 186          }
 187
 188          # Initialize  MSSDataset Variables
 189          if($this->seriesType==4){
 190            $this->MSSDatasetCounter=0;
 191            $this->MSSSubDatasetCounter=0;
 192            $this->MSSSetCounter=0;
 193
 194            $this->lineCounter=0;
 195            $this->lineSetCounter=0;
 196            $this->lineIDCounter=0;
 197          }
 198
 199          # vTrendLines Array inisialize
 200          if($this->seriesType==3){
 201            $this->vtLineCounter=1;
 202            $this->createvTrendLines($this->vtLineCounter);
 203          }
 204
 205          # TrendLines Array inisialize
 206          $this->tLineCounter=1;
 207          $this->createTrendLines($this->tLineCounter);
 208
 209          # Styles Array inisialize
 210          $this->styleDefCounter=1;
 211          $this->styleAppCounter=1;
 212          $this->createStyles("definition");
 213          $this->createSubStyles("definition","style");
 214          $this->createSubStylesParam("definition","style",$this->styleDefCounter);
 215
 216          $this->GT_categories_Counter=0;
 217           $this->GT_subcategories_Counter=0;
 218
 219          $this->GT_processes_Counter=0;
 220          $this->GT_processes_Param="";
 221
 222          $this->GT_Tasks_Counter=0;
 223          $this->GT_Tasks_Param="";
 224
 225          # Gantt Connectors
 226          $this->GT_Connectors_Counter=0;
 227          $this->GT_Connectors_Param="";
 228
 229          # Gantt datatable
 230          $this->GT_datatable_Counter=0;
 231          $this->GT_datatableParam="";
 232          $this->GT_subdatatable_Counter=0;
 233
 234          # Gantt legend
 235          $this->GT_legend_Counter=0;
 236          $this->GT_legend_Param="";
 237
 238          $this->chartMSG="";
 239          # XML store Variables
 240          $this->strXML="";
 241
 242          $this->UserColorON = false;
 243          $this->userColorCounter=0;
 244
 245          $this->noCache=false;
 246          $this->DataBaseType="mysql";
 247
 248          // JS Constructor
 249          $this->JSC["debugmode"]=false;       # debugmode default is false
 250          $this->JSC["registerwithjs"]=false;  # registerwithJS default is false
 251          $this->JSC["bgcolor"]="";            # bgcolor default not set
 252          $this->JSC["scalemode"]="noScale";   # scalemode default noScale
 253          $this->JSC["lang"]="EN";             # Language default EN
 254
 255          // dataXML type encode
 256          $this->encodeChars=true;
 257
 258     }
 259
 260
 261##------------ PUBLIC FUNCTIONS ----------------------------------------------------------------
 262     # Special Character
 263     function encodeXMLChars($option=true){
 264         $this->$encodeChars=$option;
 265     }
 266     # Setting Parameter Delimiter, Defult Parameter Separator is ";"
 267     function setParamDelimiter($strDel){
 268       $this->del=$strDel;
 269     }
 270
 271     # Database type set like ORACLE and MYSQL
 272     function setDataBaseType($dbType){
 273        $this->DataBaseType=strtolower($dbType);
 274     }
 275
 276     # Setting path of SWF file. file name like FCF_Column3D.swf. where FCF_ is common for all SWF file
 277     function setSWFPath($SWFPath){
 278       $this->SWFPath=$SWFPath;
 279       $this->SWFFile=$this->SWFPath . "FCF_" . $this->chartSWF[$this->chartType][0]  . ".swf";
 280     }
 281
 282     # We can add or change single Chart parameter by setChartParam function
 283     # its take Parameter Name and its Value
 284     function setChartParam($paramName, $paramValue){
 285       $this->chartParams[$paramName]=$this->encodeSpecialChars($paramValue);
 286     }
 287
 288     # We can add or change Chart parameter sets by setChartParams function
 289     # its take parameterset [ caption=xyz caption;subCaption=abcd abcd abcd;xAxisName=x axis;yAxisName=y's axis;bgColor=f2fec0;animation=1 ]
 290     # Defult Parameter Separator is ";"
 291     function setChartParams($strParam){
 292       $listArray=explode($this->del,$strParam);
 293       foreach ($listArray as $valueArray) {
 294           $paramValue=explode("=",$valueArray,2);
 295           if($this->validateParam($paramValue)==true){
 296            $this->chartParams[$paramValue[0]]=$this->encodeSpecialChars($paramValue[1]);
 297           }
 298       }
 299     }
 300
 301
 302     # Setting Categories Parameter into categoriesParam variables
 303     function setCategoriesParams($strParam){
 304
 305       $this->categoriesParam .= $this->ConvertParamToXMLAttribute($strParam);
 306     }
 307
 308
 309     # Function addCategoryFromDatabase adding Category from dataset
 310     function addCategoryFromDatabase($query_result, $categoryColumn){
 311        if($this->DataBaseType=="mysql"){
 312             # fetching recordset till eof
 313             while($row = mysql_fetch_array($query_result)){
 314                # add category
 315                $this->addCategory($row[$categoryColumn],"","" );
 316             }
 317        }elseif($this->DataBaseType=="oracle"){
 318             # fetching recordset till eof
 319             while(OCIFetchInto($query_result, $row, OCI_ASSOC)){
 320                # add category
 321                $this->addCategory($row[$categoryColumn],"","" );
 322             }
 323
 324        }
 325     }
 326
 327     # Function addCategoryFromArray adding Category from Array
 328     function addCategoryFromArray($categoryArray){
 329             # convert array to category set
 330             foreach ($categoryArray as $value) {
 331              # adding category
 332              $this->addCategory($value);
 333             }
 334     }
 335
 336     # Function for create set and catagory, dataset , set from array
 337     function addChartDataFromArray($dataArray, $dataCatArray=""){
 338        if(is_array($dataArray)){
 339            if ($this->seriesType==1){
 340               # Single series Array
 341               # aa[..][..]="name" aa[..][..]="value"
 342               foreach($dataArray as $arrayvalue){
 343                 if(is_array($arrayvalue)){
 344                   $this->addChartData($arrayvalue[1],"name=" . $arrayvalue[0] );
 345                 }
 346               }
 347            }else{
 348               # Multi series Array
 349               if(is_array($dataCatArray)){
 350                   foreach($dataCatArray as $value){
 351                       $this->addCategory($value);
 352                   }
 353               }
 354               foreach($dataArray as $arrayvalue){
 355                 if(is_array($arrayvalue)){
 356                   $i=0;
 357                   $aaa[0]="";$aaa[1]="";
 358                   foreach($arrayvalue as $value){
 359                     if($i>=2){
 360                           $this->addChartData($value);
 361                     }else{
 362                        $aaa[$i]=$value;
 363                     }
 364                     if($i==1){
 365                       $this->addDataset($aaa[0],$aaa[1]);
 366                     }
 367                     $i++;
 368
 369                   }
 370                 }
 371               }
 372            }
 373        }
 374     }
 375
 376     # Function addCategory adding Category and vLine element
 377     function addCategory($label="",$catParam="",$vlineParam = "" ){
 378          $strCatXML="";
 379         $strParam="";
 380         $label=$this->encodeSpecialChars($label);
 381         # cheking vlineParam equal blank
 382         if($vlineParam==""){
 383           # cheking catParam not blank
 384           if($catParam!=""){
 385
 386               $strParam = $this->ConvertParamToXMLAttribute($catParam);
 387
 388            }
 389            # adding label and parameter set to category
 390           $strCatXML ="<category name='" . $label . "' " . $strParam . " />";
 391
 392         }else{
 393
 394           $strParam = $this->ConvertParamToXMLAttribute($vlineParam);
 395
 396           # adding parameter set to vLine
 397           $strCatXML="<vLine " . $strParam . "  />";
 398         }
 399         # storing into categoryNames array
 400         $this->categoryNames[$this->categoryNamesCounter]=$strCatXML;
 401         # Increase Counter
 402         $this->categoryNamesCounter++;
 403     }
 404
 405
 406     # adding dataset array element
 407     function addDataset($seriesName, $strParam=""){
 408       $this->datasetCounter++;
 409       $this->createDataset($this->datasetCounter);
 410
 411       $this->setCounter++;
 412       $this->createDataValues($this->datasetCounter,"_" . $this->setCounter);
 413
 414       $seriesName=$this->encodeSpecialChars($seriesName);
 415       # creating seriesName and dataset parameter set
 416       $tempParam="";
 417       $tempParam ="seriesName='" . $seriesName . "' ";
 418       $tempParam .= $this->ConvertParamToXMLAttribute($strParam);
 419
 420       $colorParam="";
 421       $pos = strpos(strtolower($tempParam), " color");
 422       if ($pos === false) {
 423         $colorParam=" color='" . $this->getColor($this->datasetCounter-1) . "'";
 424       }
 425
 426        # setting  datasetParam array
 427        $this->datasetParam[$this->datasetCounter]=$tempParam . $colorParam;
 428
 429     }
 430
 431
 432     # Function addChartData adding set data element
 433     function addChartData($value="",$setParam="",$vlineParam = "" ){
 434         $strSetXML="";
 435
 436         # Choosing dataset depend on seriesType and getting XML set
 437         if($this->seriesType>=1 and $this->seriesType<=2){
 438
 439           $strSetXML=$this->setSSMSDataArray($value,$setParam,$vlineParam);
 440
 441         }elseif ($this->seriesType==3){
 442
 443           $strSetXML=$this->setScatterBubbleDataArray($value,$setParam,$vlineParam);
 444
 445         }elseif (($this->seriesType==4)){
 446
 447           $strSetXML=$this->setSSMSDataArray($value,$setParam,$vlineParam);
 448
 449         }
 450
 451         # Adding xml set to dataset array and Increase set counter
 452         if ($this->seriesType==1){
 453              $this->dataset[$this->setCounter]=$strSetXML;
 454              $this->setCounter++;
 455         }elseif($this->seriesType>1 and $this->seriesType<4){
 456              $this->dataset[$this->datasetCounter]["_" . $this->setCounter]=$strSetXML;
 457              $this->setCounter++;
 458         }elseif($this->seriesType==4){
 459              $this->MSSDataset[$this->MSSDatasetCounter][$this->MSSSubDatasetCounter][$this->MSSSetCounter]=$strSetXML;
 460              $this->MSSSetCounter++;
 461         }
 462     }
 463
 464     # The addDatasetsFromDatabase() function adds dataset and set elements from -
 465     # database, by Default, from MySql recordset. You can use setDatabaseType() function -
 466     # to set the type of database to work on.
 467     function addDatasetsFromDatabase($query_result, $ctrlField, $valueField,$datsetParamArray="",$link=""){
 468
 469             # Initialize variables
 470             $paramset="";
 471             $tempContrl="";
 472             if(is_array($datsetParamArray)==false){
 473                 $datsetParamArray=array();
 474             }
 475
 476             # Calculate total no of array elements in datsetParamArray
 477             $arrLimit=count($datsetParamArray);
 478             $i=1;
 479             $tempParam="";
 480             if($this->DataBaseType=="mysql"){
 481                 ##### For My SQL Connection
 482                 $FieldArray=explode($this->del,$valueField);
 483                 if(count($FieldArray)>1){
 484                        ### Muli Series
 485                     # fetching recordset
 486                     while($row = mysql_fetch_array($query_result)){
 487                        # Add Category
 488                        $this->addCategory($row[$ctrlField]);
 489                     }
 490
 491                     $k=0;
 492                     # Add daatset for multiple fields
 493                     foreach ($FieldArray as $FieldName) {
 494
 495                           if($k<$arrLimit){
 496                              $tempParam = $datsetParamArray[$k];
 497                             }else{
 498                              $tempParam="";
 499                           }
 500                           # Add Dataset with adddataset() function
 501                           $this->addDataset($FieldName,$tempParam);
 502
 503                           # rewind query result
 504                           mysql_data_seek($query_result,0);
 505                           while($row = mysql_fetch_array($query_result)){
 506
 507                                # Generating URL link
 508                                if($link==""){
 509                                  $paramset="";
 510                                }else{
 511                                  # Generating URL link from getLinkFromPattern
 512                                  $paramset="link=" . urlencode($this->getLinkFromPattern($row,$link));
 513                                }
 514                                # add value to dataset
 515                                $this->addChartData($row[$FieldName], $paramset, "");
 516
 517                           }
 518                          $k++;
 519                     }
 520
 521                  }else{
 522
 523                     ### Single Series
 524                     # fetching recordset
 525                     while($row = mysql_fetch_array($query_result)){
 526                           # Creating Control break depending on ctrlField
 527                           # if ctrlField value changes then dataset will be Generated
 528                           if ($tempContrl!=$row[$ctrlField]){
 529                                    if($i<=$arrLimit){
 530                                      $tempParam = $datsetParamArray[$i-1];
 531                                    }else{
 532                                      $tempParam="";
 533                                    }
 534                                    # Add Dataset with adddataset() function
 535                                    $this->addDataset($row[$ctrlField],$tempParam);
 536                                    $tempContrl=$row[$ctrlField];
 537                                    $i++;
 538                           }
 539                        # Generating URL link
 540                           if($link==""){
 541                              $paramset="";
 542                           }else{
 543                              # Generating URL link from getLinkFromPattern
 544                              $paramset="link=" . urlencode($this->getLinkFromPattern($row,$link));
 545                           }
 546                           # add value to dataset
 547                           $this->addChartData($row[$valueField], $paramset, "");
 548
 549                    }
 550                }
 551          }elseif($this->DataBaseType=="oracle"){
 552                 # For Oracle Connection
 553                 # fetching recordset
 554                 while(OCIFetchInto($query_result, $row, OCI_ASSOC)){
 555                       # Create Control break depending on ctrlField
 556                       # if ctrlField value changes then dataset will be Generated
 557                       if ($tempContrl!=$row[$ctrlField]){
 558                                if($i<=$arrLimit){
 559                                  $tempParam = $datsetParamArray[$i-1];
 560                                }else{
 561                                  $tempParam="";
 562                                }
 563                                # add Dataset
 564                                $this->addDataset($row[$ctrlField],$tempParam);
 565                                $tempContrl=$row[$ctrlField];
 566                                $i++;
 567                       }
 568                    # Generating URL link
 569                       if($link==""){
 570                          $paramset="";
 571                       }else{
 572                          # Generating URL link from getLinkFromPattern
 573                          $paramset="link=" . urlencode($this->getLinkFromPattern($row,$link));
 574                       }
 575                       # add value to dataset
 576                       $this->addChartData($row[$valueField], $paramset, "");
 577                }
 578          }
 579    }
 580
 581     # addDataFromDatabase funcion take 5 parameter like query_result, label field, value field
 582     # and initialize dataset variables and link
 583     function addDataFromDatabase($query_result, $db_field_ChartData,$db_field_CategoryNames="", $strParam="",$LinkPlaceHolder=""){
 584
 585        $paramset="";
 586       if($this->DataBaseType=="mysql"){
 587           # fetching recordset till eof
 588           while($row = mysql_fetch_array($query_result)){
 589
 590                      if($LinkPlaceHolder==""){
 591                          $paramset="";
 592                       }else{
 593                           # Getting link
 594                          $paramset="link=" . urlencode($this->getLinkFromPattern($row,$LinkPlaceHolder));
 595                       }
 596                       if ($strParam=""){
 597                         $strParam=$paramset;
 598                       }else{
 599                         $strParam .= ";" . $paramset;
 600                       }
 601
 602             # covert to set element and save to $partXML
 603             if($db_field_CategoryNames==""){
 604                $data=@$row[$db_field_ChartData];
 605                if($strParam!="")
 606                    $this->addChartData($this->encodeSpecialChars($data),$strParam);
 607                else
 608                 $this->addChartData($this->encodeSpecialChars($data));
 609            }
 610            else{
 611                $data=@$row[$db_field_ChartData];
 612                $label=@$row[$db_field_CategoryNames];
 613                $this->addChartData($this->encodeSpecialChars($data),"name=" . $this->encodeSpecialChars($label) . ";" .$strParam,"" );
 614            }
 615         }
 616       }elseif($this->DataBaseType=="oracle"){
 617           # fetching recordset till eof
 618           while(OCIFetchInto($query_result, $row, OCI_ASSOC)){
 619
 620                      if($LinkPlaceHolder==""){
 621                          $paramset="";
 622                       }else{
 623                           # Getting link
 624                          $paramset="link=" . urlencode($this->getLinkFromPattern($row,$LinkPlaceHolder));
 625                       }
 626                       if ($strParam=""){
 627                         $strParam=$paramset;
 628                       }else{
 629                         $strParam .= ";" . $paramset;
 630                       }
 631
 632             # covert to set element and save to $partXML
 633             if($db_field_CategoryNames==""){
 634                $data=@$row[$db_field_ChartData];
 635                if($strParam!="")
 636                    $this->addChartData($this->encodeSpecialChars($data),$strParam);
 637                else
 638                 $this->addChartData($this->encodeSpecialChars($data));
 639            }
 640            else{
 641                $data=@$row[$db_field_ChartData];
 642                $label=@$row[$db_field_CategoryNames];
 643                $this->addChartData($this->encodeSpecialChars($data),"name=" . $this->encodeSpecialChars($label) . ";" .$strParam,"" );
 644            }
 645         }
 646       }
 647     }
 648
 649    # setTLine create TrendLine parameter
 650    function addTrendLine($strParam){
 651
 652       $listArray=explode($this->del,$strParam);
 653       foreach ($listArray as $valueArray) {
 654           $paramValue=explode("=",$valueArray,2);
 655           if($this->validateParam($paramValue)==true){
 656              $this->trendLines[$this->tLineCounter][$paramValue[0]]=$this->encodeSpecialChars($paramValue[1]);
 657           }
 658       }
 659       $this->tLineCounter++;
 660     }
 661
 662
 663     #this function sets chart messages
 664     function setChartMessage($strParam){
 665        $this->chartMSG="?";
 666
 667        $listArray=explode($this->del,$strParam);
 668        foreach ($listArray as $valueArray) {
 669            $paramValue=explode("=",$valueArray,2);
 670            if($this->validateParam($paramValue)==true){
 671                $this->chartMSG.=$paramValue[0] . "=" . $this->encodeSpecialChars($paramValue[1]) . "&";
 672            }
 673        }
 674        $this->chartMSG=substr($this->chartMSG,0,strlen($this->chartMSG)-1);
 675    }
 676
 677     #### - This function is mostly for Future USE -----------------------------
 678     # set JS constructor of FusionCharts.js
 679     function setAddChartParams($debugMode, $registerWithJS=0, $c="", $scaleMode="", $lang=""){
 680       $this->JSC["debugmode"]=$debugMode;
 681       $this->JSC["registerwithjs"]=$registerWithJS;
 682       $this->JSC["bgcolor"]=$c;
 683       $this->JSC["scalemode"]=$scaleMode;
 684       $this->JSC["lang"]=$lang;
 685
 686     }
 687
 688     # The function SetInitParam() adds extra chart settings
 689     function setInitParam($tname,$tvalue){
 690
 691        $trimName= strtolower(str_replace(" ","",$tname));
 692        $this->JSC[$trimName]=$tvalue;
 693
 694     }
 695
 696     # getXML render all class arrays to XML output
 697     function getXML(){
 698
 699        $this->strXML="";
 700
 701        $strChartParam="";
 702
 703
 704        $strChartParam=$this->getChartParamsXML();
 705        if($this->seriesType==1){
 706                   if(gettype(strpos($this->chartType,"line"))!="boolean"){
 707                      if(strpos($strChartParam,"lineColor")===false){
 708                        $colorSet=$this->getColor(0);
 709                        $this->setChartParams("lineColor=" . $colorSet );
 710                      }
 711
 712                   }
 713                   if(gettype(strpos($this->chartType,"area"))!="boolean"){
 714                      if(strpos($strChartParam,"areaBgColor")===false){
 715                        $colorSet=$this->getColor(0);
 716                        $this->setChartParams("areaBgColor=" . $colorSet );
 717                      }
 718                   }
 719        }
 720
 721
 722        # calling getChartParamsXML function for chart parameter
 723        $this->strXML  =  "<graph " . $this->getChartParamsXML() . " >";
 724        if ($this->seriesType >= 0 and $this->seriesType <= 4) {
 725
 726            # calling getCategoriesXML function for Category element
 727            $this->strXML .= $this->getCategoriesXML();
 728            # calling getDatasetXML function for set element
 729            $this->strXML .= $this->getDatasetXML();
 730            # calling getvTrendLinesXML function for vTrendLines element
 731            if($this->seriesType==3){
 732              $this->strXML .= $this->getvTrendLinesXML();
 733            }
 734            #  Calling getLinesetXML
 735            if($this->seriesType==4){
 736              $this->strXML .= $this->getLinesetXML();
 737            }
 738            # calling getTrendLinesXML function for TrendLines element
 739            $this->strXML .= $this->getTrendLinesXML();
 740            # calling getStylesXML function for Styles element
 741            $this->strXML .= $this->getStylesXML();
 742
 743        }else if($this->seriesType == 5) {
 744            $this->strXML .= $this->getGanttCategoriesXML();
 745            $this->strXML .= $this->getProcessesXML();
 746            $this->strXML .= $this->getGanttDatatableXML();
 747            $this->strXML .= $this->getTasksXML();
 748            $this->strXML .= $this->getConnectorsXML();
 749            $this->strXML .= $this->getMilestonesXML();
 750            # calling getTrendLinesXML function for TrendLines element
 751            $this->strXML .= $this->getTrendLinesXML();
 752            # calling getStylesXML function for Styles element
 753            $this->strXML .= $this->getStylesXML();
 754            $this->strXML .= $this->getLegendXML();
 755        }
 756
 757        # Closing Chart element
 758        $this->strXML .= "</graph>";
 759        $this->strXML = chr(239) . chr(187) . chr(191) . '<?xml version="1.0" encoding="UTF-8"?>' . $this->strXML;
 760        # Return XML output
 761        return $this->strXML;
 762      }
 763
 764     # set wMode
 765     function setwMode($isTransparent=""){
 766        $this->wMode=$isTransparent;
 767     }
 768
 769     # Function getXML render all class arrays to XML output
 770     function renderChart($isHTML=false, $display=true){
 771
 772        $this->strXML=$this->getXML();
 773        $this->SWFFile=$this->SWFPath . "FCF_" . $this->chartSWF[$this->chartType][0]  . ".swf";
 774
 775        if($this->noCache==true){
 776          if($this->chartMSG==""){
 777             $this->chartMSG = "?nocache=" . microtime();
 778          }else{
 779             $this->chartMSG .=  "&nocache=" . microtime();
 780          }
 781        }
 782
 783        # print the charts
 784        if($isHTML==false){
 785          if($display){
 786             print $this->renderChartJS($this->SWFFile . $this->chartMSG,"",$this->strXML,$this->chartID, $this->width, $this->height,$this->JSC["debugmode"], $this->JSC["registerwithjs"],$this->wMode);
 787          }else{
 788            return $this->renderChartJS($this->SWFFile . $this->chartMSG,"",$this->strXML,$this->chartID, $this->width, $this->height,$this->JSC["debugmode"], $this->JSC["registerwithjs"],$this->wMode);
 789          }
 790
 791        }else{
 792          if($display){
 793            print $this->renderChartHTML($this->SWFFile . $this->chartMSG,"",$this->strXML,$this->chartID, $this->width, $this->height,$this->JSC["debugmode"], $this->JSC["registerwithjs"],$this->wMode);
 794          }else{
 795            return $this->renderChartHTML($this->SWFFile . $this->chartMSG,"",$this->strXML,$this->chartID, $this->width, $this->height,$this->JSC["debugmode"], $this->JSC["registerwithjs"],$this->wMode);
 796          }
 797        }
 798
 799      }
 800
 801      # Sets whether chart SWF files are not to be cached
 802      function setOffChartCaching($swfNoCache=false){
 803           $this->noCache=$swfNoCache;
 804      }
 805
 806     # Renders Chart form External XML data source
 807     function renderChartFromExtXML($dataXML){
 808        print $this->renderChartJS($this->SWFFile,"",$dataXML,$this->chartID, $this->width, $this->height, $this->JSC["debugmode"], $this->JSC["registerwithjs"], $this->wMode);
 809     }
 810
 811    // RenderChartJS renders the JavaScript + HTML code required to embed a chart.
 812    // This function assumes that you've already included the FusionCharts JavaScript class
 813    // in your page.
 814
 815    // $chartSWF - SWF File Name (and Path) of the chart which you intend to plot
 816    // $strURL - If you intend to use dataURL method for this chart, pass the URL as this parameter. Else, set it to "" (in case of dataXML method)
 817    // $strXML - If you intend to use dataXML method for this chart, pass the XML data as this parameter. Else, set it to "" (in case of dataURL method)
 818    // $chartId - Id for the chart, using which it will be recognized in the HTML page. Each chart on the page needs to have a unique Id.
 819    // $chartWidth - Intended width for the chart (in pixels)
 820    // $chartHeight - Intended height for the chart (in pixels)
 821    // $debugMode - Whether to start the chart in debug mode
 822    // $registerWithJS - Whether to ask chart to register itself with JavaScript
 823    // $setTransparent - Transparent mode
 824    function renderChartJS($chartSWF, $strURL, $strXML, $chartId, $chartWidth, $chartHeight, $debugMode=false, $registerWithJS=false, $setTransparent="") {
 825        //First we create a new DIV for each chart. We specify the name of DIV as "chartId"Div.
 826        //DIV names are case-sensitive.
 827
 828        // The Steps in the script block below are:
 829        //
 830        //  1)In the DIV the text "Chart" is shown to users before the chart has started loading
 831        //    (if there is a lag in relaying SWF from server). This text is also shown to users
 832        //    who do not have Flash Player installed. You can configure it as per your needs.
 833        //
 834        //  2) The chart is rendered using FusionCharts Class. Each chart's instance (JavaScript) Id
 835        //     is named as chart_"chartId".
 836        //
 837        //  3) Check whether to provide data using dataXML method or dataURL method
 838        //     save the data for usage below
 839        $strHTML="";
 840
 841        if ($strXML=="")
 842            $tempData = "\t//Set the dataURL of the chart\n\tchart_$chartId.setDataURL(\"$strURL\");";
 843        else
 844            $tempData = "\t//Provide entire XML data using dataXML method\n\tchart_$chartId.setDataXML(\"$strXML\");";
 845
 846        // Set up necessary variables for the RENDERCHART
 847        $chartIdDiv = $chartId . "Div";
 848        $ndebugMode = $this->boolToNum($debugMode);
 849        $nregisterWithJS = $this->boolToNum($registerWithJS);
 850        $nsetTransparent=($setTransparent?"true":"false");
 851
 852
 853        // Create a string for output by the caller
 854
 855        $strHTML .= "\n<!-- START Script Block for Chart $chartId --> \n\n";
 856
 857        $strHTML .= "<div id=\"$chartIdDiv\">\n";
 858        $strHTML .=	"\tChart.\n";
 859        $strHTML .= "</div>\n";
 860        $strHTML .= "<script type=\"text/javascript\" >\n";
 861            //Instantiate the Chart
 862        $strHTML .= "\tvar chart_$chartId = new FusionChartMaker(\"$chartSWF\", \"$chartId\", \"$chartWidth\", \"$chartHeight\", \"$ndebugMode\", \"$nregisterWithJS\", \"" . $this->JSC["bgcolor"] . "\",\"" . $this->JSC["scalemode"] . "\",\"" . $this->JSC["lang"] . "\"); \n";
 863
 864           if($nsetTransparent=="true"){
 865             $strHTML .= "\tchart_$chartId.setTransparent(\"$nsetTransparent\");\n";
 866        }
 867
 868        $strHTML .= $tempData . "\n";
 869        //Finally, render the chart.
 870        $strHTML .=	"\tchart_$chartId.render(\"$chartIdDiv\");\n";
 871        $strHTML .= "</script>\n\n";
 872        $strHTML .= "<!-- END Script Block for Chart $chartId -->\n";
 873
 874        return $strHTML;
 875
 876    }
 877
 878
 879    //RenderChartHTML function renders the HTML code for the JavaScript. This
 880    //method does NOT embed the chart using JavaScript class. Instead, it uses
 881    //direct HTML embedding. So, if you see the charts on IE 6 (or above), you'll
 882    //see the "Click to activate..." message on the chart.
 883    // $chartSWF - SWF File Name (and Path) of the chart which you intend to plot
 884    // $strURL - If you intend to use dataURL method for this chart, pass the URL as this parameter. Else, set it to "" (in case of dataXML method)
 885    // $strXML - If you intend to use dataXML method for this chart, pass the XML data as this parameter. Else, set it to "" (in case of dataURL method)
 886    // $chartId - Id for the chart, using which it will be recognized in the HTML page. Each chart on the page needs to have a unique Id.
 887    // $chartWidth - Intended width for the chart (in pixels)
 888    // $chartHeight - Intended height for the chart (in pixels)
 889    // $debugMode - Whether to start the chart in debug mode
 890    // $registerWithJS - Whether to ask chart to register itself with JavaScript
 891    // $setTransparent - Transparent mode
 892    function renderChartHTML($chartSWF, $strURL, $strXML, $chartId, $chartWidth, $chartHeight, $debugMode=false,$registerWithJS=false, $setTransparent="") {
 893        // Generate the FlashVars string based on whether dataURL has been provided or dataXML.
 894
 895        $strHTML="";
 896        $strFlashVars = "&chartWidth=" . $chartWidth . "&chartHeight=" . $chartHeight . "&debugMode=" . $this->boolToNum($debugMode);
 897
 898        $strFlashVars .= "&scaleMode=" . $this->JSC["scalemode"] . "&lang=" . $this->JSC["lang"];
 899
 900        if ($strXML=="")
 901            // DataURL Mode
 902            $strFlashVars .= "&dataURL=" . $strURL;
 903        else
 904            //DataXML Mode
 905            $strFlashVars .= "&dataXML=" . $strXML;
 906
 907        $nregisterWithJS = $this->boolToNum($registerWithJS);
 908        if($setTransparent!=""){
 909          $nsetTransparent=($setTransparent==false?"opaque":"transparent");
 910        }else{
 911          $nsetTransparent="window";
 912        }
 913
 914        $strHTML .= "\n<!-- START Code Block for Chart $chartId -->\n\n";
 915
 916         $HTTP="http";
 917         if(strtolower($_SERVER['HTTPS'])=="on")
 918         {
 919            $HTTP="https";
 920         }
 921
 922         $Strval = $_SERVER['HTTP_USER_AGENT'];
 923         $pos=strpos($Strval,"MSIE");
 924         if($pos===false){
 925
 926            $strHTML .= "<embed src=\"$chartSWF\" FlashVars=\"$strFlashVars&registerWithJS=$nregisterWithJS\" quality=\"high\" width=\"$chartWidth\" height=\"$chartHeight\" name=\"$chartId\" " . ($this->JSC["bgcolor"]!="")? " bgcolor=\"" . $this->JSC["bgcolor"] . "\"":"" . " allowScriptAccess=\"always\"  type=\"application/x-shockwave-flash\"  pluginspage=\"$HTTP://www.macromedia.com/go/getflashplayer\" wmode=\"$nsetTransparent\" \n";
 927
 928         }else{
 929            $strHTML .= "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"$HTTP://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"$chartWidth\" height=\"$chartHeight\" id=\"$chartId\"> \n";
 930            $strHTML .= "\t<param name=\"allowScriptAccess\" value=\"always\" /> \n";
 931            $strHTML .= "\t<param name=\"movie\" value=\"$chartSWF\" /> \n";
 932            $strHTML .= "\t<param name=\"FlashVars\" value=\"$strFlashVars&registerWithJS=$nregisterWithJS\" /> \n";
 933            $strHTML .= "\t<param name=\"quality\" value=\"high\"  /> \n";
 934            $strHTML .= "\t<param name=\"wmode\" value=\"$nsetTransparent\"  /> \n";
 935               //Set background color
 936               if($this->JSC["bgcolor"] !="") {
 937                  $strHTML .=  "\t<param name=\"bgcolor\" value=\"" . $this->JSC["bgcolor"] .  "\" /> \n";
 938               }
 939
 940            $strHTML .= "</object>\n";
 941            $strHTML .= "<!-- END Code Block for Chart $chartId -->\n";
 942
 943       }
 944       return $strHTML;
 945    }
 946
 947    // The function boolToNum() function converts boolean values to numeric (1/0)
 948    function boolToNum($bVal) {
 949        return (($bVal==true) ? 1 : 0);
 950    }
 951
 952
 953##------------ PRIVATE FUNCTIONS ----------------------------------------------------------------
 954
 955     # getDatasetXML create set chart xml
 956     function getDatasetXML(){
 957       # Calling dataset function depending on seriesType
 958       switch ($this->seriesType){
 959       case 1 :
 960         return $this->getSSDatasetXML();
 961         break;
 962       case 2 :
 963         return $this->getMSDatasetXML();
 964         break;
 965       case 3 :
 966            return $this->getMSDatasetXML();
 967         break;
 968       case 4 :
 969         return $this->getMSStackedDatasetXML();
 970         break;
 971       }
 972     }
 973     # By getChartParamsXML, we can fetch charts array and convert into XML
 974     # and return like "caption='xyz' xAxisName='x side' ............
 975     function getChartParamsXML(){
 976        $partXML="";
 977        # feching charts each array and converting into chat parameter
 978        foreach($this->chartParams as $part_type => $part_name){
 979           $partXML .= $part_type . "='" . $this->encodeSpecialChars($part_name) . "' ";
 980        }
 981        # Return Chart Parameter
 982        return $partXML;
 983     }
 984
 985
 986     # Function getCategoriesXML for getting Category part XML
 987     function getCategoriesXML(){
 988       if($this->seriesType>1){
 989           $partXML="";
 990           # adding categories parameter
 991           $partXML="<categories " . $this->categoriesParam . " >";
 992           if($this->categoryNamesCounter>1){
 993           foreach($this->categoryNames as $part_type => $part_name){
 994                   if($part_name!=""){
 995                     # adding elements
 996                     if($part_name!="Array"){
 997                         $partXML .= $part_name;
 998                    }
 999                   }
1000           }
1001           }
1002           # Closing <categories>
1003           $partXML .="</categories>";
1004           return $partXML;
1005       }
1006     }
1007     # creating single set element
1008     #       <set value='30' />
1009     #       <set value='26' />
1010
1011     function getSSDatasetXML(){
1012       if($this->seriesType==1){
1013           $partXML="";
1014           foreach($this->dataset as $part_type => $part_name){
1015               if($part_name!=""){
1016                 # adding elements
1017                 if($part_name!="Array"){
1018                   $partXML .= $part_name;
1019                 }
1020               }
1021           }
1022           return $partXML;
1023       }
1024     }
1025
1026     # getMSDatasetXML for getting datset part XML
1027     #     <dataset seriesName='Product A' color='AFD8F8' showValues='0'>
1028     #       <set value='30' />
1029     #       <set value='26' />
1030     #     </dataset>
1031     function getMSDatasetXML(){
1032       if($this->seriesType>1){
1033           $partXML="";
1034           foreach($this->dataset as $part_type => $part_name){
1035               $partXML .="<dataset  " . $this->datasetParam[$part_type] . " >";
1036               foreach($this->dataset[$part_type] as $part_type1 => $part_name1){
1037                       if($part_name1!=""){
1038                         # Adding elements
1039                         if($part_name1!="Array"){
1040                           $partXML .= $part_name1;
1041                         }
1042                       }
1043               }
1044               $partXML .="</dataset>";
1045           }
1046           return $partXML;
1047       }
1048     }
1049
1050
1051     # getTrendLinesXML create XML output depending on trendLines array
1052     #  <trendLines>
1053     #    <line startValue='700000' color='009933' displayvalue='Target' />
1054     # </trendLines>
1055     function getTrendLinesXML(){
1056        $partXML="";
1057        $lineXML="";
1058        # fetching trendLines array
1059        foreach($this->trendLines as $l_type => $l_name){
1060          # staring line element
1061          $lineXML .="<line ";
1062          # fetching trendLines array with in array element
1063          foreach($this->trendLines[$l_type] as $part_type => $part_name){
1064
1065                $lineXML .= $part_type . "='" . $this->encodeSpecialChars($part_name) . "' ";
1066
1067          }
1068          # close line element
1069          $lineXML .=" />";
1070        }
1071        # if line element present then adding $lineXML with in trendLines element
1072
1073        $pos = strpos($lineXML, "=");
1074        if ($pos!==false){
1075           $partXML = "<trendLines>" . $lineXML . "</trendLines>";
1076        }else{
1077           # return nothing
1078           $partXML="";
1079        }
1080        # return trendLines xml
1081        return $partXML;
1082     }
1083
1084
1085
1086      # adding set element to dataset element for seriesType 1 and 2
1087     function setSSMSDataArray($value="",$setParam="",$vlineParam = "" ){
1088         $strSetXML="";
1089         $strParam="";
1090         $color=0;
1091         if($vlineParam==""){
1092           if($setParam!=""){
1093               $strParam = $this->ConvertParamToXMLAttribute($setParam);
1094
1095           }
1096
1097           $colorSet="";
1098           if ($this->UserColorON == true){
1099                   if($this->seriesType==1 && (gettype(strpos($this->chartType,"line"))=="boolean" && gettype(strpos($this->chartType,"area"))=="boolean")){
1100                  if(strpos(strtolower($strParam)," color")===false){
1101                     $colorSet=" color='" . $this->getColor($this->setCounter) . "' ";
1102                  }
1103               }
1104           }else{
1105               if($this->seriesType==1 && (gettype(strpos($this->chartType,"pie"))=="boolean" && gettype(strpos($this->chartType,"line"))=="boolean" && gettype(strpos($this->chartType,"area"))=="boolean")){
1106                  if(strpos(strtolower($strParam)," color")===false){
1107                     $colorSet=" color='" . $this->getColor($this->setCounter) . "' ";
1108                  }
1109               }
1110           }
1111              # setting set parameter
1112              $strSetXML ="<set  value='" . $value . "' " . $strParam . $colorSet . " />";
1113
1114         }else{
1115           $strParam = $this->ConvertParamToXMLAttribute($strParam);
1116
1117           # setting vline parameter
1118           $strSetXML="<vLine " . $strParam . "  />";
1119         }
1120         return $strSetXML;
1121     }
1122
1123   ## - - - -   - -   Array Init Functions  - - --- - -- - - - - - - -- - - - - -
1124
1125     # Function createCategory create array element with in Categories
1126     function createCategory($catID){
1127         $this->categoryNames[$catID]= array();
1128     }
1129     # createDataset dataset array element
1130     function createDataset($dataID){
1131         $this->dataset[$dataID]= array();
1132     }
1133     # creating set  dataset array element
1134     function createDataValues($datasetID, $dataID){
1135         $this->dataset[$datasetID][$dataID]= array();
1136     }
1137     # createTrendLines create TrendLines array
1138     function createTrendLines($lineID){
1139        $this->trendLines[$lineID] = array();
1140     }
1141     # setTLine create TrendLine parameter
1142     function setTLine($lineID,$paramName, $paramValue){
1143         $this->trendLines[$lineID][$paramName]=$paramValue;
1144     }
1145
1146
1147  # ----- ----------    -----  Misc utility functions  ---- ------ -----------
1148
1149     # converting ' and " to %26apos; and &quot;
1150     function encodeSpecialChars($strValue){
1151
1152        $pattern="/%(?![\da-f]{2}|[\da-f]{4})/i";
1153        $strValue=preg_replace($pattern, "%25", $strValue);
1154
1155        if ($this->encodeChars==true){
1156            $strValue=str_replace("&","%26",$strValue);
1157            $strValue=str_replace("'","%26apos;",$strValue);
1158            $strValue=str_replace("\"","%26quot;",$strValue);
1159
1160            $strValue=preg_replace("/\<a/i", "%26lt;A", $strValue);
1161            $strValue=preg_replace("/\<\/a/i", "%26lt;/A", $strValue);
1162
1163            $strValue=preg_replace("/\<i/i", "%26lt;I", $strValue);
1164            $strValue=preg_replace("/\<\/i/i", "%26lt;/I", $strValue);
1165
1166            $strValue=preg_replace("/\<u/i", "%26lt;U", $strValue);
1167            $strValue=preg_replace("/\<\/u/i", "%26lt;/U", $strValue);
1168
1169            $strValue=preg_replace("/\<li/i", "%26lt;LI", $strValue);
1170            $strValue=preg_replace("/\<\/li/i", "%26lt;/LI", $strValue);
1171
1172            $strValue=preg_replace("/\<font/i", "%26lt;FONT", $strValue);
1173            $strValue=preg_replace("/\<\/font/i", "%26lt;/FONT", $strValue);
1174
1175            $strValue=preg_replace("/\<p/i", "%26lt;P", $strValue);
1176            $strValue=preg_replace("/\<\/p/i", "%26lt;/P", $strValue);
1177
1178            $strValue=preg_replace("/\<br/i", "%26lt;BR", $strValue);
1179
1180            $strValue=preg_replace("/\<b/i", "%26lt;B", $strValue);
1181            $strValue=preg_replace("/\<\/b/i", "%26lt;/B", $strValue);
1182
1183            $strValue=str_replace("<", "%ab",$strValue);
1184            $strValue=str_replace(">", "%26gt;",$strValue);
1185        }else{
1186            $strValue=str_replace("'","&apos;",$strValue);
1187            $strValue=str_replace("\"","&quot;",$strValue);
1188
1189            $strValue=preg_replace("/\<a/i", "&lt;A", $strValue);
1190            $strValue=preg_replace("/\<\/a/i", "&lt;/A", $strValue);
1191
1192            $strValue=preg_replace("/\<i/i", "&lt;I", $strValue);
1193            $strValue=preg_replace("/\<\/i/i", "&lt;/I", $strValue);
1194
1195            $strValue=preg_replace("/\<u/i", "&lt;U", $strValue);
1196            $strValue=preg_replace("/\<\/u/i", "&lt;/U", $strValue);
1197
1198            $strValue=preg_replace("/\<li/i", "&lt;LI", $strValue);
1199            $strValue=preg_replace("/\<\/li/i", "&lt;/LI", $strValue);
1200
1201            $strValue=preg_replace("/\<font/i", "&lt;FONT", $strValue);
1202            $strValue=preg_replace("/\<\/font/i", "&lt;/FONT", $strValue);
1203
1204            $strValue=preg_replace("/\<p/i", "&lt;P", $strValue);
1205            $strValue=preg_replace("/\<\/p/i", "&lt;/P", $strValue);
1206
1207            $strValue=preg_replace("/\<br/i", "&lt;BR", $strValue);
1208
1209            $strValue=preg_replace("/\<b/i", "&lt;B", $strValue);
1210            $strValue=preg_replace("/\<\/b/i", "&lt;/B", $strValue);
1211
1212            $strValue=str_replace("<","%ab",$strValue);
1213            $strValue=str_replace(">", "&gt;",$strValue);
1214        }
1215
1216        $strValue=str_replace("=","%3d",$strValue);
1217        $strValue=str_replace("+","%2b",$strValue);
1218
1219        $strValue=str_replace("�","%a2",$strValue);
1220        $strValue=str_replace("�","%a3",$strValue);
1221        $strValue=str_replace("�","%E2%82%AC",$strValue);
1222        $strValue=str_replace("�","%a5",$strValue);
1223        $strValue=str_replace("?","%e2%82%a3",$strValue);
1224
1225        return $strValue;
1226
1227     }
1228
1229    # Its convert pattern link to original link
1230    # abcd.php?cid=##Field_name_1##&pname=##Field_name_2##
1231    function getLinkFromPattern($row,$tempLink){
1232        # convert link into array break on '##'
1233        $aa=explode("##",$tempLink);
1234        # Reading array
1235        foreach($aa as $v){
1236          # Finding '=' into array
1237          $pos = strpos($v, "=");
1238              # not found '='
1239              if($pos === false){
1240                  if($v!=""){
1241                    $pet="##" . $v . "##";
1242                       $tempLink=str_replace($pet,$row[$v],$tempLink);
1243                }
1244              }
1245          }
1246         return $tempLink;
1247     }
1248
1249
1250     # convertion of semi colon(;) separeted paramater to XML attribute
1251     function ConvertParamToXMLAttribute($strParam){
1252
1253         $xmlParam="";
1254         $listArray=explode($this->del,$strParam);
1255         foreach ($listArray as $valueArray) {
1256           $paramValue=explode("=",$valueArray,2);
1257           if($this->validateParam($paramValue)==true){
1258               # creating parameter set
1259               $xmlParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' ";
1260           }
1261        }
1262
1263        # Return
1264        return $xmlParam;
1265
1266     }
1267
1268     function validateParam($paramValue){
1269         if(count($paramValue)>=2){
1270            if(trim($paramValue[0])==""){
1271              return false;
1272            }
1273            return true;
1274         }else{
1275            return false;
1276         }
1277     }
1278
1279     # Getting Charts series type from charts array. 1 => single series, 2=> multi-series, 3=> scatter and bubble, 4=> MSStacked. defult 1 => single series
1280     function getSeriesType(){
1281        $sValue=1;
1282        if(is_array($this->chartSWF[$this->chartType])){
1283          $sValue=$this->chartSWF[$this->chartType][1];
1284        }else{
1285          $sValue=1;
1286        }
1287     

Large files files are truncated, but you can click here to view the full file