[2] | 1 | <?php |
---|
| 2 | /**************************************************************************\ |
---|
| 3 | * phpGroupWare * |
---|
| 4 | * http://www.phpgroupware.org * |
---|
| 5 | * -------------------------------------------- * |
---|
| 6 | * This program is free software; you can redistribute it and/or modify it * |
---|
| 7 | * under the terms of the GNU General Public License as published by the * |
---|
| 8 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
| 9 | * option) any later version. * |
---|
| 10 | \**************************************************************************/ |
---|
| 11 | |
---|
| 12 | |
---|
| 13 | function parse_navbar($force = False) |
---|
| 14 | { |
---|
| 15 | $tpl = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR); |
---|
| 16 | $tpl->set_unknowns('remove'); |
---|
| 17 | |
---|
| 18 | $tpl->set_file( |
---|
| 19 | array( |
---|
| 20 | 'navbar' => 'navbar.tpl', |
---|
| 21 | 'navbar_app' => 'navbar_app.tpl' |
---|
| 22 | ) |
---|
| 23 | ); |
---|
| 24 | |
---|
| 25 | $var['navbar_color'] = $GLOBALS['phpgw_info']['theme']['navbar_bg']; |
---|
| 26 | |
---|
| 27 | if ($GLOBALS['phpgw_info']['flags']['navbar_target']) |
---|
| 28 | { |
---|
| 29 | $target = ' target="' . $GLOBALS['phpgw_info']['flags']['navbar_target'] . '"'; |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | $i = 1; |
---|
| 33 | foreach($GLOBALS['phpgw_info']['navbar'] as $app => $app_data) |
---|
| 34 | { |
---|
| 35 | if ($GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format'] == 'text') |
---|
| 36 | { |
---|
| 37 | $tabs[$i]['label'] = $app_data['title']; |
---|
| 38 | $tabs[$i]['link'] = $app_data['url']; |
---|
| 39 | if (!empty($app_data['target'])) |
---|
| 40 | { |
---|
| 41 | $tabs[$i]['target'] = $app_data['target']; |
---|
| 42 | } |
---|
| 43 | elseif (!empty($target)) |
---|
| 44 | { |
---|
| 45 | $tabs[$i]['target'] = $target; |
---|
| 46 | } |
---|
| 47 | if (ereg($GLOBALS['phpgw_info']['navbar'][$app],$_SERVER['PHP_SELF'])) |
---|
| 48 | { |
---|
| 49 | $selected = $i; |
---|
| 50 | } |
---|
| 51 | $i++; |
---|
| 52 | } |
---|
| 53 | else |
---|
| 54 | { |
---|
| 55 | $title = '<img src="' . $app_data['icon'] . '" alt="' . $app_data['title'] . '" title="' |
---|
| 56 | . $app_data['title'] . '" border="0">'; |
---|
| 57 | if ($GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format'] == 'icons_and_text') |
---|
| 58 | { |
---|
| 59 | $title .= "<br>" . $app_data['title']; |
---|
| 60 | $var['width'] = '7%'; |
---|
| 61 | } |
---|
| 62 | else |
---|
| 63 | { |
---|
| 64 | $var['width'] = '3%'; |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | $var['value'] = '<a href="' . $app_data['url'] . '"' . ($app_data['target'] ? $app_data['target'] : $target) . '>' . $title . '</a>'; |
---|
| 68 | $var['align'] = 'center'; |
---|
| 69 | $tpl->set_var($var); |
---|
| 70 | $tpl->parse('applications','navbar_app',True); |
---|
| 71 | } |
---|
| 72 | } |
---|
| 73 | if ($GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format'] == 'text') |
---|
| 74 | { |
---|
| 75 | $var['navbar_color'] = $GLOBALS['phpgw_info']['theme']['bg_color']; |
---|
| 76 | $var['align'] = 'right'; |
---|
| 77 | $var['value'] = $GLOBALS['phpgw']->common->create_tabs($tabs,$selected,-1); |
---|
| 78 | $tpl->set_var($var); |
---|
| 79 | $tpl->parse('applications','navbar_app',True); |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | if ($GLOBALS['phpgw_info']['server']['showpoweredbyon'] == 'top') |
---|
| 83 | { |
---|
| 84 | $var['powered_by'] = lang('Powered by phpGroupWare version %1',$GLOBALS['phpgw_info']['server']['versions']['phpgwapi']); |
---|
| 85 | } |
---|
| 86 | if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) |
---|
| 87 | { |
---|
| 88 | $var['current_users'] = '<a href="' . $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions') |
---|
| 89 | . '"> ' . lang('Current users') . ': ' . $GLOBALS['phpgw']->session->total() . '</a>'; |
---|
| 90 | } |
---|
| 91 | $now = time(); |
---|
| 92 | $var['user_info'] = $GLOBALS['phpgw']->common->display_fullname() . ' - ' |
---|
| 93 | . lang($GLOBALS['phpgw']->common->show_date($now,'l')) . ' ' |
---|
| 94 | . $GLOBALS['phpgw']->common->show_date($now,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']); |
---|
| 95 | // . lang($GLOBALS['phpgw']->common->show_date($now,'F')) . ' ' |
---|
| 96 | // . $GLOBALS['phpgw']->common->show_date($now,'d, Y'); |
---|
| 97 | |
---|
| 98 | // Maybe we should create a common function in the phpgw_accounts_shared.inc.php file |
---|
| 99 | // to get rid of duplicate code. |
---|
| 100 | if ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] == 0) |
---|
| 101 | { |
---|
| 102 | $api_messages = lang('You are required to change your password during your first login') |
---|
| 103 | . '<br> Click this image on the navbar: <img src="' |
---|
| 104 | . $GLOBALS['phpgw']->common->image('preferences','navbar.gif').'">'; |
---|
| 105 | } |
---|
| 106 | elseif ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - (86400*30)) |
---|
| 107 | { |
---|
| 108 | $api_messages = lang('it has been more then %1 days since you changed your password',30); |
---|
| 109 | } |
---|
| 110 | |
---|
| 111 | // This is gonna change |
---|
| 112 | if (isset($cd)) |
---|
| 113 | { |
---|
| 114 | $var['messages'] = $api_messages . '<br>' . checkcode($cd); |
---|
| 115 | } |
---|
| 116 | |
---|
| 117 | if (isset($GLOBALS['phpgw_info']['flags']['app_header'])) |
---|
| 118 | { |
---|
| 119 | $var['current_app_header'] = $GLOBALS['phpgw_info']['flags']['app_header']; |
---|
| 120 | $var['th_bg'] = $GLOBALS['phpgw_info']['theme']['th_bg']; |
---|
| 121 | } |
---|
| 122 | else |
---|
| 123 | { |
---|
| 124 | $tpl->set_block('navbar','app_header','app_header'); |
---|
| 125 | $var['app_header'] = ''; |
---|
| 126 | } |
---|
| 127 | |
---|
| 128 | $tpl->set_var($var); |
---|
| 129 | $tpl->pfp('out','navbar'); |
---|
| 130 | // If the application has a header include, we now include it |
---|
| 131 | if (!@$GLOBALS['phpgw_info']['flags']['noappheader'] && @isset($_GET['menuaction'])) |
---|
| 132 | { |
---|
| 133 | list($app,$class,$method) = explode('.',$_GET['menuaction']); |
---|
| 134 | if (is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions['header']) |
---|
| 135 | { |
---|
| 136 | $GLOBALS[$class]->header(); |
---|
| 137 | } |
---|
| 138 | } |
---|
| 139 | $GLOBALS['phpgw']->hooks->process('after_navbar'); |
---|
| 140 | return; |
---|
| 141 | } |
---|
| 142 | |
---|
| 143 | function parse_navbar_end() |
---|
| 144 | { |
---|
| 145 | if ($GLOBALS['phpgw_info']['server']['showpoweredbyon'] == 'bottom') |
---|
| 146 | { |
---|
| 147 | $tpl = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR); |
---|
| 148 | $tpl->set_unknowns('remove'); |
---|
| 149 | |
---|
| 150 | $tpl->set_file( |
---|
| 151 | array( |
---|
| 152 | 'footer' => 'footer.tpl' |
---|
| 153 | ) |
---|
| 154 | ); |
---|
| 155 | $var = Array( |
---|
| 156 | 'table_bg_color' => $GLOBALS['phpgw_info']['theme']['navbar_bg'], |
---|
| 157 | ); |
---|
| 158 | $var['powered_by'] = lang('Powered by phpGroupWare version %1',$GLOBALS['phpgw_info']['server']['versions']['phpgwapi']); |
---|
| 159 | if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) |
---|
| 160 | { |
---|
| 161 | $var['current_users'] = '<a href="' . $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions') |
---|
| 162 | . '"> ' . lang('Current users') . ': ' . $GLOBALS['phpgw']->session->total() . '</a>'; |
---|
| 163 | } |
---|
| 164 | $now = time(); |
---|
| 165 | $var['user_info'] = $GLOBALS['phpgw']->common->display_fullname() . ' - ' |
---|
| 166 | . lang($GLOBALS['phpgw']->common->show_date($now,'l')) . ' ' |
---|
| 167 | . $GLOBALS['phpgw']->common->show_date($now,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']); |
---|
| 168 | $tpl->set_var($var); |
---|
| 169 | $GLOBALS['phpgw']->hooks->process('navbar_end'); |
---|
| 170 | $tpl->pfp('out','footer'); |
---|
| 171 | } |
---|
| 172 | } |
---|