Forums / Developer / custom action and collected informations

custom action and collected informations

Author Message

sergio da silva

Monday 12 January 2009 2:53:21 am

Hello,

i created a custom action for a form which works:

In "<b>extension\ezdoubleposting\settings\content.ini.append.php</b>", i have:

<?php /*

[ActionSettings]
ExtensionDirectories[]=ezdoubleposting
*/ ?>

and in "<b>extension\ezdoubleposting\actions\content_actionhandler.php</b>", i have:

<?php
include_once( 'lib/ezutils/classes/ezoperationhandler.php' );

function ezdoubleposting_ContentActionHandler( &$module, &$http, &$objectID ) 
{ 
   if( $http->hasPostVariable("CustomAction") ) 
   { 
     // code for a doubleposting
     .
     .
     .
     //code for the informations collection
     return $module->run( "collectinformation", array() );
   } 
} ?>

The doubleposting is working but now, i would like to do the doubleposting <b>and</b> to collect informations into EZPublish and i don't manage to do the last one.

I tried to create a module:

"<b>extension\ezdoubleposting\modules\ezdoubleposting\module.php</b>"

<?php
$Module = array( 'name' => 'ezdoubleposting' );

$ViewList = array();

$ViewList['collectinformation'] = array(
    'functions' => array( 'read' ),
    'default_navigation_part' => 'ezcontentnavigationpart',
    'script' => 'collectinformation.php',
    'single_post_actions' => array( 'CustomAction' => 'CollectInformation' ),
    'post_action_parameters' => array( 'CollectInformation' => array( 'ContentObjectID' => 'ContentObjectID',
                                                                      'ContentNodeID' => 'ContentNodeID',
                                                                      'ViewMode' => 'ViewMode' ) ),
    'params' => array(  ) );?>

And in "<b>extension\ezdoubleposting\modules\collectinformation.php</b>", i put exactly the same code as in the "kernel\content\collectinformation.php" file:

<?php
//
// Created on: <21-Nov-2002 18:27:06 bf>
//
// SOFTWARE NAME: eZ Publish
// SOFTWARE RELEASE: 4.0.1
// BUILD VERSION: 22260
// COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS
// SOFTWARE LICENSE: GNU General Public License v2.0
// NOTICE: >
//   This program is free software; you can redistribute it and/or
//   modify it under the terms of version 2.0  of the GNU General
//   Public License as published by the Free Software Foundation.
//
//   This program is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU General Public License for more details.
//
//   You should have received a copy of version 2.0 of the GNU General
//   Public License along with this program; if not, write to the Free
//   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
//   MA 02110-1301, USA.
//
//

//include_once( 'kernel/classes/ezinformationcollection.php' );
//include_once( 'kernel/classes/datatypes/ezuser/ezuser.php' );
//include_once( "lib/ezdb/classes/ezdb.php" );
//include_once( 'lib/ezutils/classes/ezmail.php' );
//include_once( 'lib/ezutils/classes/ezmailtransport.php' );
require_once( 'kernel/common/template.php' );

$Module = $Params['Module'];
$http = eZHTTPTool::instance();

if ( $Module->isCurrentAction( 'CollectInformation' ) )
{
    $ObjectID = $Module->actionParameter( 'ContentObjectID' );
    .
    .
    .
    return eZModule::HOOK_STATUS_CANCEL_RUN;
}

?>

And i add in the "<b>extension\ezdoubleposting\settings\content.ini.append.php</b>" file

[ModuleSettings]
ExtensionRepositories[]=ezdoubleposting

And it doesn't work :( (the doubleposting works but not the informations collector)

Someone already tried to do that?? I need help, please

Thank you