[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 | $GLOBALS['idots_tpl'] = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR); |
---|
| 16 | |
---|
| 17 | $GLOBALS['idots_tpl']->set_file( |
---|
| 18 | array( |
---|
| 19 | 'navbar' => 'navbar.tpl' |
---|
| 20 | ) |
---|
| 21 | ); |
---|
| 22 | |
---|
| 23 | $GLOBALS['idots_tpl']->set_block('navbar','navbar_header','navbar_header'); |
---|
| 24 | $GLOBALS['idots_tpl']->set_block('navbar','extra_blocks_header','extra_block_header'); |
---|
| 25 | $GLOBALS['idots_tpl']->set_block('navbar','extra_block_row','extra_block_row'); |
---|
| 26 | $GLOBALS['idots_tpl']->set_block('navbar','extra_block_spacer','extra_block_spacer'); |
---|
| 27 | $GLOBALS['idots_tpl']->set_block('navbar','extra_blocks_footer','extra_blocks_footer'); |
---|
| 28 | $GLOBALS['idots_tpl']->set_block('navbar','navbar_footer','navbar_footer'); |
---|
| 29 | |
---|
| 30 | $var['img_root'] = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/literati/images'; |
---|
| 31 | $var['table_bg_color'] = $GLOBALS['phpgw_info']['theme']['navbar_bg']; |
---|
| 32 | |
---|
| 33 | $applications = ''; |
---|
| 34 | // == 'icons_and_text') |
---|
| 35 | foreach($GLOBALS['phpgw_info']['navbar'] as $app => $app_data) |
---|
| 36 | { |
---|
| 37 | if ($app != 'home' && $app != 'preferences' && $app != 'about' && $app != 'logout') |
---|
| 38 | { |
---|
| 39 | $title = $GLOBALS['phpgw_info']['apps'][$app]['title']; |
---|
| 40 | |
---|
| 41 | $icon = '<img src="' . $app_data['icon'] . '" alt="' . $title |
---|
| 42 | . '" title="'. $title . '" border="0" height="60">'; |
---|
| 43 | |
---|
| 44 | $app_icons .= '<TD align="center"><a href="' . $app_data['url'] . '"'; |
---|
| 45 | if (isset($GLOBALS['phpgw_info']['flags']['navbar_target']) && |
---|
| 46 | $GLOBALS['phpgw_info']['flags']['navbar_target']) |
---|
| 47 | { |
---|
| 48 | $app_icons .= ' target="' . $GLOBALS['phpgw_info']['flags']['navbar_target'] . '"'; |
---|
| 49 | } |
---|
| 50 | $app_icons .= $app_data['target'] . '>' . $icon . '</a></TD>'; |
---|
| 51 | |
---|
| 52 | $app_titles .= '<TD align=center class="mainnote"><a href="'.$app_data['url'] . '"'; |
---|
| 53 | if (isset($GLOBALS['phpgw_info']['flags']['navbar_target']) && |
---|
| 54 | $GLOBALS['phpgw_info']['flags']['navbar_target']) |
---|
| 55 | { |
---|
| 56 | $app_titles .= ' target="' . $GLOBALS['phpgw_info']['flags']['navbar_target'] . '"'; |
---|
| 57 | } |
---|
| 58 | $app_titles .= $app_data['target'] . '>' . $title . '</a></TD>'; |
---|
| 59 | |
---|
| 60 | unset($icon); |
---|
| 61 | unset($title); |
---|
| 62 | } |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | $var['app_icons'] = $app_icons; |
---|
| 66 | if($GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format']!='icons') |
---|
| 67 | { |
---|
| 68 | $var['app_titles'] = $app_titles; |
---|
| 69 | } |
---|
| 70 | if (isset($GLOBALS['phpgw_info']['flags']['app_header'])) |
---|
| 71 | { |
---|
| 72 | $var['current_app_title'] = $GLOBALS['phpgw_info']['flags']['app_header']; |
---|
| 73 | } |
---|
| 74 | else |
---|
| 75 | { |
---|
| 76 | $var['current_app_title']=$GLOBALS['phpgw_info']['navbar'][$GLOBALS['phpgw_info']['flags']['currentapp']]['title']; |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) |
---|
| 80 | { |
---|
| 81 | $var['current_users'] = '<a href="' |
---|
| 82 | . $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions') . '">' |
---|
| 83 | . lang('Current users') . ': ' . $GLOBALS['phpgw']->session->total() . '</a>'; |
---|
| 84 | } |
---|
| 85 | $now = time(); |
---|
| 86 | $var['user_info'] = '<b>'.$GLOBALS['phpgw']->common->display_fullname() .'</b>'. ' - ' |
---|
| 87 | . lang($GLOBALS['phpgw']->common->show_date($now,'l')) . ' ' |
---|
| 88 | . $GLOBALS['phpgw']->common->show_date($now,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']); |
---|
| 89 | |
---|
| 90 | if ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] == 0) |
---|
| 91 | { |
---|
| 92 | $api_messages = lang('You are required to change your password during your first login') |
---|
| 93 | . '<br> Click this image on the navbar: <img src="' |
---|
| 94 | . $GLOBALS['phpgw']->common->image('preferences','navbar.gif').'">'; |
---|
| 95 | } |
---|
| 96 | elseif($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - (86400*30)) |
---|
| 97 | { |
---|
| 98 | $api_messages = lang('it has been more then %1 days since you changed your password',30); |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | // This is gonna change |
---|
| 102 | if (isset($cd)) |
---|
| 103 | { |
---|
| 104 | $var['messages'] = $api_messages . '<br>' . checkcode($cd); |
---|
| 105 | } |
---|
| 106 | |
---|
| 107 | if (substr($GLOBALS['phpgw_info']['server']['login_logo_file'],0,4) == 'http') |
---|
| 108 | { |
---|
| 109 | $var['logo_file'] = $GLOBALS['phpgw_info']['server']['login_logo_file']; |
---|
| 110 | } |
---|
| 111 | else |
---|
| 112 | { |
---|
| 113 | $var['logo_file'] = $GLOBALS['phpgw']->common->image('phpgwapi',$GLOBALS['phpgw_info']['server']['login_logo_file']?$GLOBALS['phpgw_info']['server']['login_logo_file']:'logo'); |
---|
| 114 | } |
---|
| 115 | $var['logo_url'] = $GLOBALS['phpgw_info']['server']['login_logo_url']?$GLOBALS['phpgw_info']['server']['login_logo_url']:'http://www.eGroupWare.org'; |
---|
| 116 | if (substr($var['logo_url'],0,4) != 'http') |
---|
| 117 | { |
---|
| 118 | $var['logo_url'] = 'http://'.$var['logo_url']; |
---|
| 119 | } |
---|
| 120 | $var['logo_title'] = $GLOBALS['phpgw_info']['server']['login_logo_title']?$GLOBALS['phpgw_info']['server']['login_logo_title']:'www.eGroupWare.org'; |
---|
| 121 | |
---|
| 122 | $GLOBALS['idots_tpl']->set_var($var); |
---|
| 123 | $GLOBALS['idots_tpl']->pfp('out','navbar_header'); |
---|
| 124 | |
---|
| 125 | $menu_title = lang('General Menu'); |
---|
| 126 | |
---|
| 127 | $file['Home'] = $GLOBALS['phpgw_info']['navbar']['home']['url']; |
---|
| 128 | if ($GLOBALS['phpgw_info']['user']['apps']['preferences']) |
---|
| 129 | { |
---|
| 130 | $file['Preferences'] = $GLOBALS['phpgw_info']['navbar']['preferences']['url']; |
---|
| 131 | } |
---|
| 132 | $file += array( |
---|
| 133 | 'About %1'=>$GLOBALS['phpgw_info']['navbar']['about']['url'], |
---|
| 134 | 'Logout'=>$GLOBALS['phpgw_info']['navbar']['logout']['url'] |
---|
| 135 | ); |
---|
| 136 | |
---|
| 137 | display_sidebox('',$menu_title,$file); |
---|
| 138 | |
---|
| 139 | $GLOBALS['phpgw']->hooks->single('sidebox_menu',$GLOBALS['phpgw_info']['flags']['currentapp']); |
---|
| 140 | |
---|
| 141 | $GLOBALS['idots_tpl']->pparse('out','navbar_footer'); |
---|
| 142 | |
---|
| 143 | // If the application has a header include, we now include it |
---|
| 144 | if (!@$GLOBALS['phpgw_info']['flags']['noappheader'] && @isset($_GET['menuaction'])) |
---|
| 145 | { |
---|
| 146 | list($app,$class,$method) = explode('.',$_GET['menuaction']); |
---|
| 147 | if (is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions['header']) |
---|
| 148 | { |
---|
| 149 | $GLOBALS[$class]->header(); |
---|
| 150 | } |
---|
| 151 | } |
---|
| 152 | $GLOBALS['phpgw']->hooks->process('after_navbar'); |
---|
| 153 | return; |
---|
| 154 | } |
---|
| 155 | |
---|
| 156 | function display_sidebox($appname,$menu_title,$file) |
---|
| 157 | { |
---|
| 158 | if(!$appname || ($appname==$GLOBALS['phpgw_info']['flags']['currentapp'] && $file)) |
---|
| 159 | { |
---|
| 160 | $var['lang_title']=$menu_title;//$appname.' '.lang('Menu'); |
---|
| 161 | $GLOBALS['idots_tpl']->set_var($var); |
---|
| 162 | $GLOBALS['idots_tpl']->pfp('out','extra_blocks_header'); |
---|
| 163 | |
---|
| 164 | while(list($text,$url) = each($file)) |
---|
| 165 | { |
---|
| 166 | sidebox_menu_item($url,$text); |
---|
| 167 | } |
---|
| 168 | |
---|
| 169 | $GLOBALS['idots_tpl']->pparse('out','extra_blocks_footer'); |
---|
| 170 | } |
---|
| 171 | } |
---|
| 172 | |
---|
| 173 | function sidebox_menu_item($item_link='',$item_text='') |
---|
| 174 | { |
---|
| 175 | if($item_text == '_NewLine_' || $item_link == '_NewLine_') |
---|
| 176 | { |
---|
| 177 | $GLOBALS['idots_tpl']->pparse('out','extra_block_spacer'); |
---|
| 178 | } |
---|
| 179 | else |
---|
| 180 | { |
---|
| 181 | $var['icon_or_star']='<font color="#ff9933">*</font>'; |
---|
| 182 | $var['lang_item']=lang($item_text); |
---|
| 183 | $var['item_link']=$item_link; |
---|
| 184 | $GLOBALS['idots_tpl']->set_var($var); |
---|
| 185 | $GLOBALS['idots_tpl']->pparse('out','extra_block_row'); |
---|
| 186 | } |
---|
| 187 | } |
---|
| 188 | |
---|
| 189 | function parse_navbar_end() |
---|
| 190 | { |
---|
| 191 | $GLOBALS['idots_tpl'] = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR); |
---|
| 192 | |
---|
| 193 | $GLOBALS['idots_tpl']->set_file( |
---|
| 194 | array( |
---|
| 195 | 'footer' => 'footer.tpl' |
---|
| 196 | ) |
---|
| 197 | ); |
---|
| 198 | $var = Array( |
---|
| 199 | 'img_root' => $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/idots/images', |
---|
| 200 | 'table_bg_color' => $GLOBALS['phpgw_info']['theme']['navbar_bg'], |
---|
| 201 | 'version' => $GLOBALS['phpgw_info']['server']['versions']['phpgwapi'] |
---|
| 202 | ); |
---|
| 203 | $GLOBALS['phpgw']->hooks->process('navbar_end'); |
---|
| 204 | |
---|
| 205 | $var['powered_by'] = lang('Powered by phpGroupWare version %1',$GLOBALS['phpgw_info']['server']['versions']['phpgwapi']); |
---|
| 206 | $GLOBALS['idots_tpl']->set_var($var); |
---|
| 207 | $GLOBALS['idots_tpl']->pfp('out','footer'); |
---|
| 208 | } |
---|