1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
12: class Hermes_Data_Hermescsv extends Horde_Data_Csv
13: {
14: public function exportData(
15: $data, $header = true, $export_mapping = array())
16: {
17: return parent::exportData($this->_map($data), $header, $export_mapping);
18: }
19:
20: protected function _map($data)
21: {
22: $count = count($data);
23: for ($i = 0; $i < $count; $i++) {
24: $data[$i] = $data[$i]->toArray();
25: $data[$i]['description'] = str_replace(array("\r", "\n"), array('', ' '), $data[$i]['description']);
26: $data[$i]['note'] = str_replace(array("\r", "\n"), array('', ' '), $data[$i]['note']);
27: $data[$i]['timestamp'] = $data[$i]['date'];
28: $data[$i]['date'] = date('m/d/y', $data[$i]['date']);
29: $data[$i]['duration'] = date('H:i', mktime(0, $data[$i]['hours'] * 60));
30: $data[$i]['billable'] = $data[$i]['billable'] == 2 ? '' : $data[$i]['billable'];
31: }
32:
33: return $data;
34: }
35:
36: }
37: