Hallo neu_pe,
Zitat von
neu_pe
Wie sieht die einfachste Lösung aus?
relativ einfach wäre es, die Berechnung und Ausgabe in einem angepassten Auflistungs-Template vorzunehmen.
Hier am Beispiel des 'list_fd_table_default'.
Im Original etwa ab Zeile 92 erfolgt die Ausgabe der Tabelle mit folgendem Code:
PHP-Code:
<table cellpadding="2" cellspacing="0" border="0" class="all_records" summary="">
<!-- indexer::stop -->
<thead>
<tr><?php foreach ($this->thead as $col): ?>
<th class="head<?php echo $col['class']; ?>"><a href="<?php echo $col['href']; ?>" title="<?php echo $col['title']; ?>"><?php echo $col['link']; ?></a></th>
<?php endforeach; if ($this->details || $this->editable || $this->deletable || $this->exportable): ?>
<th class="head col_last"> </th><?php endif; ?>
</tr>
</thead>
<!-- indexer::continue -->
<tbody><?php foreach ($this->tbody as $class=>$row): ?>
<tr class="<?php echo $class; ?>"><?php foreach ($row as $col): ?>
<td class="body <?php echo $col['class']; ?>"><?php if ($col['type']=='file' && $col['src']): ?><?php if ($col['display']=='image'): ?> <img src="<?php echo($this->getImage($col['src'], 80, null)); ?>" alt="<?php echo urldecode(basename($col['src'])); ?>" title="<?php echo urldecode(basename($col['src'])); ?>" /> <?php else: ?><img src="<?php echo $col['icon']; ?>" alt="<?php echo $col['linkTitle']; ?>" /> <a href="<?php echo $col['href']; ?>"><?php echo $col['linkTitle'] . $col['size']; ?></a>
<?php endif; ?>
<?php else: echo $col['content']; endif;?> </td><?php endforeach; if ($this->details || $this->editable || $this->deletable || $this->exportable): ?>
<td class="body <?php echo $this->col_last; ?> col_last"><?php if($this->details):?> <a href="<?php echo $col['link_details']; ?>" title="<?php echo $this->textlink_details[1]; ?>"><img src="<?php echo $this->iconFolder; ?>/details.gif" alt="<?php echo $this->textlink_details[1]; ?>" title="<?php echo $this->textlink_details[1]; ?>"/></a><?php endif; ?><?php if ($this->arrEditAllowed[$col['id']]): ?> <a href="<?php echo $col['link_edit']; ?>" title="<?php echo $this->textlink_edit[1]; ?>"><img src="<?php echo $this->iconFolder; ?>/edit.gif" alt="<?php echo $this->textlink_edit[1]; ?>" title="<?php echo $this->textlink_edit[1]; ?>"/></a><?php endif; ?><?php if ($this->arrDeleteAllowed[$col['id']]): ?> <a href="<?php echo $col['link_delete']; ?>" onclick="if (!confirm('<?php echo $this->text_confirmDelete; ?>')) return false;" title="<?php echo $this->textlink_delete[1]; ?>"><img src="<?php echo $this->iconFolder; ?>/delete.gif" alt="<?php echo $this->textlink_delete[1]; ?>" title="<?php echo $this->textlink_delete[1]; ?>"/></a><?php endif; ?><?php if ($this->arrExportAllowed[$col['id']]): ?> <a href="<?php echo $col['link_export']; ?>" title="<?php echo $this->textlink_export[1]; ?>"><img src="<?php echo $this->iconFolder; ?>/exportCSV.gif" alt="<?php echo $this->textlink_export[1]; ?>" title="<?php echo $this->textlink_export[1]; ?>"/></a> <?php endif; ?></td><?php endif; ?>
</tr><?php endforeach; ?>
</tbody>
</table>
Mit den folgenden Änderungen in einer Kopie des Templates wird eine zusätzliche Spalte für die Dauer erzeugt, sowie die Dauer (vereinfacht) berechnet.
PHP-Code:
<table cellpadding="2" cellspacing="0" border="0" class="all_records" summary="">
<!-- indexer::stop -->
<thead>
<tr><?php foreach ($this->thead as $col): ?>
<th class="head<?php echo $col['class']; ?>"><a href="<?php echo $col['href']; ?>" title="<?php echo $col['title']; ?>"><?php echo $col['link']; ?></a></th>
<?php endforeach; ?>
<?php
// hier eine zusätzliche Spalte im Table-Header:
?>
<th class="head dauer">Dauer</td>
<?php if ($this->details || $this->editable || $this->deletable || $this->exportable): ?>
<th class="head col_last"> </th><?php endif; ?>
</tr>
</thead>
<!-- indexer::continue -->
<tbody><?php foreach ($this->tbody as $class=>$row): ?>
<tr class="<?php echo $class; ?>"><?php foreach ($row as $col): ?>
<td class="body <?php echo $col['class']; ?>"><?php if ($col['type']=='file' && $col['src']): ?><?php if ($col['display']=='image'): ?> <img src="<?php echo($this->getImage($col['src'], 80, null)); ?>" alt="<?php echo urldecode(basename($col['src'])); ?>" title="<?php echo urldecode(basename($col['src'])); ?>" /> <?php else: ?><img src="<?php echo $col['icon']; ?>" alt="<?php echo $col['linkTitle']; ?>" /> <a href="<?php echo $col['href']; ?>"><?php echo $col['linkTitle'] . $col['size']; ?></a>
<?php endif; ?>
<?php else: echo $col['content']; endif;?> </td><?php endforeach; ?>
<?php
// hier eine zusätzliche Spalte für die Dauer, wobei $row[6] und $row[5] anzupassen wären.
// $row[6] wäre die 5. Spalte der Auflistung
?>
<td class="body dauer"><?php echo number_format(($row[6]['raw'] - $row[5]['raw'])/3600, 2, ',', '.'); ?></td>
<?php if ($this->details || $this->editable || $this->deletable || $this->exportable): ?>
<td class="body <?php echo $this->col_last; ?> col_last"><?php if($this->details):?> <a href="<?php echo $col['link_details']; ?>" title="<?php echo $this->textlink_details[1]; ?>"><img src="<?php echo $this->iconFolder; ?>/details.gif" alt="<?php echo $this->textlink_details[1]; ?>" title="<?php echo $this->textlink_details[1]; ?>"/></a><?php endif; ?><?php if ($this->arrEditAllowed[$col['id']]): ?> <a href="<?php echo $col['link_edit']; ?>" title="<?php echo $this->textlink_edit[1]; ?>"><img src="<?php echo $this->iconFolder; ?>/edit.gif" alt="<?php echo $this->textlink_edit[1]; ?>" title="<?php echo $this->textlink_edit[1]; ?>"/></a><?php endif; ?><?php if ($this->arrDeleteAllowed[$col['id']]): ?> <a href="<?php echo $col['link_delete']; ?>" onclick="if (!confirm('<?php echo $this->text_confirmDelete; ?>')) return false;" title="<?php echo $this->textlink_delete[1]; ?>"><img src="<?php echo $this->iconFolder; ?>/delete.gif" alt="<?php echo $this->textlink_delete[1]; ?>" title="<?php echo $this->textlink_delete[1]; ?>"/></a><?php endif; ?><?php if ($this->arrExportAllowed[$col['id']]): ?> <a href="<?php echo $col['link_export']; ?>" title="<?php echo $this->textlink_export[1]; ?>"><img src="<?php echo $this->iconFolder; ?>/exportCSV.gif" alt="<?php echo $this->textlink_export[1]; ?>" title="<?php echo $this->textlink_export[1]; ?>"/></a> <?php endif; ?></td><?php endif; ?>
</tr><?php endforeach; ?>
</tbody>
</table>
Mit etwas PHP-Kenntnissen (?) sollte sich auch aus den berechneten Zeiten die Gesamtsumme addieren und in zusätzlicher Tabellenzeile ausgeben lassen.
Hoffe, das hilft als Ansatz weiter.
Schöne Grüße
Thomas
Lesezeichen