/**
  * Get navbar as array to eg. set as vars for a template (from idots' navbar.inc.php)
  *
  * Reimplemented so set the vars for the navbar itself (uses $this->tpl and the blocks a and b)
  *
  * @internal PHP5 protected
  * @param array $apps navbar apps from _get_navbar_apps
  * @return array
  */
 function _get_navbar($apps)
 {
     $var = parent::_get_navbar($apps);
     if ($GLOBALS['egw_info']['user']['preferences']['common']['click_or_onmouseover'] == 'onmouseover') {
         $var['show_menu_event'] = 'onMouseOver';
     } else {
         $var['show_menu_event'] = 'onClick';
     }
     if ($GLOBALS['egw_info']['user']['userid'] == 'anonymous') {
         $config_reg = config::read('registration');
         $this->tpl->set_var(array('url' => $GLOBALS['egw']->link('/logout.php'), 'title' => lang('Login')));
         $this->tpl->fp('upper_tabs', 'upper_tab_block');
         if ($config_reg[enable_registration] == 'True' && $config_reg[register_link] == 'True') {
             $this->tpl->set_var(array('url' => $GLOBALS['egw']->link('/registration/index.php'), 'title' => lang('Register')));
         }
     }
     if (!($max_icons = $GLOBALS['egw_info']['user']['preferences']['common']['max_icons'])) {
         $max_icons = 30;
     }
     if ($GLOBALS['egw_info']['user']['preferences']['common']['start_and_logout_icons'] == 'no') {
         $tdwidth = 100 / $max_icons;
     } else {
         $tdwidth = 100 / ($max_icons + 1);
         // +1 for logout
     }
     $this->tpl->set_var('tdwidth', round($tdwidth));
     // not shown in the navbar
     foreach ($apps as $app => $app_data) {
         if ($app != 'preferences' && $app != 'about' && $app != 'logout' && $app != 'manual' && ($app != 'home' || $GLOBALS['egw_info']['user']['preferences']['common']['start_and_logout_icons'] != 'no')) {
             $this->tpl->set_var($app_data);
             if ($i < $max_icons) {
                 $this->tpl->set_var($app_data);
                 if ($GLOBALS['egw_info']['user']['preferences']['common']['navbar_format'] != 'text') {
                     $this->tpl->fp('app_icons', 'app_icon_block', true);
                 }
                 if ($GLOBALS['egw_info']['user']['preferences']['common']['navbar_format'] != 'icons') {
                     $this->tpl->fp('app_titles', 'app_title_block', true);
                 }
             } else {
                 $this->tpl->fp('app_extra_icons', 'app_extra_block', true);
             }
             $i++;
         }
     }
     // settings for the extra icons dif
     if ($i <= $max_icons) {
         $this->tpl->set_var('app_extra_icons_div', '');
         $this->tpl->set_var('app_extra_icons_icon', '');
     } else {
         $var['lang_close'] = lang('Close');
         $var['lang_show_more_apps'] = lang('show_more_apps');
     }
     if ($GLOBALS['egw_info']['user']['preferences']['common']['start_and_logout_icons'] != 'no' && $GLOBALS['egw_info']['user']['userid'] != 'anonymous') {
         $this->tpl->set_var($apps['logout']);
         if ($GLOBALS['egw_info']['user']['preferences']['common']['navbar_format'] != 'text') {
             $this->tpl->fp('app_icons', 'app_icon_block', true);
         }
         if ($GLOBALS['egw_info']['user']['preferences']['common']['navbar_format'] != 'icons') {
             $this->tpl->fp('app_titles', 'app_title_block', true);
         }
     }
     if ($GLOBALS['egw_info']['user']['preferences']['common']['navbar_format'] == 'icons') {
         $var['app_titles'] = '<td colspan="' . $max_icons . '">&nbsp;</td>';
     }
     return $var;
 }
$tpl_info = EGW_SERVER_ROOT . '/phpgwapi/templates/' . basename($GLOBALS['egw_info']['user']['preferences']['common']['template_set']) . '/setup/setup.inc.php';
if (@file_exists($tpl_info)) {
    include_once $tpl_info;
    //	   if(isset($template_info))
    //	   {
    if ($GLOBALS['egw_info']['template'][$GLOBALS['egw_info']['user']['preferences']['common']['template_set']]['windowed']) {
        $windowed = true;
    }
    //	   }
}
if ($app == 'home' && !$api_requested && !$windowed) {
    if ($GLOBALS['egw_info']['server']['force_default_app'] && $GLOBALS['egw_info']['server']['force_default_app'] != 'user_choice') {
        $GLOBALS['egw_info']['user']['preferences']['common']['default_app'] = $GLOBALS['egw_info']['server']['force_default_app'];
    }
    if ($GLOBALS['egw_info']['user']['preferences']['common']['default_app'] && !$hasupdates) {
        $GLOBALS['egw']->redirect(egw_framework::index($GLOBALS['egw_info']['user']['preferences']['common']['default_app']));
    } else {
        $GLOBALS['egw']->redirect_link('/home/index.php');
    }
}
if ($windowed && $_GET['cd'] == 'yes') {
    $GLOBALS['egw_info']['flags'] = array('noheader' => False, 'nonavbar' => False, 'currentapp' => 'eGroupWare');
    $GLOBALS['egw']->common->egw_header();
    $GLOBALS['egw']->common->egw_footer();
} else {
    if ($api_requested) {
        $app = 'phpgwapi';
    }
    $obj = CreateObject($app . '.' . $class);
    if (is_array($obj->public_functions) && $obj->public_functions[$method] && !$invalid_data) {
        $obj->{$method}();