1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
14: class Horde_History_Log implements IteratorAggregate, ArrayAccess, Countable
15: {
16: 17: 18:
19: public $uid;
20:
21: 22: 23:
24: protected $_data = array();
25:
26: 27: 28: 29: 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: