/** * @param boolean $static Ignored in this driver. */ public function getTree($static = false) { global $injector; $this->_nodes = $this->_tree->getNodes(); $filter = $injector->createInstance('Horde_Text_Filter'); $view = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/flist')); $view->addHelper('FormTag'); $view->addHelper('Tag'); $view->optgroup = $this->getOption('optgroup'); /* Custom HTML. */ if ($customhtml = $this->getOption('customhtml')) { $view->customhtml = $customhtml; } /* Heading. */ if (($heading = $this->getOption('heading')) && strlen($heading) > 0) { $view->heading = $heading; } /* New mailbox entry. */ if ($this->getOption('new_mbox')) { $imp_imap = $injector->getInstance('IMP_Factory_Imap')->create(); if ($imp_imap->access(IMP_Imap::ACCESS_CREATEMBOX) && $imp_imap->access(IMP_Imap::ACCESS_CREATEMBOX_MAX)) { $view->new_mbox = true; } } /* Virtual folders. */ if ($this->getOption('inc_vfolder')) { $iterator = IMP_Search_IteratorFilter::create(IMP_Search_IteratorFilter::VFOLDER); $vfolder_list = array(); foreach ($iterator as $val) { $form_to = IMP_Mailbox::formTo($val); $vfolder_list[] = array('l' => $filter->filter($val->label, 'space2html', array('encode' => true)), 'sel' => !empty($this->_nodes[$form_to]['selected']), 'v' => $form_to); } if (!empty($vfolder_list)) { $view->vfolder = $vfolder_list; } } /* Add the list of editable tasklists to the list. */ if ($this->getOption('inc_tasklists')) { $tasklist = new IMP_Indices_Copy_Tasklist(); $view->tasklist = array(); foreach ($tasklist->getTasklists() as $key => $val) { $view->tasklist[] = array('l' => $filter->filter($val->get('name'), 'space2html', array('encode' => true)), 'v' => $key); } } /* Add the list of editable notepads to the list. */ if ($this->getOption('inc_notepads')) { $notepad = new IMP_Indices_Copy_Notepad(); $view->notepad = array(); foreach ($notepad->getNotepads() as $key => $val) { $view->notepad[] = array('l' => $filter->filter($val->get('name'), 'space2html', array('encode' => true)), 'v' => $key); } } /* Prepare filter list. */ $this->_filter = ($filter = $this->getOption('filter')) ? array_flip($filter) : array(); $tree = ''; foreach ($this->_tree->getRootNodes() as $node_id) { $tree .= $this->_buildTree($node_id); } $view->tree = $tree; return $view->render('flist'); }