1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15: class IMP_Minimal_Folders extends IMP_Minimal_Base
16: {
17: 18: 19: 20:
21: protected function _init()
22: {
23: global $injector, $notification, $prefs, $session;
24:
25: $imp_imap = $injector->getInstance('IMP_Factory_Imap')->create();
26:
27:
28: if (!$imp_imap->access(IMP_Imap::ACCESS_FOLDERS)) {
29: $notification->push(_("The folder view is not enabled."), 'horde.error');
30: IMP_Minimal_Mailbox::url()->redirect();
31: }
32:
33:
34: $subscribe = $prefs->getValue('subscribe');
35: $showAll = (!$subscribe || $session->get('imp', 'showunsub'));
36:
37:
38: if ($subscribe && $this->vars->ts) {
39: $showAll = !$showAll;
40: $session->set('imp', 'showunsub', $showAll);
41: }
42:
43:
44: $ftree = $injector->getInstance('IMP_Ftree');
45: $iterator = new IMP_Ftree_IteratorFilter($ftree);
46: $iterator->add($iterator::REMOTE);
47: if ($showAll) {
48: $ftree->loadUnsubscribed();
49: $iterator->remove($iterator::UNSUB);
50: }
51: $tree = $ftree->createTree('mimp_folders', array(
52: 'iterator' => $iterator,
53: 'poll_info' => true,
54: 'render_type' => 'IMP_Tree_Simplehtml'
55: ));
56:
57: $selfurl = self::url();
58: $menu = array(array(_("Refresh"), $selfurl));
59: if ($subscribe) {
60: $menu[] = array(
61: ($showAll ? _("Show Subscribed Mailboxes") : _("Show All Mailboxes")),
62: $selfurl->copy()->add('ts', 1)
63: );
64: }
65:
66: $this->title = _("Folders");
67:
68: $this->view->menu = $this->getMenu('folders', $menu);
69: $this->view->title = $this->title;
70: $this->view->tree = $tree->getTree(true);
71:
72: $this->_pages[] = 'folders';
73: $this->_pages[] = 'menu';
74: }
75:
76: 77:
78: public static function url(array $opts = array())
79: {
80: return Horde::url('minimal.php')->add('page', 'folders');
81: }
82:
83: }
84: