}
$GLOBALS['notification'] = Horde_Notification::singleton();
- $viewmode = isset($_SESSION['imp']['view'])
- ? $_SESSION['imp']['view']
- : 'imp';
+ $viewmode = self::getViewMode();
if ($viewmode == 'mimp') {
$GLOBALS['imp_notify'] = $GLOBALS['notification']->attach('status', null, 'Horde_Notification_Listener_Mobile');
}
/**
+ * Returns the current view mode for IMP.
+ *
+ * @return string Either 'dimp', 'imp', or 'mimp'.
+ */
+ static public function getViewMode()
+ {
+ return isset($_SESSION['imp']['view'])
+ ? $_SESSION['imp']['view']
+ : 'imp';
+ }
+
+ /**
* Returns the plain text label that is displayed for the current mailbox,
* replacing virtual search mailboxes with an appropriate description and
* removing namespace and mailbox prefix information from what is shown to
$args = self::composeLinkArgs($args, $extra);
if (is_null($view)) {
- /* Default to 'imp' if not currently logged-in. */
- $view = empty($_SESSION['imp']['view'])
- ? 'imp'
- : $_SESSION['imp']['view'];
+ $view = self::getViewMode();
}
if ($view == 'dimp') {