Location: PHPKode > scripts > phpchartPlus > phpchartplus/Sources/PHPConfig_Strategy.php
<?php

/*
**************************************************
Class: PHPConfig_Strategy.php
**************************************************
Author: Tsiavos Chris <hide@address.com>
Date: October 2004
**************************************************/

/**
*Includes:
*-the ConfigStrategy Interface
*-the ConfigData class, the common communication structure between 
*ConfigStrategy objects and ConfigParser
*/
require_once("ConfigStrategy_Interface.php");

/**
*Strategy for importing configuration data from PHP Arrays
*This class should be used when you want to import configuration data directly through php arrays
*@author Tsiavos Chris <hide@address.com>
*@license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
class PHPConfig_Strategy implements ConfigStrategy_Interface {
	
	/**
	*Initializes the PHPConfig_Strategy object passing an arbitrary number 
	*of parameters
	*/
	public function initialize($params=NULL) 
	{
		return;
	}
	
	/**
	*Reads the configuration data from the supplied php array
	*@access public
	*@return void
	*@param string[assoc] $params $params["ImageWidth"]<br/>
	*					    $params["ImageHeight"]<br/>
	*					    $params["ImageOutputType"]<br/>
	*					    $params["ImageColor_Start"]<br/>
	*					    $params["ImageColor_Finish"]<br/>
	*					    $params["ImageColor_Alpha"]<br/><br/>
	*					    $params["ChartTitle"]<br/>
	*					    $params["ChartType"]<br/>
	*					    $params["ChartUseBlending"]<br/>
	*					    $params["ChartUseAntialias"]<br/>
	*					    $params["ChartHmargin"]<br/>
	*					    $params["ChartVmargin"]<br/>
	*					    $params["ChartUseStatus"]<br/>
	*					    $params["ChartColor_Start"]<br/>
	*					    $params["ChartColor_Finish"]<br/>
	*					    $params["ChartColor_Alpha"]<br/><br/>
	*					    $params["FontFileLocation"]<br/>
	*					    $params["FontColor"]<br/>
	*					    $params["FontWidth"]<br/>
	*					    $params["FontHeight"]<br/>
	*					    $params["FontSize"]<br/><br/>
	*					    $params["LegendColors"]=array()<br/>
	*					    $params["LegendColors_Alpha"]<br/><br/>
	*					    $params["GridNum"]<br/>
	*					    $params["GridMinValue"]<br/>
	*					    $params["GridMaxValue"]<br/>
	*					    $params["GridColor"]
	*/
	public function readData($params=NULL) 
	{
	
		$ConfigData=new ConfigData();
		
		$ConfigData->ImageWidth=$params["ImageWidth"];
		$ConfigData->ImageHeight=$params["ImageHeight"];
		$ConfigData->ImageOutputType=$params["ImageOutputType"];
		$ConfigData->ImageColor_Start=$params["ImageColor_Start"];
		$ConfigData->ImageColor_Finish=$params["ImageColor_Finish"];
		$ConfigData->ImageColor_Alpha=$params["ImageColor_Alpha"];
		
		$ConfigData->ChartTitle=$params["ChartTitle"];
		$ConfigData->ChartType=$params["ChartType"];
		$ConfigData->ChartUseBlending=$params["ChartUseBlending"];	
		$ConfigData->ChartUseAntialias=$params["ChartUseAntialias"];	
		$ConfigData->ChartHmargin=$params["ChartHmargin"];
		$ConfigData->ChartVmargin=$params["ChartVmargin"];
		$ConfigData->ChartUseStatus=$params["ChartUseStatus"];
		$ConfigData->ChartColor_Start=$params["ChartColor_Start"];
		$ConfigData->ChartColor_Finish=$params["ChartColor_Finish"];
		$ConfigData->ChartColor_Alpha=$params["ChartColor_Alpha"];
		$ConfigData->ChartBgImage=$params["ChartBgImage"];
		
		$ConfigData->FontFileLocation=$params["FontFileLocation"];
		$ConfigData->FontColor=$params["FontColor"];
		$ConfigData->FontWidth=$params["FontWidth"];
		$ConfigData->FontHeight=$params["FontHeight"];
		$ConfigData->FontSize=$params["FontSize"];
		
		$ConfigData->LegendColors=$params["LegendColors"];
		$ConfigData->LegendColors_Alpha=$params["LegendColors_Alpha"];
		
		$ConfigData->GridNum=$params["GridNum"];
		$ConfigData->GridMinValue=$params["GridMinValue"];
		$ConfigData->GridMaxValue=$params["GridMaxValue"];
		$ConfigData->GridColor=$params["GridColor"];
		
		return $ConfigData;
		
	}
	
	/**
	*Returns to the caller
	*@access public
	*@return void
	*/
	public function finalize() 
	{
		return;
	}

}

?>
Return current item: phpchartPlus