[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

/kernel/role/ -> list.php (source)

   1  <?php
   2  //
   3  // Created on: <15-Aug-2002 14:37:29 bf>
   4  //
   5  // SOFTWARE NAME: eZ publish
   6  // SOFTWARE RELEASE: 3.9.0
   7  // BUILD VERSION: 17785
   8  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
   9  // SOFTWARE LICENSE: GNU General Public License v2.0
  10  // NOTICE: >
  11  //   This program is free software; you can redistribute it and/or
  12  //   modify it under the terms of version 2.0  of the GNU General
  13  //   Public License as published by the Free Software Foundation.
  14  //
  15  //   This program is distributed in the hope that it will be useful,
  16  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  17  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18  //   GNU General Public License for more details.
  19  //
  20  //   You should have received a copy of version 2.0 of the GNU General
  21  //   Public License along with this program; if not, write to the Free
  22  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  23  //   MA 02110-1301, USA.
  24  //
  25  //
  26  
  27  include_once ( 'kernel/classes/ezcontentobject.php' );
  28  include_once ( 'kernel/classes/ezcontentobjecttreenode.php' );
  29  include_once ( 'kernel/classes/ezcontentclass.php' );
  30  include_once ( 'kernel/classes/ezcontentbrowse.php' );
  31  include_once ( 'kernel/common/template.php' );
  32  include_once ( 'kernel/classes/ezrole.php' );
  33  include_once ( 'kernel/classes/ezpreferences.php' );
  34  
  35  $http =& eZHTTPTool::instance();
  36  
  37  
  38  $Module =& $Params['Module'];
  39  
  40  $offset = $Params['Offset'];
  41  
  42  if( eZPreferences::value( 'admin_role_list_limit' ) )
  43  {
  44      switch( eZPreferences::value( 'admin_role_list_limit' ) )
  45      {
  46          case '2': { $limit = 25; } break;
  47      case '3': { $limit = 50; } break;
  48      default:  { $limit = 10; } break;
  49      }
  50  }
  51  else
  52  {
  53      $limit = 10;
  54  }
  55  
  56  if ( $http->hasPostVariable( 'RemoveButton' )  )
  57  {
  58     if ( $http->hasPostVariable( 'DeleteIDArray' ) )
  59      {
  60          $deleteIDArray = $http->postVariable( 'DeleteIDArray' );
  61          $db =& eZDB::instance();
  62          $db->begin();
  63          foreach ( $deleteIDArray as $deleteID )
  64          {
  65              eZRole::remove( $deleteID );
  66          }
  67          // Clear role caches.
  68          eZRole::expireCache();
  69  
  70          // Clear all content cache.
  71          include_once ( 'kernel/classes/ezcontentcachemanager.php' );
  72          eZContentCacheManager::clearAllContentCache();
  73  
  74          $db->commit();
  75      }
  76  }
  77  // Redirect to content node browse in the user tree
  78  // Assign the role for a user or group
  79  if ( $Module->isCurrentAction( 'AssignRole' ) )
  80  {
  81      $selectedObjectIDArray = eZContentBrowse::result( 'AssignRole' );
  82  
  83      foreach ( $selectedObjectIDArray as $objectID )
  84      {
  85          $role->assignToUser( $objectID );
  86      }
  87      // Clear role caches.
  88      eZRole::expireCache();
  89  
  90      // Clear all content cache.
  91      include_once ( 'kernel/classes/ezcontentcachemanager.php' );
  92      eZContentCacheManager::clearAllContentCache();
  93  }
  94  
  95  if ( $http->hasPostVariable( 'NewButton' )  )
  96  {
  97      $role = eZRole::createNew( );
  98      return $Module->redirectToView( 'edit', array( $role->attribute( 'id' ) ) );
  99  }
 100  
 101  $viewParameters = array( 'offset' => $offset );
 102  $tpl =& templateInit();
 103  
 104  $roles = eZRole::fetchByOffset( $offset, $limit, $asObject = true, $ignoreTemp = true );
 105  $roleCount = eZRole::roleCount();
 106  $tempRoles = eZRole::fetchList( $temporaryVersions = true );
 107  $tpl->setVariable( 'roles', $roles );
 108  $tpl->setVariable( 'role_count', $roleCount );
 109  $tpl->setVariable( 'temp_roles', $tempRoles );
 110  $tpl->setVariable( 'module', $Module );
 111  $tpl->setVariable( 'view_parameters', $viewParameters );
 112  $tpl->setVariable( 'limit', $limit );
 113  
 114  
 115  $Result = array();
 116  $Result['content'] =& $tpl->fetch( 'design:role/list.tpl' );
 117  $Result['path'] = array( array( 'url' => false,
 118                                  'text' => ezi18n( 'kernel/role', 'Role list' ) ) );
 119  ?>


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