Ejemplo n.º 1
0
 /**
  * Output the menu.
  *
  * @param string $page  The current page ('compose', 'folders', 'mailbox',
  *                                        'message', 'search').
  * @param array $items  Additional menu items to add to the menu. First
  *                      element is label, second is URL to link to.
  *
  * @return string  The menu.
  */
 public function getMenu($page, $items = array())
 {
     if (!in_array($page, array('mailbox', 'message')) || !$this->indices->mailbox->inbox) {
         $items[] = array(_("Inbox"), IMP_Minimal_Mailbox::url(array('mailbox' => 'INBOX')));
     }
     if (!in_array($page, array('compose', 'search')) && IMP_Compose::canCompose()) {
         $items[] = array(_("New Message"), IMP_Minimal_Compose::url());
     }
     if (!in_array($page, array('folders', 'search')) && $GLOBALS['injector']->getInstance('IMP_Factory_Imap')->create()->access(IMP_Imap::ACCESS_FOLDERS)) {
         $items[] = array(_("Folders"), IMP_Minimal_Folders::url());
     }
     $items[] = array(_("Log out"), $GLOBALS['registry']->getServiceLink('logout', 'imp')->setRaw(false));
     $menu = new Horde_Menu();
     foreach ($menu->getSiteLinks() as $menuitem) {
         if ($menuitem != 'separator') {
             $items[] = array($menuitem['text'], $menuitem['url']);
         }
     }
     return $items;
 }
Ejemplo n.º 2
0
 /**
  * Returns the initial page for IMP.
  *
  * @return object  Object with the following properties:
  * <pre>
  *   - mbox (IMP_Mailbox)
  *   - url (Horde_Url)
  * </pre>
  */
 public static function getInitialPage()
 {
     global $injector, $prefs, $registry;
     $init_url = $prefs->getValue('initial_page');
     if (!$init_url || !$injector->getInstance('IMP_Factory_Imap')->create()->access(IMP_Imap::ACCESS_FOLDERS)) {
         $init_url = 'INBOX';
     }
     if ($init_url == IMP::INITIAL_FOLDERS) {
         $mbox = null;
     } else {
         $mbox = IMP_Mailbox::get($init_url);
         if (!$mbox->exists) {
             $mbox = IMP_Mailbox::get('INBOX');
         }
     }
     $result = new stdClass();
     $result->mbox = $mbox;
     switch ($registry->getView()) {
         case Horde_Registry::VIEW_BASIC:
             $result->url = is_null($mbox) ? IMP_Basic_Folders::url() : $mbox->url('mailbox');
             break;
         case Horde_Registry::VIEW_DYNAMIC:
             $result->url = IMP_Dynamic_Mailbox::url(array('mailbox' => is_null($mbox) ? 'INBOX' : $mbox));
             break;
         case Horde_Registry::VIEW_MINIMAL:
             $result->url = is_null($mbox) ? IMP_Minimal_Folders::url() : IMP_Minimal_Mailbox::url(array('mailbox' => $mbox));
             break;
         case Horde_Registry::VIEW_SMARTMOBILE:
             $result->url = is_null($mbox) ? Horde::url('smartmobile.php', true) : $mbox->url('mailbox');
             break;
     }
     return $result;
 }
Ejemplo n.º 3
0
 /**
  * Generate a link URL tag.
  *
  * @param string $node_id  The node ID.
  *
  * @return string  The link tag.
  */
 protected function _generateUrlTag($node_id)
 {
     return IMP_Minimal_Folders::url()->add(Horde_Tree::TOGGLE . $this->_tree->instance, $node_id)->link();
 }