1: <?php
2: /**
3: * Copyright 2013-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 2013-2014 Horde LLC
10: * @license http://www.horde.org/licenses/gpl GPL
11: * @package IMP
12: */
13:
14: /**
15: * Abstract class definining an account source for the IMP folder tree.
16: *
17: * @author Michael Slusarz <slusarz@horde.org>
18: * @category Horde
19: * @copyright 2013-2014 Horde LLC
20: * @license http://www.horde.org/licenses/gpl GPL
21: * @package IMP
22: */
23: abstract class IMP_Ftree_Account implements Serializable
24: {
25: /* Mask constants for getList(). */
26: const INIT = 1;
27: const UNSUB = 2;
28:
29: /* Mask constants for delete(). */
30: const DELETE_ELEMENT = 1;
31: const DELETE_ELEMENT_QUICK = 2;
32: const DELETE_RECURSIVE = 4;
33:
34: /**
35: * Account ID.
36: *
37: * @var string
38: */
39: protected $_id;
40:
41: /**
42: * Constructor.
43: *
44: * @param string $id Account ID.
45: */
46: public function __construct($id = IMP_Ftree::BASE_ELT)
47: {
48: $this->_id = strval($id);
49: }
50:
51: /**
52: * @return string Account ID.
53: */
54: public function __toString()
55: {
56: return $this->_id;
57: }
58:
59: /**
60: * Return a list of mailbox to attribute pairs.
61: *
62: * @param array $query Array of search queries.
63: * @param mixed $mask Integer mask (INIT and UNSUB constants).
64: *
65: * @return array Array of elements to be added via
66: * IMP_Ftree#_insertElt().
67: */
68: abstract public function getList($query = array(), $mask = 0);
69:
70: /**
71: * Return the mailbox selction to delete.
72: *
73: * @param IMP_Ftree_Element $elt Element to delete.
74: *
75: * @return integer Mask of mailboxes to delete.
76: */
77: abstract public function delete(IMP_Ftree_Element $elt);
78:
79: /* Serializable methods. */
80:
81: /**
82: */
83: public function serialize()
84: {
85: return $this->_id;
86: }
87:
88: /**
89: */
90: public function unserialize($data)
91: {
92: $this->_id = $data;
93: }
94:
95: }
96: