<?php

function fn_allalerts_a($aql)
{
	$list = $aql->Consume(1);
	$set = array();
	
	$allprops = Properties::GetAllProperties();

	foreach($list[0]->value as $a)
	{
		$ass = new Asset($a);
		$props = $ass->GetAlerts();
		$ass->GetValues($props);
		$ass->Fetch($props);		
		
		foreach($alerts as $p)
		{
			$px = new AQLPoint();
			$px->processed = True;
			$px->assetid = $a;
			$px->origin = $p['id'];
			$px->sourceid = $a;
			$px->propertyid = -1;
			
			$px->rawvalue = $p['state'];
			$px->value = $p['state'];
			
			if (isset($p->value['_dynamics']))
			{
				if (in_array($active,$p->value['_dynamics']))
				{
					$px->dynamic = $px->dynamic = $a.':-1:'.$p['id'].':'.$active;
				}
			}
			
			$px->fullvalue = $px->value;
			$px->type = "ALERT";
			$px->name = $p['name'];
			
			$set[] = $px;
		}
	}
		
	$a = new AQLStackElement();
	$a->typename = "pointlist";
	$a->islist = true;
	$a->value = $set;
	array_push($aql->stack,$a);
}

?>