00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 include_once( 'kernel/common/i18n.php' );
00041
00042 class eZTopMenuOperator
00043 {
00044
00045
00046
00047 function eZTopMenuOperator( $name = 'topmenu' )
00048 {
00049 $this->Operators = array( $name );
00050 $this->DefaultNames = array(
00051 'content' => array( 'name' => ezi18n( 'design/admin/pagelayout',
00052 'Content structure' ),
00053 'tooltip'=> ezi18n( 'design/admin/pagelayout',
00054 'Manage the main content structure of the site.' ) ),
00055 'media' => array( 'name' => ezi18n( 'design/admin/pagelayout',
00056 'Media library' ),
00057 'tooltip'=> ezi18n( 'design/admin/pagelayout',
00058 'Manage images, files, documents, etc.' ) ),
00059 'users' => array( 'name' => ezi18n( 'design/admin/pagelayout',
00060 'User accounts' ),
00061 'tooltip'=> ezi18n( 'design/admin/pagelayout',
00062 'Manage users, user groups and permission settings.' ) ),
00063 'shop' => array( 'name' => ezi18n( 'design/admin/pagelayout',
00064 'Webshop' ),
00065 'tooltip'=> ezi18n( 'design/admin/pagelayout',
00066 'Manage customers, orders, discounts and VAT types; view sales statistics.' ) ),
00067 'design' => array( 'name' => ezi18n( 'design/admin/pagelayout',
00068 'Design' ),
00069 'tooltip'=> ezi18n( 'design/admin/pagelayout',
00070 'Manage templates, menus, toolbars and other things related to appearence.' ) ),
00071 'setup' => array( 'name' => ezi18n( 'design/admin/pagelayout',
00072 'Setup' ),
00073 'tooltip'=> ezi18n( 'design/admin/pagelayout',
00074 'Configure settings and manage advanced functionality.' ) ),
00075 'my_account' => array( 'name' => ezi18n( 'design/admin/pagelayout',
00076 'My account' ),
00077 'tooltip'=> ezi18n( 'design/admin/pagelayout',
00078 'Manage items and settings that belong to your account.' ) ) );
00079 }
00080
00081
00082
00083
00084 function &operatorList()
00085 {
00086 return $this->Operators;
00087 }
00088
00089
00090
00091
00092 function namedParameterList()
00093 {
00094 return array( 'context' => array( 'type' => 'string',
00095 'required' => true,
00096 'default' => 'content' ) );
00097 }
00098
00099
00100
00101 function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters )
00102 {
00103
00104 $ini =& eZINI::instance( 'menu.ini' );
00105
00106 if ( !$ini->hasVariable( 'TopAdminMenu', 'Tabs' ) )
00107 {
00108 eZDebug::writeError( "Top Admin menu is not configured. Ini setting [TopAdminMenu] Tabs[] is missing" );
00109 $operatorValue = array();
00110 return;
00111 }
00112
00113 $context = $namedParameters['context'];
00114
00115 $tabIDs = $ini->variable( 'TopAdminMenu', 'Tabs' );
00116
00117 $menu = array();
00118
00119 foreach ( $tabIDs as $tabID )
00120 {
00121 $shownList = $ini->variable( 'Topmenu_' . $tabID , "Shown" );
00122 if ( isset( $shownList[$context] ) && $shownList[$context] === 'false' )
00123 {
00124 continue;
00125 }
00126
00127 $menuItem = array();
00128 $urlList = $ini->variable( 'Topmenu_' . $tabID , "URL" );
00129 if ( isset( $urlList[$context] ) )
00130 {
00131 $menuItem['url'] = $urlList[$context];
00132 }
00133 else
00134 {
00135 $menuItem['url'] = $urlList['default'];
00136 }
00137
00138 $enabledList = $ini->variable( 'Topmenu_' . $tabID , "Enabled" );
00139 if ( isset( $enabledList[$context] ) )
00140 {
00141 if ( $enabledList[$context] == 'true' )
00142 $menuItem['enabled'] = true;
00143 else
00144 $menuItem['enabled'] = false;
00145 }
00146 else
00147 {
00148 if ( $enabledList['default'] == true )
00149 $menuItem['enabled'] = true;
00150 else
00151 $menuItem['enabled'] = false;
00152 }
00153
00154 if ( $ini->hasVariable( 'Topmenu_' . $tabID , 'Name' ) && $ini->variable( 'Topmenu_' . $tabID , "Name" ) != '' )
00155 {
00156 $menuItem['name'] = $ini->variable( 'Topmenu_' . $tabID , "Name" );
00157 }
00158 else
00159 {
00160 $menuItem['name'] = $this->DefaultNames[$tabID]['name'];
00161 }
00162 if ( $ini->hasVariable( 'Topmenu_' . $tabID , 'Tooltip' ) && $ini->variable( 'Topmenu_' . $tabID , "Tooltip" ) != '' )
00163 {
00164 $menuItem['tooltip'] = $ini->variable( 'Topmenu_' . $tabID , "Tooltip" );
00165 }
00166 else
00167 {
00168 $menuItem['tooltip'] = isset( $this->DefaultNames[$tabID]['tooltip'] ) ? $this->DefaultNames[$tabID]['tooltip'] : '';
00169 }
00170 $menuItem['navigationpart_identifier'] = $ini->variable( 'Topmenu_' . $tabID , "NavigationPartIdentifier" );
00171 $menuItem['position'] = 'middle';
00172 $menu[] = $menuItem;
00173
00174 }
00175 $menu[0]['position'] = 'first';
00176 $menu[count($menu) - 1]['position'] = 'last';
00177
00178 $operatorValue = $menu;
00179 }
00180
00181
00182 var $Operators;
00183 var $DefaultNames;
00184 }
00185
00186
00187 ?>