[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

/kernel/content/ -> removenode.php (source)

   1  <?php
   2  //
   3  // Created on: <12-îÏÑ-2002 16:14:13 sp>
   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  /*! \file removenode.php
  28  */
  29  
  30  include_once ( 'lib/ezutils/classes/ezhttptool.php' );
  31  include_once ( 'kernel/common/template.php' );
  32  include_once ( 'kernel/common/i18n.php' );
  33  include_once ( 'kernel/classes/ezcontentobject.php' );
  34  include_once ( 'kernel/classes/ezcontentobjectversion.php' );
  35  include_once ( 'kernel/classes/ezcontentobjectattribute.php' );
  36  include_once ( 'kernel/classes/ezcontentobjecttreenode.php' );
  37  
  38  $http =& eZHTTPTool::instance();
  39  
  40  $tpl =& templateInit();
  41  
  42  $Module =& $Params['Module'];
  43  $ObjectID = $Params['ObjectID'];
  44  
  45  $NodeID = $Params['NodeID'];
  46  if ( !isset( $EditVersion ) )
  47      $EditVersion =& $Params['EditVersion'];
  48  
  49  $object =& eZContentObject::fetch( $ObjectID );
  50  if ( $object === null )
  51      return $Module->handleError( EZ_ERROR_KERNEL_NOT_AVAILABLE, 'kernel' );
  52  
  53  if ( !$object->attribute( 'can_remove' ) )
  54      return $Module->handleError( EZ_ERROR_KERNEL_ACCESS_DENIED, 'kernel' );
  55  
  56  $version =& $object->version( $EditVersion );
  57  $node = eZContentObjectTreeNode::fetchNode( $ObjectID, $NodeID );
  58  if ( $node !== null )
  59      $ChildObjectsCount = $node->subTreeCount();
  60  else
  61      $ChildObjectsCount = 0;
  62  $ChildObjectsCount .= " ";
  63  if ( $ChildObjectsCount == 1 )
  64      $ChildObjectsCount .= ezi18n( 'kernel/content/removenode',
  65                                    'child',
  66                                    '1 child' );
  67  else
  68      $ChildObjectsCount .= ezi18n( 'kernel/content/removenode',
  69                                    'children',
  70                                    'several children' );
  71  
  72  if ( $Module->isCurrentAction( 'ConfirmAssignmentRemove' ) )
  73  {
  74      $nodeID = $http->postVariable( 'RemoveNodeID' ) ;
  75      $version->removeAssignment( $nodeID );
  76      $Module->redirectToView( "edit", array( $ObjectID, $EditVersion ) );
  77  }
  78  elseif ( $Module->isCurrentAction( 'CancelAssignmentRemove' ) )
  79  {
  80      $Module->redirectToView( "edit", array( $ObjectID, $EditVersion ) );
  81  }
  82  
  83  $tpl->setVariable( 'object', $object );
  84  $tpl->setVariable( 'edit_version', $EditVersion );
  85  $tpl->setVariable( 'content_version', $version );
  86  $tpl->setVariable( 'ChildObjectsCount', $ChildObjectsCount );
  87  $tpl->setVariable( 'node', $node );
  88  
  89  
  90  $Result['content'] =& $tpl->fetch( 'design:node/removenode.tpl' );
  91  
  92  $Result['path'] = array( array( 'text' => $object->attribute( 'name' ),
  93                                  'url' => false ) );
  94  
  95  ?>


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