Exemplo n.º 1
0
 public static function getCSVData($xml_obj, $uniqueHeaders, $print, $headers)
 {
     global $defaultApiNamespace;
     global $defaultObjectNamespace;
     global $SEPARATOR;
     global $TEXT_QUALIFIER;
     $resultRecords = $xml_obj->xpath("//" . $defaultApiNamespace . ":records");
     return ZuoraAPIHelper::getCSVDataFromRecords($resultRecords, $uniqueHeaders, $print, $headers);
     /*
     	#Fill in the data.
     	$temp = "";
     	$output = "";
     	$outputArray = array();
     	if ($headers) {
     	    $temp = implode($SEPARATOR, $uniqueHeaders);
     	    $output .= $temp . "\n";
                 $outputArray[] = $temp;
     	}
     	if ($print) {
     	    print $output;
     	    $output = "";
     	}
     	for ($i = 0; $i < count($resultRecords); $i++) {
                 $temp = "";
     	    $index = 0;
     	    foreach ($uniqueHeaders as $header) {
     	    	if ($index > 0) {
     		    $temp .= $SEPARATOR;
     		}
     	        $attr = $xml_obj->xpath("//" . $defaultApiNamespace . ":records[position()=" . ($i+1) . "]/" . $defaultObjectNamespace . ":" . $header);
     		$value = $attr[0];
     		if ($value) {
     		   // Previously checked if the SEPARATOR character was in the data, but now just escaping by default.
     		   $temp .= $TEXT_QUALIFIER . $value . $TEXT_QUALIFIER;
     		}
     		$index++;
     	    }
     	    $output .= $temp . "\n";
                 $outputArray[] = $temp;
     	    if ($print) {
     	        print $output;
     		$output = "";
     	    }
     	}
     	return $outputArray;
     */
 }