put output of version attriubtes into separate function

This commit is contained in:
Uwe Steinmann 2016-08-03 15:18:36 +02:00
parent 6a367906d6
commit 6e96222466

View File

@ -76,6 +76,48 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
} }
} /* }}} */ } /* }}} */
protected function printVersionAttributes($folder, $version) { /* {{{ */
$f = null;
$attrdefgrps = $folder->getAttributeDefintionGroupList(true, $f);
if($attrdefgrps) {
foreach($attrdefgrps as $attrdefgrp) {
$attrdefs = $attrdefgrp['group']->getAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_all, SeedDMS_Core_AttributeDefinition::objtype_documentcontent), SeedDMS_Core_AttributeDefinitionGroup::show_details);
if($attrdefs) {
echo "<b>".htmlspecialchars($attrdefgrp['group']->getName())."</b><br />";
foreach($attrdefs as $attrdefarr) {
$attrdef = $attrdefarr['attrdef'];
$attribute = $version->getAttribute($attrdef);
if($attribute) {
$arr = $this->callHook('showDocumentContentAttribute', $version, $attribute, SeedDMS_Core_AttributeDefinitionGroup::show_details);
if(is_array($arr)) {
echo "<li>".$arr[0].": ".$arr[1]."</li>\n";
} else {
print "<li>".htmlspecialchars($attrdef->getName()).": ";
$this->printAttributeValue($attribute);
echo "</li>\n";
}
}
}
}
}
} else {
$attributes = $version->getAttributes();
if($attributes) {
foreach($attributes as $attribute) {
$arr = $this->callHook('showDocumentContentAttribute', $version, $attribute, SeedDMS_Core_AttributeDefinitionGroup::show_details);
if(is_array($arr)) {
print "<li>".$arr[0].": ".$arr[1]."</li>\n";
} else {
$attrdef = $attribute->getAttributeDefinition();
print "<li>".htmlspecialchars($attrdef->getName()).": ";
$this->printAttributeValue($attribute);
echo "</li>\n";
}
}
}
}
} /* }}} */
function timelinedata() { /* {{{ */ function timelinedata() { /* {{{ */
$dms = $this->params['dms']; $dms = $this->params['dms'];
$user = $this->params['user']; $user = $this->params['user'];
@ -507,45 +549,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
print "</ul>\n"; print "</ul>\n";
print "<p style=\"font-style: italic;\">".htmlspecialchars($latestContent->getComment())."</p>"; print "<p style=\"font-style: italic;\">".htmlspecialchars($latestContent->getComment())."</p>";
print "<ul class=\"actions unstyled\">\n"; print "<ul class=\"actions unstyled\">\n";
$f = null; $this->printVersionAttributes($folder, $latestContent);
$attrdefgrps = $folder->getAttributeDefintionGroupList(true, $f);
if($attrdefgrps) {
foreach($attrdefgrps as $attrdefgrp) {
$attrdefs = $attrdefgrp['group']->getAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_all, SeedDMS_Core_AttributeDefinition::objtype_documentcontent), SeedDMS_Core_AttributeDefinitionGroup::show_details);
if($attrdefs) {
echo "<b>".htmlspecialchars($attrdefgrp['group']->getName())."</b><br />";
foreach($attrdefs as $attrdefarr) {
$attrdef = $attrdefarr['attrdef'];
$attribute = $latestContent->getAttribute($attrdef);
if($attribute) {
$arr = $this->callHook('showDocumentContentAttribute', $latestContent, $attribute);
if(is_array($arr)) {
echo "<li>".$arr[0].": ".$arr[1]."</li>\n";
} else {
print "<li>".htmlspecialchars($attrdef->getName()).": ";
$this->printAttributeValue($attribute);
echo "</li>\n";
}
}
}
}
}
} else {
$attributes = $latestContent->getAttributes();
if($attributes) {
foreach($attributes as $attribute) {
$arr = $this->callHook('showDocumentContentAttribute', $latestContent, $attribute);
if(is_array($arr)) {
print "<li>".$arr[0].": ".$arr[1]."</li>\n";
} else {
$attrdef = $attribute->getAttributeDefinition();
print "<li>".htmlspecialchars($attrdef->getName()).": ";
$this->printAttributeValue($attribute);
echo "</li>\n";
}
}
}
}
print "</ul></td>\n"; print "</ul></td>\n";
// print "<td>".htmlspecialchars($latestContent->getComment())."</td>"; // print "<td>".htmlspecialchars($latestContent->getComment())."</td>";
@ -1337,18 +1341,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
if($version->getComment()) if($version->getComment())
print "<p style=\"font-style: italic;\">".htmlspecialchars($version->getComment())."</p>"; print "<p style=\"font-style: italic;\">".htmlspecialchars($version->getComment())."</p>";
print "<ul class=\"actions unstyled\">\n"; print "<ul class=\"actions unstyled\">\n";
$attributes = $version->getAttributes(); $this->printVersionAttributes($folder, $version);
if($attributes) {
foreach($attributes as $attribute) {
$arr = $this->callHook('showDocumentContentAttribute', $version, $attribute);
if(is_array($arr)) {
print "<li>".$arr[0].": ".$arr[1]."</li>\n";
} else {
$attrdef = $attribute->getAttributeDefinition();
print "<li>".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars(implode(', ', $attribute->getValueAsArray()))."</li>\n";
}
}
}
print "</ul></td>\n"; print "</ul></td>\n";
// print "<td>".htmlspecialchars($version->getComment())."</td>"; // print "<td>".htmlspecialchars($version->getComment())."</td>";
print "<td>".getOverallStatusText($vstat["status"])."</td>"; print "<td>".getOverallStatusText($vstat["status"])."</td>";