1: <?php
2: /**
3: * Copyright 2012-2014 Horde LLC (http://www.horde.org/)
4: *
5: * See the enclosed file COPYING for license information (GPL). If you
6: * did not receive this file, see http://www.horde.org/licenses/gpl.
7: *
8: * @category Horde
9: * @copyright 2012-2014 Horde LLC
10: * @license http://www.horde.org/licenses/gpl GPL
11: * @package IMP
12: */
13:
14: /**
15: * This class represents thread information for a single message.
16: *
17: * @author Michael Slusarz <slusarz@horde.org>
18: * @category Horde
19: * @copyright 2012-2014 Horde LLC
20: * @license http://www.horde.org/licenses/gpl GPL
21: * @package IMP
22: *
23: * @property-read string $img An image HTML tag of the thread.
24: * @property-read string $raw The raw thread data.
25: * @property-read string $reverse_img An image HTML tag of the thread
26: * (reversed).
27: * @property-read string $reverse_raw The raw thread data (reversed).
28: */
29: class IMP_Mailbox_List_Thread
30: {
31: /* Thread level representations. */
32: const BLANK = 0;
33: const LINE = 1;
34: const JOIN = 2;
35: const JOINBOTTOM_DOWN = 3;
36: const JOINBOTTOM = 4;
37:
38: /**
39: * Thread information.
40: *
41: * @var string
42: */
43: protected $_data;
44:
45: /**
46: * Constructor.
47: *
48: * @param string $data The thread information.
49: */
50: public function __construct($data)
51: {
52: $this->_data = $data;
53: }
54:
55: /**
56: */
57: public function __get($name)
58: {
59: switch ($name) {
60: case 'reverse_img':
61: case 'reverse_raw':
62: $ret = strtr($this->_data, array(
63: self::JOINBOTTOM_DOWN => self::JOINBOTTOM,
64: self::JOINBOTTOM => self::JOINBOTTOM_DOWN
65: ));
66: break;
67:
68: default:
69: $ret = $this->_data;
70: break;
71: }
72:
73: switch ($name) {
74: case 'img':
75: case 'reverse_img':
76: $tmp = '';
77: if (strlen($ret)) {
78: foreach (str_split($ret) as $val) {
79: $tmp .= '<span class="horde-tree-image horde-tree-image-' . $val . '"></span>';
80: }
81: }
82: return $tmp;
83:
84: case 'raw':
85: case 'reverse_raw':
86: return $ret;
87: }
88: }
89:
90: }
91: