add hooks showDocumentAttribute and showDocumentContentAttribute

This commit is contained in:
Uwe Steinmann 2020-07-28 15:39:59 +02:00
parent 15d89c09d6
commit b9ad2195d3

View File

@ -514,18 +514,40 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
$attrstr .= "<table class=\"table table-condensed\">\n";
$attrstr .= "<tr><th>".getMLText('name')."</th><th>".getMLText('attribute_value')."</th></tr>";
foreach($lcattributes as $lcattribute) {
$attrdef = $lcattribute->getAttributeDefinition();
$attrstr .= "<tr><td>".htmlspecialchars($attrdef->getName())."</td><td>".htmlspecialchars(implode(', ', $lcattribute->getValueAsArray()))."</td></tr>\n";
$arr = $this->callHook('showDocumentContentAttribute', $lc, $lcattribute);
if(is_array($arr)) {
$attrstr .= "<tr>";
$attrstr .= "<td>".$arr[0].":</td>";
$attrstr .= "<td>".$arr[1]."</td>";
$attrstr .= "</tr>";
} elseif(is_string($arr)) {
$attrstr .= $arr;
} else {
$attrdef = $lcattribute->getAttributeDefinition();
$attrstr .= "<tr><td>".htmlspecialchars($attrdef->getName())."</td><td>".htmlspecialchars(implode(', ', $lcattribute->getValueAsArray()))."</td></tr>\n";
// TODO: better use printAttribute()
// $this->printAttribute($lcattribute);
}
}
$attrstr .= "</table>\n";
}
$docttributes = $document->getAttributes();
if($docttributes) {
$docattributes = $document->getAttributes();
if($docattributes) {
$attrstr .= "<table class=\"table table-condensed\">\n";
$attrstr .= "<tr><th>".getMLText('name')."</th><th>".getMLText('attribute_value')."</th></tr>";
foreach($docttributes as $docttribute) {
$attrdef = $docttribute->getAttributeDefinition();
$attrstr .= "<tr><td>".htmlspecialchars($attrdef->getName())."</td><td>".htmlspecialchars(implode(', ', $docttribute->getValueAsArray()))."</td></tr>\n";
foreach($docattributes as $docattribute) {
$arr = $this->callHook('showDocumentAttribute', $document, $docattribute);
if(is_array($arr)) {
$attrstr .= "<tr>";
$attrstr .= "<td>".$arr[0].":</td>";
$attrstr .= "<td>".$arr[1]."</td>";
$attrstr .= "</tr>";
} elseif(is_string($arr)) {
$attrstr .= $arr;
} else {
$attrdef = $docattribute->getAttributeDefinition();
$attrstr .= "<tr><td>".htmlspecialchars($attrdef->getName())."</td><td>".htmlspecialchars(implode(', ', $docattribute->getValueAsArray()))."</td></tr>\n";
}
}
$attrstr .= "</table>\n";
}