[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

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

   1  <?php
   2  //
   3  // Definition of Bookmark class
   4  //
   5  // Created on: <30-Apr-2003 13:46:01 sp>
   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  /*! \file bookmark.php
  30  */
  31  include_once ( 'kernel/common/template.php' );
  32  include_once ( 'kernel/classes/ezcontentobjecttreenode.php' );
  33  include_once ( 'kernel/classes/ezcontentbrowse.php' );
  34  include_once ( 'kernel/classes/ezcontentbrowsebookmark.php' );
  35  include_once ( "lib/ezdb/classes/ezdb.php" );
  36  
  37  $Module =& $Params['Module'];
  38  $http =& eZHTTPTool::instance();
  39  
  40  $Offset = $Params['Offset'];
  41  $viewParameters = array( 'offset' => $Offset );
  42  
  43  $user =& eZUser::currentUser();
  44  $userID = $user->id();
  45  
  46  if ( $Module->isCurrentAction( 'Remove' )  )
  47  {
  48      if ( $Module->hasActionParameter( 'DeleteIDArray' ) )
  49      {
  50          $deleteIDArray = $Module->actionParameter( 'DeleteIDArray' );
  51  
  52          foreach ( $deleteIDArray as $deleteID )
  53          {
  54              $bookmark = eZContentBrowseBookmark::fetch( $deleteID );
  55              if ( $bookmark === null )
  56                  continue;
  57              $bookmark->remove();
  58          }
  59      }
  60      if ( $http->hasPostVariable( 'NeedRedirectBack' ) and $http->hasSessionVariable( "LastAccessesURI" ) )
  61      {
  62          $Module->redirectTo( $http->sessionVariable( "LastAccessesURI" ) );
  63          return;
  64      }
  65  }
  66  else if ( $Module->isCurrentAction( 'Add' )  )
  67  {
  68      return eZContentBrowse::browse( array( 'action_name' => 'AddBookmark',
  69                                             'description_template' => 'design:content/browse_bookmark.tpl',
  70                                             'from_page' => "/content/bookmark" ),
  71                                      $Module );
  72  }
  73  else if ( $Module->isCurrentAction( 'AddBookmark' )  )
  74  {
  75      $nodeList = eZContentBrowse::result( 'AddBookmark' );
  76      if ( $nodeList )
  77      {
  78          $db =& eZDB::instance();
  79          $db->begin();
  80          foreach ( $nodeList as $nodeID )
  81          {
  82              $node = eZContentObjectTreeNode::fetch( $nodeID );
  83              if ( $node )
  84              {
  85                  $nodeName = $node->attribute( 'name' );
  86                  eZContentBrowseBookmark::createNew( $userID, $nodeID, $nodeName );
  87              }
  88          }
  89          $db->commit();
  90      }
  91  }
  92  
  93  $tpl =& templateInit();
  94  $tpl->setVariable('view_parameters', $viewParameters );
  95  
  96  $Result = array();
  97  $Result['content'] =& $tpl->fetch( 'design:content/bookmark.tpl' );
  98  $Result['path'] = array( array( 'text' => ezi18n( 'kernel/content', 'My bookmarks' ),
  99                                  'url' => false ) );
 100  
 101  
 102  ?>


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