[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/kernel/common/ -> eztopmenuoperator.php (source)

   1  <?php
   2  //
   3  // Definition of eZTopMenuOperator class
   4  //
   5  // Created on: <09-Nov-2004 14:33:28 sp>
   6  //
   7  
   8  // SOFTWARE NAME: eZ publish
   9  // SOFTWARE RELEASE: 3.9.0
  10  // BUILD VERSION: 17785
  11  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
  12  // SOFTWARE LICENSE: GNU General Public License v2.0
  13  // NOTICE: >
  14  //   This program is free software; you can redistribute it and/or
  15  //   modify it under the terms of version 2.0  of the GNU General
  16  //   Public License as published by the Free Software Foundation.
  17  //
  18  //   This program is distributed in the hope that it will be useful,
  19  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  20  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21  //   GNU General Public License for more details.
  22  //
  23  //   You should have received a copy of version 2.0 of the GNU General
  24  //   Public License along with this program; if not, write to the Free
  25  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  26  //   MA 02110-1301, USA.
  27  //
  28  //
  29  
  30  /*! \file eztopmenuoperator.php
  31  */
  32  
  33  /*!
  34    \class eZTopMenuOperator eztopmenuoperator.php
  35    \brief The class eZTopMenuOperator does
  36  
  37  */
  38  include_once ( 'kernel/common/i18n.php' );
  39  
  40  class eZTopMenuOperator
  41  {
  42      /*!
  43       Constructor
  44      */
  45      function eZTopMenuOperator( $name = 'topmenu' )
  46      {
  47          $this->Operators = array( $name );
  48          $this->DefaultNames = array(
  49              'content' => array( 'name' => ezi18n( 'design/admin/pagelayout',
  50                                                    'Content structure' ),
  51                                  'tooltip'=> ezi18n( 'design/admin/pagelayout',
  52                                                      'Manage the main content structure of the site.' ) ),
  53              'media' => array( 'name' => ezi18n( 'design/admin/pagelayout',
  54                                                  'Media library' ),
  55                                'tooltip'=> ezi18n( 'design/admin/pagelayout',
  56                                                    'Manage images, files, documents, etc.' ) ),
  57              'users' => array( 'name' => ezi18n( 'design/admin/pagelayout',
  58                                                  'User accounts' ),
  59                                'tooltip'=> ezi18n( 'design/admin/pagelayout',
  60                                                    'Manage users, user groups and permission settings.' ) ),
  61              'shop' => array( 'name' => ezi18n( 'design/admin/pagelayout',
  62                                                 'Webshop' ),
  63                               'tooltip'=> ezi18n( 'design/admin/pagelayout',
  64                                                   'Manage customers, orders, discounts and VAT types; view sales statistics.' ) ),
  65              'design' => array( 'name' => ezi18n( 'design/admin/pagelayout',
  66                                                   'Design' ),
  67                                 'tooltip'=> ezi18n( 'design/admin/pagelayout',
  68                                                     'Manage templates, menus, toolbars and other things related to appearence.' ) ),
  69              'setup' => array( 'name' => ezi18n( 'design/admin/pagelayout',
  70                                                  'Setup' ),
  71                                'tooltip'=> ezi18n( 'design/admin/pagelayout',
  72                                                    'Configure settings and manage advanced functionality.' ) ),
  73              'my_account' => array( 'name' => ezi18n( 'design/admin/pagelayout',
  74                                                       'My account' ),
  75                                     'tooltip'=> ezi18n( 'design/admin/pagelayout',
  76                                                         'Manage items and settings that belong to your account.' ) ) );
  77      }
  78  
  79      /*!
  80       Returns the operators in this class.
  81      */
  82      function &operatorList()
  83      {
  84          return $this->Operators;
  85      }
  86  
  87      /*!
  88       See eZTemplateOperator::namedParameterList()
  89      */
  90      function namedParameterList()
  91      {
  92          return array( 'context' => array( 'type' => 'string',
  93                                            'required' => true,
  94                                            'default' => 'content' ) );
  95      }
  96      /*!
  97       \reimp
  98      */
  99      function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters )
 100      {
 101  
 102          $ini =& eZINI::instance( 'menu.ini' );
 103  
 104          if ( !$ini->hasVariable( 'TopAdminMenu', 'Tabs' ) )
 105          {
 106              eZDebug::writeError( "Top Admin menu is not configured. Ini  setting [TopAdminMenu] Tabs[] is missing" );
 107              $operatorValue = array();
 108              return;
 109          }
 110  
 111          $context = $namedParameters['context'];
 112  
 113          $tabIDs = $ini->variable( 'TopAdminMenu', 'Tabs' );
 114  
 115          $menu = array();
 116  
 117          foreach ( $tabIDs as $tabID )
 118          {
 119              $shownList = $ini->variable( 'Topmenu_' . $tabID , "Shown" );
 120              if ( isset( $shownList[$context] ) && $shownList[$context] === 'false' )
 121              {
 122                  continue;
 123              }
 124  
 125              $menuItem = array();
 126              $urlList = $ini->variable( 'Topmenu_' . $tabID , "URL" );
 127              if ( isset( $urlList[$context] ) )
 128              {
 129                  $menuItem['url'] = $urlList[$context];
 130              }
 131              else
 132              {
 133                  $menuItem['url'] = $urlList['default'];
 134              }
 135  
 136              $enabledList = $ini->variable( 'Topmenu_' . $tabID , "Enabled" );
 137              if ( isset( $enabledList[$context] ) )
 138              {
 139                  if ( $enabledList[$context] == 'true' )
 140                      $menuItem['enabled'] = true;
 141                  else
 142                      $menuItem['enabled'] = false;
 143              }
 144              else
 145              {
 146                  if ( $enabledList['default'] == true )
 147                      $menuItem['enabled'] = true;
 148                  else
 149                      $menuItem['enabled'] = false;
 150              }
 151  
 152              if ( $ini->hasVariable( 'Topmenu_' . $tabID , 'Name' ) &&  $ini->variable( 'Topmenu_' . $tabID , "Name" ) != '' )
 153              {
 154                  $menuItem['name'] = $ini->variable( 'Topmenu_' . $tabID , "Name" );
 155              }
 156              else
 157              {
 158                  $menuItem['name'] = $this->DefaultNames[$tabID]['name'];
 159              }
 160              if ( $ini->hasVariable( 'Topmenu_' . $tabID , 'Tooltip' ) &&  $ini->variable( 'Topmenu_' . $tabID , "Tooltip" ) != '' )
 161              {
 162                  $menuItem['tooltip'] =  $ini->variable( 'Topmenu_' . $tabID , "Tooltip" );
 163              }
 164              else
 165              {
 166                  $menuItem['tooltip'] = isset( $this->DefaultNames[$tabID]['tooltip'] ) ? $this->DefaultNames[$tabID]['tooltip'] : '';
 167              }
 168              $menuItem['navigationpart_identifier'] =  $ini->variable( 'Topmenu_' . $tabID , "NavigationPartIdentifier" );
 169              $menuItem['position'] = 'middle';
 170              $menu[] = $menuItem;
 171  
 172          }
 173          $menu[0]['position'] = 'first';
 174          $menu[count($menu) - 1]['position'] = 'last';
 175  
 176          $operatorValue = $menu;
 177      }
 178  
 179      /// \privatesection
 180      var $Operators;
 181      var $DefaultNames;
 182  }
 183  
 184  
 185  ?>


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7