3 function tool_ee_parse_getview($data)
5 $entity_data = array();
8 foreach($data as $ais_data)
10 $service_name = 'n/a';
18 foreach($ais_data as $ais_line)
20 $ais_line = trim($ais_line);
21 if (ereg("^===\[ Service ([^\ ]+) returned \]===$", $ais_line, $eregs))
23 $service_name = $eregs[1];
25 elseif (ereg("^have ([[:digit:]]+) answer$", $ais_line, $eregs))
29 elseif (ereg("^have ([[:digit:]]+) value$", $ais_line, $eregs))
33 elseif (ereg("^service ->(.*)$", $ais_line, $eregs))
36 $entity['service_id'] = trim($eregs[1]);
38 elseif (ereg("^entity ->(.*)$", $ais_line, $eregs))
41 $entity['entity'] = trim($eregs[1]);
42 $entity_string = str_replace(array('(',')','0x'), '', $entity['entity']);
43 $entity_string = str_replace(':','_', $entity_string);
44 $entity['entity_string'] = $entity_string;
46 elseif (ereg("^NamedEntityName ->(.*)$", $ais_line, $eregs))
49 $entity['entity_name'] = trim($eregs[1]);
51 elseif (ereg("^NamedEntityState ->(.*)$", $ais_line, $eregs))
54 $entity['entity_state'] = trim($eregs[1]);
56 elseif (ereg("^NamedEntityParam1 ->(.*)$", $ais_line, $eregs))
59 $entity['entity_param1'] = trim($eregs[1]);
61 elseif (ereg("^NamedEntityParam2 ->(.*)$", $ais_line, $eregs))
64 $entity['entity_param2'] = trim($eregs[1]);
67 if (sizeof($entity) && ($values_read == $values) && ($values > 0))
69 $entity['service'] = $service_name;
70 $entity['service_code'] = md5($service_name);
71 $entity_data[] = $entity;
83 function tool_ee_get_entities($data)
88 foreach($data as $dkey => $dval)
90 $dkey_bits = explode('_', $dkey);
91 $dkey_nums = sizeof($dkey_bits);
95 $_entity_bit_4 = array_pop($dkey_bits);
96 $_entity_bit_3 = array_pop($dkey_bits);
97 $_entity_bit_2 = array_pop($dkey_bits);
98 $_entity_bit_1 = array_pop($dkey_bits);
100 $dkey_bits = array_reverse($dkey_bits);
101 $_entity_service = array_pop($dkey_bits);
102 $dkey_bits = array_reverse($dkey_bits);
104 $dkey_entity = $_entity_bit_1 .'_'. $_entity_bit_2 .'_'. $_entity_bit_3 .'_'. $_entity_bit_4;
105 $dkey_name = implode('_', $dkey_bits);
107 if (!isset($entities[$_entity_service .'_'. $dkey_entity]))
109 $entities[$_entity_service .'_'. $dkey_entity] = array();
112 $entities[$_entity_service .'_'. $dkey_entity][$dkey_name] = trim($dval);