mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-12 17:05:46 +00:00
move printAttribute() into parent class
This commit is contained in:
parent
2c53286943
commit
9c3b34b41e
|
@ -1556,6 +1556,55 @@ $(document).ready(function() {
|
|||
<?php
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Output a single attribute in the document info section
|
||||
*
|
||||
* @param object $attribute attribute
|
||||
*/
|
||||
protected function printAttributeValue($attribute, $noecho=false) { /* {{{ */
|
||||
$content = '';
|
||||
$attrdef = $attribute->getAttributeDefinition();
|
||||
switch($attrdef->getType()) {
|
||||
case SeedDMS_Core_AttributeDefinition::type_url:
|
||||
$attrs = $attribute->getValueAsArray();
|
||||
$tmp = array();
|
||||
foreach($attrs as $attr) {
|
||||
$tmp[] = '<a href="'.htmlspecialchars($attr).'">'.htmlspecialchars($attr).'</a>';
|
||||
}
|
||||
$content .= implode('<br />', $tmp);
|
||||
break;
|
||||
case SeedDMS_Core_AttributeDefinition::type_email:
|
||||
$attrs = $attribute->getValueAsArray();
|
||||
$tmp = array();
|
||||
foreach($attrs as $attr) {
|
||||
$tmp[] = '<a mailto="'.htmlspecialchars($attr).'">'.htmlspecialchars($attr).'</a>';
|
||||
}
|
||||
$content .= implode('<br />', $tmp);
|
||||
break;
|
||||
default:
|
||||
$content .= htmlspecialchars(implode(', ', $attribute->getValueAsArray()));
|
||||
}
|
||||
if($noecho)
|
||||
return $content;
|
||||
else
|
||||
echo $content;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Output a single attribute in the document info section
|
||||
*
|
||||
* @param object $attribute attribute
|
||||
*/
|
||||
protected function printAttribute($attribute) { /* {{{ */
|
||||
$attrdef = $attribute->getAttributeDefinition();
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
|
||||
<td><?php $this->printAttributeValue($attribute); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
} /* }}} */
|
||||
|
||||
function printAttributeEditField($attrdef, $attribute, $fieldname='attributes', $norequire=false) { /* {{{ */
|
||||
echo self::getAttributeEditField($attrdef, $attribute, $fieldname, $norequire);
|
||||
} /* }}} */
|
||||
|
|
|
@ -83,44 +83,6 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
|
|||
}
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Output a single attribute in the document info section
|
||||
*
|
||||
* @param object $attribute attribute
|
||||
*/
|
||||
protected function printAttribute($attribute) { /* {{{ */
|
||||
$attrdef = $attribute->getAttributeDefinition();
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
switch($attrdef->getType()) {
|
||||
case SeedDMS_Core_AttributeDefinition::type_url:
|
||||
$attrs = $attribute->getValueAsArray();
|
||||
$tmp = array();
|
||||
foreach($attrs as $attr) {
|
||||
$tmp[] = '<a href="'.htmlspecialchars($attr).'">'.htmlspecialchars($attr).'</a>';
|
||||
}
|
||||
echo implode('<br />', $tmp);
|
||||
break;
|
||||
case SeedDMS_Core_AttributeDefinition::type_email:
|
||||
$attrs = $attribute->getValueAsArray();
|
||||
$tmp = array();
|
||||
foreach($attrs as $attr) {
|
||||
$tmp[] = '<a mailto="'.htmlspecialchars($attr).'">'.htmlspecialchars($attr).'</a>';
|
||||
}
|
||||
echo implode('<br />', $tmp);
|
||||
break;
|
||||
default:
|
||||
echo htmlspecialchars(implode(', ', $attribute->getValueAsArray()));
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
} /* }}} */
|
||||
|
||||
function documentListItem() { /* {{{ */
|
||||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
|
|
Loading…
Reference in New Issue
Block a user