[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

/kernel/visual/ -> menuconfig.php (source)

   1  <?php
   2  //
   3  // Definition of Menuconfig class
   4  //
   5  // Created on: <05-Mar-2004 14:34:34 bf>
   6  //
   7  // SOFTWARE NAME: eZ publish
   8  // SOFTWARE RELEASE: 3.9.0
   9  // BUILD VERSION: 17785
  10  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
  11  // SOFTWARE LICENSE: GNU General Public License v2.0
  12  // NOTICE: >
  13  //   This program is free software; you can redistribute it and/or
  14  //   modify it under the terms of version 2.0  of the GNU General
  15  //   Public License as published by the Free Software Foundation.
  16  //
  17  //   This program is distributed in the hope that it will be useful,
  18  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  19  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20  //   GNU General Public License for more details.
  21  //
  22  //   You should have received a copy of version 2.0 of the GNU General
  23  //   Public License along with this program; if not, write to the Free
  24  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  25  //   MA 02110-1301, USA.
  26  //
  27  //
  28  
  29  $http =& eZHTTPTool::instance();
  30  $module =& $Params["Module"];
  31  
  32  include_once ( 'lib/ezutils/classes/ezhttptool.php' );
  33  include_once ( 'lib/ezfile/classes/ezdir.php' );
  34  include_once ( "kernel/common/template.php" );
  35  include_once ( "kernel/classes/ezsiteaccess.php" );
  36  
  37  $ini =& eZINI::instance();
  38  $tpl =& templateInit();
  39  
  40  if ( $module->isCurrentAction( 'SelectCurrentSiteAccess' ) )
  41  {
  42      if ( $http->hasPostVariable( 'CurrentSiteAccess' ) )
  43      {
  44          $http->setSessionVariable( 'eZTemplateAdminCurrentSiteAccess', $http->postVariable( 'CurrentSiteAccess' ) );
  45      }
  46  }
  47  
  48  $siteAccessList = $ini->variable( 'SiteAccessSettings', 'AvailableSiteAccessList' );
  49  $siteAccess = false;
  50  
  51  // Fetch siteaccess settings for the selected override
  52  // Default to first defined siteacces if none are selected
  53  if ( $http->hasSessionVariable( 'eZTemplateAdminCurrentSiteAccess' ) )
  54      $siteAccess = $http->sessionVariable( 'eZTemplateAdminCurrentSiteAccess' );
  55  
  56  if ( !in_array( $siteAccess, $siteAccessList ) )
  57      $siteAccess = $siteAccessList[0];
  58  
  59  if ( $http->hasPostVariable( 'SelectCurrentSiteAccessButton' ) )
  60  {
  61      $http->setSessionVariable( 'eZTemplateAdminCurrentSiteAccess', $siteAccess );
  62  }
  63  
  64  // Get path to specified site access.
  65  $pathToSiteAccess = eZSiteAccess::findPathToSiteAccess( $siteAccess );
  66  $menuINI =& eZINI::instance( "menu.ini","",null,null, true );
  67  $menuINI->prependOverrideDir( $pathToSiteAccess, true, 'siteaccess' );
  68  $menuINI->loadCache();
  69  
  70  /*$iniPath = "settings/siteaccess/$siteAccess";
  71  $menuINI = eZINI::instance( 'menu.ini.append.php', $iniPath, null, false, null, true );*/
  72  
  73  if ( $module->isCurrentAction( 'Store' ) )
  74  {
  75      $menuType = $http->postVariable( 'MenuType' );
  76  
  77      $menuINI->setVariable( 'SelectedMenu', 'CurrentMenu', $menuType );
  78      $menuINI->setVariable( 'SelectedMenu', 'TopMenu', $menuINI->variable( $menuType, "TopMenu" ) );
  79      $menuINI->setVariable( 'SelectedMenu', 'LeftMenu', $menuINI->variable( $menuType, "LeftMenu" ) );
  80  
  81      $menuINI->save( "menu.ini.append.php", false, false, false, $pathToSiteAccess, true );
  82  
  83      // Delete compiled template
  84      $iniPath = $pathToSiteAccess;
  85      $siteINI = eZINI::instance( 'site.ini.append', $iniPath );
  86      if ( $siteINI->hasVariable( 'FileSettings', 'CacheDir' ) )
  87      {
  88          $cacheDir = $siteINI->variable( 'FileSettings', 'CacheDir' );
  89          if ( $cacheDir[0] == "/" )
  90          {
  91              $cacheDir = eZDir::path( array( $cacheDir ) );
  92          }
  93          else
  94          {
  95              if ( $siteINI->hasVariable( 'FileSettings', 'VarDir' ) )
  96              {
  97                  $varDir = $siteINI->variable( 'FileSettings', 'VarDir' );
  98                  $cacheDir = eZDir::path( array( $varDir, $cacheDir ) );
  99              }
 100          }
 101      }
 102      else if ( $siteINI->hasVariable( 'FileSettings', 'VarDir' ) )
 103      {
 104           $varDir = $siteINI->variable( 'FileSettings', 'VarDir' );
 105           $cacheDir = $ini->variable( 'FileSettings', 'CacheDir' );
 106           $cacheDir = eZDir::path( array( $varDir, $cacheDir ) );
 107      }
 108      else
 109      {
 110          $cacheDir =  eZSys::cacheDirectory();
 111      }
 112      $compiledTemplateDir = $cacheDir ."/template/compiled";
 113      eZDir::unlinkWildcard( $compiledTemplateDir . "/", "*pagelayout*.*" );
 114  
 115      // Expire template block cache
 116      include_once ( 'kernel/classes/ezcontentcachemanager.php' );
 117      eZContentCacheManager::clearTemplateBlockCacheIfNeeded( false );
 118  }
 119  
 120  $availableMenuArray = $menuINI->variable( 'MenuSettings', 'AvailableMenuArray' );
 121  
 122  $menuArray = array();
 123  foreach ( $availableMenuArray as $menuType )
 124  {
 125      $menuArray[] = array( 'type' => $menuType, 'settings' => $menuINI->group( $menuType ) );
 126  }
 127  
 128  $tpl->setVariable( 'available_menu_array', $menuArray );
 129  $tpl->setVariable( 'current_menu', $menuINI->variable( 'SelectedMenu', 'CurrentMenu' ) );
 130  $tpl->setVariable( 'siteaccess_list', $siteAccessList );
 131  
 132  $tpl->setVariable( 'current_siteaccess', $siteAccess );
 133  
 134  $Result = array();
 135  $Result['content'] =& $tpl->fetch( "design:visual/menuconfig.tpl" );
 136  $Result['path'] = array( array( 'url' => false,
 137                                  'text' => ezi18n( 'design/standard/menuconfig', 'Menu management' ) ) );
 138  
 139  ?>


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