Browse Source

Try to use covertQDC.xsl before using the Drupal's table generating business.

pull/101/head
Adam Vessey 13 years ago
parent
commit
2ac5ad45c7
  1. 81
      ObjectHelper.inc

81
ObjectHelper.inc

@ -429,50 +429,59 @@ class ObjectHelper {
return ''; return '';
} }
$simplexml = new SimpleXMLElement($xmlstr); if (($xsl_path = "$path/xsl/convertQDC.xsl") &&
($xsl = DOMDocument::load($xsl_path)) &&
($ds = DOMDocument::loadXML($xmlstr))) {
$transform = new XSLTProcessor();
$transform->importStylesheet($domdoc);
return $transform->transformToHTML($ds);
}
else {
$simplexml = new SimpleXMLElement($xmlstr);
$headers = array( $headers = array(
array( array(
'data' => t('Metadata'), 'data' => t('Metadata'),
'colspan' => 2, 'colspan' => 2,
), ),
); );
$rows = array(); $rows = array();
foreach ($simplexml->getNamespaces(TRUE) as $ns) { foreach ($simplexml->getNamespaces(TRUE) as $ns) {
foreach ($simplexml->children($ns) as $child) { foreach ($simplexml->children($ns) as $child) {
$data = array(); $data = array();
$rendered_data = ''; $rendered_data = '';
if ($grand_children = $child->children()) { if ($grand_children = $child->children()) {
foreach($grand_children as $grand_child) { foreach($grand_children as $grand_child) {
$data[] = $grand_child->tagName() . ' = ' . (string)$grand_child; $data[] = $grand_child->getName() . ' = ' . (string)$grand_child;
}
}
else {
$rendered_data = (string)$child;
} }
}
else {
$rendered_data = (string)$child;
}
if ($data) { if ($data) {
$rendered_data = theme('item_list', $data); $rendered_data = theme('item_list', $data);
} }
if ($rendered_data) { if ($rendered_data) {
$rows[] = array( $rows[] = array(
array( array(
'data' => $child->getName(), 'data' => $child->getName(),
'class' => 'dc-tag-name', 'class' => 'dc-tag-name',
), ),
array( array(
'data' => $rendered_data, 'data' => $rendered_data,
'class' => 'dc-content', 'class' => 'dc-content',
), ),
); );
} }
}
} }
}
return theme('table', $headers, $rows, array('class' => 'dc-table')); return theme('table', $headers, $rows, array('class' => 'dc-table'));
}
} }
/** /**

Loading…
Cancel
Save