phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] [18499] code cleanup


From: Dave Hall
Subject: [Phpgroupware-cvs] [18499] code cleanup
Date: Mon, 10 Mar 2008 22:22:38 +0000

Revision: 18499
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=18499
Author:   skwashd
Date:     2008-03-10 22:22:37 +0000 (Mon, 10 Mar 2008)

Log Message:
-----------
code cleanup

Modified Paths:
--------------
    trunk/phpgwapi/templates/idots/navbar.inc.php

Modified: trunk/phpgwapi/templates/idots/navbar.inc.php
===================================================================
--- trunk/phpgwapi/templates/idots/navbar.inc.php       2008-03-10 22:21:21 UTC 
(rev 18498)
+++ trunk/phpgwapi/templates/idots/navbar.inc.php       2008-03-10 22:22:37 UTC 
(rev 18499)
@@ -36,22 +36,26 @@
                prepare_navbar($navbar);
 
                $navigation = execMethod('phpgwapi.menu.get', 'navigation');
-               $sidecontent = 
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['sidecontent']) 
&& $GLOBALS['phpgw_info']['user']['preferences']['common']['sidecontent'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['common']['sidecontent'] : 
'sidebox';
+               $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'];
+               }
 
+               $sideitems = array('home', 'preferences', 'about', 'logout');
+
                foreach($navbar as $app => $app_data)
                {
-                       if (($app != 'home' && $app != 'preferences' && $app != 
'about' && $app != 'logout')
+                       if ( !in_array($app, $sideitems) 
                                || ($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'],
+                               (
+                                       'alt_img_app'   => $app_data['text'],
                                        'app_name'              => 
$app_data['text'],
-                                       'img_app'               => 
$GLOBALS['phpgw']->common->image($app_data['image'][0], $app_data['image'][1])
-                                       );
+                                       'img_app'               => 
$GLOBALS['phpgw']->common->image($app_data['image'][0], $app_data['image'][1]),
+                                       'url_app'               => 
$app_data['url']
+                               );
 
                                $GLOBALS['phpgw']->template->set_var($item);
                                
$GLOBALS['phpgw']->template->parse('navbar_items', 'navbar_item', true);
@@ -67,14 +71,21 @@
                        $var['current_app_title'] = 
lang($GLOBALS['phpgw_info']['flags']['currentapp']);
                }
 
-               if (isset($GLOBALS['phpgw_info']['navbar']['admin']) 
+               if ( isset($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>';
+                       $current = array
+                       (
+                               'link'  => 
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions'),
+                               'lang'  => lang('current users: %1', 
$GLOBALS['phpgw']->session->total())
+                       );
+                       $var['current_users'] = <<<HTML
+                       <a href="{$current['link']}">{$current['lang']}</a>
+
+HTML;
                }
+
                $now = time();
                $var['user_info'] = 
'<b>'.$GLOBALS['phpgw']->common->display_fullname() .'</b>'. ' - '
                . lang($GLOBALS['phpgw']->common->show_date($now,'l')) . ' '
@@ -164,29 +175,29 @@
        * @param string $file
        */
        function display_sidebox($menu_title, $menu)
-               {
+       {
                $GLOBALS['phpgw']->template->set_var('lang_title', $menu_title);
-                       
$GLOBALS['phpgw']->template->pfp('out','extra_blocks_header');
-                       
+               $GLOBALS['phpgw']->template->pfp('out','extra_blocks_header');
+
                foreach ( $menu as $key => $item )
+               {
+                       if ( !isset($item['url']) )
                        {
-                               if ( !isset($item['url']) )
-                               {
-                                       $item['url'] = '';
-                               }
+                               $item['url'] = '';
+                       }
 
-                               if ( !isset($item['image']) )
-                               {
-                                       $item['image'] = '';
-                               }
+                       if ( !isset($item['image']) )
+                       {
+                               $item['image'] = '';
+                       }
 
-                               if ( !isset($item['this']) )
-                               {
-                                       $item['this'] = '';
-                               }
+                       if ( !isset($item['this']) )
+                       {
+                               $item['this'] = false;
+                       }
 
                        sidebox_menu_item($item['url'], $item['text'], 
$item['image'], $item['this']);
-                       }
+               }
 
                $GLOBALS['phpgw']->template->pfp('out', 'extra_blocks_footer');
        }
@@ -199,11 +210,11 @@
        * @param string $item_text
        * @param string $item_image
        */
-       function sidebox_menu_item($item_link='', $item_text='', 
$item_image='', $highlight = '')
+       function sidebox_menu_item($item_link='', $item_text='', 
$item_image='', $highlight = false )
        {
                        $GLOBALS['phpgw']->template->set_var(array
                        (
-                       'lang_item'                     => $highlight ? 
"<strong>$item_text</strong>": $item_text,
+                               'lang_item'                     => $highlight ? 
"<strong>$item_text</strong>": $item_text,
                                'item_link'                     => $item_link
                        ));
                        
$GLOBALS['phpgw']->template->pfp('out','extra_block_row');






reply via email to

[Prev in Thread] Current Thread [Next in Thread]