<?php
function fn_pointdecode_c($aql)
{
	$list = $aql->Consume(1);
	
	//Get the list of constants
	
	if (!is_array($list[0]->value))	
		$items = array($list[0]->value);	
	else
		$items = $list[0]->value;
	
	$ppool = array();
	
	$allprops = Properties::GetAllProperties();
	
	//For each of them, break into asset, property and node...
	foreach($items as $itm)
	{
		$bits = explode(':',$itm);
		if (count($bits) < 3)
			continue;
		
		$assetid = 0+$bits[0];
		$propertyid = 0+$bits[1];
			
		$pnt = new AQLPoint();
		$pnt->assetid = $assetid;
		$pnt->sourceid = $assetid;
		$pnt->dynamic = "";
		$pnt->value = "";
		$pnt->propertyid = $propertyid;
		$pnt->processed = False;
		
		foreach($allprops as $px)
		{
			if ($px->id == $propertyid)
			{
				$pnt->type = $px->type;
				$pnt->name = $px->name;
			}
		}
		
		$ppool[] = $pnt;
	}			
	
	//LiveValuesForPoints($ppool);
	
	$a = new AQLStackElement();
	$a->typename = "pointlist";
	$a->islist = true;
	$a->value = $ppool;
	array_push($aql->stack,$a);	
	
	return;
}
?>