/** * Parse navigation bar * * @param boolean $force */ function parse_navbar($force = False) { // we hack the template root here as this is the template set of last resort $tpl = CreateObject('phpgwapi.Template', dirname(__FILE__), "remove"); $tpl->set_file('navbar', 'navbar.tpl'); $tpl->set_block('navbar', 'app', 'apps'); $navbar = execMethod('phpgwapi.menu.get', 'navbar'); prepare_navbar($navbar); foreach ($navbar as $app => $app_data) { if ($app == 'logout') { if (isset($GLOBALS['phpgw_info']['user']['apps']['manual'])) { $tpl->set_var(array('url' => "javascript:openwindow('" . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'manual.uimanual.help', 'app' => $GLOBALS['phpgw_info']['flags']['currentapp'], 'section' => isset($GLOBALS['phpgw_info']['apps']['manual']['section']) ? $GLOBALS['phpgw_info']['apps']['manual']['section'] : '', 'referer' => phpgw::get_var('menuaction'))) . "','700','600')", 'text' => lang('help'), 'icon' => $GLOBALS['phpgw']->common->image('manual', 'navbar'))); } $tpl->parse('apps', 'app', true); } $tpl->set_var(array('url' => $app_data['url'], 'text' => $app_data['text'], 'icon' => $GLOBALS['phpgw']->common->image($app_data['image'][0], $app_data['image'][1]))); $tpl->parse('apps', 'app', true); } // Maybe we should create a common function in the phpgw_accounts_shared.inc.php file // to get rid of duplicate code. if (!isset($GLOBALS['phpgw_info']['user']['lastpasswd_change']) || $GLOBALS['phpgw_info']['user']['lastpasswd_change'] == 0) { $api_messages = lang('You are required to change your password during your first login') . '<br> Click this image on the navbar: <img src="' . $GLOBALS['phpgw']->common->image('preferences', 'navbar') . '">'; } else { if ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - 86400 * 30) { $api_messages = lang('it has been more then %1 days since you changed your password', 30); } } // This is gonna change if (isset($cd)) { $var['messages'] = "<div class=\"warn\">{$api_messages}<br>\n" . checkcode($cd) . "</div>\n"; } if (isset($GLOBALS['phpgw_info']['flags']['app_header'])) { $var['current_app_header'] = $GLOBALS['phpgw_info']['flags']['app_header']; } else { $tpl->set_block('navbar', 'app_header', 'app_header'); $var['app_header'] = ''; } $tpl->set_var($var); $tpl->pfp('out', 'navbar'); // If the application has a header include, we now include it if ((!isset($GLOBALS['phpgw_info']['flags']['noappheader']) || !$GLOBALS['phpgw_info']['flags']['noappheader']) && isset($_GET['menuaction'])) { list($app, $class, $method) = explode('.', $_GET['menuaction']); if (is_array($GLOBALS[$class]->public_functions) && isset($GLOBALS[$class]->public_functions['header'])) { $GLOBALS[$class]->header(); } } $GLOBALS['phpgw']->template->set_root(PHPGW_APP_TPL); $GLOBALS['phpgw']->hooks->process('after_navbar'); unset($GLOBALS['phpgw_info']['navbar']); }
/** * Parse navigation bar * * @param boolean $force * @ignore */ function parse_navbar($force = false) { $tpl = createobject('phpgwapi.Template', PHPGW_TEMPLATE_DIR); $tpl->set_unknowns('remove'); $tpl->set_file('navbar', 'navbar.tpl'); $tpl->set_block('navbar', 'app_row', 'app_rows'); $var['api_root'] = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/probusiness/'; /* * folder handling */ if ($GLOBALS['phpgw_info']['user']['apps']['folders']['enabled'] == true) { $mtree = createobject('folders.uifolders', ''); $var['switchlink'] = $mtree->get_switchlink(); $folderMode = $mtree->get_folderMode(); } if (false) { if ($GLOBALS['phpgw_info']['user']['apps']['folders']['enabled'] == true) { $var['navbarview'] = $mtree->get_iframe(); } } else { /* * application list */ $navbar = execMethod('phpgwapi.menu.get', 'navbar'); prepare_navbar($navbar); foreach ($navbar as $app => $app_data) { if ($app == 'logout') { if (isset($GLOBALS['phpgw_info']['user']['apps']['manual'])) { $tpl->set_var(array('url' => "javascript:openwindow('" . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'manual.uimanual.help', 'app' => $GLOBALS['phpgw_info']['flags']['currentapp'], 'section' => isset($GLOBALS['phpgw_info']['apps']['manual']['section']) ? $GLOBALS['phpgw_info']['apps']['manual']['section'] : '', 'referer' => phpgw::get_var('menuaction'))) . "','700','600')", 'text' => lang('help'), 'image' => $GLOBALS['phpgw']->common->image('manual', 'navbar'))); } $tpl->parse('app_rows', 'app_row', true); } if ($app == $GLOBALS['phpgw_info']['flags']['currentapp']) { $app_data['class'] = ' class="selectedNavLink"'; } $app_data['image'] = $GLOBALS['phpgw']->common->image($app_data['image'][0], $app_data['image'][1]); $tpl->set_var($app_data); $tpl->parse('app_rows', 'app_row', true); } } // get sidebox content and parse it as a menu // it's just a hack. You need to enable the folders module to get an ouput if ($GLOBALS['phpgw_info']['user']['apps']['folders']['enabled'] == true) { $GLOBALS['phpgw']->hooks->single('sidebox_menu', $GLOBALS['phpgw_info']['flags']['currentapp']); $var['sideboxcontent'] = parseMenu(); } if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && isset($GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) { $var['current_users'] = '<a href="' . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'admin.uicurrentsessions.list_sessions')) . '"> ' . lang('Current users') . ': ' . $GLOBALS['phpgw']->session->total() . '</a>'; } if ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] == 0) { $api_messages = lang('You are required to change your password during your first login') . '<br> Click this image on the navbar: <img src="' . $GLOBALS['phpgw']->common->image('preferences', 'navbar.gif') . '">'; } elseif ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - 86400 * 30) { $api_messages = lang('it has been more then %1 days since you changed your password', 30); } // This gonna change if (isset($cd)) { $var['messages'] = $api_messages . '<br>' . checkcode($cd); } if (isset($GLOBALS['phpgw_info']['flags']['app_header'])) { $var['current_app_header'] = $GLOBALS['phpgw_info']['flags']['app_header']; } $tpl->set_var($var); $tpl->pfp('out', 'navbar'); // If the application has a header include, we now include it if (!@$GLOBALS['phpgw_info']['flags']['noappheader'] && @isset($_GET['menuaction'])) { list($app, $class, $method) = explode('.', $_GET['menuaction']); if (is_array($GLOBALS[$class]->public_functions) && isset($GLOBALS[$class]->public_functions['header']) && $GLOBALS[$class]->public_functions['header']) { $GLOBALS[$class]->header(); } } $GLOBALS['phpgw']->hooks->process('after_navbar'); }
/** * Parse navigation var * * @param boolean $force * @ignore */ function parse_navbar($force = False) { $tpl = createobject('phpgwapi.Template', PHPGW_TEMPLATE_DIR); $tpl->set_file('navbartpl', 'navbar.tpl'); $tpl->set_block('navbartpl', 'preferences'); $tpl->set_block('navbartpl', 'navbar'); $var['img_root'] = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/verdilak/images'; $currentapp = $GLOBALS['phpgw_info']['flags']['currentapp']; $applications = ''; $exclude = array('home', 'preferences', 'about', 'logout'); $navbar = execMethod('phpgwapi.menu.get', 'navbar'); prepare_navbar($navbar); foreach ($navbar as $app => $app_data) { if (in_array($app, $exclude)) { continue; } if ($app == $currentapp) { $app_data['text'] = "[<b>{$app_data['text']}</b>]"; } $applications .= <<<HTML \t\t\t\t<br> \t\t\t\t<a href="{$app_data['url']}">{$app_data['text']}</a> HTML; /* $icon = $GLOBALS['phpgw']->common->image($app_data['image'][0], $app_data['image'][1]); $applications .= <<<HTML <br> <a href="{$app_data['url']}"> <img src="{$icon}" alt="{$app_data['text']}" title="{$app_data['text']}"> </a> HTML; */ } $menu_array = execMethod('phpgwapi.menu.get_local_menu', $currentapp); $var['app_menu'] = phpgwapi_menu::render_horisontal_menu($menu_array); $var['applications'] = $applications; $var['logo'] = 'logo.png'; $var['home_url'] = $GLOBALS['phpgw']->link('/home.php'); $var['home_text'] = lang('home'); $var['about_url'] = $GLOBALS['phpgw']->link('/about.php', array('appname' => $GLOBALS['phpgw_info']['flags']['currentapp'])); $var['about_text'] = lang('about'); $var['logout_url'] = $GLOBALS['phpgw']->link('/logout.php'); $var['logout_text'] = lang('logout'); if (isset($GLOBALS['phpgw_info']['user']['apps']['manual'])) { $var['help_url'] = "javascript:openwindow('" . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'manual.uimanual.help', 'app' => $GLOBALS['phpgw_info']['flags']['currentapp'], 'section' => isset($GLOBALS['phpgw_info']['apps']['manual']['section']) ? $GLOBALS['phpgw_info']['apps']['manual']['section'] : '', 'referer' => phpgw::get_var('menuaction'))) . "','700','600')"; $var['help_text'] = lang('help'); $var['help_icon'] = 'icon icon-help'; } if ($GLOBALS['phpgw']->acl->check('run', PHPGW_ACL_READ, 'preferences')) { $var['preferences_url'] = $GLOBALS['phpgw']->link('/preferences/index.php'); $var['preferences_text'] = lang('preferences'); } if ($GLOBALS['phpgw_info']['flags']['currentapp'] == 'home') { $var['welcome_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'welcome-red'); } else { $var['welcome_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'welcome-grey'); } if ($GLOBALS['phpgw_info']['flags']['currentapp'] == 'preferences') { $var['preferences_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'preferences-red'); } else { $var['preferences_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'preferences-grey'); } $var['logout_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'logout-grey'); $var['powered_by'] = lang('Powered by phpGroupWare version %1', $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']); if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && isset($GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers'])) { $var['current_users'] = '<a style="font-family: Geneva,Arial,Helvetica,sans-serif; font-size: 12pt;" href="' . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'admin.uicurrentsessions.list_sessions')) . '"> ' . lang('Current users') . ': ' . $GLOBALS['phpgw']->session->total() . '</a>'; } $now = time(); $var['user_info'] = $GLOBALS['phpgw']->common->display_fullname() . ' - ' . lang($GLOBALS['phpgw']->common->show_date($now, 'l')) . ' ' . $GLOBALS['phpgw']->common->show_date($now, $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']); // . lang($GLOBALS['phpgw']->common->show_date($now,'F')) . ' ' // . $GLOBALS['phpgw']->common->show_date($now,'d, Y'); // Maybe we should create a common function in the phpgw_accounts_shared.inc.php file // to get rid of duplicate code. if (!isset($GLOBALS['phpgw_info']['user']['lastpasswd_change']) || $GLOBALS['phpgw_info']['user']['lastpasswd_change'] == 0) { $api_messages = lang('You are required to change your password during your first login') . '<br> Click this image on the navbar: <img src="' . $GLOBALS['phpgw']->common->image('preferences', 'navbar.png') . '">'; } else { if ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - 86400 * 30) { $api_messages = lang('it has been more then %1 days since you changed your password', 30); } } // This is gonna change if (isset($cd)) { $var['messages'] = $api_messages . '<br>' . checkcode($cd); } if (isset($GLOBALS['phpgw_info']['flags']['app_header'])) { $var['current_app_header'] = $GLOBALS['phpgw_info']['flags']['app_header']; } else { $tpl->set_block('navbar', 'app_header', 'app_header'); $var['app_header'] = ''; } $tpl->set_var($var); // check if user is allowed to change his prefs if (isset($GLOBALS['phpgw_info']['user']['apps']['preferences']) && $GLOBALS['phpgw_info']['user']['apps']['preferences']) { $tpl->parse('preferences_icon', 'preferences'); } else { $tpl->set_var('preferences_icon', ''); } $tpl->pfp('out', 'navbar'); // If the application has a header include, we now include it $menuaction = phpgw::get_var('menuaction', 'string', 'GET'); if (!isset($GLOBALS['phpgw_info']['flags']['noappheader']) && $menuaction) { list($app, $class, $method) = explode('.', $menuaction); if (is_array($GLOBALS[$class]->public_functions) && isset($GLOBALS[$class]->public_functions['header'])) { $GLOBALS[$class]->header(); } } $GLOBALS['phpgw']->hooks->process('after_navbar'); return; }
/** * Parse navigation var * * @param boolean $force * @ignore */ function parse_navbar($force = False) { $tpl = CreateObject('phpgwapi.Template', PHPGW_TEMPLATE_DIR, 'remove'); $tpl->set_file('navbar', 'navbar.tpl'); $tpl->set_block('navbar', 'app', 'apps'); $tpl->set_block('navbar', 'preferences', 'preferences_icon'); $exclude = array('home', 'preferences', 'about', 'logout'); $navbar = execMethod('phpgwapi.menu.get', 'navbar'); prepare_navbar($navbar); foreach ($navbar as $app => $app_data) { if (in_array($app, $exclude)) { continue; } $tpl->set_var(array('text' => strtoupper($app_data['text']), 'url' => $app_data['url'])); $tpl->parse('apps', 'app', true); } $var['home_link'] = $navbar['home']['url']; $var['preferences_link'] = $navbar['preferences']['url']; $var['logout_link'] = $navbar['logout']['url']; $var['help_link'] = $navbar['about']['url']; if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'home') { $var['welcome_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'welcome2'); $var['welcome_img_hover'] = $GLOBALS['phpgw']->common->image_on('phpgwapi', 'welcome2', '_over'); } else { $var['welcome_img'] = $GLOBALS['phpgw']->common->image_on('phpgwapi', 'welcome2', '_over'); $var['welcome_img_hover'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'welcome2'); } if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'preferences') { $var['preferences_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'preferences2'); $var['preferences_img_hover'] = $GLOBALS['phpgw']->common->image_on('phpgwapi', 'preferences2', '_over'); } else { $var['preferences_img'] = $GLOBALS['phpgw']->common->image_on('phpgwapi', 'preferences2', '_over'); $var['preferences_img_hover'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'preferences2'); } $var['logout_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'log_out2'); $var['logout_img_hover'] = $GLOBALS['phpgw']->common->image_on('phpgwapi', 'log_out2', '_over'); if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'about') { $var['about_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'question_mark2'); $var['about_img_hover'] = $GLOBALS['phpgw']->common->image_on('phpgwapi', 'question_mark2', '_over'); } else { $var['about_img'] = $GLOBALS['phpgw']->common->image_on('phpgwapi', 'question_mark2', '_over'); $var['about_img_hover'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'question_mark2'); } $var['content_spacer_middle_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'content_spacer_middle'); $var['em_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'em'); $var['logo_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'logo'); $var['top_spacer_middle_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'top_spacer_middle'); $var['nav_bar_left_spacer_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'nav_bar_left_spacer'); $var['nav_bar_left_top_bg_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'nav_bar_left_top_bg'); // "powered_by_color" and "_size" are is also used by number of current users thing $var['powered_by_size'] = '2'; $var['powered_by_color'] = '#ffffff'; if ($GLOBALS['phpgw_info']['server']['showpoweredbyon'] == 'top') { $var['powered_by'] = lang('Powered by phpGroupWare version %1', $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']); $tpl->set_var($var); } else { $var['powered_by'] = ''; $tpl->set_var($var); } if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) { $var['current_users'] = '<a href="' . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'admin.uicurrentsessions.list_sessions')) . '"> ' . lang('Current users') . ': ' . $GLOBALS['phpgw']->session->total() . '</a>'; $tpl->set_var($var); } else { $var['current_users'] = ''; $tpl->set_var($var); } $var['user_info_name'] = $GLOBALS['phpgw']->common->display_fullname(); $now = time(); $var['user_info_date'] = lang($GLOBALS['phpgw']->common->show_date($now, 'l')) . ' ' . $GLOBALS['phpgw']->common->show_date($now, $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']); $var['user_info'] = $var['user_info_name'] . ' - ' . $var['user_info_date']; $var['user_info_size'] = '2'; $var['user_info_color'] = '#000000'; // Maybe we should create a common function in the phpgw_accounts_shared.inc.php file // to get rid of duplicate code. if ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] == 0) { $api_messages = lang('You are required to change your password during your first login') . '<br> Click this image on the navbar: <img src="' . $GLOBALS['phpgw']->common->image('preferences', 'navbar.gif') . '">'; } elseif ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - 86400 * 30) { $api_messages = lang('it has been more then %1 days since you changed your password', 30); } // This is gonna change if (isset($cd)) { $var['messages'] = $api_messages . '<br>' . checkcode($cd); } $var['th_bg'] = $GLOBALS['phpgw_info']['theme']['th_bg']; if (isset($GLOBALS['phpgw_info']['flags']['app_header'])) { $var['current_app_header'] = $GLOBALS['phpgw_info']['flags']['app_header']; } else { $tpl->set_block('navbar', 'app_header', 'app_header'); $var['app_header'] = '<br>'; } $tpl->set_var($var); // check if user is allowed to change his prefs if ($GLOBALS['phpgw_info']['user']['apps']['preferences']) { $tpl->parse('preferences_icon', 'preferences'); } else { $tpl->set_var('preferences_icon', ''); } $tpl->pfp('out', 'navbar'); // If the application has a header include, we now include it if (!isset($GLOBALS['phpgw_info']['flags']['noappheader']) && ($menuaction = phpgw::get_var('menuaction', 'string', 'GET'))) { list($app, $class, $method) = explode('.', $menuaction); if (is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions['header']) { $GLOBALS[$class]->header(); } } $GLOBALS['phpgw']->hooks->process('after_navbar'); return; }
function parse_navbar($force = False) { $navbar = array(); $navbar = execMethod('phpgwapi.menu.get', 'navbar'); $user = $GLOBALS['phpgw']->accounts->get($GLOBALS['phpgw_info']['user']['id']); $var = array('print_url' => strpos($_SERVER['REQUEST_URI'], '?') ? "{$_SERVER['REQUEST_URI']}&phpgw_return_as=noframes" : "{$_SERVER['REQUEST_URI']}?phpgw_return_as=noframes", 'print_text' => lang('print'), 'home_url' => $GLOBALS['phpgw']->link('/home.php'), 'home_text' => lang('home'), 'home_icon' => 'icon icon-home', 'about_url' => $GLOBALS['phpgw']->link('/about.php', array('app' => $GLOBALS['phpgw_info']['flags']['currentapp'])), 'about_text' => lang('about'), 'logout_url' => $GLOBALS['phpgw']->link('/logout.php'), 'logout_text' => lang('logout'), 'user_fullname' => $user->__toString()); if ($GLOBALS['phpgw']->acl->check('run', PHPGW_ACL_READ, 'preferences')) { $var['preferences_url'] = $GLOBALS['phpgw']->link('/preferences/index.php'); $var['preferences_text'] = lang('preferences'); } if (isset($GLOBALS['phpgw_info']['user']['apps']['manual'])) { $var['help_url'] = "javascript:openwindow('" . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'manual.uimanual.help', 'app' => $GLOBALS['phpgw_info']['flags']['currentapp'], 'section' => isset($GLOBALS['phpgw_info']['apps']['manual']['section']) ? $GLOBALS['phpgw_info']['apps']['manual']['section'] : '', 'referer' => phpgw::get_var('menuaction'))) . "','700','600')"; $var['help_text'] = lang('help'); $var['help_icon'] = 'icon icon-help'; } if (isset($GLOBALS['phpgw_info']['server']['support_address']) && $GLOBALS['phpgw_info']['server']['support_address']) { $var['support_url'] = "javascript:openwindow('" . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'manual.uisupport.send', 'app' => $GLOBALS['phpgw_info']['flags']['currentapp'])) . "','700','600')"; $var['support_text'] = lang('support'); $var['support_icon'] = 'icon icon-help'; } if (isset($GLOBALS['phpgw_info']['user']['apps']['admin'])) { $var['debug_url'] = "javascript:openwindow('" . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'property.uidebug_json.index', 'app' => $GLOBALS['phpgw_info']['flags']['currentapp'])) . "','','')"; $var['debug_text'] = lang('debug'); $var['debug_icon'] = 'icon icon-debug'; } $GLOBALS['phpgw']->template->set_root(PHPGW_TEMPLATE_DIR); $GLOBALS['phpgw']->template->set_file('navbar', 'navbar.tpl'); $flags =& $GLOBALS['phpgw_info']['flags']; $var['current_app_title'] = isset($flags['app_header']) ? $flags['app_header'] : lang($GLOBALS['phpgw_info']['flags']['currentapp']); $flags['menu_selection'] = isset($flags['menu_selection']) ? $flags['menu_selection'] : ''; // breadcrumbs $current_url = array('id' => $flags['menu_selection'], 'url' => phpgw::get_var('REQUEST_URI', 'string', 'SERVER'), 'name' => $var['current_app_title']); $breadcrumbs = phpgwapi_cache::session_get('phpgwapi', 'breadcrumbs'); $breadcrumbs = $breadcrumbs ? $breadcrumbs : array(); // first one if ($breadcrumbs[0]['id'] != $flags['menu_selection']) { array_unshift($breadcrumbs, $current_url); } if (count($breadcrumbs) >= 5) { array_pop($breadcrumbs); } phpgwapi_cache::session_set('phpgwapi', 'breadcrumbs', $breadcrumbs); $breadcrumbs = array_reverse($breadcrumbs); $navigation = array(); if (!isset($GLOBALS['phpgw_info']['user']['preferences']['property']['nonavbar']) || $GLOBALS['phpgw_info']['user']['preferences']['property']['nonavbar'] != 'yes') { prepare_navbar($navbar); } else { foreach ($navbar as &$app_tmp) { $app_tmp['text'] = ' ...'; } } if (isset($GLOBALS['phpgw_info']['user']['preferences']['common']['sidecontent']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['sidecontent'] == 'ajax_menu') { $exclude = array('logout', 'about', 'preferences'); $i = 1; foreach ($navbar as $app => $app_data) { if (in_array($app, $exclude)) { continue; } $applications[] = array('value' => array('id' => $i, 'app' => $app, 'label' => $app_data['text'], 'href' => str_replace('&', '&', $app_data['url'])), 'children' => array()); $mapping[$i] = array('id' => $i, 'name' => $app, 'expanded' => false, 'highlight' => $app == $currentapp ? true : false, 'is_leaf' => false); $i++; } $applications = json_encode($applications); $mapping = json_encode($mapping); $_menu_selection = str_replace('::', '|', $GLOBALS['phpgw_info']['flags']['menu_selection']); $var['treemenu'] = <<<HTML \t\t\t\t<div id="MenutreeDiv1"></div> \t\t\t\t<script type="text/javascript"> \t\t \t\t\tvar apps = {$applications}; \t\t\t\t\tvar mapping = {$mapping}; \t\t\t\t\tvar proxy_data = ['first_element_is_dummy']; \t\t\t\t\tvar menu_selection = '{$_menu_selection}'; \t\t\t\t</script> HTML; } else { // prepare_navbar($navbar); $navigation = execMethod('phpgwapi.menu.get', 'navigation'); $treemenu = ''; foreach ($navbar as $app => $app_data) { if (!in_array($app, array('logout', 'about', 'preferences'))) { $submenu = isset($navigation[$app]) ? render_submenu($app, $navigation[$app]) : ''; $treemenu .= render_item($app_data, "navbar::{$app}", $submenu); } } $var['treemenu'] = <<<HTML \t\t\t<ul id="navbar"> {$treemenu} \t\t\t</ul> HTML; } if (isset($GLOBALS['phpgw_info']['user']['preferences']['common']['sidecontent']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['sidecontent'] == 'jsmenu') { $var['treemenu'] .= <<<JS \t\t\t\t<script type="text/javascript"> \t\t\t\t\$(function() { \t\t\t\t\$("#navbar").menu(); \t\t\t}); \t\t\t</script> JS; } $GLOBALS['phpgw']->template->set_var($var); $GLOBALS['phpgw']->template->pfp('out', 'navbar'); if (phpgw::get_var('phpgw_return_as') != 'json' && ($global_message = phpgwapi_cache::system_get('phpgwapi', 'phpgw_global_message'))) { echo "<div class='msg_good'>"; echo nl2br($global_message); echo '</div>'; } if (phpgw::get_var('phpgw_return_as') != 'json' && $breadcrumbs && isset($GLOBALS['phpgw_info']['user']['preferences']['common']['show_breadcrumbs']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['show_breadcrumbs']) { $history_url = array(); foreach ($breadcrumbs as $breadcrumb) { $history_url[] = "<a href='{$breadcrumb['url']}'>{$breadcrumb['name']}</a>"; } $breadcrumbs = '<div class="breadcrumbs"><h4>' . implode(' >> ', $history_url) . '</h4></div>'; echo $breadcrumbs; } if (phpgw::get_var('phpgw_return_as') != 'json' && ($receipt = phpgwapi_cache::session_get('phpgwapi', 'phpgw_messages'))) { phpgwapi_cache::session_clear('phpgwapi', 'phpgw_messages'); $msgbox_data = $GLOBALS['phpgw']->common->msgbox_data($receipt); $msgbox_data = $GLOBALS['phpgw']->common->msgbox($msgbox_data); foreach ($msgbox_data as &$message) { echo "<div class='{$message['msgbox_class']}'>"; echo $message['msgbox_text']; echo '</div>'; } } $GLOBALS['phpgw']->hooks->process('after_navbar'); register_shutdown_function('parse_footer_end'); }
/** * Parse navigation bar * * @param boolean $force * @ignore */ function parse_navbar($force = false) { $GLOBALS['phpgw']->template->set_root(PHPGW_TEMPLATE_DIR); $GLOBALS['phpgw']->template->set_file('navbar', 'navbar.tpl'); $GLOBALS['phpgw']->template->set_block('navbar', 'navbar_item', 'navbar_items'); $GLOBALS['phpgw']->template->set_block('navbar', 'navbar_header', 'navbar_header'); $GLOBALS['phpgw']->template->set_block('navbar', 'extra_blocks_header', 'extra_block_header'); $GLOBALS['phpgw']->template->set_block('navbar', 'extra_blocks_menu', 'extra_blocks_menu'); $GLOBALS['phpgw']->template->set_block('navbar', 'extra_block_row', 'extra_block_row'); $GLOBALS['phpgw']->template->set_block('navbar', 'extra_blocks_footer', 'extra_blocks_footer'); $GLOBALS['phpgw']->template->set_block('navbar', 'navbar_footer', 'navbar_footer'); $var['img_root'] = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/idots/images'; $applications = ''; $items = 0; $navbar = execMethod('phpgwapi.menu.get', 'navbar'); prepare_navbar($navbar); $navigation = execMethod('phpgwapi.menu.get', 'navigation'); $sidecontent = 'sidebox'; if (isset($GLOBALS['phpgw_info']['user']['preferences']['common']['sidecontent']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['sidecontent']) { $sidecontent = $GLOBALS['phpgw_info']['user']['preferences']['common']['sidecontent']; } $excluded = array('home', 'preferences', 'about', 'logout'); foreach ($navbar as $app => $app_data) { if (!in_array($app, $excluded) || $sidecontent != 'sidebox' && $sidecontent != 'jsmenu') { $item = array('app_name' => '', 'alt_img_app' => lang($app), 'img_app' => "{$var['img_root']}/noimage_nav.png", 'url_app' => $app_data['url'], 'app_name' => $app_data['text'], 'img_app' => $GLOBALS['phpgw']->common->image($app_data['image'][0], $app_data['image'][1])); $GLOBALS['phpgw']->template->set_var($item); $GLOBALS['phpgw']->template->parse('navbar_items', 'navbar_item', true); } } if (isset($GLOBALS['phpgw_info']['flags']['app_header'])) { $var['current_app_title'] = $GLOBALS['phpgw_info']['flags']['app_header']; } else { $var['current_app_title'] = lang($GLOBALS['phpgw_info']['flags']['currentapp']); } if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && isset($GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) { $var['current_users'] = '<a href="' . $GLOBALS['phpgw']->link('/index.php', 'menuaction=admin.uicurrentsessions.list_sessions') . '">' . lang('Current users') . ': ' . $GLOBALS['phpgw']->session->total() . '</a>'; } $now = time(); $var['user_info'] = '<b>' . $GLOBALS['phpgw']->common->display_fullname() . '</b>' . ' - ' . lang($GLOBALS['phpgw']->common->show_date($now, 'l')) . ' ' . $GLOBALS['phpgw']->common->show_date($now, $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']); if (!isset($GLOBALS['phpgw_info']['user']['lastpasswd_change']) || $GLOBALS['phpgw_info']['user']['lastpasswd_change'] == 0) { $api_messages = lang('You are required to change your password during your first login') . '<br> Click this image on the navbar: <img src="' . $GLOBALS['phpgw']->common->image('preferences', 'navbar') . '">'; } else { if (isset($GLOBALS['phpgw_info']['user']['lastpasswd_change']) && $GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - 86400 * 30) { $api_messages = lang('it has been more then %1 days since you changed your password', 30); } } // This is gonna change if (isset($cd)) { $var['messages'] = $api_messages . '<br>' . checkcode($cd); } $var['content_class'] = $sidecontent == 'sidebox' || $sidecontent == 'jsmenu' ? 'content' : 'content_nosidebox'; $GLOBALS['phpgw']->template->set_var($var); $GLOBALS['phpgw']->template->pfp('out', 'navbar_header'); if ($sidecontent == 'sidebox' || $sidecontent == 'jsmenu') { $menu_title = lang('General Menu'); $menu['home'] = $navbar['home']; if (isset($navbar['preferences'])) { $menu['preferences'] = $navbar['preferences']; } $menu['about'] = array('text' => lang('About'), 'url' => $GLOBALS['phpgw']->link('/about.php', array('app' => $GLOBALS['phpgw_info']['flags']['currentapp']))); $menu['logout'] = $navbar['logout']; display_sidebox($menu_title, $menu); } if (isset($navigation[$GLOBALS['phpgw_info']['flags']['currentapp']]) && $GLOBALS['phpgw_info']['flags']['currentapp'] != 'admin' && $GLOBALS['phpgw_info']['flags']['currentapp'] != 'preferences') { $app = $GLOBALS['phpgw_info']['flags']['currentapp']; $GLOBALS['phpgw']->template->set_var('lang_title', $navbar[$app]['text']); $GLOBALS['phpgw']->template->pfp('out', 'extra_blocks_header'); $menu = createObject('phpgwapi.menu'); $app_menu = $menu->render_menu($app, $navigation[$app], $navbar[$app]); $GLOBALS['phpgw']->template->set_var(array('app_menu' => $app_menu)); $GLOBALS['phpgw']->template->pfp('out', 'extra_blocks_menu'); $GLOBALS['phpgw']->template->pfp('out', 'extra_blocks_footer'); } if (isset($navbar['preferences']) && $GLOBALS['phpgw_info']['flags']['currentapp'] != 'preferences') { $prefs = execMethod('phpgwapi.menu.get', 'preferences'); if (isset($prefs[$GLOBALS['phpgw_info']['flags']['currentapp']])) { // display_sidebox(lang('preferences'), $prefs[$GLOBALS['phpgw_info']['flags']['currentapp']]); } } if (isset($navigation['admin'][$GLOBALS['phpgw_info']['flags']['currentapp']]['children'])) { // display_sidebox(lang('administration'), $navigation['admin'][$GLOBALS['phpgw_info']['flags']['currentapp']]['children']); } $GLOBALS['phpgw']->template->pparse('out', 'navbar_footer'); // If the application has a header include, we now include it if ((!isset($GLOBALS['phpgw_info']['flags']['noappheader']) || !$GLOBALS['phpgw_info']['flags']['noappheader']) && isset($_GET['menuaction'])) { list($app, $class, $method) = explode('.', $_GET['menuaction']); if (is_array($GLOBALS[$class]->public_functions) && isset($GLOBALS[$class]->public_functions['header'])) { $GLOBALS[$class]->header(); } } $GLOBALS['phpgw']->template->set_root(PHPGW_APP_TPL); $GLOBALS['phpgw']->hooks->process('after_navbar'); }
/** * Parse navigation var * * @param boolean $force * @ignore */ function parse_navbar($force = False) { $tpl = CreateObject('phpgwapi.Template', PHPGW_TEMPLATE_DIR); $tpl->set_unknowns('remove'); $tpl->set_file(array('navbar' => 'navbar.tpl')); $tpl->set_block('navbar', 'preferences', 'preferences_icon'); $var['img_root'] = PHPGW_IMAGES_DIR; $var['img_root_roll'] = PHPGW_IMAGES_DIR . '/rollover'; $exclude = array('home', 'preferences', 'about', 'logout'); $navbar = execMethod('phpgwapi.menu.get', 'navbar'); prepare_navbar($navbar); foreach ($navbar as $app => $app_data) { if (in_array($app, $exclude)) { continue; } $img = $GLOBALS['phpgw']->common->image($app_data['image'][0], $app_data['image'][1]); $var['applications'] .= <<<HTML \t\t\t<tr> \t\t\t\t<td class="main_menu_apps"> \t\t\t\t\t<a class="main_menu" href="{$app_data['url']}">{$app_data['text']}></a> \t\t\t\t</td> \t\t\t</tr> HTML; /* TODO this should be implemented at some point - skwashd feb08 $tpl->set_var(array ( 'text' => strtoupper($app_data['text']), 'url' => $app_data['url'] 'img' => $GLOBALS['phpgw']->common->image($app_data['image'][0], $app_data['image'][1]) )); $tpl->parse('apps', 'app', true); */ } $var['home_link'] = $navbar['home']['url']; $var['preferences_link'] = $navbar['preferences']['url']; $var['logout_link'] = $navbar['logout']['url']; $var['help_link'] = $navbar['about']['url']; $var['lang_welcome'] = $navbar['home']['text']; $var['lang_preferences'] = $navbar['preferences']['text']; $var['lang_logout'] = $navbar['logout']['text']; $var['lang_help'] = $navbar['about']['text']; // "powered_by_color" and "_size" are is also used by number of current users thing $var['powered_by_size'] = '2'; $var['powered_by_color'] = '#ffffff'; if ($GLOBALS['phpgw_info']['server']['showpoweredbyon'] == 'top') { $var['powered_by'] = lang('Powered by phpGroupWare version %1', $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']); $tpl->set_var($var); } else { $var['powered_by'] = ''; $tpl->set_var($var); } $var['phpgw_version'] = lang("version") . ": " . $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']; $tpl->set_var($var); if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) { $var['current_users'] = '<a class="main_menu_bottom" href="' . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'admin.uicurrentsessions.list_sessions')) . '">' . lang('Current users') . ': ' . $GLOBALS['phpgw']->session->total() . '</a>'; $tpl->set_var($var); } else { $var['current_users'] = ''; $tpl->set_var($var); } $var['user_info_name'] = $GLOBALS['phpgw']->common->display_fullname(); $var['user_info_date'] = lang($GLOBALS['phpgw']->common->show_date(time(), 'l')) . ' ' . lang($GLOBALS['phpgw']->common->show_date(time(), 'F')) . ' ' . $GLOBALS['phpgw']->common->show_date(time(), 'd, Y'); $var['user_info'] = $var['user_info_name'] . ' - ' . $var['user_info_date']; $var['user_info_size'] = '2'; $var['user_info_color'] = '#000000'; // Maybe we should create a common function in the phpgw_accounts_shared.inc.php file // to get rid of duplicate code. if ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] == 0) { $api_messages = lang('You are required to change your password during your first login') . '<br> Click this image on the navbar: <img src="' . $GLOBALS['phpgw']->common->image('preferences', 'navbar.gif') . '">'; } elseif ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - 86400 * 30) { $api_messages = lang('it has been more then %1 days since you changed your password', 30); } // This is gonna change if (isset($cd)) { $var['messages'] = $api_messages . "<br>" . checkcode($cd); } if (isset($GLOBALS['phpgw_info']['flags']['app_header'])) { $var['current_app_header'] = $GLOBALS['phpgw_info']['flags']['app_header']; $var['th_bg'] = $GLOBALS['phpgw_info']['theme']['th_bg']; $var['message_top'] = '30px'; $var['app_top'] = '40px'; } else { $tpl->set_block('navbar', 'app_header', 'app_header'); $var['app_header'] = ''; $var['message_top'] = '0px'; $var['app_top'] = '15px'; } $tpl->set_var($var); // check if user is allowed to change his prefs if ($GLOBALS['phpgw_info']['user']['apps']['preferences']) { $tpl->parse('preferences_icon', 'preferences'); } else { $tpl->set_var('preferences_icon', ''); } $tpl->pfp('out', 'navbar'); // If the application has a header include, we now include it if (!@$GLOBALS['phpgw_info']['flags']['noappheader'] && @isset($GLOBALS['HTTP_GET_VARS']['menuaction'])) { list($app, $class, $method) = explode('.', $GLOBALS['HTTP_GET_VARS']['menuaction']); if (is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions['header']) { $GLOBALS[$class]->header(); } } $GLOBALS['phpgw']->hooks->process('after_navbar'); return; }
function parse_navbar($force = False) { $user = $GLOBALS['phpgw']->accounts->get($GLOBALS['phpgw_info']['user']['id']); /* $var = array ( 'home_url' => $GLOBALS['phpgw']->link('/home.php'), 'home_text' => lang('home'), 'home_icon' => 'icon icon-home', 'about_url' => $GLOBALS['phpgw']->link('/about.php', array('app' => $GLOBALS['phpgw_info']['flags']['currentapp']) ), 'about_text' => lang('about'), 'logout_url' => $GLOBALS['phpgw']->link('/logout.php'), 'logout_text' => lang('logout'), 'user_fullname' => $user->__toString() ); */ if (!isset($GLOBALS['phpgw_info']['flags']['nonavbar']) || !$GLOBALS['phpgw_info']['flags']['nonavbar']) { $currentapp = $GLOBALS['phpgw_info']['flags']['currentapp']; $applications = ''; $exclude = array('home', 'about', 'logout'); $navbar = execMethod('phpgwapi.menu.get', 'navbar'); prepare_navbar($navbar); foreach ($navbar as $app => $app_data) { if (in_array($app, $exclude)) { continue; } if ($app == $currentapp) { $app_data['text'] = "[<b>{$app_data['text']}</b>]"; } $applications .= <<<HTML \t\t\t\t\t<a href="{$app_data['url']}">{$app_data['text']}</a> HTML; } $var['applications'] = $applications; $menu_array = execMethod('phpgwapi.menu.get_local_menu', $currentapp); $var['app_menu'] = phpgwapi_menu::render_horisontal_menu($menu_array); } /* if ( $GLOBALS['phpgw']->acl->check('run', PHPGW_ACL_READ, 'preferences') ) { $var['preferences_url'] = $GLOBALS['phpgw']->link('/preferences/index.php'); $var['preferences_text'] = lang('preferences'); } if ( isset($GLOBALS['phpgw_info']['user']['apps']['manual']) ) { $var['help_url'] = "javascript:openwindow('" . $GLOBALS['phpgw']->link('/index.php', array ( 'menuaction'=> 'manual.uimanual.help', 'app' => $GLOBALS['phpgw_info']['flags']['currentapp'], 'section' => isset($GLOBALS['phpgw_info']['apps']['manual']['section']) ? $GLOBALS['phpgw_info']['apps']['manual']['section'] : '', 'referer' => phpgw::get_var('menuaction') )) . "','700','600')"; $var['help_text'] = lang('help'); $var['help_icon'] = 'icon icon-help'; } if ( isset($GLOBALS['phpgw_info']['user']['apps']['admin']) ) { $var['debug_url'] = "javascript:openwindow('" . $GLOBALS['phpgw']->link('/index.php', array ( 'menuaction'=> 'property.uidebug_json.index' )) . "','','')"; $var['debug_text'] = lang('debug'); $var['debug_icon'] = 'icon icon-debug'; } */ $GLOBALS['phpgw']->template->set_root(PHPGW_TEMPLATE_DIR); $GLOBALS['phpgw']->template->set_file('navbar', 'navbar.tpl'); $flags =& $GLOBALS['phpgw_info']['flags']; $var['current_app_title'] = isset($flags['app_header']) ? $flags['app_header'] : lang($GLOBALS['phpgw_info']['flags']['currentapp']); $flags['menu_selection'] = isset($flags['menu_selection']) ? $flags['menu_selection'] : ''; // $controller_url = $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'controller.uicontrol.control_list')); $controller_text = lang('controller'); $tts_url = $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'property.uitts.index')); $tts_text = lang('ticket'); // $GLOBALS['phpgw']->template->set_var($var); $GLOBALS['phpgw']->template->pfp('out', 'navbar'); register_shutdown_function('parse_footer_end'); }