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

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

/**
*Includes the DataStrategy Interface
*/
require_once("DataStrategy_Interface.php");

/**
*Strategy for importing chart data from PHP Arrays
*@author Tsiavos Chris <hide@address.com>
*@license http://opensource.org/licenses/gpl-license.php GNU Public License
*/

class PHPData_Strategy implements DataStrategy_Interface {
							      
	public function initialize($params=NULL) {
		return;
	}

	public function perform($params=NULL) {
		
		$Groups=array();	
	
		for ($i=0;$i<count($params);$i++) {
			$Groups[$i]=new Group();
			$Groups[$i]->GroupName=$params[$i]["GroupName"];
			
			for ($j=0;$j<count($params[$i]["Items"]);$j++) {
				$Groups[$i]->GroupItems[$j]=new GroupItem();
				$Groups[$i]->GroupItems[$j]->ItemName=$params[$i]["Items"][$j]["ItemName"];
				$Groups[$i]->GroupItems[$j]->ItemValue=$params[$i]["Items"][$j]["ItemValue"];
			}
			
		}
		
		return $Groups;
	}

	public function finalize() {
		return;
	}
	
}

?>
Return current item: phpchartPlus