Beispiel #1
0
/**
 * 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')) . '">&nbsp;' . 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;
}
Beispiel #2
0
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');
}