Overview

Packages

  • History

Classes

  • Horde_History
  • Horde_History_Exception
  • Horde_History_Log
  • Horde_History_Mock
  • Horde_History_Sql
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Class for presenting Horde_History information.
 4:  *
 5:  * Copyright 2003-2012 Horde LLC (http://www.horde.org/)
 6:  *
 7:  * See the enclosed file COPYING for license information (LGPL). If you
 8:  * did not receive this file, see http://www.horde.org/licenses/lgpl21.
 9:  *
10:  * @author  Chuck Hagenbuch <chuck@horde.org>
11:  * @author  Jan Schneider <jan@horde.org>
12:  * @package History
13:  */
14: class Horde_History_Log implements IteratorAggregate, ArrayAccess, Countable
15: {
16:     /**
17:      * TODO
18:      */
19:     public $uid;
20: 
21:     /**
22:      * TODO
23:      */
24:     protected $_data = array();
25: 
26:     /**
27:      * Constructor.
28:      *
29:      * TODO
30:      */
31:     public function __construct($uid, $data = array())
32:     {
33:         $this->uid = $uid;
34: 
35:         if (!$data) {
36:             return;
37:         }
38: 
39:         reset($data);
40:         while (list(,$row) = each($data)) {
41:             $history = array(
42:                 'action' => $row['history_action'],
43:                 'desc' => $row['history_desc'],
44:                 'who' => $row['history_who'],
45:                 'id' => $row['history_id'],
46:                 'ts' => $row['history_ts']
47:             );
48: 
49:             if ($row['history_extra']) {
50:                 $extra = @unserialize($row['history_extra']);
51:                 if ($extra) {
52:                     $history = array_merge($history, $extra);
53:                 }
54:             }
55:             $this->_data[] = $history;
56:         }
57:     }
58: 
59:     public function getIterator()
60:     {
61:         return new ArrayIterator($this->_data);
62:     }
63: 
64:     public function offsetExists($offset)
65:     {
66:         return isset($this->_data[$offset]);
67:     }
68: 
69:     public function offsetGet($offset)
70:     {
71:         return $this->_data[$offset];
72:     }
73: 
74:     public function offsetSet($offset, $value)
75:     {
76:         $this->_data[$offset] = $value;
77:     }
78: 
79:     public function offsetUnset($offset)
80:     {
81:         unset($this->_data[$offset]);
82:     }
83: 
84:     public function count()
85:     {
86:         return count($this->_data);
87:     }
88: }
89: 
API documentation generated by ApiGen