//Skip subjects that don't match $label, if necessary if (!empty($label) && $subject['subjectLabel'] !== $label) { continue; } //If the subject has been locked, make sure it is never highlighted as //having errors if ((int) $subject['locked'] == 1) { $db->storeFinalDiffState($subject['subjectLabel'], 1); continue; } $xml = getSubjectDataAsXml($subject['subjectLabel'], $db); // header('Content-type: application/xml'); // print $xml->saveXML();die; $result = applyXSLtoXML($xml, XSL_SUBJECT_DATA); $xml = new DomDocument(); $xml->loadXML($result); $rows = $xml->getElementsByTagName('rows')->item(0); $diffResult = diffRows($rows); if ($diffResult['diff'] > 0) { $db->storeFinalDiffState($subject['subjectLabel'], -1); } else { if ($diffResult['empty'] > 0) { $db->storeFinalDiffState($subject['subjectLabel'], -2); } else { $db->storeFinalDiffState($subject['subjectLabel'], 1); } } } } catch (Exception $e) { print $e->getMessage(); }
} $xml = NULL; if ($final) { $xml = getSubjectFinalDataAsXML($subjectLabel, $db); } else { $xml = getSubjectDataAsXml($subjectLabel, $db); /** WARNING: This function caches the XSL file. */ $result = applyXSLtoXML($xml, XSL_SUBJECT_DATA); // header('Content-type: application/xml'); // print $xml->saveXML();die; $xml = new DomDocument(); $xml->loadXML($result); // header('Content-type: application/xml'); // print $xml->saveXML();die; $rows = $xml->getElementsByTagName('rows')->item(0); $hasDiff = diffRows($rows); } } catch (Exception $e) { ajax_error($e->getMessage()); } $content_type = 'application/xml'; $content_disposition = null; $result = ""; switch ($format) { case 'csv': $content_type = 'text/csv'; $content_disposition = "attachment; filename=" . $subjectLabel . ".csv"; $result = convertFinalDataToCSV($xml, array('DATA_LABEL', 'RESP')); break; default: $result = $xml->saveXML();