[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

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

   1  <?php
   2  //
   3  // Created on: <18-Jul-2002 10:55:01 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  
  30  include_once ( 'kernel/classes/ezcontentbrowse.php' );
  31  
  32  include_once ( 'lib/ezutils/classes/ezhttptool.php' );
  33  
  34  include_once ( 'kernel/common/template.php' );
  35  
  36  $tpl =& templateInit();
  37  $http =& eZHTTPTool::instance();
  38  
  39  $browse = new eZContentBrowse();
  40  
  41  $Offset = $Params['Offset'];
  42  
  43  if ( !is_numeric( $Offset ) )
  44      $Offset = 0;
  45  
  46  $parents = array();
  47  
  48  // We get node list when browse is execiuted from search engine ( "search in browse" functionality )
  49  if ( isset( $Params['NodeList'] ) )
  50  {
  51       $nodeList = $Params['NodeList']['SearchResult'];
  52       $nodeListCount = $Params['NodeList']['SearchCount'];
  53       $requestedURI = $Params['NodeList']['RequestedURI'];
  54       $requestedURISuffix = $Params['NodeList']['RequestedURISuffix'];
  55  }
  56  else
  57  {
  58  
  59      if ( isset( $Params['NodeID'] ) && is_numeric( $Params['NodeID'] ) )
  60      {
  61          $NodeID = $Params['NodeID'];
  62          $browse->setStartNode( $NodeID );
  63      }
  64  
  65      $NodeID = $browse->attribute( 'start_node' );
  66  
  67      $node = eZContentObjectTreeNode::fetch( $NodeID );
  68      if ( !$node )
  69          return $Module->handleError( EZ_ERROR_KERNEL_NOT_AVAILABLE, 'kernel' );
  70  
  71      $object =& $node->attribute( 'object' );
  72      if ( !$object )
  73          return $Module->handleError( EZ_ERROR_KERNEL_NOT_AVAILABLE, 'kernel' );
  74  
  75      if ( !$object->attribute( 'can_read' ) || !$node->attribute( 'can_read' ) )
  76      {
  77          if ( !$node->attribute( 'children_count' ) )
  78          {
  79              return $Module->handleError( EZ_ERROR_KERNEL_ACCESS_DENIED, 'kernel' );
  80          }
  81      }
  82      $parents = $node->attribute( 'path' );
  83  }
  84  
  85  $cancelAction = trim( $browse->attribute( 'cancel_page' ) );
  86  if ( $cancelAction == trim( $browse->attribute( 'from_page' ) ) )
  87  {
  88      $cancelAction = false;
  89  }
  90  
  91  $res =& eZTemplateDesignResource::instance();
  92  
  93  $keyArray = array();
  94  if ( $browse->hasAttribute( 'keys' ) )
  95  {
  96      $attributeKeys = $browse->attribute( 'keys' );
  97      if ( is_array( $attributeKeys ) )
  98      {
  99          foreach ( $attributeKeys as $attributeKey => $attributeValue )
 100          {
 101              $keyArray[] = array( $attributeKey, $attributeValue );
 102          }
 103      }
 104      $res->setKeys( $keyArray );
 105  }
 106  
 107  
 108  $tpl->setVariable( 'browse', $browse );
 109  $tpl->setVariable( 'csm_menu_item_click_action', '/content/browse' );
 110  $tpl->setVariable( 'cancel_action', $cancelAction );
 111  
 112  if ( isset( $nodeList ) )
 113  {
 114      $tpl->setVariable( 'node_list', $nodeList );
 115      $tpl->setVariable( 'node_list_count', $nodeListCount );
 116      $tpl->setVariable( 'requested_uri', $requestedURI );
 117      $tpl->setVariable( 'requested_uri_suffix', $requestedURISuffix );
 118  }
 119  else
 120  {
 121      $tpl->setVariable( 'main_node', $node );
 122      $tpl->setVariable( 'node_id', $NodeID );
 123      $tpl->setVariable( 'parents', $parents );
 124  }
 125  
 126  if ( isset( $Params['UserParameters'] ) )
 127  {
 128      $UserParameters = $Params['UserParameters'];
 129  }
 130  else
 131  {
 132      $UserParameters = array();
 133  }
 134  $viewParameters = array( 'offset' => $Offset, 'namefilter' => false );
 135  $viewParameters = array_merge( $viewParameters, $UserParameters );
 136  
 137  $tpl->setVariable( 'view_parameters', $viewParameters );
 138  
 139  $tpl->setVariable( 'path', false );
 140  
 141  if (isset( $GLOBALS['eZDesignKeys']['section'] ))
 142  {
 143      $globalSectionID = $GLOBALS['eZDesignKeys']['section'];
 144      unset($GLOBALS['eZDesignKeys']['section']);
 145  }
 146  
 147  
 148  //setting keys for override
 149  $res =& eZTemplateDesignResource::instance();
 150  
 151  $Result = array();
 152  
 153  // Fetch the navigation part from the section information
 154  $Result['navigation_part'] = 'ezcontentnavigationpart';
 155  if ( !isset( $nodeList ) )
 156  {
 157      include_once ( 'kernel/classes/ezsection.php' );
 158      $section = eZSection::fetch( $object->attribute( 'section_id' ) );
 159      if ( $section )
 160      {
 161          $Result['navigation_part'] = $section->attribute( 'navigation_part_identifier' );
 162      }
 163      $Result['node_id'] = $node->attribute( 'node_id' );
 164  
 165      $res->setKeys( array( array( 'object', $object->attribute( 'id' ) ), // Object ID
 166                            array( 'node', $node->attribute( 'node_id' ) ), // Node ID
 167                            array( 'parent_node', $node->attribute( 'parent_node_id' ) ), // Parent Node ID
 168                            array( 'class', $object->attribute( 'contentclass_id' ) ), // Class ID
 169                            array( 'depth', $node->attribute( 'depth' ) ),
 170                            array( 'url_alias', $node->attribute( 'url_alias' ) ),
 171                            array( 'class_identifier', $node->attribute( 'class_identifier' ) ),
 172                            array( 'section', $object->attribute('section_id') )
 173                            ) );
 174  
 175  }
 176  
 177  $res->setKeys( array( array( 'view_offset', $Offset ),
 178                        array( 'navigation_part_identifier', $Result['navigation_part'] )
 179                        ) );
 180  
 181  //$Result['path'] =& $path;
 182  $Result['content'] =& $tpl->fetch( 'design:content/browse.tpl' );
 183  
 184  if (isset( $globalSectionID ))
 185  {
 186      $GLOBALS['eZDesignKeys']['section'] = $globalSectionID;
 187  }
 188  
 189  $templatePath = $tpl->variable( 'path' );
 190  if ( $templatePath )
 191  {
 192      $Result['path'] = $templatePath;
 193  }
 194  elseif ( isset( $nodeList ) )
 195  {
 196      $Result['path'] = array( array( 'text' => ezi18n( 'kernel/content', 'Search' ),
 197                                      'url' => false ) );
 198  }
 199  else
 200  {
 201      $path = array();
 202      foreach ( $parents as $parent )
 203      {
 204          $path[] = array( 'text' => $parent->attribute( 'name' ),
 205                           'url' => '/content/browse/' . $parent->attribute( 'node_id' ) . '/'
 206                           );
 207      }
 208      $path[] = array( 'text' => $object->attribute( 'name' ),
 209                       'url' => false );
 210      $Result['path'] = $path;
 211  }
 212  
 213  
 214  ?>


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