1<?php
2/**
3 * Copyright 2010-2017 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 2010-2017 Horde LLC
10 * @license   http://www.horde.org/licenses/gpl GPL
11 * @package   IMP
12 */
13
14/**
15 * Data structure for storing the virtual trash.
16 *
17 * @author    Michael Slusarz <slusarz@horde.org>
18 * @category  Horde
19 * @copyright 2010-2017 Horde LLC
20 * @license   http://www.horde.org/licenses/gpl GPL
21 * @package   IMP
22 */
23class IMP_Search_Vfolder_Vtrash extends IMP_Search_Vfolder_Builtin
24{
25    /**
26     * Display this virtual folder in the preferences screen?
27     *
28     * @var boolean
29     */
30    public $prefDisplay = false;
31
32    /**
33     * Initialization tasks.
34     */
35    protected function _init()
36    {
37        $this->_id = 'vtrash';
38        $this->_label = _("Virtual Trash");
39
40        $this->add(new IMP_Search_Element_Flag(
41            Horde_Imap_Client::FLAG_DELETED,
42            true
43        ));
44    }
45
46    /**
47     * Get object properties.
48     * Only create mailbox list on demand.
49     *
50     * @see __get()
51     */
52    public function __get($name)
53    {
54        global $injector;
55
56        switch ($name) {
57        case 'mboxes':
58            $iterator = new IMP_Ftree_IteratorFilter(
59                $injector->getInstance('IMP_Ftree')
60            );
61            $iterator->add(array(
62                $iterator::CONTAINERS,
63                $iterator::NONIMAP
64            ));
65
66            return array_map('strval', iterator_to_array($iterator, false));
67        }
68
69        return parent::__get($name);
70    }
71
72}
73