eZ Publish  [4.0]
eznavigationpart.php
Go to the documentation of this file.
00001 <?php
00002 //
00003 // Definition of eZNavigationPart class
00004 //
00005 // Created on: <18-Feb-2003 11:38:57 bf>
00006 //
00007 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00008 // SOFTWARE NAME: eZ Publish
00009 // SOFTWARE RELEASE: 4.0.x
00010 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS
00011 // SOFTWARE LICENSE: GNU General Public License v2.0
00012 // NOTICE: >
00013 //   This program is free software; you can redistribute it and/or
00014 //   modify it under the terms of version 2.0  of the GNU General
00015 //   Public License as published by the Free Software Foundation.
00016 //
00017 //   This program is distributed in the hope that it will be useful,
00018 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 //   GNU General Public License for more details.
00021 //
00022 //   You should have received a copy of version 2.0 of the GNU General
00023 //   Public License along with this program; if not, write to the Free
00024 //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00025 //   MA 02110-1301, USA.
00026 //
00027 //
00028 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00029 //
00030 
00031 /*!
00032   \class eZNavigationPart eznavigationpart.php
00033   \brief eZNavigationPart handles grouping of functions across modules
00034   \ingroup eZKernel
00035 
00036   A navigation part is a group of functions which belongs together. Every view can
00037   return the navigation part it should use. It is up to the view to return the
00038   proper navigation part. Views can internally check which navigation part to use,
00039   in the case of content/view the view will check the navigation part set in
00040   the section setup and use this.
00041 
00042   If the view does not return any navigation part it will default to the Content part.
00043 
00044   The navigation parts are controlled by the \c menu.ini file, look for the
00045   \c NavigationPart group.
00046   You can easily add new entries in override files or in extensions by adding
00047   to the \c Part list.
00048 
00049 */
00050 
00051 class eZNavigationPart
00052 {
00053     /*!
00054      \static
00055      Will return the navigation part array if the identifier is valid,
00056      the default will be returned if the identifier is not valid.
00057 
00058      The navigation parts are defined in the INI file \c menu.ini
00059      under the \c NavigationPart group.
00060     */
00061     static function fetchPartByIdentifier( $identifier )
00062     {
00063         $parts = eZNavigationPart::fetchList();
00064 
00065         if ( isset( $parts[$identifier] ) )
00066             return $parts[$identifier];
00067 
00068         // Return the first part which is the default
00069         if ( isset( $parts[0] ) )
00070             return $parts[0];
00071 
00072         return false;
00073     }
00074 
00075     /*!
00076      \static
00077      \return The current list of navigation part identifiers
00078 
00079      \note The list is cached in the global variable \c eZNavigationPartList.
00080     */
00081     static function fetchList()
00082     {
00083         $list =& $GLOBALS['eZNavigationPartList'];
00084         if ( isset( $list ) )
00085             return $list;
00086 
00087         $ini = eZINI::instance( 'menu.ini' );
00088         $parts = $ini->variable( 'NavigationPart', 'Part' );
00089         $list = array();
00090         foreach ( $parts as $identifier => $name )
00091         {
00092             $list[$identifier] = array( 'name' => ezi18n( 'kernel/navigationpart', $name, 'Navigation part' ),
00093                                         'identifier' => $identifier );
00094         }
00095         return $list;
00096     }
00097 
00098     /*!
00099      \private
00100      \note This funtion only exists for the i18n entries to be picked up by ezlupdate.
00101     */
00102     private static function i18nDummy()
00103     {
00104         ezi18n( 'kernel/navigationpart', 'Content structure', 'Navigation part' );
00105         ezi18n( 'kernel/navigationpart', 'Media library', 'Navigation part' );
00106         ezi18n( 'kernel/navigationpart', 'User accounts', 'Navigation part' );
00107         ezi18n( 'kernel/navigationpart', 'Webshop', 'Navigation part' );
00108         ezi18n( 'kernel/navigationpart', 'Design', 'Navigation part' );
00109         ezi18n( 'kernel/navigationpart', 'Setup', 'Navigation part' );
00110         ezi18n( 'kernel/navigationpart', 'My account', 'Navigation part' );
00111     }
00112 
00113 }
00114 
00115 ?>