Forums / Developer / fetch('collaboration', 'item_list', hash(...))

fetch('collaboration', 'item_list', hash(...))

Author Message

Fabien Audin

Monday 12 April 2010 12:30:03 am

Hi,

I have this line : fetch('collaboration', 'item_list', hash(...)).

But this line returns only content that current user have created. I want to have all content waiting for approval. Where is the script which get these information?

Thank you in advance

Fabien Audin

Wednesday 14 April 2010 5:58:09 am

Do you have any idea about the script location?

(the script which get the pending objects)

Thank you

Nicolas Pastorino

Friday 16 April 2010 12:50:40 am

"

Do you have any idea about the script location?

(the script which get the pending objects)

"

Hello Fabien,

The fetch function used is provided by the 'collaboration' module. This means the fetch function definition will be found in the module's directory, under kernel/collaboration, in a file called 'function_definition.php' (this is the standard structure, which you can obviously apply to your custom modules). The definition of the fetch function is as follows (eZ Publish 4.2) :

$FunctionList['item_list'] = array( 'name' => 'item_list',
                                    'operation_types' => array( 'read' ),
                                    'call_method' => array( 'class' => 'eZCollaborationFunctionCollection',
                                                            'method' => 'fetchItemList' ),
                                    'parameter_type' => 'standard',
                                    'parameters' => array( array( 'name' => 'sort_by',
                                                                  'required' => false,
                                                                  'default' => false ),
                                                           array( 'name' => 'offset',
                                                                  'required' => false,
                                                                  'default' => false ),
                                                           array( 'name' => 'limit',
                                                                  'required' => false,
                                                                  'default' => false ),
                                                           array( 'name' => 'status',
                                                                  'required' => false,
                                                                  'default' => false ),
                                                           array( 'name' => 'is_read',
                                                                  'required' => false,
                                                                  'default' => null ),
                                                           array( 'name' => 'is_active',
                                                                  'required' => false,
                                                                  'default' => null ),
                                                           array( 'name' => 'parent_group_id',
                                                                  'required' => false,
                                                                  'default' => null ) ) );

This tells you that the class involved is 'eZCollaborationFunctionCollection' and the method 'fetchItemList', found in the 'kernel/collaboration/ezcollaborationfunctioncollection.php' file. You mat want to have a look there!

Cheers, and let us know how you are progressing,

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Fabien Audin

Monday 19 April 2010 1:49:54 am

Thank you very much Nicolas,

For my first problem, I had to write this line :

{def $latest_item_list=fetch("collaboration","item_list", hash("is_active",true(), "status", array(1)))}

to get only objects with status = 1.

My second problem is that this function get objects which are created by the current logged in user. But I want objects created by everyone. I'll have a look on files you told me. I'll reply when I have found.

Thanks a lot

Fabien Audin

Monday 19 April 2010 6:20:12 am

I have found the solution for my second problem. I have changed one thing in the file ezcollaborationitem.php line 459 :

$userID = eZUser::currentUserID();

by

$userID = the administrator's node_id

because each created object is linked to the administrator user in the ezpublish's database.