Finished changing to and loads template vars to an array. May speed things up.

This commit is contained in:
skeeter 2001-08-31 00:44:46 +00:00
parent cb560611b1
commit ddc855fff6
4 changed files with 213 additions and 203 deletions

View File

@ -13,8 +13,6 @@
function parse_navbar($force = False)
{
global $phpgw_info, $phpgw, $menuaction, $obj;
$tpl = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
$tpl->set_unknowns('remove');
@ -25,21 +23,21 @@
)
);
$tpl->set_var('navbar_color',$phpgw_info['theme']['navbar_bg']);
$var['navbar_color'] = $GLOBALS['phpgw_info']['theme']['navbar_bg'];
if ($phpgw_info['flags']['navbar_target'])
if ($GLOBALS['phpgw_info']['flags']['navbar_target'])
{
$target = ' target="' . $phpgw_info['flags']['navbar_target'] . '"';
$target = ' target="' . $GLOBALS['phpgw_info']['flags']['navbar_target'] . '"';
}
$i = 1;
while ($app = each($phpgw_info['navbar']))
while ($app = each($GLOBALS['phpgw_info']['navbar']))
{
if ($phpgw_info['user']['preferences']['common']['navbar_format'] == 'text')
if ($GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format'] == 'text')
{
$tabs[$i]['label'] = lang($app[1]['title']);
$tabs[$i]['link'] = $app[1]['url'];
if (ereg($phpgw_info['navbar'][$app[0]],$PHP_SELF))
if (ereg($GLOBALS['phpgw_info']['navbar'][$app[0]],$PHP_SELF))
{
$selected = $i;
}
@ -49,55 +47,57 @@
{
$title = '<img src="' . $app[1]['icon'] . '" alt="' . lang($app[1]['title']) . '" title="'
. lang($app[1]['title']) . '" border="0">';
if ($phpgw_info['user']['preferences']['common']['navbar_format'] == 'icons_and_text')
if ($GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format'] == 'icons_and_text')
{
$title .= "<br>" . lang($app[1]['title']);
$tpl->set_var('width','7%');
$var['width'] = '7%';
}
else
{
$tpl->set_var('width','3%');
$var['width'] = '3%';
}
$tpl->set_var('value','<a href="' . $app[1]['url'] . '"' . $target . '>' . $title . '</a>');
$tpl->set_var('align','center');
$var['value'] = '<a href="' . $app[1]['url'] . '"' . $target . '>' . $title . '</a>';
$var['align'] = 'center';
$tpl->set_var($var);
$tpl->parse('applications','navbar_app',True);
}
}
if ($phpgw_info['user']['preferences']['common']['navbar_format'] == 'text')
if ($GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format'] == 'text')
{
$tpl->set_var('navbar_color',$phpgw_info['theme']['bg_color']);
$tpl->set_var('align','right');
$tpl->set_var('value',$phpgw->common->create_tabs($tabs,$selected,-1));
$var['navbar_color'] = $GLOBALS['phpgw_info']['theme']['bg_color'];
$var['align'] = 'right';
$var['value'] = $GLOBALS['phpgw']->common->create_tabs($tabs,$selected,-1);
$tpl->set_var($var);
$tpl->parse('applications','navbar_app',True);
}
if ($phpgw_info['server']['showpoweredbyon'] == 'top')
if ($GLOBALS['phpgw_info']['server']['showpoweredbyon'] == 'top')
{
$tpl->set_var('powered_by',lang('Powered by phpGroupWare version x',$phpgw_info['server']['versions']['phpgwapi']));
$var['powered_by'] = lang('Powered by phpGroupWare version x',$GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
}
if (isset($phpgw_info['navbar']['admin']) && isset($phpgw_info['user']['preferences']['common']['show_currentusers']))
if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && isset($GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']))
{
$db = $phpgw->db;
$db = $GLOBALS['phpgw']->db;
$db->query("select count(session_id) from phpgw_sessions where session_flags != 'A'");
$db->next_record();
$tpl->set_var('current_users','<a href="' . $phpgw->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions')
. '">&nbsp;' . lang('Current users') . ': ' . $db->f(0) . '</a>');
$var['current_users'] = '<a href="' . $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions')
. '">&nbsp;' . lang('Current users') . ': ' . $db->f(0) . '</a>';
}
$tpl->set_var('user_info',$phpgw->common->display_fullname() . " - "
. lang($phpgw->common->show_date(time(),"l")) . " "
. lang($phpgw->common->show_date(time(),"F")) . " "
. $phpgw->common->show_date(time(),"d, Y"));
$var['user_info'] = $GLOBALS['phpgw']->common->display_fullname() . " - "
. lang($GLOBALS['phpgw']->common->show_date(time(),"l")) . " "
. lang($GLOBALS['phpgw']->common->show_date(time(),"F")) . " "
. $GLOBALS['phpgw']->common->show_date(time(),"d, Y");
// Maybe we should create a common function in the phpgw_accounts_shared.inc.php file
// to get rid of duplicate code.
if ($phpgw_info['user']['lastpasswd_change'] == 0)
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="'
. $phpgw->common->image('preferences','navbar.gif').'">';
. $GLOBALS['phpgw']->common->image('preferences','navbar.gif').'">';
}
elseif ($phpgw_info['user']['lastpasswd_change'] < time() - (86400*30))
elseif ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - (86400*30))
{
$api_messages = lang('it has been more then x days since you changed your password',30);
}
@ -105,28 +105,27 @@
// This is gonna change
if (isset($cd))
{
$tpl->set_var('messages',$api_messages . '<br>' . checkcode($cd));
$var['messages'] = $api_messages . '<br>' . checkcode($cd);
}
$tpl->set_Var($var);
$tpl->pfp('out','navbar');
// If the application has a header include, we now include it
if (!@$phpgw_info['flags']['noappheader'] && $menuaction)
if (!@$GLOBALS['phpgw_info']['flags']['noappheader'] && $GLOBALS['menuaction'])
{
if (is_array($obj->public_functions) && $obj->public_functions['header'])
if (is_array($GLOBALS['obj']->public_functions) && $GLOBALS['obj']->public_functions['header'])
{
eval("\$obj->header();");
eval("\$GLOBALS['obj']->header();");
}
}
$phpgw->common->hook('after_navbar');
$GLOBALS['phpgw']->common->hook('after_navbar');
return;
}
function parse_navbar_end()
{
global $phpgw_info, $phpgw;
if ($phpgw_info['server']['showpoweredbyon'] == 'bottom')
if ($GLOBALS['phpgw_info']['server']['showpoweredbyon'] == 'bottom')
{
$msg = "<P><P>\n" . lang('Powered by phpGroupWare version x', $phpgw_info['server']['versions']['phpgwapi']);
$msg = "<P><P>\n" . lang('Powered by phpGroupWare version x', $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
$tpl = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
$tpl->set_unknowns('remove');
@ -136,11 +135,13 @@
'footer' => 'footer.tpl'
)
);
$tpl->set_var('table_bg_color',$phpgw_info['theme']['navbar_bg']);
$tpl->set_var('msg',$msg);
$tpl->set_var('version',$phpgw_info['server']['versions']['phpgwapi']);
$phpgw->common->hook('navbar_end');
$var = Array(
'table_bg_color' => $GLOBALS['phpgw_info']['theme']['navbar_bg'],
'msg' => $msg,
'version' => $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']
);
$tpl->set_var($var);
$GLOBALS['phpgw']->common->hook('navbar_end');
$tpl->pfp('out','footer');
}
}

View File

@ -13,38 +13,38 @@
function parse_navbar($force = False)
{
global $phpgw_info, $phpgw;
$tpl = CreateObject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
$tpl->set_unknowns('remove');
$tpl->set_file(array(
'navbar' => 'navbar.tpl'
));
$tpl->set_file(
array(
'navbar' => 'navbar.tpl'
)
);
$tpl->set_block('navbar','B_powered_top','V_powered_top');
$tpl->set_var('img_root',PHPGW_IMAGES_DIR);
$tpl->set_var('img_root_roll',PHPGW_IMAGES_DIR . '/rollover');
$tpl->set_var('table_bg_color',$phpgw_info['theme']['navbar_bg']);
$var['img_root'] = PHPGW_IMAGES_DIR;
$var['img_root_roll'] = PHPGW_IMAGES_DIR . '/rollover';
$var['table_bg_color'] = $GLOBALS['phpgw_info']['theme']['navbar_bg'];
# echo '<pre>'; print_r($phpgw_info['navbar']); echo '</pre>';
# echo '<pre>'; print_r($GLOBALS['phpgw_info']['navbar']); echo '</pre>';
$applications = '';
while ($app = each($phpgw_info['navbar']))
while ($app = each($GLOBALS['phpgw_info']['navbar']))
{
if ($app[1]['title'] != 'Home' && $app[1]['title'] != 'preferences' && ! ereg('About',$app[1]['title']) && $app[1]['title'] != 'Logout')
{
$title = '<img src="' . $app[1]['icon'] . '" alt="' . $app[1]['title'] . '" title="'
. lang($app[1]['title']) . '" border="0" name="' . $app[0] . '">';
$img_src_over = $phpgw->common->image($app[0],'navbar-over.gif');
$img_src_out = $phpgw->common->image($app[0],'navbar.gif');
$img_src_over = $GLOBALS['phpgw']->common->image($app[0],'navbar-over.gif');
$img_src_out = $GLOBALS['phpgw']->common->image($app[0],'navbar.gif');
// onMouseOver="two.src='rollover/admin_over.gif'" onMouseOut="two.src='images/admin.gif'"><img src="images/admin.gif" border="0" name="two"
$applications .= '<tr><td><a href="' . $app[1]['url'] . '"';
if (isset($phpgw_info['flags']['navbar_target']))
if (isset($GLOBALS['phpgw_info']['flags']['navbar_target']))
{
$applications .= ' target="' . $phpgw_info['flags']['navbar_target'] . '"';
$applications .= ' target="' . $GLOBALS['phpgw_info']['flags']['navbar_target'] . '"';
}
if($img_src_over != '')
@ -57,74 +57,75 @@
}
$applications .= '>'.$title.'</a></td></tr>'."\n";
}
$img_src_over = $phpgw->common->image($app[0],'navbar-over.gif');
$img_src_over = $GLOBALS['phpgw']->common->image($app[0],'navbar-over.gif');
if($img_src_over)
{
$pre_load[] = $img_src_over;
}
}
$tpl->set_var('app_images',implode("','",$pre_load));
$var['app_images'] = implode("','",$pre_load);
$tpl->set_var('applications',$applications);
$var['applications'] = $applications;
$tpl->set_var('home_link',$phpgw_info['navbar']['home']['url']);
$tpl->set_var('preferences_link',$phpgw_info['navbar']['preferences']['url']);
$tpl->set_var('logout_link',$phpgw_info['navbar']['logout']['url']);
$tpl->set_var('help_link',$phpgw_info['navbar']['about']['url']);
$var['home_link'] = $GLOBALS['phpgw_info']['navbar']['home']['url'];
$var['preferences_link'] = $GLOBALS['phpgw_info']['navbar']['preferences']['url'];
$var['logout_link'] = $GLOBALS['phpgw_info']['navbar']['logout']['url'];
$var['help_link'] = $GLOBALS['phpgw_info']['navbar']['about']['url'];
if ($phpgw_info['flags']['currentapp'] == 'home')
if ($GLOBALS['phpgw_info']['flags']['currentapp'] == 'home')
{
$tpl->set_var('welcome_img',PHPGW_IMAGES_DIR . '/welcome-red.gif');
$var['welcome_img'] = PHPGW_IMAGES_DIR . '/welcome-red.gif';
}
else
{
$tpl->set_var('welcome_img',PHPGW_IMAGES_DIR . '/welcome-grey.gif');
$var['welcome_img'] = PHPGW_IMAGES_DIR . '/welcome-grey.gif';
}
if ($phpgw_info['flags']['currentapp'] == 'preferences')
if ($GLOBALS['phpgw_info']['flags']['currentapp'] == 'preferences')
{
$tpl->set_var('preferences_img',PHPGW_IMAGES_DIR . '/preferences-red.gif');
$var['preferences_img'] = PHPGW_IMAGES_DIR . '/preferences-red.gif';
}
else
{
$tpl->set_var('preferences_img',PHPGW_IMAGES_DIR . '/preferences-grey.gif');
$var['preferences_img'] = PHPGW_IMAGES_DIR . '/preferences-grey.gif';
}
$tpl->set_var('logout_img',PHPGW_IMAGES_DIR . '/logout-grey.gif');
$var['logout_img'] = PHPGW_IMAGES_DIR . '/logout-grey.gif';
if ($phpgw_info['server']['showpoweredbyon'] == 'top')
if ($GLOBALS['phpgw_info']['server']['showpoweredbyon'] == 'top')
{
$tpl->set_var("powered_by",lang("Powered by phpGroupWare version x",$phpgw_info["server"]["versions"]["phpgwapi"]));
$tpl->set_var('power_size','2');
$var['powered_by'] = lang('Powered by phpGroupWare version x',$GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
$var['power_size'] = '2';
$tpl->set_var($var);
$tpl->parse('V_powered_top','B_powered_top');
}
else
{
$tpl->set_var('V_powered_top','');
$var['V_powered_top'] = '';
}
if (isset($phpgw_info['navbar']['admin']) && isset($phpgw_info['user']['preferences']['common']['show_currentusers']))
if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && isset($GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']))
{
$db = $phpgw->db;
$db = $GLOBALS['phpgw']->db;
$db->query('select count(session_id) from phpgw_sessions');
$db->next_record();
$tpl->set_var("current_users",'<a href="' . $phpgw->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions')
. '">&nbsp;' . lang('Current users') . ': ' . $db->f(0) . '</a>');
$var['current_users'] = '<a href="' . $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions')
. '">&nbsp;' . lang('Current users') . ': ' . $db->f(0) . '</a>';
}
$tpl->set_var('user_info',$phpgw->common->display_fullname() . ' - '
. lang($phpgw->common->show_date(time(),'l')) . ' '
. lang($phpgw->common->show_date(time(),'F')) . ' '
. $phpgw->common->show_date(time(),'d, Y'));
$var['user_info'] = $GLOBALS['phpgw']->common->display_fullname() . ' - '
. lang($GLOBALS['phpgw']->common->show_date(time(),'l')) . ' '
. lang($GLOBALS['phpgw']->common->show_date(time(),'F')) . ' '
. $GLOBALS['phpgw']->common->show_date(time(),'d, Y');
// Maybe we should create a common function in the phpgw_accounts_shared.inc.php file
// to get rid of duplicate code.
/* if ($phpgw_info['user']['lastpasswd_change'] == 0)
/* 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="'
. $phpgw->common->image('preferences','navbar.gif').'">';
. $GLOBALS['phpgw']->common->image('preferences','navbar.gif').'">';
}
elseif ($phpgw_info['user']['lastpasswd_change'] < time() - (86400*30))
elseif ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - (86400*30))
{
$api_messages = lang('it has been more then x days since you changed your password',30);
}
@ -132,9 +133,10 @@
// This is gonna change
if (isset($cd))
{
$tpl->set_var('messages',$api_messages . '<br>' . checkcode($cd));
$var['messages'] = $api_messages . '<br>' . checkcode($cd);
}
*/
$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'] && $GLOBALS['menuaction'])
@ -144,27 +146,28 @@
eval("\$GLOBALS['obj']->header();");
}
}
$phpgw->common->hook('after_navbar');
$GLOBALS['phpgw']->common->hook('after_navbar');
return;
}
function parse_navbar_end()
{
global $phpgw_info, $phpgw;
$tpl = CreateObject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
$tpl->set_unknowns('remove');
$tpl->set_file(array('footer' => 'footer.tpl'));
$tpl->set_block('footer','B_powered_bottom','V_powered_bottom');
if ($phpgw_info["server"]["showpoweredbyon"] == "bottom")
if ($GLOBALS['phpgw_info']['server']['showpoweredbyon'] == 'bottom')
{
$powered = lang("Powered by phpGroupWare version x", $phpgw_info["server"]["versions"]["phpgwapi"]);
$tpl->set_var('powered',$powered);
$tpl->set_var('img_root',PHPGW_IMAGES_DIR);
$tpl->set_var('power_backcolor',$phpgw_info['theme']['navbar_bg']);
$tpl->set_var('power_textcolor',$phpgw_info['theme']['navbar_text']);
//$tpl->set_var('version',$phpgw_info['server']['versions']['phpgwapi']);
$var = Array(
'powered' => lang('Powered by phpGroupWare version x', $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
'img_root' => PHPGW_IMAGES_DIR,
'power_backcolor' => $GLOBALS['phpgw_info']['theme']['navbar_bg'],
'power_textcolor' => $GLOBALS['phpgw_info']['theme']['navbar_text']
// 'version' => $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']
);
$tpl->set_var($var);
$tpl->parse('V_powered_bottom','B_powered_bottom');
}
else
@ -172,6 +175,6 @@
$tpl->set_var('V_powered_bottom','');
}
$phpgw->common->hook('navbar_end');
$GLOBALS['phpgw']->common->hook('navbar_end');
$tpl->pfp('out','footer');
}

View File

@ -13,8 +13,6 @@
function parse_navbar($force = False)
{
global $phpgw_info, $phpgw, $PHP_SELF, $menuaction, $obj;
$tpl = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
$tpl->set_file(
@ -23,72 +21,72 @@
)
);
$tpl->set_var('img_root',$phpgw_info["server"]["webserver_url"] . "/phpgwapi/templates/justweb/images");
$tpl->set_var('table_bg_color',$phpgw_info['theme']['navbar_bg']);
$var['img_root'] = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/justweb/images';
$var[table_bg_color'] = $GLOBALS['phpgw_info']['theme']['navbar_bg'];
if ($phpgw_info['flags']['navbar_target'])
if ($GLOBALS['phpgw_info']['flags']['navbar_target'])
{
$target = ' target="' . $phpgw_info['flags']['navbar_target'] . '"';
$target = ' target="' . $GLOBALS['phpgw_info']['flags']['navbar_target'] . '"';
}
while ($app = each($phpgw_info['navbar']))
while ($app = each($GLOBALS['phpgw_info']['navbar']))
{
if ($app[1]['title'] != "Home" && $app[1]['title'] != 'preferences' && ! ereg('About',$app[1]['title']) && $app[1]['title'] != 'Logout')
{
$title = '<img src="' . $app[1]['icon'] . '" alt="' . lang($app[1]['title']) . '" title="'
. lang($app[1]['title']) . '" border="0">';
if ($phpgw_info['user']['preferences']['common']['navbar_format'] == 'icons_and_text')
if ($GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format'] == 'icons_and_text')
{
$title .= '<br>' . lang($app[1]['title']);
}
$applications .= '<br><a href="' . $app[1]['url'] . '"' . $target . '>' . $title . '</a>';
}
}
$tpl->set_var('applications',$applications);
$var ['applications'] = $applications;
$tpl->set_var('home_link',$phpgw_info['navbar']['home']['url']);
$tpl->set_var('preferences_link',$phpgw_info['navbar']['preferences']['url']);
$tpl->set_var('logout_link',$phpgw_info['navbar']['logout']['url']);
$tpl->set_var('help_link',$phpgw_info['navbar']['about']['url']);
$var['home_link'] = $GLOBALS['phpgw_info']['navbar']['home']['url'];
$var['preferences_link'] = $GLOBALS['phpgw_info']['navbar']['preferences']['url'];
$var['logout_link'] = $GLOBALS['phpgw_info']['navbar']['logout']['url'];
$var['help_link'] = $GLOBALS['phpgw_info']['navbar']['about']['url'];
if ($phpgw_info['flags']['currentapp'] == 'home')
if ($GLOBALS['phpgw_info']['flags']['currentapp'] == 'home')
{
$tpl->set_var('welcome_img',PHPGW_IMAGES_DIR . '/welcome-red.gif');
$var['welcome_img'] = PHPGW_IMAGES_DIR . '/welcome-red.gif';
}
else
{
$tpl->set_var('welcome_img',PHPGW_IMAGES_DIR . '/welcome-grey.gif');
$var['welcome_img'] = PHPGW_IMAGES_DIR . '/welcome-grey.gif';
}
if ($phpgw_info['flags']['currentapp'] == 'preferences')
if ($GLOBALS['phpgw_info']['flags']['currentapp'] == 'preferences')
{
$tpl->set_var('preferences_img',PHPGW_IMAGES_DIR . '/preferences-red.gif');
$var['preferences_img'] = PHPGW_IMAGES_DIR . '/preferences-red.gif';
}
else
{
$tpl->set_var('preferences_img',PHPGW_IMAGES_DIR . '/preferences-grey.gif');
$var['preferences_img'] = PHPGW_IMAGES_DIR . '/preferences-grey.gif';
}
$tpl->set_var('logout_img',PHPGW_IMAGES_DIR . '/logout-grey.gif');
$var['logout_img'] = PHPGW_IMAGES_DIR . '/logout-grey.gif';
/*
if ($phpgw_info['server']['showpoweredbyon'] == 'top')
if ($GLOBALS['phpgw_info']['server']['showpoweredbyon'] == 'top')
{
$tpl->set_var('powered_by',lang('Powered by phpGroupWare version x',$phpgw_info['server']['versions']['phpgwapi']));
$var['powered_by'] = lang('Powered by phpGroupWare version x',$GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
}
if (isset($phpgw_info['navbar']['admin']) && isset($phpgw_info['user']['preferences']['common']['show_currentusers']))
if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && isset($GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']))
{
$db = $phpgw->db;
$db = $GLOBALS['phpgw']->db;
$db->query("select count(session_id) from phpgw_sessions");
$db->next_record();
$tpl->set_var('current_users','<a href="' . $phpgw->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions') . '">&nbsp;'
. lang('Current users') . ': ' . $db->f(0) . '</a>');
$var['current_users'] = '<a href="' . $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions') . '">&nbsp;'
. lang('Current users') . ': ' . $db->f(0) . '</a>';
}
*/
$tpl->set_var('user_info',$phpgw->common->display_fullname() . ' - '
. lang($phpgw->common->show_date(time(),"l")) . ' '
. lang($phpgw->common->show_date(time(),"F")) . ' '
. $phpgw->common->show_date(time(),"d, Y"));
$var['user_info'] = $GLOBALS['phpgw']->common->display_fullname() . ' - '
. lang($GLOBALS['phpgw']->common->show_date(time(),"l")) . ' '
. lang($GLOBALS['phpgw']->common->show_date(time(),"F")) . ' '
. $GLOBALS['phpgw']->common->show_date(time(),"d, Y"));
/*
* Maybe we should create a common function in the phpgw_accounts_shared.inc.php file
@ -96,13 +94,13 @@
*/
/*
if ($phpgw_info['user']['lastpasswd_change'] == 0)
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="'
. $phpgw->common->image('preferences','navbar.gif').'">';
. $GLOBALS['phpgw']->common->image('preferences','navbar.gif').'">';
}
elseif ($phpgw_info['user']['lastpasswd_change'] < time() - (86400*30))
elseif ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - (86400*30))
{
$api_messages = lang('it has been more then x days since you changed your password',30);
}
@ -110,38 +108,42 @@
// This is gonna change
if (isset($cd))
{
$tpl->set_var("messages",$api_messages . "<br>" . checkcode($cd));
$var['messages'] = $api_messages . "<br>" . checkcode($cd);
}
*/
$tpl->set_var($var);
$tpl->pfp('out','navbar');
// If the application has a header include, we now include it
if (!@$phpgw_info['flags']['noappheader'] && $menuaction)
if (!@$GLOBALS['phpgw_info']['flags']['noappheader'] && $GLOBALS['HTTP_GET_VARS']['menuaction'])
{
if (is_array($obj->public_functions) && $obj->public_functions['header'])
if (is_array($GLOBALS['obj']->public_functions) && $GLOBALS['obj']->public_functions['header'])
{
eval("\$obj->header();");
eval("\$GLOBALS['obj']->header();");
}
}
$phpgw->common->hook('after_navbar');
$GLOBALS['phpgw']->common->hook('after_navbar');
return;
}
function parse_navbar_end()
{
global $phpgw_info, $phpgw;
$tpl = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
$tpl->set_file(array(
'footer' => 'footer.tpl'
));
$tpl->set_var('img_root',$phpgw_info['server']['webserver_url'] . '/phpgwapi/templates/justweb/images');
$tpl->set_var('table_bg_color',$phpgw_info['theme']['navbar_bg']);
$tpl->set_var('version',$phpgw_info['server']['versions']['phpgwapi']);
$tpl->set_var('user_info',$phpgw->common->display_fullname() . ' - '
. lang($phpgw->common->show_date(time(),'l')) . ' '
. lang($phpgw->common->show_date(time(),'F')) . ' '
. $phpgw->common->show_date(time(),'d, Y'));
$phpgw->common->hook('navbar_end');
$tpl->set_file(
array(
'footer' => 'footer.tpl'
)
);
$var = Array(
'img_root' => $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/justweb/images',
'table_bg_color' => $GLOBALS['phpgw_info']['theme']['navbar_bg'],
'version' => $GLOBALS['phpgw_info']['server']['versions']['phpgwapi'],
'user_info' => $GLOBALS['phpgw']->common->display_fullname() . ' - '
. lang($GLOBALS['phpgw']->common->show_date(time(),'l')) . ' '
. lang($GLOBALS['phpgw']->common->show_date(time(),'F')) . ' '
. $GLOBALS['phpgw']->common->show_date(time(),'d, Y')
);
$tpl->set_var($var);
$GLOBALS['phpgw']->common->hook('navbar_end');
echo $tpl->pfp('out','footer');
}

View File

@ -13,102 +13,102 @@
function parse_navbar($force = False)
{
global $phpgw_info, $phpgw, $PHP_SELF, $menuaction, $obj;
$tpl = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
$tpl->set_file(array(
'navbar' => 'navbar.tpl'
));
$tpl->set_file(
array(
'navbar' => 'navbar.tpl'
)
);
$tpl->set_var('img_root',$phpgw_info['server']['webserver_url'] . '/phpgwapi/templates/verdilak/images');
$tpl->set_var('table_bg_color',$phpgw_info['theme']['navbar_bg']);
$var['img_root'] = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/verdilak/images';
$var['table_bg_color'] = $GLOBALS['phpgw_info']['theme']['navbar_bg'];
$applications = '';
while ($app = each($phpgw_info['navbar']))
{
if ($app[1]['title'] != 'Home' && $app[1]['title'] != 'preferences' && ! ereg('About',$app[1]['title']) && $app[1]['title'] != 'Logout')
{
if ($phpgw_info['user']['preferences']['common']['navbar_format'] != 'text')
if ($GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format'] != 'text')
{
$title = '<img src="' . $app[1]['icon'] . '" alt="' . lang($app[1]['title']) . '" title="'
. lang($app[1]['title']) . '" border="0">';
}
if ($phpgw_info['user']['preferences']['common']['navbar_format'] != 'icons')
if ($GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format'] != 'icons')
{
$title .= '<br>' . lang($app[1]['title']);
}
$applications .= '<br><a href="' . $app[1]['url'] . '"';
if (isset($phpgw_info['flags']['navbar_target']) &&
$phpgw_info['flags']['navbar_target'])
if (isset($GLOBALS['phpgw_info']['flags']['navbar_target']) &&
$GLOBALS['phpgw_info']['flags']['navbar_target'])
{
$applications .= ' target="' . $phpgw_info['flags']['navbar_target'] . '"';
$applications .= ' target="' . $GLOBALS['phpgw_info']['flags']['navbar_target'] . '"';
}
$applications .= '>' . $title . '</a>';
unset($title);
}
}
$tpl->set_var('applications',$applications);
$var['applications'] = $applications;
if (isset($phpgw_info['theme']['special_logo']))
if (isset($GLOBALS['phpgw_info']['theme']['special_logo']))
{
$tpl->set_var('logo',$phpgw_info['theme']['special_logo']);
$var['logo'] = $GLOBALS['phpgw_info']['theme']['special_logo'];
}
else
{
$tpl->set_var('logo','logo.gif');
$var['logo'] = 'logo.gif';
}
$tpl->set_var('home_link',$phpgw_info['navbar']['home']['url']);
$tpl->set_var('preferences_link',$phpgw_info['navbar']['preferences']['url']);
$tpl->set_var('logout_link',$phpgw_info['navbar']['logout']['url']);
$tpl->set_var('help_link',$phpgw_info['navbar']['about']['url']);
$var['home_link'] = $GLOBALS['phpgw_info']['navbar']['home']['url'];
$var['preferences_link'] = $GLOBALS['phpgw_info']['navbar']['preferences']['url'];
$var['logout_link'] = $GLOBALS['phpgw_info']['navbar']['logout']['url'];
$var['help_link'] = $GLOBALS['phpgw_info']['navbar']['about']['url'];
$ir = $phpgw_info['server']['webserver_url'] . '/phpgwapi/templates/verdilak/images';
if ($phpgw_info['flags']['currentapp'] == 'home')
$ir = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/verdilak/images';
if ($GLOBALS['phpgw_info']['flags']['currentapp'] == 'home')
{
$tpl->set_var('welcome_img',$ir . '/welcome-red.gif');
$var['welcome_img'] = $ir . '/welcome-red.gif';
}
else
{
$tpl->set_var('welcome_img',$ir . '/welcome-grey.gif');
$var['welcome_img'] = $ir . '/welcome-grey.gif';
}
if ($phpgw_info['flags']['currentapp'] == 'preferences')
{
$tpl->set_var('preferences_img',$ir . '/preferences-red.gif');
$var['preferences_img'] = $ir . '/preferences-red.gif';
}
else
{
$tpl->set_var('preferences_img',$ir . '/preferences-grey.gif');
$var['preferences_img'] = $ir . '/preferences-grey.gif';
}
$tpl->set_var('logout_img',$ir . '/logout-grey.gif');
$var['logout_img'] = $ir . '/logout-grey.gif';
$tpl->set_var('powered_by',lang('Powered by phpGroupWare version x',$phpgw_info['server']['versions']['phpgwapi']));
$var['powered_by'] = lang('Powered by phpGroupWare version x',$GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
if (isset($phpgw_info['navbar']['admin']) && isset($phpgw_info['user']['preferences']['common']['show_currentusers']))
if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && isset($GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']))
{
$db = $phpgw->db;
$db = $GLOBALS['phpgw']->db;
$db->query("select count(session_id) from phpgw_sessions where session_flags != 'A'");
$db->next_record();
$tpl->set_var('current_users','<a style="font-family: Geneva,Arial,Helvetica,sans-serif; font-size: 12pt;" href="'
. $phpgw->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions') . '">&nbsp;'
. lang('Current users') . ': ' . $db->f(0) . '</a>');
$var['current_users'] = '<a style="font-family: Geneva,Arial,Helvetica,sans-serif; font-size: 12pt;" href="'
. $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions') . '">&nbsp;'
. lang('Current users') . ': ' . $db->f(0) . '</a>';
}
$tpl->set_var('user_info',$phpgw->common->display_fullname() . ' - '
. lang($phpgw->common->show_date(time(),'l')) . ' '
. lang($phpgw->common->show_date(time(),'F')) . ' '
. $phpgw->common->show_date(time(),'d, Y'));
$var['user_info'] = $GLOBALS['phpgw']->common->display_fullname() . ' - '
. lang($GLOBALS['phpgw']->common->show_date(time(),'l')) . ' '
. lang($GLOBALS['phpgw']->common->show_date(time(),'F')) . ' '
. $GLOBALS['phpgw']->common->show_date(time(),'d, Y');
// Maybe we should create a common function in the phpgw_accounts_shared.inc.php file
// to get rid of duplicate code.
if ($phpgw_info['user']['lastpasswd_change'] == 0)
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="'
. $phpgw->common->image('preferences','navbar.gif').'">';
. $GLOBALS['phpgw']->common->image('preferences','navbar.gif').'">';
}
else if ($phpgw_info['user']['lastpasswd_change'] < time() - (86400*30))
else if ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - (86400*30))
{
$api_messages = lang('it has been more then x days since you changed your password',30);
}
@ -116,33 +116,37 @@
// This is gonna change
if (isset($cd))
{
$tpl->set_var('messages',$api_messages . '<br>' . checkcode($cd));
$var['messages'] = $api_messages . '<br>' . checkcode($cd);
}
$tpl->set_var($var);
$tpl->pfp('out','navbar');
// If the application has a header include, we now include it
if (!@$phpgw_info['flags']['noappheader'] && $menuaction)
if (!@$GLOBALS['phpgw_info']['flags']['noappheader'] && $GLOBALS['HTTP_GET_VARS']['menuaction'])
{
if (is_array($obj->public_functions) && $obj->public_functions['header'])
if (is_array($GLOBALS['obj']->public_functions) && $GLOBALS['obj']->public_functions['header'])
{
eval("\$obj->header();");
eval("\$GLOBALS['obj']->header();");
}
}
$phpgw->common->hook('after_navbar');
$GLOBALS['phpgw']->common->hook('after_navbar');
return;
}
function parse_navbar_end()
{
global $phpgw_info, $phpgw;
$tpl = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
$tpl->set_file(array(
'footer' => 'footer.tpl'
));
$tpl->set_var('img_root',$phpgw_info['server']['webserver_url'] . '/phpgwapi/templates/verdilak/images');
$tpl->set_var('table_bg_color',$phpgw_info['theme']['navbar_bg']);
$tpl->set_var('version',$phpgw_info['server']['versions']['phpgwapi']);
$phpgw->common->hook('navbar_end');
$tpl->set_file(
array(
'footer' => 'footer.tpl'
)
);
$var = Array(
'img_root' => $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/verdilak/images',
'table_bg_color' => $GLOBALS['phpgw_info']['theme']['navbar_bg'],
'version' => $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']
);
$tpl->set_var($var);
$GLOBALS['phpgw']->common->hook('navbar_end');
echo $tpl->pfp('out','footer');
}