| 52 |  |  | 
| 53 | $querytxt = $params->getParam(0); | $querytxt = $params->getParam(0); | 
| 54 | $nqlquery = $querytxt->getval(); | $nqlquery = $querytxt->getval(); | 
| 55 | nfo_debug_clean(); | #nfo_debug_clean(); | 
| 56 | #nfo_debug_write($params); | #nfo_debug_write($params); | 
| 57 | #nfo_debug_write($nqlquery); | #nfo_debug_write($nqlquery); | 
| 58 | $result = array(); | $result = array(); | 
| 59 | cms_query($nqlquery,&$result); | cms_query($nqlquery,&$result); | 
| 60 | nfo_debug_write($result); | #nfo_debug_write($result); | 
| 61 |  |  | 
| 62 | $structinfo = array(); | $structinfo = array(); | 
| 63 | $structcontent = array(); | $structcontent = array(); | 
| 64 | $structfields = array(); | $structfields = array(); | 
| 65 |  |  | 
| 66 | foreach ($result[0] as $key => $value) { | foreach ($result[0] as $key => $value) { | 
| 67 |  | $datall = array(); | 
| 68 | if ($key == 'all'){ | if ($key == 'all'){ | 
| 69 | $datall = array(); | #nfo_debug_write($value); | 
| 70 | foreach ($result[0][$key] as $keyall => $valall) { | foreach ($result[0][$key] as $keyall => $valall) { | 
| 71 |  | $datall2 = array(); | 
| 72 | if ($keyall == 'fieldlist'){ | if ($keyall == 'fieldlist'){ | 
| 73 | $datall2 = array(); | foreach ($result[0][$key][$keyall] as $fieldkey => $fieldval) | 
| 74 | foreach ($result[0][$key][$keyall] as $fieldkey => $fieldval){ | { | 
| 75 | $datall2 = new XML_RPC_Value($fieldval,"string"); | $datall2[$fieldkey] = new XML_RPC_Value($fieldval,"string"); | 
|  | } |  | 
|  | $datall[$keyall] = new XML_RPC_Value($datall2,"struct"); |  | 
|  | }else{ |  | 
|  | $datall[$keyall] = new XML_RPC_Value($valall,"string"); |  | 
|  | } |  | 
| 76 | } | } | 
| 77 |  | $datall[$keyall] = new XML_RPC_Value($datall2,"struct"); | 
| 78 |  | }elseif($keyall == 'with'){ | 
| 79 |  | //nothing yet | 
| 80 |  | }else{ | 
| 81 |  | $datall[$keyall] = new XML_RPC_Value($valall,"string"); | 
| 82 |  | } | 
| 83 |  | } | 
| 84 |  |  | 
| 85 | $structinfo[$key] = new XML_RPC_Value($datall,"struct"); | $structinfo[$key] = new XML_RPC_Value($datall,"struct"); | 
| 86 |  |  | 
| 87 | }else{ | }else{ | 
| 88 | $structinfo[$key] = new XML_RPC_Value($value,"string"); | $structinfo[$key] = new XML_RPC_Value($value,"string"); | 
| 89 | } | } | 
| 90 | } | } | 
| 91 |  |  | 
|  | #foreach ($result[1] as $key => $value)  { |  | 
|  | #$structcontent[$key] = new XML_RPC_Value($value,"struct"); |  | 
|  | # } |  | 
|  |  |  | 
| 92 | foreach ($result[1] as $key => $value)  { | foreach ($result[1] as $key => $value)  { | 
| 93 | $cdata = array(); | $cdata = array(); | 
| 94 | foreach($value as $item => $data) { | foreach($value as $item => $data) { | 
| 99 |  |  | 
| 100 | foreach ($result[2] as $key => $value) { | foreach ($result[2] as $key => $value) { | 
| 101 | $structfields[$key] = new XML_RPC_Value($value,"string"); | $structfields[$key] = new XML_RPC_Value($value,"string"); | 
| 102 | } | } | 
| 103 |  |  | 
| 104 | $struct = array(); | $struct = array(); | 
| 105 | $struct[0] = new XML_RPC_Value($structinfo,"struct"); | $struct[0] = new XML_RPC_Value($structinfo,"struct"); | 
| 106 | $struct[1] = new XML_RPC_Value($structcontent,"struct"); | $struct[1] = new XML_RPC_Value($structcontent,"struct"); | 
| 107 | $struct[2] = new XML_RPC_Value($structfields,"struct"); | $struct[2] = new XML_RPC_Value($structfields,"struct"); | 
| 108 |  |  | 
| 109 | $xmldoc = new XML_RPC_Response(new XML_RPC_Value($struct, "struct")); | $xmldoc = new XML_RPC_Response(new XML_RPC_Value($struct, "struct")); | 
| 110 | nfo_debug_write($xmldoc); | #nfo_debug_write($xmldoc); | 
| 111 | #nfo_debug_write($xmldoc->serialize()); | #nfo_debug_write($xmldoc->serialize()); | 
| 112 |  |  | 
| 113 | return $xmldoc; | return $xmldoc; |