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