Overview

Packages

  • Hermes
  • Horde
    • Data
  • Kronolith
  • None

Classes

  • Hermes_Data_Hermescsv
  • Hermes_Data_Hermestsv
  • Hermes_Data_Hermesxls
  • Hermes_Data_Iif
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * The Horde_Data_hermes_tsv class extends Horde's TSV Data class with
 4:  * Hermes-specific handling.
 5:  *
 6:  * See the enclosed file LICENSE for license information (BSD). If you
 7:  * did not receive this file, see http://www.horde.org/licenses/bsdl.php.
 8:  *
 9:  * @author Chuck Hagenbuch <chuck@horde.org>
10:  * @package Horde_Data
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: 
API documentation generated by ApiGen